[Scummvm-cvs-logs] SF.net SVN: scummvm: [29159] scummvm/trunk/backends/fs

david_corrales at users.sourceforge.net david_corrales at users.sourceforge.net
Sun Oct 7 02:28:39 CEST 2007


Revision: 29159
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29159&view=rev
Author:   david_corrales
Date:     2007-10-06 17:28:38 -0700 (Sat, 06 Oct 2007)

Log Message:
-----------
Commit of patch #1804861. It implements a static lastPathComponent() function in each backend, used to extract the last path component of a given path, returned by getName().

Modified Paths:
--------------
    scummvm/trunk/backends/fs/abstract-fs.h
    scummvm/trunk/backends/fs/amigaos4/amigaos4-fs.cpp
    scummvm/trunk/backends/fs/dc/dc-fs.cpp
    scummvm/trunk/backends/fs/ds/ds-fs.cpp
    scummvm/trunk/backends/fs/ds/ds-fs.h
    scummvm/trunk/backends/fs/gp32/gp32-fs.cpp
    scummvm/trunk/backends/fs/morphos/abox-fs.cpp
    scummvm/trunk/backends/fs/palmos/palmos-fs.cpp
    scummvm/trunk/backends/fs/posix/posix-fs.cpp
    scummvm/trunk/backends/fs/ps2/ps2-fs.cpp
    scummvm/trunk/backends/fs/psp/psp-fs.cpp
    scummvm/trunk/backends/fs/symbian/symbian-fs.cpp
    scummvm/trunk/backends/fs/windows/windows-fs.cpp

Modified: scummvm/trunk/backends/fs/abstract-fs.h
===================================================================
--- scummvm/trunk/backends/fs/abstract-fs.h	2007-10-06 21:15:53 UTC (rev 29158)
+++ scummvm/trunk/backends/fs/abstract-fs.h	2007-10-07 00:28:38 UTC (rev 29159)
@@ -101,9 +101,15 @@
 	 * @note By default, this method returns the value of getName().
 	 */
 	virtual String getDisplayName() const { return getName(); }
-
+	
 	/**
-	 * Returns a string with an architecture dependent path description.
+	 * Returns the last component of the path pointed by this FilesystemNode.
+	 * 
+	 * Examples (POSIX):
+	 * 			/foo/bar.txt would return /bar.txt
+	 * 			/foo/bar/    would return /bar/
+	 *  
+	 * @note This method is very architecture dependent, please check the concrete implementation for more information.
 	 */
 	virtual String getName() const = 0;
 	

Modified: scummvm/trunk/backends/fs/amigaos4/amigaos4-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/amigaos4/amigaos4-fs.cpp	2007-10-06 21:15:53 UTC (rev 29158)
+++ scummvm/trunk/backends/fs/amigaos4/amigaos4-fs.cpp	2007-10-07 00:28:38 UTC (rev 29159)
@@ -93,7 +93,6 @@
 	virtual String getPath() const { return _sPath; };
 	virtual bool isDirectory() const { return _bIsDirectory; };
 	virtual bool isReadable() const { return true; }	//FIXME: this is just a stub
-	virtual bool isValid() const { return _bIsValid; };
 	virtual bool isWritable() const { return true; }	//FIXME: this is just a stub
 	
 	virtual AbstractFilesystemNode *getChild(const String &n) const;
@@ -106,9 +105,6 @@
 	virtual AbstractFSList listVolumes() const;
 };
 
-// TODO: this is ripped of
-// AmigaOSFilesystemNode::AmigaOSFilesystemNode(const String &p)
-// maybe change it to use this function instead?
 /**
  * Returns the last component of a given path.
  * 
@@ -117,6 +113,12 @@
  */
 const char *lastPathComponent(const Common::String &str) {
 	int offset = str.size();
+		
+	if (offset <= 0) {
+		debug(6, "Bad offset");
+		return;
+	}
+	
 	const char *p = str.c_str();
 
 	while (offset > 0 && (p[offset-1] == '/' || p[offset-1] == ':'))
@@ -151,19 +153,7 @@
 	}
 
 	_sPath = p;
