office/Ted: Updated for version 2.22.

Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
This commit is contained in:
Hannes Worst 2012-06-02 19:59:45 -04:00 committed by Erik Hanson
parent a54303fdaf
commit f0619135ba
6 changed files with 1146 additions and 453 deletions

View file

@ -1,10 +1,10 @@
#!/bin/sh
#!/bin/sh
# Slackware build script for Ted
# and edited by Hannes Worst <hannesworst@gmail.com>.
# Copyright by Hannes Worst
#--
# Last edited: 30-dec-2009
# Last edited: 01-05-2012
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
@ -24,9 +24,10 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Very heavily edited by the SlackBuilds.org project. --michiel
# DocSectProperies Bug-fix provided bij Mark de Does, developer of Ted
PRGNAM=Ted
VERSION=${VERSION:-2.21}
VERSION=${VERSION:-2.22}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@ -46,14 +47,14 @@ OUTPUT=${OUTPUT:-/tmp}
TOOLKIT=${TOOLKIT:-GTK}
SRCNAM=$(echo $PRGNAM | tr T t)
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
fi
@ -64,6 +65,7 @@ mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$SRCNAM-$VERSION.src.tar.gz
cp $CWD/docSectProperties.c $PRGNAM-$VERSION/docBase/docSectProperties.c
cd $PRGNAM-$VERSION
chown -R root:root .
find . \
@ -72,9 +74,6 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# Correct libpng error
patch -p0 < $CWD/ted-2.21-libpng15.patch
# Let's edit Ted's Makefile, so this allows us to package Ted quite properly without
# actually having to need /usr/local/.
sed -i 's#./configure#./configure --prefix=/usr/share#g' $TMP/$PRGNAM-$VERSION/Makefile
@ -92,31 +91,26 @@ make package.shared DESTDIR=$PKG CONFIGURE_OPTIONS="--with-$TOOLKIT \
--prefix=/usr/share/$PRGNAM --bindir=/usr/bin \
--build=$ARCH-slackware-linux"
mkdir -p $PKG/usr/share
tar -xvf $TMP/$PRGNAM-$VERSION/${SRCNAM}Package/$SRCNAM-$VERSION-linux-$ARCH.tar.gz -C $PKG/usr/share/
mv $PKG/usr/share/bin $PKG/usr/
mkdir -p $PKG/usr/man/man1
mv $PKG/usr/share/$PRGNAM/{rtf2pdf,rtf2ps,$PRGNAM}.1 $PKG/usr/man/man1
mkdir -p $PKG/usr/
tar -xvf $TMP/$PRGNAM-$VERSION/${SRCNAM}Package/$SRCNAM-$VERSION-linux-*$LIBDIRSUFFIX.tar.gz -C $PKG/usr/
mv $PKG/usr/Ted $PKG/usr/share
mv $PKG/usr/share/$PRGNAM/{rtf2pdf,rtf2ps}.sh $PKG/usr/bin/
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
mkdir -p $PKG/usr/man/man1
mv $PKG/usr/share/$PRGNAM/{rtf2pdf,rtf2ps,$PRGNAM}.1 $PKG/usr/man/man1
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cat $PKG/usr/share/$PRGNAM/$PRGNAM.ad.sample > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.ad.sample
cat $PKG/usr/share/$PRGNAM/config/$PRGNAM.ad.sample > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.ad.sample
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/usr/share/applications
mv $PKG/usr/share/$PRGNAM/varia/$PRGNAM.desktop $PKG/usr/share/applications/$PRGNAM.desktop
sed -i 's#/local/#/share/#' $PKG/usr/share/applications/$PRGNAM.desktop
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

17
office/Ted/Ted.desktop Normal file
View file

