mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 1306329 part A - nsUTF8Utils is used from outside libxul, and NS_WARNING now only works from within libxul, so make its usage conditional, r=froydnj
MozReview-Commit-ID: HRYpj8C9c5k --HG-- extra : rebase_source : 835701132df22a2713c79a36a337194626624e1c
This commit is contained in:
parent
f7206fa30e
commit
eebe7c8cdb
@ -17,6 +17,12 @@
|
||||
|
||||
#include "nsCharTraits.h"
|
||||
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
#define UTF8UTILS_WARNING(msg) NS_WARNING(msg)
|
||||
#else
|
||||
#define UTF8UTILS_WARNING(msg)
|
||||
#endif
|
||||
|
||||
class UTF8traits
|
||||
{
|
||||
public:
|
||||
@ -210,7 +216,7 @@ public:
|
||||
// as an error and return the Unicode replacement
|
||||
// character 0xFFFD.
|
||||
|
||||
NS_WARNING("Unexpected end of buffer after high surrogate");
|
||||
UTF8UTILS_WARNING("Unexpected end of buffer after high surrogate");
|
||||
|
||||
if (aErr) {
|
||||
*aErr = true;
|
||||
@ -243,7 +249,7 @@ public:
|
||||
// treated as an illegally terminated code unit sequence
|
||||
// (also Chapter 3 D91, "isolated [not paired and ill-formed]
|
||||
// UTF-16 code units in the range D800..DFFF are ill-formed").
|
||||
NS_WARNING("got a High Surrogate but no low surrogate");
|
||||
UTF8UTILS_WARNING("got a High Surrogate but no low surrogate");
|
||||
|
||||
if (aErr) {
|
||||
*aErr = true;
|
||||
@ -258,7 +264,7 @@ public:
|
||||
// this as an error and return the Unicode replacement
|
||||
// character 0xFFFD.
|
||||
|
||||
NS_WARNING("got a low Surrogate but no high surrogate");
|
||||
UTF8UTILS_WARNING("got a low Surrogate but no high surrogate");
|
||||
if (aErr) {
|
||||
*aErr = true;
|
||||
}
|
||||
@ -492,7 +498,7 @@ public:
|
||||
*out++ = '\xBF';
|
||||
*out++ = '\xBD';
|
||||
|
||||
NS_WARNING("String ending in half a surrogate pair!");
|
||||
UTF8UTILS_WARNING("String ending in half a surrogate pair!");
|
||||
|
||||
break;
|
||||
}
|
||||
@ -525,7 +531,7 @@ public:
|
||||
// D800..DFFF are ill-formed").
|
||||
p--;
|
||||
|
||||
NS_WARNING("got a High Surrogate but no low surrogate");
|
||||
UTF8UTILS_WARNING("got a High Surrogate but no low surrogate");
|
||||
}
|
||||
} else { // U+DC00 - U+DFFF
|
||||
// Treat broken characters as the Unicode replacement
|
||||
@ -535,7 +541,7 @@ public:
|
||||
*out++ = '\xBD';
|
||||
|
||||
// DC00- DFFF - Low Surrogate
|
||||
NS_WARNING("got a low Surrogate but no high surrogate");
|
||||
UTF8UTILS_WARNING("got a low Surrogate but no high surrogate");
|
||||
}
|
||||
}
|
||||
|
||||
@ -591,7 +597,7 @@ public:
|
||||
// UTF-8)
|
||||
mSize += 3;
|
||||
|
||||
NS_WARNING("String ending in half a surrogate pair!");
|
||||
UTF8UTILS_WARNING("String ending in half a surrogate pair!");
|
||||
|
||||
break;
|
||||
}
|
||||
@ -614,14 +620,14 @@ public:
|
||||
// are ill-formed").
|
||||
p--;
|
||||
|
||||
NS_WARNING("got a high Surrogate but no low surrogate");
|
||||
UTF8UTILS_WARNING("got a high Surrogate but no low surrogate");
|
||||
}
|
||||
} else { // U+DC00 - U+DFFF
|
||||
// Treat broken characters as the Unicode replacement
|
||||
// character 0xFFFD (0xEFBFBD in UTF-8)
|
||||
mSize += 3;
|
||||
|
||||
NS_WARNING("got a low Surrogate but no high surrogate");
|
||||
UTF8UTILS_WARNING("got a low Surrogate but no high surrogate");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -739,4 +745,6 @@ RewindToPriorUTF8Codepoint(const Char* utf8Chars, UnsignedT index)
|
||||
return index;
|
||||
}
|
||||
|
||||
#undef UTF8UTILS_WARNING
|
||||
|
||||
#endif /* !defined(nsUTF8Utils_h_) */
|
||||
|
Loading…
Reference in New Issue
Block a user