Uploaded image for project: 'ICU'
  1. ICU-20773

Improve the documentation on pre-flighting for u_strFromUTF8

    Details

    • Type: API Docs
    • Status: Accepted (View workflow)
    • Priority: minor
    • Resolution: Unresolved
    • Affects versions: None
    • Fix versions: 67.1
    • Components: strings
    • Labels:
      None
    • Time Needed:
      Hours

      Description

      I discovered by trial and error that preflighting (`buffer==NULL, capacity=0`) the conversion from UTF8 to UChar* will still report a "buffer overflow error", which must then be ignored after preflighting.

      This is not documented in the function API. And while the documentation is technically correct, it is not obvious that when an error code is set that the buffer destination length is also set correctly. Which may lead to some user confusion.

      To illustrate, I lost a few hours yesterday debugging why the buffer overflow happens during preflight, only to realize that this is WAI. I don't think this should be something that silently comes out of the constraints, but should be documented explicitly.

        Attachments

          Activity

            People

            • Assignee:
              markus.icu Markus Scherer
              Reporter:
              filmil Filip Filmar
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: