Author: ivan
Date: Wed Jul  1 18:08:13 2026
New Revision: 1935781

Log:
* subversion/svn/filesize.c
* subversion/tests/libsvn_subr/skel-test.c
  (format_size, put_explicit_length): Invert preprocessor condition to make
   it slightly easy to understand.

Modified:
   subversion/trunk/subversion/svn/filesize.c
   subversion/trunk/subversion/tests/libsvn_subr/skel-test.c

Modified: subversion/trunk/subversion/svn/filesize.c
==============================================================================
--- subversion/trunk/subversion/svn/filesize.c  Wed Jul  1 18:02:49 2026        
(r1935780)
+++ subversion/trunk/subversion/svn/filesize.c  Wed Jul  1 18:08:13 2026        
(r1935781)
@@ -99,10 +99,10 @@ format_size(double human_readable_size,
        files can't have fractional byte sizes. */
     if (absolute_human_readable_size >= 10)
       {
-#if !HAVE_SNPRINTF
-        sprintf(buffer, "%.0f", human_readable_size);
-#else
+#if HAVE_SNPRINTF
         snprintf(buffer, sizeof(buffer), "%.0f", human_readable_size);
+#else
+        sprintf(buffer, "%.0f", human_readable_size);
 #endif
       }
     else
@@ -110,10 +110,11 @@ format_size(double human_readable_size,
         double integral;
         const double frac = modf(absolute_human_readable_size, &integral);
         const int decimals = (index > 0 && (integral < 9 || frac <= 
.949999999));
-#if !HAVE_SNPRINTF
-        sprintf(buffer, "%.*f", decimals, human_readable_size);
+#if HAVE_SNPRINTF
+        snprintf(buffer, sizeof(buffer), "%.*f", decimals,
+                 human_readable_size);
 #else
-        snprintf(buffer, sizeof(buffer), "%.*f", decimals, 
human_readable_size);
+        sprintf(buffer, "%.*f", decimals, human_readable_size);
 #endif
       }
 

Modified: subversion/trunk/subversion/tests/libsvn_subr/skel-test.c
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/skel-test.c   Wed Jul  1 
18:02:49 2026        (r1935780)
+++ subversion/trunk/subversion/tests/libsvn_subr/skel-test.c   Wed Jul  1 
18:08:13 2026        (r1935781)
@@ -316,10 +316,10 @@ put_explicit_length(svn_stringbuf_t *str
     abort();
 
   /* Generate the length and separator character.  */
-#if !HAVE_SNPRINTF
-  sprintf(buf, "%"APR_SIZE_T_FMT"%c", len, sep);
+#if HAVE_SNPRINTF
+  snprintf(buf, alloc_len, "%" APR_SIZE_T_FMT "%c", len, sep);
 #else
-  snprintf(buf, alloc_len, "%"APR_SIZE_T_FMT"%c", len, sep);
+  sprintf(buf, "%" APR_SIZE_T_FMT "%c", len, sep);
 #endif
   length_len = strlen(buf);
 

Reply via email to