Skip to content

Commit

Permalink
Fix compiler warning: "For loop control variable must be simple local…
Browse files Browse the repository at this point in the history
… variable"
  • Loading branch information
ansgarbecker committed Jun 3, 2019
1 parent 0500f12 commit 6e2bca2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions source/dbconnection.pas
Expand Up @@ -2255,7 +2255,8 @@ procedure TDBConnection.DoBeforeConnect;


procedure TMySQLConnection.DoBeforeConnect; procedure TMySQLConnection.DoBeforeConnect;
var var
msg: String; msg,
TryLibraryPath: String;
OldErrorMode: Cardinal; OldErrorMode: Cardinal;
TryLibraryPaths: TStringList; TryLibraryPaths: TStringList;
begin begin
Expand All @@ -2270,17 +2271,18 @@ procedure TMySQLConnection.DoBeforeConnect;
TryLibraryPaths.Add('libmariadb.dll'); TryLibraryPaths.Add('libmariadb.dll');
TryLibraryPaths.Add('libmysql.dll'); TryLibraryPaths.Add('libmysql.dll');


for LibMysqlPath in TryLibraryPaths do begin for TryLibraryPath in TryLibraryPaths do begin
Log(lcDebug, f_('Loading library file %s ...', [LibMysqlPath])); Log(lcDebug, f_('Loading library file %s ...', [TryLibraryPath]));
// Temporarily suppress error popups while loading new library on Windows XP, see #79 // Temporarily suppress error popups while loading new library on Windows XP, see #79
OldErrorMode := SetErrorMode(SEM_FAILCRITICALERRORS); OldErrorMode := SetErrorMode(SEM_FAILCRITICALERRORS);
SetErrorMode(OldErrorMode or SEM_FAILCRITICALERRORS); SetErrorMode(OldErrorMode or SEM_FAILCRITICALERRORS);
LibMysqlHandle := LoadLibrary(PWideChar(LibMysqlPath)); LibMysqlHandle := LoadLibrary(PWideChar(TryLibraryPath));
SetErrorMode(OldErrorMode); SetErrorMode(OldErrorMode);
if LibMysqlHandle = 0 then begin if LibMysqlHandle = 0 then begin
// Win XP needs libmysql.dll // Win XP needs libmysql.dll
Log(lcDebug, f_('Could not load %s', [LibMysqlPath])); Log(lcDebug, f_('Could not load %s', [TryLibraryPath]));
end else begin end else begin
LibMysqlPath := TryLibraryPath;
Break; Break;
end; end;
end; end;
Expand Down

0 comments on commit 6e2bca2

Please sign in to comment.