From 33b5cf1c30108818472328fcb0a20b01e485bbc3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ji=C5=99=C3=AD=20Filipovi=C4=8D?= Date: Thu, 18 Mar 2010 16:14:08 +0000 Subject: [PATCH] most of warnings removed --- org.glite.lb.server/src/lb_html.c | 48 ++++++++++----------------------------- 1 file changed, 12 insertions(+), 36 deletions(-) diff --git a/org.glite.lb.server/src/lb_html.c b/org.glite.lb.server/src/lb_html.c index 1563331..3562938 100644 --- a/org.glite.lb.server/src/lb_html.c +++ b/org.glite.lb.server/src/lb_html.c @@ -23,6 +23,7 @@ limitations under the License. #include "pretty_print_wrapper.h" #include "glite/lb/context-int.h" +#include "glite/lb/xml_conversions.h" #include #include @@ -36,33 +37,6 @@ limitations under the License. #define UNUSED_VAR #endif -static char *xmlToHTML(char *xml) { - char *html = strdup(""); - int i = 0; - int j = 0; - while (xml[i]){ - if (xml[i] == '<'){ - html = realloc(html, (j+strlen("<")+1)*sizeof(*html) ); - strcpy(html+j, "<"); - j += strlen("<"); - } - else if (xml[i] == '>'){ - html = realloc(html, (j+strlen(">")+1)*sizeof(*html) ); - strcpy(html+j, ">"); - j += strlen(">"); - } - else{ - html = realloc(html, (j+2)*sizeof(*html)); - html[j] = xml[i]; - j++; - } - i++; - } - html[j] = 0; - - return html; -} - int edg_wll_QueryToHTML(edg_wll_Context ctx UNUSED_VAR, edg_wll_Event *eventsOut UNUSED_VAR, char **message UNUSED_VAR) { /* not implemented yet */ @@ -147,7 +121,7 @@ int edg_wll_UserNotifsToHTML(edg_wll_Context ctx UNUSED_VAR, char **notifids, ch #define TR(name,type,field,null) \ { \ int l; \ - if (field != null){ \ + if ((field) != (null)){ \ l = asprintf(&pomA,"" name ":" \ "" type "", (field)); \ } \ @@ -158,13 +132,14 @@ int edg_wll_UserNotifsToHTML(edg_wll_Context ctx UNUSED_VAR, char **notifids, ch pomB = realloc(pomB, sizeof(*pomB)*(pomL+l+1)); \ strcpy(pomB+pomL, pomA); \ pomL += l; \ - free(pomA); pomA=NULL; \ + free(pomA); \ + pomA=NULL; \ } #define TRL(name,type,field,null) \ { \ int l; \ - if (field != null){ \ + if ((field) != (null)){ \ l = asprintf(&pomA,"" name ":" \ "" type "", (field), (field)); \ } \ @@ -175,11 +150,12 @@ int edg_wll_UserNotifsToHTML(edg_wll_Context ctx UNUSED_VAR, char **notifids, ch pomB = realloc(pomB, sizeof(*pomB)*(pomL+l+1)); \ strcpy(pomB+pomL, pomA); \ pomL += l; \ - free(pomA); pomA=NULL; \ + free(pomA); \ + pomA=NULL; \ } int edg_wll_NotificationToHTML(edg_wll_Context ctx UNUSED_VAR, notifInfo *ni, char **message){ - char *pomA = NULL, *pomB = NULL, *flags, *cond; + char *pomA = NULL, *pomB = NULL, *flags = NULL, *cond; int pomL = 0; flags = edg_wll_stat_flags_to_string(ni->flags); @@ -238,13 +214,13 @@ int edg_wll_GeneralJobStatusToHTML(edg_wll_Context ctx UNUSED_VAR, edg_wll_JobSt TR("State entered","%s",ctime(&time), NULL); } else - TR("State entered", "%s", NULL, NULL); + TR("State entered", "%s", (char*)NULL, NULL); if ( (stat.lastUpdateTime.tv_sec) || (stat.lastUpdateTime.tv_usec) ) { time_t time = stat.lastUpdateTime.tv_sec; TR("Last update","%s",ctime(&time), NULL); } else - TR("Last update", "%s", NULL, NULL); + TR("Last update", "%s", (char*)NULL, NULL); TR("Expect update","%s",stat.expectUpdate ? "YES" : "NO", NULL); TR("Expect update from","%s",stat.expectFrom, NULL); TR("Location","%s",stat.location, NULL); @@ -318,13 +294,13 @@ int edg_wll_CreamJobStatusToHTML(edg_wll_Context ctx UNUSED_VAR, edg_wll_JobStat TR("State entered","%s",ctime(&time), NULL); } else - TR("State entered", "%s", NULL, NULL); + TR("State entered", "%s", (char*)NULL, NULL); if ( (stat.lastUpdateTime.tv_sec) || (stat.lastUpdateTime.tv_usec) ) { time_t time = stat.lastUpdateTime.tv_sec; TR("Last update","%s",ctime(&time), NULL); } else - TR("Last update", "%s", NULL, NULL); + TR("Last update", "%s", (char*)NULL, NULL); TR("LRMS id", "%s", stat.cream_lrms_id, NULL); -- 1.8.2.3