main/recipes.c

changeset 56
756d1a63d129
parent 54
7b134c27fadb
child 70
d6838a268020
--- a/main/recipes.c	Tue Jul 02 11:00:27 2019 +0200
+++ b/main/recipes.c	Tue Jul 02 12:10:23 2019 +0200
@@ -159,7 +159,8 @@
 		 * But check for whirlpool hops too.
 		 */
                 if (strcmp("NAME", _xml_element[4]) == 0) {
-                    snprintf(_xml_add_name, 63, "%s", char_data_buffer);
+		    _xml_add_name[0] = '\0';
+                    strncat(_xml_add_name, char_data_buffer, 63);
                 } else if (strcmp("USE", _xml_element[4]) == 0) {
                     _xml_add_valid = (strcmp("Boil", char_data_buffer) == 0);   // Only "Boil" is a valid hop
                     if (strcmp("Aroma", char_data_buffer) == 0) {
@@ -181,7 +182,8 @@
 		 * Fermentabes that must be added during the boil.
 		 */
                 if (strcmp("NAME", _xml_element[4]) == 0) {
-                    snprintf(_xml_add_name, 63, "%s", char_data_buffer);
+		    _xml_add_name[0] = '\0';
+                    strncat(_xml_add_name, char_data_buffer, 63);
                 } else if (strcmp("TYPE", _xml_element[4]) == 0) {
                     if ((strcmp("Sugar", char_data_buffer) == 0)/* || (strcmp("Adjunct", char_data_buffer) == 0)*/) {
                         _xml_add_type = ADDITION_FERMENTABLE;
@@ -197,7 +199,8 @@
 		 * Check for Misc additions to add during the boil.
 		 */
 		if (strcmp("NAME", _xml_element[4]) == 0) {
-		    snprintf(_xml_add_name, 63, "%s", char_data_buffer);
+		    _xml_add_name[0] = '\0';
+		    strncat(_xml_add_name, char_data_buffer, 63);
 		} else if (strcmp("USE", _xml_element[4]) == 0) {
 		    _xml_add_valid = (strcmp("Boil", char_data_buffer) == 0);   // Only "Boil" is a valid hop.
 		} else if (strcmp("TYPE", _xml_element[4]) == 0) {
@@ -217,7 +220,8 @@
             } else if ((_xml_depth >= 4) && (strcmp("MASH", _xml_element[2]) == 0)) {
 		if  ((_xml_depth >= 6) && (strcmp("MASH_STEP", _xml_element[4]) == 0)) {
 		    if (strcmp("NAME", _xml_element[5]) == 0) {
-			snprintf(_xml_add_name, 31, "%s", char_data_buffer);
+			_xml_add_name[0] = '\0';
+			strncat(_xml_add_name, char_data_buffer, 63);
 		    } else if (strcmp("TYPE", _xml_element[5]) == 0) {
 			// Temperature Infusion Decoction
 			_xml_add_valid = (strcmp("Temperature", char_data_buffer) == 0);
@@ -293,7 +297,8 @@
     }
     if ((_xml_depth == 5) && (strcmp("MASH_STEP", _xml_element[4]) == 0)) {
 	_xml_mashsteps++;
-	sprintf(recipe.MashStep[_xml_mashsteps].Name, "%s", _xml_add_name);
+	recipe.MashStep[_xml_mashsteps].Name[0] = '\0';
+	strncat(recipe.MashStep[_xml_mashsteps].Name, _xml_add_name, 31);
 	recipe.MashStep[_xml_mashsteps].Type = _xml_add_type;
 	recipe.MashStep[_xml_mashsteps].Temperature = _xml_add_temp;
 	recipe.MashStep[_xml_mashsteps].Resttime = _xml_add_time;
@@ -444,7 +449,7 @@
     size_t		bytes;
     uint8_t		*dst;
     uint16_t		y;
-    char		filename[256], newname[256];
+    char		filename[288], newname[288];
     int			rc;
 
     switch (Main_Screen) {
@@ -459,8 +464,8 @@
 				if (strstr(de->d_name, ".xml") || strstr(de->d_name, ".XML")) {
 				    _fg = TFT_YELLOW;
 				    TFT_print(de->d_name, 2, y);
-				    snprintf(filename, 255, "/sdcard/recipe/%s", de->d_name);
-				    snprintf(newname, 255, "/sdcard/recipe/%s", de->d_name);
+				    snprintf(filename, 287, "/sdcard/recipe/%s", de->d_name);
+				    snprintf(newname, 287, "/sdcard/recipe/%s", de->d_name);
 				    newname[strlen(newname) -2] = 'o';
 				    newname[strlen(newname) -1] = 'k';
 				    rc = ParseRecipe(filename, de->d_name);
@@ -512,7 +517,7 @@
     uint8_t	*dst;
     int		mashsteps;
     uint16_t	y;
-    char	tmp[32];
+    char	tmp[64];
     float	mintemp;
 
     switch (Main_Screen) {

mercurial