pierreinglebert / node-zopfli

Node bindings for Zopfli Compression Algorithm (zlib, gzip, deflate compatible)
MIT License
110 stars 39 forks source link

Fix compiler warnings for node-zopfli's code #42

Closed XhmikosR closed 3 years ago

pierreinglebert commented 9 years ago

I'll look at the travis & appveyor logs because I don't have any warn with clang compiler on osx.

XhmikosR commented 9 years ago

GCC shows a couple of uninitialized warnings too. After #45 and someone fixes those, we should be ready to close this issue.

pierreinglebert commented 9 years ago

Do you still have some warnings ?

XhmikosR commented 9 years ago

The warnings are still there. On Travis, expand the $ npm install --build-from-source line and you'll see them too. On AppVeyor they are not collapsed.

silverwind commented 8 years ago

I see these on the latest version:

../src/zopfli-binding.cc: In static member function 'static Nan::NAN_METHOD_RETURN_TYPE nodezopfli::CompressBinding::Sync(Nan::NAN_METHOD_ARGS_TYPE)':
../src/zopfli-binding.cc:173:20: warning: 'format' may be used uninitialized in this function [-Wmaybe-uninitialized]
     &out, &outsize);
                    ^
../src/zopfli-binding.cc: In static member function 'static Nan::NAN_METHOD_RETURN_TYPE nodezopfli::CompressBinding::Async(Nan::NAN_METHOD_ARGS_TYPE)':
../src/zopfli-binding.cc:105:78: warning: 'format' may be used uninitialized in this function [-Wmaybe-uninitialized]
   : Nan::AsyncWorker(callback), format(format), zopfli_options(zopfli_options) {
                                                                              ^
../src/zopfli-binding.cc:150:16: note: 'format' was declared here
   ZopfliFormat format;
                ^
pierreinglebert commented 8 years ago

I removed the last ones. I'll publish it after the dependencies are updated.

XhmikosR commented 8 years ago

Cool, thanks! Maybe check if it's worth update zopfli itself too.

bkinsey808 commented 8 years ago

I run into this issue when i npm build node_modules/node-zopfli

> node-zopfli@1.4.0 install /home/bkinsey/opt/pmachowski/angular2-starter-kit/node_modules/node-zopfli
> node-pre-gyp install --fallback-to-build

[node-zopfli] Success: "/home/bkinsey/opt/pmachowski/angular2-starter-kit/node_modules/node-zopfli/lib/binding/node-v47-linux-x64/zopfli.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
bkinsey@kinsey-Inspiron-3551:~/opt/pmachowski/angular2-starter-kit$ npm build node_modules/node-zopfli --build-from-source

> node-zopfli@1.4.0 install /home/bkinsey/opt/pmachowski/angular2-starter-kit/node_modules/node-zopfli
> node-pre-gyp install --fallback-to-build

make: Entering directory '/home/bkinsey/opt/pmachowski/angular2-starter-kit/node_modules/node-zopfli/build'
  CXX(target) Release/obj.target/zopfli/src/zopfli-binding.o
../src/zopfli-binding.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE nodezopfli::CompressBinding::Sync(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/zopfli-binding.cc:173:20: warning: ‘format’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     &out, &outsize);
                    ^
../src/zopfli-binding.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE nodezopfli::CompressBinding::Async(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/zopfli-binding.cc:105:78: warning: ‘format’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  : Nan::AsyncWorker(callback), format(format), zopfli_options(zopfli_options) {
                                                                             ^
../src/zopfli-binding.cc:150:16: note: ‘format’ was declared here
   ZopfliFormat format;
                ^
./Release/.deps/Release/obj.target/zopfli/src/zopfli-binding.o.d.raw { dev: 2052,
  mode: 33204,
  nlink: 1,
  uid: 1000,
  gid: 1000,
  rdev: 0,
...

this seems to relate to this issue on another project: https://github.com/pmachowski/angular2-starter-kit/issues/4

pierreinglebert commented 8 years ago

There are still 2 "conversion from 'size_t' to 'uint32_t'" warnings. Most warnings come now from zopfli c++ library