libarchive/libarchive-test — Issue #8: 9 - compiler warnings in test suite 
Author: amejia1
Created: 2012-01-20 19:22:54+00:00
State: open

I think I have a different build environment from everyone else, so
reporting these just in case they go unnoticed elsewhere.

This code:

[test_tar_large.c line 202+]
-----------
DEFINE_TEST(test_tar_large)
{
/* The sizes of the entries we're going to generate. */
static off_t tests[] = {
/* Test for 32-bit signed overflow. */
2 * GB - 1, 2 * GB, 2 * GB + 1,
/* Test for 32-bit unsigned overflow. */
4 * GB - 1, 4 * GB, 4 * GB + 1,
/* 8GB is the "official" max for ustar. */
8 * GB - 1, 8 * GB, 8 * GB + 1,
/* Bend ustar a tad and you can get 64GB (12 octal
digits). */
64 * GB - 1, 64 * GB,
/* And larger entries that require non-ustar extensions. */
256 * GB, 1 * TB, 0 };
-----------

causes these warnings:

C4307: '*' : integral constant overflow	line 207
C4307: '-' : integral constant overflow	line 207
C4307: '*' : integral constant overflow	line 207
C4307: '*' : integral constant overflow	line 207
C4307: '*' : integral constant overflow	line 209
C4307: '*' : integral constant overflow	line 209
C4307: '*' : integral constant overflow	line 209
C4307: '*' : integral constant overflow	line 211
C4307: '*' : integral constant overflow	line 211
C4307: '*' : integral constant overflow	line 211
C4307: '*' : integral constant overflow	line 213
C4307: '*' : integral constant overflow	line 213
C4307: '*' : integral constant overflow	line 215
C4307: '*' : integral constant overflow	line 215

This code:

[test_read_pax_truncated.c]
-----------
size_t i;
ssize_t filedata_size;
[...]
for (i = 0; i < filedata_size; i++)
-----------

Causes these warnings:

C4018: '<' : signed/unsigned mismatch	line 51
C4018: '<' : signed/unsigned mismatch	line 85
C4018: '<' : signed/unsigned mismatch	line 100
C4018: '<' : signed/unsigned mismatch	line 134
C4018: '<' : signed/unsigned mismatch	line 147

in Visual Studio.

Original link: http://code.google.com/p/libarchive/issues/detail?id=9