diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-10-27 15:52:30 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-10-27 15:52:30 +0000 |
commit | f209316474cc121b51455770df6c24b9c64796a9 (patch) | |
tree | 150a982d7f1dc84d27590d9956366872a326cae1 /src/base/UTextClasses.pas | |
parent | d6770dd47dcb871f021868dec2b333527ffb8ee8 (diff) | |
download | usdx-f209316474cc121b51455770df6c24b9c64796a9.tar.gz usdx-f209316474cc121b51455770df6c24b9c64796a9.tar.xz usdx-f209316474cc121b51455770df6c24b9c64796a9.zip |
- Results of UTF8Encode() in TSQLiteDatabase.BindData() are stored in a local AnsiString variable instead of directly converting it to PChar
old: PAnsiChar(UTF8Encode(WideString(Bindings[I].VPWideChar)));
new:
AnsiStr := UTF8Encode(WideString(Bindings[I].VPWideChar));
DataPtr := PAnsiChar(AnsiStr);
Although Delphi and FPC create a temporary AnsiString on the stack which is valid until the end of the method, it is more safe not to rely on this behavior. Maybe in some future version of Delphi/FPC the reference count might be decremented and invalidated after converting the temporary AnsiString to a PChar and the PChar will point to invalid data. In contrast to this, the scope of AnsiStr is obvious.
- {$IFDEF WIN32} -> {$IFDEF MSWINDOWS}
- {$WARNINGS OFF/ON} removed
- var-parameters of SQLite3_Open/SQLite3_Prepare/SQLite3_Prepare_v2 declared as out
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1480 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/base/UTextClasses.pas')
0 files changed, 0 insertions, 0 deletions