diff options
Diffstat (limited to 'Build/source/libs/gd/libgd-src/src/gd_filename.c')
-rw-r--r-- | Build/source/libs/gd/libgd-src/src/gd_filename.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/Build/source/libs/gd/libgd-src/src/gd_filename.c b/Build/source/libs/gd/libgd-src/src/gd_filename.c index fd61677d581..d668b01ddf3 100644 --- a/Build/source/libs/gd/libgd-src/src/gd_filename.c +++ b/Build/source/libs/gd/libgd-src/src/gd_filename.c @@ -28,7 +28,7 @@ static void BGD_STDCALL writejpeg(gdImagePtr im, FILE *out) { static void BGD_STDCALL writewbmp(gdImagePtr im, FILE *out) { int fg = gdImageColorClosest(im, 0, 0, 0); - + gdImageWBMP(im, fg, out); }/* writejpeg*/ @@ -61,7 +61,7 @@ static struct FileType { {".jpeg", gdImageCreateFromJpeg, writejpeg, NULL}, #endif -#ifdef HAVE_LIBTIFF +#ifdef HAVE_LIBTIFF {".tiff", gdImageCreateFromTiff, gdImageTiff, NULL}, {".tif" , gdImageCreateFromTiff, gdImageTiff, NULL}, #endif @@ -90,7 +90,7 @@ ftype(const char *filename) { /* Find the file extension (i.e. the last period in the string. */ ext = strrchr(filename, '.'); if (!ext) return NULL; - + for (n = 0; Types[n].ext; n++) { if (strcasecmp(ext, Types[n].ext) == 0) { return &Types[n]; @@ -103,7 +103,7 @@ ftype(const char *filename) { /* Function: gdSupportsFileType - + Tests if a given file type is supported by GD. Given the name of an image file (which does not have to exist), @@ -145,7 +145,7 @@ ftype(const char *filename) { GD_TRUE (1) if the file type is supported, GD_FALSE (0) if not. */ -BGD_DECLARE(int) +BGD_DECLARE(int) gdSupportsFileType(const char *filename, int writing) { struct FileType *entry = ftype(filename); return !!entry && (!writing || !!entry->writer); @@ -159,7 +159,7 @@ gdSupportsFileType(const char *filename, int writing) { Given the path to a file, <gdImageCreateFromFile> will open the file, read its contents with the appropriate _gdImageCreateFrom*_ - function and return it. + function and return it. File type is determined by the filename extension, so having an incorrect extension will probably not work. For example, renaming @@ -179,12 +179,12 @@ gdSupportsFileType(const char *filename, int writing) { */ -BGD_DECLARE(gdImagePtr) +BGD_DECLARE(gdImagePtr) gdImageCreateFromFile(const char *filename) { struct FileType *entry = ftype(filename); FILE *fh; gdImagePtr result; - + if (!entry) return NULL; if (entry->loader) return entry->loader((char *)filename); if (!entry->reader) return NULL; @@ -193,7 +193,7 @@ gdImageCreateFromFile(const char *filename) { if (!fh) return NULL; result = entry->reader(fh); - + fclose(fh); return result; @@ -235,7 +235,7 @@ gdImageCreateFromFile(const char *filename) { */ -BGD_DECLARE(int) +BGD_DECLARE(int) gdImageFile(gdImagePtr im, const char *filename) { struct FileType *entry = ftype(filename); FILE *fh; @@ -251,4 +251,3 @@ gdImageFile(gdImagePtr im, const char *filename) { return GD_TRUE; }/* gdImageFile*/ - |