evas: Fix some CID in generic loaders
authorJean-Philippe Andre <jp.andre@samsung.com>
Wed, 13 Jul 2016 06:21:06 +0000 (15:21 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Wed, 13 Jul 2016 06:21:06 +0000 (15:21 +0900)
Check the return value of fwrite. There is nothing
sensible to do as the receiver needs to handle the error
gracefully.

CID 1356613, 1356614, 1356615, 1356200

src/generic/evas/pdf/main.cpp
src/generic/evas/ps/main.c
src/generic/evas/svg/main.c
src/generic/evas/xcf/main.c

index 8623179..eab137b 100644 (file)
@@ -321,7 +321,12 @@ main(int argc, char **argv)
              // could also to "tmpfile %s\n" like shmfile but just
              // a mmaped tmp file on the system
              printf("data\n");
-             fwrite(data, crop_width * crop_height * sizeof(DATA32), 1, stdout);
+             if (fwrite(data, crop_width * crop_height * sizeof(DATA32), 1, stdout) != 1)
+               {
+                  // nothing much to do, the receiver will simply ignore the
+                  // data as it's too short
+                  D("fwrite failed (%d bytes): %m\n", crop_width * crop_height * sizeof(DATA32));
+               }
           }
         shm_free();
      }
index 48e8a4b..c5b8a18 100644 (file)
@@ -276,7 +276,12 @@ main(int argc, char **argv)
              // could also to "tmpfile %s\n" like shmfile but just
              // a mmaped tmp file on the system
              printf("data\n");
-             fwrite(data, width * height * sizeof(DATA32), 1, stdout);
+             if (fwrite(data, width * height * sizeof(DATA32), 1, stdout) != 1)
+               {
+                  // nothing much to do, the receiver will simply ignore the
+                  // data as it's too short
+                  D("fwrite failed (%d bytes): %m\n", width * height * sizeof(DATA32));
+               }
           }
         shm_free();
      }
index 8c46708..f197330 100644 (file)
@@ -218,7 +218,12 @@ int main(int argc, char **argv)
              else
                {
                   printf("data\n");
-                  fwrite(shm_addr, width * height * sizeof(DATA32), 1, stdout);
+                  if (fwrite(shm_addr, width * height * sizeof(DATA32), 1, stdout) != 1)
+                    {
+                       // nothing much to do, the receiver will simply ignore the
+                       // data as it's too short
+                       //D("fwrite failed (%d bytes): %m\n", width * height * sizeof(DATA32));
+                    }
                }
              shm_free();
           }
index 4de03f8..c5ef6a8 100644 (file)
@@ -1723,7 +1723,12 @@ main(int argc, char **argv)
              // could also to "tmpfile %s\n" like shmfile but just
              // a mmaped tmp file on the system
              printf("data\n");
-             fwrite(image->data, w * h * sizeof(DATA32), 1, stdout);
+             if (fwrite(image->data, w * h * sizeof(DATA32), 1, stdout) != 1)
+             {
+                // nothing much to do, the receiver will simply ignore the
+                // data as it's too short
+                D("fwrite failed (%d bytes): %m\n", w * h * sizeof(DATA32));
+             }
           }
         shm_free();
      }