Read correct text length back out

This commit is contained in:
Jari Bakken 2010-05-14 16:22:05 +02:00
parent 0bfc0bba81
commit f1ccf0d307
2 changed files with 6 additions and 2 deletions

View File

@ -45,7 +45,7 @@ module ICU
Lib.utrans_transUChars(@tr, buf, text_length, capacity, 0, limit, error)
end
buf.string
buf.string(text_length.get_int32(0))
end
def close

6
test.c
View File

@ -23,6 +23,10 @@ int main (int argc, char const *argv[])
UErrorCode status = U_ZERO_ERROR;
trans = utrans_open("Latin-Greek", UTRANS_FORWARD, NULL, 0, NULL, &status);
if(U_FAILURE(status)) {
print_error(status);
exit(1);
}
UChar from[256];
UChar buf[256];
@ -36,7 +40,7 @@ int main (int argc, char const *argv[])
printf("limit: %d\n", limit);
printf("text_length: %d\n", limit);
utrans_transUChars(trans, buf, &text_length, 4, 0, &limit, &status);
utrans_transUChars(trans, buf, &text_length, 12, 0, &limit, &status);
printf("uchar ptr length after: %d\n", u_strlen(buf));
printf("text_length after: %d\n", text_length);