[llvm] r211016 - Support/ConvertUTF: restore compatibility with MSVC, which only implements C89

Dmitri Gribenko gribozavr at gmail.com
Mon Jun 16 04:22:34 PDT 2014


Author: gribozavr
Date: Mon Jun 16 06:22:33 2014
New Revision: 211016

URL: http://llvm.org/viewvc/llvm-project?rev=211016&view=rev
Log:
Support/ConvertUTF: restore compatibility with MSVC, which only implements C89

Modified:
    llvm/trunk/lib/Support/ConvertUTF.c

Modified: llvm/trunk/lib/Support/ConvertUTF.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/ConvertUTF.c?rev=211016&r1=211015&r2=211016&view=diff
==============================================================================
--- llvm/trunk/lib/Support/ConvertUTF.c (original)
+++ llvm/trunk/lib/Support/ConvertUTF.c Mon Jun 16 06:22:33 2014
@@ -396,6 +396,8 @@ Boolean isLegalUTF8Sequence(const UTF8 *
 static unsigned
 findMaximalSubpartOfIllFormedUTF8Sequence(const UTF8 *source,
                                           const UTF8 *sourceEnd) {
+  UTF8 b1, b2, b3;
+
   assert(!isLegalUTF8Sequence(source, sourceEnd));
 
   /*
@@ -415,7 +417,7 @@ findMaximalSubpartOfIllFormedUTF8Sequenc
    * Byte Sequences.
    */
 
-  UTF8 b1 = *source;
+  b1 = *source;
   ++source;
   if (b1 >= 0xC2 && b1 <= 0xDF) {
     /*
@@ -428,7 +430,7 @@ findMaximalSubpartOfIllFormedUTF8Sequenc
   if (source == sourceEnd)
     return 1;
 
-  UTF8 b2 = *source;
+  b2 = *source;
   ++source;
 
   if (b1 == 0xE0) {
@@ -448,7 +450,7 @@ findMaximalSubpartOfIllFormedUTF8Sequenc
       if (source == sourceEnd)
         return 2;
 
-      UTF8 b3 = *source;
+      b3 = *source;
       return (b3 >= 0x80 && b3 <= 0xBF) ? 3 : 2;
     }
     return 1;
@@ -458,7 +460,7 @@ findMaximalSubpartOfIllFormedUTF8Sequenc
       if (source == sourceEnd)
         return 2;
 
-      UTF8 b3 = *source;
+      b3 = *source;
       return (b3 >= 0x80 && b3 <= 0xBF) ? 3 : 2;
     }
     return 1;
@@ -468,7 +470,7 @@ findMaximalSubpartOfIllFormedUTF8Sequenc
       if (source == sourceEnd)
         return 2;
 
-      UTF8 b3 = *source;
+      b3 = *source;
       return (b3 >= 0x80 && b3 <= 0xBF) ? 3 : 2;
     }
     return 1;





More information about the llvm-commits mailing list