DEADSOFTWARE

sfs: fix garbage collector
[d2df-sdl.git] / src / sfs / sfs.pas
index 49f8f7603f24aa3127894783fe01b33a2e3b3073..11e1045459cc1e894c28a9f35aa20f0e4bf6aafc 100644 (file)
@@ -1,6 +1,21 @@
+(* Copyright (C)  Doom 2D: Forever Developers
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3 of the License ONLY.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *)
 // streaming file system (virtual)
-{$MODE OBJFPC}
-{$R+}
+{$INCLUDE ../shared/a_modes.inc}
+{$SCOPEDENUMS OFF}
+{.$R+}
 {.$DEFINE SFS_VOLDEBUG}
 unit sfs;
 
@@ -70,8 +85,6 @@ type
     // íèêàêèõ ïàäåíèé íà íåïðàâèëüíûå èíäåêñû!
     function GetFiles (index: Integer): TSFSFileInfo; virtual;
 
-    procedure removeCommonPath (); virtual;
-
   public
     // pSt íå îáÿçàòåëüíî çàïîìèíàòü, åñëè îí íå íóæåí.
     constructor Create (const pFileName: AnsiString; pSt: TStream); virtual;
@@ -402,6 +415,7 @@ end;
 
 type
   TVolumeInfo = class
+  public
     fFactory: TSFSVolumeFactory;
     fVolume: TSFSVolume;
     fPackName: AnsiString; // äëÿ îäíîãî è òîãî æå ôàéëà áóäåò òîëüêî îäèí òîì!
@@ -441,8 +455,7 @@ begin
   while f < volumes.Count do
   begin
     vi := TVolumeInfo(volumes[f]);
-    if vi = nil then continue;
-    if (not vi.fPermanent) and (vi.fOpenedFilesCount = 0) then
+    if (vi <> nil) and (not vi.fPermanent) and (vi.fOpenedFilesCount = 0) then
     begin
       // this volume probably can be removed
       used := false;
@@ -744,10 +757,6 @@ begin
   fFiles := TObjectList.Create(true);
 end;
 
-procedure TSFSVolume.removeCommonPath ();
-begin
-end;
-
 procedure TSFSVolume.DoDirectoryRead ();
 var
   f, c: Integer;
@@ -779,7 +788,6 @@ begin
     sfi.fPath := normalizePath(sfi.fPath);
     if (length(sfi.fPath) = 0) and (length(sfi.fName) = 0) then sfi.Free else Inc(f);
   end;
-  removeCommonPath();
 end;
 
 destructor TSFSVolume.Destroy ();