Skip to content

Commit f8219c4

Browse files
committed
fix warnings in zlib
1 parent 7cdabd5 commit f8219c4

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/node_zlib.cc

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -445,32 +445,31 @@ class ZCtx : public AsyncWrap, public ThreadPoolWork {
445445
// But on the decompression side, a value of 0 for windowBits tells zlib
446446
// to use the window size in the zlib header of the compressed stream.
447447
uint32_t windowBits;
448-
bool winCheck = args[0]->Uint32Value(context).To(&windowBits);
448+
if (!args[0]->Uint32Value(context).To(&windowBits)) return;
449449

450450
if (!((windowBits == 0) &&
451451
(ctx->mode_ == INFLATE ||
452452
ctx->mode_ == GUNZIP ||
453453
ctx->mode_ == UNZIP))) {
454-
CHECK((windowBits >= Z_MIN_WINDOWBITS && windowBits <= Z_MAX_WINDOWBITS &&
455-
winCheck) &&
456-
"invalid windowBits");
454+
CHECK(
455+
(windowBits >= Z_MIN_WINDOWBITS && windowBits <= Z_MAX_WINDOWBITS) &&
456+
"invalid windowBits");
457457
}
458458

459459
int level = args[1]->Int32Value();
460460
CHECK((level >= Z_MIN_LEVEL && level <= Z_MAX_LEVEL) &&
461461
"invalid compression level");
462462

463463
uint32_t memLevel;
464-
bool memCheck = args[2]->Uint32Value(context).To(&memLevel);
465-
CHECK((memLevel >= Z_MIN_MEMLEVEL && memLevel <= Z_MAX_MEMLEVEL &&
466-
memCheck) &&
464+
if (!args[2]->Uint32Value(context).To(&memLevel)) return;
465+
CHECK((memLevel >= Z_MIN_MEMLEVEL && memLevel <= Z_MAX_MEMLEVEL) &&
467466
"invalid memlevel");
468467

469468
uint32_t strategy;
470-
bool strategyCheck = args[3]->Uint32Value(context).To(&strategy);
469+
if (!args[3]->Uint32Value(context).To(&strategy)) return;
471470
CHECK((strategy == Z_FILTERED || strategy == Z_HUFFMAN_ONLY ||
472471
strategy == Z_RLE || strategy == Z_FIXED ||
473-
strategy == Z_DEFAULT_STRATEGY && strategyCheck) &&
472+
strategy == Z_DEFAULT_STRATEGY) &&
474473
"invalid strategy");
475474

476475
CHECK(args[4]->IsUint32Array());

0 commit comments

Comments
 (0)