mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
ICU-174 ucmpXX_close(NULL) do not crash any more
X-SVN-Rev: 327
This commit is contained in:
parent
4305bff030
commit
dac21eaf6c
3 changed files with 48 additions and 38 deletions
|
@ -199,31 +199,39 @@ CompactShortArray* ucmp16_openAlias(uint16_t *indexArray,
|
|||
|
||||
void ucmp16_close(CompactShortArray* this_obj)
|
||||
{
|
||||
if(this_obj->fAlias == FALSE)
|
||||
{
|
||||
icu_free(this_obj->fArray);
|
||||
icu_free(this_obj->fIndex);
|
||||
if(this_obj != NULL) {
|
||||
if(!this_obj->fAlias) {
|
||||
if(this_obj->fArray != NULL) {
|
||||
icu_free(this_obj->fArray);
|
||||
}
|
||||
if(this_obj->fIndex != NULL) {
|
||||
icu_free(this_obj->fIndex);
|
||||
}
|
||||
}
|
||||
if(this_obj->fHashes != NULL) {
|
||||
icu_free(this_obj->fHashes);
|
||||
}
|
||||
icu_free(this_obj);
|
||||
}
|
||||
icu_free(this_obj->fHashes);
|
||||
icu_free(this_obj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
CompactShortArray* setToBogus(CompactShortArray* this_obj)
|
||||
{
|
||||
icu_free(this_obj->fArray);
|
||||
this_obj->fArray = NULL;
|
||||
if(this_obj != NULL) {
|
||||
if(!this_obj->fAlias) {
|
||||
icu_free(this_obj->fArray);
|
||||
this_obj->fArray = NULL;
|
||||
|
||||
icu_free(this_obj->fIndex);
|
||||
this_obj->fIndex = NULL;
|
||||
|
||||
icu_free(this_obj->fHashes);
|
||||
this_obj->fHashes = NULL;
|
||||
|
||||
this_obj->fCount = 0;
|
||||
this_obj->fCompact = FALSE;
|
||||
this_obj->fBogus = TRUE;
|
||||
icu_free(this_obj->fIndex);
|
||||
this_obj->fIndex = NULL;
|
||||
}
|
||||
icu_free(this_obj->fHashes);
|
||||
this_obj->fHashes = NULL;
|
||||
|
||||
this_obj->fCount = 0;
|
||||
this_obj->fCompact = FALSE;
|
||||
this_obj->fBogus = TRUE;
|
||||
}
|
||||
|
||||
return this_obj;
|
||||
}
|
||||
|
|
|
@ -196,17 +196,20 @@ CompactIntArray* ucmp32_openAdopt(uint16_t *indexArray, int32_t *newValues, int3
|
|||
|
||||
void ucmp32_close( CompactIntArray* this_obj)
|
||||
{
|
||||
icu_free(this_obj->fArray);
|
||||
this_obj->fArray = NULL;
|
||||
icu_free(this_obj->fIndex);
|
||||
this_obj->fIndex = NULL;
|
||||
this_obj->fCount = 0;
|
||||
this_obj->fCompact = FALSE;
|
||||
if(this_obj != NULL) {
|
||||
if(this_obj->fArray != NULL) {
|
||||
icu_free(this_obj->fArray);
|
||||
}
|
||||
if(this_obj->fIndex != NULL) {
|
||||
icu_free(this_obj->fIndex);
|
||||
}
|
||||
icu_free(this_obj);
|
||||
}
|
||||
}
|
||||
|
||||
bool_t ucmp32_isBogus(const CompactIntArray* this_obj)
|
||||
{
|
||||
return this_obj->fBogus;
|
||||
return this_obj == NULL || this_obj->fBogus;
|
||||
}
|
||||
|
||||
void ucmp32_expand(CompactIntArray* this_obj) {
|
||||
|
|
|
@ -138,18 +138,17 @@ CompactByteArray* ucmp8_openAlias(uint16_t *indexArray,
|
|||
|
||||
void ucmp8_close(CompactByteArray* this_obj)
|
||||
{
|
||||
if(this_obj->fAlias == FALSE)
|
||||
{
|
||||
icu_free(this_obj->fArray);
|
||||
icu_free(this_obj->fIndex);
|
||||
if(this_obj != NULL) {
|
||||
if(!this_obj->fAlias) {
|
||||
if(this_obj->fArray != NULL) {
|
||||
icu_free(this_obj->fArray);
|
||||
}
|
||||
if(this_obj->fIndex != NULL) {
|
||||
icu_free(this_obj->fIndex);
|
||||
}
|
||||
}
|
||||
icu_free(this_obj);
|
||||
}
|
||||
|
||||
this_obj->fArray = NULL;
|
||||
this_obj->fIndex = NULL;
|
||||
this_obj->fCount = 0;
|
||||
this_obj->fCompact = FALSE;
|
||||
this_obj->fAlias = TRUE;
|
||||
icu_free(this_obj);
|
||||
}
|
||||
|
||||
|
||||
|
@ -239,7 +238,7 @@ findOverlappingPosition(CompactByteArray* this_obj,
|
|||
bool_t
|
||||
ucmp8_isBogus(const CompactByteArray* this_obj)
|
||||
{
|
||||
return this_obj->fBogus;
|
||||
return this_obj == NULL || this_obj->fBogus;
|
||||
}
|
||||
|
||||
const int8_t*
|
||||
|
|
Loading…
Add table
Reference in a new issue