diff --git a/require-ess/src/expr.c b/require-ess/src/expr.c index b3ef0164c13c21eae9bedfea8235c16d93da85d1..150548b7b5c0a8cb743a836d8ca5b0f0a7f7bd08 100644 --- a/require-ess/src/expr.c +++ b/require-ess/src/expr.c @@ -148,7 +148,7 @@ static int parseOp(const char **pp) { skipSpace(p); if (ispunct((unsigned char)*p)) { - for (int o = 1; o < static_cast<int>(sizeof(ops) / sizeof(ops[0])); o++) { + for (int o = 1; o < (int)(sizeof(ops) / sizeof(ops[0])); o++) { int l; if ((l = startsWith(p, ops[o].str))) { /* operator found */ @@ -369,8 +369,8 @@ static long parseString(const char **pp, const char **pstart) { while (parseSlice(&p, &slice_start, &length)) { } if (exprDebug) - printf("parseString %.*s[%ld,%ld]\n", static_cast<int>(p - string_start), - string_start, slice_start, length); + printf("parseString %.*s[%ld,%ld]\n", (int)(p - string_start), string_start, + slice_start, length); if (length && pstart) { while (slice_start-- > 0) { if (*string_start++ == '\\') string_start++; diff --git a/require-ess/src/require.c b/require-ess/src/require.c index a8ef96fded327a74910b6372e4176148b64171d7..a19df00d168a0581ca0f5857ae4514bce496e655 100644 --- a/require-ess/src/require.c +++ b/require-ess/src/require.c @@ -386,8 +386,7 @@ static int getRecordHandle(const char *namepart, short type, long minsize, long dummy = 0L; long offset = 0L; - sprintf(recordname, "%.*s%s", - static_cast<int>(PVNAME_STRINGSZ - strlen(namepart) - 1), + sprintf(recordname, "%.*s%s", (int)(PVNAME_STRINGSZ - strlen(namepart) - 1), getenv("REQUIRE_IOC"), namepart); if (dbNameToAddr(recordname, paddr) != 0) { @@ -432,8 +431,7 @@ must wait until initHooks is loaded before we can register the hook. static void fillModuleListRecord(initHookState state) { if (state == initHookAfterFinishDevSup) /* MODULES record exists and has - allocated memory */ - { + allocated memory */ { DBADDR modules, versions, modver; int have_modules, have_versions, have_modver; moduleitem *m; @@ -457,24 +455,22 @@ static void fillModuleListRecord(initHookState state) { if (requireDebug) printf("require: %s[%d] = \"%.*s\"\n", modules.precord->name, i, MAX_STRING_SIZE - 1, m->content); - sprintf(reinterpret_cast<char *>(modules.pfield) + i * MAX_STRING_SIZE, - "%.*s", MAX_STRING_SIZE - 1, m->content); + sprintf((char *)(modules.pfield) + i * MAX_STRING_SIZE, "%.*s", + MAX_STRING_SIZE - 1, m->content); } if (have_versions) { if (requireDebug) printf("require: %s[%d] = \"%.*s\"\n", versions.precord->name, i, MAX_STRING_SIZE - 1, m->content + lm); - sprintf(reinterpret_cast<char *>(versions.pfield) + i * MAX_STRING_SIZE, - "%.*s", MAX_STRING_SIZE - 1, m->content + lm); + sprintf((char *)(versions.pfield) + i * MAX_STRING_SIZE, "%.*s", + MAX_STRING_SIZE - 1, m->content + lm); } if (have_modver) { if (requireDebug) printf("require: %s+=\"%-*s%s\"\n", modver.precord->name, - static_cast<int> maxModuleNameLength, m->content, - m->content + lm); - c += sprintf(reinterpret_cast<char *>(modver.pfield) + c, "%-*s%s\n", - static_cast<int> maxModuleNameLength, m->content, - m->content + lm); + (int)maxModuleNameLength, m->content, m->content + lm); + c += sprintf((char *)(modver.pfield) + c, "%-*s%s\n", + (int)maxModuleNameLength, m->content, m->content + lm); } } if (have_modules) dbGetRset(&modules)->put_array_info(&modules, i); @@ -510,7 +506,7 @@ void registerModule(const char *module, const char *version, absLocation = realpathSeparator(location); ll = strlen(absLocation) + 1; } - m = reinterpret_cast<moduleitem *> malloc(sizeof(moduleitem) + lm + lv + ll); + m = (moduleitem *)malloc(sizeof(moduleitem) + lm + lv + ll); if (m == NULL) { fprintf(stderr, "require: out of memory\n"); return; @@ -523,8 +519,7 @@ void registerModule(const char *module, const char *version, strcpy(m->content + lm + lv, absLocation ? absLocation : ""); free(absLocation); - for (pm = &loadedModules; *pm != NULL; pm = &(*pm)->next) { - } + for (pm = &loadedModules; *pm != NULL; pm = &(*pm)->next) {} *pm = m; if (lm > maxModuleNameLength) maxModuleNameLength = lm; moduleListBufferSize += lv; @@ -601,10 +596,10 @@ static int findLibRelease(struct dl_phdr_info *info, /* shared library info */ location = name; *++p = 0; } else { - p = name; /* terminate "<location>/" (if exists) */ + p = name; /* terminate "<location>/" (if exists) */ } - *(symname = p + 2) = '_'; /* replace "lib" with "_" */ - p = strchr(symname, '.'); /* find ".so" extension */ + *(symname = p + 2) = '_'; /* replace "lib" with "_" */ + p = strchr(symname, '.'); /* find ".so" extension */ if (p == NULL) p = symname + strlen(symname); /* no file extension ? */ strcpy(p, "LibRelease"); /* append "LibRelease" to module name */ version = dlsym(handle, symname); /* find symbol "_<module>LibRelease" */ @@ -660,7 +655,7 @@ static void registerExternalModules() { *symname = '_'; /* prefix module name with '_' */ strcpy((p += 2), "LibRelease"); /* append "LibRelease" to module name */ - version = reinterpret_cast<char *> GetProcAddress( + version = (char *)GetProcAddress( hMods[i], symname); /* find symbol "_<module>LibRelease" */ if (version) { *p = 0; @@ -742,8 +737,8 @@ int libversionShow(const char *outfile) { for (m = loadedModules; m; m = m->next) { lm = strlen(m->content) + 1; lv = strlen(m->content + lm) + 1; - fprintf(out, "%-*s%-20s %s\n", static_cast<int> maxModuleNameLength, - m->content, m->content + lm, m->content + lm + lv); + fprintf(out, "%-*s%-20s %s\n", (int)maxModuleNameLength, m->content, + m->content + lm, m->content + lm + lv); } if (fflush(out) < 0 && outfile) { fprintf(stderr, "can't write to %s: %s\n", outfile, strerror(errno)); @@ -829,8 +824,8 @@ static int compareVersions(const char *found, const char *request, return MISMATCH; } - sv_found = reinterpret_cast<semver_t *> calloc(1, sizeof(semver_t)); - sv_request = reinterpret_cast<semver_t *> calloc(1, sizeof(semver_t)); + sv_found = (semver_t *)calloc(1, sizeof(semver_t)); + sv_request = (semver_t *)calloc(1, sizeof(semver_t)); parse_semver(found, sv_found); parse_semver(request, sv_request); @@ -1169,9 +1164,9 @@ static int require_priv( end[2] == OSI_PATH_SEPARATOR[0]) /* "http://..." and friends */ end = strchr(end + 2, OSI_PATH_LIST_SEPARATOR[0]); if (end) - dirlen = static_cast<int>(end++ - dirname); + dirlen = (int)(end++ - dirname); else - dirlen = static_cast<int> strlen(dirname); + dirlen = (int)strlen(dirname); if (dirlen == 0) continue; /* ignore empty driverpath elements */ if (requireDebug) printf("require: trying %.*s\n", dirlen, dirname); @@ -1222,9 +1217,7 @@ static int require_priv( "%s" OSI_PATH_SEPARATOR LIBDIR "%s" OSI_PATH_SEPARATOR, currentFilename, targetArch)) { - /* filename = - * "<dirname>/[dirlen]<module>/[modulediroffs]<version>/lib/<targetArch>/" - */ + /* filename = "<dirname>/[dirlen]<module>/[modulediroffs]<version>/lib/<targetArch>/" */ if (requireDebug) printf("require: %s %s has no support for %s %s\n", module, currentFilename, epicsRelease, targetArch); @@ -1276,8 +1269,7 @@ static int require_priv( if (status == EXACT) break; } END_DIR_LOOP - } - else { + } else { /* filename = "<dirname>/[dirlen]<module>/" */ if (requireDebug) printf("require: no %s directory\n", filename); @@ -1287,9 +1279,9 @@ static int require_priv( /* look for dep file */ releasediroffs = libdiroffs = dirlen; if (TRY_FILE(dirlen, "%s%s.dep", module, versionstr)) { - /* filename = - "<dirname>/[dirlen][releasediroffs][libdiroffs]<module>(-<version>)?.dep" - */ + /* filename = + "<dirname>/[dirlen][releasediroffs][libdiroffs]<module>(-<version>)?.dep" + */ if (requireDebug) printf("require: found old style %s\n", filename); printf("Module %s%s found in %.*s\n", module, versionstr, dirlen, filename); @@ -1346,9 +1338,9 @@ static int require_priv( "%s" OSI_PATH_SEPARATOR "%n" LIBDIR "%s" OSI_PATH_SEPARATOR "%n%s.dep", founddir, &releasediroffs, targetArch, &libdiroffs, module)) { - /* filename = - "<dirname>/[dirlen]<module>/<version>/R<epicsRelease>/[releasediroffs]/lib/<targetArch>/[libdiroffs]/module.dep" - */ + /* filename = + "<dirname>/[dirlen]<module>/<version>/R<epicsRelease>/[releasediroffs]/lib/<targetArch>/[libdiroffs]/module.dep" + */ fprintf(stderr, "Dependency file %s not found\n", filename); } else { checkdep: @@ -1365,12 +1357,12 @@ static int require_priv( if (!(TRY_FILE(libdiroffs, PREFIX "%s" INFIX "%s%n" EXT, module, versionstr, &extoffs))) { - /* filename = - "<dirname>/[dirlen]<module>/<version>/R<epicsRelease>/[releasediroffs]/lib/<targetArch>/[libdiroffs]/PREFIX<module>INFIX[extoffs](EXT)?" - */ - /* or (old) - "<dirname>/[dirlen][releasediroffs][libdiroffs]PREFIX<module>INFIX(-<version>)?[extoffs](EXT)?" - */ + /* filename = + "<dirname>/[dirlen]<module>/<version>/R<epicsRelease>/[releasediroffs]/lib/<targetArch>/[libdiroffs]/PREFIX<module>INFIX[extoffs](EXT)?" + */ + /* or (old) + "<dirname>/[dirlen][releasediroffs][libdiroffs]PREFIX<module>INFIX(-<version>)?[extoffs](EXT)?" + */ printf("Module %s has no library\n", module); } else { loadlib: diff --git a/require-ess/src/runScript.c b/require-ess/src/runScript.c index f22de9ac306c69aafef818a1e7d3d232ec9fb5ad..b79aee6ebd657199aa605a9f13608c60e159f8d0 100644 --- a/require-ess/src/runScript.c +++ b/require-ess/src/runScript.c @@ -76,7 +76,7 @@ int runScript(const char *filename, const char *args) { /* add args to macro definitions */ if (args) { if (runScriptDebug) printf("runScript: macParseDefns \"%s\"\n", args); - macParseDefns(mac, reinterpret_cast<char *> args, &pairs); + macParseDefns(mac, (char *)args, &pairs); macInstallMacros(mac, pairs); free(pairs); } @@ -96,9 +96,9 @@ int runScript(const char *filename, const char *args) { end[2] == OSI_PATH_SEPARATOR[0]) /* "http://..." and friends */ end = strchr(end + 2, OSI_PATH_LIST_SEPARATOR[0]); if (end) - dirlen = static_cast<int>(end++ - dirname); + dirlen = (int)(end++ - dirname); else - dirlen = static_cast<int> strlen(dirname); + dirlen = (int)strlen(dirname); if (dirlen == 0) continue; /* ignore empty path elements */ if (dirname[dirlen - 1] == OSI_PATH_SEPARATOR[0]) dirlen--; asprintf(&fullname, "%.*s" OSI_PATH_SEPARATOR "%s", dirlen, dirname,