mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-10 10:29:17 +02:00
--- Merging r34463 into '.':
U packages/fcl-base/src/inifiles.pp --- Recording mergeinfo for merge of r34463 into '.': U . --- Merging r34477 into '.': A packages/paszlib/tests/tczstreamseek.pp U packages/paszlib/src/zstream.pp --- Recording mergeinfo for merge of r34477 into '.': G . --- Merging r35100 into '.': U rtl/freebsd/i386/identpatch.sh --- Recording mergeinfo for merge of r35100 into '.': G . --- Merging r35193 into '.': U rtl/gba/sysutils.pp U rtl/nds/sysutils.pp --- Recording mergeinfo for merge of r35193 into '.': G . # revisions: 34463,34477,35100,35193 git-svn-id: branches/fixes_3_0@35306 -
This commit is contained in:
parent
7bcebbdd1b
commit
a638d8b31e
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -6543,6 +6543,7 @@ packages/paszlib/src/ziputils.pas svneol=native#text/plain
|
||||
packages/paszlib/src/zstream.pp svneol=native#text/plain
|
||||
packages/paszlib/src/zuncompr.pas svneol=native#text/plain
|
||||
packages/paszlib/tests/tczipper.pp svneol=native#text/plain
|
||||
packages/paszlib/tests/tczstreamseek.pp svneol=native#text/plain
|
||||
packages/pcap/Makefile svneol=native#text/plain
|
||||
packages/pcap/Makefile.fpc svneol=native#text/plain
|
||||
packages/pcap/Makefile.fpc.fpcmake svneol=native#text/plain
|
||||
|
@ -165,7 +165,7 @@ type
|
||||
procedure WriteString(const Section, Ident, Value: String); virtual; abstract;
|
||||
function ReadInteger(const Section, Ident: string; Default: Longint): Longint; virtual;
|
||||
procedure WriteInteger(const Section, Ident: string; Value: Longint); virtual;
|
||||
function ReadInt64(const Section, Ident: string; Default: Int64): Longint; virtual;
|
||||
function ReadInt64(const Section, Ident: string; Default: Int64): Int64; virtual;
|
||||
procedure WriteInt64(const Section, Ident: string; Value: Int64); virtual;
|
||||
function ReadBool(const Section, Ident: string; Default: Boolean): Boolean; virtual;
|
||||
procedure WriteBool(const Section, Ident: string; Value: Boolean); virtual;
|
||||
@ -608,7 +608,7 @@ begin
|
||||
end;
|
||||
|
||||
function TCustomIniFile.ReadInt64(const Section, Ident: string; Default: Int64
|
||||
): Longint;
|
||||
): Int64;
|
||||
begin
|
||||
Result := StrToInt64Def(ReadString(Section, Ident, ''), Default);
|
||||
end;
|
||||
|
@ -324,7 +324,7 @@ begin
|
||||
raise Edecompressionerror.create(zerror(err));
|
||||
end;
|
||||
|
||||
function Tdecompressionstream.GetPosition() : Int64;
|
||||
function Tdecompressionstream.GetPosition() : Int64;
|
||||
begin
|
||||
GetPosition := raw_read;
|
||||
end;
|
||||
@ -335,31 +335,28 @@ var c,off: int64;
|
||||
|
||||
begin
|
||||
off:=Offset;
|
||||
if (origin=soBeginning) or ((origin=soCurrent) and (off+raw_read>=0)) then
|
||||
begin
|
||||
if origin = soCurrent then
|
||||
seek := raw_read + off
|
||||
else
|
||||
seek := off;
|
||||
|
||||
if origin=soBeginning then
|
||||
dec(off,raw_read);
|
||||
if offset<0 then
|
||||
begin
|
||||
inc(off,raw_read);
|
||||
reset;
|
||||
end;
|
||||
while off>0 do
|
||||
begin
|
||||
c:=off;
|
||||
if c>bufsize then
|
||||
c:=bufsize;
|
||||
c:=read(Fbuffer^,c);
|
||||
dec(off,c);
|
||||
end;
|
||||
end
|
||||
else
|
||||
|
||||
if origin=soCurrent then
|
||||
inc(off,raw_read);
|
||||
if (origin=soEnd) or (off<0) then
|
||||
raise Edecompressionerror.create(Sseek_failed);
|
||||
|
||||
seek:=off;
|
||||
|
||||
if off<raw_read then
|
||||
reset
|
||||
else
|
||||
dec(off,raw_read);
|
||||
|
||||
while off>0 do
|
||||
begin
|
||||
c:=off;
|
||||
if c>bufsize then
|
||||
c:=bufsize;
|
||||
if read(Fbuffer^,c)<>c then
|
||||
raise Edecompressionerror.create(Sseek_failed);
|
||||
dec(off,c);
|
||||
end;
|
||||
end;
|
||||
|
||||
function Tdecompressionstream.get_compressionrate:single;
|
||||
|
58
packages/paszlib/tests/tczstreamseek.pp
Normal file
58
packages/paszlib/tests/tczstreamseek.pp
Normal file
@ -0,0 +1,58 @@
|
||||
program tczstreamseek;
|
||||
{$MODE OBJFPC}
|
||||
{$ASSERTIONS ON}
|
||||
|
||||
uses
|
||||
classes,
|
||||
zstream;
|
||||
|
||||
const
|
||||
val: Uint32 = $123456;
|
||||
wasError: boolean = False;
|
||||
var
|
||||
data: TMemoryStream;
|
||||
comprStream: TCompressionStream;
|
||||
decomprStream: TDecompressionStream;
|
||||
begin
|
||||
data := TMemoryStream.Create();
|
||||
|
||||
comprStream := TCompressionStream.Create(clMax, data);
|
||||
comprStream.WriteDWord(val);
|
||||
comprStream.Free;
|
||||
|
||||
data.Seek(0, soFromBeginning);
|
||||
|
||||
decomprStream := TDecompressionStream.Create(data);
|
||||
Assert(decomprStream.ReadDWord() = val);
|
||||
Assert(decomprStream.Position = SizeOf(val));
|
||||
|
||||
decomprStream.Seek(0, soFromBeginning);
|
||||
Assert(decomprStream.Position = 0);
|
||||
Assert(decomprStream.ReadDWord() = val);
|
||||
|
||||
decomprStream.Seek(-SizeOf(val), soFromCurrent);
|
||||
Assert(decomprStream.Position = 0);
|
||||
Assert(decomprStream.ReadDWord() = val);
|
||||
|
||||
wasError := False;
|
||||
decomprStream.Seek(0, soFromBeginning);
|
||||
try
|
||||
decomprStream.Seek(-SizeOf(val), soFromCurrent);
|
||||
except
|
||||
on EDecompressionError do
|
||||
wasError := True;
|
||||
end;
|
||||
assert(wasError);
|
||||
|
||||
decomprStream.Seek(SizeOf(val), soFromBeginning);
|
||||
Assert(decomprStream.Position = SizeOf(val));
|
||||
|
||||
wasError := False;
|
||||
try
|
||||
decomprStream.Seek(40, soFromBeginning);
|
||||
except
|
||||
on EDecompressionError do
|
||||
wasError := True;
|
||||
end;
|
||||
assert(wasError);
|
||||
end.
|
@ -1,12 +1,18 @@
|
||||
#!/bin/sh
|
||||
if [ "$#" -ne 1 ]
|
||||
then
|
||||
elfdump -n `which elfdump` |awk '/FreeBSD/{print $2}' >elfversion
|
||||
IDVERSION=`cat elfversion`
|
||||
rm elfversion
|
||||
else
|
||||
IDVERSION=$1
|
||||
fi
|
||||
echo Patching cprt0.as with version $IDVERSION
|
||||
|
||||
sed -I.sav -es/900044/$IDVERSION/ cprt0.as
|
||||
sed -I.sav -es/900044/$IDVERSION/ dllprt0.as
|
||||
sed -I.sav -es/900044/$IDVERSION/ prt0.as
|
||||
sed -I.sav -es/900044/$IDVERSION/ gprt0.as
|
||||
sed -I.sav -es/900044/$IDVERSION/ si_c.inc
|
||||
sed -I.sav -es/900044/$IDVERSION/ si_prc.inc
|
||||
|
||||
|
@ -278,17 +278,39 @@ begin
|
||||
result := '';
|
||||
end;
|
||||
|
||||
function ExecuteProcess (const Path: AnsiString; const ComLine: AnsiString;Flags:TExecuteFlags=[]): integer;
|
||||
function ExecuteProcess (const Path: RawByteString; const ComLine: RawByteString;Flags:TExecuteFlags=[]): integer;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
function ExecuteProcess (const Path: AnsiString;
|
||||
const ComLine: array of AnsiString;Flags:TExecuteFlags=[]): integer;
|
||||
function ExecuteProcess (const Path: RawByteString;
|
||||
const ComLine: array of RawByteString;Flags:TExecuteFlags=[]): integer;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
function ExecuteProcess(const Path: UnicodeString; const ComLine: UnicodeString;
|
||||
Flags: TExecuteFlags = []): Integer;
|
||||
begin
|
||||
{ TODO : implement }
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
function ExecuteProcess(const Path: UnicodeString;
|
||||
const ComLine: Array of UnicodeString; Flags:TExecuteFlags = []): Integer;
|
||||
var
|
||||
CommandLine: UnicodeString;
|
||||
I: integer;
|
||||
begin
|
||||
Commandline := '';
|
||||
for I := 0 to High (ComLine) do
|
||||
if Pos (' ', ComLine [I]) <> 0 then
|
||||
CommandLine := CommandLine + ' ' + '"' + ComLine [I] + '"'
|
||||
else
|
||||
CommandLine := CommandLine + ' ' + Comline [I];
|
||||
ExecuteProcess := ExecuteProcess (Path, CommandLine,Flags);
|
||||
end;
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
Initialization code
|
||||
|
@ -315,16 +315,38 @@ begin
|
||||
result := '';
|
||||
end;
|
||||
|
||||
function ExecuteProcess (const Path: AnsiString; const ComLine: AnsiString;Flags:TExecuteFlags=[]): integer;
|
||||
function ExecuteProcess (const Path: RawByteString; const ComLine: RawByteString;Flags:TExecuteFlags=[]): integer;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
function ExecuteProcess (const Path: AnsiString; const ComLine: array of AnsiString;Flags:TExecuteFlags=[]): integer;
|
||||
function ExecuteProcess (const Path: RawByteString; const ComLine: array of RawByteString;Flags:TExecuteFlags=[]): integer;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
function ExecuteProcess(const Path: UnicodeString; const ComLine: UnicodeString;
|
||||
Flags: TExecuteFlags = []): Integer;
|
||||
begin
|
||||
{ TODO : implement }
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
function ExecuteProcess(const Path: UnicodeString;
|
||||
const ComLine: Array of UnicodeString; Flags:TExecuteFlags = []): Integer;
|
||||
var
|
||||
CommandLine: UnicodeString;
|
||||
I: integer;
|
||||
begin
|
||||
Commandline := '';
|
||||
for I := 0 to High (ComLine) do
|
||||
if Pos (' ', ComLine [I]) <> 0 then
|
||||
CommandLine := CommandLine + ' ' + '"' + ComLine [I] + '"'
|
||||
else
|
||||
CommandLine := CommandLine + ' ' + Comline [I];
|
||||
ExecuteProcess := ExecuteProcess (Path, CommandLine,Flags);
|
||||
end;
|
||||
|
||||
function GetLastOSError: Integer;
|
||||
begin
|
||||
Result := -1;
|
||||
|
Loading…
Reference in New Issue
Block a user