[Scummvm-cvs-logs] SF.net SVN: scummvm:[38811] scummvm/trunk/engines/sci/engine/kfile.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Feb 23 05:48:29 CET 2009


Revision: 38811
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38811&view=rev
Author:   fingolfin
Date:     2009-02-23 04:48:29 +0000 (Mon, 23 Feb 2009)

Log Message:
-----------
SCI: cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kfile.cpp

Modified: scummvm/trunk/engines/sci/engine/kfile.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kfile.cpp	2009-02-23 04:37:35 UTC (rev 38810)
+++ scummvm/trunk/engines/sci/engine/kfile.cpp	2009-02-23 04:48:29 UTC (rev 38811)
@@ -60,10 +60,6 @@
 #include <unistd.h>
 #endif
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
 #ifdef WIN32
 #  define FO_BINARY "b"
 #else
@@ -79,7 +75,6 @@
 namespace Sci {
 
 
-
 struct sci_dir_t {
 #ifdef WIN32
 	long search;
@@ -132,27 +127,6 @@
 ** Always refers to the cwd, cannot address subdirectories
 */
 
-int sci_open(const char *fname, int flags);
-/* Opens a file descriptor case-insensitively
-** Parameters: (const char *) fname: Name of the file to open
-**             (int) flags: open(2) flags for the file
-** Returns   : (int) a file descriptor of the open file,
-**             or SCI_INVALID_FD on failure
-** Always refers to the cwd, cannot address subdirectories
-*/
-
-char *sci_getcwd();
-/* Returns the current working directory, malloc'd.
-** Parameters: (void)
-** Returns   : (char *) a malloc'd cwd, or NULL if it couldn't be determined.
-*/
-
-int sci_fd_size(int fd);
-/* Returns the filesize of an open file
-** Parameters: (int) fd: File descriptor of open file
-** Returns   : (int) filesize of file pointed to by fd, -1 on error
-*/
-
 int sci_file_size(const char *fname);
 /* Returns the filesize of a file
 ** Parameters: (const char *) fname: Name of file to get filesize of
@@ -322,42 +296,6 @@
 	return file;
 }
 
-int sci_open(const char *fname, int flags) {
-	int file = SCI_INVALID_FD;
-	Common::String name = _fcaseseek(fname);
-	if (!name.empty())
-		file = open(name.c_str(), flags);
-
-	return file;
-}
-
-char *sci_getcwd() {
-	int size = 0;
-	char *cwd = NULL;
-
-	while (size < 8192) {
-		size += 256;
-		cwd = (char*)sci_malloc(size);
-		if (getcwd(cwd, size - 1))
-			return cwd;
-
-		free(cwd);
-	}
-
-	fprintf(stderr, "Could not determine current working directory!\n");
-
-	return NULL;
-}
-
-int sci_fd_size(int fd) {
-	struct stat fd_stat;
-
-	if (fstat(fd, &fd_stat))
-		return -1;
-
-	return fd_stat.st_size;
-}
-
 int sci_file_size(const char *fname) {
 	struct stat fn_stat;
 
@@ -369,7 +307,6 @@
 
 
 
-
 static int _savegame_indices_nr = -1; // means 'uninitialized'
 
 static struct _savegame_index_struct {
@@ -569,16 +506,13 @@
 ** Writes the cwd to the supplied address and returns the address in acc.
 */
 reg_t kGetCWD(EngineState *s, int funct_nr, int argc, reg_t *argv) {
-	char *wd = sci_getcwd();
 	char *targetaddr = kernel_dereference_char_pointer(s, argv[0], 0);
 
-	strncpy(targetaddr, wd, MAX_SAVE_DIR_SIZE - 1);
+	getcwd(targetaddr, MAX_SAVE_DIR_SIZE - 1);
+
 	targetaddr[MAX_SAVE_DIR_SIZE - 1] = 0; // Terminate
 	debug(3, "kGetCWD() -> %s", targetaddr);
 
-	SCIkdebug(SCIkFILE, "Copying cwd='%s'(%d chars) to %p", wd, strlen(wd), targetaddr);
-
-	free(wd);
 	return argv[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