ICU-9551 fix uconfig failures that were in m2, disable CJKBreak without normalization. Merges from r32354 and r32355 by dsengup.

X-SVN-Rev: 32367
This commit is contained in:
Steven R. Loomis 2012-09-11 04:02:08 +00:00
parent 9fcdf69b9f
commit 1361355eb5
7 changed files with 33 additions and 6 deletions

View file

@ -231,7 +231,9 @@ ICULanguageBreakFactory::loadEngineFor(UChar32 c, int32_t breakType) {
case USCRIPT_KHMER:
engine = new KhmerBreakEngine(m, status);
break;
#if !UCONFIG_NO_NORMALIZATION
// CJK not available w/o normalization
case USCRIPT_HANGUL:
engine = new CjkBreakEngine(m, kKorean, status);
break;
@ -255,6 +257,8 @@ ICULanguageBreakFactory::loadEngineFor(UChar32 c, int32_t breakType) {
break;
}
#endif
#endif
default:
break;
}

View file

@ -644,6 +644,7 @@ foundBest:
return wordsFound;
}
#if !UCONFIG_NO_NORMALIZATION
/*
******************************************************************
* CjkBreakEngine
@ -933,6 +934,7 @@ CjkBreakEngine::divideUpDictionaryRange( UText *text,
utext_close(&normalizedText);
return numBreaks;
}
#endif
U_NAMESPACE_END

View file

@ -186,6 +186,8 @@ class ThaiBreakEngine : public DictionaryBreakEngine {
};
#if !UCONFIG_NO_NORMALIZATION
/*******************************************************************
* CjkBreakEngine
*/
@ -247,6 +249,8 @@ class CjkBreakEngine : public DictionaryBreakEngine {
};
#endif
/*******************************************************************
* KhmerBreakEngine
*/

View file

@ -15,6 +15,8 @@
#include "unicode/udata.h"
#include "cmemory.h"
#if !UCONFIG_NO_BREAK_ITERATION
U_NAMESPACE_BEGIN
#ifndef CYGWINMSVC /* On Cygwin/MSVC, the error redefinition of symbols occurs.*/
@ -223,4 +225,4 @@ udict_swap(const UDataSwapper *ds, const void *inData, int32_t length,
}
return headerSize + size;
}
#endif

View file

@ -47,6 +47,7 @@ format.h
fpositer.h
gregocal.h
idna.h
listformatter.h
locdspnm.h
locid.h
measfmt.h

View file

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2003-2011, International Business Machines
* Copyright (C) 2003-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -1524,6 +1524,15 @@ void TestIDNA::TestCompareReferenceImpl(){
UChar src [2] = {0,0};
int32_t srcLen = 0;
// data even OK?
{
UErrorCode dataStatus = U_ZERO_ERROR;
loadTestData(dataStatus);
if(U_FAILURE(dataStatus)) {
errln("Couldn't load test data: %s\n", u_errorName(dataStatus)); // save us from thousands and thousands of errors
return;
}
}
for (int32_t i = 0; i <= 0x10FFFF; i++){
if (quick == TRUE && i > 0x0FFF){

View file

@ -97,6 +97,8 @@ static UDataInfo dataInfo = {
{ 0, 0, 0, 0 } /* data version */
};
#if !UCONFIG_NO_BREAK_ITERATION
// A wrapper for both BytesTrieBuilder and UCharsTrieBuilder.
// may want to put this somewhere in ICU, as it could be useful outside
// of this tool?
@ -199,6 +201,7 @@ public:
return (int32_t)(transformType | transformConstant);
}
};
#endif
static const UChar LINEFEED_CHARACTER = 0x000A;
static const UChar CARRIAGE_RETURN_CHARACTER = 0x000D;
@ -274,19 +277,21 @@ int main(int argc, char **argv) {
IcuToolErrorCode status("gendict/main()");
#if UCONFIG_NO_BREAK_ITERATION || UCONFIG_NO_FILE_IO
const char* outDir=NULL;
UNewDataMemory *pData;
char msg[1024];
UErrorCode tempstatus = U_ZERO_ERROR;
/* write message with just the name */ // potential for a buffer overflow here...
sprintf(msg, "gendict writes dummy %s because of UCONFIG_NO_BREAK_ITERATION and/or UCONFIG_NO_FILE_IO, see uconfig.h", outFileName);
fprintf(stderr, "%s\n", msg);
/* write the dummy data file */
pData = udata_create(outDir, NULL, outFileName, &dataInfo, NULL, &status);
pData = udata_create(outDir, NULL, outFileName, &dataInfo, NULL, &tempstatus);
udata_writeBlock(pData, msg, strlen(msg));
udata_finish(pData, &status);
return (int)status;
udata_finish(pData, &tempstatus);
return (int)tempstatus;
#else
// Read in the dictionary source file