Fix size error on Linux
authorRobert Pengelly <robertapengelly@hotmail.com>
Wed, 11 Jun 2025 21:00:25 +0000 (22:00 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Wed, 11 Jun 2025 21:00:25 +0000 (22:00 +0100)
ranlib.c

index 89e349ac2abcf7fd94f2d88d7e90232004dcbe9a..6dfdbbf661a92d31f6fc86cc4aa7795df6fe987d 100644 (file)
--- a/ranlib.c
+++ b/ranlib.c
@@ -408,7 +408,7 @@ void ranlib (FILE *arfp) {
     FILE *tfp = tmpfile ();
     
     struct ar_header header;
-    long bytes, i, j, len, read, val;
+    long i, j, len, read, val;
     
     unsigned char *object;
     void *contents;
@@ -416,6 +416,12 @@ void ranlib (FILE *arfp) {
     char temp[16];
     long offset = 0;
     
+#if     UINT_MAX == 65536
+    long bytes;
+#else
+    int bytes;
+#endif
+    
     for (;;) {
     
         struct ar_header hdr;
@@ -530,7 +536,11 @@ void ranlib (FILE *arfp) {
     memcpy (header.group, temp, 6);
     memcpy (header.mode, temp, 8);
     
+#if     UINT_MAX == 65536
     len = sprintf (temp, "%ld", bytes + 4);
+#else
+    len = sprintf (temp, "%d", bytes + 4);
+#endif
     
     temp[len] = ' ';
     memcpy (header.size, temp, 10);