Author: rinrab
Date: Mon Jun 9 16:31:15 2025
New Revision: 1926293
URL: http://svn.apache.org/viewvc?rev=1926293&view=rev
Log:
Do not include apr_xlate.h into svn_utf.h, but manually wrap the
SVN_APR_*_CHARSET constants into APR_*_CHARSET.
* subversion/include/svn_utf.h
(includes): Remove apr_xlate.h.
(SVN_APR_LOCALE_CHARSET,
SVN_APR_DEFAULT_CHARSET): Define them like APR does instead of forwarding
straight to APR.
* subversion/libsvn_subr/utf.c
(get_apr_xlate_charset): New function that forwards SVN_APR_*_CHARSET into
APR_*_CHARSET or returns unchanged charset for APR xlate call;
(xlate_alloc_handle): Call get_apr_xlate_charset() for each codepage when
creating xlate handle.
No functional changes and no API changes.
Modified:
subversion/trunk/subversion/include/svn_utf.h
subversion/trunk/subversion/libsvn_subr/utf.c
Modified: subversion/trunk/subversion/include/svn_utf.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_utf.h?rev=1926293&r1=1926292&r2=1926293&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_utf.h (original)
+++ subversion/trunk/subversion/include/svn_utf.h Mon Jun 9 16:31:15 2025
@@ -33,7 +33,6 @@
#define SVN_UTF_H
#include <apr_pools.h>
-#include <apr_xlate.h> /* for APR_*_CHARSET */
#include "svn_types.h"
#include "svn_string.h"
@@ -42,8 +41,17 @@
extern "C" {
#endif /* __cplusplus */
-#define SVN_APR_LOCALE_CHARSET APR_LOCALE_CHARSET
-#define SVN_APR_DEFAULT_CHARSET APR_DEFAULT_CHARSET
+/**
+ * Indicates the charset of the sourcecode at compile time names. This is
+ * useful if there are literal strings in the source code which must
+ * be translated according to the charset of the source code.
+ */
+#define SVN_APR_LOCALE_CHARSET (const char *)0
+
+/**
+ * To indicate charset names of the current locale
+ */
+#define SVN_APR_DEFAULT_CHARSET (const char *)1
/**
* Initialize the UTF-8 encoding/decoding routines.
Modified: subversion/trunk/subversion/libsvn_subr/utf.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/utf.c?rev=1926293&r1=1926292&r2=1926293&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/utf.c (original)
+++ subversion/trunk/subversion/libsvn_subr/utf.c Mon Jun 9 16:31:15 2025
@@ -199,6 +199,17 @@ atomic_swap(void * volatile * mem, void
#endif
}
+static const char *
+get_apr_xlate_charset(const char *charset)
+{
+ if (charset == SVN_APR_DEFAULT_CHARSET)
+ return APR_DEFAULT_CHARSET;
+ else if (charset == SVN_APR_LOCALE_CHARSET)
+ return APR_LOCALE_CHARSET;
+ else
+ return charset;
+}
+
/* Set *RET to a newly created handle node for converting from FROMPAGE
to TOPAGE, If apr_xlate_open() returns APR_EINVAL or APR_ENOTIMPL, set
(*RET)->handle to NULL. If fail for any other reason, return the error.
@@ -225,7 +236,10 @@ xlate_alloc_handle(xlate_handle_node_t *
frompage, pool);
name = "win32-xlate: ";
#else
- apr_err = apr_xlate_open(&handle, topage, frompage, pool);
+ apr_err = apr_xlate_open(&handle,
+ get_apr_xlate_charset(topage),
+ get_apr_xlate_charset(frompage),
+ pool);
name = "APR: ";
#endif