Skip to content

Commit

Permalink
fixed confusing error message when SQLite3 static files don't match e…
Browse files Browse the repository at this point in the history
…xpected revision
  • Loading branch information
Arnaud Bouchez committed Jan 25, 2021
1 parent c2d1322 commit 47a3e5b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
29 changes: 12 additions & 17 deletions src/core/mormot.core.unicode.pas
Original file line number Diff line number Diff line change
Expand Up @@ -5753,6 +5753,7 @@ procedure LowerCaseSelf(var S: RawUtf8);
Block: array[0..37, 0..127] of integer;
IndexHi: array[0..271] of byte;
IndexLo: array[0..8, 0..31] of byte;
// branchless Unicode 10.0 uppercase folding using our internal tables
function Ucs4Upper(c: PtrUInt): PtrInt;
{$ifdef HASINLINE} inline;{$endif}
end;
Expand Down Expand Up @@ -6043,9 +6044,18 @@ procedure LowerCaseSelf(var S: RawUtf8);
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12));
);

function TUnicodeUpperTable.Ucs4Upper(c: PtrUInt): PtrInt;
var
i: PtrUInt;
begin
i := c shr UU_BLOCK_HI;
result := PtrInt(c) + Block[IndexLo[
IndexHi[i shr UU_INDEX_HI], i and UU_INDEX_LO], c and UU_BLOCK_LO];
end;

function Utf8UpperReference(S, D: PUtf8Char): PUtf8Char;
var
c, i: PtrUInt;
c: PtrUInt;
S2: PUtf8Char;
{$ifdef CPUX86NOTPIC}
tab: TUnicodeUpperTable absolute UU;
Expand Down Expand Up @@ -6084,12 +6094,7 @@ function Utf8UpperReference(S, D: PUtf8Char): PUtf8Char;
c := ord('?'); // PlaceHolder for invalid UTF-8 input
end;
if c <= UU_MAX then
begin
// branchless Unicode 10.0 case folding
i := c shr UU_BLOCK_HI;
c := PtrUInt(PtrInt(c) + tab.Block[tab.IndexLo[
tab.IndexHi[i shr UU_INDEX_HI], i and UU_INDEX_LO], c and UU_BLOCK_LO]);
end;
c := tab.Ucs4Upper(c);
inc(D, Ucs4ToUtf8(c, D));
until false;
D^ := #0;
Expand All @@ -6110,16 +6115,6 @@ function UpperCaseReference(const S: RawUtf8): RawUtf8;
end;
end;

// branchless Unicode 10.0 uppercase folding using our internal tables
function TUnicodeUpperTable.Ucs4Upper(c: PtrUInt): PtrInt;
var
i: PtrUInt;
begin
i := c shr UU_BLOCK_HI;
result := PtrInt(c) + Block[IndexLo[
IndexHi[i shr UU_INDEX_HI], i and UU_INDEX_LO], c and UU_BLOCK_LO];
end;

function Utf8ICompReference(u1, u2: PUtf8Char): PtrInt;
var
c2: PtrInt;
Expand Down
6 changes: 3 additions & 3 deletions src/db/mormot.db.raw.sqlite3.static.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1142,11 +1142,11 @@ function sqlite3_trace_v2(DB: TSqlite3DB; Mask: integer; Callback: TSqlTraceCall

const
// error message if statically linked sqlite3.o(bj) does not match this
EXPECTED_SQLITE3_VERSION = {$ifdef ANDROID}''{$else}'3.34.0'{$endif};
EXPECTED_SQLITE3_VERSION = '3.34.0';

// where to download the latest available static binaries, including SQLite3
EXPECTED_STATIC_DOWNLOAD = 'https://github.com/synopse/mORMot2/releases/' +
'download/pre1/mormot2static.7z';
EXPECTED_STATIC_DOWNLOAD =
'https://github.com/synopse/mORMot2/releases/tag/sqlite.' + EXPECTED_SQLITE3_VERSION;

constructor TSqlite3LibraryStatic.Create;
var
Expand Down

0 comments on commit 47a3e5b

Please sign in to comment.