Closed Bug 1543295 Opened 1 year ago Closed 1 year ago

Pass the text length when creating an `nsString` from a SQLite text result

Categories

(Toolkit :: Storage, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: Lina, Assigned: Lina)

Details

Attachments

(1 file)

Something to do on the train ride home. 😄 I forgot to do this in https://phabricator.services.mozilla.com/D20073 (see this comment), and also fixed up the other callers while I was there.

This commit updates mozStorage to always:

  • Pass the length, using sqlite3_{column, value}_bytes16, when
    creating an nsDependentString from a pointer.
  • Call sqlite3_{column, value}bytes{16} after
    sqlite3
    {column, value}_{text, blob, text16}, per the
    recommendation in https://www.sqlite.org/c3ref/column_blob.html.
    Some callers did this before, or in unclear order, since C++ doesn't
    specify one for evaluating function arguments.
  • Pass the byte length to sqlite3_result_text16.
Pushed by kcambridge@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b0a8a5c4533e
Pass the text length when creating an `nsString` from a SQLite text result. r=mak
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.