Skip to content

Commit

Permalink
[bug] avoid double-base64-encoding when -Z 2 is used, fix #219
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Apr 25, 2024
1 parent 3b7e11c commit ea67ea9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/mcx_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -4476,7 +4476,12 @@ int mcx_jdataencode(void* vol, int ndim, uint* dims, char* type, int byte, int
}

/*compress data using zlib*/
ret = zmat_encode(totalbytes, (uchar*)vol, &compressedbytes, (uchar**)&compressed, zipid, &status);
if (zipid != zmBase64) {
ret = zmat_encode(totalbytes, (uchar*)vol, &compressedbytes, (uchar**)&compressed, zipid, &status);
} else {
compressed = (uchar*)vol;
compressedbytes = totalbytes;
}

if (!ret) {
if (!cfg->isdumpjson) {
Expand Down Expand Up @@ -4521,7 +4526,7 @@ int mcx_jdataencode(void* vol, int ndim, uint* dims, char* type, int byte, int
}
}

if (compressed) {
if (compressed && zipid != zmBase64) {
free(compressed);
}

Expand Down

0 comments on commit ea67ea9

Please sign in to comment.