mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 06:25:30 +00:00
ICU-2135 fixing memory problems
X-SVN-Rev: 10407
This commit is contained in:
parent
6540e5e838
commit
8e192f2f4a
7 changed files with 34 additions and 13 deletions
|
@ -2940,12 +2940,12 @@ unorm_previous(UCharIterator *src,
|
|||
UBool doNormalize, UBool *pNeededToNormalize,
|
||||
UErrorCode *pErrorCode) {
|
||||
UChar stackBuffer[100];
|
||||
UChar *buffer;
|
||||
IsPrevBoundaryFn *isPreviousBoundary;
|
||||
uint32_t mask;
|
||||
int32_t startIndex, bufferLength, bufferCapacity, destLength;
|
||||
int32_t c, c2;
|
||||
UChar minC;
|
||||
UChar *buffer=NULL;
|
||||
IsPrevBoundaryFn *isPreviousBoundary=NULL;
|
||||
uint32_t mask=0;
|
||||
int32_t startIndex=0, bufferLength=0, bufferCapacity=0, destLength=0;
|
||||
int32_t c=0, c2=0;
|
||||
UChar minC=0;
|
||||
|
||||
/* check argument values */
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
|
@ -3031,7 +3031,7 @@ unorm_previous(UCharIterator *src,
|
|||
if(pNeededToNormalize!=0 && U_SUCCESS(*pErrorCode)) {
|
||||
*pNeededToNormalize=
|
||||
(UBool)(destLength!=bufferLength ||
|
||||
0!=uprv_memcmp(dest, buffer, destLength*U_SIZEOF_UCHAR));
|
||||
0!=uprv_memcmp(dest, buffer+startIndex, destLength*U_SIZEOF_UCHAR));
|
||||
}
|
||||
} else {
|
||||
/* just copy the source characters */
|
||||
|
|
|
@ -342,7 +342,7 @@ static void TestNewFormatAndParseAPI(void)
|
|||
UDate d1,d;
|
||||
UDateFormat *def1;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
double value;
|
||||
double value = 0.0;
|
||||
UChar ret[30];
|
||||
UParseError parseError;
|
||||
UMessageFormat* fmt = NULL;
|
||||
|
@ -437,13 +437,14 @@ static void TestSampleFormatAndParseWithError(void)
|
|||
|
||||
UChar *result, *tzID, *str;
|
||||
UChar pattern[100];
|
||||
|
||||
UChar expected[100];
|
||||
int32_t resultLengthOut, resultlength;
|
||||
UCalendar *cal;
|
||||
UDate d1,d;
|
||||
UDateFormat *def1;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
double value;
|
||||
double value = 0.0;
|
||||
UChar ret[30];
|
||||
UParseError parseError;
|
||||
|
||||
|
@ -534,7 +535,7 @@ static void TestSampleFormatAndParse()
|
|||
UDate d1,d;
|
||||
UDateFormat *def1;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
double value;
|
||||
double value = 0.0;
|
||||
UChar ret[30];
|
||||
log_verbose("Testing format and parse\n");
|
||||
|
||||
|
|
|
@ -3932,6 +3932,9 @@ static void TestJitterbug2411(){
|
|||
log_err("iso-2022-kr_1 cannot handle multiple escape sequences : %s\n", u_errorName(errorCode));
|
||||
return;
|
||||
}
|
||||
|
||||
ucnv_close(kr);
|
||||
ucnv_close(kr1);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -292,6 +292,7 @@ static void TestInitialization(void)
|
|||
UErrorCode status = U_ZERO_ERROR;
|
||||
UChar pattern[512];
|
||||
const UChar text[] = {0x61, 0x62, 0x63, 0x64, 0x65, 0x66};
|
||||
int32_t i = 0;
|
||||
UStringSearch *result;
|
||||
|
||||
/* simple test on the pattern ce construction */
|
||||
|
@ -306,7 +307,10 @@ static void TestInitialization(void)
|
|||
usearch_close(result);
|
||||
|
||||
/* testing if an extremely large pattern will fail the initialization */
|
||||
uprv_memset(pattern, 0x41, 512);
|
||||
for(i = 0; i < 512; i++) {
|
||||
pattern[i] = 0x41;
|
||||
}
|
||||
/*uprv_memset(pattern, 0x41, 512);*/
|
||||
result = usearch_openFromCollator(pattern, 512, text, 3, EN_US_, NULL,
|
||||
&status);
|
||||
if (U_FAILURE(status)) {
|
||||
|
@ -1026,6 +1030,8 @@ static void TestGetSetOffset(void)
|
|||
UChar text[128];
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UStringSearch *strsrch;
|
||||
memset(pattern, 0, 32*sizeof(UChar));
|
||||
memset(text, 0, 128*sizeof(UChar));
|
||||
|
||||
open();
|
||||
if (usearch_getOffset(NULL) != USEARCH_DONE) {
|
||||
|
|
|
@ -1738,6 +1738,7 @@ void CollationAPITest::TestUClassID()
|
|||
if (id != 0) {
|
||||
errln("Dynamic class id for CollationElementIterator should be 0");
|
||||
}
|
||||
delete key;
|
||||
delete iter;
|
||||
delete coll;
|
||||
}
|
||||
|
|
|
@ -1097,6 +1097,7 @@ void ICUServiceTest::testLocale() {
|
|||
lkey->fallback();
|
||||
logln("lkey descriptor 3: " + lkey->currentDescriptor(result));
|
||||
result.remove();
|
||||
delete lkey; // tentatively weiv
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1163,6 +1164,13 @@ void ICUServiceTest::testLocale() {
|
|||
errln("could not create available locales");
|
||||
}
|
||||
}
|
||||
delete one;
|
||||
delete two;
|
||||
delete root;
|
||||
delete german;
|
||||
delete germany;
|
||||
delete japanese;
|
||||
delete japan;
|
||||
}
|
||||
|
||||
class WrapFactory : public ICUServiceFactory {
|
||||
|
|
|
@ -481,8 +481,10 @@ void TimeZoneRegressionTest:: Test4151406() {
|
|||
max = count;
|
||||
logln(hname + ' ' + count +
|
||||
((count > 0) ? (" e.g. " + *ids->snext(ec)) : UnicodeString("")));
|
||||
// delete [] ids;
|
||||
uprv_free(ids);
|
||||
// weiv 11/27/2002: why uprv_free? This should be a delete
|
||||
delete ids;
|
||||
//delete [] ids;
|
||||
//uprv_free(ids);
|
||||
/*} catch (Exception e) {
|
||||
errln(hname + ' ' + "Fail: " + e);
|
||||
}*/
|
||||
|
|
Loading…
Add table
Reference in a new issue