Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 65ef97c

Browse files
Merge pull request #413 from norayr/lazarus_fixes
changes to fix Lazarus and FreePascal compilation issues.
2 parents 1cd6621 + 6b24861 commit 65ef97c

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

‎Source/PythonEngine.pas‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6066,7 +6066,8 @@ function TPythonEngine.PyUnicodeAsString(obj : PPyObject): UnicodeString;
60666066
Exit;
60676067

60686068
// The second argument is the size of the destination (Result) including #0
6069-
NewSize := Utf8ToUnicode(PChar(Result), Cardinal(Size + 1), Buffer, Cardinal(Size));
6069+
NewSize := Utf8ToUnicode(PWideChar(Result), Cardinal(Size + 1), Buffer, Cardinal(Size));
6070+
60706071
// NewSize includes #0
60716072
SetLength(Result, NewSize - 1);
60726073
end

‎Source/WrapDelphi.pas‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2571,12 +2571,14 @@ function TPyDelphiObject.Dir_Wrapper(args: PPyObject): PPyObject;
25712571

25722572
var
25732573
PyType: PPyTypeObject;
2574+
25742575
{$IFDEF EXTENDED_RTTI}
25752576
Context: TRttiContext;
25762577
RttiType: TRTTIType;
25772578
{$ELSE}
25782579
_PropList: PPropList;
25792580
_propCount : Integer;
2581+
i: Integer;
25802582
{$ENDIF}
25812583
begin
25822584
Adjust(@Self);

‎Source/WrapDelphiClasses.pas‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
interface
66

77
uses
8-
Classes, SysUtils, PythonEngine, WrapDelphi;
8+
Classes, SysUtils, PythonEngine, WrapDelphi
9+
{$IFDEF FPC}, bufstream{$ENDIF};
910

1011
type
1112
{
@@ -367,6 +368,7 @@ implementation
367368
uses
368369
TypInfo {$IFNDEF FPC}, System.Rtti{$ENDIF};
369370

371+
370372
{$IFNDEF FPC}
371373
type
372374
TPyReader = class(TReader)
@@ -2223,7 +2225,12 @@ TBufferedFileStreamClass = class of TBufferedFileStream;
22232225
DelphiObject := TBufferedFileStreamClass(DelphiObjectClass).Create(String(LFileName), LMode, LBufferSize);
22242226
end else if (LArgCount = 3) then begin
22252227
if (APythonType.Engine.PyArg_ParseTupleAndKeywords(args, kwds, 'sHI|i:Create', @LKwArgs2[0], @LFileName, @LMode, @LRights, @LBufferSize) <> 0) then
2226-
DelphiObject := TBufferedFileStreamClass(DelphiObjectClass).Create(String(LFileName), LMode, LRights, LBufferSize);
2228+
{$IFDEF FPC}
2229+
DelphiObject := TBufferedFileStreamClass(DelphiObjectClass).Create(String(LFileName), LMode, LRights);
2230+
DelphiObject.Size:= LBufferSize;
2231+
{$ELSE}
2232+
DelphiObject := TBufferedFileStreamClass(DelphiObjectClass).Create(String(LFileName), LMode, LRights, LBufferSize);
2233+
{$ENDIF}
22272234
end;
22282235

22292236
//Maybe it was created on the next attempt...
@@ -2385,14 +2392,14 @@ TResourceStreamClass = class of TResourceStream;
23852392
{$ELSE}
23862393
if APythonType.Engine.PyArg_ParseTuple(args, 'Iss:Create', @LHandle, @LResName, @LResType) <> 0 then
23872394
{$ENDIF}
2388-
DelphiObject := TResourceStreamClass(DelphiObjectClass).Create(LHandle, String(LResName), PWideChar(String(LResType)))
2395+
DelphiObject := TResourceStreamClass(DelphiObjectClass).Create(LHandle, String(LResName), PChar(String(LResType)))
23892396
else
23902397
{$IFDEF CPUX64}
23912398
if APythonType.Engine.PyArg_ParseTuple(args, 'Kis:Create', @LHandle, @LResId, @LResType) <> 0 then
23922399
{$ELSE}
23932400
if APythonType.Engine.PyArg_ParseTuple(args, 'Iis:Create', @LHandle, @LResId, @LResType) <> 0 then
23942401
{$ENDIF}
2395-
DelphiObject := TResourceStreamClass(DelphiObjectClass).CreateFromID(LHandle, LResId, PWideChar(String(LResType)));
2402+
DelphiObject := TResourceStreamClass(DelphiObjectClass).CreateFromID(LHandle, LResId, PChar(String(LResType)));
23962403
except
23972404
on E: Exception do
23982405
with GetPythonEngine do

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /