Browse Source

Redo "Improve sign flags handling for merged entries."

This reverts commit ed1f132e8c69d5dc9511c7be817948f00648f53d.
Martijn Laan 1 year ago
parent
commit
e1e7b59b65

+ 1 - 0
Projects/Src/Compiler.Messages.pas

@@ -208,6 +208,7 @@ const
   { Flags }
   SCompilerParamUnknownFlag2 = 'Parameter "%s" includes an unknown flag';
   SCompilerParamErrorBadCombo2 = 'Parameter "%s" cannot have both the "%s" and "%s" flags';
+  SCompilerParamErrorBadCombo3 = 'Parameter "%s" cannot have both the "%s" and "%s" flags on the same source file';
   SCompilerParamUnsupportedFlag = 'Parameter "%s" includes a flag that is not supported in this section';
   SCompilerParamFlagMissing = 'Flag "%s" must be used if flag "%s" is used';
   SCompilerParamFlagMissing2 = 'Flag "%s" must be used if parameter "%s" is used';

+ 16 - 16
Projects/Src/Compiler.SetupCompiler.pas

@@ -4584,7 +4584,7 @@ const
     'noencryption', 'nocompression', 'dontverifychecksum',
     'uninsnosharedfileprompt', 'createallsubdirs', '32bit', '64bit',
     'solidbreak', 'setntfscompression', 'unsetntfscompression',
-    'sortfilesbyname', 'gacinstall', 'signcheck', 'signonce', 'sign');
+    'sortfilesbyname', 'gacinstall', 'sign', 'signonce', 'signcheck');
   SignFlags: array[TSetupFileLocationSign] of String = (
     '', 'sign', 'signonce', 'signcheck');
   AttribsFlags: array[0..3] of PChar = (
@@ -4831,6 +4831,16 @@ type
     end;
   end;
 
+  procedure ApplyNewSign(var Sign: TSetupFileLocationSign;
+    const NewSign: TSetupFileLocationSign; const ErrorMessage: String);
+  begin
+    if not (Sign in [fsNoSetting, NewSign]) then
+      AbortCompileOnLineFmt(ErrorMessage,
+        [ParamCommonFlags, SignFlags[Sign], SignFlags[NewSign]])
+    else
+      Sign := NewSign;
+  end;
+
   procedure ProcessFileList(const FileListBaseDir: String; FileList: TList);
   var
     FileListRec: PFileListRec;
@@ -4911,8 +4921,8 @@ type
           Exclude(NewFileLocationEntry^.Flags, foChunkCompressed);
         if NoEncryption then
           Exclude(NewFileLocationEntry^.Flags, foChunkEncrypted);
-        if Sign > NewFileLocationEntry.Sign then
-          NewFileLocationEntry.Sign := Sign;
+        if Sign <> fsNoSetting then
+          ApplyNewSign(NewFileLocationEntry.Sign, Sign, SCompilerParamErrorBadCombo3);
       end
       else begin
         NewFileEntry^.SourceFilename := SourceFile;
@@ -5092,16 +5102,6 @@ type
     end;
   end;
 
-  procedure ApplyNewSign(const NewSign: TSetupFileLocationSign);
-  begin
-    { Error if there's multiple and different sign flags on the same entry }
-    if not (Sign in [fsNoSetting, NewSign]) then
-      AbortCompileOnLineFmt(SCompilerParamErrorBadCombo2,
-        [ParamCommonFlags, SignFlags[Sign], SignFlags[NewSign]])
-    else
-      Sign := NewSign;
-  end;
-
 var
   FileList, DirList: TList;
   SortFilesByExtension, SortFilesByName: Boolean;
@@ -5184,9 +5184,9 @@ begin
                    35: Include(Options, foUnsetNTFSCompression);
                    36: SortFilesByName := True;
                    37: Include(Options, foGacInstall);
-                   38: ApplyNewSign(fsCheck);
-                   39: ApplyNewSign(fsOnce);
-                   40: ApplyNewSign(fsYes);
+                   38: ApplyNewSign(Sign, fsYes, SCompilerParamErrorBadCombo2);
+                   39: ApplyNewSign(Sign, fsOnce, SCompilerParamErrorBadCombo2);
+                   40: ApplyNewSign(Sign, fsCheck, SCompilerParamErrorBadCombo2);
                  end;
 
                { Source }

+ 2 - 2
Projects/Src/Shared.Struct.pas

@@ -33,7 +33,7 @@ const
     this file it's recommended you change SetupID. Any change will do (like
     changing the letters or numbers), as long as your format is
     unrecognizable by the standard Inno Setup. }
-  SetupID: TSetupID = 'Inno Setup Setup Data (6.4.0)';
+  SetupID: TSetupID = 'Inno Setup Setup Data (6.3.0)';
   UninstallLogID: array[Boolean] of TUninstallLogID =
     ('Inno Setup Uninstall Log (b)', 'Inno Setup Uninstall Log (b) 64-bit');
   MessagesHdrID: TMessagesHdrID = 'Inno Setup Messages (6.0.0) (u)';
@@ -241,7 +241,7 @@ const
   SetupFileLocationEntryStrings = 0;
   SetupFileLocationEntryAnsiStrings = 0;
 type
-  TSetupFileLocationSign = (fsNoSetting, fsCheck, fsOnce, fsYes); { Must be ordered }
+  TSetupFileLocationSign = (fsNoSetting, fsYes, fsOnce, fsCheck);
   PSetupFileLocationEntry = ^TSetupFileLocationEntry;
   TSetupFileLocationEntry = packed record
     FirstSlice, LastSlice: Integer;