summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gzguts.h6
-rw-r--r--gzlib.c10
2 files changed, 6 insertions, 10 deletions
diff --git a/gzguts.h b/gzguts.h
index f937504..adc2b34 100644
--- a/gzguts.h
+++ b/gzguts.h
@@ -210,9 +210,5 @@ char ZLIB_INTERNAL *gz_strwinerror(DWORD error);
210/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t 210/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
211 value -- needed when comparing unsigned to z_off64_t, which is signed 211 value -- needed when comparing unsigned to z_off64_t, which is signed
212 (possible z_off64_t types off_t, off64_t, and long are all signed) */ 212 (possible z_off64_t types off_t, off64_t, and long are all signed) */
213#ifdef INT_MAX
214# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
215#else
216unsigned ZLIB_INTERNAL gz_intmax(void); 213unsigned ZLIB_INTERNAL gz_intmax(void);
217# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) 214#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
218#endif
diff --git a/gzlib.c b/gzlib.c
index 29fc448..9c103db 100644
--- a/gzlib.c
+++ b/gzlib.c
@@ -563,20 +563,20 @@ void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg) {
563#endif 563#endif
564} 564}
565 565
566#ifndef INT_MAX
567/* portably return maximum value for an int (when limits.h presumed not 566/* portably return maximum value for an int (when limits.h presumed not
568 available) -- we need to do this to cover cases where 2's complement not 567 available) -- we need to do this to cover cases where 2's complement not
569 used, since C standard permits 1's complement and sign-bit representations, 568 used, since C standard permits 1's complement and sign-bit representations,
570 otherwise we could just use ((unsigned)-1) >> 1 */ 569 otherwise we could just use ((unsigned)-1) >> 1 */
571unsigned ZLIB_INTERNAL gz_intmax(void) { 570unsigned ZLIB_INTERNAL gz_intmax(void) {
572 unsigned p, q; 571#ifdef INT_MAX
573 572 return INT_MAX;
574 p = 1; 573#else
574 unsigned p = 1, q;
575 do { 575 do {
576 q = p; 576 q = p;
577 p <<= 1; 577 p <<= 1;
578 p++; 578 p++;
579 } while (p > q); 579 } while (p > q);
580 return q >> 1; 580 return q >> 1;
581}
582#endif 581#endif
582}