Merged revision(s) 51026 #39da734bec from trunk:

LazUtils: fix compilation for WinCE.
........

git-svn-id: branches/fixes_1_6@51029 -
This commit is contained in:
maxim 2015-12-24 22:17:53 +00:00
parent 7e7e3da5e3
commit f3a9a4ddf2
2 changed files with 13 additions and 5 deletions
components/lazutils

View File

@ -55,9 +55,9 @@ function UTF8ToConsole(const s: string): string;
// for all Windows supporting 8bit codepages (e.g. not WinCE)
// converts string in Windows code page to UTF8 (used with some Windows specific functions)
function WinCPToUTF8(const s: string): string;
function WinCPToUTF8(const s: string): string; {$ifdef WinCe}inline;{$endif}
// converts UTF8 string to Windows code page encoding (used by Write, WriteLn)
function UTF8ToWinCP(const s: string): string;
function UTF8ToWinCP(const s: string): string; {$ifdef WinCe}inline;{$endif}
function ParamStrUTF8(Param: Integer): string;

View File

@ -265,14 +265,17 @@ begin
{$endif WinCE}
end;
{$IFDEF MSWindows}
{$IFDEF Windows}
// for all Windows supporting 8bit codepages (e.g. not WinCE)
function WinCPToUTF8(const s: string): string;
function WinCPToUTF8(const s: string): string; {$ifdef WinCe}inline;{$endif}
// result has codepage CP_ACP
var
UTF16WordCnt: SizeInt;
UTF16Str: UnicodeString;
begin
{$ifdef WinCE}
Result := SysToUtf8(s);
{$else}
Result:=s;
if IsASCII(Result) then begin
{$ifdef FPC_HAS_CPSTRING}
@ -293,14 +296,18 @@ begin
SetCodePage(RawByteString(Result), CP_ACP, False);
{$endif}
end;
{$endif}
end;
function UTF8ToWinCP(const s: string): string;
function UTF8ToWinCP(const s: string): string; {$ifdef WinCe}inline;{$endif}
// result has codepage CP_ACP
var
src: UnicodeString;
len: LongInt;
begin
{$ifdef WinCE}
Result := Utf8ToSys(s);
{$else}
Result:=s;
if IsASCII(Result) then begin
{$ifdef FPC_HAS_CPSTRING}
@ -321,6 +328,7 @@ begin
SetCodePage(RawByteString(Result), CP_ACP, False);
{$endif}
end;
{$endif}
end;
{$ENDIF}