From 93883d12642a1adc4b90320ab73e0c16d2006568 Mon Sep 17 00:00:00 2001 From: paul <paul@idefix.freepascal.org> Date: Sat, 4 Jan 2014 16:42:20 +0000 Subject: [PATCH] compiler: load binary unicode mappings in cpavailable() call instead of separate loadbinarycp() call git-svn-id: trunk@26379 - --- compiler/scandir.pas | 2 +- compiler/widestr.pas | 30 ++++++++++++++---------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/compiler/scandir.pas b/compiler/scandir.pas index a3cf2c320e..b9ddf07984 100644 --- a/compiler/scandir.pas +++ b/compiler/scandir.pas @@ -1511,7 +1511,7 @@ unit scandir; s:=current_scanner.readcomment; if (upper(s)='UTF8') or (upper(s)='UTF-8') then current_settings.sourcecodepage:=CP_UTF8 - else if not(cpavailable(s) or loadbinarycp(s)) then + else if not cpavailable(s) then Message1(option_code_page_not_available,s) else current_settings.sourcecodepage:=codepagebyname(s); diff --git a/compiler/widestr.pas b/compiler/widestr.pas index 5df1d1fd42..43a54adb0a 100644 --- a/compiler/widestr.pas +++ b/compiler/widestr.pas @@ -56,14 +56,13 @@ unit widestr; procedure unicode2ascii(r : pcompilerwidestring;p : pchar;cp : tstringencoding); function hasnonasciichars(const p: pcompilerwidestring): boolean; function getcharwidestring(r : pcompilerwidestring;l : SizeInt) : tcompilerwidechar; - function cpavailable(const s : string) : boolean; - function cpavailable(cp : word) : boolean; + function cpavailable(const s: string) : boolean; + function cpavailable(cp: word) : boolean; procedure changecodepage( s : pchar; l : SizeInt; scp : tstringencoding; d : pchar; dcp : tstringencoding ); function codepagebyname(const s : string) : tstringencoding; - function loadbinarycp(const s: String): Boolean; implementation @@ -287,14 +286,22 @@ unit widestr; end; - function cpavailable(const s : string) : boolean; + function cpavailable(const s: string): boolean; begin - cpavailable:=mappingavailable(lower(s)); + result:=mappingavailable(lower(s)); + {$if FPC_FULLVERSION>20700} + if not result then + result:=(unicodepath<>'')and(registerbinarymapping(unicodepath+'charset',lower(s))); + {$ifend} end; - function cpavailable(cp : word) : boolean; + function cpavailable(cp: word): boolean; begin - cpavailable:=mappingavailable(cp); + result:=mappingavailable(cp); + {$if FPC_FULLVERSION>20700} + if not result then + result:=(unicodepath<>'')and(registerbinarymapping(unicodepath+'charset','cp'+tostr(cp))); + {$ifend} end; procedure changecodepage( @@ -329,13 +336,4 @@ unit widestr; Result:=p^.cp; end; - function loadbinarycp(const s: String): Boolean; - begin - {$if FPC_FULLVERSION>20700} - result:=(unicodepath<>'')and(registerbinarymapping(unicodepath+'charset',s)); - {$else} - result:=false; - {$ifend} - end; - end.