[Scummvm-cvs-logs] scummvm master -> 52c05acd959bd873306177a39e6c159e67e5f165

sev- sev at scummvm.org
Sun Apr 24 11:26:27 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
52c05acd95 AGI: Fix bug #3087825: AGI: Code analysis warnings


Commit: 52c05acd959bd873306177a39e6c159e67e5f165
    https://github.com/scummvm/scummvm/commit/52c05acd959bd873306177a39e6c159e67e5f165
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2011-04-24T02:28:22-07:00

Commit Message:
AGI: Fix bug #3087825: AGI: Code analysis warnings

Changed paths:
    engines/agi/inv.cpp
    engines/agi/keyboard.cpp



diff --git a/engines/agi/inv.cpp b/engines/agi/inv.cpp
index 46dfcb2..f1d9523 100644
--- a/engines/agi/inv.cpp
+++ b/engines/agi/inv.cpp
@@ -66,7 +66,7 @@ namespace Agi {
 #define SELECT_MSG_RU	"ENTER - \xa2\xeb\xa1\xe0\xa0\xe2\xec, ESC - \xae\xe2\xac\xa5\xad\xa8\xe2\xec."
 
 void AgiEngine::printItem(int n, int fg, int bg) {
-	printText(objectName(_intobj[n]), 0, n % 2 ? 39 - strlen(objectName(_intobj[n])) : 1,
+	printText(objectName(_intobj[n]), 0, ((n % 2) ? 39 - strlen(objectName(_intobj[n])) : 1),
 			(n / 2) + 2, 40, fg, bg);
 }
 
diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp
index 3446541..95211f8 100644
--- a/engines/agi/keyboard.cpp
+++ b/engines/agi/keyboard.cpp
@@ -279,7 +279,7 @@ void AgiEngine::handleGetstring(int key) {
 void AgiEngine::handleKeys(int key) {
 	uint8 *p = NULL;
 	int c = 0;
-	static uint8 formattedEntry[256];
+	static uint8 formattedEntry[40];
 	int l = _game.lineUserInput;
 	int fg = _game.colorFg, bg = _game.colorBg;
 	int promptLength = strlen(agiSprintf(_game.strings[0]));
@@ -298,7 +298,7 @@ void AgiEngine::handleKeys(int key) {
 			;
 
 		// Copy to internal buffer
-		for (; *p; p++) {
+		for (; *p && c < 40-1; p++) {
 			// Squash spaces
 			if (*p == 0x20 && *(p + 1) == 0x20) {
 				p++;






More information about the Scummvm-git-logs mailing list