Re: Zeos 7.3 testers-thread
Posted: 23.05.2019, 10:27
I was able to compile with some modifications:
LongWord has different size depending on platform and my Delphi 10.2.3 was complaining that declarations of proceduress in interface and implementation was different, when type LongWord was used.
Another bug was abmigitious overload of Min function - I had to explicitly define type of args.
Code: Select all
Index: core/ZVariant.pas
===================================================================
--- core/ZVariant.pas (revision 5660)
+++ core/ZVariant.pas (working copy)
@@ -107,7 +107,7 @@
Hour: Word;
Minute: Word;
Second: Word;
- Fractions: LongWord;
+ Fractions: Cardinal;
end;
{** Defines a variant structure. }
TZVariant = {$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}packed{$endif} record
Index: dbc/ZDbcASAResultSet.pas
===================================================================
--- dbc/ZDbcASAResultSet.pas (revision 5660)
+++ dbc/ZDbcASAResultSet.pas (working copy)
@@ -101,7 +101,7 @@
function IsNull(ColumnIndex: Integer): Boolean; override;
function GetBoolean(ColumnIndex: Integer): Boolean; override;
function GetInt(ColumnIndex: Integer): Integer; override;
- function GetUInt(ColumnIndex: Integer): LongWord; override;
+ function GetUInt(ColumnIndex: Integer): Cardinal; override;
function GetLong(ColumnIndex: Integer): Int64; override;
function GetULong(ColumnIndex: Integer): UInt64; override;
function GetFloat(ColumnIndex: Integer): Single; override;
@@ -521,7 +521,7 @@
@return the column value; if the value is SQL <code>NULL</code>, the
value returned is <code>0</code>
}
-function TZASAAbstractResultSet.GetUInt(ColumnIndex: Integer): LongWord;
+function TZASAAbstractResultSet.GetUInt(ColumnIndex: Integer): Cardinal;
begin
CheckClosed;
LastWasNull := IsNull(ColumnIndex);
Index: dbc/ZDbcASAUtils.pas
===================================================================
--- dbc/ZDbcASAUtils.pas (revision 5660)
+++ dbc/ZDbcASAUtils.pas (working copy)
@@ -1005,11 +1005,11 @@
begin
case Self.GetFieldSqlType(Index) of
stAsciiStream:
- SetFieldType(TempSQLDA, 0, DT_LONGVARCHAR, Min( BlockSize, Length));
+ SetFieldType(TempSQLDA, 0, DT_LONGVARCHAR, Min( Int64(BlockSize), Int64(Length)));
stUnicodeStream:
- SetFieldType(TempSQLDA, 0, DT_LONGNVARCHAR, Min( BlockSize, Length));
+ SetFieldType(TempSQLDA, 0, DT_LONGNVARCHAR, Min( Int64(BlockSize), Int64(Length)));
stBinaryStream:
- SetFieldType(TempSQLDA, 0, DT_LONGBINARY, Min( BlockSize, Length));
+ SetFieldType(TempSQLDA, 0, DT_LONGBINARY, Min( Int64(BlockSize), Int64(Length)));
else
sqlType := DT_FIXCHAR;
end;
@@ -1032,7 +1032,7 @@
if ( sqlind^ = 0 ) or ( RD = Length) then
break;
Inc( Offs, PZASABlobStruct( sqlData)^.stored_len);
- sqllen := Min( BlockSize, Length-Rd);
+ sqllen := Min( Int64(BlockSize), Int64(Length-Rd));
end;
if Rd <> Length then
CreateException( 'Could''nt complete BLOB-Read');
Index: dbc/ZDbcInterbase6Utils.pas
===================================================================
--- dbc/ZDbcInterbase6Utils.pas (revision 5660)
+++ dbc/ZDbcInterbase6Utils.pas (working copy)
@@ -270,7 +270,7 @@
var MemPerRow, PreparedRowsOfArray, MaxRowsPerBatch: Integer;
var TypeTokens: TRawByteStringDynArray;
InitialStatementType: TZIbSqlStatementType;
- const XSQLDAMaxSize: LongWord): RawByteString;
+ const XSQLDAMaxSize: Cardinal): RawByteString;
const
{ Default Interbase blob size for reading }
@@ -435,8 +435,8 @@
//ported from NoThrowTimeStamp.cpp
-procedure isc_decode_time(ntime: ISC_TIME; out hours, minutes, seconds: Word; out fractions: LongWord);
-procedure isc_encode_time(var ntime: ISC_TIME; hours, minutes, seconds: Word; fractions: LongWord);
+procedure isc_decode_time(ntime: ISC_TIME; out hours, minutes, seconds: Word; out fractions: Cardinal);
+procedure isc_encode_time(var ntime: ISC_TIME; hours, minutes, seconds: Word; fractions: Cardinal);
procedure isc_decode_date(nday: ISC_DATE; out year, month, day: Word);
procedure isc_encode_date(out nday: ISC_DATE; year, month, day: Word);
@@ -1971,7 +1971,7 @@
var MemPerRow, PreparedRowsOfArray,MaxRowsPerBatch: Integer;
var TypeTokens: TRawByteStringDynArray;
InitialStatementType: TZIbSqlStatementType;
- const XSQLDAMaxSize: LongWord): RawByteString;
+ const XSQLDAMaxSize: Cardinal): RawByteString;
var
IndexName, ArrayName: RawByteString;
ParamIndex, J: Cardinal;
@@ -2107,8 +2107,8 @@
end;
Inc(SingleStmtLength, 1{;}+Length(LineEnding));
if MaxRowsPerBatch = 0 then //calc maximum batch count if not set already
- MaxRowsPerBatch := Min((XSQLDAMaxSize div Cardinal(MemPerRow)), {memory limit of XSQLDA structs}
- (((32*1024)-LBlockLen) div Cardinal(HeaderLen+SingleStmtLength)))+1; {32KB limited Also with FB3};
+ MaxRowsPerBatch := Min((XSQLDAMaxSize div Int64(MemPerRow)), {memory limit of XSQLDA structs}
+ (((32*1024)-LBlockLen) div Int64(HeaderLen+SingleStmtLength)))+1; {32KB limited Also with FB3};
Inc(StmtLength, HeaderLen+SingleStmtLength);
Inc(FullHeaderLen, HeaderLen);
//we run into XSQLDA !update! count limit of 255 see:
@@ -2150,7 +2150,7 @@
Inc(PreparedRowsOfArray);
end;
-procedure isc_decode_time(ntime: ISC_TIME; out hours, minutes, seconds: Word; out fractions: LongWord);
+procedure isc_decode_time(ntime: ISC_TIME; out hours, minutes, seconds: Word; out fractions: Cardinal);
begin
hours := ntime div (SecsPerHour * ISC_TIME_SECONDS_PRECISION);
ntime := ntime mod (SecsPerHour * ISC_TIME_SECONDS_PRECISION);
@@ -2161,7 +2161,7 @@
end;
{$IFDEF FPC} {$PUSH} {$WARN 4081 off : Converting the operands to "$1" before doing the multiply could prevent overflow errors.} {$ENDIF} // overflow means error so just disable hint
-procedure isc_encode_time(var ntime: ISC_TIME; hours, minutes, seconds: Word; fractions: LongWord);
+procedure isc_encode_time(var ntime: ISC_TIME; hours, minutes, seconds: Word; fractions: Cardinal);
begin
ntime := ((hours * MinsPerHour + minutes) * SecsPerMin + seconds) * ISC_TIME_SECONDS_PRECISION + fractions;
end;
Index: dbc/ZDbcODBCResultSet.pas
===================================================================
--- dbc/ZDbcODBCResultSet.pas (revision 5660)
+++ dbc/ZDbcODBCResultSet.pas (working copy)
@@ -133,7 +133,7 @@
function GetUTF8String(ColumnIndex: Integer): UTF8String;
function GetRawByteString(ColumnIndex: Integer): RawByteString;
function GetBoolean(ColumnIndex: Integer): Boolean;
- function GetUInt(ColumnIndex: Integer): LongWord;
+ function GetUInt(ColumnIndex: Integer): Cardinal;
function GetInt(ColumnIndex: Integer): Integer;
function GetULong(ColumnIndex: Integer): UInt64;
function GetLong(ColumnIndex: Integer): Int64;
@@ -1170,7 +1170,7 @@
end;
end;
-function TAbstractODBCResultSet.GetUInt(ColumnIndex: Integer): LongWord;
+function TAbstractODBCResultSet.GetUInt(ColumnIndex: Integer): Cardinal;
var L: LengthInt;
begin
if not IsNull(ColumnIndex) then
Index: dbc/ZDbcOracleUtils.pas
===================================================================
--- dbc/ZDbcOracleUtils.pas (revision 5660)
+++ dbc/ZDbcOracleUtils.pas (working copy)
@@ -1183,7 +1183,7 @@
DataType := SQLT_INT;
case DataSize of
SizeOf(Int64): Result := stLong;
- SizeOf(LongInt): Result := stInteger;
+ SizeOf(Integer): Result := stInteger;
SizeOf(SmallInt): Result := stSmall;
SizeOf(ShortInt): Result := stShort;
else begin
Index: dbc/ZDbcPostgreSqlUtils.pas
===================================================================
--- dbc/ZDbcPostgreSqlUtils.pas (revision 5660)
+++ dbc/ZDbcPostgreSqlUtils.pas (working copy)
@@ -139,8 +139,8 @@
//macros from datetime.c
function date2j(y, m, d: Integer): Integer;
procedure j2date(jd: Integer; out AYear, AMonth, ADay: Word);
-procedure dt2time(jd: Int64; out Hour, Min, Sec: Word; out fsec: LongWord); overload;
-procedure dt2time(jd: Double; out Hour, Min, Sec: Word; out fsec: LongWord); overload;
+procedure dt2time(jd: Int64; out Hour, Min, Sec: Word; out fsec: Cardinal); overload;
+procedure dt2time(jd: Double; out Hour, Min, Sec: Word; out fsec: Cardinal); overload;
procedure DateTime2PG(const Value: TDateTime; out Result: Int64); overload;
procedure DateTime2PG(const Value: TDateTime; out Result: Double); overload;
@@ -152,11 +152,11 @@
function PG2DateTime(Value: Double): TDateTime; overload;
procedure PG2DateTime(Value: Double; out Year, Month, Day, Hour, Min, Sec: Word;
- out fsec: LongWord); overload;
+ out fsec: Cardinal); overload;
function PG2DateTime(Value: Int64): TDateTime; overload;
procedure PG2DateTime(Value: Int64; out Year, Month, Day, Hour, Min, Sec: Word;
- out fsec: LongWord); overload;
+ out fsec: Cardinal); overload;
function PG2Time(Value: Double): TDateTime; overload;
function PG2Time(Value: Int64): TDateTime; overload;
@@ -846,7 +846,7 @@
procedure j2date(jd: Integer; out AYear, AMonth, ADay: Word);
var
- julian, quad, extra: LongWord;
+ julian, quad, extra: Cardinal;
y: Integer;
begin
julian := jd;
@@ -893,7 +893,7 @@
{$IFNDEF ENDIAN_BIG}
procedure Reverse8Bytes(P: Pointer); {$IFDEF WITH_INLINE}inline;{$ENDIF}
-var W: LongWord;
+var W: Cardinal;
begin
W := PLongWord(P)^;
PByteArray(P)[0] := PByteArray(P)[7];
@@ -939,7 +939,7 @@
function PG2DateTime(Value: Double): TDateTime;
var date: TDateTime;
Year, Month, Day, Hour, Min, Sec: Word;
- fsec: LongWord;
+ fsec: Cardinal;
begin
PG2DateTime(Value, Year, Month, Day, Hour, Min, Sec, fsec);
TryEncodeDate(Year, Month, Day, date);
@@ -949,7 +949,7 @@
end;
procedure PG2DateTime(value: Double; out Year, Month, Day, Hour, Min, Sec: Word;
- out fsec: LongWord);
+ out fsec: Cardinal);
var
date: Double;
time: Double;
@@ -975,7 +975,7 @@
function PG2DateTime(Value: Int64): TDateTime;
var date: TDateTime;
Year, Month, Day, Hour, Min, Sec: Word;
- fsec: LongWord;
+ fsec: Cardinal;
begin
PG2DateTime(Value, Year, Month, Day, Hour, Min, Sec, fsec);
if not TryEncodeDate(Year, Month, Day, date) then
@@ -986,7 +986,7 @@
end;
procedure PG2DateTime(Value: Int64; out Year, Month, Day, Hour, Min, Sec: Word;
- out fsec: LongWord);
+ out fsec: Cardinal);
var date: Int64;
begin
{$IFNDEF ENDIAN_BIG}
@@ -1003,7 +1003,7 @@
dt2time(Value, Hour, Min, Sec, fsec);
end;
-procedure dt2time(jd: Int64; out Hour, Min, Sec: Word; out fsec: LongWord);
+procedure dt2time(jd: Int64; out Hour, Min, Sec: Word; out fsec: Cardinal);
begin
Hour := jd div USECS_PER_HOUR;
jd := jd - Int64(Hour) * Int64(USECS_PER_HOUR);
@@ -1013,7 +1013,7 @@
Fsec := jd - (Int64(Sec) * Int64(USECS_PER_SEC));
end;
-procedure dt2time(jd: Double; out Hour, Min, Sec: Word; out fsec: LongWord);
+procedure dt2time(jd: Double; out Hour, Min, Sec: Word; out fsec: Cardinal);
begin
Hour := Trunc(jd / SECS_PER_HOUR);
jd := jd - Hour * SECS_PER_HOUR;
@@ -1045,7 +1045,7 @@
end;
function PG2Time(Value: Double): TDateTime;
-var Hour, Min, Sec: Word; fsec: LongWord;
+var Hour, Min, Sec: Word; fsec: Cardinal;
begin
{$IFNDEF ENDIAN_BIG}
Reverse8Bytes(@Value);
@@ -1056,7 +1056,7 @@
end;
function PG2Time(Value: Int64): TDateTime;
-var Hour, Min, Sec: Word; fsec: LongWord;
+var Hour, Min, Sec: Word; fsec: Cardinal;
begin
{$IFNDEF ENDIAN_BIG}
Reverse8Bytes(@Value);
Another bug was abmigitious overload of Min function - I had to explicitly define type of args.