[Tux4kids-commits] r1405 - in tuxtype/branches/gsoc-sarah: doc src

Sarah Frisk fou_fou-guest at alioth.debian.org
Mon Aug 10 06:42:48 UTC 2009


Author: fou_fou-guest
Date: 2009-08-10 06:42:48 +0000 (Mon, 10 Aug 2009)
New Revision: 1405

Modified:
   tuxtype/branches/gsoc-sarah/doc/ChangeLog
   tuxtype/branches/gsoc-sarah/src/editor.c
Log:
Fixed bus error issues in program

Modified: tuxtype/branches/gsoc-sarah/doc/ChangeLog
===================================================================
--- tuxtype/branches/gsoc-sarah/doc/ChangeLog	2009-08-09 18:58:22 UTC (rev 1404)
+++ tuxtype/branches/gsoc-sarah/doc/ChangeLog	2009-08-10 06:42:48 UTC (rev 1405)
@@ -1,3 +1,7 @@
+9 Aug 2009 (svn.debian.org/tux4kids -revision 1405)
+[Sarah Frisk <ssfrisk at gmail.com> }
+	-Bus error bug is fixed.  Final cosmetic issues should be fixed tomorrow.
+
 5 Aug 2009 (svn.debian.org/tux4kids -revision 1365)
 [Sarah Frisk <ssfrisk at gmail.com> }
 	-Program now successfully creates/removes/changes files

Modified: tuxtype/branches/gsoc-sarah/src/editor.c
===================================================================
--- tuxtype/branches/gsoc-sarah/src/editor.c	2009-08-09 18:58:22 UTC (rev 1404)
+++ tuxtype/branches/gsoc-sarah/src/editor.c	2009-08-10 06:42:48 UTC (rev 1405)
@@ -746,8 +746,8 @@
 	SDL_Rect Text;
 	SDL_Rect Directions_rect;
 	
-	char wordlist[MAX_WORD_SIZE + 1];
-	wchar_t temp[FNLEN];
+	char wordlist[MAX_WORD_SIZE+1];
+	wchar_t temp[MAX_WORD_SIZE+1];
 
 	int len = 0; //len = length, 
 	int i = 0; //i = checks for keydown
@@ -758,7 +758,7 @@
 	//Creates a box thing, tells user to enter in name of list.  Click OK, or CANCEL
 	//FIXME: Text in boxes needs work
 	//FIXME: Create a rect for user to enter stuff, and a pretty box to go around everything
-	//FIDME: Change size of boxes
+	//FIXME: Change size of boxes
 	
 	OK = BlackOutline(gettext_noop("OK"), 25, &yellow);
 	CANCEL = BlackOutline(gettext_noop("CANCEL"), 25, &yellow);
@@ -827,11 +827,11 @@
 					
 					if (event.key.keysym.sym == SDLK_BACKSPACE)
 					{
-						len = ConvertFromUTF8(temp, wordlist, FNLEN);
+						len = ConvertFromUTF8(temp, wordlist, MAX_WORD_SIZE);
 						if (len > 0)
 						{
 							temp[len - 1] = temp[len];
-							len = ConvertToUTF8(temp, wordlist, FNLEN);
+							len = ConvertToUTF8(temp, wordlist, MAX_WORD_SIZE);
 							NewWordlist = BlackOutline(wordlist, DEFAULT_MENU_FONT_SIZE, &yellow);
 							fprintf(stderr, "Word: %s\n", wordlist);
 						}
@@ -846,6 +846,7 @@
 					if(event.key.keysym.sym == SDLK_ESCAPE)
 					{
 						stop = 1;
+						i = 0;
 						break;
 					}
 					
@@ -879,17 +880,19 @@
 					if (i) //if it is typing time
 					{
 
-						len = ConvertFromUTF8(temp, wordlist, FNLEN);
+						len = ConvertFromUTF8(temp, wordlist, MAX_WORD_SIZE);
 						
-						// adds a character to the end of existing string
-						temp[len] = toupper(event.key.keysym.unicode);
-						temp[len + 1] = 0;
-						ConvertToUTF8(temp, wordlist, FNLEN);
+						if (len < MAX_WORD_SIZE) {
+							// adds a character to the end of existing string
+							temp[len] = toupper(event.key.keysym.unicode);
+							temp[len + 1] = 0;
+						}
+						len = ConvertToUTF8(temp, wordlist, MAX_WORD_SIZE);
+						fprintf(stderr, "TEMP: %s\n", wordlist);
 						
 						//Copy back into onscreen
-						fprintf(stderr, "Word: %s\n", wordlist);
 						NewWordlist = BlackOutline(wordlist, DEFAULT_MENU_FONT_SIZE, &yellow);
-					
+						
 						i = 0;
 						break;
 					} // end of if(i)			




More information about the Tux4kids-commits mailing list