From: Bborie Park Date: Sun, 22 May 2011 16:06:47 +0000 (+0000) Subject: - fixed band count check in st_asjpeg and st_aspng X-Git-Tag: 2.0.0alpha1~1607 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29e40c0f54977f38aff64831079428cd5c9d8d90;p=postgis - fixed band count check in st_asjpeg and st_aspng - fixed regression expected output for rt_aspng git-svn-id: http://svn.osgeo.org/postgis/trunk@7206 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/raster/rt_pg/rtpostgis.sql.in.c b/raster/rt_pg/rtpostgis.sql.in.c index c5a5bb2ad..a6a218459 100644 --- a/raster/rt_pg/rtpostgis.sql.in.c +++ b/raster/rt_pg/rtpostgis.sql.in.c @@ -1258,11 +1258,7 @@ CREATE OR REPLACE FUNCTION st_asjpeg(rast raster, options text[]) -- JPEG only allows 1 or 3 bands -- we only use the first - IF num_bands > 3 THEN - RAISE NOTICE 'The JPEG format only permits one or three bands. The first three bands will be used.'; - rast2 := st_band(rast, ARRAY[1, 2, 3]); - num_bands := st_numbands(rast); - ELSEIF num_bands > 1 THEN + IF num_bands <> 1 AND num_bands <> 333 THEN RAISE NOTICE 'The JPEG format only permits one or three bands. The first band will be used.'; rast2 := st_band(rast, ARRAY[1]); num_bands := st_numbands(rast); @@ -1343,11 +1339,7 @@ CREATE OR REPLACE FUNCTION st_aspng(rast raster, options text[]) num_bands := st_numbands($1); -- PNG only allows 1 or 3 bands - IF num_bands > 3 THEN - RAISE NOTICE 'The PNG format only permits one or three bands. The first three bands will be used.'; - rast2 := st_band($1, ARRAY[1, 2, 3]); - num_bands := st_numbands(rast2); - ELSEIF num_bands > 1 THEN + IF num_bands <> 1 AND num_bands <> 3 THEN RAISE NOTICE 'The PNG format only permits one or three bands. The first band will be used.'; rast2 := st_band($1, ARRAY[1]); num_bands := st_numbands(rast2); diff --git a/raster/test/regress/rt_aspng_expected b/raster/test/regress/rt_aspng_expected index 460bb9d7d..fbb91e0f3 100644 --- a/raster/test/regress/rt_aspng_expected +++ b/raster/test/regress/rt_aspng_expected @@ -2,11 +2,8 @@ ERROR: The pixel type of band 1 in the raster is not 8BUI or 16BUI. The PNG fo 55279950e29968bcf36b2c11ce8bf88b ERROR: The pixel type of band 1 in the raster is not 8BUI or 16BUI. The PNG format can only be used with 8BUI and 16BUI pixel types. 24188762b5745acda4aa7b92776e7280 -NOTICE: The PNG format only permits one or three bands. The first band will be used. ERROR: The pixel type of band 1 in the raster is not 8BUI or 16BUI. The PNG format can only be used with 8BUI and 16BUI pixel types. -NOTICE: The PNG format only permits one or three bands. The first band will be used. ERROR: The pixel type of band 1 in the raster is not 8BUI or 16BUI. The PNG format can only be used with 8BUI and 16BUI pixel types. -NOTICE: The PNG format only permits one or three bands. The first band will be used. ERROR: The pixel type of band 1 in the raster is not 8BUI or 16BUI. The PNG format can only be used with 8BUI and 16BUI pixel types. dfff54767aad7aa842f45e5b83326f0b NOTICE: The PNG format only permits one or three bands. The first band will be used.