Skip to content

Commit 0aeb1bb

Browse files
committed
Clean MSVC warnings
1 parent c193dfa commit 0aeb1bb

File tree

5 files changed

+16
-14
lines changed

5 files changed

+16
-14
lines changed

asApp/src/asVerify.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ int main(int argc, char **argv)
9191
fclose(fp);
9292
return (-1);
9393
}
94-
while (!feof(fp) && (n = fread(s, 1, BUF_SIZE, fp))) { fwrite(s, 1, n, ftmp); }
94+
while (!feof(fp) && (n = (int)fread(s, 1, BUF_SIZE, fp))) { fwrite(s, 1, n, ftmp); }
9595
fclose(fp);
9696
fp = NULL;
9797

asApp/src/dbrestore.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ float mySafeDoubleToFloat(double d)
124124
if (d > 0.0) f = FLT_MIN;
125125
else f = -FLT_MIN;
126126
} else {
127-
f = d;
127+
f = (float)d;
128128
}
129129
return (f);
130130
}
@@ -290,7 +290,7 @@ STATIC long scalar_restore(int pass, DBENTRY *pdbentry, char *PVname, char *valu
290290
status = dbNameToAddr(PVname, paddr);
291291
if (!status) {
292292
if (is_long_string && paddr->field_type == DBF_CHAR) {
293-
status = dbPut(paddr, DBF_CHAR, value_string, strlen(value_string) + 1);
293+
status = dbPut(paddr, DBF_CHAR, value_string, (long)strlen(value_string) + 1);
294294
} else {
295295
status = dbPut(paddr, DBF_STRING, value_string, 1);
296296
}
@@ -947,7 +947,7 @@ int reboot_restore(char *filename, initHookState init_state)
947947
printf(" ebuffer='%s'\n", ebuffer);
948948
}
949949
}
950-
n = BUF_SIZE - strlen(value_string) - 1;
950+
n = BUF_SIZE - (int)strlen(value_string) - 1;
951951
strncat(value_string, bp, n);
952952
/* make sure value_string is properly null-terminated */
953953
value_string[BUF_SIZE - 1] = '\0';
@@ -1508,7 +1508,7 @@ void makeAutosaveFileFromDbInfo(char *fileBaseName, char *info_name)
15081508
for (pend = pbegin; *pend && !isspace((int)*pend); pend++) {}
15091509
/* pend points to whitespace or \0 */
15101510

1511-
flen = pend - pbegin;
1511+
flen = (int)(pend - pbegin);
15121512
if (flen >= sizeof(field) - 1) flen = sizeof(field) - 1;
15131513
memcpy(field, pbegin, flen);
15141514
field[flen] = '\0';

asApp/src/os/WIN32/osdNfs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
/* definition except for vxWorks */
1717
#define OK 0
18+
#undef ERROR /* ERROR is defined by Windows in wingdi.h */
1819
#define ERROR -1
1920
#define logMsg errlogPrintf
2021

asApp/src/save_restore.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@
178178
#define SET_FILE_PERMISSIONS 1
179179

180180
#ifdef _WIN32
181+
#undef SET_FILE_PERMISSIONS
181182
#define SET_FILE_PERMISSIONS 0
182183
#endif
183184

