Revision: 56731
          http://sourceforge.net/p/brlcad/code/56731
Author:   mohitdaga
Date:     2013-08-10 01:05:00 +0000 (Sat, 10 Aug 2013)
Log Message:
-----------
Add wrtting flags to open function in pix_save and bw_save. Also remove 
redundant comments.

Modified Paths:
--------------
    brlcad/trunk/src/libicv/bw.c
    brlcad/trunk/src/libicv/pix.c

Modified: brlcad/trunk/src/libicv/bw.c
===================================================================
--- brlcad/trunk/src/libicv/bw.c        2013-08-09 22:23:37 UTC (rev 56730)
+++ brlcad/trunk/src/libicv/bw.c        2013-08-10 01:05:00 UTC (rev 56731)
@@ -35,6 +35,9 @@
 #include "bn.h"
 #include "icv.h"
 
+
+
+
 /* defined in encoding.c */
 extern HIDDEN double *uchar2double(unsigned char *data, long int size);
 extern HIDDEN unsigned char *data2uchar(const icv_image_t *bif);
@@ -59,8 +62,8 @@
     size = (size_t) bif->height*bif->width;
     
     if(filename==NULL)
-       fd = fileno(stdout); /* for stdout */
-    else if ((fd = open(filename, O_RDONLY, WRMODE)) < 0) {
+       fd = fileno(stdout);
+    else if ((fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, WRMODE)) 
< 0) {
        bu_log("bw_save: Cannot open file for saving\n");
        return -1;
     }
@@ -92,7 +95,7 @@
     size = (size_t) height*width;
 
     if(filename==NULL)
-       fd = fileno(stdin); /* for stdin */
+       fd = fileno(stdin);
     else if ((fd = open(filename, O_RDONLY, WRMODE)) < 0) {
        bu_log("bw_load: Cannot open file for reading\n");
        return NULL;

Modified: brlcad/trunk/src/libicv/pix.c
===================================================================
--- brlcad/trunk/src/libicv/pix.c       2013-08-09 22:23:37 UTC (rev 56730)
+++ brlcad/trunk/src/libicv/pix.c       2013-08-10 01:05:00 UTC (rev 56731)
@@ -56,8 +56,8 @@
     }
     
     if(filename==NULL)
-       fd = fileno(stdout); /* for stdout */
-    else if ((fd = open(filename, O_RDONLY, WRMODE)) < 0) {
+       fd = fileno(stdout);
+    else if ((fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, WRMODE)) 
< 0) {
        bu_log("pix_save: Cannot open file for saving\n");
        return -1;
     }
@@ -91,7 +91,7 @@
     size = (size_t) height*width*3;
 
     if(filename == NULL)
-       fd = fileno(stdin); /* for stdin */
+       fd = fileno(stdin);
     else if ((fd = open(filename, O_RDONLY, WRMODE))<0) {
        bu_log("bw_load: Cannot open file for reading\n");
        return NULL;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to