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

wjpalenstijn at users.sourceforge.net wjpalenstijn at users.sourceforge.net
Sun Sep 27 01:43:55 CEST 2009


Revision: 44385
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44385&view=rev
Author:   wjpalenstijn
Date:     2009-09-26 23:43:45 +0000 (Sat, 26 Sep 2009)

Log Message:
-----------
SCI: Ignore size argument to FILEIO_WRITE_STRING.
This matches LSL5's expectations when saving the password.

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-09-26 22:56:15 UTC (rev 44384)
+++ scummvm/trunk/engines/sci/engine/kfile.cpp	2009-09-26 23:43:45 UTC (rev 44385)
@@ -233,7 +233,7 @@
 	return s->r_acc;
 }
 
-void fwrite_wrapper(EngineState *s, int handle, char *data, int length) {
+void fwrite_wrapper(EngineState *s, int handle, const char *data, int length) {
 	debugC(2, kDebugLevelFile, "fwrite()'ing \"%s\" to handle %d\n", data, handle);
 
 	FileHandle *f = getFileFromHandle(s, handle);
@@ -808,15 +808,14 @@
 	case K_FILEIO_WRITE_STRING : {
 		int handle = argv[1].toUint16();
 		int size = argv[3].toUint16();
-		char *buf = s->segMan->derefString(argv[2], size);
+		char *buf = s->segMan->derefString(argv[2]);
 		debug(3, "K_FILEIO_WRITE_STRING(%d,%d)", handle, size);
 
-		// FIXME: What is the difference between K_FILEIO_WRITE_STRING and
-		// K_FILEIO_WRITE_RAW? Normally, I would expect the difference to
-		// be that the former doesn't receive a 'size' parameter. But here
-		// it does. Are we missing something?
-		if (buf)
-			fwrite_wrapper(s, handle, buf, size);
+		// CHECKME: Is the size parameter used at all?
+		// In the LSL5 password protection it is zero, and we should
+		// then write a full string. (Not sure if it should write the
+		// terminating zero.)
+		fwrite_wrapper(s, handle, buf, strlen(buf));
 		break;
 	}
 	case K_FILEIO_SEEK : {


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