@@ -598,7 +599,7 @@ STATIC void on_change_timer(CALLBACK *pcallback)
598599
STATIC void on_change_save(struct event_handler_args event)
599600
{
600601
struct chlist *plist;
601-
if (save_restoreDebug >= 10) { logMsg("on_change_save: event.usr=0x%lx\n", (unsigned long)event.usr); }
602+
if (save_restoreDebug >= 10) { logMsg("on_change_save: event.usr=0x%llx\n", (unsigned long long)event.usr); }
602603
plist = (struct chlist *)event.usr;
603604

604605
if (plist) {
@@ -2362,7 +2363,7 @@ STATIC int create_data_set(char *filename, /* save set request file
23622363
while ((plist->save_file[inx] != 0) && (plist->save_file[inx] != '.') && (inx < (FN_LEN-6))) inx++;
23632364
#else
23642365
/* fix bfr 2007-10-01: need to search for last '.', not first */
2365-
inx = strlen(plist->save_file) - 1;
2366+
inx = (int)strlen(plist->save_file) - 1;
23662367
while (inx > 0 && plist->save_file[inx] != '.') inx--;
23672368
#endif
23682369
plist->save_file[inx] = 0; /* truncate if necessary to leave room for ".sav" + null */
@@ -2502,8 +2503,8 @@ int set_requestfile_path(char *path, char *pathsub)
25022503
char fullpath[MAX_PATH_LEN + 1] = "";
25032504
int path_len = 0, pathsub_len = 0;
25042505

2505-
if (path && *path) path_len = strlen(path);
2506-
if (pathsub && *pathsub) pathsub_len = strlen(pathsub);
2506+
if (path && *path) path_len = (int)strlen(path);
2507+
if (pathsub && *pathsub) pathsub_len = (int)strlen(pathsub);
25072508
if (path_len + pathsub_len > (MAX_PATH_LEN - 1)) { /* may have to add '/' */
25082509
printf("save_restore:set_requestfile_path: 'path'+'pathsub' is too long\n");
25092510
return (ERROR);
@@ -3294,7 +3295,7 @@ STATIC int do_manual_restore(char *filename, int file_type, char *macrostring)
32943295
if (bp[strlen(bp) - 1] != '\n') {
32953296
/* No, we didn't. One more read will certainly accumulate a value string of length BUF_SIZE */
32963297
bp = fgets(buffer, BUF_SIZE, inp_fd);
3297-
n = BUF_SIZE - strlen(value_string) - 1;
3298+
n = BUF_SIZE - (int)strlen(value_string) - 1;
32983299
strncat(value_string, bp, n);
32993300
if (value_string[strlen(value_string) - 1] == '\n')
33003301
value_string[strlen(value_string) - 1] = '\0';
@@ -3308,7 +3309,7 @@ STATIC int do_manual_restore(char *filename, int file_type, char *macrostring)
33083309
} else if (ca_pend_io(0.5) != ECA_NORMAL) {
33093310
num_errs++;
33103311
/* Don't forget trailing null character: "strlen(value_string)+1" below */
3311-
} else if (ca_array_put(DBR_CHAR, strlen(value_string) + 1, chanid, value_string) != ECA_NORMAL) {
3312+
} else if (ca_array_put(DBR_CHAR, (unsigned long)strlen(value_string) + 1, chanid, value_string) != ECA_NORMAL) {
33123313
printf("save_restore:do_manual_restore: ca_array_put of '%s' to '%s' failed\n", value_string,
33133314
PVname);
33143315
num_errs++;

asApp/src/verify.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ int do_asVerify_fp(FILE *fp, int verbose, int debug, int write_restore_file, cha
334334
/* No, we didn't. One more read will certainly accumulate a value string of length BUF_SIZE */
335335
if (debug > 3) printf("did not reach end of line for long-string PV\n");
336336
bp = fgets(s, BUF_SIZE, fp);
337-
n = BUF_SIZE - strlen(value_string) - 1;
337+
n = BUF_SIZE - (int)strlen(value_string) - 1;
338338
strncat(value_string, bp, n);
339339
if (value_string[strlen(value_string) - 1] == '\n')
340340
value_string[strlen(value_string) - 1] = '\0';
@@ -376,7 +376,7 @@ int do_asVerify_fp(FILE *fp, int verbose, int debug, int write_restore_file, cha
376376
if (different || (verbose > 0)) {
377377
WRITE_HEADER;
378378
if (is_scalar || is_long_string) {
379-
nspace = 24 - strlen(value_string);
379+
nspace = 24 - (int)strlen(value_string);
380380
if (nspace < 1) nspace = 1;
381381
printf("%s%-24s '%s'%*s'%s'\n", different ? "*** " : " ", PVname, value_string,
382382
nspace, "", svalue);
@@ -461,7 +461,7 @@ static float safeDoubleToFloat(double d)
461461
if (d > 0.0) f = FLT_MIN;
462462
else f = -FLT_MIN;
463463
} else {
464-
f = d;
464+
f = (float)d;
465465
}
466466
return (f);
467467
}

0 commit comments

Comments
 (0)