You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2022/05/24 14:11:38 UTC

svn commit: r1901212 - in /apr/apr/trunk: misc/win32/utf8.c test/internal/Makefile.win test/internal/testucs.c test/internal/testutf.c

Author: wrowe
Date: Tue May 24 14:11:38 2022
New Revision: 1901212

URL: http://svn.apache.org/viewvc?rev=1901212&view=rev
Log:
Normalize ucs-4 to utf-32 (documentation change)

Added:
    apr/apr/trunk/test/internal/testutf.c
      - copied, changed from r1901211, apr/apr/trunk/test/internal/testucs.c
Removed:
    apr/apr/trunk/test/internal/testucs.c
Modified:
    apr/apr/trunk/misc/win32/utf8.c
    apr/apr/trunk/test/internal/Makefile.win

Modified: apr/apr/trunk/misc/win32/utf8.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/misc/win32/utf8.c?rev=1901212&r1=1901211&r2=1901212&view=diff
==============================================================================
--- apr/apr/trunk/misc/win32/utf8.c (original)
+++ apr/apr/trunk/misc/win32/utf8.c Tue May 24 14:11:38 2022
@@ -44,7 +44,7 @@
  * One of the X bits must be 1 to avoid overlong representation in utf-8.
  *
  * For conversion into utf-16, the 4th form is limited in range to 0010 FFFF,
- * and the final two forms are used only by full ucs-4, per RFC 3629;
+ * and the final two forms are used only by full utf-32, per RFC 3629;
  *
  *   "Pairs of UCS-2 values between D800 and DFFF (surrogate pairs in 
  *   Unicode parlance), being actually UCS-4 characters transformed 
@@ -110,7 +110,7 @@ APR_DECLARE(apr_status_t) apr_conv_utf8_
                 expect = 1;
                 while ((ch & mask) == mask) {
                     mask |= mask >> 1;
-                    if (++expect > 3) /* (or 5 for a ucs-4 code point) */
+                    if (++expect > 3) /* (or 5 for a utf-32 code point) */
                         return APR_EINVAL;
                 }
                 newch = ch & ~mask;
@@ -158,7 +158,7 @@ APR_DECLARE(apr_status_t) apr_conv_utf8_
                     newch |= (ch & 0077);
                 }
                 *inbytes -= eating;
-                /* newch is now a true ucs-4 character
+                /* newch is now a true utf-32 character
                  *
                  * now we need to fold to utf-16
                  */

Modified: apr/apr/trunk/test/internal/Makefile.win
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/internal/Makefile.win?rev=1901212&r1=1901211&r2=1901212&view=diff
==============================================================================
--- apr/apr/trunk/test/internal/Makefile.win (original)
+++ apr/apr/trunk/test/internal/Makefile.win Tue May 24 14:11:38 2022
@@ -42,7 +42,7 @@ INTDIR=$(OUTDIR)
 !MESSAGE Building tests into $(OUTDIR) for $(MODEL)
 
 NONPORTABLE = \
-	$(OUTDIR)\testucs.exe
+	$(OUTDIR)\testutf.exe
 
 CLEAN_BUILDDIRS = Release Debug 9x x64
 
@@ -85,7 +85,7 @@ SHLDFLAGS = /nologo /dll /debug /subsyst
 .c{$(INTDIR)}.obj:
 	$(CL) $(CFLAGS) -c $< -Fd$(INTDIR)\ $(INCLUDES) 
 
-$(OUTDIR)\testucs.exe: $(INTDIR)\testucs.obj $(LOCAL_LIB) 
+$(OUTDIR)\testutf.exe: $(INTDIR)\testutf.obj $(LOCAL_LIB) 
 	$(LD) $(LDFLAGS) /out:"$@" $** $(LD_LIBS)
 	@if exist "$@.manifest" \
 	    mt.exe -manifest "$@.manifest" -outputresource:$@;1

Copied: apr/apr/trunk/test/internal/testutf.c (from r1901211, apr/apr/trunk/test/internal/testucs.c)
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/internal/testutf.c?p2=apr/apr/trunk/test/internal/testutf.c&p1=apr/apr/trunk/test/internal/testucs.c&r1=1901211&r2=1901212&rev=1901212&view=diff
==============================================================================
--- apr/apr/trunk/test/internal/testucs.c (original)
+++ apr/apr/trunk/test/internal/testutf.c Tue May 24 14:11:38 2022
@@ -30,10 +30,10 @@ struct testval {
 };
 
 #ifdef FOR_REFERENCE
