mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-23 23:31:29 +02: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;
|
||||
pc : pchar;
|
||||
pw : pcompilerwidestring;
|
||||
i : longint;
|
||||
begin
|
||||
inherited ppuload(constsym,ppufile);
|
||||
constdef:=nil;
|
||||
@ -1521,7 +1522,19 @@ implementation
|
||||
begin
|
||||
initwidestring(pw);
|
||||
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;
|
||||
end;
|
||||
conststring,
|
||||
@ -1610,7 +1623,7 @@ implementation
|
||||
constwstring :
|
||||
begin
|
||||
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;
|
||||
conststring,
|
||||
constresourcestring :
|
||||
|
@ -5,4 +5,9 @@ uses
|
||||
|
||||
begin
|
||||
writeln(DEFAULT_SIGNATURE);
|
||||
if ('edb_signature' <> DEFAULT_SIGNATURE) then
|
||||
halt(1);
|
||||
writeln(DEFAULT_SIGNATURE2);
|
||||
if ('edb_signature2' <> DEFAULT_SIGNATURE2) then
|
||||
halt(1);
|
||||
end.
|
||||
|
@ -3,11 +3,12 @@ unit uw13583;
|
||||
interface
|
||||
|
||||
type
|
||||
// TEDBString = WideString;
|
||||
TEDBString = ansiString;
|
||||
TEDBString = WideString;
|
||||
TEDBString2 = ansiString;
|
||||
|
||||
const
|
||||
DEFAULT_SIGNATURE = TEDBString('edb_signature');
|
||||
DEFAULT_SIGNATURE2 = TEDBString('edb_signature2');
|
||||
|
||||
implementation
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user