Author: fredkiefer
Date: Sat Oct 24 23:16:46 2015
New Revision: 39090

URL: http://svn.gna.org/viewcvs/gnustep?rev=39090&view=rev
Log:
        * Source/NSBitmapImageRep.m
        (TIFFRepresentationOfImageRepsInArray:): Only return a non-null
        NSData object.

Modified:
    libs/gui/trunk/ChangeLog
    libs/gui/trunk/Source/NSBitmapImageRep.m

Modified: libs/gui/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/ChangeLog?rev=39090&r1=39089&r2=39090&view=diff
==============================================================================
--- libs/gui/trunk/ChangeLog    (original)
+++ libs/gui/trunk/ChangeLog    Sat Oct 24 23:16:46 2015
@@ -1,3 +1,9 @@
+2015-10-24 Fred Kiefer <[email protected]>
+
+       * Source/NSBitmapImageRep.m
+       (TIFFRepresentationOfImageRepsInArray:): Only return a non-null
+       NSData object.
+
 2015-10-22 Fred Kiefer <[email protected]>
 
        * Source/NSWindowController.m (-_windowWillClose:): Don't unset

Modified: libs/gui/trunk/Source/NSBitmapImageRep.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/trunk/Source/NSBitmapImageRep.m?rev=39090&r1=39089&r2=39090&view=diff
==============================================================================
--- libs/gui/trunk/Source/NSBitmapImageRep.m    (original)
+++ libs/gui/trunk/Source/NSBitmapImageRep.m    Sat Oct 24 23:16:46 2015
@@ -1380,6 +1380,7 @@
   char *bytes = 0;
   long length = 0;
   int num = 0;
+  NSData *data;
 
   image = NSTiffOpenDataWrite(&bytes, &length);
   if (image == 0)
@@ -1412,7 +1413,17 @@
     }
 
   NSTiffClose(image);
-  return [NSData dataWithBytesNoCopy: bytes length: length];
+  data = [NSData dataWithBytesNoCopy: bytes length: length];
+  if (num > 0)
+    {
+      return data;
+    }
+  else
+    {
+      // FIXME: Not sure wether this is the correct behaviour, at least it was
+      // the old one of this method.
+      return nil;
+    }
 }
 
 /** Produces an NSData object containing a TIFF representation of all
@@ -1429,6 +1440,8 @@
   TIFF *image;
   char *bytes = 0;
   long length = 0;
+  int num = 0;
+  NSData *data;
 
   image = NSTiffOpenDataWrite(&bytes, &length);
   if (image == 0)
@@ -1444,6 +1457,9 @@
           [(NSBitmapImageRep*)rep _fillTIFFInfo: &info
                                usingCompression: compression
                                          factor: factor];
+          info.imageNumber = num++;
+          info.numImages = [anArray count];
+          info.subfileType = FILETYPE_PAGE;
           if (NSTiffWrite(image, &info, [(NSBitmapImageRep*)rep bitmapData]) 
!= 0)
             {
               [NSException raise: NSTIFFException format: @"Writing data"];
@@ -1452,7 +1468,17 @@
     }
 
   NSTiffClose(image);
-  return [NSData dataWithBytesNoCopy: bytes length: length];
+  data = [NSData dataWithBytesNoCopy: bytes length: length];
+  if (num > 0)
+    {
+      return data;
+    }
+  else
+    {
+      // FIXME: Not sure wether this is the correct behaviour, at least it was
+      // the old one of this method.
+      return nil;
+    }
 }
 
 /** Returns an NSData object containing a TIFF representation of the


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to