mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-06 10:07:54 +02:00
* PChar -> PAnsiChar
This commit is contained in:
parent
0a798a4b72
commit
7cacddbd28
@ -41,7 +41,7 @@ type
|
||||
TWordParser = class
|
||||
private
|
||||
FCount: integer;
|
||||
FWildCardChar: char;
|
||||
FWildCardChar: AnsiChar;
|
||||
WordList: array of TWordToken;
|
||||
procedure AddToken(AValue: UTF8String; ATokenType: TWordTokenType);
|
||||
function GetSearchWordQuery: UTF8String;
|
||||
@ -50,7 +50,7 @@ type
|
||||
public
|
||||
constructor Create(ASearchWords: UTF8String);
|
||||
property Count: integer read FCount write SetCount;
|
||||
property WildCardChar: char read FWildCardChar write FWildCardChar;
|
||||
property WildCardChar: AnsiChar read FWildCardChar write FWildCardChar;
|
||||
property SearchWordQuery: UTF8String read GetSearchWordQuery;
|
||||
property Token[index: integer]: TWordToken read GetToken;
|
||||
end;
|
||||
@ -945,7 +945,7 @@ Const
|
||||
|
||||
var
|
||||
s: UTF8String;
|
||||
c: char;
|
||||
c: AnsiChar;
|
||||
|
||||
begin
|
||||
if not Assigned(Stream) then
|
||||
|
@ -32,12 +32,12 @@ uses
|
||||
type
|
||||
TMaskCharType = (mcChar, mcCharSet, mcAnyChar, mcAnyText);
|
||||
|
||||
TCharSet = set of Char;
|
||||
TCharSet = set of AnsiChar;
|
||||
PCharSet = ^TCharSet;
|
||||
|
||||
TMaskChar = record
|
||||
case CharType: TMaskCharType of
|
||||
mcChar: (CharValue: Char);
|
||||
mcChar: (CharValue: AnsiChar);
|
||||
mcCharSet: (Negative: Boolean; SetValue: PCharSet);
|
||||
mcAnyChar, mcAnyText: ();
|
||||
end;
|
||||
@ -75,7 +75,7 @@ type
|
||||
function GetCount: Integer;
|
||||
function GetItem(Index: Integer): TMask;
|
||||
public
|
||||
constructor Create(const AValue: UTF8string; ASeparator: Char = ';');
|
||||
constructor Create(const AValue: UTF8string; ASeparator: AnsiChar = ';');
|
||||
destructor Destroy; override;
|
||||
|
||||
function Matches(const AFileName: UTF8string): Boolean;
|
||||
@ -85,7 +85,7 @@ type
|
||||
end;
|
||||
|
||||
function MatchesMask(const FileName, Mask: UTF8string): Boolean;
|
||||
function MatchesMaskList(const FileName, Mask: UTF8string; Separator: Char = ';'): Boolean;
|
||||
function MatchesMaskList(const FileName, Mask: UTF8string; Separator: AnsiChar = ';'): Boolean;
|
||||
|
||||
implementation
|
||||
|
||||
@ -101,7 +101,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function MatchesMaskList(const FileName, Mask: UTF8string; Separator: Char): Boolean;
|
||||
function MatchesMaskList(const FileName, Mask: UTF8string; Separator: AnsiChar): Boolean;
|
||||
var
|
||||
AMaskList: TMaskList;
|
||||
begin
|
||||
@ -158,7 +158,7 @@ var
|
||||
var
|
||||
CharSet: TCharSet;
|
||||
Valid: Boolean;
|
||||
C, Last: Char;
|
||||
C, Last: AnsiChar;
|
||||
begin
|
||||
SkipAnyText := False;
|
||||
|
||||
@ -362,7 +362,7 @@ begin
|
||||
Result := FMasks.Count;
|
||||
end;
|
||||
|
||||
constructor TMaskList.Create(const AValue: UTF8string; ASeparator: Char);
|
||||
constructor TMaskList.Create(const AValue: UTF8string; ASeparator: AnsiChar);
|
||||
var
|
||||
S: TParseStringList;
|
||||
I: Integer;
|
||||
|
@ -34,8 +34,8 @@ type
|
||||
LinePos: integer;
|
||||
Tg, Tx: integer;
|
||||
FParser: THTMLParser; //our htmlparser class
|
||||
procedure OnTag(NoCaseTag, ActualTag: String);
|
||||
procedure OnText(Text: String);
|
||||
procedure OnTag(NoCaseTag, ActualTag: AnsiString);
|
||||
procedure OnText(Text: AnsiString);
|
||||
protected
|
||||
function GetToken: UTF8String; override;
|
||||
function AllowedToken(token: UTF8String): boolean; override;
|
||||
@ -47,11 +47,11 @@ implementation
|
||||
|
||||
{ TIReaderHTML }
|
||||
|
||||
procedure TIReaderHTML.OnTag(NoCaseTag, ActualTag: String);
|
||||
procedure TIReaderHTML.OnTag(NoCaseTag, ActualTag: AnsiString);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TIReaderHTML.OnText(Text: String);
|
||||
procedure TIReaderHTML.OnText(Text: AnsiString);
|
||||
var
|
||||
token: UTF8String;
|
||||
s: TSearchWordData;
|
||||
|
@ -259,7 +259,7 @@ end;
|
||||
|
||||
function TDescrItem.BlockSize: Integer;
|
||||
begin
|
||||
Result:=Sizeof(Integer)+Length(FDescription)*SizeOf(Char);
|
||||
Result:=Sizeof(Integer)+Length(FDescription)*SizeOf(AnsiChar);
|
||||
end;
|
||||
|
||||
procedure TDescrItem.WriteStringToStream(Astream: TStream; S: UTF8string);
|
||||
@ -269,7 +269,7 @@ begin
|
||||
L:=Length(S);
|
||||
AStream.WriteBuffer(L,SizeOf(L));
|
||||
if (L>0) then
|
||||
AStream.WriteBuffer(S[1],L*SizeOf(Char));
|
||||
AStream.WriteBuffer(S[1],L*SizeOf(AnsiChar));
|
||||
end;
|
||||
|
||||
procedure TDescrItem.WriteToStream(S: TStream);
|
||||
@ -300,7 +300,7 @@ begin
|
||||
AStream.ReadBuffer(L,SizeOf(L));
|
||||
SetLength(Result,L);
|
||||
if (L>0) then
|
||||
AStream.ReadBuffer(Pointer(Result)^,L*SizeOf(Char));
|
||||
AStream.ReadBuffer(Pointer(Result)^,L*SizeOf(AnsiChar));
|
||||
end;
|
||||
|
||||
function TDescrItem.ReadFromStream(S: TStream) : Integer;
|
||||
|
@ -40,7 +40,7 @@ type
|
||||
SearchWordID: TDatabaseID;
|
||||
URLID: TDatabaseID;
|
||||
FMatchList : TUTF8StringArray;
|
||||
procedure CheckSQLite(Rc: cint; pzErrMsg: PChar);
|
||||
procedure CheckSQLite(Rc: cint; pzErrMsg: PAnsiChar);
|
||||
protected
|
||||
class function AllowForeignKeyInTable: boolean; override;
|
||||
function GetFieldType(FieldType: TIndexField): UTF8string; override;
|
||||
@ -68,9 +68,9 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
function SearchCallback(_para1: pointer; plArgc: longint; argv: PPchar; argcol: PPchar): longint; cdecl;
|
||||
function SearchCallback(_para1: pointer; plArgc: longint; argv: PPAnsiChar; argcol: PPAnsiChar): longint; cdecl;
|
||||
var
|
||||
PVal: ^PChar;
|
||||
PVal: ^PAnsiChar;
|
||||
SearchRes: TSearchWordData;
|
||||
begin
|
||||
PVal := argv;
|
||||
@ -92,10 +92,10 @@ begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
function WordListCallback(_para1: pointer; plArgc: longint; argv: PPchar; argcol: PPchar): longint; cdecl;
|
||||
function WordListCallback(_para1: pointer; plArgc: longint; argv: PPAnsiChar; argcol: PPAnsiChar): longint; cdecl;
|
||||
|
||||
var
|
||||
PVal: ^PChar;
|
||||
PVal: ^PAnsiChar;
|
||||
S : UTF8String;
|
||||
|
||||
begin
|
||||
@ -112,7 +112,7 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function IndexCallback(_para1: pointer; plArgc: longint; argv: PPchar; argcol: PPchar): longint; cdecl;
|
||||
function IndexCallback(_para1: pointer; plArgc: longint; argv: PPAnsiChar; argcol: PPAnsiChar): longint; cdecl;
|
||||
begin
|
||||
//store the query result
|
||||
TSQLiteIndexDB(_para1).QueryResult := argv^;
|
||||
@ -123,12 +123,12 @@ end;
|
||||
|
||||
procedure TSQLiteIndexDB.Execute(const sql: UTF8string; ignoreErrors: boolean = True);
|
||||
var
|
||||
pzErrMsg: PChar;
|
||||
pzErrMsg: PAnsiChar;
|
||||
rc: cint;
|
||||
begin
|
||||
QueryResult := '';
|
||||
//Writeln('Executing : ',SQL);
|
||||
rc := sqlite3_exec(db, PChar(sql), @IndexCallback, self, @pzErrMsg);
|
||||
rc := sqlite3_exec(db, PAnsiChar(sql), @IndexCallback, self, @pzErrMsg);
|
||||
if not ignoreErrors then
|
||||
CheckSQLite(rc, pzErrMsg);
|
||||
end;
|
||||
@ -239,7 +239,7 @@ var
|
||||
begin
|
||||
if (Filename = '') then
|
||||
raise EFPIndexer.Create('Error: no filename specified');
|
||||
rc := sqlite3_open(PChar(FFilename), @db);
|
||||
rc := sqlite3_open(PAnsiChar(FFilename), @db);
|
||||
if rc <> SQLITE_OK then
|
||||
raise EFPIndexer.CreateFmt('Cannot open database: %s', [filename]);
|
||||
end;
|
||||
@ -282,7 +282,7 @@ begin
|
||||
// Result:=sqlite3_last_insert_rowid(db);
|
||||
end;
|
||||
|
||||
procedure TSQLiteIndexDB.CheckSQLite(Rc: cint; pzErrMsg: PChar);
|
||||
procedure TSQLiteIndexDB.CheckSQLite(Rc: cint; pzErrMsg: PAnsiChar);
|
||||
var
|
||||
S: UTF8string;
|
||||
begin
|
||||
@ -296,7 +296,7 @@ end;
|
||||
|
||||
procedure TSQLiteIndexDB.FindSearchData(SearchWord: TWordParser; FPSearch: TFPSearch; SearchOptions: TSearchOptions);
|
||||
var
|
||||
pzErrMsg: PChar;
|
||||
pzErrMsg: PAnsiChar;
|
||||
rc: cint;
|
||||
sql: UTF8string;
|
||||
begin
|
||||
@ -305,7 +305,7 @@ begin
|
||||
|
||||
sql := GetMatchSQL(SearchOptions, SearchWord, False);
|
||||
//sql := Format(sql, [SearchWord]);
|
||||
rc := sqlite3_exec(db, PChar(sql), @SearchCallback, self, @pzErrMsg);
|
||||
rc := sqlite3_exec(db, PAnsiChar(sql), @SearchCallback, self, @pzErrMsg);
|
||||
CheckSQLite(rc, pzErrMsg);
|
||||
end;
|
||||
|
||||
@ -314,7 +314,7 @@ function TSQLiteIndexDB.GetAvailableWords(out aList: TUTF8StringArray; aContaini
|
||||
Var
|
||||
st,sql: UTF8string;
|
||||
rc: cint;
|
||||
pzErrMsg: PChar;
|
||||
pzErrMsg: PAnsiChar;
|
||||
|
||||
begin
|
||||
Result:=0;
|
||||
@ -331,7 +331,7 @@ begin
|
||||
ST:='';
|
||||
end;
|
||||
sql:=StringReplace(SQL,':'+SearchTermParam,''''+ST+'''',[]);
|
||||
rc := sqlite3_exec(db, PChar(sql), @WordListCallback, self, @pzErrMsg);
|
||||
rc := sqlite3_exec(db, PAnsiChar(sql), @WordListCallback, self, @pzErrMsg);
|
||||
CheckSQLite(rc, pzErrMsg);
|
||||
SetLength(FMatchList,FRow);
|
||||
aList:=FMatchList;
|
||||
|
Loading…
Reference in New Issue
Block a user