diff --git a/lib/cmock_generator_plugin_return_thru_ptr.rb b/lib/cmock_generator_plugin_return_thru_ptr.rb index 4ecc983..9363e4c 100644 --- a/lib/cmock_generator_plugin_return_thru_ptr.rb +++ b/lib/cmock_generator_plugin_return_thru_ptr.rb @@ -79,7 +79,7 @@ class CMockGeneratorPluginReturnThruPtr arg_name = arg[:name] next unless @utils.ptr_or_str?(arg[:type]) && !(arg[:const?]) - dest_cast = arg[:volatile?] ? '(void*)(uintptr_t)' : '(void*)' + dest_cast = arg[:volatile?] ? '(void*)(CMOCK_MEM_PTR_AS_INT)' : '(void*)' lines << " if (Mock.#{function[:name]}_IgnoreBool && cmock_call_instance != NULL &&\n" lines << " cmock_call_instance->ReturnThruPtr_#{arg_name}_Used)\n" lines << " {\n" @@ -134,7 +134,7 @@ class CMockGeneratorPluginReturnThruPtr arg_name = arg[:name] next unless @utils.ptr_or_str?(arg[:type]) && !(arg[:const?]) - dest_cast = arg[:volatile?] ? '(void*)(uintptr_t)' : '(void*)' + dest_cast = arg[:volatile?] ? '(void*)(CMOCK_MEM_PTR_AS_INT)' : '(void*)' lines << " if (cmock_call_instance->ReturnThruPtr_#{arg_name}_Used)\n" lines << " {\n" lines << " UNITY_TEST_ASSERT_NOT_NULL(#{arg_name}, cmock_line, CMockStringPtrIsNULL);\n" diff --git a/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb b/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb index c6a7a06..f1dfbb0 100644 --- a/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +++ b/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb @@ -252,14 +252,14 @@ describe CMockGeneratorPluginReturnThruPtr, "Verify CMockGeneratorPluginReturnTh assert_equal(expected, returned) end - it "uses (void*)(uintptr_t) cast in mock_implementation for volatile pointer arg" do + it "uses (void*)(CMOCK_MEM_PTR_AS_INT) cast in mock_implementation for volatile pointer arg" do volatile_ptr_func_expect() expected = " if (cmock_call_instance->ReturnThruPtr_foo_handle_Used)\n" + " {\n" + " UNITY_TEST_ASSERT_NOT_NULL(foo_handle, cmock_line, CMockStringPtrIsNULL);\n" + - " CMOCK_MEMCPY((void*)(uintptr_t)foo_handle, (const void*)cmock_call_instance->ReturnThruPtr_foo_handle_Val,\n" + + " CMOCK_MEMCPY((void*)(CMOCK_MEM_PTR_AS_INT)foo_handle, (const void*)cmock_call_instance->ReturnThruPtr_foo_handle_Val,\n" + " cmock_call_instance->ReturnThruPtr_foo_handle_Size);\n" + " }\n"