diff --git a/src/lib66/parser.c b/src/lib66/parser.c index 7e495a615b497f4f2a8d54200393afd49998fc77..78e34a30a43c2871ce89eda477d180478fd2bd89 100644 --- a/src/lib66/parser.c +++ b/src/lib66/parser.c @@ -14,6 +14,7 @@ #include <string.h> #include <stdint.h> +#include <stdint.h> //#include <stdio.h> #include <oblibs/error2.h> @@ -34,56 +35,56 @@ #include <66/parser.h> -int parser(sv_alltype *service,stralloc *src,char const *file) +int parser(sv_alltype *service,stralloc *src,char const *svname) { - int r ; - int svtype = -1 ; + int r , svtype = -1 ; + size_t i = 0 ; section_t sasection = SECTION_ZERO ; genalloc ganocheck = GENALLOC_ZERO ; - sasection.file = file ; + sasection.file = svname ; r = section_get_range(&sasection,src) ; if (r <= 0){ - strerr_warnwu2x("parse section of service file: ",file) ; + strerr_warnwu2x("parse section of service file: ",svname) ; goto err ; } if (!sasection.idx[MAIN]) { - VERBO1 strerr_warnw2x("missing section [main] in service file: ", file) ; + VERBO1 strerr_warnw2x("missing section [main] in service file: ", svname) ; goto err ; } if (!key_get_range(&ganocheck,&sasection,&svtype)) goto err ; if (svtype < 0) { - VERBO1 strerr_warnw2x("invalid value for key: @type in service file: ",file) ; + VERBO1 strerr_warnw4x("invalid value for key: ",get_keybyid(TYPE)," in service file: ",svname) ; goto err ; } if (svtype != BUNDLE && !sasection.idx[START]) { - VERBO1 strerr_warnw2x("missing section [start] in service file: ", file) ; + VERBO1 strerr_warnw2x("missing section [start] in service file: ", svname) ; goto err ; } if (!genalloc_len(keynocheck,&ganocheck)){ - VERBO1 strerr_warnw2x("empty service file: ",file) ; + VERBO1 strerr_warnw2x("empty service file: ",svname) ; goto err ; } - for (unsigned int i = 0;i < genalloc_len(keynocheck,&ganocheck);i++) + for (i = 0;i < genalloc_len(keynocheck,&ganocheck);i++) { uint32_t idsec = genalloc_s(keynocheck,&ganocheck)[i].idsec ; - for (int j = 0;j < total_list_el[idsec] && total_list[idsec].list > 0;j++) + for (unsigned int j = 0;j < total_list_el[idsec] && total_list[idsec].list > 0;j++) { if (!get_mandatory(&ganocheck,idsec,j)) { - VERBO1 strerr_warnw2x("mandatory key is missing in service file: ",file) ; + VERBO1 strerr_warnw2x("mandatory key is missing in service file: ",svname) ; goto err ; } } } - for (unsigned int i = 0;i < genalloc_len(keynocheck,&ganocheck);i++) + for (i = 0;i < genalloc_len(keynocheck,&ganocheck);i++) { if (!nocheck_toservice(&(genalloc_s(keynocheck,&ganocheck)[i]),svtype,service)) { - VERBO1 strerr_warnwu2x("keep information of service file: ",file) ; + VERBO1 strerr_warnwu2x("keep information of service file: ",svname) ; goto err ; } }