diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2015-05-18 07:31:16 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2015-05-18 07:31:16 +0000 |
commit | 76b86227951fdb5096572c36a256f07aee76def3 (patch) | |
tree | 713dcf30179d88b685605bdc8a03a5068832e4ff /plugins/AdvaImg/src/FreeImage/PluginPNM.cpp | |
parent | 4b289716d4cdd6b3ea29aec8d50e0b69afdc8384 (diff) |
git-svn-id: http://svn.miranda-ng.org/main/trunk@13671 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AdvaImg/src/FreeImage/PluginPNM.cpp')
-rw-r--r-- | plugins/AdvaImg/src/FreeImage/PluginPNM.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/plugins/AdvaImg/src/FreeImage/PluginPNM.cpp b/plugins/AdvaImg/src/FreeImage/PluginPNM.cpp index 3155315559..3b4d0de554 100644 --- a/plugins/AdvaImg/src/FreeImage/PluginPNM.cpp +++ b/plugins/AdvaImg/src/FreeImage/PluginPNM.cpp @@ -33,11 +33,13 @@ Get an integer value from the actual position pointed by handle static int GetInt(FreeImageIO *io, fi_handle handle) { char c = 0; - BOOL firstchar; + BOOL bFirstChar; // skip forward to start of next number - if(!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING; + if(!io->read_proc(&c, 1, 1, handle)) { + throw FI_MSG_ERROR_PARSING; + } while (1) { // eat comments @@ -45,15 +47,16 @@ GetInt(FreeImageIO *io, fi_handle handle) { if (c == '#') { // if we're at a comment, read to end of line - firstchar = TRUE; + bFirstChar = TRUE; while (1) { - if(!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING; + if(!io->read_proc(&c, 1, 1, handle)) { + throw FI_MSG_ERROR_PARSING; + } - if (firstchar && c == ' ') { + if (bFirstChar && c == ' ') { // loop off 1 sp after # - - firstchar = FALSE; + bFirstChar = FALSE; } else if (c == '\n') { break; } @@ -62,11 +65,12 @@ GetInt(FreeImageIO *io, fi_handle handle) { if (c >= '0' && c <='9') { // we've found what we were looking for - break; } - if(!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING; + if(!io->read_proc(&c, 1, 1, handle)) { + throw FI_MSG_ERROR_PARSING; + } } // we're at the start of a number, continue until we hit a non-number @@ -76,10 +80,13 @@ GetInt(FreeImageIO *io, fi_handle handle) { while (1) { i = (i * 10) + (c - '0'); - if(!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING; + if(!io->read_proc(&c, 1, 1, handle)) { + throw FI_MSG_ERROR_PARSING; + } - if (c < '0' || c > '9') - break; + if (c < '0' || c > '9') { + break; + } } return i; |