mirror of https://github.com/erickguan/ffi-icu.git
Read correct text length back out
This commit is contained in:
parent
0bfc0bba81
commit
f1ccf0d307
|
@ -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
6
test.c
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue