Ver código fonte

* Replaced local writable typed constant with variable. Makes function thread-safe (local typed constants are still allocated globally, writable ones ruin thread-safety) and able to compile in {$J-} state.

git-svn-id: trunk@23354 -
sergei 12 anos atrás
pai
commit
3175f49e4f
1 arquivos alterados com 4 adições e 2 exclusões
  1. 4 2
      rtl/win/sysdir.inc

+ 4 - 2
rtl/win/sysdir.inc

@@ -76,9 +76,8 @@ end;
 
 procedure GetDir (DriveNr: byte; var Dir: ShortString);
 {$ifndef WINCE}
-const
-  Drive:array[0..3]of char=(#0,':',#0,#0);
 var
+  Drive:array[0..3]of char;
   defaultdrive:boolean;
   DirBuf,SaveBuf:array[0..259] of Char;
 {$endif WINCE}
@@ -88,6 +87,9 @@ begin
   if not defaultdrive then
    begin
     byte(Drive[0]):=Drivenr+64;
+    Drive[1]:=':';
+    Drive[2]:=#0;
+    Drive[3]:=#0;
     GetCurrentDirectory(SizeOf(SaveBuf),SaveBuf);
     if not SetCurrentDirectory(@Drive) then
      begin