From b75c969e666b9f262a05e0d1e54d56f7d3e45441 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 10 May 2005 22:56:25 +0000 Subject: Moved class File and the MD5 stuff to namespace Common svn-id: r18037 --- common/file.cpp | 9 ++++++--- common/file.h | 12 ++++++++---- common/md5.cpp | 4 ++++ common/md5.h | 4 ++++ 4 files changed, 22 insertions(+), 7 deletions(-) (limited to 'common') diff --git a/common/file.cpp b/common/file.cpp index 7f948f7bc7..7128796623 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -22,8 +22,9 @@ #include "common/file.h" #include "common/util.h" +namespace Common { -Common::StringList File::_defaultDirectories; +StringList File::_defaultDirectories; static FILE *fopenNoCase(const char *filename, const char *directory, const char *mode) { @@ -99,7 +100,7 @@ static FILE *fopenNoCase(const char *filename, const char *directory, const char return file; } -void File::addDefaultDirectory(const Common::String &directory) { +void File::addDefaultDirectory(const String &directory) { _defaultDirectories.push_back(directory); } @@ -153,7 +154,7 @@ bool File::open(const char *filename, AccessMode mode, const char *directory) { if (mode == kFileWriteMode || directory) { _handle = fopenNoCase(filename, directory ? directory : "", modeStr); } else { - Common::StringList::const_iterator x; + StringList::const_iterator x; // Try all default directories for (x = _defaultDirectories.begin(); _handle == NULL && x != _defaultDirectories.end(); ++x) { _handle = fopenNoCase(filename, x->c_str(), modeStr); @@ -282,3 +283,5 @@ uint32 File::write(const void *ptr, uint32 len) { return len; } + +} // End of namespace Common diff --git a/common/file.h b/common/file.h index ead42c0788..9669158503 100644 --- a/common/file.h +++ b/common/file.h @@ -27,7 +27,9 @@ #include "common/str.h" #include "common/stream.h" -class File : public Common::SeekableReadStream, public Common::WriteStream { +namespace Common { + +class File : public SeekableReadStream, public WriteStream { protected: /** POSIX file handle to the actual file; 0 if no file is open. */ FILE *_handle; @@ -39,10 +41,10 @@ protected: int32 _refcount; /** The name of this file, for debugging. */ - Common::String _name; + String _name; - static Common::StringList _defaultDirectories; + static StringList _defaultDirectories; public: enum AccessMode { @@ -50,7 +52,7 @@ public: kFileWriteMode = 2 }; - static void addDefaultDirectory(const Common::String &directory); + static void addDefaultDirectory(const String &directory); static void resetDefaultDirectories(); File(); @@ -76,4 +78,6 @@ public: uint32 write(const void *dataPtr, uint32 dataSize); }; +} // End of namespace Common + #endif diff --git a/common/md5.cpp b/common/md5.cpp index f0e277172c..65a26a6026 100644 --- a/common/md5.cpp +++ b/common/md5.cpp @@ -30,6 +30,8 @@ #include "common/md5.h" #include "common/util.h" +namespace Common { + #define GET_UINT32(n,b,i) (n) = READ_LE_UINT32(b + i) #define PUT_UINT32(n,b,i) WRITE_LE_UINT32(b + i, n) @@ -278,6 +280,8 @@ bool md5_file( const char *name, uint8 digest[16], const char *directory, uint32 return true; } +} // End of namespace Common + #ifdef TEST #include diff --git a/common/md5.h b/common/md5.h index a6f329a811..b795bfa963 100644 --- a/common/md5.h +++ b/common/md5.h @@ -23,6 +23,8 @@ #include "common/scummsys.h" +namespace Common { + typedef struct { uint32 total[2]; @@ -37,4 +39,6 @@ void md5_finish( md5_context *ctx, uint8 digest[16] ); bool md5_file( const char *name, uint8 digest[16], const char *directory = NULL, uint32 length = 0 ); +} // End of namespace Common + #endif -- cgit v1.2.3