ret = fscanf(fp, "%s %ld %ld %ld ",
type, &map->width, &map->height, &map->maxcolor);
if (ret < 4) {
- fprintf(stderr, "fscanf: %s\n", strerror(errno));
+ fprintf(stderr, "Invalid PPM file");
retval = FALSE;
goto out;
}
map->bitmap = silc_malloc(map->bitsilc_map_size);
ret = fread(map->bitmap, map->bitsilc_map_size, 1, fp);
if (ret < 0) {
- fprintf(stderr, "fscanf: %s\n", strerror(errno));
+ fprintf(stderr, "fread: %s\n", strerror(errno));
retval = FALSE;
goto out;
}
return 0;
}
+ if (d < 0) {
+ m = (m < 0 ? m : -m);
+ s = (s < 0 ? s : -s);
+ }
+
return ((d < 0 ? -1 : d > 0 ? 1 : 0) *
abs(d) + (m / 60) + (s / 3600));
}