* avoid partial matches on extensions in TFPCustomImage.FindHandlerFromExtension

Patch by Ondrej

git-svn-id: trunk@39172 -
This commit is contained in:
marco 2018-06-04 14:33:03 +00:00
parent e6a8c058e0
commit c3ac166614

View File

@ -264,22 +264,25 @@ begin
result := FExtra.count; result := FExtra.count;
end; end;
const dumchar = ';';
class function TFPCustomImage.FindHandlerFromExtension(extension: String class function TFPCustomImage.FindHandlerFromExtension(extension: String
): TIHData; ): TIHData;
var s : string; var s : string;
r : integer; r : integer;
begin begin
if extension='' then
Exit(nil);
extension := lowercase (extension); extension := lowercase (extension);
if (extension <> '') and (extension[1] = '.') then if (extension <> '') and (extension[1] = '.') then
delete (extension,1,1); delete (extension,1,1);
with ImageHandlers do with ImageHandlers do
begin begin
r := count-1; r := count-1;
s := extension + ';'; s := dumchar + extension + dumchar;
while (r >= 0) do while (r >= 0) do
begin begin
Result := GetData(r); Result := GetData(r);
if (pos(s,Result.Fextension+';') <> 0) then if (pos(s, dumchar+Result.Fextension+dumchar) <> 0) then
Exit; Exit;
dec (r); dec (r);
end; end;