[devel] Removed spurious tabs, shorten long lines (no source change)

Also added scripts/chkfmt to validate the format of all the files that can
reasonably be validated (it is suggested to run "make distclean" before
checking, because some machine generated files have long lines.)
Reformatted the CHANGES file to be more consistent throughout.
This commit is contained in:
Glenn Randers-Pehrson 2010-08-18 20:25:36 -05:00
parent 11966d9c55
commit a313751258
16 changed files with 1555 additions and 1258 deletions

View File

@ -350,6 +350,11 @@ version 1.5.0beta42 [August 18, 2010]
literal pointers declare them (John Bowler).
version 1.5.0beta43 [August 11, 2010]
Removed spurious tabs, shorten long lines (no source change)
Also added scripts/chkfmt to validate the format of all the files that can
reasonably be validated (it is suggested to run "make distclean" before
checking, because some machine generated files have long lines.)
Reformatted the CHANGES file to be more consistent throughout.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit

1345
CHANGES

File diff suppressed because it is too large Load Diff

View File

@ -4,22 +4,22 @@
#
# WARNING: if you run this you will change the versions
# of the tools which are used and, maybe, required!
touch Makefile.am configure.ac
touch Makefile.am configure.ac
{
echo "running libtoolize" >&2
libtoolize --force --copy --automake
echo "running libtoolize" >&2
libtoolize --force --copy --automake
} && {
echo "running aclocal" >&2
aclocal
echo "running aclocal" >&2
aclocal
} && {
echo "running autoheader [ignore the warnings]" >&2
autoheader
echo "running autoheader [ignore the warnings]" >&2
autoheader
} && {
echo "running automake" >&2
automake --force-missing --foreign -a -c
echo "running automake" >&2
automake --force-missing --foreign -a -c
} && {
echo "running autoconf" >&2
autoconf
echo "running autoconf" >&2
autoconf
} &&
echo "autogen complete" >&2 ||
echo "ERROR: autogen.sh failed, autogen is incomplete" >&2
echo "autogen complete" >&2 ||
echo "ERROR: autogen.sh failed, autogen is incomplete" >&2

View File

@ -1,12 +1,12 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
@ -56,7 +56,7 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it

View File

@ -63,9 +63,9 @@ BUILD INSTRUCTIONS
- Prerequisites (in order of compilation):
- zlib http://zlib.net/
- libpng http://www.libpng.org/pub/png/libpng.html
- pngbook http://www.libpng.org/pub/png/book/sources.html
- zlib http://zlib.net/
- libpng http://www.libpng.org/pub/png/libpng.html
- pngbook http://www.libpng.org/pub/png/book/sources.html
The pngbook demo programs are explicitly designed to demonstrate proper
coding techniques for using the libpng reference library. As a result,
@ -165,19 +165,19 @@ RUNNING THE PROGRAMS: (VERY) BRIEF INTRO
rpng is a simple PNG viewer that can display transparent PNGs with a
specified background color; for example,
rpng -bgcolor \#ff0000 toucan.png
rpng -bgcolor \#ff0000 toucan.png
would display the image with a red background. rpng2 is a progressive
viewer that simulates a web browser in some respects; it can display
images against either a background color or a dynamically generated
background image. For example:
rpng2 -bgpat 16 toucan.png
rpng2 -bgpat 16 toucan.png
wpng is a purely command-line image converter from binary PBMPLUS/NetPBM
format (.pgm or .ppm) to PNG; for example,
wpng -time < toucan-notrans.ppm > toucan-notrans.png
wpng -time < toucan-notrans.ppm > toucan-notrans.png
would convert the specified PPM file (using redirection) to PNG, auto-
matically setting the PNG modification-time chunk.

View File

@ -263,7 +263,8 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
return NULL;
}
Trace((stderr, "readpng_get_image: channels = %d, rowbytes = %ld, height = %ld\n", *pChannels, rowbytes, height));
Trace((stderr, "readpng_get_image: channels = %d, rowbytes = %ld, height = %ld\n",
*pChannels, rowbytes, height));
/* set the individual row_pointers to point at the correct offsets */

View File

