brewco/rdrecipes.c

changeset 473
fdd30e935079
parent 464
4a624c071ca9
equal deleted inserted replaced
472:55bcbf92ecab 473:fdd30e935079
116 } 116 }
117 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BOILTIME", "%d", recipe->boiltime)) < 0) { 117 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BOILTIME", "%d", recipe->boiltime)) < 0) {
118 syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterWriteFormatElement"); 118 syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterWriteFormatElement");
119 return 1; 119 return 1;
120 } 120 }
121 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLTO", "%f", recipe->coolto)) < 0) {
122 syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterWriteFormatElement");
123 return 1;
124 }
121 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "STARTTIME", "%d", (int)recipe->starttime)) < 0) { 125 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "STARTTIME", "%d", (int)recipe->starttime)) < 0) {
122 syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterWriteFormatElement"); 126 syslog(LOG_NOTICE, "wrrecipes: error at xmlTextWriterWriteFormatElement");
123 return 1; 127 return 1;
124 } 128 }
125 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ENDTIME", "%d", (int)recipe->endtime)) < 0) { 129 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ENDTIME", "%d", (int)recipe->endtime)) < 0) {
331 float fval; 335 float fval;
332 336
333 recipe = (a_recipe *)malloc(sizeof(a_recipe)); 337 recipe = (a_recipe *)malloc(sizeof(a_recipe));
334 memset(recipe, 0, sizeof(a_recipe)); 338 memset(recipe, 0, sizeof(a_recipe));
335 recipe->next = NULL; 339 recipe->next = NULL;
340 recipe->coolto = 20.0;
336 341
337 cur = cur->xmlChildrenNode; 342 cur = cur->xmlChildrenNode;
338 while (cur != NULL) { 343 while (cur != NULL) {
339 if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) { 344 if ((!xmlStrcmp(cur->name, (const xmlChar *)"UUID"))) {
340 recipe->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 345 recipe->uuid = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
347 } 352 }
348 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BOILTIME"))) { 353 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BOILTIME"))) {
349 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 354 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
350 if (sscanf((const char *)key, "%d", &ival) == 1) 355 if (sscanf((const char *)key, "%d", &ival) == 1)
351 recipe->boiltime = ival; 356 recipe->boiltime = ival;
357 xmlFree(key);
358 }
359 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLTO"))) {
360 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
361 if (sscanf((const char *)key, "%f", &fval) == 1)
362 recipe->coolto = fval;
352 xmlFree(key); 363 xmlFree(key);
353 } 364 }
354 if ((!xmlStrcmp(cur->name, (const xmlChar *)"STARTTIME"))) { 365 if ((!xmlStrcmp(cur->name, (const xmlChar *)"STARTTIME"))) {
355 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 366 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
356 if (sscanf((const char *)key, "%d", &ival) == 1) 367 if (sscanf((const char *)key, "%d", &ival) == 1)

mercurial