From 1794ca908fe07fc30afb207f73e8caa24239928e Mon Sep 17 00:00:00 2001 From: gmvbif Date: Sat, 2 Jan 2016 08:56:40 +0300 Subject: [PATCH] Fixed some warnings from Native project - fastMode assigned twice in ChunkFIle constructor - added checking for fail while reading ini file (possible infinity loop) - zim_save assigned dithval twice (Please double check this) - in http_client added checking progress againt nullptr --- ext/native/file/chunk_file.cpp | 1 - ext/native/file/ini_file.cpp | 2 +- ext/native/image/zim_save.cpp | 2 +- ext/native/net/http_client.cpp | 3 ++- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/native/file/chunk_file.cpp b/ext/native/file/chunk_file.cpp index 7fb050abb0..dd627b9522 100644 --- a/ext/native/file/chunk_file.cpp +++ b/ext/native/file/chunk_file.cpp @@ -8,7 +8,6 @@ ChunkFile::ChunkFile(const char *filename, bool _read) { data=0; fn = filename; - fastMode=false; numLevels=0; read=_read; pos=0; diff --git a/ext/native/file/ini_file.cpp b/ext/native/file/ini_file.cpp index 9070bb8079..14d0b6b370 100644 --- a/ext/native/file/ini_file.cpp +++ b/ext/native/file/ini_file.cpp @@ -531,7 +531,7 @@ bool IniFile::Load(std::istream &in) { // Maximum number of letters in a line static const int MAX_BYTES = 1024*32; - while (!in.eof()) + while (!(in.eof() || in.fail())) { char templine[MAX_BYTES]; in.getline(templine, MAX_BYTES); diff --git a/ext/native/image/zim_save.cpp b/ext/native/image/zim_save.cpp index be9bb5485d..ba753a79be 100644 --- a/ext/native/image/zim_save.cpp +++ b/ext/native/image/zim_save.cpp @@ -164,7 +164,7 @@ void Convert(const uint8_t *image_data, int width, int height, int pitch, int fl for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { int dithval = dith[(x&3)+((y&0x3)<<2)] - 8; - dithval = 0; + //dithval = 0; please check this int r = clamp32((image_data[i * 4] + dithval/2) >> 3); int g = clamp64((image_data[i * 4 + 1] + dithval/4) >> 2); int b = clamp32((image_data[i * 4 + 2] + dithval/2) >> 3); diff --git a/ext/native/net/http_client.cpp b/ext/native/net/http_client.cpp index aecee2ae1d..739923519e 100644 --- a/ext/native/net/http_client.cpp +++ b/ext/native/net/http_client.cpp @@ -323,7 +323,8 @@ int Client::ReadResponseEntity(Buffer *readbuf, const std::vector & bool result = decompress_string(compressed, &decompressed); if (!result) { ELOG("Error decompressing using zlib"); - *progress = 0.0f; + if (progress) + *progress = 0.0f; return -1; } output->Append(decompressed);