Author: spouliot
Date: 2007-01-19 14:22:33 -0500 (Fri, 19 Jan 2007)
New Revision: 71360

Modified:
   trunk/libgdiplus/src/ChangeLog
   trunk/libgdiplus/src/bitmap.c
   trunk/libgdiplus/src/image.c
Log:
2007-01-19  Sebastien Pouliot  <[EMAIL PROTECTED]> 

        * bitmap.c: Fix GdipLoadImageFromFile to return OutOfMemory (like MS
        GDI+) when the file isn't found.
        * image.c: Change GdipCreateBitmapFromFile[ICM] to still return (see
        previous fix) InvalidParameter if the file isn't found (again to match
        MS GDI+). Not sure why FileNotFound was defined as an error code :-|



Modified: trunk/libgdiplus/src/ChangeLog
===================================================================
--- trunk/libgdiplus/src/ChangeLog      2007-01-19 19:16:31 UTC (rev 71359)
+++ trunk/libgdiplus/src/ChangeLog      2007-01-19 19:22:33 UTC (rev 71360)
@@ -1,3 +1,11 @@
+2007-01-19  Sebastien Pouliot  <[EMAIL PROTECTED]> 
+
+       * bitmap.c: Fix GdipLoadImageFromFile to return OutOfMemory (like MS
+       GDI+) when the file isn't found.
+       * image.c: Change GdipCreateBitmapFromFile[ICM] to still return (see
+       previous fix) InvalidParameter if the file isn't found (again to match
+       MS GDI+). Not sure why FileNotFound was defined as an error code :-|
+
 2007-01-19  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * graphics.c: Remove extern declaration for gdip_get_cairo_filter

Modified: trunk/libgdiplus/src/bitmap.c
===================================================================
--- trunk/libgdiplus/src/bitmap.c       2007-01-19 19:16:31 UTC (rev 71359)
+++ trunk/libgdiplus/src/bitmap.c       2007-01-19 19:22:33 UTC (rev 71360)
@@ -764,13 +764,17 @@
 GpStatus
 GdipCreateBitmapFromFile (GDIPCONST WCHAR* filename, GpBitmap **bitmap)
 {
-       return GdipLoadImageFromFile (filename, (GpImage **) bitmap);
+       GpStatus status = GdipLoadImageFromFile (filename, (GpImage **) bitmap);
+       if (status == OutOfMemory)
+               status = InvalidParameter;
+       return status;
 }
 
 /* coverity[+alloc : arg-*1] */
 GpStatus 
 GdipCreateBitmapFromFileICM (GDIPCONST WCHAR* filename, GpBitmap **bitmap)
 {
+       /* ICM isn't supported */
        return GdipCreateBitmapFromFile (filename, bitmap);
 }
 

Modified: trunk/libgdiplus/src/image.c
===================================================================
--- trunk/libgdiplus/src/image.c        2007-01-19 19:16:31 UTC (rev 71359)
+++ trunk/libgdiplus/src/image.c        2007-01-19 19:22:33 UTC (rev 71360)
@@ -112,7 +112,7 @@
        case Format32bppRgb:
                break;
        default:
-               return GenericError;
+               return OutOfMemory;
        }
 
        surface = cairo_image_surface_create_for_data ((unsigned char *) 
image->active_bitmap->scan0, image->cairo_format,
@@ -647,7 +647,7 @@
        fp = fopen(file_name, "rb");
        if (fp == NULL) {
                GdipFree (file_name);
-               return InvalidParameter;
+               return OutOfMemory;
        }
        
        format_peek_sz = fread (format_peek, 1, 10, fp);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to