[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: started applying Marcus' patch

From: Karl Fogel <kfogel_at_newton.ch.collab.net>
Date: 2002-07-09 20:55:33 CEST

By the way, Marcus --

We haven't yet applied your patch to APR's xlate.c, about which you
wrote the following in a mail message once:

   Implementation note: I'm now using apr_xlate instead of calling
   iconv directly. This means that it's now up to APR to worry about
   portability. Unfortunately, apr_xlate seems to make several of the
   mistakes that Ulrich cautioned about. In particular, it ignores
   return codes greater than 0 from iconv. It should probably return
   some other apr_status_t than APR_SUCCESS in this case, to indicate
   an inexact translation. Of course, we'll need to decide on in
   which cases an inexact translation is acceptable as well. For a
   pathname, probably not. For an error message, probably. But what
   about a property diff, for example?

Have you had any more thoughts on that?

The patch itself is below. Can you write a log message for it? I
don't think there was one included with the patch, and didn't see one
posted later. (I don't understand everything the patch does just from
looking at it, though perhaps someone more knowledgable than I about
APR's i18n support would be able to get by without a log message).

-Karl

Index: i18n/unix/xlate.c
===================================================================
RCS file: /home/cvspublic/apr/i18n/unix/xlate.c,v
retrieving revision 1.26
diff -u -r1.26 xlate.c
--- i18n/unix/xlate.c 8 Jun 2002 18:53:13 -0000 1.26
+++ i18n/unix/xlate.c 28 Jun 2002 14:52:34 -0000
@@ -219,6 +219,14 @@
 }
 #endif /* HAVE_ICONV */
 
+static void make_identity_table(apr_xlate_t *convset)
+{
+ int i;
+ convset->sbcs_table = apr_palloc(convset->pool, 256);
+ for (i=0; i<256; i++)
+ convset->sbcs_table[i] = i;
+}
+
 apr_status_t apr_xlate_open(apr_xlate_t **convset, const char *topage,
                             const char *frompage, apr_pool_t *pool)
 {
@@ -251,6 +259,12 @@
     set found to non-zero if found in the cache
 #endif
 
+ if (!found && !strcmp(topage, frompage)) {
+ /* to and from are the same */
+ found = 1;
+ make_identity_table(new);
+ }
+
 #ifdef HAVE_ICONV
     if (!found) {
         new->ich = iconv_open(topage, frompage);
@@ -259,7 +273,8 @@
         }
         found = 1;
         check_sbcs(new);
- }
+ } else
+ new->ich = (iconv_t)-1;
 #endif /* HAVE_ICONV */
 
     if (found) {

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Jul 9 21:06:03 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.