From 414a55c3cee502d868e1ac4f85e323caae7d3a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Van=20Canneyt?= Date: Sat, 14 Jan 2023 14:54:04 +0100 Subject: [PATCH] * PChar -> PAnsiChar --- packages/aspell/src/aspelldyn.pp | 2 +- packages/aspell/src/spellcheck.pp | 48 +++++++++++++++---------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/packages/aspell/src/aspelldyn.pp b/packages/aspell/src/aspelldyn.pp index 18985c80e3..bca23c834a 100644 --- a/packages/aspell/src/aspelldyn.pp +++ b/packages/aspell/src/aspelldyn.pp @@ -487,7 +487,7 @@ var bversion, path: ansistring; version: dword; i: Integer; - s: string; + s: AnsiString; begin aspell_init := True; libname := libn; diff --git a/packages/aspell/src/spellcheck.pp b/packages/aspell/src/spellcheck.pp index f02957ce0e..845dd5da55 100644 --- a/packages/aspell/src/spellcheck.pp +++ b/packages/aspell/src/spellcheck.pp @@ -11,10 +11,10 @@ uses SysUtils, Classes, Aspell; type - TSuggestionArray = array of string; + TSuggestionArray = array of AnsiString; TWordError = record - Word: string; // the word itself + Word: AnsiString; // the word itself Pos: LongWord; // word position in line Length: LongWord; // word length Suggestions: TSuggestionArray; // suggestions for the given word @@ -27,21 +27,21 @@ type TSpeller = class // abstract class, basis for all checkers protected - FMode: string; - FEncoding: string; - FLanguage: string; - procedure SetEncoding(const AValue: string); - procedure SetLanguage(const AValue: string); - procedure SetMode(const AValue: string); + FMode: AnsiString; + FEncoding: AnsiString; + FLanguage: AnsiString; + procedure SetEncoding(const AValue: AnsiString); + procedure SetLanguage(const AValue: AnsiString); + procedure SetMode(const AValue: AnsiString); procedure CreateSpeller; virtual; abstract; procedure FreeSpeller; virtual; abstract; public constructor Create; destructor Destroy; override; public - property Mode: string read FMode write SetMode; - property Encoding: string read FEncoding write SetEncoding; - property Language: string read FLanguage write SetLanguage; + property Mode: AnsiString read FMode write SetMode; + property Encoding: AnsiString read FEncoding write SetEncoding; + property Language: AnsiString read FLanguage write SetLanguage; end; { TWordSpeller } @@ -49,13 +49,13 @@ type TWordSpeller = class(TSpeller) // class for simple per-word checking private FSpeller: PAspellSpeller; - FLastError: string; + FLastError: AnsiString; function DoCreateSpeller(Lang, Enc, aMode: PAnsiChar): PAspellSpeller; protected procedure CreateSpeller; override; procedure FreeSpeller; override; public - function SpellCheck(const Word: string): TSuggestionArray; // use to check single words, parsed out by you + function SpellCheck(const Word: AnsiString): TSuggestionArray; // use to check single words, parsed out by you end; { TDocumentSpeller } @@ -70,11 +70,11 @@ type protected procedure CreateSpeller; override; procedure FreeSpeller; override; - procedure DoNameSuggestions(const Word: string; var aWordError: TWordError); + procedure DoNameSuggestions(const Word: AnsiString; var aWordError: TWordError); public constructor Create; - function CheckLine(const aLine: string): TLineErrors; - function CheckDocument(const FileName: string): Integer; // returns number of spelling errors found or -1 for error + function CheckLine(const aLine: AnsiString): TLineErrors; + function CheckDocument(const FileName: AnsiString): Integer; // returns number of spelling errors found or -1 for error function CheckDocument(aStringList: TStringList): Integer; // returns number of spelling errors found or -1 for error procedure Reset; public @@ -90,7 +90,7 @@ const DEFAULT_LANGUAGE = 'en'; DEFAULT_MODE = ''; -function GetDefaultLanguage: string; +function GetDefaultLanguage: AnsiString; begin Result := GetEnvironmentVariable('LANG'); if Length(Result) = 0 then @@ -99,19 +99,19 @@ end; { TSpeller } -procedure TSpeller.SetEncoding(const AValue: string); +procedure TSpeller.SetEncoding(const AValue: AnsiString); begin FEncoding := aValue; CreateSpeller; end; -procedure TSpeller.SetLanguage(const AValue: string); +procedure TSpeller.SetLanguage(const AValue: AnsiString); begin FLanguage := aValue; CreateSpeller; end; -procedure TSpeller.SetMode(const AValue: string); +procedure TSpeller.SetMode(const AValue: AnsiString); begin FMode := aValue; CreateSpeller; @@ -185,7 +185,7 @@ begin end; end; -function TWordSpeller.SpellCheck(const Word: string): TSuggestionArray; +function TWordSpeller.SpellCheck(const Word: AnsiString): TSuggestionArray; var sgs: Paspellwordlist; elm: Paspellstringenumeration; @@ -252,7 +252,7 @@ begin inherited FreeSpeller; end; -procedure TDocumentSpeller.DoNameSuggestions(const Word: string; +procedure TDocumentSpeller.DoNameSuggestions(const Word: AnsiString; var aWordError: TWordError); begin aWordError.Suggestions := SpellCheck(Word); @@ -265,7 +265,7 @@ begin FNameSuggestions := True; end; -function TDocumentSpeller.CheckLine(const aLine: string): TLineErrors; +function TDocumentSpeller.CheckLine(const aLine: AnsiString): TLineErrors; const CHUNK_SIZE = 10; var @@ -300,7 +300,7 @@ begin SetLength(Result, Count); end; -function TDocumentSpeller.CheckDocument(const FileName: string): Integer; +function TDocumentSpeller.CheckDocument(const FileName: AnsiString): Integer; var s: TStringList; begin