char *eos(char *); /* also used by dlb.c */
FILE *fopen_datafile(const char *, const char *);
unsigned FITSuint_(unsigned long long, const char *, int);
+unsigned Strlen_(const char *, const char *, int);
#ifdef DLB
#ifdef DLBLIB
if (remainder > (long) sizeof(buf))
r = (int) sizeof(buf);
else
- r = remainder;
+ r = (int) remainder;
- n = fread(buf, 1, r, lib.fdata);
+ n = (int) fread(buf, 1, r, lib.fdata);
if (n != r) {
printf("Read Error in '%s'\n", lib.dir[i].fname);
xexit(EXIT_FAILURE);
for (; ap < argc; ap++, nfiles++) {
if (nfiles == ldlimit)
grow_ld(&ld, &ldlimit, DLB_FILES_ALLOC / 5);
- ld[nfiles].fname = (char *) alloc(strlen(argv[ap]) + 1);
+ ld[nfiles].fname = (char *) alloc(Strlen(argv[ap]) + 1);
Strcpy(ld[nfiles].fname, argv[ap]);
}
}
if (nfiles == ldlimit)
grow_ld(&ld, &ldlimit, DLB_FILES_ALLOC / 5);
*(eos(buf) - 1) = '\0'; /* strip newline */
- ld[nfiles].fname = (char *) alloc(strlen(buf) + 1);
+ ld[nfiles].fname = (char *) alloc((int)strlen(buf) + 1);
Strcpy(ld[nfiles].fname, buf);
}
fclose(list);
printf("%s\n", ld[i].fname);
fsiz = 0L;
- while ((r = read(fd, buf, sizeof buf)) != 0) {
+ while ((r = (int) read(fd, buf, sizeof buf)) != 0) {
if (r == -1) {
printf("Read Error in '%s'\n", ld[i].fname);
xexit(EXIT_FAILURE);
}
return (unsigned)i;
}
+
+ /* ditto */
+unsigned
+Strlen_(const char *str, const char *file, int line){
+ size_t len = strnlen(str, LARGEST_INT);
+
+ if (len == LARGEST_INT) {
+ printf("%s:%d string too long", file, line);
+ xexit(EXIT_FAILURE);
+ }
+ return (unsigned) len;
+}
/*dlb_main.c*/