Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#120 closed bug (fixed)

dstLen is not set with utf8_conversions.cpp

Reported by: bxi07354@… Owned by: bpmagic@…
Priority: normal Milestone: R1
Component: - General Version:
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All



*dstLen is not set when there are errors in convert_to_utf8() and convert_from_utf8().

It is necessary to set dstLen to 0 if there is no output.

sample if (*srcLen == 0) {

dst[0] = '\0'; *dstLen = 0; return B_OK;


Attachments (1)

utf8_conversions.diff (320 bytes) - added by johndrinkwater 14 years ago.
Add (*srcLen == 0) case

Download all attachments as: .zip

Change History (6)

comment:1 Changed 14 years ago by korli

Resolution: fixed

comment:2 Changed 14 years ago by korli

Status: newclosed

comment:3 Changed 14 years ago by korli

I tested the behavior on R5 and fixed ours in rev 16294.

Changed 14 years ago by johndrinkwater

Attachment: utf8_conversions.diff added

Add (*srcLen == 0) case

comment:4 Changed 14 years ago by bxi07354@…

hrev16294 is the same as R5. if (*srcLen == 0) {

*dstLen = 0; return B_ERROR;


hrev16328 was changed with B_OK. Why. if (*srcLen == 0) {

*dstLen = 0; return B_OK;


The minus was put. if (*srcLen <= 0) {

*srcLen = 0; *dstLen = 0; return B_ERROR;


comment:5 Changed 14 years ago by korli

I think axeld checks on Dano and reproduced the behavior. Having a zero length doesn't sound as an error in the end.

Note: See TracTickets for help on using tickets.