@ -341,10 +341,10 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
#else
if (png_get_gAMA_fixed(png_ptr, info_ptr, &gamma))
png_set_gamma_fixed(png_ptr,
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), gamma);
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), gamma);
else
png_set_gamma_fixed(png_ptr,
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), 45455);
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), 45455);
#endif
/* we'll let libpng expand interlaced images, too */

View File

@ -782,8 +782,8 @@ static void rpng2_x_init(void)
/* GRR TEMPORARY HACK: this is fundamentally no different from cases
* above; libpng should call our error handler to longjmp() back to us
* when png_ptr goes away. If we/it segfault instead, seems like a
* libpng bug... */
* when png_ptr goes away. If we/it segfault instead, seems like a
* libpng bug... */
/* we're here via libpng callback, so if window fails, clean and bail */
readpng2_cleanup(&rpng2_info);

View File

@ -104,8 +104,8 @@ while test $# -gt 0; do
;;
--ldopts)
echo ${ldopts}
;;
echo ${ldopts}
;;
--ldflags)
echo ${ldopts} ${L_opts} ${R_opts} ${libs}
@ -113,7 +113,7 @@ while test $# -gt 0; do
--static)
R_opts=""
libs=${all_libs}
libs=${all_libs}
;;
*)

View File

@ -288,14 +288,14 @@
#ifndef PNG_FUNCTION
# ifdef __GNUC__
# define PNG_FUNCTION(type, name, args, attributes)\
attributes type name args
attributes type name args
# else /* !GNUC */
# ifdef _MSC_VER
# define PNG_FUNCTION(type, name, args, attributes)\
attributes type name args
attributes type name args
# else /* !MSC */
# define PNG_FUNCTION(type, name, args, attributes)\
type name args
type name args
# endif
# endif
#endif
@ -430,18 +430,18 @@
#endif
#ifndef PNG_FP_EXPORT /* A floating point API. */
# ifdef PNG_FLOATING_POINT_SUPPORTED
# define PNG_FP_EXPORT(type, name, args, attributes, ordinal)\
PNG_EXPORT(type, name, args, attributes, ordinal)
# define PNG_FP_EXPORT(type, name, args, attributes, ordinal)\
PNG_EXPORT(type, name, args, attributes, ordinal)
# else /* No floating point APIs */
# define PNG_FP_EXPORT(type, name, args, attributes, ordinal)
# define PNG_FP_EXPORT(type, name, args, attributes, ordinal)
# endif
#endif
#ifndef PNG_FIXED_EXPORT /* A fixed point API. */
# ifdef PNG_FIXED_POINT_SUPPORTED
# define PNG_FIXED_EXPORT(type, name, args, attributes, ordinal)\
PNG_EXPORT(type, name, args, attributes, ordinal)
# define PNG_FIXED_EXPORT(type, name, args, attributes, ordinal)\
PNG_EXPORT(type, name, args, attributes, ordinal)
# else /* No fixed point APIs */
# define PNG_FIXED_EXPORT(type, name, args, attributes, ordinal)
# define PNG_FIXED_EXPORT(type, name, args, attributes, ordinal)
# endif
#endif

View File

