Revision: 76546
http://sourceforge.net/p/brlcad/code/76546
Author: brlcad
Date: 2020-07-28 06:20:40 +0000 (Tue, 28 Jul 2020)
Log Message:
-----------
use fileno instead of assuming
Modified Paths:
--------------
brlcad/trunk/src/util/pixtile.c
Modified: brlcad/trunk/src/util/pixtile.c
===================================================================
--- brlcad/trunk/src/util/pixtile.c 2020-07-28 05:47:55 UTC (rev 76545)
+++ brlcad/trunk/src/util/pixtile.c 2020-07-28 06:20:40 UTC (rev 76546)
@@ -124,7 +124,7 @@
if (!get_args(argc, argv)) {
(void)fputs(usage, stderr);
- bu_exit (1, NULL);
+ bu_exit(1, NULL);
}
if (bu_optind+1 == argc) {
@@ -138,7 +138,7 @@
if (file_width < 1) {
fprintf(stderr, "pixtile: width of %d out of range\n", file_width);
- bu_exit (12, NULL);
+ bu_exit(12, NULL);
}
scanbytes = file_width * 3;
@@ -156,7 +156,7 @@
if ((obuf = (char *)malloc(swathbytes)) == (char *)0) {
fprintf(stderr, "pixtile: malloc %d failure\n", swathbytes);
- bu_exit (10, NULL);
+ bu_exit(10, NULL);
}
image = 0;
@@ -173,7 +173,7 @@
if (image >= maximage) {
fprintf(stderr, "\npixtile: frame full\n");
/* All swaths already written out */
- bu_exit (0, NULL);
+ bu_exit(0, NULL);
}
fprintf(stderr, "%d ", framenumber); fflush(stdout);
if (is_stream) {
@@ -189,7 +189,7 @@
}
ifname = bu_file_realpath(name, NULL);
- if ((fd=open(ifname, 0))<0) {
+ if ((fd=open(ifname, O_RDONLY|O_BINARY))<0) {
perror(ifname);
bu_free(ifname, "ifname alloc from bu_file_realpath");
goto done;
@@ -211,9 +211,10 @@
break;
}
}
- if (fd > 0) close(fd);
+ if (fd > 0)
+ close(fd);
}
- ret = write(1, obuf, swathbytes);
+ ret = write(fileno(stdout), obuf, swathbytes);
if (ret < 0)
perror("write");
@@ -222,7 +223,7 @@
done:
/* Flush partial frame? */
if (rel != 0) {
- ret = write(1, obuf, swathbytes);
+ ret = write(fileno(stdout), obuf, swathbytes);
if (ret < 0)
perror("write");
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits