Commit Graph

37 Commits

Author SHA1 Message Date
Glenn Maynard 752d4ecdb8 simplify: use RageFileObjZipStored to create an abstract "file" within the ZIP, which is them simply passed to RageFileObjZipDeflate if it's compressed. 2004-12-11 04:48:16 +00:00
Glenn Maynard 1552944b98 generalize/cleanup 2004-12-11 04:23:48 +00:00
Glenn Maynard de0eed990d generalize/cleanup 2004-12-11 04:16:49 +00:00
Glenn Maynard a946c220bc whitespace cleanups (prefer tabs over spaces) 2004-12-11 02:30:24 +00:00
Glenn Maynard ae92b86b34 RageFileBasic 2004-12-11 02:25:38 +00:00
Glenn Maynard 7bb2cec302 simplify RageFileObjZipStored 2004-12-11 01:18:27 +00:00
Glenn Maynard 47994102b3 vc fix? 2004-12-10 13:13:14 +00:00
Glenn Maynard 8915e3944a simplify; use RageBasicFile instead of RageFileObj 2004-12-10 10:04:32 +00:00
Glenn Maynard 287a150db7 Move buffering logic from RageFile into RageFileObj.
Common file interface class, RageBasicFile, shared by RageFile
and RageFileObj.  This makes most uses of these objects interchangeable.
RageFile is now just a simple wrapper for RageFileObj, to create
files in FILEMAN's namespace; file objects can also be created
independently.  This means that, for example, IniFile can be used
to write a file to a CString, without having to jump through hoops,
and without having to use a separate file access wrapper; just do
something like:

RageFileObjMem string_file;
ini.WriteFile( string );
const CString &sString = string_file.GetString();
2004-12-10 08:48:18 +00:00
Glenn Maynard a526d09e3a seek fix 2004-12-10 03:25:28 +00:00
Glenn Maynard e2ea72dbac internalize RageFileObj implementation functions 2004-12-10 03:14:01 +00:00
Glenn Maynard ec22ffec62 stop passing ugly back-references to the RageFile to RageFileObj 2004-12-09 11:47:20 +00:00
Glenn Maynard 6761eb7a51 remove Rewind() 2004-12-09 10:44:07 +00:00
Glenn Maynard ea820c77b2 Avoid RageFileObj::Seek; handle rewinds in Seek(). 2004-12-09 10:38:42 +00:00
Glenn Maynard fa2719a2c1 Remove RageFile::SeekCur(). It's just as easy to call Seek(Tell()), and
separating "seek from current position" doesn't do anything useful for
file drivers.
2004-12-09 08:36:08 +00:00
Glenn Maynard 6558f6f7de This comment is incorrect. deflateReset() doesn't leak; it resets the
object to a just-initialized state.  deflateEnd() is correct (no comment
needed for that; it's obvious, I don't know why I used deflateReset to
begin with).

zlib doesn't appear to do anything special with allocations; running
the following:

#include <zlib.h>
main()
{
	z_stream z; z.zalloc = NULL; z.zfree = NULL;
	inflateInit2( &z, -MAX_WBITS ); inflateReset( &z );
}

under Valgrind shows:

==17033== 7080 bytes in 1 blocks are possibly lost in loss record 1 of 1
==17033==    at 0x1B904EDD: malloc (vg_replace_malloc.c:131)
==17033==    by 0x1B91D4B4: zcalloc (in /usr/lib/libz.so.1.2.1.2)
==17033==    by 0x1B91D608: inflateInit2_ (in /usr/lib/libz.so.1.2.1.2)
==17033==    by 0x80485A4: main (in /home/glenn/a.out)
2004-12-09 04:07:14 +00:00
Charles Lohr 9a93860c6a Major memory leak fix regarding packages.
The reason that only some people were experiencing a major memory leak
was that it had to do with packages, a lot of devs don't use packages.

This leak could not be found through conventional methods, as zlib's ram
seems to be allocated from the global ram.
2004-12-09 02:09:32 +00:00
Glenn Maynard 3da657bfc8 simplify 2004-09-05 03:43:05 +00:00
Glenn Maynard cbea6c75bc use GetFilePriv 2004-09-05 03:41:40 +00:00
Glenn Maynard 57b6bd4ceb fix RageFileObjZipStored::Copy 2004-09-05 03:37:34 +00:00
Glenn Maynard db0fa11b51 use NullFilenameDB 2004-09-05 03:35:49 +00:00
Glenn Maynard 463c81d7f1 const 2004-08-30 04:49:57 +00:00
Glenn Maynard 33a04b79de beginning GPL->X11 license transition
The conventions I'm using are to put the entire copyright notice at the bottom
of each file, and to put the summary of the source file's use at the top of the
header.

Putting the license text in each file avoids confusion, and is normal practice
for many projects.  Putting it at the bottom gets it out of the way; it's a
ton of clutter to put at the top.

The description is in the header.  People who don't know what a class is for,
or how to use it, are probably looking at the header to see the interface,
not the implementation, so let's put the description in there.  Keep it brief
(one line); any substantial implementation notes should go in the source file.
2004-05-06 00:42:06 +00:00
Glenn Maynard 485354928f fix error reporting 2004-04-21 04:16:31 +00:00
Steve Checkoway 20a8bab45c Clean up includes. 2004-04-05 05:22:32 +00:00
Steve Checkoway ec6039769c Work around stupid #include bug. 2004-02-17 00:24:56 +00:00
Glenn Maynard a7b2a73889 fix for very small ZIPs 2004-02-11 20:58:02 +00:00
Glenn Maynard 1b69bfdff9 allow VFS drivers to register themselves 2004-02-10 23:39:45 +00:00
Manu Evans ce888de237 fixed some xbox build errors :/ 2004-01-17 05:21:24 +00:00
Glenn Maynard 6c7ac56451 optimize lseek(0,SEEK_END) in ZIPs 2004-01-11 22:01:49 +00:00
Glenn Maynard 20792a51bb Write files in such a way that a program crash, system crash, powerdown,
etc. won't cause data loss if we're running on a journalling filesystem.
2003-12-21 07:23:29 +00:00
Glenn Maynard c34c2c5aec dur 2003-12-10 11:01:44 +00:00
Glenn Maynard aac40fec42 disable RageFileObjZipDeflated::Copy 2003-12-10 10:06:32 +00:00
Glenn Maynard b62824a60c fix warnings, compile 2003-12-10 07:32:40 +00:00
Glenn Maynard 83701f9a9f Rewrite, loosely based on Info-ZIP. 2003-12-10 07:08:22 +00:00
Glenn Maynard 85bee1df5f RageFileDriverZip through RageFile 2003-12-08 03:20:26 +00:00
Glenn Maynard b8ab0fc587 add RageFileDriverZip 2003-12-08 00:08:20 +00:00