[Scummvm-cvs-logs] SF.net SVN: scummvm:[33869] scummvm/branches/gsoc2008-vkeybd/backends

kenny-d at users.sourceforge.net kenny-d at users.sourceforge.net
Thu Aug 14 21:20:26 CEST 2008


Revision: 33869
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33869&view=rev
Author:   kenny-d
Date:     2008-08-14 19:20:25 +0000 (Thu, 14 Aug 2008)

Log Message:
-----------
Loads of valgrind fixes

Modified Paths:
--------------
    scummvm/branches/gsoc2008-vkeybd/backends/keymapper/keymap.cpp
    scummvm/branches/gsoc2008-vkeybd/backends/keymapper/keymap.h
    scummvm/branches/gsoc2008-vkeybd/backends/keymapper/remap-dialog.cpp
    scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard-gui.cpp
    scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard-gui.h
    scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard.cpp

Modified: scummvm/branches/gsoc2008-vkeybd/backends/keymapper/keymap.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/keymapper/keymap.cpp	2008-08-14 18:43:27 UTC (rev 33868)
+++ scummvm/branches/gsoc2008-vkeybd/backends/keymapper/keymap.cpp	2008-08-14 19:20:25 UTC (rev 33869)
@@ -38,6 +38,12 @@
 	}
 }
 
