* with ICU.
*/
+#define __STDC_FORMAT_MACROS 1
+#include <inttypes.h>
+
#include <stdio.h>
#include "unicode/utypes.h"
#include "unicode/uchar.h"
#include "unicode/ucnv.h"
#include "unicode/unistr.h"
+using namespace icu;
+
#ifndef UPRV_LENGTHOF
#define UPRV_LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
#endif
if(U_SUCCESS(errorCode)) {
printUString("full-lowercased/en: ", buffer, length);
} else {
- printf("error in u_strToLower(en)=%ld error=%s\n", length, u_errorName(errorCode));
+ printf("error in u_strToLower(en)=%" PRId32 " error=%s\n", length, u_errorName(errorCode));
}
/* lowercase/Turkish */
errorCode=U_ZERO_ERROR;
if(U_SUCCESS(errorCode)) {
printUString("full-lowercased/tr: ", buffer, length);
} else {
- printf("error in u_strToLower(tr)=%ld error=%s\n", length, u_errorName(errorCode));
+ printf("error in u_strToLower(tr)=%" PRId32 " error=%s\n", length, u_errorName(errorCode));
}
/* uppercase/English */
errorCode=U_ZERO_ERROR;
if(U_SUCCESS(errorCode)) {
printUString("full-uppercased/en: ", buffer, length);
} else {
- printf("error in u_strToUpper(en)=%ld error=%s\n", length, u_errorName(errorCode));
+ printf("error in u_strToUpper(en)=%" PRId32 " error=%s\n", length, u_errorName(errorCode));
}
/* uppercase/Turkish */
errorCode=U_ZERO_ERROR;
if(U_SUCCESS(errorCode)) {
printUString("full-uppercased/tr: ", buffer, length);
} else {
- printf("error in u_strToUpper(tr)=%ld error=%s\n", length, u_errorName(errorCode));
+ printf("error in u_strToUpper(tr)=%" PRId32 " error=%s\n", length, u_errorName(errorCode));
}
/* titlecase/English */
errorCode=U_ZERO_ERROR;
if(U_SUCCESS(errorCode)) {
printUString("full-titlecased/en: ", buffer, length);
} else {
- printf("error in u_strToTitle(en)=%ld error=%s\n", length, u_errorName(errorCode));
+ printf("error in u_strToTitle(en)=%" PRId32 " error=%s\n", length, u_errorName(errorCode));
}
/* titlecase/Turkish */
errorCode=U_ZERO_ERROR;
if(U_SUCCESS(errorCode)) {
printUString("full-titlecased/tr: ", buffer, length);
} else {
- printf("error in u_strToTitle(tr)=%ld error=%s\n", length, u_errorName(errorCode));
+ printf("error in u_strToTitle(tr)=%" PRId32 " error=%s\n", length, u_errorName(errorCode));
}
/* case-fold/default */
errorCode=U_ZERO_ERROR;
if(U_SUCCESS(errorCode)) {
printUString("full-case-folded/default: ", buffer, length);
} else {
- printf("error in u_strFoldCase(default)=%ld error=%s\n", length, u_errorName(errorCode));
+ printf("error in u_strFoldCase(default)=%" PRId32 " error=%s\n", length, u_errorName(errorCode));
}
/* case-fold/Turkic */
errorCode=U_ZERO_ERROR;
if(U_SUCCESS(errorCode)) {
printUString("full-case-folded/Turkic: ", buffer, length);
} else {
- printf("error in u_strFoldCase(Turkic)=%ld error=%s\n", length, u_errorName(errorCode));
+ printf("error in u_strFoldCase(Turkic)=%" PRId32 " error=%s\n", length, u_errorName(errorCode));
}
}
printUnicodeString("readonly-aliasing string after modification: ", three);
// the aliased array is not modified
for(i=0; i<three.length(); ++i) {
- printf("readonly buffer[%d] after modifying its string: 0x%lx\n",
+ printf("readonly buffer[%d] after modifying its string: 0x%" PRId32 "\n",
i, readonly[i]);
}
// setTo() readonly alias
// a modification writes through to the buffer
four.setCharAt(1, 0x39);
for(i=0; i<four.length(); ++i) {
- printf("writeable-alias backing buffer[%d]=0x%lx "
+ printf("writeable-alias backing buffer[%d]=0x%" PRId32 " "
"after modification\n", i, writeable[i]);
}
// a copy will not alias any more;
two=four;
two.setCharAt(1, 0x21);
for(i=0; i<two.length(); ++i) {
- printf("writeable-alias backing buffer[%d]=0x%lx after "
+ printf("writeable-alias backing buffer[%d]=0x%" PRId32 " after "
"modification of string copy\n", i, writeable[i]);
}
// setTo() writeable alias, capacity==length
one.truncate(one.length()-1);
// we still operate on the copy
one.setCharAt(1, 0x25);
- printf("string after growing too much and then shrinking[1]=0x%lx\n"
- " backing store for this[1]=0x%lx\n",
+ printf("string after growing too much and then shrinking[1]=0x%" PRId32 "\n"
+ " backing store for this[1]=0x%" PRId32 "\n",
one.charAt(1), writeable[1]);
// if we need it in the original buffer, then extract() to it
// extract() does not do anything if the string aliases that same buffer
}
one.extract(0, i, writeable);
for(i=0; i<UPRV_LENGTHOF(writeable); ++i) {
- printf("writeable-alias backing buffer[%d]=0x%lx after re-extract\n",
+ printf("writeable-alias backing buffer[%d]=0x%" PRId32 " after re-extract\n",
i, writeable[i]);
}
}