[Scummvm-cvs-logs] SF.net SVN: scummvm:[54122] scummvm/trunk/common

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Nov 7 18:17:21 CET 2010


Revision: 54122
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54122&view=rev
Author:   fingolfin
Date:     2010-11-07 17:17:21 +0000 (Sun, 07 Nov 2010)

Log Message:
-----------
COMMON: Add const qualifiers and remove Common:: prefix in MacResManager code

Modified Paths:
--------------
    scummvm/trunk/common/macresman.cpp
    scummvm/trunk/common/macresman.h

Modified: scummvm/trunk/common/macresman.cpp
===================================================================
--- scummvm/trunk/common/macresman.cpp	2010-11-07 17:16:59 UTC (rev 54121)
+++ scummvm/trunk/common/macresman.cpp	2010-11-07 17:17:21 UTC (rev 54122)
@@ -73,36 +73,36 @@
 	delete _stream; _stream = 0;
 }
 
-bool MacResManager::hasDataFork() {
+bool MacResManager::hasDataFork() const {
 	return !_baseFileName.empty();
 }
 
-bool MacResManager::hasResFork() {
+bool MacResManager::hasResFork() const {
 	return !_baseFileName.empty() && _mode != kResForkNone;
 }
 
-uint32 MacResManager::getResForkSize() {
+uint32 MacResManager::getResForkSize() const {
 	if (!hasResFork())
 		return 0;
 
 	return _resForkSize;
 }
 
-Common::String MacResManager::computeResForkMD5AsString(uint32 length) {
+String MacResManager::computeResForkMD5AsString(uint32 length) const {
 	if (!hasResFork())
-		return Common::String();
+		return String();
 
 	SeekableSubReadStream resForkStream(_stream, _resForkOffset, _resForkOffset + _resForkSize);
 	return computeStreamMD5AsString(resForkStream, MIN<uint32>(length, _resForkSize));
 }
 
-bool MacResManager::open(Common::String filename) {
+bool MacResManager::open(String filename) {
 	close();
 
 #ifdef MACOSX
 	// Check the actual fork on a Mac computer
-	Common::String fullPath = ConfMan.get("path") + "/" + filename + "/..namedfork/rsrc";
-	Common::SeekableReadStream *macResForkRawStream = StdioStream::makeFromPath(fullPath, false);
+	String fullPath = ConfMan.get("path") + "/" + filename + "/..namedfork/rsrc";
+	SeekableReadStream *macResForkRawStream = StdioStream::makeFromPath(fullPath, false);
 
 	if (macResForkRawStream && loadFromRawFork(*macResForkRawStream)) {
 		_baseFileName = filename;
@@ -112,7 +112,7 @@
 	delete macResForkRawStream;
 #endif
 
-	Common::File *file = new Common::File();
+	File *file = new File();
 
 	// First, let's try to see if the Mac converted name exists
 	if (file->open("._" + filename) && loadFromAppleDouble(*file)) {
@@ -156,13 +156,13 @@
 	return false;
 }
 
-bool MacResManager::open(Common::FSNode path, Common::String filename) {
+bool MacResManager::open(FSNode path, String filename) {
 	close();
 
 #ifdef MACOSX
 	// Check the actual fork on a Mac computer
-	Common::String fullPath = path.getPath() + "/" + filename + "/..namedfork/rsrc";
-	Common::SeekableReadStream *macResForkRawStream = StdioStream::makeFromPath(fullPath, false);
+	String fullPath = path.getPath() + "/" + filename + "/..namedfork/rsrc";
+	SeekableReadStream *macResForkRawStream = StdioStream::makeFromPath(fullPath, false);
 
 	if (macResForkRawStream && loadFromRawFork(*macResForkRawStream)) {
 		_baseFileName = filename;
@@ -173,7 +173,7 @@
 #endif
 
 	// First, let's try to see if the Mac converted name exists
-	Common::FSNode fsNode = path.getChild("._" + filename);
+	FSNode fsNode = path.getChild("._" + filename);
 	if (fsNode.exists() && !fsNode.isDirectory()) {
 		SeekableReadStream *stream = fsNode.createReadStream();
 		if (loadFromAppleDouble(*stream)) {
@@ -226,7 +226,7 @@
 	return false;
 }
 
-bool MacResManager::loadFromAppleDouble(Common::SeekableReadStream &stream) {
+bool MacResManager::loadFromAppleDouble(SeekableReadStream &stream) {
 	if (stream.readUint32BE() != 0x00051607) // tag
 		return false;
 
@@ -251,7 +251,7 @@
 	return false;
 }
 
-bool MacResManager::isMacBinary(Common::SeekableReadStream &stream) {
+bool MacResManager::isMacBinary(SeekableReadStream &stream) {
 	byte infoHeader[MBI_INFOHDR];
 	int resForkOffset = -1;
 
@@ -279,7 +279,7 @@
 	return true;
 }
 
-bool MacResManager::loadFromMacBinary(Common::SeekableReadStream &stream) {
+bool MacResManager::loadFromMacBinary(SeekableReadStream &stream) {
 	byte infoHeader[MBI_INFOHDR];
 	stream.read(infoHeader, MBI_INFOHDR);
 
@@ -308,14 +308,14 @@
 	return load(stream);
 }
 
-bool MacResManager::loadFromRawFork(Common::SeekableReadStream &stream) {
+bool MacResManager::loadFromRawFork(SeekableReadStream &stream) {
 	_mode = kResForkRaw;
 	_resForkOffset = 0;
 	_resForkSize = stream.size();
 	return load(stream);
 }
 
-bool MacResManager::load(Common::SeekableReadStream &stream) {
+bool MacResManager::load(SeekableReadStream &stream) {
 	if (_mode == kResForkNone)
 		return false;
 
@@ -343,7 +343,7 @@
 	return true;
 }
 
-Common::SeekableReadStream *MacResManager::getDataFork() {
+SeekableReadStream *MacResManager::getDataFork() {
 	if (!_stream)
 		return NULL;
 
@@ -353,7 +353,7 @@
 		return new SeekableSubReadStream(_stream, MBI_INFOHDR, MBI_INFOHDR + dataSize);
 	}
 
-	Common::File *file = new Common::File();
+	File *file = new File();
 	if (file->open(_baseFileName))
 		return file;
 	delete file;
@@ -396,7 +396,7 @@
 	return tagArray;
 }
 
-Common::String MacResManager::getResName(uint32 typeID, uint16 resID) {
+String MacResManager::getResName(uint32 typeID, uint16 resID) const {
 	int typeNum = -1;
 
 	for (int i = 0; i < _resMap.numTypes; i++)
@@ -415,7 +415,7 @@
 	return "";
 }
 
-Common::SeekableReadStream *MacResManager::getResource(uint32 typeID, uint16 resID) {
+SeekableReadStream *MacResManager::getResource(uint32 typeID, uint16 resID) {
 	int typeNum = -1;
 	int resNum = -1;
 
@@ -447,7 +447,7 @@
 	return _stream->readStream(len);
 }
 
-Common::SeekableReadStream *MacResManager::getResource(const Common::String &filename) {
+SeekableReadStream *MacResManager::getResource(const String &filename) {
 	for (uint32 i = 0; i < _resMap.numTypes; i++) {
 		for (uint32 j = 0; j < _resTypes[i].items; j++) {
 			if (_resLists[i][j].nameOffset != -1 && filename.equalsIgnoreCase(_resLists[i][j].name)) {
@@ -466,7 +466,7 @@
 	return 0;
 }
 
-Common::SeekableReadStream *MacResManager::getResource(uint32 typeID, const Common::String &filename) {
+SeekableReadStream *MacResManager::getResource(uint32 typeID, const String &filename) {
 	for (uint32 i = 0; i < _resMap.numTypes; i++) {
 		if (_resTypes[i].id != typeID)
 			continue;
@@ -543,7 +543,7 @@
 
 void MacResManager::convertCrsrCursor(byte *data, int datasize, byte **cursor, int *w, int *h,
 				int *hotspot_x, int *hotspot_y, int *keycolor, bool colored, byte **palette, int *palSize) {
-	Common::MemoryReadStream dis(data, datasize);
+	MemoryReadStream dis(data, datasize);
 	int i, b;
 	byte imageByte;
 	byte *iconData;

Modified: scummvm/trunk/common/macresman.h
===================================================================
--- scummvm/trunk/common/macresman.h	2010-11-07 17:16:59 UTC (rev 54121)
+++ scummvm/trunk/common/macresman.h	2010-11-07 17:17:21 UTC (rev 54122)
@@ -33,8 +33,8 @@
 
 class FSNode;
 
-typedef Common::Array<uint16> MacResIDArray;
-typedef Common::Array<uint32> MacResTagArray;
+typedef Array<uint16> MacResIDArray;
+typedef Array<uint32> MacResTagArray;
 
 /**
  * Class for reading Mac Binary files.
@@ -46,14 +46,14 @@
 	MacResManager();
 	~MacResManager();
 
-	bool open(Common::String filename);
-	bool open(Common::FSNode path, Common::String filename);
+	bool open(String filename);
+	bool open(FSNode path, String filename);
 	void close();
 
-	bool hasDataFork();
-	bool hasResFork();
+	bool hasDataFork() const;
+	bool hasResFork() const;
 
-	static bool isMacBinary(Common::SeekableReadStream &stream);
+	static bool isMacBinary(SeekableReadStream &stream);
 
 	/**
 	 * Read resource from the Mac Binary file
@@ -61,7 +61,7 @@
 	 * @param resID Resource ID to fetch
 	 * @return Pointer to a SeekableReadStream with loaded resource
 	 */
-	Common::SeekableReadStream *getResource(uint32 typeID, uint16 resID);
+	SeekableReadStream *getResource(uint32 typeID, uint16 resID);
 
 	/**
 	 * Read resource from the Mac Binary file
@@ -69,7 +69,7 @@
 	 * @param filename filename of the resource
 	 * @return Pointer to a SeekableReadStream with loaded resource
 	 */
-	Common::SeekableReadStream *getResource(const Common::String &filename);
+	SeekableReadStream *getResource(const String &filename);
 
 	/**
 	 * Read resource from the Mac Binary file
@@ -77,14 +77,14 @@
 	 * @param filename filename of the resource
 	 * @return Pointer to a SeekableReadStream with loaded resource
 	 */
-	Common::SeekableReadStream *getResource(uint32 typeID, const Common::String &filename);
+	SeekableReadStream *getResource(uint32 typeID, const String &filename);
 
-	Common::SeekableReadStream *getDataFork();
-	Common::String getResName(uint32 typeID, uint16 resID);
-	uint32 getResForkSize();
-	Common::String computeResForkMD5AsString(uint32 length = 0);
+	SeekableReadStream *getDataFork();
+	String getResName(uint32 typeID, uint16 resID) const;
+	uint32 getResForkSize() const;
+	String computeResForkMD5AsString(uint32 length = 0) const;
 
-	Common::String getBaseFileName() { return _baseFileName; }
+	String getBaseFileName() const { return _baseFileName; }
 
 	/**
 	 * Convert cursor from crsr format to format suitable for feeding to CursorMan
@@ -117,14 +117,14 @@
 	MacResTagArray getResTagArray();
 
 private:
-	Common::SeekableReadStream *_stream;
-	Common::String _baseFileName;
+	SeekableReadStream *_stream;
+	String _baseFileName;
 
-	bool load(Common::SeekableReadStream &stream);
+	bool load(SeekableReadStream &stream);
 
-	bool loadFromRawFork(Common::SeekableReadStream &stream);
-	bool loadFromMacBinary(Common::SeekableReadStream &stream);
-	bool loadFromAppleDouble(Common::SeekableReadStream &stream);
+	bool loadFromRawFork(SeekableReadStream &stream);
+	bool loadFromMacBinary(SeekableReadStream &stream);
+	bool loadFromAppleDouble(SeekableReadStream &stream);
 
 	enum {
 		kResForkNone = 0,


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list