@ -0,0 +1,17 @@
# Desktop entry for Ted.
# System wide install as /usr/share/applications, or /usr/local/share/applications
# Private install as $HOME/.local/share/applications
# See http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.0.html
# See http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html
[Desktop Entry]
Version=1.0
Type=Application
Name=Ted rtf text processor
GenericName=rtf text processor
Comment=A lightweight rtf text processor
Icon=/usr/share/Ted/Ted.png
Exec=Ted %F
Terminal=false
MimeType=application/rtf;text/rtf;
Categories=Office;WordProcessor;
#StartupNotify=false

View file

@ -1,10 +1,10 @@
PRGNAM="Ted"
VERSION="2.21"
VERSION="2.22"
HOMEPAGE="http://www.nllgg.nl/Ted/"
DOWNLOAD="ftp://ftp.nluug.nl/pub/editors/ted/ted-2.21.src.tar.gz"
MD5SUM="34ae855938a3b364eb587cca504ba356"
DOWNLOAD="ftp://ftp.nluug.nl/pub/editors/ted/ted-2.22.src.tar.gz"
MD5SUM="08162c9164dfdde1d46e41ae64df16be"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
MAINTAINER="Hannes Worst"
EMAIL="hannesworst@gmail.com"
APPROVED="BP{k},Niels Horn"
APPROVED="dsomero"

File diff suppressed because it is too large Load diff

View file

@ -10,7 +10,7 @@ Ted: Ted (a lightweight WYSIWYG wordprocessor)
Ted:
Ted: Ted is a lightweight wordprocessor that emphasizes simplicity,
Ted: but with many features.
Ted: There are additional packages for different languages
Ted: There are additional packages for different languages
Ted: to be found on the hompage. Ted is simple to use and easily compiled.
Ted: It starts up quickly.
Ted:

View file