+Keymap::~Keymap() {
+	List<Action*>::iterator it;
+	for (it = _actions.begin(); it != _actions.end(); it++)
+		delete *it;
+}
+
 void Keymap::addAction(Action *action) {
 	if (findAction(action->id))
 		error("Action with id %d already in KeyMap!", action->id);

Modified: scummvm/branches/gsoc2008-vkeybd/backends/keymapper/keymap.h
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/keymapper/keymap.h	2008-08-14 18:43:27 UTC (rev 33868)
+++ scummvm/branches/gsoc2008-vkeybd/backends/keymapper/keymap.h	2008-08-14 19:20:25 UTC (rev 33869)
@@ -53,6 +53,7 @@
 public:
 	Keymap(const String& name, Keymap *parent = 0) : _name(name), _parent(parent) {}
 	Keymap(const Keymap& km);
+	~Keymap();
 
 public:
 	/**

Modified: scummvm/branches/gsoc2008-vkeybd/backends/keymapper/remap-dialog.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/keymapper/remap-dialog.cpp	2008-08-14 18:43:27 UTC (rev 33868)
+++ scummvm/branches/gsoc2008-vkeybd/backends/keymapper/remap-dialog.cpp	2008-08-14 19:20:25 UTC (rev 33869)
@@ -265,9 +265,7 @@
 		}
 
 	} else if (_kmPopUp->getSelected() != -1) {
-		uint32 select = _kmPopUp->getSelected();
-		uint32 tag = _kmPopUp->getSelectedTag();
-		Keymap *km = _keymapTable[tag];
+		Keymap *km = _keymapTable[_kmPopUp->getSelectedTag()];
 
 		List<Action*>::iterator it;
 		for (it = km->getActions().begin(); it != km->getActions().end(); it++) {

Modified: scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard-gui.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard-gui.cpp	2008-08-14 18:43:27 UTC (rev 33868)
+++ scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard-gui.cpp	2008-08-14 19:20:25 UTC (rev 33869)
@@ -29,20 +29,23 @@
 
 namespace Common {
 
-VirtualKeyboardGUI::VirtualKeyboardGUI(VirtualKeyboard *kbd) {
-	_kbd = kbd;
-
+VirtualKeyboardGUI::VirtualKeyboardGUI(VirtualKeyboard *kbd)
+	: _kbd(kbd), _displaying(false), _needRedraw(false), _drag(false),
+	_drawCaret(false), _refreshDisplay(false), _displayEnabled(false),
+	_firstRun(true), _cursorAnimateTimer(0), _cursorAnimateCounter(0) {
+	
+	assert(_kbd);
 	assert(g_system);
 	_system = g_system;
-
+	
 	_lastScreenChanged = _system->getScreenChangeID();
-
+	
 	memset(_cursor, 0xFF, sizeof(_cursor));
+}
 
-	_displaying = _needRedraw = _drag = _drawCaret = _displayEnabled = false;
-	_firstRun = true;
-
-	_cursorAnimateTimer = 0;
+VirtualKeyboardGUI::~VirtualKeyboardGUI() {
+	_overlayBackup.free();
+	_dispSurface.free();
 }
 
 void VirtualKeyboardGUI::initMode(VirtualKeyboard::Mode *mode) {
@@ -52,6 +55,7 @@
 	_kbdBound.setHeight(_kbdSurface->h + 1);
 	_needRedraw = true;
 
+	_dispSurface.free();
 	_displayEnabled = false;
 	if (!mode->displayArea)
 		return;
@@ -66,7 +70,6 @@
 	}
 	_dispX = r.left;
 	_dispY = r.top + (r.height() + 1 - _dispFont->getFontHeight()) / 2;
-	_dispSurface.free();
 	_dispSurface.create(r.width() + 1, _dispFont->getFontHeight(), sizeof(OverlayColor));
 	_dispI = 0;
 	_dispForeColor = mode->displayFontColor;
@@ -108,6 +111,7 @@
 	if (!g_gui.isActive()) _system->hideOverlay();
 
 	_overlayBackup.free();
+	_dispSurface.free();
 }
 
 void VirtualKeyboardGUI::hide() {
@@ -192,7 +196,7 @@
 			if (_kbd->_keyQueue.hasStringChanged())
 				_refreshDisplay = true;
 			animateCaret();
-			if (_refreshDisplay) updateDisplay();;
+			if (_refreshDisplay) updateDisplay();
 		}
 		if (_needRedraw) redraw();
 		animateCursor();
@@ -261,16 +265,16 @@
 	extendDirtyRect(_kbdBound);
 
 	Graphics::SurfaceKeyColored surf;
-	surf.create(_dirtyRect.width()+1, _dirtyRect.height()+1, sizeof(OverlayColor));
+	surf.create(_dirtyRect.width(), _dirtyRect.height(), sizeof(OverlayColor));
 
-	OverlayColor *scr = (OverlayColor *)surf.pixels;
-	const OverlayColor *ove = (OverlayColor *) _overlayBackup.getBasePtr(_dirtyRect.left, _dirtyRect.top);
+	OverlayColor *dst = (OverlayColor *)surf.pixels;
+	const OverlayColor *src = (OverlayColor *) _overlayBackup.getBasePtr(_dirtyRect.left, _dirtyRect.top);
 	int16 h = surf.h;
 
 	while (h--) {
-		memcpy(scr, ove, surf.w * sizeof(OverlayColor));
-		scr += surf.w;
-		ove += _overlayBackup.w;
+		memcpy(dst, src, surf.w * sizeof(OverlayColor));
+		dst += surf.w;
+		src += _overlayBackup.w;
 	}
 
 	int16 keyX = _kbdBound.left - _dirtyRect.left;

Modified: scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard-gui.h
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard-gui.h	2008-08-14 18:43:27 UTC (rev 33868)
+++ scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard-gui.h	2008-08-14 19:20:25 UTC (rev 33869)
@@ -39,6 +39,8 @@
 public:
 
 	VirtualKeyboardGUI(VirtualKeyboard *kbd);
+	~VirtualKeyboardGUI();
+	
 	void initMode(VirtualKeyboard::Mode *mode);
 	void run();
 	void hide();

Modified: scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard.cpp	2008-08-14 18:43:27 UTC (rev 33868)
+++ scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard.cpp	2008-08-14 19:20:25 UTC (rev 33869)
@@ -214,6 +214,8 @@
 VirtualKeyboard::KeyPressQueue::KeyPressQueue() {
 	_keyPos = _keys.end();
 	_strPos = 0;
+	_strChanged = false;
+	_keyFlags = 0;
 }
 
 void VirtualKeyboard::KeyPressQueue::toggleFlags(byte fl) {


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