mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-29 07:22:18 +01:00
o fixed r13033:
* test now tests both ansistring and widestring constants, instead of only
ansistring
* fixed writing of widestring constants to ppu file
* fixed setting length of read widestring constants (don't only set maxlen)
* handle cross-endian reading of widestring constants
git-svn-id: trunk@13034 -
This commit is contained in:
parent
37a2cff8fb
commit
045ae3ab69
@ -1501,6 +1501,7 @@ implementation
|
|||||||
ps : pnormalset;
|
ps : pnormalset;
|
||||||
pc : pchar;
|
pc : pchar;
|
||||||
pw : pcompilerwidestring;
|
pw : pcompilerwidestring;
|
||||||
|
i : longint;
|
||||||
begin
|
begin
|
||||||
inherited ppuload(constsym,ppufile);
|
inherited ppuload(constsym,ppufile);
|
||||||
constdef:=nil;
|
constdef:=nil;
|
||||||
@ -1521,7 +1522,19 @@ implementation
|
|||||||
begin
|
begin
|
||||||
initwidestring(pw);
|
initwidestring(pw);
|
||||||
setlengthwidestring(pw,ppufile.getlongint);
|
setlengthwidestring(pw,ppufile.getlongint);
|
||||||
ppufile.getdata(pw^.data^,pw^.len*sizeof(tcompilerwidechar));
|
pw^.len:=pw^.maxlen;
|
||||||
|
{ don't use getdata, because the compilerwidechars may have to
|
||||||
|
be byteswapped
|
||||||
|
}
|
||||||
|
{$if sizeof(tcompilerwidechar) = 2}
|
||||||
|
for i:=0 to pw^.len-1 do
|
||||||
|
pw^.data[i]:=ppufile.getword;
|
||||||
|
{$elseif sizeof(tcompilerwidechar) = 4}
|
||||||
|
for i:=0 to pw^.len-1 do
|
||||||
|
pw^.data[i]:=cardinal(ppufile.getlongint);
|
||||||
|
{$else}
|
||||||
|
{$error Unsupported tcompilerwidechar size}
|
||||||
|
{$endif}
|
||||||
pcompilerwidestring(value.valueptr):=pw;
|
pcompilerwidestring(value.valueptr):=pw;
|
||||||
end;
|
end;
|
||||||
conststring,
|
conststring,
|
||||||
@ -1610,7 +1623,7 @@ implementation
|
|||||||
constwstring :
|
constwstring :
|
||||||
begin
|
begin
|
||||||
ppufile.putlongint(getlengthwidestring(pcompilerwidestring(value.valueptr)));
|
ppufile.putlongint(getlengthwidestring(pcompilerwidestring(value.valueptr)));
|
||||||
ppufile.putdata(pcompilerwidestring(value.valueptr)^.data,pcompilerwidestring(value.valueptr)^.len*sizeof(tcompilerwidechar));
|
ppufile.putdata(pcompilerwidestring(value.valueptr)^.data^,pcompilerwidestring(value.valueptr)^.len*sizeof(tcompilerwidechar));
|
||||||
end;
|
end;
|
||||||
conststring,
|
conststring,
|
||||||
constresourcestring :
|
constresourcestring :
|
||||||
|
|||||||
@ -5,4 +5,9 @@ uses
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
writeln(DEFAULT_SIGNATURE);
|
writeln(DEFAULT_SIGNATURE);
|
||||||
|
if ('edb_signature' <> DEFAULT_SIGNATURE) then
|
||||||
|
halt(1);
|
||||||
|
writeln(DEFAULT_SIGNATURE2);
|
||||||
|
if ('edb_signature2' <> DEFAULT_SIGNATURE2) then
|
||||||
|
halt(1);
|
||||||
end.
|
end.
|
||||||
|
|||||||
@ -3,11 +3,12 @@ unit uw13583;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
type
|
type
|
||||||
// TEDBString = WideString;
|
TEDBString = WideString;
|
||||||
TEDBString = ansiString;
|
TEDBString2 = ansiString;
|
||||||
|
|
||||||
const
|
const
|
||||||
DEFAULT_SIGNATURE = TEDBString('edb_signature');
|
DEFAULT_SIGNATURE = TEDBString('edb_signature');
|
||||||
|
DEFAULT_SIGNATURE2 = TEDBString('edb_signature2');
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user