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
This commit is contained in:
gmvbif 2016-01-02 08:56:40 +03:00
parent f8f7dadba4
commit 1794ca908f
4 changed files with 4 additions and 4 deletions

View File

@ -8,7 +8,6 @@
ChunkFile::ChunkFile(const char *filename, bool _read) { ChunkFile::ChunkFile(const char *filename, bool _read) {
data=0; data=0;
fn = filename; fn = filename;
fastMode=false;
numLevels=0; numLevels=0;
read=_read; read=_read;
pos=0; pos=0;

View File

@ -531,7 +531,7 @@ bool IniFile::Load(std::istream &in) {
// Maximum number of letters in a line // Maximum number of letters in a line
static const int MAX_BYTES = 1024*32; static const int MAX_BYTES = 1024*32;
while (!in.eof()) while (!(in.eof() || in.fail()))
{ {
char templine[MAX_BYTES]; char templine[MAX_BYTES];
in.getline(templine, MAX_BYTES); in.getline(templine, MAX_BYTES);

View File

@ -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 y = 0; y < height; y++) {
for (int x = 0; x < width; x++) { for (int x = 0; x < width; x++) {
int dithval = dith[(x&3)+((y&0x3)<<2)] - 8; 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 r = clamp32((image_data[i * 4] + dithval/2) >> 3);
int g = clamp64((image_data[i * 4 + 1] + dithval/4) >> 2); int g = clamp64((image_data[i * 4 + 1] + dithval/4) >> 2);
int b = clamp32((image_data[i * 4 + 2] + dithval/2) >> 3); int b = clamp32((image_data[i * 4 + 2] + dithval/2) >> 3);

View File

@ -323,6 +323,7 @@ int Client::ReadResponseEntity(Buffer *readbuf, const std::vector<std::string> &
bool result = decompress_string(compressed, &decompressed); bool result = decompress_string(compressed, &decompressed);
if (!result) { if (!result) {
ELOG("Error decompressing using zlib"); ELOG("Error decompressing using zlib");
if (progress)
*progress = 0.0f; *progress = 0.0f;
return -1; return -1;
} }