diff --git a/src/lv_interop.cc b/src/lv_interop.cc index e583a024d..64f7608e8 100644 --- a/src/lv_interop.cc +++ b/src/lv_interop.cc @@ -20,8 +20,6 @@ typedef int32_t(*RTSetCleanupProc_T)(grpc_labview::CleanupProcPtr cleanUpProc, g typedef unsigned char** (*DSNewHandlePtr_T)(size_t); typedef int (*DSSetHandleSize_T)(void* h, size_t); typedef long (*DSDisposeHandle_T)(void* h); -typedef int (*ConvertSystemStringToUTF8_T)(grpc_labview::LStrHandle, grpc_labview::LStrHandle *); -typedef int (*ConvertUTF8StringToSystem_T)(grpc_labview::LStrHandle, grpc_labview::LStrHandle *); //--------------------------------------------------------------------- @@ -35,8 +33,6 @@ static std::string ModulePath = ""; static DSNewHandlePtr_T DSNewHandleImpl = nullptr; static DSSetHandleSize_T DSSetHandleSizeImpl = nullptr; static DSDisposeHandle_T DSDisposeHandleImpl = nullptr; -static ConvertSystemStringToUTF8_T ConvertSystemStringToUTF8Impl = nullptr; -static ConvertUTF8StringToSystem_T ConvertUTF8StringToSystemImpl = nullptr; namespace grpc_labview { @@ -87,8 +83,6 @@ namespace grpc_labview DSNewHandleImpl = (DSNewHandlePtr_T)GetProcAddress(lvModule, "DSNewHandle"); DSSetHandleSizeImpl = (DSSetHandleSize_T)GetProcAddress(lvModule, "DSSetHandleSize"); DSDisposeHandleImpl = (DSDisposeHandle_T)GetProcAddress(lvModule, "DSDisposeHandle"); - ConvertSystemStringToUTF8Impl = (ConvertSystemStringToUTF8_T)GetProcAddress(lvModule, "ConvertSystemStringToUTF8"); - ConvertUTF8StringToSystemImpl = (ConvertUTF8StringToSystem_T)GetProcAddress(lvModule, "ConvertUTF8StringToSystem"); } #else @@ -109,8 +103,6 @@ namespace grpc_labview DSNewHandleImpl = (DSNewHandlePtr_T)dlsym(RTLD_DEFAULT, "DSNewHandle"); DSSetHandleSizeImpl = (DSSetHandleSize_T)dlsym(RTLD_DEFAULT, "DSSetHandleSize"); DSDisposeHandleImpl = (DSDisposeHandle_T)dlsym(RTLD_DEFAULT, "DSDisposeHandle"); - ConvertSystemStringToUTF8Impl = (ConvertSystemStringToUTF8_T)dlsym(RTLD_DEFAULT, "ConvertSystemStringToUTF8"); - ConvertUTF8StringToSystemImpl = (ConvertUTF8StringToSystem_T)dlsym(RTLD_DEFAULT, "ConvertUTF8StringToSystem"); } #endif @@ -162,17 +154,9 @@ namespace grpc_labview void SetLVString(LStrHandle* lvString, std::string str) { auto length = str.length(); - - LStrHandle utf8String = nullptr; - auto error = NumericArrayResize(0x01, 1, &utf8String, length); - std::unique_ptr utf8StringDeleter(utf8String, &DSDisposeHandle); - if (error != 0) throw std::bad_alloc(); - - memcpy((*utf8String)->str, str.c_str(), length); - (*utf8String)->cnt = (int)length; - - error = ConvertUTF8StringToSystem(utf8String, lvString); - if (error != 0) throw std::runtime_error("Failed to convert string encoding."); + auto error = NumericArrayResize(0x01, 1, lvString, length); + memcpy((**lvString)->str, str.c_str(), length); + (**lvString)->cnt = (int)length; } //--------------------------------------------------------------------- @@ -184,13 +168,8 @@ namespace grpc_labview return std::string(); } - LStrHandle utf8String = nullptr; - auto error = ConvertSystemStringToUTF8(lvString, &utf8String); - std::unique_ptr utf8StringDeleter(utf8String, &DSDisposeHandle); - if (error != 0) throw std::runtime_error("Failed to convert string encoding."); - - auto count = (*utf8String)->cnt; - auto chars = (*utf8String)->str; + auto count = (*lvString)->cnt; + auto chars = (*lvString)->str; std::string result(chars, count); return result; @@ -239,18 +218,4 @@ namespace grpc_labview return 0x8; // uQ } } - - //--------------------------------------------------------------------- - //--------------------------------------------------------------------- - int ConvertSystemStringToUTF8(LStrHandle stringIn, LStrHandle *stringOut) - { - return ConvertSystemStringToUTF8Impl(stringIn, stringOut); - } - - //--------------------------------------------------------------------- - //--------------------------------------------------------------------- - int ConvertUTF8StringToSystem(LStrHandle stringIn, LStrHandle *stringOut) - { - return ConvertUTF8StringToSystemImpl(stringIn, stringOut); - } } diff --git a/src/lv_interop.h b/src/lv_interop.h index b3ba1de91..f27f31fac 100644 --- a/src/lv_interop.h +++ b/src/lv_interop.h @@ -160,6 +160,4 @@ namespace grpc_labview int SignalOccurrence(MagicCookie occurrence); int32_t RegisterCleanupProc(CleanupProcPtr cleanUpProc, grpc_labview::gRPCid* id, CleanupProcMode cleanupCondition = CleanupProcMode::CleanOnIdle); int32_t DeregisterCleanupProc(CleanupProcPtr cleanUpProc, grpc_labview::gRPCid* id); - int ConvertSystemStringToUTF8(LStrHandle stringIn, LStrHandle *stringOut); - int ConvertUTF8StringToSystem(LStrHandle stringIn, LStrHandle *stringOut); } diff --git a/tests/AutoTests/Test_HelloWorld_Internationalization.vi b/tests/AutoTests/Test_HelloWorld_Internationalization.vi deleted file mode 100644 index a252f53ba..000000000 Binary files a/tests/AutoTests/Test_HelloWorld_Internationalization.vi and /dev/null differ diff --git a/tests/AutoTests/Test_HelloWorld_Utf8Encoding.vi b/tests/AutoTests/Test_HelloWorld_Utf8Encoding.vi deleted file mode 100644 index 5ba8fa487..000000000 Binary files a/tests/AutoTests/Test_HelloWorld_Utf8Encoding.vi and /dev/null differ diff --git a/tests/Tests.lst b/tests/Tests.lst index 0999c767b..319419f13 100644 --- a/tests/Tests.lst +++ b/tests/Tests.lst @@ -1,6 +1,4 @@ AutoTests\Test_HelloWorld.vi -AutoTests\Test_HelloWorld_Internationalization.vi -AutoTests\Test_HelloWorld_Utf8Encoding.vi AutoTests\Test_RouteGuide_Unary.vi AutoTests\Test_RouteGuide_ResponseStreaming.vi AutoTests\Test_RouteGuide_BidirectionalStreaming.vi