-
-	// Extract last	component from path
-	const char *str = p.c_str();
-
-	while (offset > 0 && (str[offset-1] == '/' || str[offset-1] == ':'))
-		offset--;
-
-	while (offset > 0 && (str[offset-1] != '/' && str[offset-1] != ':')) {
-		len++;
-		offset--;
-	}
-
-	_sDisplayName = String(str + offset, len);
+	_sDisplayName = lastPathComponent(_sPath);
 	_pFileLock = 0;
 	_bIsDirectory = false;
 
@@ -352,7 +342,12 @@
 						if (lock) {
 							AmigaOSFilesystemNode *entry = new AmigaOSFilesystemNode(lock, (char *)ead->ed_Name);
 							if (entry) {
-								if (entry->isValid())
+								//FIXME: since the isValid() function is no longer part of the AbstractFilesystemNode
+								//       specification, the following call had to be changed:
+								//       	if (entry->isValid())
+								//		 Please verify that the logic of the code remains coherent. Also, remember
+								//		 that the isReadable() and isWritable() methods are available.
+								if (entry->exists())
 								    myList.push_back(entry);
 								else
 									delete entry;
@@ -453,7 +448,12 @@
 
 				AmigaOSFilesystemNode *entry = new AmigaOSFilesystemNode(volumeLock, buffer);
 				if (entry) {
-					if (entry->isValid())
+					//FIXME: since the isValid() function is no longer part of the AbstractFilesystemNode
+					//       specification, the following call had to be changed:
+					//       	if (entry->isValid())
+					//		 Please verify that the logic of the code remains coherent. Also, remember
+					//		 that the isReadable() and isWritable() methods are available.
+					if(entry->exists())
 						myList.push_back(entry);
 					else
 						delete entry;

Modified: scummvm/trunk/backends/fs/dc/dc-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/dc/dc-fs.cpp	2007-10-06 21:15:53 UTC (rev 29158)
+++ scummvm/trunk/backends/fs/dc/dc-fs.cpp	2007-10-07 00:28:38 UTC (rev 29159)
@@ -62,7 +62,6 @@
 	virtual String getPath() const { return _path; }
 	virtual bool isDirectory() const { return _isDirectory; }
 	virtual bool isReadable() const { return true; }	//FIXME: this is just a stub
-	virtual bool isValid() const { return _isValid; }
 	virtual bool isWritable() const { return true; }	//FIXME: this is just a stub
 
 	virtual AbstractFilesystemNode *getChild(const String &n) const;
@@ -81,6 +80,9 @@
  * @return Pointer to the first char of the last component inside str.
  */
 const char *lastPathComponent(const Common::String &str) {
+	if(str.empty())
+		return "";
+	
 	const char *start = str.c_str();
 	const char *cur = start + str.size() - 2;
 

Modified: scummvm/trunk/backends/fs/ds/ds-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/ds/ds-fs.cpp	2007-10-06 21:15:53 UTC (rev 29158)
+++ scummvm/trunk/backends/fs/ds/ds-fs.cpp	2007-10-07 00:28:38 UTC (rev 29159)
@@ -36,12 +36,30 @@
 ZipFile*   	DSFileSystemNode::_zipFile = NULL;
 char		currentDir[128];
 
+const char *lastPathComponentDS(const Common::String &str) {
+	if (str.empty())
+		return "";
+	
+	char disp[128];
+	char* pathStr = (char *) str.c_str();
+	int lastSlash = 3;
+	
+	for (int r = 0; r < (int) strlen(pathStr) - 1; r++) {
+		if (path[r] == '\\') {
+			lastSlash = r;
+		}
+	}
+	
+	strcpy(disp, pathStr + lastSlash + 1);
+	
+	return disp;
+}
+
 DSFileSystemNode::DSFileSystemNode() {
-	_displayName = "ds:/";
 	_path = "ds:/";
+	_displayName = "ds:/";
 	_isValid = true;
 	_isDirectory = true;
-	_path = "ds:/";
 
 /*	if (!_archive) {
 		_archive = (GBFS_FILE *) find_first_gbfs_file(scummdata);
@@ -56,23 +74,12 @@
 DSFileSystemNode::DSFileSystemNode(const String& path) {
 //	consolePrintf("--%s ",path.c_str());
 	
-	char disp[128];
-	char* pathStr = (char *) path.c_str();
-	
-	int lastSlash = 3;
-	for (int r = 0; r < (int) strlen(pathStr) - 1; r++) {
-		if (path[r] == '\\') {
-			lastSlash = r;
-		}
-	}
-	
-	strcpy(disp, pathStr + lastSlash + 1);
-	
-	_displayName = String(disp);
 	_path = path;
+	_displayName = lastPathComponentDS(_path);
 //	_isValid = true;
 //	_isDirectory = false;
 
+	char* pathStr = (char *) path.c_str();
 	if (!strncmp(pathStr, "ds:/", 4)) {
 		pathStr += 4;
 	}
@@ -99,19 +106,8 @@
 DSFileSystemNode::DSFileSystemNode(const String& path, bool isDir) {
 //	consolePrintf("--%s ",path.c_str());
 	
-	char disp[128];
-	char* pathStr = (char *) path.c_str();
-	int lastSlash = 3;
-	for (int r = 0; r < (int) strlen(pathStr) - 1; r++) {
-		if (path[r] == '\\') {
-			lastSlash = r;
-		}
-	}
-	
-	strcpy(disp, pathStr + lastSlash + 1);
-	
-	_displayName = String(disp);
 	_path = path;
+	_displayName = lastPathComponentDS(_path);
 	_isValid = true;
 	_isDirectory = isDir;
 	
@@ -206,20 +202,14 @@
 // GBAMPFileSystemNode - File system using GBA Movie Player and CF card //
 //////////////////////////////////////////////////////////////////////////
 
-GBAMPFileSystemNode::GBAMPFileSystemNode() {
-	_displayName = "mp:/";
-	_path = "mp:/";
-	_isValid = true;
-	_isDirectory = true;
-	_path = "mp:/";
-}
-
-GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path) {
-//	consolePrintf("'%s'",path.c_str());
+const char *lastPathComponentGBAMP(const Common::String &str) {
+	if (str.empty())
+		return "";
 	
 	char disp[128];
-	char* pathStr = (char *) path.c_str();
+	char* pathStr = (char *) str.c_str();
 	int lastSlash = 3;
+	
 	for (int r = 0; r < (int) strlen(pathStr) - 1; r++) {
 		if ((path[r] == '\\') || (path[r] == '/')) {
 			lastSlash = r;
@@ -227,7 +217,20 @@
 	}
 	
 	strcpy(disp, pathStr + lastSlash + 1);
+	
+	return disp;
+}
 
+GBAMPFileSystemNode::GBAMPFileSystemNode() {
+	_path = "mp:/";
+	_displayName = "mp:/";
+	_isValid = true;
+	_isDirectory = true;
+}
+
+GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path) {
+//	consolePrintf("'%s'",path.c_str());
+	
 	char check[128];
 	int success;
 	
@@ -243,8 +246,8 @@
 	}
 //	consolePrintf("Path: %s  (%d)\n", check, success);
 	
-	_displayName = String(disp);
 	_path = path;
+	_displayName = lastPathComponentGBAMP(_path);
 	_isValid = success == FT_FILE;
 	_isDirectory = success == FT_DIR;
 }
@@ -252,19 +255,8 @@
 GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path, bool isDirectory) {
 //	consolePrintf("'%s'",path.c_str());
 	
-	char disp[128];
-	char* pathStr = (char *) path.c_str();
-	int lastSlash = 3;
-	for (int r = 0; r < (int) strlen(pathStr) - 1; r++) {
-		if ((path[r] == '\\') || (path[r] == '/')) {
-			lastSlash = r;
-		}
-	}
-	
-	strcpy(disp, pathStr + lastSlash + 1);
-
-	_displayName = String(disp);
 	_path = path;
+	_displayName = lastPathComponentGBAMP(_path);
 	_isValid = true;
 	_isDirectory = isDirectory;
 }

Modified: scummvm/trunk/backends/fs/ds/ds-fs.h
===================================================================
--- scummvm/trunk/backends/fs/ds/ds-fs.h	2007-10-06 21:15:53 UTC (rev 29158)
+++ scummvm/trunk/backends/fs/ds/ds-fs.h	2007-10-07 00:28:38 UTC (rev 29159)
@@ -83,7 +83,6 @@
 	virtual String getPath() const { return _path; }
 	virtual bool isDirectory() const { return _isDirectory; }
 	virtual bool isReadable() const { return true; }	//FIXME: this is just a stub
-	virtual bool isValid() const { return _isValid; }
 	virtual bool isWritable() const { return true; }	//FIXME: this is just a stub
 	
 	/**
@@ -149,7 +148,6 @@
 	virtual String getPath() const { return _path; }
 	virtual bool isDirectory() const { return _isDirectory; }
 	virtual bool isReadable() const { return true; }	//FIXME: this is just a stub
-	virtual bool isValid() const { return _isValid; }
 	virtual bool isWritable() const { return true; }	//FIXME: this is just a stub
 	
 	/**

Modified: scummvm/trunk/backends/fs/gp32/gp32-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/gp32/gp32-fs.cpp	2007-10-06 21:15:53 UTC (rev 29158)
+++ scummvm/trunk/backends/fs/gp32/gp32-fs.cpp	2007-10-07 00:28:38 UTC (rev 29159)
@@ -60,7 +60,6 @@
 	// FIXME: isValid should return false if this Node can't be used!
 	// so client code can rely on the return value.
 	virtual bool isReadable() const { return true; }	//FIXME: this is just a stub
-	virtual bool isValid() const { return true; }
 	virtual bool isWritable() const { return true; }	//FIXME: this is just a stub
 
 	virtual AbstractFilesystemNode *getChild(const String &n) const;
@@ -82,6 +81,9 @@
  * @return Pointer to the first char of the last component inside str.
  */
 const char *lastPathComponent(const Common::String &str) {
+	if(str.empty())
+		return "";
+	
 	const char *start = str.c_str();
 	const char *cur = start + str.size() - 2;
 

Modified: scummvm/trunk/backends/fs/morphos/abox-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/morphos/abox-fs.cpp	2007-10-06 21:15:53 UTC (rev 29158)
+++ scummvm/trunk/backends/fs/morphos/abox-fs.cpp	2007-10-07 00:28:38 UTC (rev 29159)
@@ -80,7 +80,6 @@
 	virtual String getPath() const { return _path; }
 	virtual bool isDirectory() const { return _isDirectory; }
 	virtual bool isReadable() const { return true; }	//FIXME: this is just a stub
-	virtual bool isValid() const { return _isValid; }
 	virtual bool isWritable() const { return true; }	//FIXME: this is just a stub
 	
 	virtual AbstractFilesystemNode *getChild(const String &name) const;
@@ -93,12 +92,33 @@
 	static AbstractFSList getRootChildren();
 };
 
+/**
+ * Returns the last component of a given path.
+ * 
+ * @param str String containing the path.
+ * @return Pointer to the first char of the last component inside str.
+ */
+const char *lastPathComponent(const Common::String &str) {
+	if (str.empty())
+		return "";
+	
+	const char *str = _path.c_str();
+	while (offset > 0 && (str[offset-1] == '/' || str[offset-1] == ':') )
+		offset--;
+	while (offset > 0 && (str[offset-1] != '/' && str[offset-1] != ':')) {
+		len++;
+		offset--;
+	}
+	
+	return str + offset;
+}
+
 ABoxFilesystemNode::ABoxFilesystemNode()
 {
+	_path = "";
 	_displayName = "Mounted Volumes";
 	_isValid = true;
 	_isDirectory = true;
-	_path = "";
 	_lock = NULL;
 }
 
@@ -108,16 +128,7 @@
 	assert(offset > 0);
 
 	_path = p;
-
-	// Extract last component from path
-	const char *str = p.c_str();
-	while (offset > 0 && (str[offset-1] == '/' || str[offset-1] == ':') )
-		offset--;
-	while (offset > 0 && (str[offset-1] != '/' && str[offset-1] != ':')) {
-		len++;
-		offset--;
-	}
-	_displayName = String(str + offset, len);
+	_displayName = lastPathComponent(_path);
 	_lock = NULL;
 	_isDirectory = false;
 
@@ -212,10 +223,10 @@
 
 ABoxFilesystemNode::ABoxFilesystemNode(const ABoxFilesystemNode& node)
 {
+	_path = node._path;
 	_displayName = node._displayName;
 	_isValid = node._isValid;
 	_isDirectory = node._isDirectory;
-	_path = node._path;
 	_lock = DupLock(node._lock);
 }
 
@@ -299,7 +310,12 @@
 					entry = new ABoxFilesystemNode(lock, fib->fib_FileName);
 					if (entry)
 					{
-						if (entry->isValid())
+						//FIXME: since the isValid() function is no longer part of the AbstractFilesystemNode
+						//       specification, the following call had to be changed:
+						//       	if (entry->isValid())
+						//		 Please verify that the logic of the code remains coherent. Also, remember
+						//		 that the isReadable() and isWritable() methods are available.
+						if (entry->exists())
 							list.push_back(entry);
 						else
 							delete entry;
@@ -378,7 +394,12 @@
 				entry = new ABoxFilesystemNode(volume_lock, name);
 				if (entry)
 				{
-					if (entry->isValid())
+					//FIXME: since the isValid() function is no longer part of the AbstractFilesystemNode
+					//       specification, the following call had to be changed:
+					//       	if (entry->isValid())
+					//		 Please verify that the logic of the code remains coherent. Also, remember
+					//		 that the isReadable() and isWritable() methods are available.
+					if (entry->exists())
 						list.push_back(entry);
 					else
 						delete entry;

Modified: scummvm/trunk/backends/fs/palmos/palmos-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/palmos/palmos-fs.cpp	2007-10-06 21:15:53 UTC (rev 29158)
+++ scummvm/trunk/backends/fs/palmos/palmos-fs.cpp	2007-10-07 00:28:38 UTC (rev 29159)
@@ -61,7 +61,6 @@
 	virtual String getPath() const { return _path; }
 	virtual bool isDirectory() const { return _isDirectory; }
 	virtual bool isReadable() const { return true; }	//FIXME: this is just a stub
-	virtual bool isValid() const { return _isValid; }
 	virtual bool isWritable() const { return true; }	//FIXME: this is just a stub
 
 	virtual AbstractFilesystemNode *getChild(const String &n) const;
@@ -92,6 +91,9 @@
  * @return Pointer to the first char of the last component inside str.
  */
 const char *lastPathComponent(const Common::String &str) {
+	if(str.empty())
+		return "";
+	
 	const char *start = str.c_str();
 	const char *cur = start + str.size() - 2;
 
@@ -136,7 +138,7 @@
 
 PalmOSFilesystemNode::PalmOSFilesystemNode(const String &p) {
 	_path = p;
-	_displayName = lastPathComponent(p);
+	_displayName = lastPathComponent(_path);
 
 	UInt32 attr;
 	FileRef handle;

Modified: scummvm/trunk/backends/fs/posix/posix-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/posix/posix-fs.cpp	2007-10-06 21:15:53 UTC (rev 29158)
+++ scummvm/trunk/backends/fs/posix/posix-fs.cpp	2007-10-07 00:28:38 UTC (rev 29159)
@@ -91,6 +91,9 @@
  * @return Pointer to the first char of the last component inside str.
  */
 const char *lastPathComponent(const Common::String &str) {
+	if(str.empty())
+		return "";
+	
 	const char *start = str.c_str();
 	const char *cur = start + str.size() - 2;
 

Modified: scummvm/trunk/backends/fs/ps2/ps2-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/ps2/ps2-fs.cpp	2007-10-06 21:15:53 UTC (rev 29158)
+++ scummvm/trunk/backends/fs/ps2/ps2-fs.cpp	2007-10-07 00:28:38 UTC (rev 29159)
@@ -68,7 +68,6 @@
 	virtual String getPath() const { return _path; }
 	virtual bool isDirectory() const { return _isDirectory; }
 	virtual bool isReadable() const { return true; }	//FIXME: this is just a stub
-	virtual bool isValid() const { return !_isRoot; }
 	virtual bool isWritable() const { return true; }	//FIXME: this is just a stub
 
 	virtual AbstractFilesystemNode *clone() const { return new Ps2FilesystemNode(this); }
@@ -77,6 +76,22 @@
 	virtual AbstractFilesystemNode *getParent() const;
 };
 
+/**
+ * Returns the last component of a given path.
+ * 
+ * @param str String containing the path.
+ * @return Pointer to the first char of the last component inside str.
+ */
+const char *lastPathComponent(const Common::String &str) {
+	//FIXME: implement this method properly.
+	// This code is probably around the constructors,
+	// but I couldn't figure it out without having
+	// doubts on the correctness of my assumptions.
+	// Therefore, I leave it to the porter to correctly
+	// implement this method.
+	assert(false);
+}
+
 Ps2FilesystemNode::Ps2FilesystemNode() {
 	_isDirectory = true;
 	_isRoot = true;

Modified: scummvm/trunk/backends/fs/psp/psp-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/psp/psp-fs.cpp	2007-10-06 21:15:53 UTC (rev 29158)
+++ scummvm/trunk/backends/fs/psp/psp-fs.cpp	2007-10-07 00:28:38 UTC (rev 29159)
@@ -64,7 +64,6 @@
 	virtual String getPath() const { return _path; }
 	virtual bool isDirectory() const { return _isDirectory; }
 	virtual bool isReadable() const { return true; }	//FIXME: this is just a stub
-	virtual bool isValid() const { return _isValid; }
 	virtual bool isWritable() const { return true; }	//FIXME: this is just a stub
 
 	virtual AbstractFilesystemNode *getChild(const String &n) const;
@@ -83,6 +82,9 @@
  * @return Pointer to the first char of the last component inside str.
  */
 const char *lastPathComponent(const Common::String &str) {
+	if(str.empty())
+		return "";
+		
 	const char *start = str.c_str();
 	const char *cur = start + str.size() - 2;
 
@@ -170,8 +172,6 @@
 }
 
 AbstractFilesystemNode *PSPFilesystemNode::getParent() const {
-	assert(_isValid);
-	
 	if (_path == ROOT_PATH)
 		return 0;
 	

Modified: scummvm/trunk/backends/fs/symbian/symbian-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/symbian/symbian-fs.cpp	2007-10-06 21:15:53 UTC (rev 29158)
+++ scummvm/trunk/backends/fs/symbian/symbian-fs.cpp	2007-10-07 00:28:38 UTC (rev 29159)
@@ -64,7 +64,6 @@
 	virtual String getPath() const { return _path; }
 	virtual bool isDirectory() const { return _isDirectory; }
 	virtual bool isReadable() const { return true; }	//FIXME: this is just a stub
-	virtual bool isValid() const { return _isValid; }
 	virtual bool isWritable() const { return true; }	//FIXME: this is just a stub
 
 	virtual AbstractFilesystemNode *getChild(const String &n) const;
@@ -83,6 +82,9 @@
  * @return Pointer to the first char of the last component inside str.
  */
 const char *lastPathComponent(const Common::String &str) {
+	if(str.empty())
+		return "";
+		
 	const char *start = str.c_str();
 	const char *cur = start + str.size() - 2;
 

Modified: scummvm/trunk/backends/fs/windows/windows-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/windows/windows-fs.cpp	2007-10-06 21:15:53 UTC (rev 29158)
+++ scummvm/trunk/backends/fs/windows/windows-fs.cpp	2007-10-07 00:28:38 UTC (rev 29159)
@@ -92,7 +92,6 @@
 	virtual String getPath() const { return _path; }
 	virtual bool isDirectory() const { return _isDirectory; }
 	virtual bool isReadable() const { return _access(_path.c_str(), R_OK) == 0; }
-	virtual bool isValid() const { return _isValid; }
 	virtual bool isWritable() const { return _access(_path.c_str(), W_OK) == 0; }
 
 	virtual AbstractFilesystemNode *getChild(const String &n) const;
@@ -139,6 +138,9 @@
  * @return Pointer to the first char of the last component inside str.
  */
 const char *lastPathComponent(const Common::String &str) {
+	if(str.empty())
+		return "";
+		
 	const char *start = str.c_str();
 	const char *cur = start + str.size() - 2;
 


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