Skip to content

Commit

Permalink
Fixed the type error bugs
Browse files Browse the repository at this point in the history
Signed-off-by: Priyansh61 <[email protected]>
  • Loading branch information
Priyansh61 committed Sep 6, 2023
1 parent e7ef07f commit 3bf800c
Showing 1 changed file with 40 additions and 4 deletions.
44 changes: 40 additions & 4 deletions system-apps/app-store/zssServer/c/appStoreDataService.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,30 @@ typedef struct AppStoreServiceData_t
uint64 loggingId;
} AppStoreServiceData;

static jsonPrinter *writeSuccess(HttpResponse *response, int rc, char *type) {
int convert = TRUE;
int outCCSID = CCSID_EBCDIC_1047;
int reasonCode = 0;
int translationLength = 0;
char *convertBuffer = safeMalloc(4096, "ConvertBuffer");

if (!strcmp(type, "tar") || !strcmp(type, "pax")){
convert = FALSE;
}

jsonPrinter *p = respondWithJsonPrinter(response);

setResponseStatus(response, 200, "OK");
setDefaultJSONRESTHeaders(response);
writeHeader(response);

jsonStart(p);
jsonStartMultipartString(p, "output");
jsonEndMultipartString(p);
safeFree(convertBuffer, 4096);
return p;
}

static int appStoreDataService(HttpService *service, HttpResponse *response)
{
HttpRequest *request = response->request;
Expand Down Expand Up @@ -80,7 +104,7 @@ static int appStoreDataService(HttpService *service, HttpResponse *response)
// Convert the header for mainframe
char *nativeBody = copyStringToNative(request->slh, inPtr, strlen(inPtr));
int inLen = strlen(nativeBody);
char *errBuf[1024];
char errBuf[1024];

// Checks for the validity of the body if the body is not valid then it will return NULL
Json *body = jsonParseUnterminatedString(
Expand Down Expand Up @@ -116,7 +140,15 @@ static int appStoreDataService(HttpService *service, HttpResponse *response)

if (autoEncodingJson != NULL)
{
autoEncoding = jsonAsBoolean(autoEncodingJson);
if (jsonAsBoolean(autoEncodingJson)) {
char encoding[5];
strcpy(encoding, "yes");
autoEncoding = encoding;
} else {
char encoding[5];
strcpy(encoding, "no");
autoEncoding = encoding;
}
}
else
{
Expand All @@ -128,7 +160,9 @@ static int appStoreDataService(HttpService *service, HttpResponse *response)

if (skipEnableJson != NULL)
{
skipEnable = jsonAsBoolean(skipEnableJson);
if (jsonAsBoolean(skipEnableJson)) {
skipEnable = true;
}
}

if (registryJson == NULL)
Expand All @@ -148,6 +182,8 @@ static int appStoreDataService(HttpService *service, HttpResponse *response)
char *registry = jsonAsString(registryJson);
char *handler = jsonAsString(handlerJson);

char *type = "string";

char cmd[10280];

int bufferPos = 0;
Expand All @@ -172,7 +208,7 @@ static int appStoreDataService(HttpService *service, HttpResponse *response)
"App Store call '%s' ended in rc=%d\n", cmd, retCode);

if (!retCode) {
jsonPrinter *p = writeSuccess(response, retCode, "string");
jsonPrinter *p = writeSuccess(response, retCode, type);
jsonAddInt(p, "rc", retCode);

jsonEnd(p);
Expand Down

0 comments on commit 3bf800c

Please sign in to comment.