@ -1,423 +0,0 @@
This patch is from netbsd pkgsrc
ftp://ftp.netbsd.org/pub/NetBSD/packages/pkgsrc/editors/ted/patches/
--- bitmap/bmpng.c
+++ bitmap/bmpng.c
@@ -20,23 +20,32 @@
/* */
/************************************************************************/
-static int bpPngiToBitmap( const png_info * pngi,
+static int bpPngiToBitmap( const png_structp pngp,
+ png_info * pngi,
BitmapDescription * bd )
{
unsigned int col;
+ png_uint_32 res_x, res_y;
+ int unit_type= 0;
- bd->bdPixelsWide= pngi->width;
- bd->bdPixelsHigh= pngi->height;
+ bd->bdPixelsWide= png_get_image_width( pngp, pngi );
+ bd->bdPixelsHigh= png_get_image_height( pngp, pngi );
bd->bdHasAlpha= 0;
- switch( pngi->color_type )
+ switch( png_get_color_type( pngp, pngi ) )
{
case PNG_COLOR_TYPE_PALETTE:
+ {
+ int num_palette;
+ png_colorp palette;
+
+ png_get_PLTE( pngp, pngi, &palette, &num_palette );
+
bd->bdColorEncoding= BMcoRGB8PALETTE;
- bd->bdColorCount= pngi->num_palette;
+ bd->bdColorCount= num_palette;
bd->bdBitsPerSample= 8;
bd->bdSamplesPerPixel= 3;
- bd->bdBitsPerPixel= pngi->bit_depth;
+ bd->bdBitsPerPixel= png_get_bit_depth( pngp, pngi );
bd->bdRGB8Palette= (RGB8Color *)
malloc( bd->bdColorCount* sizeof(RGB8Color) );
@@ -46,47 +55,51 @@ static int bpPngiToBitmap( const png_inf
for ( col= 0; col < bd->bdColorCount; col++ )
{
- bd->bdRGB8Palette[col].rgb8Red= pngi->palette[col].red;
- bd->bdRGB8Palette[col].rgb8Green= pngi->palette[col].green;
- bd->bdRGB8Palette[col].rgb8Blue= pngi->palette[col].blue;
+ bd->bdRGB8Palette[col].rgb8Red= palette[col].red;
+ bd->bdRGB8Palette[col].rgb8Green= palette[col].green;
+ bd->bdRGB8Palette[col].rgb8Blue= palette[col].blue;
bd->bdRGB8Palette[col].rgb8Alpha= 0;
}
+ }
break;
case PNG_COLOR_TYPE_RGB:
bd->bdColorEncoding= BMcoRGB;
- bd->bdBitsPerSample= pngi->bit_depth;
- bd->bdSamplesPerPixel= pngi->channels;
- bd->bdBitsPerPixel= pngi->pixel_depth;
+ bd->bdBitsPerSample= png_get_bit_depth( pngp, pngi );
+ bd->bdSamplesPerPixel= png_get_channels( pngp, pngi );
+ bd->bdBitsPerPixel= bd->bdSamplesPerPixel* bd->bdBitsPerSample;
break;
case PNG_COLOR_TYPE_GRAY:
bd->bdColorEncoding= BMcoWHITEBLACK;
- bd->bdBitsPerSample= pngi->bit_depth;
- bd->bdSamplesPerPixel= pngi->channels;
- bd->bdBitsPerPixel= pngi->pixel_depth;
+ bd->bdBitsPerSample= png_get_bit_depth( pngp, pngi );
+ bd->bdSamplesPerPixel= png_get_channels( pngp, pngi );
+ bd->bdBitsPerPixel= bd->bdSamplesPerPixel* bd->bdBitsPerSample;
break;
case PNG_COLOR_TYPE_RGB_ALPHA:
bd->bdHasAlpha= 1;
bd->bdColorEncoding= BMcoRGB;
- bd->bdBitsPerSample= pngi->bit_depth;
- bd->bdSamplesPerPixel= pngi->channels;
- bd->bdBitsPerPixel= pngi->pixel_depth;
+ bd->bdBitsPerSample= png_get_bit_depth( pngp, pngi );
+ bd->bdSamplesPerPixel= png_get_channels( pngp, pngi );
+ bd->bdBitsPerPixel= bd->bdSamplesPerPixel* bd->bdBitsPerSample;
break;
case PNG_COLOR_TYPE_GRAY_ALPHA:
bd->bdHasAlpha= 1;
- LDEB(pngi->color_type); return -1;
+ LDEB(png_get_color_type( pngp, pngi )); return -1;
default:
- LDEB(pngi->color_type); return -1;
+ LDEB(png_get_color_type( pngp, pngi )); return -1;
}
- bd->bdBytesPerRow= pngi->rowbytes;
+ bd->bdBytesPerRow= png_get_rowbytes( pngp, pngi );
bd->bdBufferLength= bd->bdBytesPerRow* bd->bdPixelsHigh;
- switch( pngi->phys_unit_type )
+ if ( ! png_get_pHYs( pngp, pngi, &res_x, &res_y, &unit_type ) )
+ { unit_type= PNG_RESOLUTION_UNKNOWN; }
+
+ switch( unit_type )
{
case PNG_RESOLUTION_UNKNOWN:
bd->bdUnit= BMunPIXEL;
@@ -96,12 +109,12 @@ static int bpPngiToBitmap( const png_inf
case PNG_RESOLUTION_METER:
bd->bdUnit= BMunM;
- bd->bdXResolution= pngi->x_pixels_per_unit;
- bd->bdYResolution= pngi->y_pixels_per_unit;
+ bd->bdXResolution= res_x;
+ bd->bdYResolution= res_y;
break;
default:
- LDEB(pngi->phys_unit_type);
+ LDEB(unit_type);
return -1;
}
@@ -119,11 +132,11 @@ static int bmPngReadContents( png_info *
unsigned char * buffer;
numberOfPasses= 1;
- if ( pngi->interlace_type )
+ if ( png_get_interlace_type( png, pngi ) )
{ numberOfPasses= png_set_interlace_handling( png ); }
- if ( pngi->color_type == PNG_COLOR_TYPE_RGB &&
- pngi->bit_depth == 16 )
+ if ( png_get_color_type( png, pngi ) == PNG_COLOR_TYPE_RGB &&
+ png_get_bit_depth( png, pngi ) == 16 )
{
const unsigned short one= 1;
const unsigned char * testEndian= (const unsigned char *)&one;
@@ -133,9 +146,6 @@ static int bmPngReadContents( png_info *
}
png_start_read_image( png );
- /*
- png_read_update_info( png, pngi );
- */
buffer= (unsigned char *)malloc( bd->bdBufferLength );
if ( ! buffer )
@@ -236,9 +246,9 @@ int bmPngReadPng( BitmapDescription * bd
png_read_info( pngp, pngip );
- if ( bpPngiToBitmap( pngip, bd ) )
+ if ( bpPngiToBitmap( pngp, pngip, bd ) )
{
- LLLDEB(pngip->color_type,bd->bdColorCount,bd->bdRGB8Palette);
+ LLDEB(bd->bdColorCount,bd->bdRGB8Palette);
png_destroy_read_struct( &pngp, &pngip, (png_infop *)0 );
return -1;
}
@@ -282,44 +292,43 @@ int bmCanWritePngFile( const BitmapDescr
static int bpPngiFromBitmap( png_structp png,
png_info * pngi,
+ png_colorp * pPalette,
const BitmapDescription * bd )
{
- png_info_init( pngi );
- pngi->width= bd->bdPixelsWide;
- pngi->height= bd->bdPixelsHigh;
+ int bit_depth;
+ int color_type;
+ png_color_8 sig_bit;
switch( bd->bdUnit )
{
case BMunM:
- pngi->phys_unit_type= PNG_RESOLUTION_METER;
- pngi->x_pixels_per_unit= bd->bdXResolution;
- pngi->y_pixels_per_unit= bd->bdYResolution;
- pngi->valid |= PNG_INFO_pHYs;
+ png_set_pHYs( png, pngi,
+ bd->bdXResolution,
+ bd->bdYResolution,
+ PNG_RESOLUTION_METER);
break;
case BMunINCH:
- pngi->phys_unit_type= PNG_RESOLUTION_METER;
- pngi->x_pixels_per_unit= (int)( 39.37* bd->bdXResolution );
- pngi->y_pixels_per_unit= (int)( 39.37* bd->bdYResolution );
- pngi->valid |= PNG_INFO_pHYs;
+ png_set_pHYs( png, pngi,
+ (int)( 39.37* bd->bdXResolution ),
+ (int)( 39.37* bd->bdYResolution ),
+ PNG_RESOLUTION_METER);
break;
case BMunPOINT:
- pngi->phys_unit_type= PNG_RESOLUTION_METER;
- pngi->x_pixels_per_unit= POINTS_PER_M* bd->bdXResolution;
- pngi->y_pixels_per_unit= POINTS_PER_M* bd->bdYResolution;
- pngi->valid |= PNG_INFO_pHYs;
+ png_set_pHYs( png, pngi,
+ POINTS_PER_M* bd->bdXResolution,
+ POINTS_PER_M* bd->bdYResolution,
+ PNG_RESOLUTION_METER);
break;
case BMunPIXEL:
- pngi->phys_unit_type= PNG_RESOLUTION_UNKNOWN;
- pngi->x_pixels_per_unit= 1;
- pngi->y_pixels_per_unit= 1;
+ png_set_pHYs(png, pngi, 1, 1, PNG_RESOLUTION_UNKNOWN);
break;
default:
LDEB(bd->bdUnit);
- pngi->phys_unit_type= PNG_RESOLUTION_UNKNOWN;
+ png_set_pHYs(png, pngi, 1, 1, PNG_RESOLUTION_UNKNOWN);
break;
}
@@ -329,41 +338,48 @@ static int bpPngiFromBitmap( png_structp
case BMcoBLACKWHITE:
case BMcoWHITEBLACK:
- pngi->bit_depth= bd->bdBitsPerPixel;
+ bit_depth= bd->bdBitsPerPixel;
if ( bd->bdHasAlpha )
- { pngi->color_type= PNG_COLOR_TYPE_GRAY_ALPHA; }
- else{ pngi->color_type= PNG_COLOR_TYPE_GRAY; }
- pngi->sig_bit.gray= bd->bdBitsPerSample;
+ { color_type= PNG_COLOR_TYPE_GRAY_ALPHA; }
+ else{ color_type= PNG_COLOR_TYPE_GRAY; }
+ sig_bit.gray= bd->bdBitsPerSample;
break;
case BMcoRGB:
- pngi->bit_depth= bd->bdBitsPerSample;
+ bit_depth= bd->bdBitsPerSample;
if ( bd->bdHasAlpha )
- { pngi->color_type= PNG_COLOR_TYPE_RGB_ALPHA; }
- else{ pngi->color_type= PNG_COLOR_TYPE_RGB; }
- pngi->sig_bit.red= bd->bdBitsPerSample;
- pngi->sig_bit.green= bd->bdBitsPerSample;
- pngi->sig_bit.blue= bd->bdBitsPerSample;
+ { color_type= PNG_COLOR_TYPE_RGB_ALPHA; }
+ else{ color_type= PNG_COLOR_TYPE_RGB; }
+ sig_bit.red= bd->bdBitsPerSample;
+ sig_bit.green= bd->bdBitsPerSample;
+ sig_bit.blue= bd->bdBitsPerSample;
break;
case BMcoRGB8PALETTE:
- pngi->bit_depth= bd->bdBitsPerPixel;
- pngi->color_type= PNG_COLOR_TYPE_PALETTE;
+ bit_depth= bd->bdBitsPerPixel;
+ color_type= PNG_COLOR_TYPE_PALETTE;
- pngi->valid |= PNG_INFO_PLTE;
- pngi->palette= (png_color *)malloc( 256* sizeof( png_color ) );
- if ( ! pngi->palette )
- { XDEB(pngi->palette); return -1; }
- pngi->num_palette= bd->bdColorCount;
- pngi->sig_bit.red= bd->bdBitsPerSample;
- pngi->sig_bit.green= bd->bdBitsPerSample;
- pngi->sig_bit.blue= bd->bdBitsPerSample;
- for ( i= 0; i < pngi->num_palette; i++ )
+ if ( bd->bdColorCount > PNG_MAX_PALETTE_LENGTH )
{
- pngi->palette[i].red= bd->bdRGB8Palette[i].rgb8Red;
- pngi->palette[i].green= bd->bdRGB8Palette[i].rgb8Green;
- pngi->palette[i].blue= bd->bdRGB8Palette[i].rgb8Blue;
+ LLDEB(bd->bdColorCount,PNG_MAX_PALETTE_LENGTH);
+ return -1;
}
+
+ *pPalette= (png_color *)malloc( PNG_MAX_PALETTE_LENGTH*
+ sizeof( png_color ) );
+ if ( ! *pPalette )
+ { XDEB(*pPalette); return -1; }
+ sig_bit.red= bd->bdBitsPerSample;
+ sig_bit.green= bd->bdBitsPerSample;
+ sig_bit.blue= bd->bdBitsPerSample;
+ for ( i= 0; i < bd->bdColorCount; i++ )
+ {
+ (*pPalette)[i].red= bd->bdRGB8Palette[i].rgb8Red;
+ (*pPalette)[i].green= bd->bdRGB8Palette[i].rgb8Green;
+ (*pPalette)[i].blue= bd->bdRGB8Palette[i].rgb8Blue;
+ }
+
+ png_set_PLTE( png, pngi, (*pPalette), bd->bdColorCount );
break;
default:
@@ -371,7 +387,13 @@ static int bpPngiFromBitmap( png_structp
return -1;
}
- pngi->interlace_type= 0;
+ png_set_sBIT( png, pngi, &sig_bit );
+ png_set_IHDR( png, pngi,
+ bd->bdPixelsWide, bd->bdPixelsHigh,
+ bit_depth, color_type,
+ PNG_INTERLACE_NONE,
+ PNG_COMPRESSION_TYPE_BASE,
+ PNG_FILTER_TYPE_BASE );
return 0;
}
@@ -395,8 +417,8 @@ static void bmPngWriteContents( png_stru
}
}
- if ( pngi->color_type == PNG_COLOR_TYPE_RGB &&
- bd->bdBitsPerSample == 16 )
+ if ( png_get_color_type( png, pngi ) == PNG_COLOR_TYPE_RGB &&
+ bd->bdBitsPerSample == 16 )
{
const unsigned short one= 1;
const unsigned char * testEndian= (const unsigned char *)&one;
@@ -431,9 +453,9 @@ static void bmPngWriteContents( png_stru
from= scratch;
}
- if ( pngi->color_type == PNG_COLOR_TYPE_RGB &&
- bd->bdBitsPerSample == 16 &&
- scratch )
+ if ( png_get_color_type( png, pngi ) == PNG_COLOR_TYPE_RGB &&
+ bd->bdBitsPerSample == 16 &&
+ scratch )
{
int col;
const BmUint16 * fr= (const BmUint16 *)from;
@@ -453,10 +475,6 @@ static void bmPngWriteContents( png_stru
png_write_end( png, pngi );
- if ( bd->bdColorEncoding == BMcoRGB8PALETTE &&
- pngi->palette )
- { free( pngi->palette ); }
-
if ( scratch )
{ free( scratch ); }
@@ -510,50 +528,43 @@ int bmPngWritePng( const BitmapDescript
const unsigned char * buffer,
SimpleOutputStream * sos )
{
+ int rval= 0;
png_structp pngp= (png_structp)0;
png_infop pngip= (png_infop)0;
+ png_colorp palette= (png_colorp)0;
pngp = png_create_write_struct( PNG_LIBPNG_VER_STRING, (void *)0,
(png_error_ptr)0, (png_error_ptr)0 );
if ( ! pngp )
- { LDEB(1); return -1; }
+ { XDEB(pngp); rval= -1; goto ready; }
pngip = png_create_info_struct( pngp );
if ( ! pngip )
- {
- LDEB(1);
- png_destroy_write_struct( &pngp, (png_infop *)0 );
- return -1;
- }
+ { XDEB(pngip); rval= -1; goto ready; }
+
+ /*
+ As the info struct is built by libpng this is not needed:
+ (The call will disappear from libpng in version 1.4)
+ png_info_init( pngi );
+ */
if ( setjmp( png_jmpbuf( pngp ) ) )
- {
- LDEB(1);
- png_destroy_write_struct( &pngp, &pngip );
- /* Crashes:
- if ( bd->bdColorEncoding == BMcoRGB8PALETTE &&
- pngip->palette )
- { free( pngip->palette ); }
- */
- return -1;
- }
+ { LDEB(1); rval= -1; goto ready; }
png_init_io( pngp, (FILE *)0 );
png_set_write_fn( pngp, (void *)sos, bmPngWriteBytes, bmPngFlushBytes );
- if ( bpPngiFromBitmap( pngp, pngip, bd ) )
- {
- LDEB(bd->bdColorEncoding);
- png_destroy_write_struct( &pngp, &pngip );
- return -1;
- }
-
- /*
- png_write_info( pngp, pngip );
- */
+ if ( bpPngiFromBitmap( pngp, pngip, &palette, bd ) )
+ { LDEB(bd->bdColorEncoding); rval= -1; goto ready; }
bmPngWriteContents( pngp, pngip, buffer, bd );
+ ready:
+
+ if ( palette )
+ { free( palette ); }
+
png_destroy_write_struct( &pngp, &pngip );
- return 0;
+
+ return rval;
}