summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2018-06-21 21:44:54 -0400
committerMike Frysinger <vapier@gentoo.org>2018-06-21 21:44:54 -0400
commitaac77143ddeb561216d9fe63546d17a1d2156bae (patch)
tree37e53e5369364f319bc95e3ed708eb5a3266cd17
parentc4ee95d1a403061707c17dcae0343ad059e08d2f (diff)
downloadlibgd-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.
-rw-r--r--appveyor.yml414
-rw-r--r--cmake/modules/FindPTHREAD.cmake184
-rw-r--r--tests/gd2/bug00209.c54
-rw-r--r--tests/gd2/bug00354.c62
-rw-r--r--tests/gdimagebrightness/basic.c78
-rw-r--r--tests/gdimagecolor/basic.c56
-rw-r--r--tests/gdimagecontrast/basic.c78
-rw-r--r--tests/gdimageconvolution/basic.c117
-rw-r--r--tests/gdimagecreate/bug00340.c62
-rw-r--r--tests/gdimagefile/gdnametest.c236
-rw-r--r--tests/gdimagefilledpolygon/self_intersecting.c60
-rw-r--r--tests/gdimageflip/gdimageflip.c71
-rw-r--r--tests/gdimagegrayscale/basic.c56
-rw-r--r--tests/gdimageline/bug00315.c76
-rw-r--r--tests/gdimagenegate/basic.c56
-rw-r--r--tests/gdimagerotate/php_bug_65070.c68
-rw-r--r--tests/gdimagescale/bug00329.c103
-rw-r--r--tests/gdimagescale/bug00330.c62
-rw-r--r--tests/gdimagesetpixel/alpha_blending.c106
-rw-r--r--tests/jpeg/bug00338.c97
-rw-r--r--tests/png/bug00338.c93
-rw-r--r--tests/tiff/tiff_dpi.c152
-rw-r--r--tests/tiff/tiff_im2im.c128
-rw-r--r--tests/tiff/tiff_null.c28
-rw-r--r--tests/tiff/tiff_read_bw.c51
-rw-r--r--tests/xbm/github_bug_109.c68
-rw-r--r--tests/xbm/x10_basic_read.c62
-rw-r--r--windows/gentest.bat70
-rw-r--r--windows/readme.md106
-rw-r--r--windows/run_tests.bat86
30 files changed, 1438 insertions, 1502 deletions
diff --git a/appveyor.yml b/appveyor.yml
index 70a2b62..268fcef 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,207 +1,207 @@
-version: 2.1.1.{build}
-shallow_clone: true
-
-
-environment:
- # settings
- min_build: 0 # if 1 overwrites tbs_gd_* flags to leave png and jpeg
-
- tbs_gd_png: 1
- tbs_gd_jpeg: 1
- tbs_gd_freetype: 1
- tbs_gd_iconv: 0 # todo: add iconv thumbs
- tbs_gd_tiff: 1
-
- build_bindings: 1 # build .net bidnings
- pack_dlls: 1 # pack dll with upx
-
-
- matrix:
- - tbs_arch: "x86"
- tbs_tools: "msvc12"
- tbs_static_runtime: 0
-
- - tbs_arch: "x64"
- tbs_tools: "msvc12"
- tbs_static_runtime: 0
-
- - tbs_arch: "x86"
- tbs_tools: "mingw"
- tbs_static_runtime: 1
-
- - tbs_arch: "x64"
- tbs_tools: "mingw"
- tbs_static_runtime: 1
-
-
-
-install:
- - if [%min_build%]==[1] (
- SET tbs_gd_png=1&&
- SET tbs_gd_jpeg=1&&
- SET tbs_gd_freetype=0&&
- SET tbs_gd_iconv=0&&
- SET tbs_gd_tiff=0)
-
- - ps: if($env:build_platform -eq 'x64') {
- $env:vcvar_arg = 'x86_amd64';
- }
- else {
- $env:vcvar_arg = 'x86';
- }
-
- - ps: 'function prepend($file, $line) { Set-Content (Resolve-Path $file) -value $line,(Get-Content (Resolve-Path $file)) }'
-
- # get common functions
- - git clone https://github.com/imazen/gd-appveyor-helpers
- - ps: . .\gd-appveyor-helpers\appveyor_funcs.ps1
-
-
- # fetch deps
- - mkdir deps
- - ps: if($env:build_bindings -eq 1) { invoke 'git' 'clone https://github.com/imazen/gd-dotnet-bindings-generator.git --depth 1' }
-
- - nuget install zlib-%tbs_tools%-%tbs_arch%-master -Source https://ci.appveyor.com/nuget/zlib-94hmpf3q011d
- - ps: move zlib*\* deps -force
- - if [%tbs_tools%]==[mingw] move deps\libzlibstatic.a deps\libz.a
- - if [%tbs_tools%]==[msvc12] move deps\zlibstatic.lib deps\zlib.lib
- - SET tbsd_zlib_built=1
- - SET tbsd_zlib_incdir=deps
- - SET tbsd_zlib_libdir=deps
-
- - if [%tbs_gd_jpeg%]==[1] (
- nuget install libjpeg-%tbs_tools%-%tbs_arch%-master -Source https://ci.appveyor.com/nuget/libjpeg-turbo-t70qw53csfhj &&
- powershell -Command "move libjpeg*\* deps -force" &&
- (if [%tbs_tools%]==[msvc12] move deps\jpeg_static.lib deps\jpeg.lib) &&
- SET tbsd_libjpeg_turbo_built=1)
-
- - if [%tbs_gd_png%]==[1] (
- nuget install libpng-%tbs_tools%-%tbs_arch%-master -Source https://ci.appveyor.com/nuget/libpng-7hwq4pmmrc48 &&
- powershell -Command "move libpng*\* deps -force" &&
- (if [%tbs_tools%]==[mingw] move deps\libpng16.a deps\libpng.a) &&
- (if [%tbs_tools%]==[msvc12] move deps\libpng16_static.lib deps\png.lib) &&
- SET tbsd_libpng_built=1)
-
- - if [%tbs_gd_freetype%]==[1] (
- nuget install freetype-%tbs_tools%-%tbs_arch%-master -Source https://ci.appveyor.com/nuget/freetype-vf7bw7v5ec29 &&
- powershell -Command "move freetype*\* deps -force" &&
- (if [%tbs_tools%]==[msvc12] move deps\freetype_static.lib deps\freetype.lib) &&
- SET tbsd_freetype_built=1)
-
- - if [%tbs_gd_tiff%]==[1] (
- nuget install libtiff-%tbs_tools%-%tbs_arch%-master -Source https://ci.appveyor.com/nuget/libtiff-i3h8tqqy7o7b &&
- powershell -Command "move libtiff*\* deps -force" &&
- (if [%tbs_tools%]==[msvc12] move deps\tiff_static.lib deps\tiff.lib) &&
- SET tbsd_libtiff_built=1)
-
- # remove dyn libs
- - del deps\*.dll*
-
-
-
- # get upx (cinst broken; gets dos ver)
- #- if [%pack_dlls%]==[1] cinst upx
- - if [%pack_dlls%]==[1] (
- curl -L -o upx.zip http://upx.sourceforge.net/download/upx391w.zip &&
- 7z e upx.zip *.exe -r )
-
- # get mingw-w64-dgn (C:\mingw64)
- - ps: if($env:tbs_tools -eq 'mingw' -and $env:tbs_arch -eq 'x64') {
- invoke 'curl' '-L -o mw64.7z "http://libgd.blob.core.windows.net/mingw/mingw-w64-dgn-x86_64-20141001.7z"';
- invoke '7z' 'x -oC:\ mw64.7z'; }
-
- # get mingw-w64-32bit (C:\mingw32)
- - ps: if($env:tbs_tools -eq 'mingw' -and $env:tbs_arch -eq 'x86' -and $env:build_bindings -eq 1) {
- invoke 'curl' '-L -o mw64-32.7z "http://libgd.blob.core.windows.net/mingw/i686-4.9.1-release-posix-dwarf-rt_v3-rev1.7z"';
- invoke '7z' 'x -oC:\ mw64-32.7z'; }
-
-
-
-
-build_script:
- - '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall" %vcvar_arg%'
- - if [%tbs_tools%]==[mingw] if [%tbs_arch%]==[x86] SET PATH=C:\mingw\bin;%PATH%
- - if [%tbs_tools%]==[mingw] if [%tbs_arch%]==[x64] SET PATH=C:\mingw64\bin;%PATH%
-
- - SET zip=libgd-%tbs_tools%-%tbs_arch%.zip
- - ps: $nupkg_b = "libgd-$($env:tbs_tools)-$($env:tbs_arch)-$($env:APPVEYOR_REPO_BRANCH)";
- - ps: $nupkg_c = "libgd-$($env:tbs_tools)-$($env:tbs_arch)-$($env:APPVEYOR_REPO_COMMIT)";
-
- - if [%tbs_arch%]==[x86] SET dll_make=C:\mingw32\bin\mingw32-make.exe
- - if [%tbs_arch%]==[x64] SET dll_make=C:\mingw64\bin\mingw32-make.exe
-
- - for /f "tokens=*" %%i in ('thumbs list_bin') do set dll_name=%%i
- - SET dll_name=%dll_name:/=\%
- - for /f %%i in ("%dll_name%") do set dll_basename=%%~nxi
- - SET dll_raw=%dll_name%.raw
- - if [%tbs_tools%]==[msvc12] SET cli_args=%dll_basename%
- - if [%tbs_tools%]==[mingw] SET cli_args=%dll_make% %dll_basename%
-
- - thumbs make
- - for /f "tokens=*" %%i in ('thumbs list') do set files=%%i
-
- - copy %dll_name% %dll_raw%
- - if [%pack_dlls%]==[1] (
- appveyor PushArtifact %dll_raw% &&
- del %dll_name% &&
- upx -o %dll_name% %dll_raw% )
-
- - 7z a %zip% %files%
- - appveyor PushArtifact %zip%
-
- - ps: if(Test-Path $env:zip) {
- zip2nuget $env:zip $nupkg_b;
- zip2nuget $env:zip $nupkg_c; }
-
-
- # build bindings
-
- - ps: if($env:with_tiff -eq 0 -and $env:build_bindings -eq 1) {
- prepend 'gd-dotnet-bindings-generator\LibGD.CLI\LibGDExtensions.cs' '#define NO_TIFF';
- $env:test_defs += 'NO_TIFF;' }
- - ps: if($env:with_freetype -eq 0 -and $env:build_bindings -eq 1) {
- prepend 'gd-dotnet-bindings-generator\LibGD.CLI\LibGDExtensions.cs' '#define NO_FREETYPE';
- $env:test_defs += 'NO_FREETYPE;' }
-
- - '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall"'
- - if [%build_bindings%]==[1] (
- cd gd-dotnet-bindings-generator &&
- msbuild LibGD.CLI\LibGD.CLI.csproj /p:Configuration=Debug /p:Platform=AnyCPU /v:m &&
- copy ..\%dll_raw% LibGD.CLI\bin\Debug\%dll_basename% &&
- cd LibGD.CLI\bin\Debug &&
- LibGD.CLI.exe %APPVEYOR_BUILD_FOLDER%\src %cli_args% &&
- cd ..\..\.. &&
- msbuild LibGD.Tests\LibGD.Tests.csproj /p:Configuration=Debug /p:Platform=AnyCPU /p:DefineConstants="%test_defs%" /v:m &&
- cd..)
-
- - SET zip=LibGDSharp-%tbs_tools%-%tbs_arch%.zip
- - ps: if($env:build_bindings -eq 1) {
- invoke '7z' "a $($env:zip)
- .\$($env:dll_pack)
- .\gd-dotnet-bindings-generator\LibGD.CLI\bin\Debug\_iobuf.cs
- .\gd-dotnet-bindings-generator\LibGD.CLI\bin\Debug\LibGD.cs
- .\gd-dotnet-bindings-generator\LibGD.CLI\bin\Debug\LibGDExtensions.cs
- .\gd-dotnet-bindings-generator\LibGD.CLI\bin\Debug\LibGDSharp.dll";
- Push-AppveyorArtifact $($env:zip); }
-
- - appveyor PushArtifact src\config.h
-
-
-
-
-test_script:
- - SET fail=0
- - thumbs check || SET fail=1 & ver > nul
- - ps: Push-Ctest-Results 'build'
- - ps: Push-AppveyorArtifact build\Testing\Temporary\LastTest.log
- - exit %fail%
-
- - if [%build_bindings%]==[1] (
- copy %dll_name% gd-dotnet-bindings-generator\LibGD.Tests\bin\Debug\%dll_basename% &&
- (if [%tbs_arch%]==[x86] (nunit-console-x86 gd-dotnet-bindings-generator\LibGD.Tests\bin\Debug\LibGD.Tests.dll)
- else if [%tbs_arch%]==[x64] (nunit-console gd-dotnet-bindings-generator\LibGD.Tests\bin\Debug\LibGD.Tests.dll)) &&
- appveyor PushArtifact TestResult.xml )
-
-on_success:
- - ps: Push-AppveyorArtifact "$nupkg_b*.nupkg"
- - ps: Push-AppveyorArtifact "$nupkg_c*.nupkg"
+version: 2.1.1.{build}
+shallow_clone: true
+
+
+environment:
+ # settings
+ min_build: 0 # if 1 overwrites tbs_gd_* flags to leave png and jpeg
+
+ tbs_gd_png: 1
+ tbs_gd_jpeg: 1
+ tbs_gd_freetype: 1
+ tbs_gd_iconv: 0 # todo: add iconv thumbs
+ tbs_gd_tiff: 1
+
+ build_bindings: 1 # build .net bidnings
+ pack_dlls: 1 # pack dll with upx
+
+
+ matrix:
+ - tbs_arch: "x86"
+ tbs_tools: "msvc12"
+ tbs_static_runtime: 0
+
+ - tbs_arch: "x64"
+ tbs_tools: "msvc12"
+ tbs_static_runtime: 0
+
+ - tbs_arch: "x86"
+ tbs_tools: "mingw"
+ tbs_static_runtime: 1
+
+ - tbs_arch: "x64"
+ tbs_tools: "mingw"
+ tbs_static_runtime: 1
+
+
+
+install:
+ - if [%min_build%]==[1] (
+ SET tbs_gd_png=1&&
+ SET tbs_gd_jpeg=1&&
+ SET tbs_gd_freetype=0&&
+ SET tbs_gd_iconv=0&&
+ SET tbs_gd_tiff=0)
+
+ - ps: if($env:build_platform -eq 'x64') {
+ $env:vcvar_arg = 'x86_amd64';
+ }
+ else {
+ $env:vcvar_arg = 'x86';
+ }
+
+ - ps: 'function prepend($file, $line) { Set-Content (Resolve-Path $file) -value $line,(Get-Content (Resolve-Path $file)) }'
+
+ # get common functions
+ - git clone https://github.com/imazen/gd-appveyor-helpers
+ - ps: . .\gd-appveyor-helpers\appveyor_funcs.ps1
+
+
+ # fetch deps
+ - mkdir deps
+ - ps: if($env:build_bindings -eq 1) { invoke 'git' 'clone https://github.com/imazen/gd-dotnet-bindings-generator.git --depth 1' }
+
+ - nuget install zlib-%tbs_tools%-%tbs_arch%-master -Source https://ci.appveyor.com/nuget/zlib-94hmpf3q011d
+ - ps: move zlib*\* deps -force
+ - if [%tbs_tools%]==[mingw] move deps\libzlibstatic.a deps\libz.a
+ - if [%tbs_tools%]==[msvc12] move deps\zlibstatic.lib deps\zlib.lib
+ - SET tbsd_zlib_built=1
+ - SET tbsd_zlib_incdir=deps
+ - SET tbsd_zlib_libdir=deps
+
+ - if [%tbs_gd_jpeg%]==[1] (
+ nuget install libjpeg-%tbs_tools%-%tbs_arch%-master -Source https://ci.appveyor.com/nuget/libjpeg-turbo-t70qw53csfhj &&
+ powershell -Command "move libjpeg*\* deps -force" &&
+ (if [%tbs_tools%]==[msvc12] move deps\jpeg_static.lib deps\jpeg.lib) &&
+ SET tbsd_libjpeg_turbo_built=1)
+
+ - if [%tbs_gd_png%]==[1] (
+ nuget install libpng-%tbs_tools%-%tbs_arch%-master -Source https://ci.appveyor.com/nuget/libpng-7hwq4pmmrc48 &&
+ powershell -Command "move libpng*\* deps -force" &&
+ (if [%tbs_tools%]==[mingw] move deps\libpng16.a deps\libpng.a) &&
+ (if [%tbs_tools%]==[msvc12] move deps\libpng16_static.lib deps\png.lib) &&
+ SET tbsd_libpng_built=1)
+
+ - if [%tbs_gd_freetype%]==[1] (
+ nuget install freetype-%tbs_tools%-%tbs_arch%-master -Source https://ci.appveyor.com/nuget/freetype-vf7bw7v5ec29 &&
+ powershell -Command "move freetype*\* deps -force" &&
+ (if [%tbs_tools%]==[msvc12] move deps\freetype_static.lib deps\freetype.lib) &&
+ SET tbsd_freetype_built=1)
+
+ - if [%tbs_gd_tiff%]==[1] (
+ nuget install libtiff-%tbs_tools%-%tbs_arch%-master -Source https://ci.appveyor.com/nuget/libtiff-i3h8tqqy7o7b &&
+ powershell -Command "move libtiff*\* deps -force" &&
+ (if [%tbs_tools%]==[msvc12] move deps\tiff_static.lib deps\tiff.lib) &&
+ SET tbsd_libtiff_built=1)
+
+ # remove dyn libs
+ - del deps\*.dll*
+
+
+
+ # get upx (cinst broken; gets dos ver)
+ #- if [%pack_dlls%]==[1] cinst upx
+ - if [%pack_dlls%]==[1] (
+ curl -L -o upx.zip http://upx.sourceforge.net/download/upx391w.zip &&
+ 7z e upx.zip *.exe -r )
+
+ # get mingw-w64-dgn (C:\mingw64)
+ - ps: if($env:tbs_tools -eq 'mingw' -and $env:tbs_arch -eq 'x64') {
+ invoke 'curl' '-L -o mw64.7z "http://libgd.blob.core.windows.net/mingw/mingw-w64-dgn-x86_64-20141001.7z"';
+ invoke '7z' 'x -oC:\ mw64.7z'; }
+
+ # get mingw-w64-32bit (C:\mingw32)
+ - ps: if($env:tbs_tools -eq 'mingw' -and $env:tbs_arch -eq 'x86' -and $env:build_bindings -eq 1) {
+ invoke 'curl' '-L -o mw64-32.7z "http://libgd.blob.core.windows.net/mingw/i686-4.9.1-release-posix-dwarf-rt_v3-rev1.7z"';
+ invoke '7z' 'x -oC:\ mw64-32.7z'; }
+
+
+
+
+build_script:
+ - '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall" %vcvar_arg%'
+ - if [%tbs_tools%]==[mingw] if [%tbs_arch%]==[x86] SET PATH=C:\mingw\bin;%PATH%
+ - if [%tbs_tools%]==[mingw] if [%tbs_arch%]==[x64] SET PATH=C:\mingw64\bin;%PATH%
+
+ - SET zip=libgd-%tbs_tools%-%tbs_arch%.zip
+ - ps: $nupkg_b = "libgd-$($env:tbs_tools)-$($env:tbs_arch)-$($env:APPVEYOR_REPO_BRANCH)";
+ - ps: $nupkg_c = "libgd-$($env:tbs_tools)-$($env:tbs_arch)-$($env:APPVEYOR_REPO_COMMIT)";
+
+ - if [%tbs_arch%]==[x86] SET dll_make=C:\mingw32\bin\mingw32-make.exe
+ - if [%tbs_arch%]==[x64] SET dll_make=C:\mingw64\bin\mingw32-make.exe
+
+ - for /f "tokens=*" %%i in ('thumbs list_bin') do set dll_name=%%i
+ - SET dll_name=%dll_name:/=\%
+ - for /f %%i in ("%dll_name%") do set dll_basename=%%~nxi
+ - SET dll_raw=%dll_name%.raw
+ - if [%tbs_tools%]==[msvc12] SET cli_args=%dll_basename%
+ - if [%tbs_tools%]==[mingw] SET cli_args=%dll_make% %dll_basename%
+
+ - thumbs make
+ - for /f "tokens=*" %%i in ('thumbs list') do set files=%%i
+
+ - copy %dll_name% %dll_raw%
+ - if [%pack_dlls%]==[1] (
+ appveyor PushArtifact %dll_raw% &&
+ del %dll_name% &&
+ upx -o %dll_name% %dll_raw% )
+
+ - 7z a %zip% %files%
+ - appveyor PushArtifact %zip%
+
+ - ps: if(Test-Path $env:zip) {
+ zip2nuget $env:zip $nupkg_b;
+ zip2nuget $env:zip $nupkg_c; }
+
+
+ # build bindings
+
+ - ps: if($env:with_tiff -eq 0 -and $env:build_bindings -eq 1) {
+ prepend 'gd-dotnet-bindings-generator\LibGD.CLI\LibGDExtensions.cs' '#define NO_TIFF';
+ $env:test_defs += 'NO_TIFF;' }
+ - ps: if($env:with_freetype -eq 0 -and $env:build_bindings -eq 1) {
+ prepend 'gd-dotnet-bindings-generator\LibGD.CLI\LibGDExtensions.cs' '#define NO_FREETYPE';
+ $env:test_defs += 'NO_FREETYPE;' }
+
+ - '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall"'
+ - if [%build_bindings%]==[1] (
+ cd gd-dotnet-bindings-generator &&
+ msbuild LibGD.CLI\LibGD.CLI.csproj /p:Configuration=Debug /p:Platform=AnyCPU /v:m &&
+ copy ..\%dll_raw% LibGD.CLI\bin\Debug\%dll_basename% &&
+ cd LibGD.CLI\bin\Debug &&
+ LibGD.CLI.exe %APPVEYOR_BUILD_FOLDER%\src %cli_args% &&
+ cd ..\..\.. &&
+ msbuild LibGD.Tests\LibGD.Tests.csproj /p:Configuration=Debug /p:Platform=AnyCPU /p:DefineConstants="%test_defs%" /v:m &&
+ cd..)
+
+ - SET zip=LibGDSharp-%tbs_tools%-%tbs_arch%.zip
+ - ps: if($env:build_bindings -eq 1) {
+ invoke '7z' "a $($env:zip)
+ .\$($env:dll_pack)
+ .\gd-dotnet-bindings-generator\LibGD.CLI\bin\Debug\_iobuf.cs
+ .\gd-dotnet-bindings-generator\LibGD.CLI\bin\Debug\LibGD.cs
+ .\gd-dotnet-bindings-generator\LibGD.CLI\bin\Debug\LibGDExtensions.cs
+ .\gd-dotnet-bindings-generator\LibGD.CLI\bin\Debug\LibGDSharp.dll";
+ Push-AppveyorArtifact $($env:zip); }
+
+ - appveyor PushArtifact src\config.h
+
+
+
+
+test_script:
+ - SET fail=0
+ - thumbs check || SET fail=1 & ver > nul
+ - ps: Push-Ctest-Results 'build'
+ - ps: Push-AppveyorArtifact build\Testing\Temporary\LastTest.log
+ - exit %fail%
+
+ - if [%build_bindings%]==[1] (
+ copy %dll_name% gd-dotnet-bindings-generator\LibGD.Tests\bin\Debug\%dll_basename% &&
+ (if [%tbs_arch%]==[x86] (nunit-console-x86 gd-dotnet-bindings-generator\LibGD.Tests\bin\Debug\LibGD.Tests.dll)
+ else if [%tbs_arch%]==[x64] (nunit-console gd-dotnet-bindings-generator\LibGD.Tests\bin\Debug\LibGD.Tests.dll)) &&
+ appveyor PushArtifact TestResult.xml )
+
+on_success:
+ - ps: Push-AppveyorArtifact "$nupkg_b*.nupkg"
+ - ps: Push-AppveyorArtifact "$nupkg_c*.nupkg"
diff --git a/cmake/modules/FindPTHREAD.cmake b/cmake/modules/FindPTHREAD.cmake
index 0627c6d..7846e17 100644
--- a/cmake/modules/FindPTHREAD.cmake
+++ b/cmake/modules/FindPTHREAD.cmake
@@ -1,92 +1,92 @@
-#############################################################################
-#
-# $Id: FindPTHREAD.cmake 4056 2013-01-05 13:04:42Z fspindle $
-#
-# This file is part of the ViSP software.
-# Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
-#
-# This software is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# ("GPL") version 2 as published by the Free Software Foundation.
-# See the file LICENSE.txt at the root directory of this source
-# distribution for additional information about the GNU GPL.
-#
-# For using ViSP with software that can not be combined with the GNU
-# GPL, please contact INRIA about acquiring a ViSP Professional
-# Edition License.
-#
-# See http://www.irisa.fr/lagadic/visp/visp.html for more information.
-#
-# This software was developed at:
-# INRIA Rennes - Bretagne Atlantique
-# Campus Universitaire de Beaulieu
-# 35042 Rennes Cedex
-# France
-# http://www.irisa.fr/lagadic
-#
-# If you have questions regarding the use of this file, please contact
-# INRIA at visp@inria.fr
-#
-# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-#
-# Description:
-# Try to find pthread library.
-# Once run this will define:
-#
-# PTHREAD_FOUND
-# PTHREAD_INCLUDE_DIRS
-# PTHREAD_LIBRARIES
-#
-# Authors:
-# Fabien Spindler
-#
-#############################################################################
-
-
- FIND_PATH(PTHREAD_INCLUDE_DIR pthread.h
- "$ENV{PTHREAD_HOME}/include"
- "$ENV{PTHREAD_DIR}/include"
- /usr/include
- "C:/MinGW/include"
- )
- #MESSAGE("DBG PTHREAD_INCLUDE_DIR=${PTHREAD_INCLUDE_DIR}")
-
- # pthreadVSE pthreadGCE pthreadGC pthreadVC1 pthreadVC2 are comming from web
- FIND_LIBRARY(PTHREAD_LIBRARY
- NAMES pthread pthreadGC2 pthreadVSE pthreadGCE pthreadGC pthreadVC1 pthreadVC2
- PATHS
- "$ENV{PTHREAD_HOME}/lib"
- "$ENV{PTHREAD_DIR}/lib"
- /usr/lib
- /usr/local/lib
- /lib
- "C:/MinGW/lib"
- )
-
- #MESSAGE(STATUS "DBG PTHREAD_LIBRARY=${PTHREAD_LIBRARY}")
-
- ## --------------------------------
-
- IF(PTHREAD_LIBRARY)
- SET(PTHREAD_LIBRARIES ${PTHREAD_LIBRARY})
- ELSE(PTHREAD_LIBRARY)
- #MESSAGE(SEND_ERROR "pthread library not found.")
- ENDIF(PTHREAD_LIBRARY)
-
- IF(NOT PTHREAD_INCLUDE_DIR)
- #MESSAGE(SEND_ERROR "pthread include dir not found.")
- ENDIF(NOT PTHREAD_INCLUDE_DIR)
-
- IF(PTHREAD_LIBRARIES AND PTHREAD_INCLUDE_DIR)
- SET(PTHREAD_INCLUDE_DIRS ${PTHREAD_INCLUDE_DIR})
- SET(PTHREAD_FOUND TRUE)
- ELSE(PTHREAD_LIBRARIES AND PTHREAD_INCLUDE_DIR)
- SET(PTHREAD_FOUND FALSE)
- ENDIF(PTHREAD_LIBRARIES AND PTHREAD_INCLUDE_DIR)
-
- MARK_AS_ADVANCED(
- PTHREAD_INCLUDE_DIR
- PTHREAD_LIBRARY
- )
- #MESSAGE(STATUS "PTHREAD_FOUND : ${PTHREAD_FOUND}")
+#############################################################################
+#
+# $Id: FindPTHREAD.cmake 4056 2013-01-05 13:04:42Z fspindle $
+#
+# This file is part of the ViSP software.
+# Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
+#
+# This software is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# ("GPL") version 2 as published by the Free Software Foundation.
+# See the file LICENSE.txt at the root directory of this source
+# distribution for additional information about the GNU GPL.
+#
+# For using ViSP with software that can not be combined with the GNU
+# GPL, please contact INRIA about acquiring a ViSP Professional
+# Edition License.
+#
+# See http://www.irisa.fr/lagadic/visp/visp.html for more information.
+#
+# This software was developed at:
+# INRIA Rennes - Bretagne Atlantique
+# Campus Universitaire de Beaulieu
+# 35042 Rennes Cedex
+# France
+# http://www.irisa.fr/lagadic
+#
+# If you have questions regarding the use of this file, please contact
+# INRIA at visp@inria.fr
+#
+# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+#
+# Description:
+# Try to find pthread library.
+# Once run this will define:
+#
+# PTHREAD_FOUND
+# PTHREAD_INCLUDE_DIRS
+# PTHREAD_LIBRARIES
+#
+# Authors:
+# Fabien Spindler
+#
+#############################################################################
+
+
+ FIND_PATH(PTHREAD_INCLUDE_DIR pthread.h
+ "$ENV{PTHREAD_HOME}/include"
+ "$ENV{PTHREAD_DIR}/include"
+ /usr/include
+ "C:/MinGW/include"
+ )
+ #MESSAGE("DBG PTHREAD_INCLUDE_DIR=${PTHREAD_INCLUDE_DIR}")
+
+ # pthreadVSE pthreadGCE pthreadGC pthreadVC1 pthreadVC2 are comming from web
+ FIND_LIBRARY(PTHREAD_LIBRARY
+ NAMES pthread pthreadGC2 pthreadVSE pthreadGCE pthreadGC pthreadVC1 pthreadVC2
+ PATHS
+ "$ENV{PTHREAD_HOME}/lib"
+ "$ENV{PTHREAD_DIR}/lib"
+ /usr/lib
+ /usr/local/lib
+ /lib
+ "C:/MinGW/lib"
+ )
+
+ #MESSAGE(STATUS "DBG PTHREAD_LIBRARY=${PTHREAD_LIBRARY}")
+
+ ## --------------------------------
+
+ IF(PTHREAD_LIBRARY)
+ SET(PTHREAD_LIBRARIES ${PTHREAD_LIBRARY})
+ ELSE(PTHREAD_LIBRARY)
+ #MESSAGE(SEND_ERROR "pthread library not found.")
+ ENDIF(PTHREAD_LIBRARY)
+
+ IF(NOT PTHREAD_INCLUDE_DIR)
+ #MESSAGE(SEND_ERROR "pthread include dir not found.")
+ ENDIF(NOT PTHREAD_INCLUDE_DIR)
+
+ IF(PTHREAD_LIBRARIES AND PTHREAD_INCLUDE_DIR)
+ SET(PTHREAD_INCLUDE_DIRS ${PTHREAD_INCLUDE_DIR})
+ SET(PTHREAD_FOUND TRUE)
+ ELSE(PTHREAD_LIBRARIES AND PTHREAD_INCLUDE_DIR)
+ SET(PTHREAD_FOUND FALSE)
+ ENDIF(PTHREAD_LIBRARIES AND PTHREAD_INCLUDE_DIR)
+
+ MARK_AS_ADVANCED(
+ PTHREAD_INCLUDE_DIR
+ PTHREAD_LIBRARY
+ )
+ #MESSAGE(STATUS "PTHREAD_FOUND : ${PTHREAD_FOUND}")
diff --git a/tests/gd2/bug00209.c b/tests/gd2/bug00209.c
index 4c55171..7904d01 100644
--- a/tests/gd2/bug00209.c
+++ b/tests/gd2/bug00209.c
@@ -1,28 +1,26 @@
-/**
- * Regression test for github issue #209
- *
- * We're testing that bug00209.gd2, which claims to have 12336 x 48 pixels, but
- * actually provides not enough image data, is rejected, i.e. that
- * gdImageCreateFromGd2() returns NULL
- *
- * See <https://github.com/libgd/libgd/issues/209>.
- */
-
-
-#include "gd.h"
-#include "gdtest.h"
-
-
-int main()
-{
- gdImagePtr im;
- FILE *fp;
-
- fp = gdTestFileOpen2("gd2", "bug00209.gd2");
- gdTestAssert(fp != NULL);
- im = gdImageCreateFromGd2(fp);
- gdTestAssert(im == NULL);
- fclose(fp);
-
- return gdNumFailures();
-}
+/**
+ * Regression test for github issue #209
+ *
+ * We're testing that bug00209.gd2, which claims to have 12336 x 48 pixels, but
+ * actually provides not enough image data, is rejected, i.e. that
+ * gdImageCreateFromGd2() returns NULL
+ *
+ * See <https://github.com/libgd/libgd/issues/209>.
+ */
+
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ FILE *fp;
+
+ fp = gdTestFileOpen2("gd2", "bug00209.gd2");
+ gdTestAssert(fp != NULL);
+ im = gdImageCreateFromGd2(fp);
+ gdTestAssert(im == NULL);
+ fclose(fp);
+
+ return gdNumFailures();
+}
diff --git a/tests/gd2/bug00354.c b/tests/gd2/bug00354.c
index cc64254..1bce091 100644
--- a/tests/gd2/bug00354.c
+++ b/tests/gd2/bug00354.c
@@ -1,32 +1,30 @@
-/**
- * We're testing GD2 image files which report illegal chunk counts. These should
- * not cause integer overflows or other issues, but instead simply fail to be
- * loaded.
- *
- * See also <https://github.com/libgd/libgd/issues/354>.
- */
-
-
-#include "gd.h"
-#include "gdtest.h"
-
-
-int main()
-{
- gdImagePtr im;
- FILE *fp;
-
- fp = gdTestFileOpen2("gd2", "bug00354a.gd2");
- gdTestAssert(fp != NULL);
- im = gdImageCreateFromGd2(fp);
- gdTestAssert(im == NULL);
- fclose(fp);
-
- fp = gdTestFileOpen2("gd2", "bug00354b.gd2");
- gdTestAssert(fp != NULL);
- im = gdImageCreateFromGd2(fp);
- gdTestAssert(im == NULL);
- fclose(fp);
-
- return gdNumFailures();
-}
+/**
+ * We're testing GD2 image files which report illegal chunk counts. These should
+ * not cause integer overflows or other issues, but instead simply fail to be
+ * loaded.
+ *
+ * See also <https://github.com/libgd/libgd/issues/354>.
+ */
+
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ FILE *fp;
+
+ fp = gdTestFileOpen2("gd2", "bug00354a.gd2");
+ gdTestAssert(fp != NULL);
+ im = gdImageCreateFromGd2(fp);
+ gdTestAssert(im == NULL);
+ fclose(fp);
+
+ fp = gdTestFileOpen2("gd2", "bug00354b.gd2");
+ gdTestAssert(fp != NULL);
+ im = gdImageCreateFromGd2(fp);
+ gdTestAssert(im == NULL);
+ fclose(fp);
+
+ return gdNumFailures();
+}
diff --git a/tests/gdimagebrightness/basic.c b/tests/gdimagebrightness/basic.c
index 8c3a73c..dfed242 100644
--- a/tests/gdimagebrightness/basic.c
+++ b/tests/gdimagebrightness/basic.c
@@ -1,41 +1,37 @@
-/**
- * Basic test for gdImageBrightness()
- */
-
-
-#include "gd.h"
-#include "gdtest.h"
-
-
-static void test_brightness(int brightness);
-
-
-int main()
-{
- test_brightness(+100);
- test_brightness(-100);
-
- return gdNumFailures();
-}
-
-
-static void test_brightness(int brightness)
-{
- gdImagePtr im;
- FILE *fp;
- char basename[256];
- char *path;
-
- fp = gdTestFileOpen2("gdimagebrightness", "basic.png");
- im = gdImageCreateFromPng(fp);
- fclose(fp);
-
- gdImageBrightness(im, brightness);
-
- sprintf(basename, "basic%+03d.png", brightness);
- path = gdTestFilePath2("gdimagebrightness", basename);
- gdAssertImageEqualsToFile(path, im);
- gdFree(path);
-
- gdImageDestroy(im);
-}
+/**
+ * Basic test for gdImageBrightness()
+ */
+
+#include "gd.h"
+#include "gdtest.h"
+
+static void test_brightness(int brightness);
+
+int main()
+{
+ test_brightness(+100);
+ test_brightness(-100);
+
+ return gdNumFailures();
+}
+
+static void test_brightness(int brightness)
+{
+ gdImagePtr im;
+ FILE *fp;
+ char basename[256];
+ char *path;
+
+ fp = gdTestFileOpen2("gdimagebrightness", "basic.png");
+ im = gdImageCreateFromPng(fp);
+ fclose(fp);
+
+ gdImageBrightness(im, brightness);
+
+ sprintf(basename, "basic%+03d.png", brightness);
+ path = gdTestFilePath2("gdimagebrightness", basename);
+ gdAssertImageEqualsToFile(path, im);
+ gdFree(path);
+
+ gdImageDestroy(im);
+}
diff --git a/tests/gdimagecolor/basic.c b/tests/gdimagecolor/basic.c
index 2ad0f3c..86c0aff 100644
--- a/tests/gdimagecolor/basic.c
+++ b/tests/gdimagecolor/basic.c
@@ -1,29 +1,27 @@
-/**
- * Basic test for gdImageColor()
- */
-
-
-#include "gd.h"
-#include "gdtest.h"
-
-
-int main()
-{
- gdImagePtr im;
- FILE *fp;
- char *path;
-
- fp = gdTestFileOpen2("gdimagecolor", "basic.png");
- im = gdImageCreateFromPng(fp);
- fclose(fp);
-
- gdImageColor(im, 127, -127, -127, 0);
-
- path = gdTestFilePath2("gdimagecolor", "basic_exp.png");
- gdAssertImageEqualsToFile(path, im);
- gdFree(path);
-
- gdImageDestroy(im);
-
- return gdNumFailures();
-}
+/**
+ * Basic test for gdImageColor()
+ */
+
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ FILE *fp;
+ char *path;
+
+ fp = gdTestFileOpen2("gdimagecolor", "basic.png");
+ im = gdImageCreateFromPng(fp);
+ fclose(fp);
+
+ gdImageColor(im, 127, -127, -127, 0);
+
+ path = gdTestFilePath2("gdimagecolor", "basic_exp.png");
+ gdAssertImageEqualsToFile(path, im);
+ gdFree(path);
+
+ gdImageDestroy(im);
+
+ return gdNumFailures();
+}
diff --git a/tests/gdimagecontrast/basic.c b/tests/gdimagecontrast/basic.c
index d001bf9..ef1f44a 100644
--- a/tests/gdimagecontrast/basic.c
+++ b/tests/gdimagecontrast/basic.c
@@ -1,41 +1,37 @@
-/**
- * Basic test for gdImageContrast()
- */
-
-
-#include "gd.h"
-#include "gdtest.h"
-
-
-static void test_contrast(double contrast);
-
-
-int main()
-{
- test_contrast(+50.0);
- test_contrast(-50.0);
-
- return gdNumFailures();
-}
-
-
-static void test_contrast(double contrast)
-{
- gdImagePtr im;
- FILE *fp;
- char basename[256];
- char *path;
-
- fp = gdTestFileOpen2("gdimagecontrast", "basic.png");
- im = gdImageCreateFromPng(fp);
- fclose(fp);
-
- gdImageContrast(im, contrast);
-
- sprintf(basename, "basic%+03.0f.png", contrast);
- path = gdTestFilePath2("gdimagecontrast", basename);
- gdAssertImageEqualsToFile(path, im);
- gdFree(path);
-
- gdImageDestroy(im);
-}
+/**
+ * Basic test for gdImageContrast()
+ */
+
+#include "gd.h"
+#include "gdtest.h"
+
+static void test_contrast(double contrast);
+
+int main()
+{
+ test_contrast(+50.0);
+ test_contrast(-50.0);
+
+ return gdNumFailures();
+}
+
+static void test_contrast(double contrast)
+{
+ gdImagePtr im;
+ FILE *fp;
+ char basename[256];
+ char *path;
+
+ fp = gdTestFileOpen2("gdimagecontrast", "basic.png");
+ im = gdImageCreateFromPng(fp);
+ fclose(fp);
+
+ gdImageContrast(im, contrast);
+
+ sprintf(basename, "basic%+03.0f.png", contrast);
+ path = gdTestFilePath2("gdimagecontrast", basename);
+ gdAssertImageEqualsToFile(path, im);
+ gdFree(path);
+
+ gdImageDestroy(im);
+}
diff --git a/tests/gdimageconvolution/basic.c b/tests/gdimageconvolution/basic.c
index 7ca98be..5fe308c 100644
--- a/tests/gdimageconvolution/basic.c
+++ b/tests/gdimageconvolution/basic.c
@@ -1,62 +1,55 @@
-/**
- * Basic test for gdImageConvolution() and related functions
- */
-
-
-#include "gd.h"
-#include "gdtest.h"
-
-
-static void test_convolution(void (*convolution_func)(gdImagePtr im), const char *expected)
-{
- gdImagePtr im;
- FILE *fp;
- char *path;
-
- fp = gdTestFileOpen2("gdimageconvolution", "basic.png");
- im = gdImageCreateFromPng(fp);
- fclose(fp);
-
- convolution_func(im);
-
- path = gdTestFilePath2("gdimageconvolution", expected);
- gdAssertImageEqualsToFile(path, im);
- gdFree(path);
-
- gdImageDestroy(im);
-}
-
-
-static void test_edge_detect_quick(gdImagePtr im)
-{
- gdImageEdgeDetectQuick(im);
-}
-
-
-static void test_smooth(gdImagePtr im)
-{
- gdImageSmooth(im, 5);
-}
-
-
-static void test_emboss(gdImagePtr im)
-{
- gdImageEmboss(im);
-}
-
-
-static void test_mean_removal(gdImagePtr im)
-{
- gdImageMeanRemoval(im);
-}
-
-
-int main()
-{
- test_convolution(&test_edge_detect_quick, "basic_edge_detect_quick.png");
- test_convolution(&test_smooth, "basic_smooth.png");
- test_convolution(&test_emboss, "basic_emboss.png");
- test_convolution(&test_mean_removal, "basic_mean_removal.png");
-
- return gdNumFailures();
-}
+/**
+ * Basic test for gdImageConvolution() and related functions
+ */
+
+#include "gd.h"
+#include "gdtest.h"
+
+static void test_convolution(void (*convolution_func)(gdImagePtr im), const char *expected)
+{
+ gdImagePtr im;
+ FILE *fp;
+ char *path;
+
+ fp = gdTestFileOpen2("gdimageconvolution", "basic.png");
+ im = gdImageCreateFromPng(fp);
+ fclose(fp);
+
+ convolution_func(im);
+
+ path = gdTestFilePath2("gdimageconvolution", expected);
+ gdAssertImageEqualsToFile(path, im);
+ gdFree(path);
+
+ gdImageDestroy(im);
+}
+
+static void test_edge_detect_quick(gdImagePtr im)
+{
+ gdImageEdgeDetectQuick(im);
+}
+
+static void test_smooth(gdImagePtr im)
+{
+ gdImageSmooth(im, 5);
+}
+
+static void test_emboss(gdImagePtr im)
+{
+ gdImageEmboss(im);
+}
+
+static void test_mean_removal(gdImagePtr im)
+{
+ gdImageMeanRemoval(im);
+}
+
+int main()
+{
+ test_convolution(&test_edge_detect_quick, "basic_edge_detect_quick.png");
+ test_convolution(&test_smooth, "basic_smooth.png");
+ test_convolution(&test_emboss, "basic_emboss.png");
+ test_convolution(&test_mean_removal, "basic_mean_removal.png");
+
+ return gdNumFailures();
+}
diff --git a/tests/gdimagecreate/bug00340.c b/tests/gdimagecreate/bug00340.c
index 5babcaa..9c6eff3 100644
--- a/tests/gdimagecreate/bug00340.c
+++ b/tests/gdimagecreate/bug00340.c
@@ -1,33 +1,29 @@
-/**
- * Regression test for <https://github.com/libgd/libgd/issues/340>
- *
- * We're testing that trying to create an oversized image fails early,
- * triggering an appropriate warning.
- */
-
-
-#include <string.h>
-#include "gd.h"
-#include "gd_errors.h"
-#include "gdtest.h"
-
-
-#define MSG "product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n"
-
-
-void error_handler(int priority, const char *format, ...)
-{
- gdTestAssert(priority == GD_WARNING);
- gdTestAssert(!strcmp(format, MSG));
-}
-
-
-int main()
-{
- gdImagePtr im;
-
- im = gdImageCreate(64970, 65111);
- gdTestAssert(im == NULL);
-
- return gdNumFailures();
-}
+/**
+ * Regression test for <https://github.com/libgd/libgd/issues/340>
+ *
+ * We're testing that trying to create an oversized image fails early,
+ * triggering an appropriate warning.
+ */
+
+#include <string.h>
+#include "gd.h"
+#include "gd_errors.h"
+#include "gdtest.h"
+
+#define MSG "product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n"
+
+void error_handler(int priority, const char *format, ...)
+{
+ gdTestAssert(priority == GD_WARNING);
+ gdTestAssert(!strcmp(format, MSG));
+}
+
+int main()
+{
+ gdImagePtr im;
+
+ im = gdImageCreate(64970, 65111);
+ gdTestAssert(im == NULL);
+
+ return gdNumFailures();
+}
diff --git a/tests/gdimagefile/gdnametest.c b/tests/gdimagefile/gdnametest.c
index b6b7c56..fcd040a 100644
--- a/tests/gdimagefile/gdnametest.c
+++ b/tests/gdimagefile/gdnametest.c
@@ -11,149 +11,145 @@
#define LY (HEIGHT/2) // Line Y
#define HT 2 // Half of line-thickness
-
-gdImagePtr mkwhite(int x, int y)
+static gdImagePtr
+mkwhite(int x, int y)
{
- gdImagePtr im;
+ gdImagePtr im;
im = gdImageCreateTrueColor(x, y);
gdImageFilledRectangle(im, 0, 0, x-1, y-1,
- gdImageColorExactAlpha(im, 255, 255, 255, 0));
+ gdImageColorExactAlpha(im, 255, 255, 255, 0));
- gdTestAssert(im != NULL);
+ gdTestAssert(im != NULL);
- gdImageSetInterpolationMethod(im, GD_BICUBIC); // FP interp'n
+ gdImageSetInterpolationMethod(im, GD_BICUBIC); // FP interp'n
- return im;
+ return im;
}/* mkwhite*/
+static gdImagePtr
+mkcross(void)
+{
+ gdImagePtr im;
+ int fg, n;
-gdImagePtr mkcross() {
- gdImagePtr im;
- int fg, n;
-
- im = mkwhite(WIDTH, HEIGHT);
- fg = gdImageColorAllocate(im, 0, 0, 0);
+ im = mkwhite(WIDTH, HEIGHT);
+ fg = gdImageColorAllocate(im, 0, 0, 0);
- for (n = -HT; n < HT; n++) {
- gdImageLine(im, LX-n, 0, LX-n, HEIGHT-1, fg);
- gdImageLine(im, 0, LY-n, WIDTH-1, LY-n, fg);
- }/* for */
+ for (n = -HT; n < HT; n++) {
+ gdImageLine(im, LX-n, 0, LX-n, HEIGHT-1, fg);
+ gdImageLine(im, 0, LY-n, WIDTH-1, LY-n, fg);
+ }/* for */
- return im;
+ return im;
}/* mkcross*/
-
-
-
-void
-do_test() {
-
- gdTestAssertMsg(strchr("123",'2') != 0, "strchr() is not functional.\n");
- gdTestAssertMsg(strcasecmp("123abC","123Abc") == 0, "strcasecmp() is not functional.\n");
-
- int n;
- struct {
- const char *nm; // Filename
- unsigned maxdiff; // Maximum total pixel diff
- int required; // 1 -> image type always supported, -1 -> skip it
- int readonly; // 1 -> gd can only read this type
- } names[] = {
- {"img.png", 0, 0, 0},
- {"img.gif", 5, 1, 0}, // This seems to come from tc<->palette
- {"img.GIF", 5, 1, 0}, // Test for case insensitivity
- {"img.gd", 0, 1, 0},
- {"img.gd2", 0, 0, 0},
- {"img.jpg", 25, 0, 0},
- {"img.jpeg", 25, 0, 0},
- {"img.wbmp", 0, 1, 0},
- {"img.bmp", 0, 1, 0},
- {"img-ref.xpm", 0, 0, 1},
- {"img-ref.xbm", 0, 1, 1},
- {"img-ref.tga", 0, 1, 1},
- {"img.webp", 10, 1, 0},
- {"img.tiff", 0, 1, 0},
-
- {NULL, 0}
- };
-
- for (n = 0; names[n].nm; n++) {
- gdImagePtr orig, copy;
- int status;
- char *full_filename = NULL;
- unsigned int pixels;
-
- /* Some image readers are buggy and crash the program so we
- * skip them. Bug fixers should remove these from the list of
- * skipped items as bugs are fixed. */
- if (names[n].required < 0) {
- printf("Skipping test for '%s'. FIX THIS!\n", names[n].nm);
- continue;
- }/* if */
-
- /* Skip this file if the current library build doesn't support
- * it. (If it's one of the built-in types, *that* a different
- * problem; we assert that here.) */
- if (!gdSupportsFileType(names[n].nm, 0)) {
- gdTestAssertMsg(!names[n].required, "GD doesn't support required file type: %s\n", names[n].nm);
- continue;
- }/* if */
-
- orig = mkcross();
-
- /* Write the image unless writing is not supported. */
- if (!names[n].readonly) {
- /* Prepend the test directory; this is expected to be run in
- * the parent dir. */
- full_filename = gdTestTempFile(names[n].nm);
- status = gdImageFile(orig, full_filename);
- gdTestAssertMsg(status == GD_TRUE, "Failed to create %s\n", full_filename);
- } else {
- /* Prepend the test directory; this is expected to be run in
- * the parent dir. */
- full_filename = gdTestFilePath2("gdimagefile", names[n].nm);
- }/* if */
-
- copy = gdImageCreateFromFile(full_filename);
- gdTestAssertMsg(!!copy, "Failed to load %s\n", full_filename);
- if (!copy) continue;
-
- pixels = gdMaxPixelDiff(orig, copy);
- gdTestAssertMsg(pixels <= names[n].maxdiff, "%u pixels different on %s\n", pixels, full_filename);
-
- if (!names[n].readonly) {
- status = remove(full_filename);
- gdTestAssertMsg(status == 0, "Failed to delete %s\n", full_filename);
- }/* if */
-
- free(full_filename);
- gdImageDestroy(orig);
- gdImageDestroy(copy);
- }/* for */
+static void
+do_test(void)
+{
+ gdTestAssertMsg(strchr("123",'2') != 0, "strchr() is not functional.\n");
+ gdTestAssertMsg(strcasecmp("123abC","123Abc") == 0, "strcasecmp() is not functional.\n");
+
+ int n;
+ struct {
+ const char *nm; // Filename
+ unsigned maxdiff; // Maximum total pixel diff
+ int required; // 1 -> image type always supported, -1 -> skip it
+ int readonly; // 1 -> gd can only read this type
+ } names[] = {
+ {"img.png", 0, 0, 0},
+ {"img.gif", 5, 1, 0}, // This seems to come from tc<->palette
+ {"img.GIF", 5, 1, 0}, // Test for case insensitivity
+ {"img.gd", 0, 1, 0},
+ {"img.gd2", 0, 0, 0},
+ {"img.jpg", 25, 0, 0},
+ {"img.jpeg", 25, 0, 0},
+ {"img.wbmp", 0, 1, 0},
+ {"img.bmp", 0, 1, 0},
+ {"img-ref.xpm", 0, 0, 1},
+ {"img-ref.xbm", 0, 1, 1},
+ {"img-ref.tga", 0, 1, 1},
+ {"img.webp", 10, 1, 0},
+ {"img.tiff", 0, 1, 0},
+
+ {NULL, 0}
+ };
+
+ for (n = 0; names[n].nm; n++) {
+ gdImagePtr orig, copy;
+ int status;
+ char *full_filename = NULL;
+ unsigned int pixels;
+
+ /* Some image readers are buggy and crash the program so we
+ * skip them. Bug fixers should remove these from the list of
+ * skipped items as bugs are fixed. */
+ if (names[n].required < 0) {
+ printf("Skipping test for '%s'. FIX THIS!\n", names[n].nm);
+ continue;
+ }/* if */
+
+ /* Skip this file if the current library build doesn't support
+ * it. (If it's one of the built-in types, *that* a different
+ * problem; we assert that here.) */
+ if (!gdSupportsFileType(names[n].nm, 0)) {
+ gdTestAssertMsg(!names[n].required, "GD doesn't support required file type: %s\n", names[n].nm);
+ continue;
+ }/* if */
+
+ orig = mkcross();
+
+ /* Write the image unless writing is not supported. */
+ if (!names[n].readonly) {
+ /* Prepend the test directory; this is expected to be run in
+ * the parent dir. */
+ full_filename = gdTestTempFile(names[n].nm);
+ status = gdImageFile(orig, full_filename);
+ gdTestAssertMsg(status == GD_TRUE, "Failed to create %s\n", full_filename);
+ } else {
+ /* Prepend the test directory; this is expected to be run in
+ * the parent dir. */
+ full_filename = gdTestFilePath2("gdimagefile", names[n].nm);
+ }/* if */
+
+ copy = gdImageCreateFromFile(full_filename);
+ gdTestAssertMsg(!!copy, "Failed to load %s\n", full_filename);
+ if (!copy) continue;
+
+ pixels = gdMaxPixelDiff(orig, copy);
+ gdTestAssertMsg(pixels <= names[n].maxdiff, "%u pixels different on %s\n", pixels, full_filename);
+
+ if (!names[n].readonly) {
+ status = remove(full_filename);
+ gdTestAssertMsg(status == 0, "Failed to delete %s\n", full_filename);
+ }/* if */
+
+ free(full_filename);
+ gdImageDestroy(orig);
+ gdImageDestroy(copy);
+ }/* for */
}/* do_test*/
+static void
+do_errortest(void)
+{
+ gdImagePtr im;
-void
-do_errortest() {
- gdImagePtr im;
-
- im = mkcross();
+ im = mkcross();
- gdTestAssert(!gdImageFile(im, "img.xpng"));
- gdTestAssert(!gdImageFile(im, "bobo"));
- gdTestAssert(!gdImageFile(im, "png"));
- gdTestAssert(!gdImageFile(im, ""));
+ gdTestAssert(!gdImageFile(im, "img.xpng"));
+ gdTestAssert(!gdImageFile(im, "bobo"));
+ gdTestAssert(!gdImageFile(im, "png"));
+ gdTestAssert(!gdImageFile(im, ""));
- gdImageDestroy(im);
+ gdImageDestroy(im);
}/* do_errortest*/
-
int main()
{
+ do_test();
+ do_errortest();
- do_test();
- do_errortest();
-
- return gdNumFailures();
+ return gdNumFailures();
}
diff --git a/tests/gdimagefilledpolygon/self_intersecting.c b/tests/gdimagefilledpolygon/self_intersecting.c
index 6123cc1..f9b96da 100644
--- a/tests/gdimagefilledpolygon/self_intersecting.c
+++ b/tests/gdimagefilledpolygon/self_intersecting.c
@@ -1,31 +1,29 @@
-/**
- * We're testing the filling behavior of self-intersecting polygons, which is
- * *currently* using the even-odd fillrule.
- */
-
-
-#include "gd.h"
-#include "gdtest.h"
-
-
-int main()
-{
- gdImagePtr im;
- int black;
- gdPoint points[] = {{50, 5}, {24, 86}, {93, 36}, {7, 36}, {76, 86}};
- char *path;
-
- im = gdImageCreate(100, 100);
- gdImageColorAllocate(im, 255, 255, 255);
- black = gdImageColorAllocate(im, 0, 0, 0);
-
- gdImageFilledPolygon(im, points, 5, black);
-
- path = gdTestFilePath2("gdimagefilledpolygon", "self_intersecting_exp.png");
- gdAssertImageEqualsToFile(path, im);
- gdFree(path);
-
- gdImageDestroy(im);
-
- return gdNumFailures();
-}
+/**
+ * We're testing the filling behavior of self-intersecting polygons, which is
+ * *currently* using the even-odd fillrule.
+ */
+
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int black;
+ gdPoint points[] = {{50, 5}, {24, 86}, {93, 36}, {7, 36}, {76, 86}};
+ char *path;
+
+ im = gdImageCreate(100, 100);
+ gdImageColorAllocate(im, 255, 255, 255);
+ black = gdImageColorAllocate(im, 0, 0, 0);
+
+ gdImageFilledPolygon(im, points, 5, black);
+
+ path = gdTestFilePath2("gdimagefilledpolygon", "self_intersecting_exp.png");
+ gdAssertImageEqualsToFile(path, im);
+ gdFree(path);
+
+ gdImageDestroy(im);
+
+ return gdNumFailures();
+}
diff --git a/tests/gdimageflip/gdimageflip.c b/tests/gdimageflip/gdimageflip.c
index 7caf1c0..da834ee 100644
--- a/tests/gdimageflip/gdimageflip.c
+++ b/tests/gdimageflip/gdimageflip.c
@@ -1,37 +1,34 @@
-/**
- * Testing the basic operation of the gdImageFlip*() functions
- */
-
-
-#include "gd.h"
-#include "gdtest.h"
-
-
-static void test_flip(void (BGD_STDCALL *func)(gdImagePtr), const char *filename)
-{
- gdImagePtr im;
- FILE *fp;
- char *path;
-
- fp = gdTestFileOpen2("gdimageflip", "remi.png");
- im = gdImageCreateFromPng(fp);
- fclose(fp);
-
- func(im);
-
- path = gdTestFilePath2("gdimageflip", filename);
- gdAssertImageEqualsToFile(path, im);
- gdFree(path);
-
- gdImageDestroy(im);
-}
-
-
-int main()
-{
- test_flip(gdImageFlipVertical, "gdimageflipvertical_exp.png");
- test_flip(gdImageFlipHorizontal, "gdimagefliphorizontal_exp.png");
- test_flip(gdImageFlipBoth, "gdimageflipboth_exp.png");
-
- return gdNumFailures();
-}
+/**
+ * Testing the basic operation of the gdImageFlip*() functions
+ */
+
+#include "gd.h"
+#include "gdtest.h"
+
+static void test_flip(void (BGD_STDCALL *func)(gdImagePtr), const char *filename)
+{
+ gdImagePtr im;
+ FILE *fp;
+ char *path;
+
+ fp = gdTestFileOpen2("gdimageflip", "remi.png");
+ im = gdImageCreateFromPng(fp);
+ fclose(fp);
+
+ func(im);
+
+ path = gdTestFilePath2("gdimageflip", filename);
+ gdAssertImageEqualsToFile(path, im);
+ gdFree(path);
+
+ gdImageDestroy(im);
+}
+
+int main()
+{
+ test_flip(gdImageFlipVertical, "gdimageflipvertical_exp.png");
+ test_flip(gdImageFlipHorizontal, "gdimagefliphorizontal_exp.png");
+ test_flip(gdImageFlipBoth, "gdimageflipboth_exp.png");
+
+ return gdNumFailures();
+}
diff --git a/tests/gdimagegrayscale/basic.c b/tests/gdimagegrayscale/basic.c
index e3c21d8..3ecc482 100644
--- a/tests/gdimagegrayscale/basic.c
+++ b/tests/gdimagegrayscale/basic.c
@@ -1,29 +1,27 @@
-/**
- * Basic test for gdImageGrayScale()
- */
-
-
-#include "gd.h"
-#include "gdtest.h"
-
-
-int main()
-{
- gdImagePtr im;
- FILE *fp;
- char *path;
-
- fp = gdTestFileOpen2("gdimagegrayscale", "basic.png");
- im = gdImageCreateFromPng(fp);
- fclose(fp);
-
- gdImageGrayScale(im);
-
- path = gdTestFilePath2("gdimagegrayscale", "basic_exp.png");
- gdAssertImageEqualsToFile(path, im);
- gdFree(path);
-
- gdImageDestroy(im);
-
- return gdNumFailures();
-}
+/**
+ * Basic test for gdImageGrayScale()
+ */
+
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ FILE *fp;
+ char *path;
+
+ fp = gdTestFileOpen2("gdimagegrayscale", "basic.png");
+ im = gdImageCreateFromPng(fp);
+ fclose(fp);
+
+ gdImageGrayScale(im);
+
+ path = gdTestFilePath2("gdimagegrayscale", "basic_exp.png");
+ gdAssertImageEqualsToFile(path, im);
+ gdFree(path);
+
+ gdImageDestroy(im);
+
+ return gdNumFailures();
+}
diff --git a/tests/gdimageline/bug00315.c b/tests/gdimageline/bug00315.c
index 7c94e41..719d155 100644
--- a/tests/gdimageline/bug00315.c
+++ b/tests/gdimageline/bug00315.c
@@ -1,39 +1,37 @@
-/**
- * Regression test for <https://github.com/libgd/libgd/issues/315>
- *
- * We're testing that a single-pointed gdImageAALine() is drawn as a single
- * non-antialized pixel, according to (two-pointed) vertical and horizontal
- * lines.
- */
-
-
-#include "gd.h"
-#include "gdtest.h"
-
-
-int main()
-{
- gdImagePtr im;
- int white, black;
- char *path;
-
- im = gdImageCreateTrueColor(6, 6);
- white = gdImageColorAllocate(im, 255, 255, 255);
- black = gdImageColorAllocate(im, 0, 0, 0);
- gdImageFilledRectangle(im, 0,0, 5,5, white);
-
- gdImageLine(im, 4,4, 4,4, black);
- gdImageLine(im, 1,4, 2,4, black);
- gdImageLine(im, 4,1, 4,2, black);
-
- gdImageSetAntiAliased(im, black);
- gdImageLine(im, 1,1, 1,1, gdAntiAliased);
-
- path = gdTestFilePath2("gdimageline", "bug00315_exp.png");
- gdAssertImageEqualsToFile(path, im);
- gdFree(path);
-
- gdImageDestroy(im);
-
- return gdNumFailures();
-}
+/**
+ * Regression test for <https://github.com/libgd/libgd/issues/315>
+ *
+ * We're testing that a single-pointed gdImageAALine() is drawn as a single
+ * non-antialized pixel, according to (two-pointed) vertical and horizontal
+ * lines.
+ */
+
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int white, black;
+ char *path;
+
+ im = gdImageCreateTrueColor(6, 6);
+ white = gdImageColorAllocate(im, 255, 255, 255);
+ black = gdImageColorAllocate(im, 0, 0, 0);
+ gdImageFilledRectangle(im, 0,0, 5,5, white);
+
+ gdImageLine(im, 4,4, 4,4, black);
+ gdImageLine(im, 1,4, 2,4, black);
+ gdImageLine(im, 4,1, 4,2, black);
+
+ gdImageSetAntiAliased(im, black);
+ gdImageLine(im, 1,1, 1,1, gdAntiAliased);
+
+ path = gdTestFilePath2("gdimageline", "bug00315_exp.png");
+ gdAssertImageEqualsToFile(path, im);
+ gdFree(path);
+
+ gdImageDestroy(im);
+
+ return gdNumFailures();
+}
diff --git a/tests/gdimagenegate/basic.c b/tests/gdimagenegate/basic.c
index b904eb8..563eec6 100644
--- a/tests/gdimagenegate/basic.c
+++ b/tests/gdimagenegate/basic.c
@@ -1,29 +1,27 @@
-/**
- * Basic test for gdImageNegate()
- */
-
-
-#include "gd.h"
-#include "gdtest.h"
-
-
-int main()
-{
- gdImagePtr im;
- FILE *fp;
- char *path;
-
- fp = gdTestFileOpen2("gdimagenegate", "basic.png");
- im = gdImageCreateFromPng(fp);
- fclose(fp);
-
- gdImageNegate(im);
-
- path = gdTestFilePath2("gdimagenegate", "basic_exp.png");
- gdAssertImageEqualsToFile(path, im);
- gdFree(path);
-
- gdImageDestroy(im);
-
- return gdNumFailures();
-}
+/**
+ * Basic test for gdImageNegate()
+ */
+
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ FILE *fp;
+ char *path;
+
+ fp = gdTestFileOpen2("gdimagenegate", "basic.png");
+ im = gdImageCreateFromPng(fp);
+ fclose(fp);
+
+ gdImageNegate(im);
+
+ path = gdTestFilePath2("gdimagenegate", "basic_exp.png");
+ gdAssertImageEqualsToFile(path, im);
+ gdFree(path);
+
+ gdImageDestroy(im);
+
+ return gdNumFailures();
+}
diff --git a/tests/gdimagerotate/php_bug_65070.c b/tests/gdimagerotate/php_bug_65070.c
index f1b5504..87a43ea 100644
--- a/tests/gdimagerotate/php_bug_65070.c
+++ b/tests/gdimagerotate/php_bug_65070.c
@@ -1,35 +1,33 @@
-/**
- * Regression test for <https://github.com/libgd/libgd/issues/319>
- *
- * We're testing that the rotated image actually has the requested background
- * color.
- */
-
-
-#include "gd.h"
-#include "gdtest.h"
-
-
-int main()
-{
- gdImagePtr src, dst;
- FILE *fp;
- int black;
- char *path;
-
- fp = gdTestFileOpen2("gdimagerotate", "php_bug_65070.gif");
- src = gdImageCreateFromGif(fp);
- fclose(fp);
-
- black = gdImageColorAllocateAlpha(src, 0, 0, 0, 0);
- dst = gdImageRotateInterpolated(src, 30.0, black);
-
- path = gdTestFilePath2("gdimagerotate", "php_bug_65070_exp.png");
- gdAssertImageEqualsToFile(path, dst);
- gdFree(path);
-
- gdImageDestroy(src);
- gdImageDestroy(dst);
-
- return gdNumFailures();
-}
+/**
+ * Regression test for <https://github.com/libgd/libgd/issues/319>
+ *
+ * We're testing that the rotated image actually has the requested background
+ * color.
+ */
+
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr src, dst;
+ FILE *fp;
+ int black;
+ char *path;
+
+ fp = gdTestFileOpen2("gdimagerotate", "php_bug_65070.gif");
+ src = gdImageCreateFromGif(fp);
+ fclose(fp);
+
+ black = gdImageColorAllocateAlpha(src, 0, 0, 0, 0);
+ dst = gdImageRotateInterpolated(src, 30.0, black);
+
+ path = gdTestFilePath2("gdimagerotate", "php_bug_65070_exp.png");
+ gdAssertImageEqualsToFile(path, dst);
+ gdFree(path);
+
+ gdImageDestroy(src);
+ gdImageDestroy(dst);
+
+ return gdNumFailures();
+}
diff --git a/tests/gdimagescale/bug00329.c b/tests/gdimagescale/bug00329.c
index 0b1b32d..67a1561 100644
--- a/tests/gdimagescale/bug00329.c
+++ b/tests/gdimagescale/bug00329.c
@@ -1,53 +1,50 @@
-/**
- * Regression test for <https://github.com/libgd/libgd/issues/329>
- *
- * We're testing that for truecolor as well as palette images after
- * GD_BILINEAR_FIXED scaling the corner pixels of the scaled image have the
- * expected color.
- */
-
-
-#include <string.h>
-#include "gd.h"
-#include "gdtest.h"
-
-
-static void test(const char *mode)
-{
- gdImagePtr src, dst;
- int expected, actual;
-
- if (strcmp(mode, "palette")) {
- src = gdImageCreateTrueColor(100, 100);
- expected = gdTrueColorAlpha(255, 255, 255, gdAlphaOpaque);
- gdImageFilledRectangle(src, 0,0, 99,99, expected);
- } else {
- src = gdImageCreate(100, 100);
- gdImageColorAllocate(src, 255, 255, 255);
- expected = gdImageGetTrueColorPixel(src, 49, 49);
- }
-
- gdImageSetInterpolationMethod(src, GD_BILINEAR_FIXED);
- dst = gdImageScale(src, 200, 200);
-
- actual = gdImageGetPixel(dst, 0, 0);
- gdTestAssertMsg(actual == expected, "%s: wrong color; expected %x, but got %x", mode, expected, actual);
- actual = gdImageGetPixel(dst, 0, 199);
- gdTestAssertMsg(actual == expected, "%s: wrong color; expected %x, but got %x", mode, expected, actual);
- actual = gdImageGetPixel(dst, 199, 199);
- gdTestAssertMsg(actual == expected, "%s: wrong color; expected %x, but got %x", mode, expected, actual);
- actual = gdImageGetPixel(dst, 199, 0);
- gdTestAssertMsg(actual == expected, "%s: wrong color; expected %x, but got %x", mode, expected, actual);
-
- gdImageDestroy(src);
- gdImageDestroy(dst);
-}
-
-
-int main()
-{
- test("palette");
- test("truecolor");
-
- return gdNumFailures();
-}
+/**
+ * Regression test for <https://github.com/libgd/libgd/issues/329>
+ *
+ * We're testing that for truecolor as well as palette images after
+ * GD_BILINEAR_FIXED scaling the corner pixels of the scaled image have the
+ * expected color.
+ */
+
+#include <string.h>
+#include "gd.h"
+#include "gdtest.h"
+
+static void test(const char *mode)
+{
+ gdImagePtr src, dst;
+ int expected, actual;
+
+ if (strcmp(mode, "palette")) {
+ src = gdImageCreateTrueColor(100, 100);
+ expected = gdTrueColorAlpha(255, 255, 255, gdAlphaOpaque);
+ gdImageFilledRectangle(src, 0,0, 99,99, expected);
+ } else {
+ src = gdImageCreate(100, 100);
+ gdImageColorAllocate(src, 255, 255, 255);
+ expected = gdImageGetTrueColorPixel(src, 49, 49);
+ }
+
+ gdImageSetInterpolationMethod(src, GD_BILINEAR_FIXED);
+ dst = gdImageScale(src, 200, 200);
+
+ actual = gdImageGetPixel(dst, 0, 0);
+ gdTestAssertMsg(actual == expected, "%s: wrong color; expected %x, but got %x", mode, expected, actual);
+ actual = gdImageGetPixel(dst, 0, 199);
+ gdTestAssertMsg(actual == expected, "%s: wrong color; expected %x, but got %x", mode, expected, actual);
+ actual = gdImageGetPixel(dst, 199, 199);
+ gdTestAssertMsg(actual == expected, "%s: wrong color; expected %x, but got %x", mode, expected, actual);
+ actual = gdImageGetPixel(dst, 199, 0);
+ gdTestAssertMsg(actual == expected, "%s: wrong color; expected %x, but got %x", mode, expected, actual);
+
+ gdImageDestroy(src);
+ gdImageDestroy(dst);
+}
+
+int main()
+{
+ test("palette");
+ test("truecolor");
+
+ return gdNumFailures();
+}
diff --git a/tests/gdimagescale/bug00330.c b/tests/gdimagescale/bug00330.c
index c5cda40..44ba2f4 100644
--- a/tests/gdimagescale/bug00330.c
+++ b/tests/gdimagescale/bug00330.c
@@ -1,32 +1,30 @@
-/**
- * Regression test for <https://github.com/libgd/libgd/issues/330>.
- *
- * We're testing that after scaling a palette image, the center pixel actually
- * has the expected color value.
- */
-
-
-#include "gd.h"
-#include "gdtest.h"
-
-
-int main()
-{
- gdImagePtr src, dst;
- int color;
-
- src = gdImageCreate(100, 100);
- gdImageColorAllocate(src, 255, 255, 255);
-
- gdImageSetInterpolationMethod(src, GD_BILINEAR_FIXED);
- dst = gdImageScale(src, 200, 200);
-
- color = gdImageGetPixel(dst, 99, 99);
- gdTestAssertMsg(color == 0xffffff,
- "expected color ffffff, but got %x\n", color);
-
- gdImageDestroy(src);
- gdImageDestroy(dst);
-
- return 0;
-}
+/**
+ * Regression test for <https://github.com/libgd/libgd/issues/330>.
+ *
+ * We're testing that after scaling a palette image, the center pixel actually
+ * has the expected color value.
+ */
+
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr src, dst;
+ int color;
+
+ src = gdImageCreate(100, 100);
+ gdImageColorAllocate(src, 255, 255, 255);
+
+ gdImageSetInterpolationMethod(src, GD_BILINEAR_FIXED);
+ dst = gdImageScale(src, 200, 200);
+
+ color = gdImageGetPixel(dst, 99, 99);
+ gdTestAssertMsg(color == 0xffffff,
+ "expected color ffffff, but got %x\n", color);
+
+ gdImageDestroy(src);
+ gdImageDestroy(dst);
+
+ return 0;
+}
diff --git a/tests/gdimagesetpixel/alpha_blending.c b/tests/gdimagesetpixel/alpha_blending.c
index 394ced5..f182d59 100644
--- a/tests/gdimagesetpixel/alpha_blending.c
+++ b/tests/gdimagesetpixel/alpha_blending.c
@@ -1,54 +1,52 @@
-/**
- * Testing all effects
- */
-
-
-#include "gd.h"
-#include "gdtest.h"
-
-
-int main()
-{
- gdImagePtr im;
- int effects[] = {
- gdEffectReplace, gdEffectAlphaBlend, gdEffectNormal,
- gdEffectOverlay, gdEffectMultiply
- };
- int red[3], blue[3];
- int x, y, i, j;
- char *path;
-
- red[0] = gdTrueColorAlpha(0, 0, 255, 127);
- red[1] = gdTrueColorAlpha(0, 0, 255, 63);
- red[2] = gdTrueColorAlpha(0, 0, 255, 0);
- blue[0] = gdTrueColorAlpha(255, 0, 0, 127);
- blue[1] = gdTrueColorAlpha(255, 0, 0, 63);
- blue[2] = gdTrueColorAlpha(255, 0, 0, 0);
-
- im = gdImageCreateTrueColor(120, 180);
-
- gdImageAlphaBlending(im, gdEffectReplace);
- for (j = 0; j < 3; j++) {
- y = 60 * j;
- gdImageFilledRectangle(im, 0,y, 119,y+59, red[j]);
- }
-
- for (i = 0; i < 5; i++) {
- x = 20 * i;
- gdImageAlphaBlending(im, effects[i]);
- for (j = 0; j < 9; j++) {
- y = 20 * j;
- gdImageFilledRectangle(im, x+20,y, x+39,y+19, blue[j % 3]);
- }
- }
-
- gdImageSaveAlpha(im, 1);
-
- path = gdTestFilePath2("gdimagesetpixel", "alphablending_exp.png");
- gdAssertImageEqualsToFile(path, im);
- gdFree(path);
-
- gdImageDestroy(im);
-
- return gdNumFailures();
-}
+/**
+ * Testing all effects
+ */
+
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ int effects[] = {
+ gdEffectReplace, gdEffectAlphaBlend, gdEffectNormal,
+ gdEffectOverlay, gdEffectMultiply
+ };
+ int red[3], blue[3];
+ int x, y, i, j;
+ char *path;
+
+ red[0] = gdTrueColorAlpha(0, 0, 255, 127);
+ red[1] = gdTrueColorAlpha(0, 0, 255, 63);
+ red[2] = gdTrueColorAlpha(0, 0, 255, 0);
+ blue[0] = gdTrueColorAlpha(255, 0, 0, 127);
+ blue[1] = gdTrueColorAlpha(255, 0, 0, 63);
+ blue[2] = gdTrueColorAlpha(255, 0, 0, 0);
+
+ im = gdImageCreateTrueColor(120, 180);
+
+ gdImageAlphaBlending(im, gdEffectReplace);
+ for (j = 0; j < 3; j++) {
+ y = 60 * j;
+ gdImageFilledRectangle(im, 0,y, 119,y+59, red[j]);
+ }
+
+ for (i = 0; i < 5; i++) {
+ x = 20 * i;
+ gdImageAlphaBlending(im, effects[i]);
+ for (j = 0; j < 9; j++) {
+ y = 20 * j;
+ gdImageFilledRectangle(im, x+20,y, x+39,y+19, blue[j % 3]);
+ }
+ }
+
+ gdImageSaveAlpha(im, 1);
+
+ path = gdTestFilePath2("gdimagesetpixel", "alphablending_exp.png");
+ gdAssertImageEqualsToFile(path, im);
+ gdFree(path);
+
+ gdImageDestroy(im);
+
+ return gdNumFailures();
+}
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();
+}
diff --git a/tests/png/bug00338.c b/tests/png/bug00338.c
index 7f2101c..f439d8c 100644
--- a/tests/png/bug00338.c
+++ b/tests/png/bug00338.c
@@ -1,49 +1,44 @@
-/**
- * Regression test for <https://github.com/libgd/libgd/issues/338>
- *
- * We're testing that writing a PNG image with an unsupported quality
- * raises a GD_WARNING for the fatal libpng error, but not a GD_ERROR.
- * We also make sure, that the fatal libpng error is actually reported.
- *
- * See also ../jpeg/bug00338.c
- */
-
-
-#include <string.h>
-#include "gd.h"
-#include "gd_errors.h"
-#include "gdtest.h"
-
-
-#define MSG "gd-png: fatal libpng error: %s\n"
-
-
-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();
- gdImagePngEx(im, fp, 100);
- gdImageDestroy(im);
- fclose(fp);
-
- gdTestAssert(error_handler_called);
-
- return gdNumFailures();
-}
+/**
+ * Regression test for <https://github.com/libgd/libgd/issues/338>
+ *
+ * We're testing that writing a PNG image with an unsupported quality
+ * raises a GD_WARNING for the fatal libpng error, but not a GD_ERROR.
+ * We also make sure, that the fatal libpng error is actually reported.
+ *
+ * See also ../jpeg/bug00338.c
+ */
+
+#include <string.h>
+#include "gd.h"
+#include "gd_errors.h"
+#include "gdtest.h"
+
+#define MSG "gd-png: fatal libpng error: %s\n"
+
+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();
+ gdImagePngEx(im, fp, 100);
+ gdImageDestroy(im);
+ fclose(fp);
+
+ gdTestAssert(error_handler_called);
+
+ return gdNumFailures();
+}
diff --git a/tests/tiff/tiff_dpi.c b/tests/tiff/tiff_dpi.c
index f057629..7362646 100644
--- a/tests/tiff/tiff_dpi.c
+++ b/tests/tiff/tiff_dpi.c
@@ -1,76 +1,76 @@
-/*
- * Test that reading and writing image resolution values to/from TIFF files
- * works correctly. Set the image resolution, write the file, read the file
- * back and test that the image resolution comes back correct.
- */
-
-#include "gd.h"
-#include "gdtest.h"
-
-int main()
-{
- gdImagePtr src, dst;
- int r, res_x, res_y;
- void *p;
- int size = 0;
- int status = 0;
-
- src = gdImageCreate(100, 100);
- if (src == NULL) {
- gdTestErrorMsg("could not create src\n");
- return 1;
- }
- r = gdImageColorAllocate(src, 0xFF, 0, 0);
- gdImageFilledRectangle(src, 0, 0, 99, 99, r);
-
- // gd default DPI is 96; libtiff default is 72.
- // Use something else so we know the value has been
- // written / read correctly.
- res_x = 100;
- res_y = 200;
- src->res_x = res_x;
- src->res_y = res_y;
-
-#define OUTPUT_TIFF(name) do { \
- FILE *fp = gdTestTempFp(); \
- gdImageTiff(name, fp); \
- fclose(fp); \
- } while (0)
-
- OUTPUT_TIFF(src);
- p = gdImageTiffPtr(src, &size);
- if (p == NULL) {
- status = 1;
- gdTestErrorMsg("p is null\n");
- goto door0;
- }
- if (size <= 0) {
- status = 1;
- gdTestErrorMsg("size is non-positive\n");
- goto door1;
- }
-
- dst = gdImageCreateFromTiffPtr(size, p);
- if (dst == NULL) {
- status = 1;
- gdTestErrorMsg("could not create dst\n");
- goto door1;
- }
-
- if (dst->res_x != res_x) {
- status = 1;
- gdTestErrorMsg("mismatch in res_x (got %d, expected %d)\n", dst->res_x, res_x);
- }
-
- if (dst->res_y != res_y) {
- status = 1;
- gdTestErrorMsg("mismatch in res_y (got %d, expected %d)\n", dst->res_y, res_y);
- }
-
- gdImageDestroy(dst);
-door1:
- gdFree(p);
-door0:
- gdImageDestroy(src);
- return status;
-}
+/*
+ * Test that reading and writing image resolution values to/from TIFF files
+ * works correctly. Set the image resolution, write the file, read the file
+ * back and test that the image resolution comes back correct.
+ */
+
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr src, dst;
+ int r, res_x, res_y;
+ void *p;
+ int size = 0;
+ int status = 0;
+
+ src = gdImageCreate(100, 100);
+ if (src == NULL) {
+ gdTestErrorMsg("could not create src\n");
+ return 1;
+ }
+ r = gdImageColorAllocate(src, 0xFF, 0, 0);
+ gdImageFilledRectangle(src, 0, 0, 99, 99, r);
+
+ // gd default DPI is 96; libtiff default is 72.
+ // Use something else so we know the value has been
+ // written / read correctly.
+ res_x = 100;
+ res_y = 200;
+ src->res_x = res_x;
+ src->res_y = res_y;
+
+#define OUTPUT_TIFF(name) do { \
+ FILE *fp = gdTestTempFp(); \
+ gdImageTiff(name, fp); \
+ fclose(fp); \
+ } while (0)
+
+ OUTPUT_TIFF(src);
+ p = gdImageTiffPtr(src, &size);
+ if (p == NULL) {
+ status = 1;
+ gdTestErrorMsg("p is null\n");
+ goto door0;
+ }
+ if (size <= 0) {
+ status = 1;
+ gdTestErrorMsg("size is non-positive\n");
+ goto door1;
+ }
+
+ dst = gdImageCreateFromTiffPtr(size, p);
+ if (dst == NULL) {
+ status = 1;
+ gdTestErrorMsg("could not create dst\n");
+ goto door1;
+ }
+
+ if (dst->res_x != res_x) {
+ status = 1;
+ gdTestErrorMsg("mismatch in res_x (got %d, expected %d)\n", dst->res_x, res_x);
+ }
+
+ if (dst->res_y != res_y) {
+ status = 1;
+ gdTestErrorMsg("mismatch in res_y (got %d, expected %d)\n", dst->res_y, res_y);
+ }
+
+ gdImageDestroy(dst);
+door1:
+ gdFree(p);
+door0:
+ gdImageDestroy(src);
+ return status;
+}
diff --git a/tests/tiff/tiff_im2im.c b/tests/tiff/tiff_im2im.c
index 307b379..7b6c4cb 100644
--- a/tests/tiff/tiff_im2im.c
+++ b/tests/tiff/tiff_im2im.c
@@ -1,64 +1,64 @@
-#include "gd.h"
-#include "gdtest.h"
-
-int main()
-{
- gdImagePtr src, dst;
- int r, g, b;
- void *p;
- int size = 0;
- int status = 0;
- CuTestImageResult result = {0, 0};
-
- src = gdImageCreate(100, 100);
- if (src == NULL) {
- gdTestErrorMsg("could not create src\n");
- return 1;
- }
- r = gdImageColorAllocate(src, 0xFF, 0, 0);
- g = gdImageColorAllocate(src, 0, 0xFF, 0);
- b = gdImageColorAllocate(src, 0, 0, 0xFF);
- gdImageFilledRectangle(src, 0, 0, 99, 99, r);
- gdImageRectangle(src, 20, 20, 79, 79, g);
- gdImageEllipse(src, 70, 25, 30, 20, b);
-
-#define OUTPUT_TIFF(name) do { \
- FILE *fp = gdTestTempFp(); \
- gdImageTiff(name, fp); \
- fclose(fp); \
- } while (0)
-
- OUTPUT_TIFF(src);
- p = gdImageTiffPtr(src, &size);
- if (p == NULL) {
- status = 1;
- gdTestErrorMsg("p is null\n");
- goto door0;
- }
- if (size <= 0) {
- status = 1;
- gdTestErrorMsg("size is non-positive\n");
- goto door1;
- }
-
- dst = gdImageCreateFromTiffPtr(size, p);
- if (dst == NULL) {
- status = 1;
- gdTestErrorMsg("could not create dst\n");
- goto door1;
- }
- OUTPUT_TIFF(dst);
-
- gdTestImageDiff(src, dst, NULL, &result);
- if (result.pixels_changed > 0) {
- status = 1;
- printf("pixels changed: %d\n", result.pixels_changed);
- }
-
- gdImageDestroy(dst);
-door1:
- gdFree(p);
-door0:
- gdImageDestroy(src);
- return status;
-}
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr src, dst;
+ int r, g, b;
+ void *p;
+ int size = 0;
+ int status = 0;
+ CuTestImageResult result = {0, 0};
+
+ src = gdImageCreate(100, 100);
+ if (src == NULL) {
+ gdTestErrorMsg("could not create src\n");
+ return 1;
+ }
+ r = gdImageColorAllocate(src, 0xFF, 0, 0);
+ g = gdImageColorAllocate(src, 0, 0xFF, 0);
+ b = gdImageColorAllocate(src, 0, 0, 0xFF);
+ gdImageFilledRectangle(src, 0, 0, 99, 99, r);
+ gdImageRectangle(src, 20, 20, 79, 79, g);
+ gdImageEllipse(src, 70, 25, 30, 20, b);
+
+#define OUTPUT_TIFF(name) do { \
+ FILE *fp = gdTestTempFp(); \
+ gdImageTiff(name, fp); \
+ fclose(fp); \
+ } while (0)
+
+ OUTPUT_TIFF(src);
+ p = gdImageTiffPtr(src, &size);
+ if (p == NULL) {
+ status = 1;
+ gdTestErrorMsg("p is null\n");
+ goto door0;
+ }
+ if (size <= 0) {
+ status = 1;
+ gdTestErrorMsg("size is non-positive\n");
+ goto door1;
+ }
+
+ dst = gdImageCreateFromTiffPtr(size, p);
+ if (dst == NULL) {
+ status = 1;
+ gdTestErrorMsg("could not create dst\n");
+ goto door1;
+ }
+ OUTPUT_TIFF(dst);
+
+ gdTestImageDiff(src, dst, NULL, &result);
+ if (result.pixels_changed > 0) {
+ status = 1;
+ printf("pixels changed: %d\n", result.pixels_changed);
+ }
+
+ gdImageDestroy(dst);
+door1:
+ gdFree(p);
+door0:
+ gdImageDestroy(src);
+ return status;
+}
diff --git a/tests/tiff/tiff_null.c b/tests/tiff/tiff_null.c
index 973b0f9..ccaade7 100644
--- a/tests/tiff/tiff_null.c
+++ b/tests/tiff/tiff_null.c
@@ -1,14 +1,14 @@
-#include "gd.h"
-
-int main()
-{
- gdImagePtr im;
-
- im = gdImageCreateFromTiff(NULL);
- if (im != NULL) {
- gdImageDestroy(im);
- return 1;
- }
- gdImageTiff(im, NULL); /* noop safely */
- return 0;
-}
+#include "gd.h"
+
+int main()
+{
+ gdImagePtr im;
+
+ im = gdImageCreateFromTiff(NULL);
+ if (im != NULL) {
+ gdImageDestroy(im);
+ return 1;
+ }
+ gdImageTiff(im, NULL); /* noop safely */
+ return 0;
+}
diff --git a/tests/tiff/tiff_read_bw.c b/tests/tiff/tiff_read_bw.c
index 5a14a32..93b646d 100644
--- a/tests/tiff/tiff_read_bw.c
+++ b/tests/tiff/tiff_read_bw.c
@@ -1,26 +1,25 @@
-#include "gd.h"
-#include "gdtest.h"
-
-
-int main()
-{
- gdImagePtr im;
- FILE *fp;
- char *path;
-
- fp = gdTestFileOpen2("tiff", "tiff_read_bw.tiff");
- gdTestAssert(fp != NULL);
- im = gdImageCreateFromTiff(fp);
- fclose(fp);
-
- gdTestAssert(im != NULL);
- gdTestAssert(!gdImageTrueColor(im));
-
- path = gdTestFilePath2("tiff", "tiff_read_bw_exp.png");
- gdAssertImageEqualsToFile(path, im);
- gdFree(path);
-
- gdImageDestroy(im);
-
- return gdNumFailures();
-}
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ FILE *fp;
+ char *path;
+
+ fp = gdTestFileOpen2("tiff", "tiff_read_bw.tiff");
+ gdTestAssert(fp != NULL);
+ im = gdImageCreateFromTiff(fp);
+ fclose(fp);
+
+ gdTestAssert(im != NULL);
+ gdTestAssert(!gdImageTrueColor(im));
+
+ path = gdTestFilePath2("tiff", "tiff_read_bw_exp.png");
+ gdAssertImageEqualsToFile(path, im);
+ gdFree(path);
+
+ gdImageDestroy(im);
+
+ return gdNumFailures();
+}
diff --git a/tests/xbm/github_bug_109.c b/tests/xbm/github_bug_109.c
index 1a020c6..70b7937 100644
--- a/tests/xbm/github_bug_109.c
+++ b/tests/xbm/github_bug_109.c
@@ -1,35 +1,33 @@
-/**
- * Test reading of XBM images with a width that is not a multiple of 8
- *
- * We're reading such an XBM image, and check that we got what we've expected,
- * instead of an error message.
- *
- * See also <https://github.com/libgd/libgd/issues/109>.
- */
-
-
-#include "gd.h"
-#include "gdtest.h"
-
-
-int main()
-{
- gdImagePtr im;
- FILE *fp;
- char *path;
-
- fp = gdTestFileOpen2("xbm", "github_bug_109.xbm");
- im = gdImageCreateFromXbm(fp);
- fclose(fp);
- gdTestAssert(im != NULL);
- gdTestAssert(gdImageGetTrueColorPixel(im, 0, 0) == 0);
- gdTestAssert(gdImageGetTrueColorPixel(im, 0, 1) == 0xffffff);
-
- path = gdTestFilePath2("xbm", "github_bug_109_exp.png");
- gdAssertImageEqualsToFile(path, im);
- gdFree(path);
-
- gdImageDestroy(im);
-
- return gdNumFailures();
-}
+/**
+ * Test reading of XBM images with a width that is not a multiple of 8
+ *
+ * We're reading such an XBM image, and check that we got what we've expected,
+ * instead of an error message.
+ *
+ * See also <https://github.com/libgd/libgd/issues/109>.
+ */
+
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ FILE *fp;
+ char *path;
+
+ fp = gdTestFileOpen2("xbm", "github_bug_109.xbm");
+ im = gdImageCreateFromXbm(fp);
+ fclose(fp);
+ gdTestAssert(im != NULL);
+ gdTestAssert(gdImageGetTrueColorPixel(im, 0, 0) == 0);
+ gdTestAssert(gdImageGetTrueColorPixel(im, 0, 1) == 0xffffff);
+
+ path = gdTestFilePath2("xbm", "github_bug_109_exp.png");
+ gdAssertImageEqualsToFile(path, im);
+ gdFree(path);
+
+ gdImageDestroy(im);
+
+ return gdNumFailures();
+}
diff --git a/tests/xbm/x10_basic_read.c b/tests/xbm/x10_basic_read.c
index fb643cf..f7c505e 100644
--- a/tests/xbm/x10_basic_read.c
+++ b/tests/xbm/x10_basic_read.c
@@ -1,32 +1,30 @@
-/**
- * Test reading of an X10 style XBM file
- *
- * X10 style XBMs define a short[] instead of a char[] array. We're testing
- * that such files are read correctly, particularly regarding the line padding,
- * which is 2 bytes instead of 1, and the endianess.
- */
-
-
-#include "gd.h"
-#include "gdtest.h"
-
-
-int main()
-{
- gdImagePtr im;
- FILE *fp;
- char *path;
-
- fp = gdTestFileOpen2("xbm", "x10_basic_read.xbm");
- im = gdImageCreateFromXbm(fp);
- fclose(fp);
- gdTestAssert(im != NULL);
-
- path = gdTestFilePath2("xbm", "x10_basic_read_exp.png");
- gdAssertImageEqualsToFile(path, im);
- gdFree(path);
-
- gdImageDestroy(im);
-
- return gdNumFailures();
-}
+/**
+ * Test reading of an X10 style XBM file
+ *
+ * X10 style XBMs define a short[] instead of a char[] array. We're testing
+ * that such files are read correctly, particularly regarding the line padding,
+ * which is 2 bytes instead of 1, and the endianess.
+ */
+
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ FILE *fp;
+ char *path;
+
+ fp = gdTestFileOpen2("xbm", "x10_basic_read.xbm");
+ im = gdImageCreateFromXbm(fp);
+ fclose(fp);
+ gdTestAssert(im != NULL);
+
+ path = gdTestFilePath2("xbm", "x10_basic_read_exp.png");
+ gdAssertImageEqualsToFile(path, im);
+ gdFree(path);
+
+ gdImageDestroy(im);
+
+ return gdNumFailures();
+}
diff --git a/windows/gentest.bat b/windows/gentest.bat
index f57d08b..756e0f9 100644
--- a/windows/gentest.bat
+++ b/windows/gentest.bat
@@ -1,35 +1,35 @@
-SETLOCAL ENABLEDELAYEDEXPANSION
-@echo off
-set testsdir=%~1
-set builddir=%~2
-set CFLAGS=%~3
-set LDFLAGS=%~4
-set CC=%~5
-set LD=%~6
-set TESTMK=%~7
-set TESTLIST=%~8
-echo %*
-echo recieved !testsdir! !builddir! !CFLAGS! !LDFLAGS! !CC!
-
-copy NUL !TESTMK! > nul
-copy NUL !TESTLIST! > nul
-
-for /D %%d in (!testsdir!/*) do (
- if NOT "%%d"=="fontconfig" if NOT "%%d"=="gdtest" for %%f in (!testsdir!/%%d/*.c) do (
- echo TEST_EXES=!builddir!\tests\%%d_%%~nf.exe ^$^(TEST_EXES^) >> !TESTMK!
- )
-)
-
-for /D %%d in (!testsdir!/*) do (
- if NOT "%%d"=="fontconfig" if NOT "%%d"=="gdtest" for %%f in (!testsdir!/%%d/*.c) do (
- echo !builddir!\%%d_%%~nf.obj: !testsdir!\%%d\%%f; ^$^(CC^) ^$^(TEST_CFLAGS^) /c ^$** /Fd$*.pdb /Fo:$@ >> !TESTMK!
- )
-)
-
-for /D %%d in (!testsdir!/*) do (
- if NOT "%%d"=="fontconfig" if NOT "%%d"=="gdtest" for %%f in (!testsdir!/%%d/*.c) do (
- echo !builddir!\tests\%%d_%%~nf.exe: !builddir!\%%d_%%~nf.obj; !LD! !LDFLAGS! $** /out:$@ >> !TESTMK!
- echo %%d_%%~nf.exe >> !TESTLIST!
- )
-)
-ENDLOCAL \ No newline at end of file
+SETLOCAL ENABLEDELAYEDEXPANSION
+@echo off
+set testsdir=%~1
+set builddir=%~2
+set CFLAGS=%~3
+set LDFLAGS=%~4
+set CC=%~5
+set LD=%~6
+set TESTMK=%~7
+set TESTLIST=%~8
+echo %*
+echo recieved !testsdir! !builddir! !CFLAGS! !LDFLAGS! !CC!
+
+copy NUL !TESTMK! > nul
+copy NUL !TESTLIST! > nul
+
+for /D %%d in (!testsdir!/*) do (
+ if NOT "%%d"=="fontconfig" if NOT "%%d"=="gdtest" for %%f in (!testsdir!/%%d/*.c) do (
+ echo TEST_EXES=!builddir!\tests\%%d_%%~nf.exe ^$^(TEST_EXES^) >> !TESTMK!
+ )
+)
+
+for /D %%d in (!testsdir!/*) do (
+ if NOT "%%d"=="fontconfig" if NOT "%%d"=="gdtest" for %%f in (!testsdir!/%%d/*.c) do (
+ echo !builddir!\%%d_%%~nf.obj: !testsdir!\%%d\%%f; ^$^(CC^) ^$^(TEST_CFLAGS^) /c ^$** /Fd$*.pdb /Fo:$@ >> !TESTMK!
+ )
+)
+
+for /D %%d in (!testsdir!/*) do (
+ if NOT "%%d"=="fontconfig" if NOT "%%d"=="gdtest" for %%f in (!testsdir!/%%d/*.c) do (
+ echo !builddir!\tests\%%d_%%~nf.exe: !builddir!\%%d_%%~nf.obj; !LD! !LDFLAGS! $** /out:$@ >> !TESTMK!
+ echo %%d_%%~nf.exe >> !TESTLIST!
+ )
+)
+ENDLOCAL
diff --git a/windows/readme.md b/windows/readme.md
index cd95b79..dce5202 100644
--- a/windows/readme.md
+++ b/windows/readme.md
@@ -1,53 +1,53 @@
-# Building on Windows with Visual Studio 2015
-
-* Get the required dependencies from
- http://windows.php.net/downloads/php-sdk/deps/vc14/ and
- http://windows.php.net/downloads/pecl/deps/, respectively. Choose the x86 or
- x64 packages depending on your needs.
-
- * freetype
- * libiconv
- * libjpeg
- * libpng
- * libtiff
- * libwebp
- * libxpm
- * zlib
-
-* Unpack all dependency packages into the same folder.
-
-* Open the VS2015 x86 or x64 Native Tools Command Prompt.
-
-* Set the environment variable `WITH_DEVEL` to the path where you have unpacked
- the dependencies. `WITH_DEVEL` defaults to `..\deps`.
-
-* If you want a debug build, do
-````
-set DEBUG=1
-````
-
-* `cd` into the libgd source folder.
-
-* To build the libraries, do:
-```
-nmake /f windows\Makefile.vc
-```
-
-* To build and run the tests, do:
-````
-nmake /f windows\Makefile.vc check
-````
-
-* To build the executable programs, do:
-````
-nmake /f windows\Makefile.vc build_progs
-````
-
-* After a successful build, you find the libraries and test executables in
- `..\gdbuild`. You can change the build folder by setting the environment
- variable `WITH_BUILD` to the desired path.
-
-* Before rebuilding, you may have to run:
-```
-nmake /f windows\Makefile.vc clean
-```
+# Building on Windows with Visual Studio 2015
+
+* Get the required dependencies from
+ http://windows.php.net/downloads/php-sdk/deps/vc14/ and
+ http://windows.php.net/downloads/pecl/deps/, respectively. Choose the x86 or
+ x64 packages depending on your needs.
+
+ * freetype
+ * libiconv
+ * libjpeg
+ * libpng
+ * libtiff
+ * libwebp
+ * libxpm
+ * zlib
+
+* Unpack all dependency packages into the same folder.
+
+* Open the VS2015 x86 or x64 Native Tools Command Prompt.
+
+* Set the environment variable `WITH_DEVEL` to the path where you have unpacked
+ the dependencies. `WITH_DEVEL` defaults to `..\deps`.
+
+* If you want a debug build, do
+````
+set DEBUG=1
+````
+
+* `cd` into the libgd source folder.
+
+* To build the libraries, do:
+```
+nmake /f windows\Makefile.vc
+```
+
+* To build and run the tests, do:
+````
+nmake /f windows\Makefile.vc check
+````
+
+* To build the executable programs, do:
+````
+nmake /f windows\Makefile.vc build_progs
+````
+
+* After a successful build, you find the libraries and test executables in
+ `..\gdbuild`. You can change the build folder by setting the environment
+ variable `WITH_BUILD` to the desired path.
+
+* Before rebuilding, you may have to run:
+```
+nmake /f windows\Makefile.vc clean
+```
diff --git a/windows/run_tests.bat b/windows/run_tests.bat
index bd73946..097d3b9 100644
--- a/windows/run_tests.bat
+++ b/windows/run_tests.bat
@@ -1,43 +1,43 @@
-@echo off
-setlocal EnableDelayedExpansion
-if [%PLATFORM%]==[] set PLATFORM=x86
-if [%PREFERREDTOOLARCHITECTURE%]==[x64] set PLATFORM=x64
-set PLATFORM=%PLATFORM:X=x%
-
-set total=0
-set total_passed=0
-set total_failed=0
-set total_missing=0
-
-for /f %%T in (testlist.txt) do (
- set test=%%T
- set output=test: !test!....................................................................
- set target=%%~nT.exe
- if not exist !target! SET result=NotFound
- call !target! && (SET result=Passed) || (SET result=Failed)
-
- rem > last_test.out 2> last_test.err
- rem set /p testerr=<last_test.err
- rem set /p testout=<last_test.out
-
- echo !output:~0,70!!result!
-
- rem if defined testerr echo error: !testerr!
- rem if defined testout echo msg: !testout!
-
- set /a total=total+1
- if "!result!"=="Passed" set /a total_passed=total_passed+1
- if "!result!"=="Failed" set /a total_failed=total_failed+1
- if "!result!"=="NotFound" set /a total_missing=total_missing+1
-
- if defined APPVEYOR (
- appveyor AddTest "!test! %PLATFORM%" -Outcome !result! -Framework Custom -Filename %%~nT.exe -Duration 0
- )
-)
-echo.
-echo Tests: !total!
-echo Passed: !total_passed!
-echo Failed: !total_failed!
-echo Missing: !total_missing!
-
-exit /b 0 \ No newline at end of file
+@echo off
+setlocal EnableDelayedExpansion
+if [%PLATFORM%]==[] set PLATFORM=x86
+if [%PREFERREDTOOLARCHITECTURE%]==[x64] set PLATFORM=x64
+set PLATFORM=%PLATFORM:X=x%
+
+set total=0
+set total_passed=0
+set total_failed=0
+set total_missing=0
+
+for /f %%T in (testlist.txt) do (
+ set test=%%T
+ set output=test: !test!....................................................................
+ set target=%%~nT.exe
+ if not exist !target! SET result=NotFound
+ call !target! && (SET result=Passed) || (SET result=Failed)
+
+ rem > last_test.out 2> last_test.err
+ rem set /p testerr=<last_test.err
+ rem set /p testout=<last_test.out
+
+ echo !output:~0,70!!result!
+
+ rem if defined testerr echo error: !testerr!
+ rem if defined testout echo msg: !testout!
+
+ set /a total=total+1
+ if "!result!"=="Passed" set /a total_passed=total_passed+1
+ if "!result!"=="Failed" set /a total_failed=total_failed+1
+ if "!result!"=="NotFound" set /a total_missing=total_missing+1
+
+ if defined APPVEYOR (
+ appveyor AddTest "!test! %PLATFORM%" -Outcome !result! -Framework Custom -Filename %%~nT.exe -Duration 0
+ )
+)
+echo.
+echo Tests: !total!
+echo Passed: !total_passed!
+echo Failed: !total_failed!
+echo Missing: !total_missing!
+
+exit /b 0