@ -1023,7 +1023,8 @@ png_init_read_transformations(png_structp png_ptr)
}
for (i = 0; i < num_palette; i++)
{
if (i < (int)png_ptr->num_trans && png_ptr->trans_alpha[i] != 0xff)
if (i < (int)png_ptr->num_trans &&
png_ptr->trans_alpha[i] != 0xff)
{
if (png_ptr->trans_alpha[i] == 0)
{

View File

@ -12,14 +12,14 @@
# work with any awk
BEGIN{
err=0
master="" # master file
official[1] = "" # defined symbols from master file
symbol[1] = "" # defined symbols from png.h
removed[1] = "" # removed symbols from png.h
lasto = 0 # last ordinal value from png.h
mastero = 0 # highest ordinal in master file
symbolo = 0 # highest ordinal in png.h
err=0
master="" # master file
official[1] = "" # defined symbols from master file
symbol[1] = "" # defined symbols from png.h
removed[1] = "" # removed symbols from png.h
lasto = 0 # last ordinal value from png.h
mastero = 0 # highest ordinal in master file
symbolo = 0 # highest ordinal in png.h
}
# Read existing definitions from the master file (the first
@ -29,23 +29,23 @@ BEGIN{
# symbol @ordinal
#
master == "" {
master = FILENAME;
master = FILENAME
}
FILENAME==master && NF==2 && $2~/^@/ && $1!~/^;/ {
o=0+substr($2,2)
if (o > 0) {
if (official[o] == "") {
official[o] = $1
if (o > mastero) mastero = o
next
} else
print master ": duplicated symbol:", official[o] ":", $0
} else
print master ": bad export line format:", $0
err = 1
o=0+substr($2,2)
if (o > 0) {
if (official[o] == "") {
official[o] = $1
if (o > mastero) mastero = o
next
} else
print master ": duplicated symbol:", official[o] ":", $0
} else
print master ": bad export line format:", $0
err = 1
}
FILENAME==master {
next
next
}
# Read new definitions, these are free form but the lines must
@ -54,102 +54,92 @@ FILENAME==master {
# than PNG_EXPORT. Use symbols.dfn or pngwin.dfn to generate the
# input file.
#
# symbol @ordinal # two fields, exported symbol
# ; symbol @ordinal # three fields, removed symbol
# ; @ordinal # two fields, the last ordinal
# symbol @ordinal # two fields, exported symbol
# ; symbol @ordinal # three fields, removed symbol
# ; @ordinal # two fields, the last ordinal
NF==2 && $1 == ";" && $2 ~ /^@[1-9][0-9]*$/ { # last ordinal
o=0+substr($2,2)
if (lasto == 0 || lasto == o)
lasto=o
else {
print "png.h: duplicated last ordinal:", lasto, o
err = 1
}
next
o=0+substr($2,2)
if (lasto == 0 || lasto == o)
lasto=o
else {
print "png.h: duplicated last ordinal:", lasto, o
err = 1
}
next
}
NF==3 && $1 == ";" && $3 ~ /^@[1-9][0-9]*$/ { # removed symbol
o=0+substr($3,2)
if (removed[o] == "" || removed[o] == $2) {
removed[o] = $2
if (o > symbolo) symbolo = o
} else {
print "png.h: duplicated removed symbol",
o ": '" removed[o] "' != '" $2 "'"
err = 1
}
next
o=0+substr($3,2)
if (removed[o] == "" || removed[o] == $2) {
removed[o] = $2
if (o > symbolo) symbolo = o
} else {
print "png.h: duplicated removed symbol", o ": '" removed[o] "' != '" $2 "'"
err = 1
}
next
}
NF==2 && $2 ~ /^@[1-9][0-9]*$/ { # exported symbol
o=0+substr($2,2)
if (symbol[o] == "" || symbol[o] == $1) {
symbol[o] = $1
if (o > symbolo) symbolo = o
} else {
print "png.h: duplicated symbol",
o ": '" symbol[o] "' != '" $1 "'"
err = 1
}
o=0+substr($2,2)
if (symbol[o] == "" || symbol[o] == $1) {
symbol[o] = $1
if (o > symbolo) symbolo = o
} else {
print "png.h: duplicated symbol", o ": '" symbol[o] "' != '" $1 "'"
err = 1
}
}
{
next # skip all other lines
next # skip all other lines
}
# At the end check for symbols marked as both duplicated and removed
END{
if (symbolo > lasto) {
print "highest symbol ordinal in png.h,",
symbolo ", exceeds last ordinal from png.h", lasto
err = 1
}
if (mastero > lasto) {
print "highest symbol ordinal in", master ",",
mastero ", exceeds last ordinal from png.h", lasto
err = 1
}
unexported=0
for (o=1; o<=lasto; ++o) {
if (symbol[o] == "" && removed[o] == "") {
if (unexported == 0) unexported = o
if (official[o] == "") {
# missing in export list too, so ok
if (o < lasto) continue
}
}
if (unexported != 0) {
# Symbols in the .def but not in the new file are errors
if (o-1 > unexported)
print "png.h: warning: unexported symbol definitions:",
unexported "-" o-1
else
print "png.h: warning: unexported symbol definition:",
unexported
unexported = 0
}
if (symbol[o] != "" && removed[o] != "") {
print "png.h: symbol", o,
"both exported as '" symbol[o] "' and removed as '" removed[o] "'"
err = 1
} else if (symbol[o] != official[o]) {
# either the symbol is missing somewhere or it changed
err = 1
if (symbol[o] == "")
print "png.h: symbol", o,
"is exported as '" official[o] "' in", master
else if (official[o] == "")
print "png.h: exported symbol", o,
"'" symbol[o] "' not present in", master
else
print "png.h: exported symbol", o,
"'" symbol[o] "' exists as '" official[o] "' in", master
}
if (symbolo > lasto) {
print "highest symbol ordinal in png.h,", symbolo ", exceeds last ordinal from png.h", lasto
err = 1
}
if (mastero > lasto) {
print "highest symbol ordinal in", master ",", mastero ", exceeds last ordinal from png.h", lasto
err = 1
}
unexported=0
for (o=1; o<=lasto; ++o) {
if (symbol[o] == "" && removed[o] == "") {
if (unexported == 0) unexported = o
if (official[o] == "") {
# missing in export list too, so ok
if (o < lasto) continue
}
}
if (unexported != 0) {
# Symbols in the .def but not in the new file are errors
if (o-1 > unexported)
print "png.h: warning: unexported symbol definitions:", unexported "-" o-1
else
print "png.h: warning: unexported symbol definition:", unexported
unexported = 0
}
if (symbol[o] != "" && removed[o] != "") {
print "png.h: symbol", o, "both exported as '" symbol[o] "' and removed as '" removed[o] "'"
err = 1
} else if (symbol[o] != official[o]) {
# either the symbol is missing somewhere or it changed
err = 1
if (symbol[o] == "")
print "png.h: symbol", o, "is exported as '" official[o] "' in", master
else if (official[o] == "")
print "png.h: exported symbol", o, "'" symbol[o] "' not present in", master
else
print "png.h: exported symbol", o, "'" symbol[o] "' exists as '" official[o] "' in", master
}
# Finally generate symbols.new
if (symbol[o] != "")
print " " symbol[o], "@" o > "symbols.new"
}
# Finally generate symbols.new
if (symbol[o] != "")
print " " symbol[o], "@" o > "symbols.new"
}
if (err != 0) {
print "*** A new list is in symbols.new ***"
exit 1
}
if (err != 0) {
print "*** A new list is in symbols.new ***"
exit 1
}
}

137
scripts/chkfmt Executable file
View File

@ -0,0 +1,137 @@
#!/bin/sh
#
# Check the format of the source files in the current directory - checks for a
# line length of 80 characters max and no tab characters.
#
# Optionally arguments are files or directories to check.
#
# -v: output the long lines (makes fixing them easier)
# -e: spawn an editor for each file that needs a change ($EDITOR must be
# defined). When using -e the script MUST be run from an interactive
# command line.
verbose=
edit=
vers=
test "$1" = "-v" && {
shift
verbose=yes
}
test "$1" = "-e" && {
shift
if test -n "$EDITOR"
then
edit=yes
# Copy the standard streams for the editor
exec 3>&0 4>&1 5>&2
else
echo "chkfmt -e: EDITOR must be defined" >&2
exit 1
fi
}
# Function to edit a single file - if the file isn't changed ask the user
# whether or not to continue. This stuff only works if the script is run from
# the command line (otherwise, don't specify -e or you will be sorry).
doed(){
cp "$file" "$file".orig
"$EDITOR" "$file" 0>&3 1>&4 2>&5 3>&- 4>&- 5>&- || exit 1
if cmp -s "$file".orig "$file"
then
rm "$file".orig
echo -n "$file: file not changed, type anything to continue: " >&5
read ans 0>&3
test -n "$ans" || return 1
fi
return 0
}
# In beta versions the version string which appears in files can be a little
# long and cause spuriously overlong lines. To avoid this subtitute the version
# string with a 'standard' version a.b.cc before checking for long lines.
if test -r png.h
then
vers="`sed -n -e \
's/^#define PNG_LIBPNG_VER_STRING .\([0-9]\.[0-9]\.[0-9][0-9a-z]*\).$/\1/p' \
png.h`"
echo "chkfmt: checking version $vers"
fi
if test -z "$vers"
then
echo "chkfmt: png.h not found, ignoring version number" >&2
fi
test -n "$1" || set -- .
find "$@" \( -type d \( -name '.git' -o -name '.libs' -o -name 'projects' \) \
-prune \) -o \( -type f \
! -name '*.[oa]' ! -name '*.l[oa]' ! -name '*.png' ! -name '*.out' \
! -name '*.jpg' ! -name '*.patch' ! -name '*.obj' ! -name '*.exe' \
! -name '*.com' ! -name '*.tar.*' ! -name '*.zip' ! -name '*.ico' \
! -name '*.res' ! -name '*.rc' ! -name '*.mms' ! -name '*.rej' \
! -name '*.dsp' ! -name '*.orig' ! -name '*.dfn' ! -name '*.swp' \
! -name '~*' ! -name '*.3' \
! -name 'missing' ! -name 'mkinstalldirs' ! -name 'depcomp' \
! -name 'aclocal.m4' ! -name 'install-sh' ! -name 'Makefile.in' \
! -name 'ltmain.sh' ! -name 'config*' -print \) | {
st=0
while read file
do
case "$file" in
*.mak|*[Mm]akefile.*|*[Mm]akefile)
# Makefiles require tabs, dependency lines can be this long.
check_tabs=
line_length=100;;
*.awk)
# Includes literal tabs
check_tabs=
# The following is arbitrary
line_length=132;;
*contrib/*/*.[ch])
check_tabs=yes
line_length=96;;
*)
check_tabs=yes
line_length=80;;
esac
# Note that vers can only contain 0-9, . and a-z
if test -n "$vers"
then
sed -e "s/$vers/a.b.cc/g" "$file" >"$file".$$
else
cp "$file" "$file".$$
fi
splt="`fold -$line_length "$file".$$ | diff -c "$file".$$ -`"
rm "$file".$$
if test -n "$splt"
then
echo "$file: lines too long"
st=1
if test -n "$EDITOR" -a -n "$edit"
then
doed "$file" || exit 1
elif test -n "$verbose"
then
echo "$splt"
fi
fi
if test -n "$check_tabs"
then
tab="`tr -c -d '\t' <"$file"`"
if test -n "$tab"
then
echo "$file: file contains tab characters"
st=1
if test -n "$EDITOR" -a -n "$edit"
then
doed "$file" || exit 1
elif test -n "$verbose"
then
echo "$splt"
fi
fi
fi
done
exit $st
}

View File

@ -64,7 +64,10 @@ copy-src:
compilation:
@echo " * Compilation of $(PACKAGE)"
cd $(PACKAGE) && CPPFLAGS="$(CPPFLAGS) -DPNG_CONSOLE_IO_SUPPORTED -D_WIN32_WCE=0x0420" CFLAGS="$(CFLAGS) -mms-bitfields -O3 -pipe -fomit-frame-pointer" LDFLAGS="$(LDFLAGS) -Wl,--enable-auto-import -Wl,-s" ./configure --prefix=/opt/wince --host=arm-mingw32ce && make
cd $(PACKAGE) && CPPFLAGS="$(CPPFLAGS) -DPNG_CONSOLE_IO_SUPPORTED -D_WIN32_WCE=0x0420" \
CFLAGS="$(CFLAGS) -mms-bitfields -O3 -pipe -fomit-frame-pointer" \
LDFLAGS="$(LDFLAGS) -Wl,--enable-auto-import -Wl,-s" \
./configure --prefix=/opt/wince --host=arm-mingw32ce && make
copy:
@echo " * Copy of binary and development files"

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,8 @@ RM = delete quiet
MKDIR = makedir
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o pngread.o \
pngerror.o pngpread.o pngwrite.o pngrtran.o pngwtran.o pngrio.o pngwio.o pngmem.o
pngerror.o pngpread.o pngwrite.o pngrtran.o pngwtran.o pngrio.o \
pngwio.o pngmem.o
all: $(LIBNAME) pngtest