|
11 | 11 | #include <vector> |
12 | 12 |
|
13 | 13 | static int func_callback_update = 0; |
14 | | -static bool TPCB2Called = false; |
15 | | - |
| 14 | +static int TPCB2Called = 0; |
16 | 15 | class xptiApiTest : public ::testing::Test { |
17 | 16 | protected: |
18 | 17 | void SetUp() override { |
19 | | - TPCB2Called = false; |
| 18 | + TPCB2Called = 0; |
20 | 19 | func_callback_update = 0; |
21 | 20 | } |
22 | 21 |
|
@@ -220,8 +219,8 @@ void trace_point_callback(uint16_t /*trace_type*/, |
220 | 219 | void trace_point_callback2(uint16_t /*trace_type*/, |
221 | 220 | xpti::trace_event_data_t * /*parent*/, |
222 | 221 | xpti::trace_event_data_t * /*event*/, |
223 | | - uint64_t /*instance*/, const void * /*user_data*/) { |
224 | | - TPCB2Called = true; |
| 222 | + uint64_t /*instance*/, const void *user_data) { |
| 223 | + TPCB2Called = *static_cast<const int *>(user_data); |
225 | 224 | } |
226 | 225 |
|
227 | 226 | void fn_callback(uint16_t /*trace_type*/, xpti::trace_event_data_t * /*parent*/, |
@@ -307,13 +306,12 @@ TEST_F(xptiApiTest, xptiNotifySubscribersGoodInput) { |
307 | 306 |
|
308 | 307 | uint8_t StreamID = xptiRegisterStream("foo"); |
309 | 308 | xptiForceSetTraceEnabled(true); |
310 | | - int foo_return = 0; |
| 309 | + int FooUserData = 42; |
311 | 310 | auto Result = xptiRegisterCallback(StreamID, 1, trace_point_callback2); |
312 | 311 | EXPECT_EQ(Result, xpti::result_t::XPTI_RESULT_SUCCESS); |
313 | | - Result = xptiNotifySubscribers(StreamID, 1, nullptr, Event, 0, |
314 | | - (void *)(&foo_return)); |
| 312 | + Result = xptiNotifySubscribers(StreamID, 1, nullptr, Event, 0, &FooUserData); |
315 | 313 | EXPECT_EQ(Result, xpti::result_t::XPTI_RESULT_SUCCESS); |
316 | | - EXPECT_TRUE(TPCB2Called); |
| 314 | + EXPECT_EQ(TPCB2Called, FooUserData); |
317 | 315 | int tmp = func_callback_update; |
318 | 316 | Result = xptiRegisterCallback( |
319 | 317 | StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::function_begin), |
|
0 commit comments