From 4ac33129dfdc7b38d1493f031ebb02c390c2b18e Mon Sep 17 00:00:00 2001 From: Gordon <46924906+FGadvancer@users.noreply.github.com> Date: Fri, 8 Dec 2023 15:09:17 +0800 Subject: [PATCH] fix: change go empty json string to null. --- c_cpp_wrapper/protocol.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/c_cpp_wrapper/protocol.go b/c_cpp_wrapper/protocol.go index c9aa97e..9b5b065 100644 --- a/c_cpp_wrapper/protocol.go +++ b/c_cpp_wrapper/protocol.go @@ -3,6 +3,7 @@ package main /* #include #include +#include typedef void (*CB_S)(char *); typedef void (*CB_I_S)(int,char *); typedef void (*CB_S_I_S_S)(char *,int,char *,char *); @@ -26,6 +27,9 @@ void Call_CB_I_S(CB_I_S func,int event,char* data) printf("callback func is null\n"); return; } + if (strcmp(data, "\"\"") == 0) { + strcpy(data, ""); + } func(event,data); if (data != NULL && data[0] != '\0') { @@ -39,6 +43,9 @@ void Call_CB_S_I_S_S(CB_S_I_S_S func,char* operationID, int errCode,char* errMsg printf("callback func is null\n"); return; } + if (strcmp(data, "\"\"") == 0) { + strcpy(data, ""); + } func(operationID,errCode,errMsg,data); if (errMsg != NULL && errMsg[0] != '\0') { @@ -62,6 +69,9 @@ void Call_CB_S_I_S_S_I(CB_S_I_S_S_I func,char* operationID,int errCode,char* err printf("callback func is null\n"); return; } + if(strcmp(data, "\"\"") == 0) { + strcpy(data, ""); + } func(operationID,errCode,errMsg,data,progress); if (errMsg != NULL && errMsg[0] != '\0') {