Explorar o código

Fix previous: though SeparateDirective always returned trimmed values but it doesnt.

Martijn Laan hai 1 ano
pai
achega
5b6e82a44c
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      Projects/Src/Compile.pas

+ 4 - 2
Projects/Src/Compile.pas

@@ -3224,6 +3224,7 @@ begin
   end;
   end;
 end;
 end;
 
 
+{ Note: result Value may include leading/trailing whitespaces if it was quoted! }
 procedure TSetupCompiler.SeparateDirective(const Line: PChar;
 procedure TSetupCompiler.SeparateDirective(const Line: PChar;
   var Key, Value: String);
   var Key, Value: String);
 var
 var
@@ -3245,7 +3246,7 @@ begin
     { If Value is surrounded in quotes, remove them. Note that unlike parameter
     { If Value is surrounded in quotes, remove them. Note that unlike parameter
       values, for backward compatibility we don't require embedded quotes to be
       values, for backward compatibility we don't require embedded quotes to be
       doubled, nor do we require surrounding quotes when there's a quote in
       doubled, nor do we require surrounding quotes when there's a quote in
-      the middle of the value. }
+      the middle of the value. Does *not* remove whitespace after removing quotes! }
     if (Length(Value) >= 2) and
     if (Length(Value) >= 2) and
        (Value[1] = '"') and (Value[Length(Value)] = '"') then
        (Value[1] = '"') and (Value[Length(Value)] = '"') then
       Value := Copy(Value, 2, Length(Value)-2);
       Value := Copy(Value, 2, Length(Value)-2);
@@ -3620,7 +3621,7 @@ begin
         end;
         end;
       end;
       end;
     ssCompression: begin
     ssCompression: begin
-        Value := LowerCase(Value);
+        Value := LowerCase(Trim(Value));
         if Value = 'none' then begin
         if Value = 'none' then begin
           CompressMethod := cmStored;
           CompressMethod := cmStored;
           CompressLevel := 0;
           CompressLevel := 0;
@@ -3797,6 +3798,7 @@ begin
         InfoAfterFile := Value;
         InfoAfterFile := Value;
       end;
       end;
     ssInternalCompressLevel: begin
     ssInternalCompressLevel: begin
+        Value := Trim(Value);
         if (Value = '0') or (CompareText(Value, 'none') = 0) then
         if (Value = '0') or (CompareText(Value, 'none') = 0) then
           InternalCompressLevel := 0
           InternalCompressLevel := 0
         else if not LZMAGetLevel(Value, InternalCompressLevel) then
         else if not LZMAGetLevel(Value, InternalCompressLevel) then