Skip to content

Commit ea67ea9

Browse files
committed
[bug] avoid double-base64-encoding when -Z 2 is used, fix #219
1 parent 3b7e11c commit ea67ea9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/mcx_utils.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4476,7 +4476,12 @@ int mcx_jdataencode(void* vol, int ndim, uint* dims, char* type, int byte, int
44764476
}
44774477

44784478
/*compress data using zlib*/
4479-
ret = zmat_encode(totalbytes, (uchar*)vol, &compressedbytes, (uchar**)&compressed, zipid, &status);
4479+
if (zipid != zmBase64) {
4480+
ret = zmat_encode(totalbytes, (uchar*)vol, &compressedbytes, (uchar**)&compressed, zipid, &status);
4481+
} else {
4482+
compressed = (uchar*)vol;
4483+
compressedbytes = totalbytes;
4484+
}
44804485

44814486
if (!ret) {
44824487
if (!cfg->isdumpjson) {
@@ -4521,7 +4526,7 @@ int mcx_jdataencode(void* vol, int ndim, uint* dims, char* type, int byte, int
45214526
}
45224527
}
45234528

4524-
if (compressed) {
4529+
if (compressed && zipid != zmBase64) {
45254530
free(compressed);
45264531
}
45274532

0 commit comments

Comments
 (0)