ICU-20159 Fixing gcc warnings in project and test code.
This commit is contained in:
parent
8018eb84e7
commit
fd5faeb48b
@ -264,7 +264,9 @@ public:
|
||||
// The trie stores values for lead surrogate code *units*.
|
||||
// Surrogate code *points* are inert.
|
||||
uint16_t getNorm16(UChar32 c) const {
|
||||
return U_IS_LEAD(c) ? INERT : UCPTRIE_FAST_GET(normTrie, UCPTRIE_16, c);
|
||||
return U_IS_LEAD(c) ?
|
||||
static_cast<uint16_t>(INERT) :
|
||||
UCPTRIE_FAST_GET(normTrie, UCPTRIE_16, c);
|
||||
}
|
||||
uint16_t getRawNorm16(UChar32 c) const { return UCPTRIE_FAST_GET(normTrie, UCPTRIE_16, c); }
|
||||
|
||||
|
@ -156,6 +156,7 @@ U_CFUNC int u_wmsg(FILE *fp, const char *tag, ... )
|
||||
uprint(msg,msgLen, fp, &err);
|
||||
}
|
||||
#else
|
||||
(void)gNoFormatting; // suppress -Wunused-variable
|
||||
va_start(ap, tag);
|
||||
|
||||
resultLength = u_vformatMessage(uloc_getDefault(), msg, msgLen, result, resultLength, ap, &err);
|
||||
|
@ -377,7 +377,7 @@ UnicodeString& ListFormatter::format(
|
||||
int32_t offset;
|
||||
FieldPositionIteratorHandler handler(posIter, errorCode);
|
||||
return format_(items, nItems, appendTo, -1, offset, &handler, errorCode);
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
UnicodeString& ListFormatter::format(
|
||||
|
@ -90,7 +90,7 @@ static void testContext(void);
|
||||
static void doTailTest(void);
|
||||
|
||||
static void testBracketOverflow(void);
|
||||
static void TestExplicitLevel0();
|
||||
static void TestExplicitLevel0(void);
|
||||
|
||||
/* new BIDI API */
|
||||
static void testReorderingMode(void);
|
||||
@ -139,7 +139,7 @@ addComplexTest(TestNode** root) {
|
||||
addTest(root, testGetBaseDirection, "complex/bidi/testGetBaseDirection");
|
||||
addTest(root, testContext, "complex/bidi/testContext");
|
||||
addTest(root, testBracketOverflow, "complex/bidi/TestBracketOverflow");
|
||||
addTest(root, &TestExplicitLevel0, "complex/bidi/TestExplicitLevel0");
|
||||
addTest(root, TestExplicitLevel0, "complex/bidi/TestExplicitLevel0");
|
||||
|
||||
addTest(root, doArabicShapingTest, "complex/arabic-shaping/ArabicShapingTest");
|
||||
addTest(root, doLamAlefSpecialVLTRArabicShapingTest, "complex/arabic-shaping/lamalef");
|
||||
@ -4927,7 +4927,7 @@ testBracketOverflow(void) {
|
||||
ubidi_close(bidi);
|
||||
}
|
||||
|
||||
static void TestExplicitLevel0() {
|
||||
static void TestExplicitLevel0(void) {
|
||||
// The following used to fail with an error, see ICU ticket #12922.
|
||||
static const UChar text[2] = { 0x202d, 0x05d0 };
|
||||
static UBiDiLevel embeddings[2] = { 0, 0 };
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "cstring.h"
|
||||
#include "uparse.h"
|
||||
#include "uresimp.h"
|
||||
#include "uassert.h"
|
||||
|
||||
#include "unicode/putil.h"
|
||||
#include "unicode/ubrk.h"
|
||||
@ -1776,6 +1777,7 @@ static void TestKeywordVariants(void)
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
resultLen = uloc_getName(testCases[i].localeID, buffer, 256, &status);
|
||||
U_ASSERT(resultLen < 256);
|
||||
if (U_SUCCESS(status)) {
|
||||
if (testCases[i].expectedLocaleID == 0) {
|
||||
log_err("Expected uloc_getName(\"%s\") to fail; got \"%s\"\n",
|
||||
@ -1793,6 +1795,7 @@ static void TestKeywordVariants(void)
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
resultLen = uloc_getBaseName(testCases[i].localeID, buffer, 256, &status);
|
||||
U_ASSERT(resultLen < 256);
|
||||
if (U_SUCCESS(status)) {
|
||||
if (testCases[i].expectedLocaleIDNoKeywords == 0) {
|
||||
log_err("Expected uloc_getBaseName(\"%s\") to fail; got \"%s\"\n",
|
||||
@ -1810,6 +1813,7 @@ static void TestKeywordVariants(void)
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
resultLen = uloc_canonicalize(testCases[i].localeID, buffer, 256, &status);
|
||||
U_ASSERT(resultLen < 256);
|
||||
if (U_SUCCESS(status)) {
|
||||
if (testCases[i].expectedCanonicalID == 0) {
|
||||
log_err("Expected uloc_canonicalize(\"%s\") to fail; got \"%s\"\n",
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "cmemory.h"
|
||||
#include "cstring.h"
|
||||
#include "putilimp.h"
|
||||
#include "uassert.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -1822,6 +1823,7 @@ static void TestRBNFRounding() {
|
||||
return;
|
||||
}
|
||||
len = unum_formatDouble(fmt, 10.123456789, fmtbuf, FORMAT_BUF_CAPACITY, NULL, &status);
|
||||
U_ASSERT(len < FORMAT_BUF_CAPACITY);
|
||||
if (U_FAILURE(status)) {
|
||||
log_err_status(status, "unum_formatDouble 10.123456789 failed with %s\n", u_errorName(status));
|
||||
}
|
||||
@ -1841,6 +1843,7 @@ static void TestRBNFRounding() {
|
||||
log_err("UNUM_ROUNDING_MODE was not set -> %d\n", unum_getAttribute(fmt, UNUM_ROUNDING_MODE));
|
||||
}
|
||||
len = unum_formatDouble(fmt, 10.123456789, fmtbuf, FORMAT_BUF_CAPACITY, NULL, &status);
|
||||
U_ASSERT(len < FORMAT_BUF_CAPACITY);
|
||||
if (U_FAILURE(status)) {
|
||||
log_err_status(status, "unum_formatDouble 10.123456789 failed with %s\n", u_errorName(status));
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ U_CDECL_BEGIN
|
||||
static punycode_uint decode_digit(punycode_uint cp)
|
||||
{
|
||||
return cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 :
|
||||
cp - 97 < 26 ? cp - 97 : base;
|
||||
cp - 97 < 26 ? cp - 97 : static_cast<punycode_uint>(base);
|
||||
}
|
||||
|
||||
/* encode_digit(d,flag) returns the basic code point whose value */
|
||||
@ -191,8 +191,8 @@ enum punycode_status punycode_encode(
|
||||
|
||||
for (q = delta, k = base; ; k += base) {
|
||||
if (out >= max_out) return punycode_big_output;
|
||||
t = k <= bias /* + tmin */ ? tmin : /* +tmin not needed */
|
||||
k >= bias + tmax ? tmax : k - bias;
|
||||
t = k <= bias /* + tmin */ ? static_cast<punycode_uint>(tmin) : /* +tmin not needed */
|
||||
k >= bias + tmax ? static_cast<punycode_uint>(tmax) : k - bias;
|
||||
if (q < t) break;
|
||||
output[out++] = encode_digit(t + (q - t) % (base - t), 0);
|
||||
q = (q - t) / (base - t);
|
||||
@ -263,8 +263,8 @@ enum punycode_status punycode_decode(
|
||||
if (digit >= base) return punycode_bad_input;
|
||||
if (digit > (maxint - i) / w) return punycode_overflow;
|
||||
i += digit * w;
|
||||
t = k <= bias /* + tmin */ ? tmin : /* +tmin not needed */
|
||||
k >= bias + tmax ? tmax : k - bias;
|
||||
t = k <= bias /* + tmin */ ? static_cast<punycode_uint>(tmin) : /* +tmin not needed */
|
||||
k >= bias + tmax ? static_cast<punycode_uint>(tmax) : k - bias;
|
||||
if (digit < t) break;
|
||||
if (w > maxint / (base - t)) return punycode_overflow;
|
||||
w *= (base - t);
|
||||
|
@ -512,17 +512,18 @@ void TransliteratorAPITest::TestKeyboardTransliterator1(){
|
||||
logln("Testing transliterate(Replaceable, int32_t, UChar, UErrorCode)");
|
||||
for(i=10; i<UPRV_LENGTHOF(Data); i=i+2){
|
||||
UnicodeString log;
|
||||
if (Data[i+0] != "") {
|
||||
log = s + " + " + Data[i+0] + " -> ";
|
||||
UChar c=Data[i+0].charAt(0);
|
||||
t->transliterate(s, index, c, status);
|
||||
if(U_FAILURE(status))
|
||||
if (Data[i+0] != "") {
|
||||
log = s + " + " + Data[i+0] + " -> ";
|
||||
UChar c=Data[i+0].charAt(0);
|
||||
t->transliterate(s, index, c, status);
|
||||
if(U_FAILURE(status)) {
|
||||
errln("FAIL: " + t->getID()+ ".transliterate(Replaceable, int32_t[], UChar, UErrorCode)-->" + (UnicodeString)u_errorName(status));
|
||||
continue;
|
||||
}else {
|
||||
}
|
||||
} else {
|
||||
log = s + " => ";
|
||||
t->finishTransliteration(s, index);
|
||||
}
|
||||
}
|
||||
// Show the start index '{' and the cursor '|'
|
||||
displayOutput(s, Data[i+1], log, index);
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "cmemory.h"
|
||||
#include "transrt.h"
|
||||
#include "testutil.h"
|
||||
#include "uassert.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@ -1047,6 +1048,7 @@ static void writeStringInU8(FILE *out, const UnicodeString &s) {
|
||||
UBool isError = FALSE;
|
||||
int32_t destIdx = 0;
|
||||
U8_APPEND(bufForOneChar, destIdx, (int32_t)sizeof(bufForOneChar), c, isError);
|
||||
U_ASSERT(!isError);
|
||||
fwrite(bufForOneChar, 1, destIdx, out);
|
||||
}
|
||||
}
|
||||
|
@ -653,7 +653,8 @@ compactToUnicode2(UCMStates *states,
|
||||
/* for each lead byte */
|
||||
for(i=0; i<256; ++i) {
|
||||
entry=states->stateTable[leadState][i];
|
||||
if(MBCS_ENTRY_IS_TRANSITION(entry) && (MBCS_ENTRY_TRANSITION_STATE(entry))==trailState) {
|
||||
if(MBCS_ENTRY_IS_TRANSITION(entry) &&
|
||||
(MBCS_ENTRY_TRANSITION_STATE(entry))==static_cast<uint32_t>(trailState)) {
|
||||
/* the offset is different for each lead byte */
|
||||
offset=MBCS_ENTRY_TRANSITION_OFFSET(entry);
|
||||
/* for each trail byte for this lead byte */
|
||||
|
Loading…
Reference in New Issue
Block a user