ICU-9687 Propagate the ambiguous alias warning when opening converter

X-SVN-Rev: 32907
This commit is contained in:
Michael Ow 2012-11-29 21:38:40 +00:00
parent b6ab4f46c4
commit ebad01d878
2 changed files with 10 additions and 8 deletions

View File

@ -793,6 +793,8 @@ ucnv_loadSharedData(const char *converterName,
* without updating the alias table, or when there is no alias table
*/
pArgs->name = pPieces->cnvName;
} else if (internalErrorCode == U_AMBIGUOUS_ALIAS_WARNING) {
*err = U_AMBIGUOUS_ALIAS_WARNING;
}
}

View File

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2010, International Business Machines Corporation and
* Copyright (c) 1997-2012, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*****************************************************************************
@ -390,14 +390,14 @@ static void TestErrorBehaviour(){
expectedSUB, sizeof(expectedSUB), "ibm-1363", 0, TRUE, U_ZERO_ERROR))
log_err("u-> ibm-1363 [UCNV_DBCS portion] is supposed to fail\n");
if(!convertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
expected, sizeof(expected), "ibm-1363", 0, FALSE, U_ZERO_ERROR))
expected, sizeof(expected), "ibm-1363", 0, FALSE, U_AMBIGUOUS_ALIAS_WARNING))
log_err("u-> ibm-1363 [UCNV_DBCS portion] is supposed to fail\n");
if(!convertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
expectedSUB, sizeof(expectedSUB), "ibm-1363", offsetsSUB, TRUE, U_ZERO_ERROR))
log_err("u-> ibm-1363 [UCNV_DBCS portion] is supposed to fail\n");
if(!convertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
expected, sizeof(expected), "ibm-1363", offsets, FALSE, U_ZERO_ERROR))
expected, sizeof(expected), "ibm-1363", offsets, FALSE, U_AMBIGUOUS_ALIAS_WARNING))
log_err("u-> ibm-1363 [UCNV_DBCS portion] is supposed to fail\n");
@ -413,7 +413,7 @@ static void TestErrorBehaviour(){
expectedSUB, sizeof(expectedSUB), "ibm-1363", 0, TRUE, U_ZERO_ERROR))
log_err("u-> ibm-1363 [UCNV_MBCS] \n");
if(!convertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
expected, sizeof(expected), "ibm-1363", 0, FALSE, U_ZERO_ERROR))
expected, sizeof(expected), "ibm-1363", 0, FALSE, U_AMBIGUOUS_ALIAS_WARNING))
log_err("u-> ibm-1363 [UCNV_MBCS] \n");
if(!convertFromU(sampleText2, sizeof(sampleText2)/sizeof(sampleText2[0]),
@ -460,8 +460,8 @@ static void TestErrorBehaviour(){
expectedSUB, sizeof(expectedSUB), "iso-2022-jp", offsets, TRUE, U_ZERO_ERROR))
log_err("u-> iso-2022-jp [UCNV_MBCS] \n");
if(!convertFromU(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
expected, sizeof(expected), "iso-2022-jp", offsets, FALSE, U_ZERO_ERROR))
log_err("u-> ibm-1363 [UCNV_MBCS] \n");
expected, sizeof(expected), "iso-2022-jp", offsets, FALSE, U_AMBIGUOUS_ALIAS_WARNING))
log_err("u-> iso-2022-jp [UCNV_MBCS] \n");
if(!convertFromU(sampleText2, sizeof(sampleText2)/sizeof(sampleText2[0]),
expected2, sizeof(expected2), "iso-2022-jp", offsets2, TRUE, U_ZERO_ERROR))
@ -636,10 +636,10 @@ static void TestToUnicodeErrorBehaviour()
const UChar expected[] = { 0x00a1 };
if(!convertToU(sampleText, sizeof(sampleText),
expected, sizeof(expected)/sizeof(expected[0]), "ibm-1363", 0, TRUE, U_ZERO_ERROR ))
expected, sizeof(expected)/sizeof(expected[0]), "ibm-1363", 0, TRUE, U_AMBIGUOUS_ALIAS_WARNING ))
log_err("DBCS (ibm-1363)->Unicode did not match.\n");
if(!convertToU(sampleText, sizeof(sampleText),
expected, sizeof(expected)/sizeof(expected[0]), "ibm-1363", 0, FALSE, U_ZERO_ERROR ))
expected, sizeof(expected)/sizeof(expected[0]), "ibm-1363", 0, FALSE, U_AMBIGUOUS_ALIAS_WARNING ))
log_err("DBCS (ibm-1363)->Unicode with flush = false did not match.\n");
}
log_verbose("Testing error conditions for SBCS\n");