diff options
author | Mike Frysinger <vapier@gentoo.org> | 2018-06-21 21:44:54 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2018-06-21 21:44:54 -0400 |
commit | aac77143ddeb561216d9fe63546d17a1d2156bae (patch) | |
tree | 37e53e5369364f319bc95e3ed708eb5a3266cd17 /tests/jpeg | |
parent | c4ee95d1a403061707c17dcae0343ad059e08d2f (diff) | |
download | libgd-aac77143ddeb561216d9fe63546d17a1d2156bae.tar.gz |
convert all files to native line encodings
A bunch of these files were committed with Windows line encodings.
Strip all those ^M gremlins out as people working on Windows can
use git's autocrlf setting to convert back and forth as needed.
Diffstat (limited to 'tests/jpeg')
-rw-r--r-- | tests/jpeg/bug00338.c | 97 |
1 files changed, 46 insertions, 51 deletions
diff --git a/tests/jpeg/bug00338.c b/tests/jpeg/bug00338.c index 6dbbf07..7874df2 100644 --- a/tests/jpeg/bug00338.c +++ b/tests/jpeg/bug00338.c @@ -1,51 +1,46 @@ -/**
- * Regression test for <https://github.com/libgd/libgd/issues/338>
- *
- * We're testing that reading a JPEG image with gdImageCreateFromJpeg()
- * raises a GD_WARNING for the fatal libjpeg error, but not a GD_ERROR.
- * We also make sure, that the fatal libjpeg error is actually reported.
- *
- * See also ../png/bug00338.c
- */
-
-
-#include <string.h>
-#include "gd.h"
-#include "gd_errors.h"
-#include "gdtest.h"
-
-
-#define MSG "gd-jpeg: JPEG library reports unrecoverable error: %s"
-
-
-static int error_handler_called = 0;
-
-
-static void error_handler(int priority, const char *format, va_list args)
-{
- if (!strcmp(format, MSG)) {
- gdTestAssertMsg(priority == GD_WARNING, "expected priority %d, but got %d", GD_WARNING, priority);
- error_handler_called = 1;
- }
-}
-
-
-int main()
-{
- gdImagePtr im;
- FILE *fp;
-
- gdSetErrorMethod(error_handler);
-
- im = gdImageCreateTrueColor(10, 10);
- fp = gdTestTempFp();
- gdImagePng(im, fp);
- gdImageDestroy(im);
-
- im = gdImageCreateFromJpeg(fp);
- gdTestAssert(im == NULL);
-
- gdTestAssert(error_handler_called);
-
- return gdNumFailures();
-}
+/** + * Regression test for <https://github.com/libgd/libgd/issues/338> + * + * We're testing that reading a JPEG image with gdImageCreateFromJpeg() + * raises a GD_WARNING for the fatal libjpeg error, but not a GD_ERROR. + * We also make sure, that the fatal libjpeg error is actually reported. + * + * See also ../png/bug00338.c + */ + +#include <string.h> +#include "gd.h" +#include "gd_errors.h" +#include "gdtest.h" + +#define MSG "gd-jpeg: JPEG library reports unrecoverable error: %s" + +static int error_handler_called = 0; + +static void error_handler(int priority, const char *format, va_list args) +{ + if (!strcmp(format, MSG)) { + gdTestAssertMsg(priority == GD_WARNING, "expected priority %d, but got %d", GD_WARNING, priority); + error_handler_called = 1; + } +} + +int main() +{ + gdImagePtr im; + FILE *fp; + + gdSetErrorMethod(error_handler); + + im = gdImageCreateTrueColor(10, 10); + fp = gdTestTempFp(); + gdImagePng(im, fp); + gdImageDestroy(im); + + im = gdImageCreateFromJpeg(fp); + gdTestAssert(im == NULL); + + gdTestAssert(error_handler_called); + + return gdNumFailures(); +} |