2017-01-14 16:54 GMT+01:00 Andreas Tille <[email protected]>:
> Hi Adrian,
>
> On Fri, Jan 13, 2017 at 05:29:01PM +0200, Adrian Bunk wrote:
>> I saw you were just working on the MRIcron package.
>>
>> Can you take a look at the patch in
>> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=813718#40
>> ?
>
> Thanks for the ping. I tried to turn the suggested patch into a quilt
> patch which I commited to Git:
>
>
> https://anonscm.debian.org/git/debian-med/mricron.git/tree/debian/patches/stricter_fpc.patch
>
> Unfortunately there is a Build-Problem:
>
> (3104) Compiling /build/mricron-0.20140804.1~dfsg.1/common/dialogsx.pas
> /build/mricron-0.20140804.1~dfsg.1/common/dialogsx.pas(75,42) Error: (5000)
> Identifier not found "Dialogs"
> /build/mricron-0.20140804.1~dfsg.1/common/dialogsx.pas(75,42) Fatal: (2003)
> Syntax error, ";" expected but "." found
> Fatal: (1018) Compilation aborted
> Error: /usr/bin/ppcx64 returned an error exitcode
> Error: (lazarus) Compile Project, Target: dcm2nii: stopped with exit code 256
> ERROR: failed compiling of project
> /build/mricron-0.20140804.1~dfsg.1/dcm2nii/dcm2nii.lpi
> debian/rules:10: recipe for target 'override_dh_auto_build' failed
>
>
> I admit I can not see where a "." mit be but a ";" is expected but
> the patch seems to have some issue.
>
My patch from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=813718#40
assumes that the "Dialogs" unit is in the uses clause. But the
"Dialogs" unit is in the uses clause only when the symbol "GUI" is
defined at compilation. I didn't test the compilation without the GUI
symbol.
I'm attaching a fixed version of the patch:)
Regards,
Michalis
diff -ur mricron-0.20140804.1~dfsg.1/common/dialogsx.pas mricron-0.20140804.1~dfsg.2/common/dialogsx.pas
--- common/dialogsx.pas 2014-01-28 18:06:18.000000000 +0100
+++ common/dialogsx.pas 2017-01-14 22:07:02.839240363 +0100
@@ -68,13 +68,44 @@
function MsgDlg(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint): Word;
{$IFDEF GUI}
+
+ { Convert our TMsgDlgButtons type to Dialogs.TMsgDlgButtons type
+ in a type-safe manner. Do not assume that memory layout matches between
+ - TMsgDlgButtons and Dialogs.TMsgDlgButtons, or
+ - TMsgDlgBtn and Dialogs.TMsgDlgBtn.
+ }
+ function MsgDlgButtonsConvertToStandard(
+ const Buttons: TMsgDlgButtons): Dialogs.TMsgDlgButtons;
+ var
+ B: TMsgDlgBtn;
+ begin
+ Result := [];
+ for B := Low(B) to High(B) do
+ if B in Buttons then
+ { convert our TMsgDlgBtn to Dialogs.TMsgDlgBtn type }
+ case B of
+ mbYes : Include(Result, Dialogs.mbYes );
+ mbNo : Include(Result, Dialogs.mbNo );
+ mbOK : Include(Result, Dialogs.mbOK );
+ mbCancel : Include(Result, Dialogs.mbCancel );
+ mbAbort : Include(Result, Dialogs.mbAbort );
+ mbRetry : Include(Result, Dialogs.mbRetry );
+ mbIgnore : Include(Result, Dialogs.mbIgnore );
+ mbAll : Include(Result, Dialogs.mbAll );
+ mbNoToAll : Include(Result, Dialogs.mbNoToAll );
+ mbYesToAll: Include(Result, Dialogs.mbYesToAll);
+ mbHelp : Include(Result, Dialogs.mbHelp );
+ else raise Exception.Create('Unsupported TMsgDlgBtn value');
+ end;
+ end;
+
var
lDlgType : Dialogs.TMsgDlgType;
lButtons: Dialogs.TMsgDlgButtons;
begin
lDlgType := Dialogs.TMsgDlgType(DlgType);
- lButtons:= Dialogs.TMsgDlgButtons(Buttons);
+ lButtons:= MsgDlgButtonsConvertToStandard(Buttons);
result := MessageDlg(Msg, lDlgType, lButtons,HelpCtx);
{$ELSE}
begin