[rkward-cvs] SF.net SVN: rkward:[4261] trunk/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue May 22 17:52:28 UTC 2012


Revision: 4261
          http://rkward.svn.sourceforge.net/rkward/?rev=4261&view=rev
Author:   tfry
Date:     2012-05-22 17:52:28 +0000 (Tue, 22 May 2012)
Log Message:
-----------
Fix off-by-one when the ReadConsole buffer limit is hit.

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/rbackend/rkrbackend.cpp

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2012-05-22 10:08:23 UTC (rev 4260)
+++ trunk/rkward/ChangeLog	2012-05-22 17:52:28 UTC (rev 4261)
@@ -1,3 +1,4 @@
+- Fixed: One character missing in R commands on lines longer than 4096 characters
 - Fixed: "Next"-button in wizards would remain enabled while settings are missing on a page
 - Fixed: Dynamic pages in a wizard would cause a layout bug on the first page
 - Do not offer to restore individual removed columns of a data.frame opened for editing

Modified: trunk/rkward/rkward/rbackend/rkrbackend.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rkrbackend.cpp	2012-05-22 10:08:23 UTC (rev 4260)
+++ trunk/rkward/rkward/rbackend/rkrbackend.cpp	2012-05-22 17:52:28 UTC (rev 4261)
@@ -230,8 +230,9 @@
 
 	bool reached_eof = false;
 	int pos = 0;
+	const int max_pos = buflen - 2;	// one for the termination
 	bool reached_newline = false;
-	while (pos < (buflen-1)) {
+	while (true) {
 		buf[pos] = *current_buffer;
 		if (*current_buffer == '\n') {
 			reached_newline = true;
@@ -241,6 +242,7 @@
 			reached_eof = true;
 			break;
 		}
+		if (pos >= max_pos) break;
 		++current_buffer;
 		++pos;
 	}

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





More information about the rkward-tracker mailing list