Skip to content

Commit

Permalink
Support/ConvertUTF: restore compatibility with MSVC, which only imple…
Browse files Browse the repository at this point in the history
…ments C89

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211016 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
gribozavr committed Jun 16, 2014
1 parent 9becc6c commit 438c85b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/Support/ConvertUTF.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
static unsigned
findMaximalSubpartOfIllFormedUTF8Sequence(const UTF8 *source,
const UTF8 *sourceEnd) {
UTF8 b1, b2, b3;

assert(!isLegalUTF8Sequence(source, sourceEnd));

/*
Expand All @@ -415,7 +417,7 @@ findMaximalSubpartOfIllFormedUTF8Sequence(const UTF8 *source,
* Byte Sequences.
*/

UTF8 b1 = *source;
b1 = *source;
++source;
if (b1 >= 0xC2 && b1 <= 0xDF) {
/*
Expand All @@ -428,7 +430,7 @@ findMaximalSubpartOfIllFormedUTF8Sequence(const UTF8 *source,
if (source == sourceEnd)
return 1;

UTF8 b2 = *source;
b2 = *source;
++source;

if (b1 == 0xE0) {
Expand All @@ -448,7 +450,7 @@ findMaximalSubpartOfIllFormedUTF8Sequence(const UTF8 *source,
if (source == sourceEnd)
return 2;

UTF8 b3 = *source;
b3 = *source;
return (b3 >= 0x80 && b3 <= 0xBF) ? 3 : 2;
}
return 1;
Expand All @@ -458,7 +460,7 @@ findMaximalSubpartOfIllFormedUTF8Sequence(const UTF8 *source,
if (source == sourceEnd)
return 2;

UTF8 b3 = *source;
b3 = *source;
return (b3 >= 0x80 && b3 <= 0xBF) ? 3 : 2;
}
return 1;
Expand All @@ -468,7 +470,7 @@ findMaximalSubpartOfIllFormedUTF8Sequence(const UTF8 *source,
if (source == sourceEnd)
return 2;

UTF8 b3 = *source;
b3 = *source;
return (b3 >= 0x80 && b3 <= 0xBF) ? 3 : 2;
}
return 1;
Expand Down

0 comments on commit 438c85b

Please sign in to comment.