diff options
author | Nathan Baker <elitebadger@gmail.com> | 2018-02-04 23:54:17 +0000 |
---|---|---|
committer | Olivier Paquet <olivier.paquet@gmail.com> | 2018-02-04 23:54:17 +0000 |
commit | e9fa4baf1da46058e75c29d9b8d894c913199963 (patch) | |
tree | 2d0c7f7ef588a6c82e1cdfe1e7a28489bc8e06cb | |
parent | c4d31e9b06a06d3876a86fc2166ee52c641e95a0 (diff) | |
download | libtiff-git-e9fa4baf1da46058e75c29d9b8d894c913199963.tar.gz |
Fix all compiler warnings for default build
-rw-r--r-- | contrib/iptcutil/iptcutil.c | 1 | ||||
-rw-r--r-- | tools/thumbnail.c | 16 | ||||
-rw-r--r-- | tools/tiff2pdf.c | 13 | ||||
-rw-r--r-- | tools/tiffcmp.c | 3 | ||||
-rw-r--r-- | tools/tiffcrop.c | 16 |
5 files changed, 27 insertions, 22 deletions
diff --git a/contrib/iptcutil/iptcutil.c b/contrib/iptcutil/iptcutil.c index b5b774ff..ad0a79c5 100644 --- a/contrib/iptcutil/iptcutil.c +++ b/contrib/iptcutil/iptcutil.c @@ -926,6 +926,7 @@ int tokenizer(unsigned inflag,char *token,int tokmax,char *line, { case IN_WHITE: _p_state=IN_TOKEN; /* switch states */ + /* Fall through */ case IN_TOKEN: /* these 2 are */ case IN_QUOTE: /* identical here */ diff --git a/tools/thumbnail.c b/tools/thumbnail.c index db9c0c08..4e73df08 100644 --- a/tools/thumbnail.c +++ b/tools/thumbnail.c @@ -526,14 +526,14 @@ setrow(uint8* row, uint32 nrows, const uint8* rows[]) for (i = fw; i > 8; i--) acc += bits[*src++]; /* fall thru... */ - case 8: acc += bits[*src++]; - case 7: acc += bits[*src++]; - case 6: acc += bits[*src++]; - case 5: acc += bits[*src++]; - case 4: acc += bits[*src++]; - case 3: acc += bits[*src++]; - case 2: acc += bits[*src++]; - case 1: acc += bits[*src++]; + case 8: acc += bits[*src++]; /* fall thru */ + case 7: acc += bits[*src++]; /* fall thru */ + case 6: acc += bits[*src++]; /* fall thru */ + case 5: acc += bits[*src++]; /* fall thru */ + case 4: acc += bits[*src++]; /* fall thru */ + case 3: acc += bits[*src++]; /* fall thru */ + case 2: acc += bits[*src++]; /* fall thru */ + case 1: acc += bits[*src++]; /* fall thru */ case 0: break; } acc += bits[*src & mask1]; diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c index 484776c1..984ef654 100644 --- a/tools/tiff2pdf.c +++ b/tools/tiff2pdf.c @@ -3736,12 +3736,13 @@ tsize_t t2p_sample_rgbaa_to_rgb(tdata_t data, uint32 samplecount) { uint32 i; - - /* For the 3 first samples, there is overlapping between souce and - destination, so use memmove(). - See http://bugzilla.maptools.org/show_bug.cgi?id=2577 */ - for(i = 0; i < 3 && i < samplecount; i++) - memmove((uint8*)data + i * 3, (uint8*)data + i * 4, 3); + + /* For the 3 first samples, there is overlap between source and + * destination, so use memmove(). + * See http://bugzilla.maptools.org/show_bug.cgi?id=2577 + */ + for(i = 0; i < 3 && i < samplecount; i++) + memmove((uint8*)data + i * 3, (uint8*)data + i * 4, 3); for(; i < samplecount; i++) memcpy((uint8*)data + i * 3, (uint8*)data + i * 4, 3); diff --git a/tools/tiffcmp.c b/tools/tiffcmp.c index 02a5e342..299847df 100644 --- a/tools/tiffcmp.c +++ b/tools/tiffcmp.c @@ -436,7 +436,8 @@ PrintIntDiff(uint32 row, int sample, uint32 pix, uint32 w1, uint32 w2) { int32 mask1, mask2, s; - mask1 = ~((-1) << bitspersample); + /* mask1 should have the n lowest bits set, where n == bitspersample */ + mask1 = ((int32)1 << bitspersample) - 1; s = (8 - bitspersample); mask2 = mask1 << s; for (; mask2 && pix < imagewidth; diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c index d82a94c8..91a38f67 100644 --- a/tools/tiffcrop.c +++ b/tools/tiffcrop.c @@ -2210,8 +2210,9 @@ main(int argc, char* argv[]) unsigned int total_pages = 0; unsigned int total_images = 0; unsigned int end_of_input = FALSE; - int seg, length; - char temp_filename[PATH_MAX + 1]; + int seg; + size_t length; + char temp_filename[PATH_MAX + 16]; /* Extra space keeps the compiler from complaining */ little_endian = *((unsigned char *)&little_endian) & '1'; @@ -2303,8 +2304,8 @@ main(int argc, char* argv[]) if (dump.infile != NULL) fclose (dump.infile); - /* dump.infilename is guaranteed to be NUL termimated and have 20 bytes - fewer than PATH_MAX */ + /* dump.infilename is guaranteed to be NUL terminated and have 20 bytes + fewer than PATH_MAX */ snprintf(temp_filename, sizeof(temp_filename), "%s-read-%03d.%s", dump.infilename, dump_images, (dump.format == DUMP_TEXT) ? "txt" : "raw"); @@ -2322,7 +2323,7 @@ main(int argc, char* argv[]) if (dump.outfile != NULL) fclose (dump.outfile); - /* dump.outfilename is guaranteed to be NUL termimated and have 20 bytes + /* dump.outfilename is guaranteed to be NUL terminated and have 20 bytes fewer than PATH_MAX */ snprintf(temp_filename, sizeof(temp_filename), "%s-write-%03d.%s", dump.outfilename, dump_images, @@ -9055,8 +9056,9 @@ mirrorImage(uint16 spp, uint16 bps, uint16 mirror, uint32 width, uint32 length, _TIFFfree(line_buff); if (mirror == MIRROR_VERT) break; + /* Fall through */ case MIRROR_HORIZ : - if ((bps % 8) == 0) /* byte alligned data */ + if ((bps % 8) == 0) /* byte aligned data */ { for (row = 0; row < length; row++) { @@ -9201,7 +9203,7 @@ invertImage(uint16 photometric, uint16 spp, uint16 bps, uint32 width, uint32 len bytebuff2 = 4 - (uint8)(*src & 48 >> 4); bytebuff3 = 4 - (uint8)(*src & 12 >> 2); bytebuff4 = 4 - (uint8)(*src & 3); - *src = (bytebuff1 << 6) || (bytebuff2 << 4) || (bytebuff3 << 2) || bytebuff4; + *src = (bytebuff1 << 6) | (bytebuff2 << 4) | (bytebuff3 << 2) | bytebuff4; src++; } break; |