Bug 1203412 - Fix a warning in intl/unicharutil/. r=emk.

This change is for the following warning-as-error that shows up on "B2G L
Emulator" builds: "error: call to 'sprintf' declared with attribute warning:
sprintf is often misused; please use snprintf".

The patch also removes two ALLOW_COMPILER_WARNINGS=True flags, which are no
longer necessary.

--HG--
extra : rebase_source : 7fcbb06ca94b93bab4b75f6701b7f8a4838f1767
This commit is contained in:
Nicholas Nethercote 2015-09-10 08:01:24 -07:00
parent 8d622f7ff4
commit 98d9b76132
3 changed files with 5 additions and 8 deletions

View File

@ -10,6 +10,7 @@
#include "nsString.h"
#include "nsCharTraits.h"
#include "nsServiceManagerUtils.h"
#include "mozilla/Snprintf.h"
struct testcaseLine {
wchar_t* c1;
@ -136,7 +137,6 @@ bool TestUnspecifiedCodepoint(uint32_t codepoint)
bool rv = true;
char16_t unicharArray[3];
nsAutoString X, normalized;
char description[9];
if (IS_IN_BMP(codepoint)) {
unicharArray[0] = codepoint;
@ -157,8 +157,11 @@ bool TestUnspecifiedCodepoint(uint32_t codepoint)
X == NFC(X) == NFD(X) == NFKC(X) == NFKD(X)
*/
static const size_t len = 9;
char description[len];
DEBUG_TESTCASE(X);
sprintf(description, "U+%04X", codepoint);
snprintf(description, len, "U+%04X", codepoint);
NORMALIZE_AND_COMPARE(X, X, NFC, description);
NORMALIZE_AND_COMPARE(X, X, NFD, description);
NORMALIZE_AND_COMPARE(X, X, NFKC, description);

View File

@ -8,7 +8,4 @@ SOURCES += [
'NormalizationTest.cpp',
]
# XXX: We should fix these warnings.
ALLOW_COMPILER_WARNINGS = True
FINAL_LIBRARY = 'xul-gtest'

View File

@ -43,7 +43,4 @@ if CONFIG['ENABLE_INTL_API']:
CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS']
USE_LIBS += ['icu']
if not CONFIG['GNU_CXX']:
ALLOW_COMPILER_WARNINGS = True
DIST_INSTALL = True