Author: brane
Date: Sat May 30 21:00:08 2026
New Revision: 1934788
Log:
Silence Apple's deprecation of sprintf().
* subversion/svn/filesize.c
(format_size): Wrap the function implementation in diagnostic #pragma
to silence [-Wdeprecated-declarations].
* subversion/tests/libsvn_subr/skel-test.c
(put_explicit_length): Likewise.
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 Sat May 30 20:40:53 2026
(r1934787)
+++ subversion/trunk/subversion/svn/filesize.c Sat May 30 21:00:08 2026
(r1934788)
@@ -72,6 +72,16 @@ format_size(double human_readable_size,
apr_size_t index,
apr_pool_t *result_pool)
{
+ /* Apple in its infinite wisdom has seen fit to deprecate sprintf() which
+ has been part of the C standard library since the K&R days and is not
+ deprecated in any version of the C standard. */
+#ifdef __APPLE__
+# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+# endif
+#endif /* __APPLE__ */
+
/* NOTE: We want to display a locale-specific decimal sepratator, but
APR's formatter completely ignores the locale. So we use the
good, old, standard, *dangerous* sprintf() to format the size.
@@ -107,6 +117,12 @@ format_size(double human_readable_size,
}
return apr_pstrcat(result_pool, buffer, suffix, SVN_VA_NULL);
+
+#ifdef __APPLE__
+# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
+# pragma GCC diagnostic pop
+# endif
+#endif /* __APPLE__ */
}
Modified: subversion/trunk/subversion/tests/libsvn_subr/skel-test.c
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/skel-test.c Sat May 30
20:40:53 2026 (r1934787)
+++ subversion/trunk/subversion/tests/libsvn_subr/skel-test.c Sat May 30
21:00:08 2026 (r1934788)
@@ -307,6 +307,16 @@ put_explicit_length(svn_stringbuf_t *str
apr_size_t len,
char sep)
{
+ /* Apple in its infinite wisdom has seen fit to deprecate sprintf() which
+ has been part of the C standard library since the K&R days and is not
+ deprecated in any version of the C standard. */
+#ifdef __APPLE__
+# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+# endif
+#endif /* __APPLE__ */
+
char *buf = malloc(len + 100);
apr_size_t length_len;
@@ -322,6 +332,12 @@ put_explicit_length(svn_stringbuf_t *str
svn_stringbuf_appendbytes(str, buf, length_len + len);
free(buf);
+
+#ifdef __APPLE__
+# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
+# pragma GCC diagnostic pop
+# endif
+#endif /* __APPLE__ */
}