Refactoring!

This commit is contained in:
Ianos Gnatiuc
2006-05-06 09:13:21 +00:00
parent 7a646ca788
commit 1cb9ab528b
9 changed files with 171 additions and 288 deletions

View File

@@ -37,10 +37,8 @@
// ------------------------------------------------------------------
// Declare the CRC tables
extern "C" {
extern word __crc16_table[];
extern dword __crc32_table[];
}
// ------------------------------------------------------------------
// Generate/update a CRC-16 or CRC-32 value
@@ -76,6 +74,10 @@ dword strHash32(const char* s, bool nocase=true);
word memCrc16(const void* m, long l, bool nocase=true, word mask=CRC16_MASK_NORMAL);
dword memCrc32(const void* m, long l, bool nocase=true, dword mask=CRC32_MASK_NORMAL);
inline dword memCrc32(dword crc, const void* m, long l, bool nocase=true, dword mask=CRC32_MASK_NORMAL)
{
return memCrc32(m, l, nocase, crc ^ mask) ^ mask;
}
// ------------------------------------------------------------------
// Get keyword/value pairs and crc
@@ -90,4 +92,3 @@ word getkeyvalcrc(char** key, char** val);
#endif
// ------------------------------------------------------------------

View File

@@ -74,7 +74,7 @@ public:
gfile(); // Bare constructor
// gfile(int __fh); // Construct from Unix file handle
// gfile(FILE* __fp); // Construct from ANSI stream pointer
gfile(const char* __path, int __access, int __shflag=SH_DENYNO, int __mode=S_IREAD|S_IWRITE);
gfile(const char* __path, int __access, int __shflag=SH_DENYNO, int __mode=S_STDRW);
gfile(const char* __path, const char* __mode, int __shflag=SH_DENYNO);
~gfile(); // Destructor (closes file)
@@ -90,8 +90,8 @@ public:
// --------------------------------------------------------------
// UNIX-style raw I/O
int Open (const char* __path, int __access, int __shflag=SH_DENYNO, int __mode=S_IREAD|S_IWRITE);
int Open (const char* __path, int __access, const char* __fmode, int __shflag=SH_DENYNO, int __mode=S_IREAD|S_IWRITE);
int Open (const char* __path, int __access, int __shflag=SH_DENYNO, int __mode=S_STDRW);
int Open (const char* __path, int __access, const char* __fmode, int __shflag=SH_DENYNO, int __mode=S_STDRW);
int Close ();
int Read (void* __ptr, size_t __len);