static int32_t U_CALLCONV
compareElementStrings(const void *context, const void *left, const void *right) {
- const CharString *strings=reinterpret_cast<const CharString *>(context);
- const BytesTrieElement *leftElement=reinterpret_cast<const BytesTrieElement *>(left);
- const BytesTrieElement *rightElement=reinterpret_cast<const BytesTrieElement *>(right);
+ const CharString *strings=static_cast<const CharString *>(context);
+ const BytesTrieElement *leftElement=static_cast<const BytesTrieElement *>(left);
+ const BytesTrieElement *rightElement=static_cast<const BytesTrieElement *>(right);
return leftElement->compareStringTo(*rightElement, *strings);
}
}
if(bytesCapacity<capacity) {
uprv_free(bytes);
- bytes=reinterpret_cast<char *>(uprv_malloc(capacity));
+ bytes=static_cast<char *>(uprv_malloc(capacity));
if(bytes==NULL) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
bytesCapacity=0;
do {
newCapacity*=2;
} while(newCapacity<=length);
- char *newBytes=reinterpret_cast<char *>(uprv_malloc(newCapacity));
+ char *newBytes=static_cast<char *>(uprv_malloc(newCapacity));
if(newBytes==NULL) {
// unable to allocate memory
uprv_free(bytes);
/*
*******************************************************************************
-* Copyright (C) 2010-2011, International Business Machines
+* Copyright (C) 2010-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: bytestrieiterator.cpp
BytesTrie::Iterator::Iterator(const void *trieBytes, int32_t maxStringLength,
UErrorCode &errorCode)
- : bytes_(reinterpret_cast<const uint8_t *>(trieBytes)),
+ : bytes_(static_cast<const uint8_t *>(trieBytes)),
pos_(bytes_), initialPos_(bytes_),
remainingMatchLength_(-1), initialRemainingMatchLength_(-1),
str_(NULL), maxLength_(maxStringLength), value_(0), stack_(NULL) {
if ((p = uprv_strchr(posixID, '.')) != NULL) {
/* assume new locale can't be larger than old one? */
- correctedPOSIXLocale = reinterpret_cast<char *>(uprv_malloc(uprv_strlen(posixID)+1));
+ correctedPOSIXLocale = static_cast<char *>(uprv_malloc(uprv_strlen(posixID)+1));
/* Exit on memory allocation error. */
if (correctedPOSIXLocale == NULL) {
return NULL;
/* Note that we scan the *uncorrected* ID. */
if ((p = uprv_strrchr(posixID, '@')) != NULL) {
if (correctedPOSIXLocale == NULL) {
- correctedPOSIXLocale = reinterpret_cast<char *>(uprv_malloc(uprv_strlen(posixID)+1));
+ correctedPOSIXLocale = static_cast<char *>(uprv_malloc(uprv_strlen(posixID)+1));
/* Exit on memory allocation error. */
if (correctedPOSIXLocale == NULL) {
return NULL;
static int32_t U_CALLCONV
compareElementStrings(const void *context, const void *left, const void *right) {
- const UnicodeString *strings=reinterpret_cast<const UnicodeString *>(context);
- const UCharsTrieElement *leftElement=reinterpret_cast<const UCharsTrieElement *>(left);
- const UCharsTrieElement *rightElement=reinterpret_cast<const UCharsTrieElement *>(right);
+ const UnicodeString *strings=static_cast<const UnicodeString *>(context);
+ const UCharsTrieElement *leftElement=static_cast<const UCharsTrieElement *>(left);
+ const UCharsTrieElement *rightElement=static_cast<const UCharsTrieElement *>(right);
return leftElement->compareStringTo(*rightElement, *strings);
}
}
if(ucharsCapacity<capacity) {
uprv_free(uchars);
- uchars=reinterpret_cast<UChar *>(uprv_malloc(capacity*2));
+ uchars=static_cast<UChar *>(uprv_malloc(capacity*2));
if(uchars==NULL) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
ucharsCapacity=0;
do {
newCapacity*=2;
} while(newCapacity<=length);
- UChar *newUChars=reinterpret_cast<UChar *>(uprv_malloc(newCapacity*2));
+ UChar *newUChars=static_cast<UChar *>(uprv_malloc(newCapacity*2));
if(newUChars==NULL) {
// unable to allocate memory
uprv_free(uchars);
/*
******************************************************************************
*
-* Copyright (C) 1999-2011, International Business Machines
+* Copyright (C) 1999-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
if (listOffset < gMainTable.taggedAliasListsSize) {
UAliasContext *myContext;
- myEnum = reinterpret_cast<UEnumeration *>(uprv_malloc(sizeof(UEnumeration)));
+ myEnum = static_cast<UEnumeration *>(uprv_malloc(sizeof(UEnumeration)));
if (myEnum == NULL) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
return NULL;
}
uprv_memcpy(myEnum, &gEnumAliases, sizeof(UEnumeration));
- myContext = reinterpret_cast<UAliasContext *>(uprv_malloc(sizeof(UAliasContext)));
+ myContext = static_cast<UAliasContext *>(uprv_malloc(sizeof(UAliasContext)));
if (myContext == NULL) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
uprv_free(myEnum);
if (haveAliasData(pErrorCode)) {
uint16_t *myContext;
- myEnum = reinterpret_cast<UEnumeration *>(uprv_malloc(sizeof(UEnumeration)));
+ myEnum = static_cast<UEnumeration *>(uprv_malloc(sizeof(UEnumeration)));
if (myEnum == NULL) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
return NULL;
}
uprv_memcpy(myEnum, &gEnumAllConverters, sizeof(UEnumeration));
- myContext = reinterpret_cast<uint16_t *>(uprv_malloc(sizeof(uint16_t)));
+ myContext = static_cast<uint16_t *>(uprv_malloc(sizeof(uint16_t)));
if (myContext == NULL) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
uprv_free(myEnum);
return NULL;
}
uprv_memcpy(result, &gKeywordsEnum, sizeof(UEnumeration));
- myContext = reinterpret_cast<UKeywordsContext *>(uprv_malloc(sizeof(UKeywordsContext)));
+ myContext = static_cast<UKeywordsContext *>(uprv_malloc(sizeof(UKeywordsContext)));
if (myContext == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
uprv_free(result);
}
if(n>=jSize) {
if(j==smallBuffer) { /* overflowed the small buffer. */
- j = reinterpret_cast<_acceptLangItem *>(uprv_malloc(sizeof(j[0])*(jSize*2)));
+ j = static_cast<_acceptLangItem *>(uprv_malloc(sizeof(j[0])*(jSize*2)));
if(j!=NULL) {
uprv_memcpy(j,smallBuffer,sizeof(j[0])*jSize);
}
fprintf(stderr,"malloced at size %d\n", jSize);
#endif
} else {
- j = reinterpret_cast<_acceptLangItem *>(uprv_realloc(j, sizeof(j[0])*jSize*2));
+ j = static_cast<_acceptLangItem *>(uprv_realloc(j, sizeof(j[0])*jSize*2));
#if defined(ULOC_DEBUG)
fprintf(stderr,"re-alloced at size %d\n", jSize);
#endif
}
return -1;
}
- strs = reinterpret_cast<char **>(uprv_malloc((size_t)(sizeof(strs[0])*n)));
+ strs = static_cast<char **>(uprv_malloc((size_t)(sizeof(strs[0])*n)));
/* Check for null pointer */
if (strs == NULL) {
uprv_free(j); /* Free to avoid memory leak */
if(U_FAILURE(*status)) {
return -1;
}
- fallbackList = reinterpret_cast<char **>(uprv_malloc((size_t)(sizeof(fallbackList[0])*acceptListCount)));
+ fallbackList = static_cast<char **>(uprv_malloc((size_t)(sizeof(fallbackList[0])*acceptListCount)));
if(fallbackList==NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
return -1;
* @stable ICU 4.8
*/
BytesTrie(const void *trieBytes)
- : ownedArray_(NULL), bytes_(reinterpret_cast<const uint8_t *>(trieBytes)),
+ : ownedArray_(NULL), bytes_(static_cast<const uint8_t *>(trieBytes)),
pos_(bytes_), remainingMatchLength_(-1) {}
/**
* This constructor is only called by the builder.
*/
BytesTrie(void *adoptBytes, const void *trieBytes)
- : ownedArray_(reinterpret_cast<uint8_t *>(adoptBytes)),
- bytes_(reinterpret_cast<const uint8_t *>(trieBytes)),
+ : ownedArray_(static_cast<uint8_t *>(adoptBytes)),
+ bytes_(static_cast<const uint8_t *>(trieBytes)),
pos_(bytes_), remainingMatchLength_(-1) {}
// No assignment operator.
/*
******************************************************************************
*
-* Copyright (C) 2002-2011, International Business Machines
+* Copyright (C) 2002-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
U_CAPI void U_EXPORT2
uprv_deleteUObject(void *obj) {
- delete reinterpret_cast<UObject *>(obj);
+ delete static_cast<UObject *>(obj);
}
if(U_FAILURE(*status)) {
return NULL;
}
- myContext = reinterpret_cast<ULocalesContext *>(uprv_malloc(sizeof(ULocalesContext)));
+ myContext = static_cast<ULocalesContext *>(uprv_malloc(sizeof(ULocalesContext)));
en = (UEnumeration *)uprv_malloc(sizeof(UEnumeration));
if(!en || !myContext) {
*status = U_MEMORY_ALLOCATION_ERROR;
U_ASSERT(length >= offsetBufferSize || offsetStore != NULL);
if(length >= offsetBufferSize) {
int32_t newCapacity = 2 * offsetBufferSize + UCOL_EXPAND_CE_BUFFER_SIZE;
- int32_t *newBuffer = reinterpret_cast<int32_t *>(uprv_malloc(newCapacity * 4));
+ int32_t *newBuffer = static_cast<int32_t *>(uprv_malloc(newCapacity * 4));
if(newBuffer == NULL) {
errorCode = U_MEMORY_ALLOCATION_ERROR;
return;
return NULL;
}
- result = reinterpret_cast<char *>(uprv_malloc(count+1));
+ result = static_cast<char *>(uprv_malloc(count+1));
if (result == NULL)
{
count = (uint32_t)uprv_strlen(string);
if (count > 0){
if((count % 2)==0){
- value = reinterpret_cast<uint8_t *>(uprv_malloc(sizeof(uint8_t) * count));
+ value = static_cast<uint8_t *>(uprv_malloc(sizeof(uint8_t) * count));
if (value == NULL)
{
/* check data format and format version */
const UDataInfo *pInfo=
reinterpret_cast<const UDataInfo *>(
- reinterpret_cast<const char *>(inData)+4);
+ static_cast<const char *>(inData)+4);
if(!(
pInfo->dataFormat[0]==0x70 && /* dataFormat="pnam" */
pInfo->dataFormat[1]==0x6e &&
return 0;
}
- const uint8_t *inBytes=reinterpret_cast<const uint8_t *>(inData)+headerSize;
- uint8_t *outBytes=reinterpret_cast<uint8_t *>(outData)+headerSize;
+ const uint8_t *inBytes=static_cast<const uint8_t *>(inData)+headerSize;
+ uint8_t *outBytes=static_cast<uint8_t *>(outData)+headerSize;
if(length>=0) {
length-=headerSize;