DEADSOFTWARE

changed license to GPLv3 only; sorry, no trust to FSF anymore
[d2df-sdl.git] / src / sfs / sfsPlainFS.pas
index e0b2bd0be6648e5be102ac7820920ca6b33938df..51b0c0ddfb29f43ecea2558c9f2b2895bb7b6feb 100644 (file)
@@ -1,13 +1,24 @@
-// Streaming R/O Virtual File System v0.2.0
-// Copyright (C) XL A.S. Ketmar.  All rights reserved
-// See the file aplicense.txt for conditions of use.
-//
+(* 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/>.
+ *)
 // simple grouping files w/o packing:
 //   Quake I/II .PAK (PACK)
 //   SiN .SIN (SPAK)
 //
-{$MODE OBJFPC}
-{$R+}
+{$INCLUDE ../shared/a_modes.inc}
+{$SCOPEDENUMS OFF}
+{.$R+}
 unit sfsPlainFS;
 
 interface
@@ -52,8 +63,8 @@ var
 begin
   if (fType <> sfspvPAK) and (fType <> sfspvSIN) then raise ESFSError.Create('invalid archive');
   fFileStream.Seek(4, soCurrent); // skip signature
-  fFileStream.ReadBuffer(dofs, 4);
-  fFileStream.ReadBuffer(dsize, 4);
+  dofs := readLongWord(fFileStream);
+  dsize := readLongWord(fFileStream);
   fFileStream.Position := dofs;
   if fType = sfspvPAK then esz := 64 else esz := 128;
   while dsize >= esz do
@@ -62,8 +73,8 @@ begin
     FillChar(name[0], length(name), 0);
     fFileStream.ReadBuffer(name[0], esz-8);
     fi.fName := PChar(@name[0]);
-    fFileStream.ReadBuffer(fi.fOfs, 4);
-    fFileStream.ReadBuffer(fi.fSize, 4);
+    fi.fOfs := readLongWord(fFileStream);
+    fi.fSize := readLongWord(fFileStream);
     Dec(dsize, esz);
   end;
 end;
@@ -100,8 +111,8 @@ begin
   vt := sfspvNone;
 
   st.ReadBuffer(sign[0], 4);
-  st.ReadBuffer(dofs, 4);
-  st.ReadBuffer(dsize, 4);
+  dofs := readLongWord(st);
+  dsize := readLongWord(st);
   st.Seek(-12, soCurrent);
   if sign = 'PACK' then
   begin