photopea / UPNG.js

Fast and advanced PNG (APNG) decoder and encoder (lossy / lossless)
MIT License
2.1k stars 259 forks source link

LGTM.com issues in UPNG.js #71

Closed Mugen87 closed 3 years ago

Mugen87 commented 3 years ago

The three.js project uses UPNG.js in its RGBMLoader for decoding PNGs in JavaScript. We have noticed that lgtm.com reports three alerts in context of UPNG.js:

  1. It seems the i variable in this line is undefined and implicitly converted to number.

https://github.com/photopea/UPNG.js/blob/c976240e62b0497167f8aafabd7889625f8b2016/UPNG.js#L90

  1. Assigning a value to foff is not necessary since the variable is not used anymore in subsequent code.

https://github.com/photopea/UPNG.js/blob/c976240e62b0497167f8aafabd7889625f8b2016/UPNG.js#L205

  1. The initial value of di is unused, since it's always overwritten. A variable declaration is sufficient.

https://github.com/photopea/UPNG.js/blob/c976240e62b0497167f8aafabd7889625f8b2016/UPNG.js#L328

Would be great if these issue could be fixed in this repository and not in our local copy 👍 . The last two should be easy to fix, I'm unsure about the first one.

photopea commented 3 years ago

The first case is a bug, but the other two are not! However, I have fixed them all :)