[Tux4kids-commits] r1716 - tuxmath/trunk/src

B. Luchen cheezmeister-guest at alioth.debian.org
Mon Jan 4 02:34:03 UTC 2010


Author: cheezmeister-guest
Date: 2010-01-04 02:34:03 +0000 (Mon, 04 Jan 2010)
New Revision: 1716

Modified:
   tuxmath/trunk/src/mathcards.c
Log:
Fixed (?) mathcards bug causing the last character of 3-digit answers to be stripped

Modified: tuxmath/trunk/src/mathcards.c
===================================================================
--- tuxmath/trunk/src/mathcards.c	2010-01-04 02:27:48 UTC (rev 1715)
+++ tuxmath/trunk/src/mathcards.c	2010-01-04 02:34:03 UTC (rev 1716)
@@ -2518,14 +2518,14 @@
   char* beg = 0;
   char* end = 0;
   char nans[MC_ANSWER_LEN];
-  char nformula[MC_FORMULA_LEN + MC_ANSWER_LEN]; //gets a bit larger than usual in the meantime
+  char nformula[MC_FORMULA_LEN + MC_ANSWER_LEN + 1]; //gets a bit larger than usual in the meantime
  
   {
     DEBUGMSG(debug_mathcards, "Starting formula: %s\n", card->formula_string);
     //insert old answer where question mark was
     for (i = 0, j = 0; card->formula_string[j] != '?'; ++i, ++j)
       nformula[i] = card->formula_string[j];
-    i += snprintf(nformula + i, MC_ANSWER_LEN - 1, "%s", card->answer_string);
+    i += snprintf(nformula + i, MC_ANSWER_LEN, "%s", card->answer_string);
     DEBUGMSG(debug_mathcards, "interim formula: %s\n", nformula);
     snprintf(nformula + i, MC_FORMULA_LEN - i, "%s", card->formula_string + j + 1);
 




More information about the Tux4kids-commits mailing list