Update to bitmap 1.0.8

This commit is contained in:
matthieu 2015-01-25 11:30:36 +00:00
parent 8e6050dcaa
commit d6201822a8
12 changed files with 936 additions and 611 deletions

View File

@ -41,6 +41,7 @@ from The Open Group.
#include "BitmapP.h"
#include "Bitmap.h"
#include <assert.h>
#include <stdio.h>
#include <math.h>
@ -686,10 +687,14 @@ XmuWriteBitmapDataToFile(_Xconst _XtString filename,
else
file = fopen(filename, "w+");
if (!basename || !strcmp(basename, "") || !strcmp(basename, "-"))
basename = StripFilename(filename);
if (file) {
String new_basename;
if (!basename || !strcmp(basename, "") || !strcmp(basename, "-"))
basename = new_basename = StripFilename(filename);
else
new_basename = NULL;
fprintf(file, "#define %s_width %d\n", basename, width);
fprintf(file, "#define %s_height %d\n", basename, height);
if (QuerySet(x_hot, y_hot)) {
@ -708,6 +713,7 @@ XmuWriteBitmapDataToFile(_Xconst _XtString filename,
if (file != stdout)
fclose(file);
XtFree(new_basename);
return BitmapSuccess;
}
@ -902,20 +908,20 @@ Initialize(Widget wrequest, Widget wnew, ArgList argv, Cardinal *argc)
{
int status;
XImage *image, *buffer;
unsigned char *image_data;
char *buffer_data;
unsigned char *image_data2;
char *buffer_data2;
unsigned int width, height;
int x_hot, y_hot;
status = XmuReadBitmapDataFromFile(new->bitmap.filename,
&width, &height, &image_data,
&width, &height, &image_data2,
&x_hot, &y_hot);
if (status == BitmapSuccess) {
buffer_data = CreateCleanData(Length(width, height));
buffer_data2 = CreateCleanData(Length(width, height));
image = CreateBitmapImage(new, (char *)image_data, width, height);
buffer = CreateBitmapImage(new, buffer_data, width, height);
image = CreateBitmapImage(new, (char *)image_data2, width, height);
buffer = CreateBitmapImage(new, buffer_data2, width, height);
TransferImageData(new->bitmap.image, buffer);
@ -1102,7 +1108,7 @@ BWReadFile(Widget w, _Xconst _XtString filename, _Xconst _XtString basename) /*
XtFree(BW->bitmap.filename);
BW->bitmap.filename = XtNewString(filename);
XtFree(BW->bitmap.basename);
BW->bitmap.basename= XtNewString(StripFilename(filename));
BW->bitmap.basename = StripFilename(filename);
BWUnmark(w);
@ -1198,7 +1204,7 @@ BWWriteFile(Widget w, _Xconst _XtString filename, _Xconst _XtString basename)
XtFree(BW->bitmap.filename);
BW->bitmap.filename = XtNewString(filename);
XtFree(BW->bitmap.basename);
BW->bitmap.basename= XtNewString(StripFilename(filename));
BW->bitmap.basename = StripFilename(filename);
}
if (!basename) basename = BW->bitmap.basename;
else {
@ -1238,6 +1244,8 @@ BWGetFilepath(Widget w, String *str)
String end;
*str = XtNewString(BW->bitmap.filename);
assert(*str);
end = strrchr(*str, '/');
if (end)

View File

@ -1,3 +1,200 @@
commit 2f5eae70cd2e9c1e09dcbd8a2a58eaf58207fe00
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Jan 16 21:57:03 2015 -0800
bitmap 1.0.8
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit dacae58710f7033d5295c50cf6262783350e938d
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Mon Dec 29 18:28:00 2014 -0800
Stop memory leak in XmuWriteBitmapDataToFile()
StripFilename() allocates a new string for its result, so after we're
done with it, free it instead of just losing the pointer to it.
Fixes errors found by Oracle Parfait 1.5.1 bug checking tool:
Error: Memory leak (CWE 401)
Memory leak of pointer basename allocated with StripFilename(filename)
at line 712 of Bitmap.c in function 'XmuWriteBitmapDataToFile'.
basename allocated at line 691 with StripFilename(filename).
basename leaks when i >= data_length at line 702.
Error: Memory leak (CWE 401)
Memory leak of pointer basename allocated with StripFilename(filename)
at line 715 of Bitmap.c in function 'XmuWriteBitmapDataToFile'.
basename allocated at line 691 with StripFilename(filename).
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 8df1a843a3a9f92399113688a350873a141bf995
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Mon Dec 29 18:15:57 2014 -0800
Stop memory leaks from XtNewString(StripFilename(filename))
StripFilename() already allocates a new string for its result,
we don't need to duplicate it and then lose the pointer to the
first one.
Fixes errors found by Oracle Parfait 1.5.1 bug checking tool:
Error: Memory leak (CWE 401)
Memory leak of pointer pointer allocated with StripFilename(filename)
at line 1119 of Bitmap.c in function 'BWReadFile'.
pointer allocated at line 1106 with StripFilename(filename).
pointer leaks when StripFilename(filename) != NULL at line 1106.
Error: Memory leak (CWE 401)
Memory leak of pointer pointer allocated with StripFilename(filename)
at line 1119 of Bitmap.c in function 'BWReadFile'.
pointer allocated at line 1106 with StripFilename(filename).
Error: Memory leak (CWE 401)
Memory leak of pointer pointer allocated with StripFilename(filename)
at line 1222 of Bitmap.c in function 'BWWriteFile'.
pointer allocated at line 1202 with StripFilename(filename).
pointer leaks when StripFilename(filename) != NULL at line 1202.
Error: Memory leak (CWE 401)
Memory leak of pointer pointer allocated with StripFilename(filename)
at line 1222 of Bitmap.c in function 'BWWriteFile'.
pointer allocated at line 1202 with StripFilename(filename).
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit a0db0f6c7996b282aa9027d3b670597d88fe3353
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Jun 1 21:03:14 2014 -0700
autogen.sh: Honor NOCONFIGURE=1
See http://people.gnome.org/~walters/docs/build-api.txt
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 8fb1efccb5f24eab51cefafedb1a5a60217db35f
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Jun 1 21:03:13 2014 -0700
configure: Drop AM_MAINTAINER_MODE
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit d0911d130b870da0951b56f5103c6b4dfb9eeb28
Author: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Wed Jan 1 23:02:48 2014 -0800
Use '& 7' instead '% 8' to silence clang analyzer warning
Graphics.c:569:10: warning: The result of the '<<' expression is undefined
while (!QueryFlood(BW, x, y, value) && (x < x_right))
^~~~~~~~~~~~~~~~~~~~~~~~~~~
Graphics.c:470:7: note: expanded from macro 'QueryFlood'
((GetBit(BW->bitmap.image, x, y) !=\
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Graphics.c:66:9: note: expanded from macro 'GetBit'
(1 << ((x) % 8))) ? 1 : 0))
~~^~~~~~~~~~~~
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
commit e3fe79502a4a1b0f0b148659948d541ce26ed7bf
Author: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Wed Jan 1 22:58:23 2014 -0800
Demacro modernization of NewSList to plug a memory leak during error handling
atobm.c:248:6: warning: Potential leak of memory pointed to by 'slist'
NewSList ();
^~~~~~~~~~~
atobm.c:209:3: note: expanded from macro 'NewSList'
fprintf (stderr, "%s: unable to allocate char array\n", \
^~~~~~~
atobm.c:259:6: warning: Potential leak of memory pointed to by 'old'
NewSList ();
^~~~~~~~~~~
atobm.c:209:3: note: expanded from macro 'NewSList'
fprintf (stderr, "%s: unable to allocate char array\n", \
^~~~~~~
atobm.c:259:6: warning: Potential leak of memory pointed to by 'slist'
NewSList ();
^~~~~~~~~~~
atobm.c:209:3: note: expanded from macro 'NewSList'
fprintf (stderr, "%s: unable to allocate char array\n", \
^~~~~~~
3 warnings generated.
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
commit a59538d5d57bd2f8b2101e398a97fe8466b8eef7
Author: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Wed Jan 1 22:43:26 2014 -0800
Silence -Wbad-function-cast
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
commit e7086abb4576a777a4b0aff8553047077cdd08ce
Author: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Wed Jan 1 22:29:45 2014 -0800
Avoid shadow declarations
Bitmap.c:906:17: warning: declaration shadows a local variable [-Wshadow]
unsigned char *image_data;
^
Bitmap.c:799:11: note: previous declaration is here
char *image_data, *buffer_data;
^
Bitmap.c:907:8: warning: declaration shadows a local variable [-Wshadow]
char *buffer_data;
^
Bitmap.c:799:24: note: previous declaration is here
char *image_data, *buffer_data;
^
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
commit 1e236565459d10c7ad85ebed285d2acfc4b15b69
Author: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Wed Jan 1 22:27:36 2014 -0800
assert to avoid a NULL dereference
Bitmap.c:1246:8: warning: Dereference of null pointer
**str = '\0';
~~~~~~^~~~~~
1 warning generated.
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
commit 15d326027827c168511f923e72c64e2131515e19
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Mon Nov 4 23:14:22 2013 -0800
Print which option was in error along with usage message
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
commit 64bc2b97d408d6fea16716e37f7b5ff1661d57fd
Author: Gaetan Nadon <memsize@videotron.ca>
Date: Fri Oct 25 21:51:37 2013 -0400
config: replace deprecated use of AC_OUTPUT with AC_CONFIG_FILES
Fix Automake warning: AC_OUTPUT should be used without arguments.
www.gnu.org/software/autoconf/manual/autoconf.html#Configuration-Files
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
commit a78fc882fac9a3334a77744be4c617b51997a5bb
Author: Eric S. Raymond <esr@thyrsus.com>
Date: Thu Jun 6 14:24:08 2013 -0400
Use table markup in preference to various low-level constructions.
commit 10584a7e5f476c5adb5ec6de9f0b519380abd6df
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri May 17 21:12:44 2013 -0700

View File

@ -57,13 +57,19 @@ from The Open Group.
# endif
#endif
#ifdef __clang__
/* clang doesn't like (int)floor(d) */
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wbad-function-cast"
#endif
/*****************************************************************************\
* Graphics *
\*****************************************************************************/
#define GetBit(image, x, y)\
((bit)((*(image->data + (x) / 8 + (y) * image->bytes_per_line) &\
(1 << ((x) % 8))) ? 1 : 0))
(1 << ((x) & 7))) ? 1 : 0))
#if 0
bit

View File

@ -288,7 +288,6 @@ LIBS = @LIBS@
LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MAN_SUBSTS = @MAN_SUBSTS@
MATH_LIBS = @MATH_LIBS@
@ -305,6 +304,8 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@ -418,7 +419,7 @@ all: config.h
.SUFFIXES: .c .o .obj
am--refresh: Makefile
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -445,9 +446,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(top_srcdir)/configure: $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
@ -458,7 +459,7 @@ config.h: stamp-h1
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(srcdir)/config.h.in: $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@

199
app/bitmap/aclocal.m4 vendored
View File

@ -20,6 +20,7 @@ If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 1 (pkg-config-0.24)
#
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
#
@ -46,8 +47,12 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
# ----------------------------------
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
@ -60,7 +65,6 @@ if test -n "$PKG_CONFIG"; then
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])# PKG_PROG_PKG_CONFIG
@ -69,33 +73,31 @@ fi[]dnl
# Check to see whether a particular set of modules exists. Similar
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
#
#
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
# this or PKG_CHECK_MODULES is called, or make sure to call
# PKG_CHECK_EXISTS manually
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
# only at the first occurence in configure.ac, so if the first place
# it's called might be skipped (such as if it is within an "if", you
# have to call PKG_CHECK_EXISTS manually
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_ifval([$2], [$2], [:])
m4_default([$2], [:])
m4_ifvaln([$3], [else
$3])dnl
fi])
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
# ---------------------------------------------
m4_define([_PKG_CONFIG],
[if test -n "$PKG_CONFIG"; then
if test -n "$$1"; then
[if test -n "$$1"; then
pkg_cv_[]$1="$$1"
else
elif test -n "$PKG_CONFIG"; then
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes ],
[pkg_failed=yes])
fi
else
else
pkg_failed=untried
fi[]dnl
])# _PKG_CONFIG
@ -138,16 +140,17 @@ and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
ifelse([$4], , [AC_MSG_ERROR(dnl
m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
@ -155,28 +158,67 @@ $$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
_PKG_TEXT
])],
[AC_MSG_RESULT([no])
$4])
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
ifelse([$4], , [AC_MSG_FAILURE(dnl
AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
_PKG_TEXT
To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
[$4])
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
ifelse([$3], , :, [$3])
$3
fi[]dnl
])# PKG_CHECK_MODULES
# PKG_INSTALLDIR(DIRECTORY)
# -------------------------
# Substitutes the variable pkgconfigdir as the location where a module
# should install pkg-config .pc files. By default the directory is
# $libdir/pkgconfig, but the default can be changed by passing
# DIRECTORY. The user can override through the --with-pkgconfigdir
# parameter.
AC_DEFUN([PKG_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([pkgconfigdir],
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
[with_pkgconfigdir=]pkg_default)
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
]) dnl PKG_INSTALLDIR
# PKG_NOARCH_INSTALLDIR(DIRECTORY)
# -------------------------
# Substitutes the variable noarch_pkgconfigdir as the location where a
# module should install arch-independent pkg-config .pc files. By
# default the directory is $datadir/pkgconfig, but the default can be
# changed by passing DIRECTORY. The user can override through the
# --with-noarch-pkgconfigdir parameter.
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([noarch-pkgconfigdir],
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
[with_noarch_pkgconfigdir=]pkg_default)
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
]) dnl PKG_NOARCH_INSTALLDIR
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
@ -757,44 +799,6 @@ fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
# Copyright (C) 1996-2012 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_MAINTAINER_MODE([DEFAULT-MODE])
# ----------------------------------
# Control maintainer-specific portions of Makefiles.
# Default is to disable them, unless 'enable' is passed literally.
# For symmetry, 'disable' may be passed as well. Anyway, the user
# can override the default with the --enable/--disable switch.
AC_DEFUN([AM_MAINTAINER_MODE],
[m4_case(m4_default([$1], [disable]),
[enable], [m4_define([am_maintainer_other], [disable])],
[disable], [m4_define([am_maintainer_other], [enable])],
[m4_define([am_maintainer_other], [enable])
m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode's default is 'disable' unless 'enable' is passed
AC_ARG_ENABLE([maintainer-mode],
[AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
am_maintainer_other[ make rules and dependencies not useful
(and sometimes confusing) to the casual installer])],
[USE_MAINTAINER_MODE=$enableval],
[USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
AC_MSG_RESULT([$USE_MAINTAINER_MODE])
AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
MAINT=$MAINTAINER_MODE_TRUE
AC_SUBST([MAINT])dnl
]
)
AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001-2012 Free Software Foundation, Inc.
@ -1269,7 +1273,7 @@ dnl DEALINGS IN THE SOFTWARE.
# See the "minimum version" comment for each macro you use to see what
# version you require.
m4_defun([XORG_MACROS_VERSION],[
m4_define([vers_have], [1.16.2])
m4_define([vers_have], [1.19.0])
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
m4_if(m4_cmp(maj_have, maj_needed), 0,,
@ -1319,6 +1323,7 @@ if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then
AC_MSG_RESULT([no])
else
if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then
TRADITIONALCPPFLAGS="-traditional"
RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
AC_MSG_RESULT([yes])
else
@ -1327,6 +1332,7 @@ else
fi
rm -f conftest.$ac_ext
AC_SUBST(RAWCPPFLAGS)
AC_SUBST(TRADITIONALCPPFLAGS)
]) # XORG_PROG_RAWCPP
# XORG_MANPAGE_SECTIONS()
@ -1851,9 +1857,10 @@ AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
]) # XORG_WITH_ASCIIDOC
# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
# --------------------------------
# -------------------------------------------
# Minimum version: 1.5.0
# Minimum version for optional DEFAULT argument: 1.11.0
# Minimum version for optional DOT checking: 1.18.0
#
# Documentation tools are not always available on all platforms and sometimes
# not at the appropriate level. This macro enables a module to test for the
@ -1873,6 +1880,7 @@ AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
#
AC_DEFUN([XORG_WITH_DOXYGEN],[
AC_ARG_VAR([DOXYGEN], [Path to doxygen command])
AC_ARG_VAR([DOT], [Path to the dot graphics utility])
m4_define([_defopt], m4_default([$2], [auto]))
AC_ARG_WITH(doxygen,
AS_HELP_STRING([--with-doxygen],
@ -1916,6 +1924,20 @@ m4_ifval([$1],
AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
fi])
fi])
dnl Check for DOT if we have doxygen. The caller decides if it is mandatory
dnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
dnl HAVE_DOT = @HAVE_DOT@
HAVE_DOT=no
if test "x$have_doxygen" = "xyes"; then
AC_PATH_PROG([DOT], [dot])
if test "x$DOT" != "x"; then
HAVE_DOT=yes
fi
fi
AC_SUBST([HAVE_DOT])
AM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
]) # XORG_WITH_DOXYGEN
@ -2098,6 +2120,29 @@ fi])
AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
]) # XORG_WITH_FOP
# XORG_WITH_M4([MIN-VERSION])
# ---------------------------
# Minimum version: 1.19.0
#
# This macro attempts to locate an m4 macro processor which supports
# -I option and is only useful for modules relying on M4 in order to
# expand macros in source code files.
#
# Interface to module:
# M4: returns the path of the m4 program found
# returns the path set by the user in the environment
#
AC_DEFUN([XORG_WITH_M4], [
AC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
[AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
[[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
[AC_MSG_ERROR([could not find m4 that supports -I option])],
[$PATH:/usr/gnu/bin])])
AC_SUBST([M4], [$ac_cv_path_M4])
]) # XORG_WITH_M4
# XORG_WITH_PS2PDF([DEFAULT])
# ----------------
# Minimum version: 1.6.0
@ -2552,7 +2597,8 @@ AC_ARG_ENABLE(malloc0returnsnull,
AC_MSG_CHECKING([whether malloc(0) returns NULL])
if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
AC_RUN_IFELSE([AC_LANG_PROGRAM([
AC_CACHE_VAL([xorg_cv_malloc0_returns_null],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([
#include <stdlib.h>
],[
char *m0, *r0, *c0, *p;
@ -2562,9 +2608,9 @@ if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
c0 = calloc(0,10);
exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
])],
[MALLOC_ZERO_RETURNS_NULL=yes],
[MALLOC_ZERO_RETURNS_NULL=no],
[MALLOC_ZERO_RETURNS_NULL=yes])
[xorg_cv_malloc0_returns_null=yes],
[xorg_cv_malloc0_returns_null=no])])
MALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
fi
AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
@ -2775,18 +2821,18 @@ fi
found="no"
m4_foreach([flag], m4_cdr($@), [
if test $found = "no" ; then
if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
fi
if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
fi
PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
AC_MSG_CHECKING([if ]COMPILER[ supports]flag[])
AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
AC_CACHE_VAL($cacheid,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
@ -2853,7 +2899,7 @@ AC_LANG_CASE(
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
]
)
@ -2862,16 +2908,17 @@ AC_LANG_CASE(
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
# These are currently disabled because they are noisy. They will be enabled
# in the future once the codebase is sufficiently modernized to silence
# them. For now, I don't want them to drown out the other warnings.
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
# Turn some warnings into errors, so we don't accidently get successful builds
# when there are problems that should be fixed.

View File

@ -42,9 +42,11 @@ static char *ProgramName;
static void doit(FILE *fp, const char *filename, const char *chars,
int xhot, int yhot, const char *name);
static void _X_NORETURN
usage (void)
static void _X_NORETURN _X_COLD
usage (const char *msg)
{
if (msg)
fprintf(stderr, "%s: %s\n", ProgramName, msg);
fprintf (stderr, "usage: %s [-options ...] [filename]\n\n%s\n",
ProgramName,
"where options include:\n"
@ -55,6 +57,14 @@ usage (void)
exit (1);
}
static void _X_NORETURN _X_COLD
missing_arg (const char *option)
{
char msg[32];
snprintf(msg, sizeof(msg), "%s requires an argument", option);
usage(msg);
}
static char *
cify_name (char *name)
@ -106,23 +116,25 @@ main (int argc, char *argv[])
filename = NULL;
continue;
case 'c':
if (++i >= argc) usage ();
if (++i >= argc) missing_arg("-chars");
chars = argv[i];
continue;
case 'n':
if (++i >= argc) usage ();
if (++i >= argc) missing_arg("-name");
name = argv[i];
continue;
case 'x':
if (++i >= argc) usage ();
if (++i >= argc) missing_arg("-xhot");
xhot = atoi (argv[i]);
continue;
case 'y':
if (++i >= argc) usage ();
if (++i >= argc) missing_arg("-yhot");
yhot = atoi (argv[i]);
continue;
default:
usage ();
fprintf(stderr, "%s: unrecognized option '%s'\n",
ProgramName, argv[i]);
usage (NULL);
}
} else {
filename = arg;
@ -155,6 +167,31 @@ main (int argc, char *argv[])
exit (0);
}
struct _scan_list {
int allocated;
int used;
unsigned char *scanlines;
struct _scan_list *next;
};
#define NTOALLOC 16
static inline struct _scan_list *
_new_scan_list(int bytes_per_scanline) {
struct _scan_list *slist = (struct _scan_list *) calloc (1, sizeof(*slist));
if (!slist) {
return NULL;
}
slist->allocated = NTOALLOC * bytes_per_scanline;
slist->scanlines = (unsigned char *) calloc(slist->allocated, 1);
if (!slist->scanlines) {
free(slist);
return NULL;
}
slist->used = 0;
slist->next = NULL;
return slist;
}
static void
doit (FILE *fp,
@ -173,34 +210,11 @@ doit (FILE *fp,
(isascii(chars[1]) && isspace(chars[1]))) ? 0 : 1);
int lineno = 0;
int bytes_per_scanline = 0;
struct _scan_list {
int allocated;
int used;
unsigned char *scanlines;
struct _scan_list *next;
} *head = NULL, *slist = NULL;
struct _scan_list *head = NULL, *slist = NULL;
static unsigned char masktable[] = {
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
int padded = 0;
#define NTOALLOC 16
#define NewSList() \
slist = (struct _scan_list *) calloc (1, sizeof *slist); \
if (!slist) { \
fprintf (stderr, "%s: unable to allocate scan list\n", \
ProgramName); \
return; \
} \
slist->allocated = NTOALLOC * bytes_per_scanline; \
slist->scanlines = (unsigned char *) calloc(slist->allocated, 1); \
if (!slist->scanlines) { \
fprintf (stderr, "%s: unable to allocate char array\n", \
ProgramName); \
return; \
} \
slist->used = 0; \
slist->next = NULL;
while (1) {
buf[0] = '\0';
lineno++;
@ -233,8 +247,12 @@ doit (FILE *fp,
width = len;
padded = ((width & 7) != 0);
bytes_per_scanline = (len + 7) / 8;
NewSList ();
head = slist;
head = slist = _new_scan_list(bytes_per_scanline);
if (!slist) {
fprintf (stderr, "%s: unable to allocate scan list\n", ProgramName);
return;
}
} else if (width != len) {
fprintf (stderr,
"%s: line %d is %d characters wide instead of %d\n",
@ -244,8 +262,13 @@ doit (FILE *fp,
if (slist->used + 1 >= slist->allocated) {
struct _scan_list *old = slist;
NewSList ();
old->next = slist;
old->next = slist = _new_scan_list(bytes_per_scanline);
if (!slist) {
fprintf (stderr, "%s: unable to allocate scan list\n", ProgramName);
free(old);
return;
}
}
/* okay, parse the line and stick values into the scanline array */

View File

@ -9,5 +9,6 @@ cd $srcdir
autoreconf -v --install || exit 1
cd $ORIGDIR || exit $?
$srcdir/configure --enable-maintainer-mode "$@"
if test -z "$NOCONFIGURE"; then
$srcdir/configure "$@"
fi

View File

@ -130,10 +130,16 @@ main (int argc, char *argv[])
filename = NULL;
continue;
case 'c':
if (++i >= argc) usage ();
if (++i >= argc) {
fprintf(stderr, "%s: -chars requires an argument\n",
ProgramName);
usage ();
}
chars = argv[i];
continue;
default:
fprintf(stderr, "%s: unrecognized option '%s'\n",
ProgramName, argv[i]);
usage ();
}
} else {

892
app/bitmap/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -23,14 +23,13 @@ dnl Process this file with autoconf to create configure.
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([bitmap], [1.0.7],
AC_INIT([bitmap], [1.0.8],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [bitmap])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
# Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
m4_ifndef([XORG_MACROS_VERSION],
@ -56,7 +55,7 @@ AC_SUBST([MATH_LIBS])
# Obtain compiler/linker options from dependencies
PKG_CHECK_MODULES(BMTOA, [x11 xmu xproto >= 7.0.17])
PKG_CHECK_MODULES(ATOBM, [xproto >= 7.0.17])
PKG_CHECK_MODULES(ATOBM, [xproto >= 7.0.25])
PKG_CHECK_MODULES(BITMAP, xbitmaps xaw7 xmu)
PKG_CHECK_MODULES(APPDEFS, xt)
@ -67,5 +66,6 @@ AC_ARG_WITH(appdefaultdir,
[appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"])
AC_SUBST(appdefaultdir)
AC_OUTPUT([Makefile
AC_CONFIG_FILES([Makefile
man/Makefile])
AC_OUTPUT

View File

@ -184,7 +184,6 @@ LIBS = @LIBS@
LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MAN_SUBSTS = @MAN_SUBSTS@
MATH_LIBS = @MATH_LIBS@
@ -201,6 +200,8 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@ -271,7 +272,7 @@ all: all-am
.SUFFIXES:
.SUFFIXES: .$(APP_MAN_SUFFIX) .man
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -296,9 +297,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-appmanDATA: $(appman_DATA)

View File

@ -612,20 +612,23 @@ purpose as well. It can be freely incorporated with other
applications and used as a standard editing tool. The following are
the resources provided by the bitmap widget.
.sp
.nf
.TS
lb lb
l l.
Bitmap Widget
Header file Bitmap.h
Class bitmapWidgetClass
Class Name Bitmap
Superclass Bitmap
.TE
All the Simple Widget resources plus .\|.\|.
.ta 1.6i 3.2i 4.8i
.TS
lb lb lb lb lb
l l l l l.
Name Class Type Default Value
foreground Foreground Pixel XtDefaultForeground
highlight Highlight Pixel XtDefaultForeground
framing Framing Pixel XtDefaultForeground
@ -648,7 +651,7 @@ button4Function Button4Function DrawingFunction Invert
button5Function Button5Function DrawingFunction Invert
filename Filename String None ("")
basename Basename String None ("")
.fi
.TE
.SH AUTHOR
Davor Matic, MIT X Consortium