aboutsummaryrefslogtreecommitdiff
path: root/zlib/test
diff options
context:
space:
mode:
authorMatthias Klose <doko@ubuntu.com>2015-11-23 20:27:57 +0000
committerMatthias Klose <doko@gcc.gnu.org>2015-11-23 20:27:57 +0000
commitcd9ec14217a566fa0ae12ccf34534cbb7680f5ab (patch)
treec0867a0d04452190fa29a7e38ad632c37d5221cd /zlib/test
parent4c93660449ea23e5eee1f8ce3e97129c7974b7fc (diff)
downloadgcc-cd9ec14217a566fa0ae12ccf34534cbb7680f5ab.zip
gcc-cd9ec14217a566fa0ae12ccf34534cbb7680f5ab.tar.gz
gcc-cd9ec14217a566fa0ae12ccf34534cbb7680f5ab.tar.bz2
2015-11-23 Matthias Klose <doko@ubuntu.com>
* Imported zlib 1.2.8; merged local changes. From-SVN: r230774
Diffstat (limited to 'zlib/test')
-rw-r--r--zlib/test/example.c8
-rw-r--r--zlib/test/minigzip.c20
2 files changed, 24 insertions, 4 deletions
diff --git a/zlib/test/example.c b/zlib/test/example.c
index f515a48..138a699 100644
--- a/zlib/test/example.c
+++ b/zlib/test/example.c
@@ -26,7 +26,7 @@
} \
}
-const char hello[] = "hello, hello!";
+z_const char hello[] = "hello, hello!";
/* "hello world" would be more standard, but the repeated "hello"
* stresses the compression code better, sorry...
*/
@@ -212,7 +212,7 @@ void test_deflate(compr, comprLen)
err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
CHECK_ERR(err, "deflateInit");
- c_stream.next_in = (Bytef*)hello;
+ c_stream.next_in = (z_const unsigned char *)hello;
c_stream.next_out = compr;
while (c_stream.total_in != len && c_stream.total_out < comprLen) {
@@ -387,7 +387,7 @@ void test_flush(compr, comprLen)
err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
CHECK_ERR(err, "deflateInit");
- c_stream.next_in = (Bytef*)hello;
+ c_stream.next_in = (z_const unsigned char *)hello;
c_stream.next_out = compr;
c_stream.avail_in = 3;
c_stream.avail_out = (uInt)*comprLen;
@@ -476,7 +476,7 @@ void test_dict_deflate(compr, comprLen)
c_stream.next_out = compr;
c_stream.avail_out = (uInt)comprLen;
- c_stream.next_in = (Bytef*)hello;
+ c_stream.next_in = (z_const unsigned char *)hello;
c_stream.avail_in = (uInt)strlen(hello)+1;
err = deflate(&c_stream, Z_FINISH);
diff --git a/zlib/test/minigzip.c b/zlib/test/minigzip.c
index aa7ac7a..b3025a4 100644
--- a/zlib/test/minigzip.c
+++ b/zlib/test/minigzip.c
@@ -40,6 +40,10 @@
# define SET_BINARY_MODE(file)
#endif
+#ifdef _MSC_VER
+# define snprintf _snprintf
+#endif
+
#ifdef VMS
# define unlink delete
# define GZ_SUFFIX "-gz"
@@ -463,8 +467,12 @@ void file_compress(file, mode)
exit(1);
}
+#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
+ snprintf(outfile, sizeof(outfile), "%s%s", file, GZ_SUFFIX);
+#else
strcpy(outfile, file);
strcat(outfile, GZ_SUFFIX);
+#endif
in = fopen(file, "rb");
if (in == NULL) {
@@ -499,7 +507,11 @@ void file_uncompress(file)
exit(1);
}
+#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
+ snprintf(buf, sizeof(buf), "%s", file);
+#else
strcpy(buf, file);
+#endif
if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) {
infile = file;
@@ -508,7 +520,11 @@ void file_uncompress(file)
} else {
outfile = file;
infile = buf;
+#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
+ snprintf(buf + len, sizeof(buf) - len, "%s", GZ_SUFFIX);
+#else
strcat(infile, GZ_SUFFIX);
+#endif
}
in = gzopen(infile, "rb");
if (in == NULL) {
@@ -546,7 +562,11 @@ int main(argc, argv)
gzFile file;
char *bname, outmode[20];
+#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
+ snprintf(outmode, sizeof(outmode), "%s", "wb6 ");
+#else
strcpy(outmode, "wb6 ");
+#endif
prog = argv[0];
bname = strrchr(argv[0], '/');