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 by korli, 14 years ago

Resolution: fixed

comment:2 by korli, 14 years ago

Status: newclosed

comment:3 by korli, 14 years ago

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

by johndrinkwater, 14 years ago

Attachment: utf8_conversions.diff added

Add (*srcLen == 0) case

comment:4 by bxi07354@…, 14 years ago

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 by korli, 14 years ago

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.