-/* For reference; a table of invalid utf-8 encoded ucs-2/ucs-4 sequences.
+/* For reference; a table of invalid utf-8 encoded utf-16/utf-32 sequences.
  * The table consists of start, end pairs for all invalid ranges.
- * NO_UCS2_PAIRS will pass the reservered D800-DFFF values, halting at FFFF
- * FULL_UCS4_MAPPER represents all 31 bit values to 7FFF FFFF
+ * NO_UTF16_PAIRS will pass the reservered D800-DFFF values, halting at FFFF
+ * FULL_UTF32_MAPPER represents all 31 bit values to 7FFF FFFF
  *
  * We already tested these, because we ensure there is a 1:1 mapping across
  * the entire range of byte values in each position of 1 to 6 byte sequences.
@@ -45,29 +45,29 @@ struct testval malformed[] = [
     [[0xC1,0xBF], 2,],                         /* overshort mapping of 007F */
     [[0xE0,0x80,0x80,], 3,],                   /* overshort mapping of 0000 */
     [[0xE0,0x9F,0xBF,], 3,],                   /* overshort mapping of 07FF */
-#ifndef NO_UCS2_PAIRS
-    [[0xED,0xA0,0x80,], 3,],    /* unexpected mapping of UCS-2 literal D800 */
-    [[0xED,0xBF,0xBF,], 3,],    /* unexpected mapping of UCS-2 literal DFFF */
+#ifndef NO_UTF16_PAIRS
+    [[0xED,0xA0,0x80,], 3,],   /* unexpected mapping of utf-16 literal D800 */
+    [[0xED,0xBF,0xBF,], 3,],   /* unexpected mapping of utf-16 literal DFFF */
 #endif
     [[0xF0,0x80,0x80,0x80,], 4,],              /* overshort mapping of 0000 */
     [[0xF0,0x8F,0xBF,0xBF,], 4,],              /* overshort mapping of FFFF */
-#ifdef NO_UCS2_PAIRS
+#ifdef NO_UTF16_PAIRS
     [[0xF0,0x90,0x80,0x80,], 4,],      /* invalid too large value 0001 0000 */
     [[0xF4,0x8F,0xBF,0xBF,], 4,],      /* invalid too large value 0010 FFFF */
 #endif
-#ifndef FULL_UCS4_MAPPER
+#ifndef FULL_UTF32_MAPPER
     [[0xF4,0x90,0x80,0x80,], 4,],      /* invalid too large value 0011 0000 */
     [[0xF7,0xBF,0xBF,0xBF,], 4,],      /* invalid too large value 001F FFFF */
 #endif
     [[0xF8,0x80,0x80,0x80,0x80,], 5,],    /* overshort mapping of 0000 0000 */
     [[0xF8,0x87,0xBF,0xBF,0xBF,], 5,],    /* overshort mapping of 001F FFFF */
-#ifndef FULL_UCS4_MAPPER
+#ifndef FULL_UTF32_MAPPER
     [[0xF8,0x88,0x80,0x80,0x80,], 5,], /* invalid too large value 0020 0000 */
     [[0xFB,0xBF,0xBF,0xBF,0xBF,], 5,], /* invalid too large value 03FF FFFF */
 #endif
     [[0xFC,0x80,0x80,0x80,0x80,0x80,], 6,],  /* overshort mapping 0000 0000 */
     [[0xFC,0x83,0xBF,0xBF,0xBF,0xBF,], 6,],  /* overshort mapping 03FF FFFF */
-#ifndef FULL_UCS4_MAPPER
+#ifndef FULL_UTF32_MAPPER
     [[0xFC,0x84,0x80,0x80,0x80,0x80,], 6,],  /* overshort mapping 0400 0000 */
     [[0xFD,0xBF,0xBF,0xBF,0xBF,0xBF,], 6,],  /* overshort mapping 7FFF FFFF */
 #endif
@@ -324,7 +324,7 @@ void test_ranges()
 }
 
 /*
- *  Syntax: testucs [w|n]
+ *  Syntax: testutf [w|n]
  *
  *  If no arg or arg is not recognized, run equality sequence test.
  */