fix: change go empty json string to null.

dev_1
Gordon 2 years ago
parent 38f09d3ff7
commit 4ac33129df
  1. 10
      c_cpp_wrapper/protocol.go

@ -3,6 +3,7 @@ package main
/*
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
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')
{

Loading…
Cancel
Save