ICU-3668 make C getters take const object pointer

X-SVN-Rev: 14788
This commit is contained in:
Alan Liu 2004-03-27 07:21:32 +00:00
parent 3f4f09f5a9
commit 1a057ed7e4
8 changed files with 31 additions and 31 deletions

View file

@ -128,7 +128,7 @@ udata_getMemory(UDataMemory *pData) {
* @internal Currently used only in cintltst/udatatst.c
*/
U_CAPI int32_t U_EXPORT2
udata_getLength(UDataMemory *pData) {
udata_getLength(const UDataMemory *pData) {
if(pData!=NULL && pData->pHeader!=NULL && pData->length>=0) {
/*
* subtract the header size,
@ -146,7 +146,7 @@ udata_getLength(UDataMemory *pData) {
* @internal
*/
U_CAPI const void * U_EXPORT2
udata_getRawMemory(UDataMemory *pData) {
udata_getRawMemory(const UDataMemory *pData) {
if(pData!=NULL && pData->pHeader!=NULL) {
return pData->pHeader;
} else {

View file

@ -52,10 +52,10 @@ void UDataMemory_setData (UDataMemory *This, const void *dataAddr);
const DataHeader *UDataMemory_normalizeDataPointer(const void *p);
U_CAPI int32_t U_EXPORT2
udata_getLength(UDataMemory *pData);
udata_getLength(const UDataMemory *pData);
U_CAPI const void * U_EXPORT2
udata_getRawMemory(UDataMemory *pData);
udata_getRawMemory(const UDataMemory *pData);
#endif

View file

@ -74,11 +74,11 @@ U_CAPI UBool U_EXPORT2 uprv_mstrm_setError(UMemoryStream *MS){
return MS->fError;
}
U_CAPI UBool U_EXPORT2 uprv_mstrm_error(UMemoryStream *MS){
U_CAPI UBool U_EXPORT2 uprv_mstrm_error(const UMemoryStream *MS){
return MS->fError;
}
U_CAPI UBool U_EXPORT2 uprv_mstrm_eof(UMemoryStream *MS){
U_CAPI UBool U_EXPORT2 uprv_mstrm_eof(const UMemoryStream *MS){
return MS->fEof;
}
@ -124,7 +124,7 @@ U_CAPI int32_t U_EXPORT2 uprv_mstrm_write(UMemoryStream *MS, const void *buffer,
}
}
U_CAPI const uint8_t * U_EXPORT2 uprv_mstrm_getBuffer(UMemoryStream *MS, int32_t *len){
U_CAPI const uint8_t * U_EXPORT2 uprv_mstrm_getBuffer(const UMemoryStream *MS, int32_t *len){
if(MS->fError == FALSE) {
*len = MS->fPos;
return MS->fStart;
@ -134,7 +134,7 @@ U_CAPI const uint8_t * U_EXPORT2 uprv_mstrm_getBuffer(UMemoryStream *MS, int32_t
}
}
U_CAPI const uint8_t * U_EXPORT2 uprv_mstrm_getCurrentBuffer(UMemoryStream *MS, int32_t *len){
U_CAPI const uint8_t * U_EXPORT2 uprv_mstrm_getCurrentBuffer(const UMemoryStream *MS, int32_t *len){
if(MS->fError == FALSE) {
*len = MS->fPos-MS->fReadPos;
return MS->fStart+MS->fReadPos;

View file

@ -45,12 +45,12 @@ U_CAPI UMemoryStream * U_EXPORT2 uprv_mstrm_openNew(int32_t size);
U_CAPI UMemoryStream * U_EXPORT2 uprv_mstrm_openBuffer(const uint8_t *buffer, int32_t len);
U_CAPI void U_EXPORT2 uprv_mstrm_close(UMemoryStream *MS);
U_CAPI UBool U_EXPORT2 uprv_mstrm_setError(UMemoryStream *MS);
U_CAPI UBool U_EXPORT2 uprv_mstrm_error(UMemoryStream *MS);
U_CAPI UBool U_EXPORT2 uprv_mstrm_eof(UMemoryStream *MS);
U_CAPI UBool U_EXPORT2 uprv_mstrm_error(const UMemoryStream *MS);
U_CAPI UBool U_EXPORT2 uprv_mstrm_eof(const UMemoryStream *MS);
U_CAPI int32_t U_EXPORT2 uprv_mstrm_read(UMemoryStream *MS, void* addr, int32_t len);
U_CAPI int32_t U_EXPORT2 uprv_mstrm_write(UMemoryStream *MS, const void *buffer, int32_t len);
U_CAPI const uint8_t * U_EXPORT2 uprv_mstrm_getBuffer(UMemoryStream *MS, int32_t *len);
U_CAPI const uint8_t * U_EXPORT2 uprv_mstrm_getCurrentBuffer(UMemoryStream *MS, int32_t *len);
U_CAPI const uint8_t * U_EXPORT2 uprv_mstrm_getBuffer(const UMemoryStream *MS, int32_t *len);
U_CAPI const uint8_t * U_EXPORT2 uprv_mstrm_getCurrentBuffer(const UMemoryStream *MS, int32_t *len);
U_CAPI int32_t U_EXPORT2 uprv_mstrm_skip(UMemoryStream *MS, int32_t len);
U_CAPI int32_t U_EXPORT2 uprv_mstrm_jump(UMemoryStream *MS, const uint8_t *where);

View file

@ -277,13 +277,13 @@ umsg_setLocale(UMessageFormat *fmt, const char* locale)
}
U_CAPI const char* U_EXPORT2
umsg_getLocale(UMessageFormat *fmt)
umsg_getLocale(const UMessageFormat *fmt)
{
//check arguments
if(fmt==NULL){
return "";
}
return ((MessageFormat*)fmt)->getLocale().getName();
return ((const MessageFormat*)fmt)->getLocale().getName();
}
U_CAPI void U_EXPORT2
@ -314,7 +314,7 @@ umsg_applyPattern(UMessageFormat *fmt,
}
U_CAPI int32_t U_EXPORT2
umsg_toPattern(UMessageFormat *fmt,
umsg_toPattern(const UMessageFormat *fmt,
UChar* result,
int32_t resultLength,
UErrorCode* status)
@ -335,12 +335,12 @@ umsg_toPattern(UMessageFormat *fmt,
// otherwise, alias the destination buffer
res.setTo(result, 0, resultLength);
}
((MessageFormat*)fmt)->toPattern(res);
((const MessageFormat*)fmt)->toPattern(res);
return res.extract(result, resultLength, *status);
}
U_CAPI int32_t
umsg_format( UMessageFormat *fmt,
umsg_format( const UMessageFormat *fmt,
UChar *result,
int32_t resultLength,
UErrorCode *status,
@ -383,7 +383,7 @@ MessageFormatAdapter::getArgTypeList(const MessageFormat& m,
U_NAMESPACE_END
U_CAPI int32_t U_EXPORT2
umsg_vformat( UMessageFormat *fmt,
umsg_vformat( const UMessageFormat *fmt,
UChar *result,
int32_t resultLength,
va_list ap,
@ -401,7 +401,7 @@ umsg_vformat( UMessageFormat *fmt,
int32_t count =0;
const Formattable::Type* argTypes =
MessageFormatAdapter::getArgTypeList(*(MessageFormat*)fmt, count);
MessageFormatAdapter::getArgTypeList(*(const MessageFormat*)fmt, count);
// Allocate at least one element. Allocating an array of length
// zero causes problems on some platforms (e.g. Win32).
Formattable* args = new Formattable[count ? count : 1];
@ -459,7 +459,7 @@ umsg_vformat( UMessageFormat *fmt,
FieldPosition fieldPosition(0);
/* format the message */
((MessageFormat*)fmt)->format(args,count,resultStr,fieldPosition,*status);
((const MessageFormat*)fmt)->format(args,count,resultStr,fieldPosition,*status);
delete[] args;
@ -471,7 +471,7 @@ umsg_vformat( UMessageFormat *fmt,
}
U_CAPI void
umsg_parse( UMessageFormat *fmt,
umsg_parse( const UMessageFormat *fmt,
const UChar *source,
int32_t sourceLength,
int32_t *count,
@ -493,7 +493,7 @@ umsg_parse( UMessageFormat *fmt,
}
U_CAPI void U_EXPORT2
umsg_vparse(UMessageFormat *fmt,
umsg_vparse(const UMessageFormat *fmt,
const UChar *source,
int32_t sourceLength,
int32_t *count,
@ -514,7 +514,7 @@ umsg_vparse(UMessageFormat *fmt,
}
UnicodeString srcString(source,sourceLength);
Formattable *args = ((MessageFormat*)fmt)->parse(source,*count,*status);
Formattable *args = ((const MessageFormat*)fmt)->parse(source,*count,*status);
UDate *aDate;
double *aDouble;
UChar *aString;

View file

@ -468,7 +468,7 @@ umsg_setLocale(UMessageFormat *fmt,
* @stable ICU 2.0
*/
U_STABLE const char* U_EXPORT2
umsg_getLocale(UMessageFormat *fmt);
umsg_getLocale(const UMessageFormat *fmt);
/**
* Sets the pattern.
@ -501,7 +501,7 @@ umsg_applyPattern( UMessageFormat *fmt,
* @stable ICU 2.0
*/
U_STABLE int32_t U_EXPORT2
umsg_toPattern(UMessageFormat *fmt,
umsg_toPattern(const UMessageFormat *fmt,
UChar* result,
int32_t resultLength,
UErrorCode* status);
@ -522,7 +522,7 @@ umsg_toPattern(UMessageFormat *fmt,
* @stable ICU 2.0
*/
U_STABLE int32_t U_EXPORT2
umsg_format( UMessageFormat *fmt,
umsg_format( const UMessageFormat *fmt,
UChar *result,
int32_t resultLength,
UErrorCode *status,
@ -544,7 +544,7 @@ umsg_format( UMessageFormat *fmt,
* @stable ICU 2.0
*/
U_STABLE int32_t U_EXPORT2
umsg_vformat( UMessageFormat *fmt,
umsg_vformat( const UMessageFormat *fmt,
UChar *result,
int32_t resultLength,
va_list ap,
@ -565,7 +565,7 @@ umsg_vformat( UMessageFormat *fmt,
* @stable ICU 2.0
*/
U_STABLE void U_EXPORT2
umsg_parse( UMessageFormat *fmt,
umsg_parse( const UMessageFormat *fmt,
const UChar *source,
int32_t sourceLength,
int32_t *count,
@ -588,7 +588,7 @@ umsg_parse( UMessageFormat *fmt,
* @stable ICU 2.0
*/
U_STABLE void U_EXPORT2
umsg_vparse(UMessageFormat *fmt,
umsg_vparse(const UMessageFormat *fmt,
const UChar *source,
int32_t sourceLength,
int32_t *count,

View file

@ -751,7 +751,7 @@ typedef enum UNumberFormatSymbol {
* @stable ICU 2.0
*/
U_CAPI int32_t U_EXPORT2
unum_getSymbol(UNumberFormat *fmt,
unum_getSymbol(const UNumberFormat *fmt,
UNumberFormatSymbol symbol,
UChar *buffer,
int32_t size,

View file

@ -666,7 +666,7 @@ unum_toPattern( const UNumberFormat* fmt,
// TODO: first parameter should be const!
U_CAPI int32_t U_EXPORT2
unum_getSymbol(UNumberFormat *fmt,
unum_getSymbol(const UNumberFormat *fmt,
UNumberFormatSymbol symbol,
UChar *buffer,
int32_t size,