From aad93e32a0df7cb97bb3ac17b6bb09d215b0c2ff Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] gtk-vnc with Dan's version 2 patch. --- .hgignore | 1 + gtk-vnc/gtk-vnc-0.3.7-abs-ungrab.patch | 19 + gtk-vnc/gtk-vnc-0.3.7-mingw32-dan2.patch | 3351 ++++ gtk-vnc/gtk-vnc-0.3.7-mingw32-gnulib-files.patch | 17597 +++++++++++++++++++++ gtk-vnc/gtk-vnc-0.3.7-mingw32-socketcompat.patch | 17 + gtk-vnc/mingw32-gtk-vnc.spec | 86 + 6 files changed, 21071 insertions(+) create mode 100644 gtk-vnc/gtk-vnc-0.3.7-abs-ungrab.patch create mode 100644 gtk-vnc/gtk-vnc-0.3.7-mingw32-dan2.patch create mode 100644 gtk-vnc/gtk-vnc-0.3.7-mingw32-gnulib-files.patch create mode 100644 gtk-vnc/gtk-vnc-0.3.7-mingw32-socketcompat.patch create mode 100644 gtk-vnc/mingw32-gtk-vnc.spec diff --git a/.hgignore b/.hgignore index f3c06f9..bf6b0fd 100644 --- a/.hgignore +++ b/.hgignore @@ -21,6 +21,7 @@ gnutls/gnutls-2.4.1.tar.bz2 gnutls/gnutls-2.4.2-nosrp.tar.bz2 gtk2/gtk+-2.14.0.tar.bz2 gtk2/gtk+-2.14.2.tar.bz2 +gtk-vnc/gtk-vnc-0.3.7.tar.gz iconv/libiconv-1.12.tar.gz jasper/jasper-1.900.1.zip libgcrypt/libgcrypt-1.4.1.tar.bz2 diff --git a/gtk-vnc/gtk-vnc-0.3.7-abs-ungrab.patch b/gtk-vnc/gtk-vnc-0.3.7-abs-ungrab.patch new file mode 100644 index 0000000..4be1452 --- /dev/null +++ b/gtk-vnc/gtk-vnc-0.3.7-abs-ungrab.patch @@ -0,0 +1,19 @@ +diff -r cf0e849385e0 src/vncdisplay.c +--- a/src/vncdisplay.c Thu Sep 11 17:07:42 2008 +0100 ++++ b/src/vncdisplay.c Thu Sep 25 12:57:31 2008 +0100 +@@ -703,13 +703,12 @@ + } + } + +- if ((!priv->grab_keyboard || !priv->absolute) && +- key->type == GDK_KEY_PRESS && ++ if (key->type == GDK_KEY_PRESS && + ((keyval == GDK_Control_L && (key->state & GDK_MOD1_MASK)) || + (keyval == GDK_Alt_L && (key->state & GDK_CONTROL_MASK)))) { + if (priv->in_pointer_grab) + do_pointer_ungrab(VNC_DISPLAY(widget), FALSE); +- else ++ else if (!priv->grab_keyboard || !priv->absolute) + do_pointer_grab(VNC_DISPLAY(widget), FALSE); + } + diff --git a/gtk-vnc/gtk-vnc-0.3.7-mingw32-dan2.patch b/gtk-vnc/gtk-vnc-0.3.7-mingw32-dan2.patch new file mode 100644 index 0000000..3383fe9 --- /dev/null +++ b/gtk-vnc/gtk-vnc-0.3.7-mingw32-dan2.patch @@ -0,0 +1,3351 @@ +diff -urN gtk-vnc-0.3.7/bootstrap gtk-vnc-0.3.7.mingw/bootstrap +--- gtk-vnc-0.3.7/bootstrap 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.mingw/bootstrap 2008-10-09 12:19:03.000000000 +0100 +@@ -0,0 +1,84 @@ ++#!/bin/sh ++# Run this after autogen.sh, to pull in all of the gnulib-related bits. ++# It's important to run *after* autogen.sh, since it updates some of ++# the same files autogen.sh does, yet those from gnulib are newer, ++# and match the tests. So if a gnulib bug has been fixed since the ++# snapshot taken for whatever gettext release you're using, yet you ++# run "make check" against the wrong version, the corresponding unit ++# test in gl-tests/ may well fail. ++ ++usage() { ++ echo >&2 "\ ++Usage: $0 [OPTION]... ++Bootstrap this package from the checked-out sources. ++ ++Options: ++ --gnulib-srcdir=DIRNAME Specify the local directory where gnulib ++ sources reside. Use this if you already ++ have gnulib sources on your machine, and ++ do not want to waste your bandwidth downloading ++ them again. ++ ++If the file bootstrap.conf exists in the current working directory, its ++contents are read as shell variables to configure the bootstrap. ++ ++Running without arguments will suffice in most cases. ++" ++} ++ ++for option ++do ++ case $option in ++ --help) ++ usage ++ exit;; ++ --gnulib-srcdir=*) ++ GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;; ++ *) ++ echo >&2 "$0: $option: unknown option" ++ exit 1;; ++ esac ++done ++ ++cleanup_gnulib() { ++ st=$? ++ rm -fr .gnulib ++ exit $st ++} ++ ++case ${GNULIB_SRCDIR--} in ++-) ++ if [ ! -d .gnulib ]; then ++ echo "$0: getting gnulib files..." ++ ++ trap cleanup_gnulib 1 2 13 15 ++ ++ git clone --depth 1 git://git.sv.gnu.org/gnulib .gnulib || ++ cleanup_gnulib ++ ++ trap - 1 2 13 15 ++ fi ++ GNULIB_SRCDIR=.gnulib ++esac ++ ++gnulib_tool=$GNULIB_SRCDIR/gnulib-tool ++<$gnulib_tool || exit ++ ++modules=' ++getaddrinfo ++vc-list-files ++' ++ ++# Tell gnulib to: ++# require LGPLv2+ ++# put *.m4 files in new gnulib/m4/ dir ++# put *.[ch] files in new gnulib/lib/ dir. ++ ++$gnulib_tool \ ++ --lgpl=2 \ ++ --with-tests \ ++ --m4-base=gnulib/m4 \ ++ --source-base=gnulib/lib \ ++ --tests-base=gnulib/tests \ ++ --import $modules ++ +diff -urN gtk-vnc-0.3.7/configure.ac gtk-vnc-0.3.7.mingw/configure.ac +--- gtk-vnc-0.3.7/configure.ac 2008-09-05 13:32:15.000000000 +0100 ++++ gtk-vnc-0.3.7.mingw/configure.ac 2008-10-09 12:19:03.000000000 +0100 +@@ -23,15 +23,29 @@ + + AC_CONFIG_HEADERS([config.h:config.hin]) + +- + AC_CANONICAL_TARGET + + AM_INIT_AUTOMAKE(gtk-vnc, 0.3.7) + ++ ++dnl gl_INIT uses m4_foreach_w, yet that is not defined in autoconf-2.59. ++dnl In order to accommodate developers with such old tools, here's a ++dnl replacement definition. ++m4_ifndef([m4_foreach_w], ++ [m4_define([m4_foreach_w], ++ [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) ++ ++gl_EARLY ++gl_INIT ++ + AC_PROG_CC_STDC + AM_PROG_CC_C_O ++AC_LIBTOOL_WIN32_DLL ++ + AC_PROG_LIBTOOL + ++AC_CHECK_HEADERS([pwd.h winsock2.h]) ++ + AC_ARG_WITH(python, + [ --with-python build python bindings], + [case "${withval}" in +@@ -234,6 +248,8 @@ + + AC_CONFIG_FILES( + Makefile ++ gnulib/lib/Makefile ++ gnulib/tests/Makefile + src/Makefile + examples/Makefile + plugin/Makefile +diff -urN gtk-vnc-0.3.7/Makefile.am gtk-vnc-0.3.7.mingw/Makefile.am +--- gtk-vnc-0.3.7/Makefile.am 2008-09-05 13:32:15.000000000 +0100 ++++ gtk-vnc-0.3.7.mingw/Makefile.am 2008-10-09 12:19:01.000000000 +0100 +@@ -1,5 +1,9 @@ + +-SUBDIRS = src examples plugin ++SUBDIRS = gnulib/lib src examples plugin gnulib/tests ++ ++ACLOCAL_AMFLAGS = -I gnulib/m4 ++ ++ + + pkgconfig_DATA = @PACKAGE@-1.0.pc + pkgconfigdir = $(libdir)/pkgconfig +diff -urN gtk-vnc-0.3.7/src/continuation.c gtk-vnc-0.3.7.mingw/src/continuation.c +--- gtk-vnc-0.3.7/src/continuation.c 2008-09-05 13:32:16.000000000 +0100 ++++ gtk-vnc-0.3.7.mingw/src/continuation.c 2008-10-09 12:19:03.000000000 +0100 +@@ -8,6 +8,8 @@ + * GTK VNC Widget + */ + ++#include ++ + #include "continuation.h" + + /* +diff -urN gtk-vnc-0.3.7/src/coroutine_gthread.c gtk-vnc-0.3.7.mingw/src/coroutine_gthread.c +--- gtk-vnc-0.3.7/src/coroutine_gthread.c 2008-09-05 13:32:16.000000000 +0100 ++++ gtk-vnc-0.3.7.mingw/src/coroutine_gthread.c 2008-10-09 12:19:03.000000000 +0100 +@@ -8,6 +8,8 @@ + * GTK VNC Widget + */ + ++#include ++ + #include "coroutine.h" + #include + #include +@@ -17,13 +19,24 @@ + static struct coroutine *current; + static struct coroutine leader; + ++#if 0 ++#define CO_DEBUG(OP) fprintf(stderr, "%s %p %s %d\n", OP, g_thread_self(), __FUNCTION__, __LINE__) ++#else ++#define CO_DEBUG(OP) ++#endif ++ + static void coroutine_system_init(void) + { +- if (!g_thread_supported()) ++ if (!g_thread_supported()) { ++ CO_DEBUG("INIT"); + g_thread_init(NULL); ++ } ++ + + run_cond = g_cond_new(); + run_lock = g_mutex_new(); ++ CO_DEBUG("LOCK"); ++ g_mutex_lock(run_lock); + + /* The thread that creates the first coroutine is the system coroutine + * so let's fill out a structure for it */ +@@ -42,17 +55,22 @@ + static gpointer coroutine_thread(gpointer opaque) + { + struct coroutine *co = opaque; +- ++ CO_DEBUG("LOCK"); + g_mutex_lock(run_lock); +- while (!co->runnable) ++ while (!co->runnable) { ++ CO_DEBUG("WAIT"); + g_cond_wait(run_cond, run_lock); ++ } + ++ CO_DEBUG("RUNNABLE"); + current = co; + co->data = co->entry(co->data); + co->exited = 1; + + co->caller->runnable = TRUE; ++ CO_DEBUG("BROADCAST"); + g_cond_broadcast(run_cond); ++ CO_DEBUG("UNLOCK"); + g_mutex_unlock(run_lock); + + return NULL; +@@ -62,7 +80,8 @@ + { + if (run_cond == NULL) + coroutine_system_init(); +- ++ ++ CO_DEBUG("NEW"); + co->thread = g_thread_create_full(coroutine_thread, co, co->stack_size, + FALSE, TRUE, + G_THREAD_PRIORITY_NORMAL, +@@ -88,15 +107,19 @@ + to->runnable = TRUE; + to->data = arg; + to->caller = from; ++ CO_DEBUG("BROADCAST"); + g_cond_broadcast(run_cond); ++ CO_DEBUG("UNLOCK"); + g_mutex_unlock(run_lock); +- ++ CO_DEBUG("LOCK"); + g_mutex_lock(run_lock); +- while (!from->runnable) ++ while (!from->runnable) { ++ CO_DEBUG("WAIT"); + g_cond_wait(run_cond, run_lock); +- ++ } + current = from; + ++ CO_DEBUG("SWAPPED"); + return from->data; + } + +@@ -111,6 +134,7 @@ + fprintf(stderr, "Co-routine is re-entering itself\n"); + abort(); + } ++ CO_DEBUG("SWAP"); + return coroutine_swap(coroutine_self(), to, arg); + } + +@@ -121,6 +145,8 @@ + fprintf(stderr, "Co-routine is yielding to no one\n"); + abort(); + } ++ ++ CO_DEBUG("SWAP"); + coroutine_self()->caller = NULL; + return coroutine_swap(coroutine_self(), to, arg); + } +diff -urN gtk-vnc-0.3.7/src/coroutine_ucontext.c gtk-vnc-0.3.7.mingw/src/coroutine_ucontext.c +--- gtk-vnc-0.3.7/src/coroutine_ucontext.c 2008-09-05 13:32:16.000000000 +0100 ++++ gtk-vnc-0.3.7.mingw/src/coroutine_ucontext.c 2008-10-09 12:19:03.000000000 +0100 +@@ -8,6 +8,8 @@ + * GTK VNC Widget + */ + ++#include ++ + #include + #include + #include +diff -urN gtk-vnc-0.3.7/src/gvnc.c gtk-vnc-0.3.7.mingw/src/gvnc.c +--- gtk-vnc-0.3.7/src/gvnc.c 2008-09-05 13:32:16.000000000 +0100 ++++ gtk-vnc-0.3.7.mingw/src/gvnc.c 2008-10-09 12:19:03.000000000 +0100 +@@ -8,13 +8,10 @@ + * GTK VNC Widget + */ + +-#include "gvnc.h" ++#include + +-#include +-#include +-#include ++#include "gvnc.h" + +-#include + #include + #include + #include +@@ -40,6 +37,15 @@ + #include + + #include "vnc_keycodes.h" ++#include "socketcompat.h" ++#include "getaddrinfo.h" ++ ++/* AI_ADDRCONFIG is missing on some systems and gnulib won't provide it ++ even if its emulated getaddrinfo() for us . */ ++#ifndef AI_ADDRCONFIG ++# define AI_ADDRCONFIG 0 ++#endif ++ + + struct wait_queue + { +@@ -185,7 +191,6 @@ + + g_io_add_watch(channel, cond | G_IO_HUP | G_IO_ERR | G_IO_NVAL, g_io_wait_helper, coroutine_self()); + ret = coroutine_yield(NULL); +- + return *ret; + } + +@@ -321,10 +326,8 @@ + + /* inflate as much as possible */ + err = inflate(gvnc->strm, Z_SYNC_FLUSH); +- if (err != Z_OK) { +- errno = EIO; +- return -1; +- } ++ if (err != Z_OK) ++ return -EIO; + + gvnc->uncompressed_length = (uint8_t *)gvnc->strm->next_out - gvnc->uncompressed_buffer; + gvnc->compressed_length -= (uint8_t *)gvnc->strm->next_in - gvnc->compressed_buffer; +@@ -344,7 +347,7 @@ + size_t offset = 0; + + if (gvnc->has_error) return -EINVAL; +- ++ + while (offset < len) { + size_t tmp; + +@@ -352,10 +355,10 @@ + * so we must by-pass it */ + if (gvnc_use_compression(gvnc)) { + int ret = gvnc_zread(gvnc, data + offset, len); +- if (ret == -1) { ++ if (ret < 0) { + GVNC_DEBUG("Closing the connection: gvnc_read() - gvnc_zread() failed\n"); + gvnc->has_error = TRUE; +- return -errno; ++ return ret; + } + offset += ret; + continue; +@@ -366,17 +369,19 @@ + ret = gnutls_read(gvnc->tls_session, gvnc->read_buffer, 4096); + if (ret < 0) { + if (ret == GNUTLS_E_AGAIN) +- errno = EAGAIN; ++ ret = -EAGAIN; + else +- errno = EIO; +- ret = -1; ++ ret = -EIO; + } +- } else +- ret = read(fd, gvnc->read_buffer, 4096); ++ } else { ++ ret = recv(fd, gvnc->read_buffer, 4096, 0); ++ if (ret < 0) ++ ret = socket_errno() * -1; ++ } + +- if (ret == -1) { +- switch (errno) { +- case EAGAIN: ++ if (ret < 0) { ++ switch (ret * -1) { ++ case EWOULDBLOCK: + if (gvnc->wait_interruptable) { + if (!g_io_wait_interruptable(&gvnc->wait, + gvnc->channel, G_IO_IN)) +@@ -386,9 +391,9 @@ + case EINTR: + continue; + default: +- GVNC_DEBUG("Closing the connection: gvnc_read() - ret=-1\n"); ++ GVNC_DEBUG("Closing the connection: gvnc_read() - ret=%d\n", ret); + gvnc->has_error = TRUE; +- return -errno; ++ return ret; + } + } + if (ret == 0) { +@@ -425,23 +430,25 @@ + gvnc->write_offset-offset); + if (ret < 0) { + if (ret == GNUTLS_E_AGAIN) +- errno = EAGAIN; ++ ret = -EAGAIN; + else +- errno = EIO; +- ret = -1; ++ ret = -EIO; + } +- } else +- ret = write(fd, +- gvnc->write_buffer+offset, +- gvnc->write_offset-offset); +- if (ret == -1) { +- switch (errno) { +- case EAGAIN: ++ } else { ++ ret = send(fd, ++ gvnc->write_buffer+offset, ++ gvnc->write_offset-offset, 0); ++ if (ret < 0) ++ ret = socket_errno() * -1; ++ } ++ if (ret < 0) { ++ switch (ret * -1) { ++ case EWOULDBLOCK: + g_io_wait(gvnc->channel, G_IO_OUT); + case EINTR: + continue; + default: +- GVNC_DEBUG("Closing the connection: gvnc_flush\n"); ++ GVNC_DEBUG("Closing the connection: gvnc_flush %d\n", ret); + gvnc->has_error = TRUE; + return; + } +@@ -488,7 +495,7 @@ + retry: + ret = write(fd, data, len); + if (ret < 0) { +- if (errno == EINTR) ++ if (socket_errno() == EINTR) + goto retry; + return -1; + } +@@ -506,7 +513,7 @@ + retry: + ret = read(fd, data, len); + if (ret < 0) { +- if (errno == EINTR) ++ if (socket_errno() == EINTR) + goto retry; + return -1; + } +@@ -2802,12 +2809,12 @@ + if (gvnc_has_error(gvnc)) + return FALSE; + +- if (!gvnc->fmt.true_color_flag && gvnc->ops.get_preferred_pixel_format) ++ if (!gvnc->fmt.true_color_flag && gvnc->ops.get_preferred_pixel_format) { + if (gvnc->ops.get_preferred_pixel_format(gvnc->ops_data, &gvnc->fmt)) + gvnc_set_pixel_format(gvnc, &gvnc->fmt); + else + goto fail; +- ++ } + memset(&gvnc->strm, 0, sizeof(gvnc->strm)); + /* FIXME what level? */ + for (i = 0; i < 5; i++) +@@ -2822,15 +2829,16 @@ + return !gvnc_has_error(gvnc); + } + +-gboolean gvnc_open_fd(struct gvnc *gvnc, int fd) ++static gboolean gvnc_set_nonblock(int fd) + { +- int flags; +- if (gvnc_is_open(gvnc)) { +- GVNC_DEBUG ("Error: already connected?\n"); ++#ifdef __MINGW32__ ++ unsigned long flags = 1; ++ if (ioctlsocket(fd, FIONBIO, &flags) < 0) { ++ GVNC_DEBUG ("Failed to set nonblocking flag\n"); + return FALSE; + } +- +- GVNC_DEBUG("Connecting to FD %d\n", fd); ++#else ++ int flags; + if ((flags = fcntl(fd, F_GETFL)) < 0) { + GVNC_DEBUG ("Failed to fcntl()\n"); + return FALSE; +@@ -2840,6 +2848,21 @@ + GVNC_DEBUG ("Failed to fcntl()\n"); + return FALSE; + } ++#endif ++ return TRUE; ++} ++ ++gboolean gvnc_open_fd(struct gvnc *gvnc, int fd) ++{ ++ if (gvnc_is_open(gvnc)) { ++ GVNC_DEBUG ("Error: already connected?\n"); ++ return FALSE; ++ } ++ ++ GVNC_DEBUG("Connecting to FD %d\n", fd); ++ ++ if (!gvnc_set_nonblock(fd)) ++ return FALSE; + + if (!(gvnc->channel = g_io_channel_unix_new(fd))) { + GVNC_DEBUG ("Failed to g_io_channel_unix_new()\n"); +@@ -2873,7 +2896,7 @@ + + runp = ai; + while (runp != NULL) { +- int flags, fd; ++ int fd; + GIOChannel *chan; + + if ((fd = socket(runp->ai_family, runp->ai_socktype, +@@ -2883,17 +2906,8 @@ + } + + GVNC_DEBUG("Trying socket %d\n", fd); +- if ((flags = fcntl(fd, F_GETFL)) < 0) { +- close(fd); +- GVNC_DEBUG ("Failed to fcntl()\n"); +- break; +- } +- flags |= O_NONBLOCK; +- if (fcntl(fd, F_SETFL, flags) < 0) { +- close(fd); +- GVNC_DEBUG ("Failed to fcntl()\n"); +- break; +- } ++ if (!gvnc_set_nonblock(fd)) ++ break; + + if (!(chan = g_io_channel_unix_new(fd))) { + close(fd); +@@ -2904,21 +2918,22 @@ + reconnect: + /* FIXME: Better handle EINPROGRESS/EISCONN return values, + as explained in connect(2) man page */ +- if ( (connect(fd, runp->ai_addr, runp->ai_addrlen) == 0) || errno == EISCONN) { ++ if ((connect(fd, runp->ai_addr, runp->ai_addrlen) == 0) || ++ socket_errno() == EISCONN) { + gvnc->channel = chan; + gvnc->fd = fd; + freeaddrinfo(ai); + return !gvnc_has_error(gvnc); + } +- +- if (errno == EINPROGRESS) { ++ if (socket_errno() == EINPROGRESS || ++ socket_errno() == EWOULDBLOCK) { + g_io_wait(chan, G_IO_OUT|G_IO_ERR|G_IO_HUP); + goto reconnect; +- } else if (errno != ECONNREFUSED && +- errno != EHOSTUNREACH) { ++ } else if (socket_errno() != ECONNREFUSED && ++ socket_errno() != EHOSTUNREACH) { + g_io_channel_unref(chan); + close(fd); +- GVNC_DEBUG ("Failed with errno = %d\n", errno); ++ GVNC_DEBUG ("Failed with errno = %d\n", socket_errno()); + break; + } + close(fd); +diff -urN gtk-vnc-0.3.7/src/Makefile.am gtk-vnc-0.3.7.mingw/src/Makefile.am +--- gtk-vnc-0.3.7/src/Makefile.am 2008-09-05 13:32:15.000000000 +0100 ++++ gtk-vnc-0.3.7.mingw/src/Makefile.am 2008-10-09 12:19:03.000000000 +0100 +@@ -4,13 +4,15 @@ + lib_LTLIBRARIES = libgtk-vnc-1.0.la + + libgtk_vnc_1_0_la_LIBADD = @GTK_LIBS@ @GTKGLEXT_LIBS@ @GNUTLS_LIBS@ \ +- @GTHREAD_LIBS@ ++ @GTHREAD_LIBS@ \ ++ ../gnulib/lib/libgnu.la + libgtk_vnc_1_0_la_CFLAGS = @GTK_CFLAGS@ @GTKGLEXT_CFLAGS@ @GNUTLS_CFLAGS@ \ + @GTHREAD_CFLAGS@ @WARNING_CFLAGS@ \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ +- -DG_LOG_DOMAIN=\"gtk-vnc\" ++ -DG_LOG_DOMAIN=\"gtk-vnc\" \ ++ -I$(top_srcdir)gnulib/lib -I../gnulib/lib + libgtk_vnc_1_0_la_LDFLAGS = -Wl, @LD_VERSION_SCRIPT_SUPPORT@ \ +- -version-info 0:1:0 ++ -version-info 0:1:0 -no-undefined + + gtk_vnc_includedir = $(includedir)/gtk-vnc-1.0/ + gtk_vnc_include_HEADERS = vncdisplay.h +@@ -22,7 +24,7 @@ + vncdisplay.h vncdisplay.c \ + vncmarshal.h vncmarshal.c \ + x_keymap.h x_keymap.c vnc_keycodes.h \ +- utils.h ++ utils.h socketcompat.h + + if WITH_UCONTEXT + libgtk_vnc_1_0_la_SOURCES += continuation.h continuation.c coroutine_ucontext.c +diff -urN gtk-vnc-0.3.7/src/socketcompat.h gtk-vnc-0.3.7.mingw/src/socketcompat.h +--- gtk-vnc-0.3.7/src/socketcompat.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.mingw/src/socketcompat.h 2008-10-09 12:19:03.000000000 +0100 +@@ -0,0 +1,64 @@ ++/* ++ * socketcompat.h: Socket compatibility for Windows, making it slightly ++ * less painful to use. ++ * ++ * Use this header under the following circumstances: ++ * (a) Instead of including any of: , , ++ * , , , AND ++ * (b) The file will be part of what is built on Windows (basically ++ * just remote client stuff). ++ * ++ * You need to use socket_errno() instead of errno to get socket ++ * errors. ++ * ++ * Copyright (C) 2008 Red Hat, Inc. ++ * ++ * See COPYING.LIB for the License of this software ++ * ++ * Richard W.M. Jones ++ */ ++ ++#ifndef __SOCKETCOMPAT_H__ ++#define __SOCKETCOMPAT_H__ ++ ++#include ++ ++#include ++ ++#ifndef HAVE_WINSOCK2_H /* Unix & Cygwin. */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++static inline int ++socket_errno (void) ++{ ++ return errno; ++} ++ ++#else /* MinGW & Win32 */ ++ ++#include ++ ++/* Socket functions in Windows don't set errno. Instead of using errno ++ * to test for socket errors, call this function to get the errno. ++ */ ++static inline int ++socket_errno (void) ++{ ++ return WSAGetLastError (); ++} ++ ++/* Compatibility. */ ++#define EWOULDBLOCK WSAEWOULDBLOCK ++#define ECONNREFUSED WSAECONNREFUSED ++#define EINPROGRESS WSAEINPROGRESS ++#define EHOSTUNREACH WSAEHOSTUNREACH ++#define EISCONN WSAEISCONN ++ ++#endif /* HAVE_WINSOCK2_H */ ++ ++#endif /* __WINSOCKWRAPPER_H__ */ +diff -urN gtk-vnc-0.3.7/src/vncdisplay.c gtk-vnc-0.3.7.mingw/src/vncdisplay.c +--- gtk-vnc-0.3.7/src/vncdisplay.c 2008-10-09 12:16:42.000000000 +0100 ++++ gtk-vnc-0.3.7.mingw/src/vncdisplay.c 2008-10-09 12:19:03.000000000 +0100 +@@ -8,6 +8,8 @@ + * GTK VNC Widget + */ + ++#include ++ + #include "vncdisplay.h" + #include "coroutine.h" + #include "gvnc.h" +@@ -24,7 +26,9 @@ + #include + #include + #include ++#ifdef HAVE_PWD_H + #include ++#endif + + #if WITH_GTKGLEXT + #include +@@ -2191,33 +2195,44 @@ + + static int vnc_display_set_x509_credential(VncDisplay *obj, const char *name) + { +- char sysdir[PATH_MAX], userdir[PATH_MAX]; +- struct passwd *pw; + char file[PATH_MAX]; ++ char sysdir[PATH_MAX]; ++#ifndef __MINGW32__ ++ char userdir[PATH_MAX]; ++ struct passwd *pw; + char *dirs[] = { sysdir, userdir }; ++#else ++ char *dirs[] = { sysdir }; ++#endif + + strncpy(sysdir, SYSCONFDIR "/pki", PATH_MAX-1); + sysdir[PATH_MAX-1] = '\0'; + ++#ifndef __MINGW32__ + if (!(pw = getpwuid(getuid()))) + return TRUE; + + snprintf(userdir, PATH_MAX-1, "%s/.pki", pw->pw_dir); + userdir[PATH_MAX-1] = '\0'; ++#endif + +- if (vnc_display_best_path(file, PATH_MAX, "CA", "cacert.pem", dirs, 2) < 0) ++ if (vnc_display_best_path(file, PATH_MAX, "CA", "cacert.pem", ++ dirs, sizeof(dirs)/sizeof(dirs[0])) < 0) + return TRUE; + gvnc_set_credential_x509_cacert(obj->priv->gvnc, file); + + /* Don't mind failures of CRL */ +- if (vnc_display_best_path(file, PATH_MAX, "CA", "cacrl.pem", dirs, 2) == 0) ++ if (vnc_display_best_path(file, PATH_MAX, "CA", "cacrl.pem", ++ dirs, sizeof(dirs)/sizeof(dirs[0])) == 0) + gvnc_set_credential_x509_cacert(obj->priv->gvnc, file); + + /* Set client key & cert if we have them. Server will reject auth + * if it decides it requires them*/ +- if (vnc_display_best_path(file, PATH_MAX, name, "private/clientkey.pem", dirs, 2) == 0) ++ if (vnc_display_best_path(file, PATH_MAX, name, "private/clientkey.pem", ++ dirs, sizeof(dirs)/sizeof(dirs[0])) == 0) + gvnc_set_credential_x509_key(obj->priv->gvnc, file); +- if (vnc_display_best_path(file, PATH_MAX, name, "clientcert.pem", dirs, 2) == 0) ++ if (vnc_display_best_path(file, PATH_MAX, name, "clientcert.pem", ++ dirs, sizeof(dirs)/sizeof(dirs[0])) == 0) + gvnc_set_credential_x509_cert(obj->priv->gvnc, file); + + return FALSE; +diff -urN gtk-vnc-0.3.7/src/vncdisplay.c.orig gtk-vnc-0.3.7.mingw/src/vncdisplay.c.orig +--- gtk-vnc-0.3.7/src/vncdisplay.c.orig 2008-09-05 13:32:16.000000000 +0100 ++++ gtk-vnc-0.3.7.mingw/src/vncdisplay.c.orig 1970-01-01 01:00:00.000000000 +0100 +@@ -1,2491 +0,0 @@ +-/* +- * Copyright (C) 2006 Anthony Liguori +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU Lesser General Public License version 2 or +- * later as published by the Free Software Foundation. +- * +- * GTK VNC Widget +- */ +- +-#include "vncdisplay.h" +-#include "coroutine.h" +-#include "gvnc.h" +-#include "utils.h" +-#include "vncmarshal.h" +-#include "config.h" +-#include "x_keymap.h" +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#if WITH_GTKGLEXT +-#include +-#include +-#endif +- +-#define VNC_DISPLAY_GET_PRIVATE(obj) \ +- (G_TYPE_INSTANCE_GET_PRIVATE((obj), VNC_TYPE_DISPLAY, VncDisplayPrivate)) +- +-struct _VncDisplayPrivate +-{ +- int fd; +- char *host; +- char *port; +- GdkGC *gc; +- GdkImage *image; +- GdkCursor *null_cursor; +- GdkCursor *remote_cursor; +- +-#if WITH_GTKGLEXT +- int gl_enabled; +- GdkGLConfig *gl_config; +- GdkGLDrawable *gl_drawable; +- GdkGLContext *gl_context; +- uint8_t *gl_tex_data; +- int gl_texture_width; +- int gl_texture_height; +- int gl_width; +- int gl_height; +- GLuint gl_tex; +-#endif +- +- struct gvnc_framebuffer fb; +- struct coroutine coroutine; +- struct gvnc *gvnc; +- +- guint open_id; +- +- gboolean in_pointer_grab; +- gboolean in_keyboard_grab; +- +- guint down_keyval[16]; +- guint down_scancode[16]; +- +- int button_mask; +- int last_x; +- int last_y; +- +- gboolean absolute; +- +- gboolean grab_pointer; +- gboolean grab_keyboard; +- gboolean local_pointer; +- gboolean read_only; +- gboolean allow_lossy; +- gboolean allow_scaling; +- gboolean shared_flag; +- gboolean force_size; +- +- GSList *preferable_auths; +-}; +- +-/* Delayed signal emission. +- * +- * We want signals to be delivered in the system coroutine. This helps avoid +- * confusing applications. This is particularly important when using +- * GThread based coroutines since GTK gets very upset if a signal handler is +- * run in a different thread from the main loop if that signal handler isn't +- * written to use explicit locking. +- */ +-struct signal_data +-{ +- VncDisplay *obj; +- struct coroutine *caller; +- +- int signum; +- GValueArray *cred_list; +- int width; +- int height; +- const char *msg; +- unsigned int auth_type; +- GString *str; +-}; +- +-G_DEFINE_TYPE(VncDisplay, vnc_display, GTK_TYPE_DRAWING_AREA) +- +-/* Properties */ +-enum +-{ +- PROP_0, +- PROP_POINTER_LOCAL, +- PROP_POINTER_GRAB, +- PROP_KEYBOARD_GRAB, +- PROP_READ_ONLY, +- PROP_WIDTH, +- PROP_HEIGHT, +- PROP_NAME, +- PROP_LOSSY_ENCODING, +- PROP_SCALING, +- PROP_SHARED_FLAG, +- PROP_FORCE_SIZE +-}; +- +-/* Signals */ +-typedef enum +-{ +- VNC_POINTER_GRAB, +- VNC_POINTER_UNGRAB, +- VNC_KEYBOARD_GRAB, +- VNC_KEYBOARD_UNGRAB, +- +- VNC_CONNECTED, +- VNC_INITIALIZED, +- VNC_DISCONNECTED, +- VNC_AUTH_CREDENTIAL, +- +- VNC_DESKTOP_RESIZE, +- +- VNC_AUTH_FAILURE, +- VNC_AUTH_UNSUPPORTED, +- +- VNC_SERVER_CUT_TEXT, +- VNC_BELL, +- +- LAST_SIGNAL +-} vnc_display_signals; +- +-static guint signals[LAST_SIGNAL] = { 0, 0, 0, 0, +- 0, 0, 0, 0, +- 0, 0, 0, 0, 0,}; +-static GParamSpec *signalCredParam; +-gboolean debug_enabled = FALSE; +- +-static const GOptionEntry gtk_vnc_args[] = +-{ +- { "gtk-vnc-debug", 0, 0, G_OPTION_ARG_NONE, &debug_enabled, "Enables debug output", 0 }, +- { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, 0 } +-}; +- +- +-static void +-vnc_display_get_property (GObject *object, +- guint prop_id, +- GValue *value, +- GParamSpec *pspec) +-{ +- VncDisplay *vnc = VNC_DISPLAY (object); +- +- switch (prop_id) +- { +- case PROP_POINTER_LOCAL: +- g_value_set_boolean (value, vnc->priv->local_pointer); +- break; +- case PROP_POINTER_GRAB: +- g_value_set_boolean (value, vnc->priv->grab_pointer); +- break; +- case PROP_KEYBOARD_GRAB: +- g_value_set_boolean (value, vnc->priv->grab_keyboard); +- break; +- case PROP_READ_ONLY: +- g_value_set_boolean (value, vnc->priv->read_only); +- break; +- case PROP_WIDTH: +- g_value_set_int (value, vnc_display_get_width (vnc)); +- break; +- case PROP_HEIGHT: +- g_value_set_int (value, vnc_display_get_height (vnc)); +- break; +- case PROP_NAME: +- g_value_set_string (value, vnc_display_get_name (vnc)); +- break; +- case PROP_LOSSY_ENCODING: +- g_value_set_boolean (value, vnc->priv->allow_lossy); +- break; +- case PROP_SCALING: +- g_value_set_boolean (value, vnc->priv->allow_scaling); +- break; +- case PROP_SHARED_FLAG: +- g_value_set_boolean (value, vnc->priv->shared_flag); +- break; +- case PROP_FORCE_SIZE: +- g_value_set_boolean (value, vnc->priv->force_size); +- break; +- default: +- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); +- break; +- } +-} +- +-static void +-vnc_display_set_property (GObject *object, +- guint prop_id, +- const GValue *value, +- GParamSpec *pspec) +-{ +- VncDisplay *vnc = VNC_DISPLAY (object); +- +- switch (prop_id) +- { +- case PROP_POINTER_LOCAL: +- vnc_display_set_pointer_local (vnc, g_value_get_boolean (value)); +- break; +- case PROP_POINTER_GRAB: +- vnc_display_set_pointer_grab (vnc, g_value_get_boolean (value)); +- break; +- case PROP_KEYBOARD_GRAB: +- vnc_display_set_keyboard_grab (vnc, g_value_get_boolean (value)); +- break; +- case PROP_READ_ONLY: +- vnc_display_set_read_only (vnc, g_value_get_boolean (value)); +- break; +- case PROP_LOSSY_ENCODING: +- vnc_display_set_lossy_encoding (vnc, g_value_get_boolean (value)); +- break; +- case PROP_SCALING: +- vnc_display_set_scaling (vnc, g_value_get_boolean (value)); +- break; +- case PROP_SHARED_FLAG: +- vnc_display_set_shared_flag (vnc, g_value_get_boolean (value)); +- break; +- case PROP_FORCE_SIZE: +- vnc_display_set_force_size (vnc, g_value_get_boolean (value)); +- break; +- default: +- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); +- break; +- } +-} +- +-GtkWidget *vnc_display_new(void) +-{ +- return GTK_WIDGET(g_object_new(VNC_TYPE_DISPLAY, NULL)); +-} +- +-static GdkCursor *create_null_cursor(void) +-{ +- GdkBitmap *image; +- gchar data[4] = {0}; +- GdkColor fg = { 0, 0, 0, 0 }; +- GdkCursor *cursor; +- +- image = gdk_bitmap_create_from_data(NULL, data, 1, 1); +- +- cursor = gdk_cursor_new_from_pixmap(GDK_PIXMAP(image), +- GDK_PIXMAP(image), +- &fg, &fg, 0, 0); +- gdk_bitmap_unref(image); +- +- return cursor; +-} +- +-static gboolean expose_event(GtkWidget *widget, GdkEventExpose *expose) +-{ +- VncDisplay *obj = VNC_DISPLAY(widget); +- VncDisplayPrivate *priv = obj->priv; +- int x, y, w, h; +- GdkRectangle drawn; +- GdkRegion *clear, *copy; +- +- GVNC_DEBUG("Expose %dx%d @ %d,%d\n", +- expose->area.x, +- expose->area.y, +- expose->area.width, +- expose->area.height); +- +- if (priv->image == NULL) { +-#if WITH_GTKGLEXT +- if (priv->gl_tex_data == NULL) +-#endif +- { +- GdkGC *gc = gdk_gc_new(widget->window); +- gdk_draw_rectangle(widget->window, gc, TRUE, +- expose->area.x, expose->area.y, +- expose->area.width, +- expose->area.height); +- g_object_unref(gc); +- return TRUE; +- } +- } +- +-#if WITH_GTKGLEXT +- if (priv->gl_enabled) { +- float rx, ry; +- int wx = 0, wy = 0; +- int ww = priv->gl_width, wh = priv->gl_height; +- double scale_x, scale_y; +- +- scale_x = (double)priv->gl_width / priv->fb.width; +- scale_y = (double)priv->gl_height / priv->fb.height; +- +- x = expose->area.x / scale_x; +- y = expose->area.y / scale_y; +- w = expose->area.width / scale_x; +- h = expose->area.height / scale_y; +- +- y -= 5; +- h += 10; +- if (y < 0) +- y = 0; +- +- x -= 5; +- w += 10; +- if (x < 0) +- x = 0; +- +- x = MIN(x, priv->fb.width); +- y = MIN(y, priv->fb.height); +- w = MIN(x + w, priv->fb.width); +- h = MIN(y + h, priv->fb.height); +- w -= x; +- h -= y; +- +- gdk_gl_drawable_gl_begin(priv->gl_drawable, priv->gl_context); +- glBindTexture(GL_TEXTURE_2D, priv->gl_tex); +- glPixelStorei(GL_UNPACK_ROW_LENGTH, priv->fb.width); +- glTexSubImage2D(GL_TEXTURE_2D, 0, +- x, y, w, h, +- GL_BGRA_EXT, +- GL_UNSIGNED_BYTE, +- priv->gl_tex_data + +- y * 4 * priv->fb.width + +- x * 4); +- rx = (float)priv->fb.width / priv->gl_texture_width; +- ry = (float)priv->fb.height / priv->gl_texture_height; +- +- glEnable(GL_TEXTURE_2D); +- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); +- glBegin(GL_QUADS); +- glTexCoord2f(0,ry); glVertex3f(wx, wy, 0); +- glTexCoord2f(0,0); glVertex3f(wx, wy+wh, 0); +- glTexCoord2f(rx,0); glVertex3f(wx+ww, wy+wh, 0); +- glTexCoord2f(rx,ry); glVertex3f(wx+ww, wy, 0); +- glEnd(); +- glDisable(GL_TEXTURE_2D); +- glFlush(); +- gdk_gl_drawable_gl_end(priv->gl_drawable); +- } else +-#endif +- { +- int mx = 0, my = 0; +- int ww, wh; +- +- gdk_drawable_get_size(widget->window, &ww, &wh); +- if (ww > priv->fb.width) +- mx = (ww - priv->fb.width) / 2; +- if (wh > priv->fb.height) +- my = (wh - priv->fb.height) / 2; +- +- x = MIN(expose->area.x - mx, priv->fb.width); +- y = MIN(expose->area.y - my, priv->fb.height); +- w = MIN(expose->area.x + expose->area.width - mx, priv->fb.width); +- h = MIN(expose->area.y + expose->area.height - my, priv->fb.height); +- x = MAX(0, x); +- y = MAX(0, y); +- w = MAX(0, w); +- h = MAX(0, h); +- +- w -= x; +- h -= y; +- +- drawn.x = x + mx; +- drawn.y = y + my; +- drawn.width = w; +- drawn.height = h; +- +- clear = gdk_region_rectangle(&expose->area); +- copy = gdk_region_rectangle(&drawn); +- gdk_region_subtract(clear, copy); +- +- gdk_gc_set_clip_region(priv->gc, copy); +- gdk_draw_image(widget->window, priv->gc, priv->image, +- x, y, x + mx, y + my, w, h); +- +- gdk_gc_set_clip_region(priv->gc, clear); +- gdk_draw_rectangle(widget->window, priv->gc, TRUE, expose->area.x, expose->area.y, +- expose->area.width, expose->area.height); +- +- gdk_region_destroy(clear); +- gdk_region_destroy(copy); +- } +- +- return TRUE; +-} +- +-static void do_keyboard_grab(VncDisplay *obj, gboolean quiet) +-{ +- VncDisplayPrivate *priv = obj->priv; +- +- gdk_keyboard_grab(GTK_WIDGET(obj)->window, +- FALSE, +- GDK_CURRENT_TIME); +- priv->in_keyboard_grab = TRUE; +- if (!quiet) +- g_signal_emit(obj, signals[VNC_KEYBOARD_GRAB], 0); +-} +- +- +-static void do_keyboard_ungrab(VncDisplay *obj, gboolean quiet) +-{ +- VncDisplayPrivate *priv = obj->priv; +- +- gdk_keyboard_ungrab(GDK_CURRENT_TIME); +- priv->in_keyboard_grab = FALSE; +- if (!quiet) +- g_signal_emit(obj, signals[VNC_KEYBOARD_UNGRAB], 0); +-} +- +-static void do_pointer_hide(VncDisplay *obj) +-{ +- VncDisplayPrivate *priv = obj->priv; +- gdk_window_set_cursor(GTK_WIDGET(obj)->window, +- priv->remote_cursor ? priv->remote_cursor : priv->null_cursor); +-} +- +-static void do_pointer_show(VncDisplay *obj) +-{ +- VncDisplayPrivate *priv = obj->priv; +- gdk_window_set_cursor(GTK_WIDGET(obj)->window, +- priv->remote_cursor); +-} +- +-static void do_pointer_grab(VncDisplay *obj, gboolean quiet) +-{ +- VncDisplayPrivate *priv = obj->priv; +- +- /* If we're not already grabbing keyboard, grab it now */ +- if (!priv->grab_keyboard) +- do_keyboard_grab(obj, quiet); +- +- gdk_pointer_grab(GTK_WIDGET(obj)->window, +- TRUE, +- GDK_POINTER_MOTION_MASK | +- GDK_BUTTON_PRESS_MASK | +- GDK_BUTTON_RELEASE_MASK | +- GDK_BUTTON_MOTION_MASK | +- GDK_SCROLL_MASK, +- GTK_WIDGET(obj)->window, +- priv->remote_cursor ? priv->remote_cursor : priv->null_cursor, +- GDK_CURRENT_TIME); +- priv->in_pointer_grab = TRUE; +- if (!quiet) +- g_signal_emit(obj, signals[VNC_POINTER_GRAB], 0); +-} +- +-static void do_pointer_ungrab(VncDisplay *obj, gboolean quiet) +-{ +- VncDisplayPrivate *priv = obj->priv; +- +- /* If we grabbed keyboard upon pointer grab, then ungrab it now */ +- if (!priv->grab_keyboard) +- do_keyboard_ungrab(obj, quiet); +- +- gdk_pointer_ungrab(GDK_CURRENT_TIME); +- priv->in_pointer_grab = FALSE; +- +- if (priv->absolute) +- do_pointer_hide(obj); +- +- if (!quiet) +- g_signal_emit(obj, signals[VNC_POINTER_UNGRAB], 0); +-} +- +-void vnc_display_force_grab(VncDisplay *obj, gboolean enable) +-{ +- if (enable) +- do_pointer_grab(obj, FALSE); +- else +- do_pointer_ungrab(obj, FALSE); +-} +- +-static gboolean button_event(GtkWidget *widget, GdkEventButton *button) +-{ +- VncDisplayPrivate *priv = VNC_DISPLAY(widget)->priv; +- int n; +- +- if (priv->gvnc == NULL || !gvnc_is_initialized(priv->gvnc)) +- return FALSE; +- +- if (priv->read_only) +- return FALSE; +- +- gtk_widget_grab_focus (widget); +- +- if (priv->grab_pointer && !priv->absolute && !priv->in_pointer_grab && +- button->button == 1 && button->type == GDK_BUTTON_PRESS) +- do_pointer_grab(VNC_DISPLAY(widget), FALSE); +- +- n = 1 << (button->button - 1); +- if (button->type == GDK_BUTTON_PRESS) +- priv->button_mask |= n; +- else if (button->type == GDK_BUTTON_RELEASE) +- priv->button_mask &= ~n; +- +- if (priv->absolute) { +- gvnc_pointer_event(priv->gvnc, priv->button_mask, +- priv->last_x, priv->last_y); +- } else { +- gvnc_pointer_event(priv->gvnc, priv->button_mask, +- 0x7FFF, 0x7FFF); +- } +- +- return TRUE; +-} +- +-static gboolean scroll_event(GtkWidget *widget, GdkEventScroll *scroll) +-{ +- VncDisplayPrivate *priv = VNC_DISPLAY(widget)->priv; +- int mask; +- +- if (priv->gvnc == NULL || !gvnc_is_initialized(priv->gvnc)) +- return FALSE; +- +- if (priv->read_only) +- return FALSE; +- +- if (scroll->direction == GDK_SCROLL_UP) +- mask = (1 << 3); +- else if (scroll->direction == GDK_SCROLL_DOWN) +- mask = (1 << 4); +- else if (scroll->direction == GDK_SCROLL_LEFT) +- mask = (1 << 5); +- else if (scroll->direction == GDK_SCROLL_RIGHT) +- mask = (1 << 6); +- else +- return FALSE; +- +- if (priv->absolute) { +- gvnc_pointer_event(priv->gvnc, priv->button_mask | mask, +- priv->last_x, priv->last_y); +- gvnc_pointer_event(priv->gvnc, priv->button_mask, +- priv->last_x, priv->last_y); +- } else { +- gvnc_pointer_event(priv->gvnc, priv->button_mask | mask, +- 0x7FFF, 0x7FFF); +- gvnc_pointer_event(priv->gvnc, priv->button_mask, +- 0x7FFF, 0x7FFF); +- } +- +- return TRUE; +-} +- +-static gboolean motion_event(GtkWidget *widget, GdkEventMotion *motion) +-{ +- VncDisplayPrivate *priv = VNC_DISPLAY(widget)->priv; +- int dx, dy; +- +- if (priv->gvnc == NULL || !gvnc_is_initialized(priv->gvnc)) +- return FALSE; +- +- if (!priv->absolute && !priv->in_pointer_grab) +- return FALSE; +- +- if (priv->read_only) +- return FALSE; +- +-#if WITH_GTKGLEXT +- if (priv->gl_enabled) { +- motion->x *= priv->fb.width; +- motion->x /= priv->gl_width; +- motion->y *= priv->fb.height; +- motion->y /= priv->gl_height; +- } else +-#endif +- { +- int ww, wh; +- int mw = 0, mh = 0; +- +- gdk_drawable_get_size(widget->window, &ww, &wh); +- if (ww > priv->fb.width) +- mw = (ww - priv->fb.width) / 2; +- if (wh > priv->fb.height) +- mh = (wh - priv->fb.height) / 2; +- +- motion->x -= mw; +- motion->y -= mh; +- +- if (motion->x < 0 || motion->x >= priv->fb.width || +- motion->y < 0 || motion->y >= priv->fb.height) +- return FALSE; +- } +- +- if (!priv->absolute && priv->in_pointer_grab) { +- GdkDrawable *drawable = GDK_DRAWABLE(widget->window); +- GdkDisplay *display = gdk_drawable_get_display(drawable); +- GdkScreen *screen = gdk_drawable_get_screen(drawable); +- int x = (int)motion->x_root; +- int y = (int)motion->y_root; +- +- if (x == 0) x += 200; +- if (y == 0) y += 200; +- if (x == (gdk_screen_get_width(screen) - 1)) x -= 200; +- if (y == (gdk_screen_get_height(screen) - 1)) y -= 200; +- +- if (x != (int)motion->x_root || y != (int)motion->y_root) { +- gdk_display_warp_pointer(display, screen, x, y); +- priv->last_x = -1; +- priv->last_y = -1; +- return FALSE; +- } +- } +- +- if (priv->last_x != -1) { +- if (priv->absolute) { +- dx = (int)motion->x; +- dy = (int)motion->y; +- } else { +- dx = (int)motion->x + 0x7FFF - priv->last_x; +- dy = (int)motion->y + 0x7FFF - priv->last_y; +- } +- +- gvnc_pointer_event(priv->gvnc, priv->button_mask, dx, dy); +- } +- +- priv->last_x = (int)motion->x; +- priv->last_y = (int)motion->y; +- +- return TRUE; +-} +- +-static gboolean key_event(GtkWidget *widget, GdkEventKey *key) +-{ +- VncDisplayPrivate *priv = VNC_DISPLAY(widget)->priv; +- guint keyval; +- gint group, level; +- GdkModifierType consumed; +- +- if (priv->gvnc == NULL || !gvnc_is_initialized(priv->gvnc)) +- return FALSE; +- +- if (priv->read_only) +- return FALSE; +- +- /* +- * Key handling in VNC is screwy. The event.keyval from GTK is +- * interpreted relative to modifier state. This really messes +- * up with VNC which has no concept of modifiers - it just sees +- * key up & down events - the remote end interprets modifiers +- * itself. So if we interpret at the client end you can end up +- * with 'Alt' key press generating Alt_L, and key release generating +- * ISO_Prev_Group. This really really confuses the VNC server +- * with 'Alt' getting stuck on. +- * +- * So we have to redo GTK's keycode -> keyval translation +- * using only the SHIFT modifier which the RFB explicitly +- * requires to be interpreted at client end. +- * +- * Arggggh. +- */ +- gdk_keymap_translate_keyboard_state(gdk_keymap_get_default(), +- key->hardware_keycode, +- key->state & (GDK_SHIFT_MASK | GDK_LOCK_MASK), +- key->group, +- &keyval, +- &group, +- &level, +- &consumed); +- +- keyval = x_keymap_get_keyval_from_keycode(key->hardware_keycode, keyval); +- +- /* +- * More VNC suckiness with key state & modifiers in particular +- * +- * Because VNC has no concept of modifiers, we have to track what keys are +- * pressed and when the widget looses focus send fake key up events for all +- * keys current held down. This is because upon gaining focus any keys held +- * down are no longer likely to be down. This would thus result in keys +- * being 'stuck on' in the remote server. eg upon Alt-Tab to switch window +- * focus you'd never see key up for the Alt or Tab keys without this :-( +- * +- * This is mostly a problem with modifier keys, but its best to just track +- * all key presses regardless. There's a limit to how many keys a user can +- * press at once due to a max of 10 fingers (normally :-), so down_key_vals +- * is only storing upto 16 for now. Should be plenty... +- * +- * Arggggh. +- */ +- if (key->type == GDK_KEY_PRESS) { +- int i; +- for (i = 0 ; i < (int)(sizeof(priv->down_keyval)/sizeof(priv->down_keyval[0])) ; i++) { +- if (priv->down_scancode[i] == 0) { +- priv->down_keyval[i] = keyval; +- priv->down_scancode[i] = key->hardware_keycode; +- /* Send the actual key event we're dealing with */ +- gvnc_key_event(priv->gvnc, 1, keyval, key->hardware_keycode); +- break; +- } else if (priv->down_scancode[i] == key->hardware_keycode) { +- /* Got an press when we're already pressed ! Why ... ? +- * +- * Well, GTK merges sequential press+release pairs of the same +- * key so instead of press+release,press+release,press+release +- * we only get press+press+press+press+press+release. This +- * really annoys some VNC servers, so we have to un-merge +- * them into a sensible stream of press+release pairs +- */ +- /* Fake an up event for the previous down event */ +- gvnc_key_event(priv->gvnc, 0, keyval, key->hardware_keycode); +- /* Now send our actual ldown event */ +- gvnc_key_event(priv->gvnc, 1, keyval, key->hardware_keycode); +- break; +- } +- } +- } else { +- int i; +- for (i = 0 ; i < (int)(sizeof(priv->down_keyval)/sizeof(priv->down_keyval[0])) ; i++) { +- /* We were pressed, and now we're released, so... */ +- if (priv->down_scancode[i] == key->hardware_keycode) { +- priv->down_keyval[i] = 0; +- priv->down_scancode[i] = 0; +- /* ..send the key release event we're dealing with */ +- gvnc_key_event(priv->gvnc, 0, keyval, key->hardware_keycode); +- break; +- } +- } +- } +- +- if ((!priv->grab_keyboard || !priv->absolute) && +- key->type == GDK_KEY_PRESS && +- ((keyval == GDK_Control_L && (key->state & GDK_MOD1_MASK)) || +- (keyval == GDK_Alt_L && (key->state & GDK_CONTROL_MASK)))) { +- if (priv->in_pointer_grab) +- do_pointer_ungrab(VNC_DISPLAY(widget), FALSE); +- else +- do_pointer_grab(VNC_DISPLAY(widget), FALSE); +- } +- +- return TRUE; +-} +- +-static gboolean enter_event(GtkWidget *widget, GdkEventCrossing *crossing) +-{ +- VncDisplayPrivate *priv = VNC_DISPLAY(widget)->priv; +- +- if (priv->gvnc == NULL || !gvnc_is_initialized(priv->gvnc)) +- return FALSE; +- +- if (crossing->mode != GDK_CROSSING_NORMAL) +- return FALSE; +- +- if (priv->grab_keyboard) +- do_keyboard_grab(VNC_DISPLAY(widget), FALSE); +- +- return TRUE; +-} +- +-static gboolean leave_event(GtkWidget *widget, GdkEventCrossing *crossing) +-{ +- VncDisplayPrivate *priv = VNC_DISPLAY(widget)->priv; +- +- if (priv->gvnc == NULL || !gvnc_is_initialized(priv->gvnc)) +- return FALSE; +- +- if (crossing->mode != GDK_CROSSING_NORMAL) +- return FALSE; +- +- if (priv->grab_keyboard) +- do_keyboard_ungrab(VNC_DISPLAY(widget), FALSE); +- +- if (priv->grab_pointer) +- do_pointer_ungrab(VNC_DISPLAY(widget), FALSE); +- +- return TRUE; +-} +- +- +-static gboolean focus_event(GtkWidget *widget, GdkEventFocus *focus G_GNUC_UNUSED) +-{ +- VncDisplayPrivate *priv = VNC_DISPLAY(widget)->priv; +- int i; +- +- if (priv->gvnc == NULL || !gvnc_is_initialized(priv->gvnc)) +- return FALSE; +- +- for (i = 0 ; i < (int)(sizeof(priv->down_keyval)/sizeof(priv->down_keyval[0])) ; i++) { +- /* We are currently pressed so... */ +- if (priv->down_scancode[i] != 0) { +- /* ..send the fake key release event to match */ +- gvnc_key_event(priv->gvnc, 0, +- priv->down_keyval[i], priv->down_scancode[i]); +- priv->down_keyval[i] = 0; +- priv->down_scancode[i] = 0; +- } +- } +- +- return TRUE; +-} +- +-#if WITH_GTKGLEXT +-static void realize_event(GtkWidget *widget) +-{ +- VncDisplayPrivate *priv = VNC_DISPLAY(widget)->priv; +- +- GTK_WIDGET_CLASS (vnc_display_parent_class)->realize(widget); +- +- if (priv->gl_config == NULL) +- return; +- +- priv->gl_drawable = gtk_widget_get_gl_drawable(widget); +- priv->gl_context = gtk_widget_get_gl_context(widget); +-} +-#endif +- +-static gboolean on_update(void *opaque, int x, int y, int w, int h) +-{ +- GtkWidget *widget = GTK_WIDGET(opaque); +- VncDisplay *obj = VNC_DISPLAY(widget); +- VncDisplayPrivate *priv = obj->priv; +- +-#if WITH_GTKGLEXT +- if (priv->gl_enabled) { +- double scale_x, scale_y; +- +- scale_x = (double)priv->gl_width / priv->fb.width; +- scale_y = (double)priv->gl_height / priv->fb.height; +- +- x *= scale_x; +- y *= scale_y; +- w *= scale_x; +- h *= scale_y; +- } else +-#endif +- { +- int ww, wh; +- int mw = 0, mh = 0; +- +- gdk_drawable_get_size(widget->window, &ww, &wh); +- if (ww > priv->fb.width) +- mw = (ww - priv->fb.width) / 2; +- if (wh > priv->fb.height) +- mh = (wh - priv->fb.height) / 2; +- +- x += mw; +- y += mh; +- } +- +- gtk_widget_queue_draw_area(widget, x, y, w, h); +- +- return TRUE; +-} +- +-static void setup_gdk_image(VncDisplay *obj, gint width, gint height) +-{ +- VncDisplayPrivate *priv = obj->priv; +- GdkVisual *visual; +- +- visual = gdk_drawable_get_visual(GTK_WIDGET(obj)->window); +- +- priv->image = gdk_image_new(GDK_IMAGE_FASTEST, visual, width, height); +- GVNC_DEBUG("Visual mask: %3d %3d %3d\n shift: %3d %3d %3d\n", +- visual->red_mask, +- visual->green_mask, +- visual->blue_mask, +- visual->red_shift, +- visual->green_shift, +- visual->blue_shift); +- +- priv->fb.red_mask = visual->red_mask >> visual->red_shift; +- priv->fb.green_mask = visual->green_mask >> visual->green_shift; +- priv->fb.blue_mask = visual->blue_mask >> visual->blue_shift; +- priv->fb.red_shift = visual->red_shift; +- priv->fb.green_shift = visual->green_shift; +- priv->fb.blue_shift = visual->blue_shift; +- priv->fb.depth = priv->image->depth; +- priv->fb.bpp = priv->image->bpp; +- priv->fb.width = priv->image->width; +- priv->fb.height = priv->image->height; +- priv->fb.linesize = priv->image->bpl; +- priv->fb.data = (uint8_t *)priv->image->mem; +- priv->fb.byte_order = priv->image->byte_order == GDK_LSB_FIRST ? G_LITTLE_ENDIAN : G_BIG_ENDIAN; +- +- if (priv->force_size) +- gtk_widget_set_size_request(GTK_WIDGET(obj), width, height); +-} +- +-#if WITH_GTKGLEXT +-static int pow_of_2(int value) +-{ +- int i; +- for (i = 0; value >= (1 << i); i++); +- return (1 << i); +-} +- +-static void setup_gl_image(VncDisplay *obj, gint width, gint height) +-{ +- VncDisplayPrivate *priv = VNC_DISPLAY(obj)->priv; +- void *dummy; +- +- priv->gl_texture_width = pow_of_2(width); +- priv->gl_texture_height = pow_of_2(height); +- +- gdk_gl_drawable_gl_begin(priv->gl_drawable, priv->gl_context); +- +- glGenTextures(1, &priv->gl_tex); +- glBindTexture(GL_TEXTURE_2D, priv->gl_tex); +- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); +- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); +- +- dummy = g_malloc(priv->gl_texture_width*priv->gl_texture_height*4); +- memset(dummy, 0, priv->gl_texture_width*priv->gl_texture_height*4); +- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, +- priv->gl_texture_width, priv->gl_texture_height, 0, +- GL_RGB, GL_UNSIGNED_BYTE, +- dummy); +- g_free(dummy); +- +- gdk_gl_drawable_gl_end(priv->gl_drawable); +- +- priv->gl_tex_data = g_malloc(width * height * 4); +- +- priv->fb.red_mask = 0xFF; +- priv->fb.green_mask = 0xFF; +- priv->fb.blue_mask = 0xFF; +- priv->fb.red_shift = 16; +- priv->fb.green_shift = 8; +- priv->fb.blue_shift = 0; +- priv->fb.depth = 32; +- priv->fb.bpp = 4; +- priv->fb.width = width; +- priv->fb.height = height; +- priv->fb.linesize = priv->fb.width * priv->fb.bpp; +- priv->fb.data = (uint8_t *)priv->gl_tex_data; +-} +-#endif +- +-static gboolean emit_signal_auth_cred(gpointer opaque) +-{ +- struct signal_data *s = opaque; +- +- switch (s->signum) { +- case VNC_AUTH_CREDENTIAL: +- g_signal_emit(G_OBJECT(s->obj), +- signals[VNC_AUTH_CREDENTIAL], +- 0, +- s->cred_list); +- break; +- case VNC_DESKTOP_RESIZE: +- g_signal_emit(G_OBJECT(s->obj), +- signals[VNC_DESKTOP_RESIZE], +- 0, +- s->width, s->height); +- break; +- case VNC_AUTH_FAILURE: +- g_signal_emit(G_OBJECT(s->obj), +- signals[VNC_AUTH_FAILURE], +- 0, +- s->msg); +- break; +- case VNC_AUTH_UNSUPPORTED: +- g_signal_emit(G_OBJECT(s->obj), +- signals[VNC_AUTH_UNSUPPORTED], +- 0, +- s->auth_type); +- break; +- case VNC_SERVER_CUT_TEXT: +- g_signal_emit(G_OBJECT(s->obj), +- signals[VNC_SERVER_CUT_TEXT], +- 0, +- s->str->str); +- break; +- case VNC_BELL: +- case VNC_CONNECTED: +- case VNC_INITIALIZED: +- case VNC_DISCONNECTED: +- g_signal_emit(G_OBJECT(s->obj), +- signals[s->signum], +- 0); +- break; +- } +- +- coroutine_yieldto(s->caller, NULL); +- +- return FALSE; +-} +- +-/* This function should be used to emit signals from gvnc callbacks */ +-static void emit_signal_delayed(VncDisplay *obj, int signum, +- struct signal_data *data) +-{ +- data->obj = obj; +- data->caller = coroutine_self(); +- data->signum = signum; +- g_idle_add(emit_signal_auth_cred, data); +- coroutine_yield(NULL); +-} +- +-static gboolean do_resize(void *opaque, int width, int height, gboolean quiet) +-{ +- VncDisplay *obj = VNC_DISPLAY(opaque); +- VncDisplayPrivate *priv = obj->priv; +- struct signal_data s; +- +- if (priv->gvnc == NULL || !gvnc_is_initialized(priv->gvnc)) +- return TRUE; +- +- if (priv->image) { +- g_object_unref(priv->image); +- priv->image = NULL; +- } +- +-#if WITH_GTKGLEXT +- if (priv->gl_tex_data) { +- gdk_gl_drawable_gl_begin(priv->gl_drawable, +- priv->gl_context); +- glDeleteTextures(1, &priv->gl_tex); +- gdk_gl_drawable_gl_end(priv->gl_drawable); +- g_free(priv->gl_tex_data); +- priv->gl_tex_data = NULL; +- } +-#endif +- +- if (priv->gc == NULL) { +- priv->null_cursor = create_null_cursor(); +- if (priv->local_pointer) +- do_pointer_show(obj); +- else if (priv->in_pointer_grab || priv->absolute) +- do_pointer_hide(obj); +- priv->gc = gdk_gc_new(GTK_WIDGET(obj)->window); +- } +- +-#if WITH_GTKGLEXT +- if (priv->gl_enabled) +- setup_gl_image(obj, width, height); +- else +-#endif +- setup_gdk_image(obj, width, height); +- +- gvnc_set_local(priv->gvnc, &priv->fb); +- +- if (!quiet) { +- s.width = width; +- s.height = height; +- emit_signal_delayed(obj, VNC_DESKTOP_RESIZE, &s); +- } +- +- return TRUE; +-} +- +-static gboolean on_resize(void *opaque, int width, int height) +-{ +- return do_resize(opaque, width, height, FALSE); +-} +- +-static gboolean on_pixel_format(void *opaque, +- struct gvnc_pixel_format *fmt G_GNUC_UNUSED) +-{ +- VncDisplay *obj = VNC_DISPLAY(opaque); +- VncDisplayPrivate *priv = obj->priv; +- +- return do_resize(opaque, priv->fb.width, priv->fb.height, TRUE); +-} +- +-static gboolean on_get_preferred_pixel_format(void *opaque, +- struct gvnc_pixel_format *fmt) +-{ +- VncDisplay *obj = VNC_DISPLAY(opaque); +- GdkVisual *v = gdk_drawable_get_visual(GTK_WIDGET(obj)->window); +- +- GVNC_DEBUG("Setting pixel format to true color\n"); +- +- fmt->true_color_flag = 1; +- fmt->depth = v->depth; +- fmt->bits_per_pixel = v->depth > 16 ? 32 : v->depth; +- fmt->red_max = v->red_mask >> v->red_shift; +- fmt->green_max = v->green_mask >> v->green_shift; +- fmt->blue_max = v->blue_mask >> v->blue_shift; +- fmt->red_shift = v->red_shift; +- fmt->green_shift = v->green_shift; +- fmt->blue_shift = v->blue_shift; +- fmt->byte_order = v->byte_order == GDK_LSB_FIRST ? G_BIG_ENDIAN : G_LITTLE_ENDIAN; +- +- return TRUE; +-} +- +-#if WITH_GTKGLEXT +-static void build_gl_image_from_gdk(uint32_t *data, GdkImage *image) +-{ +- GdkVisual *visual; +- int i, j; +- uint8_t *row; +- +- visual = image->visual; +- row = image->mem; +- for (j = 0; j < image->height; j++) { +- uint8_t *src = row; +- for (i = 0; i < image->width; i++) { +- uint32_t pixel = 0; +- switch (image->bpp) { +- case 1: +- pixel = *(uint8_t *)src; +- break; +- case 2: +- pixel = *(uint16_t *)src; +- break; +- case 4: +- pixel = *(uint32_t *)src; +- break; +- } +- *data = ((pixel & visual->red_mask) >> visual->red_shift) << (24 - visual->red_prec) | +- ((pixel & visual->green_mask) >> visual->green_shift) << (16 - visual->green_prec) | +- ((pixel & visual->blue_mask) >> visual->blue_shift) << (8 - visual->blue_prec); +- src += image->bpp; +- data++; +- } +- row += image->bpl; +- +- } +-} +- +-static void build_gdk_image_from_gl(GdkImage *image, uint32_t *data) +-{ +- GdkVisual *visual; +- int i, j; +- uint8_t *row; +- +- visual = image->visual; +- row = image->mem; +- for (j = 0; j < image->height; j++) { +- uint8_t *dst = row; +- for (i = 0; i < image->width; i++) { +- uint32_t pixel; +- +- pixel = (((*data >> (24 - visual->red_prec)) << visual->red_shift) & visual->red_mask) | +- (((*data >> (16 - visual->green_prec)) << visual->green_shift) & visual->green_mask) | +- (((*data >> (8 - visual->blue_prec)) << visual->blue_shift) & visual->blue_mask); +- +- switch (image->bpp) { +- case 1: +- *(uint8_t *)dst = pixel; +- break; +- case 2: +- *(uint16_t *)dst = pixel; +- break; +- case 4: +- *(uint32_t *)dst = pixel; +- break; +- } +- dst += image->bpp; +- data++; +- } +- row += image->bpl; +- } +-} +- +-static void scale_display(VncDisplay *obj, gint width, gint height) +-{ +- VncDisplayPrivate *priv = VNC_DISPLAY(obj)->priv; +- +- if (priv->gl_drawable == NULL) +- return; +- +- if (priv->gl_enabled == 0) { +- GdkImage *image; +- +- priv->gl_enabled = 1; +- +- image = priv->image; +- priv->image = NULL; +- +- do_resize(obj, priv->fb.width, priv->fb.height, TRUE); +- build_gl_image_from_gdk((uint32_t *)priv->fb.data, image); +- +- g_object_unref(image); +- } +- +- priv->gl_width = width; +- priv->gl_height = height; +- +- gdk_gl_drawable_gl_begin(priv->gl_drawable, priv->gl_context); +- glClearColor (0.0, 0.0, 0.0, 0.0); +- glShadeModel(GL_FLAT); +- glPixelStorei(GL_UNPACK_ALIGNMENT, 1); +- +- glViewport(0, 0, priv->gl_width, priv->gl_height); +- glMatrixMode(GL_PROJECTION); +- glLoadIdentity(); +- glOrtho(0.0, priv->gl_width, 0.0, priv->gl_height, -1, 1); +- glMatrixMode(GL_MODELVIEW); +- glLoadIdentity(); +- gdk_gl_drawable_gl_end(priv->gl_drawable); +-} +- +-static void rescale_display(VncDisplay *obj, gint width, gint height) +-{ +- VncDisplayPrivate *priv = obj->priv; +- +- if (priv->allow_scaling && +- (priv->fb.width != width || +- priv->fb.height != height)) +- scale_display(obj, width, height); +- else if (priv->gl_enabled) { +- void *data; +- priv->gl_enabled = 0; +- +- data = priv->gl_tex_data; +- priv->gl_tex_data = NULL; +- +- do_resize(GTK_WIDGET(obj), priv->fb.width, priv->fb.height, TRUE); +- +- build_gdk_image_from_gl(priv->image, (uint32_t *)data); +- gdk_gl_drawable_gl_begin(priv->gl_drawable, +- priv->gl_context); +- glDeleteTextures(1, &priv->gl_tex); +- gdk_gl_drawable_gl_end(priv->gl_drawable); +- g_free(data); +- } +-} +- +-static gboolean configure_event(GtkWidget *widget, GdkEventConfigure *configure) +-{ +- VncDisplay *obj = VNC_DISPLAY(widget); +- VncDisplayPrivate *priv = obj->priv; +- +- if (priv->fb.data == NULL) +- return FALSE; +- +- rescale_display(VNC_DISPLAY(widget), +- configure->width, configure->height); +- +- return FALSE; +-} +-#endif +- +-static gboolean on_pointer_type_change(void *opaque, int absolute) +-{ +- VncDisplay *obj = VNC_DISPLAY(opaque); +- VncDisplayPrivate *priv = obj->priv; +- +- if (absolute && priv->in_pointer_grab && !priv->grab_pointer) +- do_pointer_ungrab(obj, FALSE); +- +- priv->absolute = absolute; +- +- if (!priv->in_pointer_grab && !priv->absolute) +- do_pointer_show(obj); +- +- return TRUE; +-} +- +-static gboolean on_auth_cred(void *opaque) +-{ +- VncDisplay *obj = VNC_DISPLAY(opaque); +- GValueArray *cred_list; +- GValue username, password, clientname; +- struct signal_data s; +- +- memset(&username, 0, sizeof(username)); +- memset(&password, 0, sizeof(password)); +- memset(&clientname, 0, sizeof(clientname)); +- +- cred_list = g_value_array_new(0); +- if (gvnc_wants_credential_username(obj->priv->gvnc)) { +- g_value_init(&username, G_PARAM_SPEC_VALUE_TYPE(signalCredParam)); +- g_value_set_enum(&username, VNC_DISPLAY_CREDENTIAL_USERNAME); +- cred_list = g_value_array_append(cred_list, &username); +- } +- if (gvnc_wants_credential_password(obj->priv->gvnc)) { +- g_value_init(&password, G_PARAM_SPEC_VALUE_TYPE(signalCredParam)); +- g_value_set_enum(&password, VNC_DISPLAY_CREDENTIAL_PASSWORD); +- cred_list = g_value_array_append(cred_list, &password); +- } +- if (gvnc_wants_credential_x509(obj->priv->gvnc)) { +- g_value_init(&clientname, G_PARAM_SPEC_VALUE_TYPE(signalCredParam)); +- g_value_set_enum(&clientname, VNC_DISPLAY_CREDENTIAL_CLIENTNAME); +- cred_list = g_value_array_append(cred_list, &clientname); +- } +- +- s.cred_list = cred_list; +- emit_signal_delayed(obj, VNC_AUTH_CREDENTIAL, &s); +- +- g_value_array_free(cred_list); +- +- return TRUE; +-} +- +-static gboolean on_auth_type(void *opaque, unsigned int ntype, unsigned int *types) +-{ +- VncDisplay *obj = VNC_DISPLAY(opaque); +- VncDisplayPrivate *priv = obj->priv; +- GSList *l; +- guint i; +- +- if (!ntype) +- return TRUE; +- +- for (l = priv->preferable_auths; l; l=l->next) { +- gvnc_auth pref = GPOINTER_TO_UINT (l->data); +- +- for (i=0; igvnc, types[i]); +- return TRUE; +- } +- } +- } +- +- gvnc_set_auth_type(priv->gvnc, types[0]); +- return TRUE; +-} +- +-static gboolean on_auth_subtype(void *opaque, unsigned int ntype, unsigned int *types) +-{ +- VncDisplay *obj = VNC_DISPLAY(opaque); +- VncDisplayPrivate *priv = obj->priv; +- +- GSList *l; +- guint i; +- +- if (!ntype) +- return TRUE; +- +- for (l = priv->preferable_auths; l; l=l->next) { +- gvnc_auth pref = GPOINTER_TO_UINT (l->data); +- +- for (i=0; igvnc, types[i]); +- return TRUE; +- } +- } +- } +- +- gvnc_set_auth_subtype(priv->gvnc, types[0]); +- return TRUE; +-} +- +-static gboolean on_auth_failure(void *opaque, const char *msg) +-{ +- VncDisplay *obj = VNC_DISPLAY(opaque); +- struct signal_data s; +- +- s.msg = msg; +- emit_signal_delayed(obj, VNC_AUTH_FAILURE, &s); +- +- return TRUE; +-} +- +-static gboolean on_auth_unsupported(void *opaque, unsigned int auth_type) +-{ +- VncDisplay *obj = VNC_DISPLAY(opaque); +- struct signal_data s; +- +- s.auth_type = auth_type; +- emit_signal_delayed(obj, VNC_AUTH_UNSUPPORTED, &s); +- +- return TRUE; +-} +- +-static gboolean on_server_cut_text(void *opaque, const void* text, size_t len) +-{ +- VncDisplay *obj = VNC_DISPLAY(opaque); +- GString *str = g_string_new_len ((const gchar *)text, len); +- struct signal_data s; +- +- s.str = str; +- emit_signal_delayed(obj, VNC_SERVER_CUT_TEXT, &s); +- +- g_string_free (str, TRUE); +- return TRUE; +-} +- +-static gboolean on_bell(void *opaque) +-{ +- VncDisplay *obj = VNC_DISPLAY(opaque); +- struct signal_data s; +- +- emit_signal_delayed(obj, VNC_BELL, &s); +- +- return TRUE; +-} +- +-static gboolean on_local_cursor(void *opaque, int x, int y, int width, int height, uint8_t *image) +-{ +- VncDisplay *obj = VNC_DISPLAY(opaque); +- VncDisplayPrivate *priv = obj->priv; +- +- if (priv->remote_cursor) { +- gdk_cursor_unref(priv->remote_cursor); +- priv->remote_cursor = NULL; +- } +- +- if (width && height) { +- GdkDisplay *display = gdk_drawable_get_display(GDK_DRAWABLE(GTK_WIDGET(obj)->window)); +- GdkPixbuf *pixbuf = gdk_pixbuf_new_from_data(image, GDK_COLORSPACE_RGB, +- TRUE, 8, width, height, +- width * 4, NULL, NULL); +- priv->remote_cursor = gdk_cursor_new_from_pixbuf(display, +- pixbuf, +- x, y); +- gdk_pixbuf_unref(pixbuf); +- } +- +- if (priv->in_pointer_grab) { +- do_pointer_ungrab(obj, TRUE); +- do_pointer_grab(obj, TRUE); +- } else if (priv->absolute) { +- do_pointer_hide(obj); +- } +- +- return TRUE; +-} +- +-static gboolean check_pixbuf_support(const char *name) +-{ +- GSList *list, *i; +- +- list = gdk_pixbuf_get_formats(); +- +- for (i = list; i; i = i->next) { +- GdkPixbufFormat *fmt = i->data; +- if (!strcmp(gdk_pixbuf_format_get_name(fmt), name)) +- break; +- } +- +- g_slist_free(list); +- +- return !!(i); +-} +- +-static gboolean on_render_jpeg(void *opaque G_GNUC_UNUSED, +- rgb24_render_func *render, void *render_opaque, +- int x, int y, int w, int h, +- uint8_t *data, int size) +-{ +- GdkPixbufLoader *loader = gdk_pixbuf_loader_new(); +- GdkPixbuf *p; +- uint8_t *pixels; +- +- if (!gdk_pixbuf_loader_write(loader, data, size, NULL)) +- return FALSE; +- +- gdk_pixbuf_loader_close(loader, NULL); +- +- p = g_object_ref(gdk_pixbuf_loader_get_pixbuf(loader)); +- g_object_unref(loader); +- +- pixels = gdk_pixbuf_get_pixels(p); +- +- render(render_opaque, x, y, w, h, +- gdk_pixbuf_get_pixels(p), +- gdk_pixbuf_get_rowstride(p)); +- +- gdk_pixbuf_unref(p); +- +- return TRUE; +-} +- +-static const struct gvnc_ops vnc_display_ops = { +- .auth_cred = on_auth_cred, +- .auth_type = on_auth_type, +- .auth_subtype = on_auth_subtype, +- .auth_failure = on_auth_failure, +- .update = on_update, +- .resize = on_resize, +- .pixel_format = on_pixel_format, +- .pointer_type_change = on_pointer_type_change, +- .local_cursor = on_local_cursor, +- .auth_unsupported = on_auth_unsupported, +- .server_cut_text = on_server_cut_text, +- .bell = on_bell, +- .render_jpeg = on_render_jpeg, +- .get_preferred_pixel_format = on_get_preferred_pixel_format +-}; +- +-/* we use an idle function to allow the coroutine to exit before we actually +- * unref the object since the coroutine's state is part of the object */ +-static gboolean delayed_unref_object(gpointer data) +-{ +- VncDisplay *obj = VNC_DISPLAY(data); +- +- g_assert(obj->priv->coroutine.exited == TRUE); +- +- if (obj->priv->image) { +- g_object_unref(obj->priv->image); +- obj->priv->image = NULL; +- } +- +-#if WITH_GTKGLEXT +- if (obj->priv->gl_tex_data) +- g_free(obj->priv->gl_tex_data); +- obj->priv->gl_tex_data = NULL; +- obj->priv->gl_enabled = 0; +-#endif +- +- g_object_unref(G_OBJECT(data)); +- return FALSE; +-} +- +-static void *vnc_coroutine(void *opaque) +-{ +- VncDisplay *obj = VNC_DISPLAY(opaque); +- VncDisplayPrivate *priv = obj->priv; +- +- /* this order is extremely important! */ +- int32_t encodings[] = { GVNC_ENCODING_TIGHT_JPEG5, +- GVNC_ENCODING_TIGHT, +- GVNC_ENCODING_EXT_KEY_EVENT, +- GVNC_ENCODING_DESKTOP_RESIZE, +- GVNC_ENCODING_WMVi, +- GVNC_ENCODING_RICH_CURSOR, +- GVNC_ENCODING_XCURSOR, +- GVNC_ENCODING_POINTER_CHANGE, +- GVNC_ENCODING_ZRLE, +- GVNC_ENCODING_HEXTILE, +- GVNC_ENCODING_RRE, +- GVNC_ENCODING_COPY_RECT, +- GVNC_ENCODING_RAW }; +- int32_t *encodingsp; +- int n_encodings; +- int ret; +- struct signal_data s; +- +- if (priv->gvnc == NULL || gvnc_is_open(priv->gvnc)) { +- g_idle_add(delayed_unref_object, obj); +- return NULL; +- } +- +- GVNC_DEBUG("Started background coroutine\n"); +- x_keymap_set_keymap_entries(); +- +- if (priv->fd != -1) { +- if (!gvnc_open_fd(priv->gvnc, priv->fd)) +- goto cleanup; +- } else { +- if (!gvnc_open_host(priv->gvnc, priv->host, priv->port)) +- goto cleanup; +- } +- +- emit_signal_delayed(obj, VNC_CONNECTED, &s); +- +- GVNC_DEBUG("Protocol initialization\n"); +- if (!gvnc_initialize(priv->gvnc, priv->shared_flag)) +- goto cleanup; +- +- emit_signal_delayed(obj, VNC_INITIALIZED, &s); +- +- encodingsp = encodings; +- n_encodings = G_N_ELEMENTS(encodings); +- +- if (check_pixbuf_support("jpeg")) { +- if (!priv->allow_lossy) { +- encodingsp++; +- n_encodings--; +- } +- } else { +- encodingsp += 2; +- n_encodings -= 2; +- } +- +- if (!gvnc_set_encodings(priv->gvnc, n_encodings, encodingsp)) +- goto cleanup; +- +- if (!gvnc_framebuffer_update_request(priv->gvnc, 0, 0, 0, priv->fb.width, priv->fb.height)) +- goto cleanup; +- +- GVNC_DEBUG("Running main loop\n"); +- while ((ret = gvnc_server_message(priv->gvnc))) { +- if (!gvnc_framebuffer_update_request(priv->gvnc, 1, 0, 0, +- priv->fb.width, priv->fb.height)) +- goto cleanup; +- } +- +- cleanup: +- GVNC_DEBUG("Doing final VNC cleanup\n"); +- gvnc_close(priv->gvnc); +- emit_signal_delayed(obj, VNC_DISCONNECTED, &s); +- g_idle_add(delayed_unref_object, obj); +- x_keymap_free_keymap_entries(); +- /* Co-routine exits now - the VncDisplay object may no longer exist, +- so don't do anything else now unless you like SEGVs */ +- return NULL; +-} +- +-static gboolean do_vnc_display_open(gpointer data) +-{ +- VncDisplay *obj = VNC_DISPLAY(data); +- struct coroutine *co; +- +- if (obj->priv->gvnc == NULL || gvnc_is_open(obj->priv->gvnc)) { +- g_object_unref(G_OBJECT(obj)); +- return FALSE; +- } +- +- obj->priv->open_id = 0; +- +- co = &obj->priv->coroutine; +- +- co->stack_size = 16 << 20; +- co->entry = vnc_coroutine; +- co->release = NULL; +- +- coroutine_init(co); +- coroutine_yieldto(co, obj); +- +- return FALSE; +-} +- +-gboolean vnc_display_open_fd(VncDisplay *obj, int fd) +-{ +- if (obj->priv->gvnc == NULL || gvnc_is_open(obj->priv->gvnc)) +- return FALSE; +- +- obj->priv->fd = fd; +- obj->priv->host = NULL; +- obj->priv->port = NULL; +- +- g_object_ref(G_OBJECT(obj)); /* Unref'd when co-routine exits */ +- obj->priv->open_id = g_idle_add(do_vnc_display_open, obj); +- +- return TRUE; +-} +- +-gboolean vnc_display_open_host(VncDisplay *obj, const char *host, const char *port) +-{ +- if (obj->priv->gvnc == NULL || gvnc_is_open(obj->priv->gvnc)) +- return FALSE; +- +- obj->priv->host = g_strdup(host); +- if (!obj->priv->host) { +- return FALSE; +- } +- obj->priv->port = g_strdup(port); +- if (!obj->priv->port) { +- g_free(obj->priv->host); +- obj->priv->host = NULL; +- return FALSE; +- } +- +- g_object_ref(G_OBJECT(obj)); /* Unref'd when co-routine exits */ +- obj->priv->open_id = g_idle_add(do_vnc_display_open, obj); +- return TRUE; +-} +- +-gboolean vnc_display_is_open(VncDisplay *obj) +-{ +- if (obj->priv->gvnc == NULL) +- return FALSE; +- return gvnc_is_open(obj->priv->gvnc); +-} +- +-void vnc_display_close(VncDisplay *obj) +-{ +- VncDisplayPrivate *priv = obj->priv; +- GtkWidget *widget = GTK_WIDGET(obj); +- +- if (priv->open_id) { +- g_source_remove(priv->open_id); +- obj->priv->open_id = 0; +- } +- +- if (priv->gvnc == NULL) +- return; +- +- if (gvnc_is_open(priv->gvnc)) { +- GVNC_DEBUG("Requesting graceful shutdown of connection\n"); +- gvnc_shutdown(priv->gvnc); +- } +- +-#if WITH_GTKGLEXT +- if (priv->gl_tex_data) { +- gdk_gl_drawable_gl_begin(priv->gl_drawable, +- priv->gl_context); +- glDeleteTextures(1, &priv->gl_tex); +- gdk_gl_drawable_gl_end(priv->gl_drawable); +- } +-#endif +- +- if (widget->window) { +- gint width, height; +- +- gdk_drawable_get_size(widget->window, &width, &height); +- gtk_widget_queue_draw_area(widget, 0, 0, width, height); +- } +-} +- +- +-void vnc_display_send_keys(VncDisplay *obj, const guint *keyvals, int nkeyvals) +-{ +- vnc_display_send_keys_ex(obj, keyvals, +- nkeyvals, VNC_DISPLAY_KEY_EVENT_CLICK); +-} +- +-static guint get_keycode_from_keyval(guint keyval) +-{ +- guint keycode = 0; +- GdkKeymapKey *keys = NULL; +- gint n_keys = 0; +- +- if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(), +- keyval, &keys, &n_keys)) { +- /* FIXME what about levels? */ +- keycode = keys[0].keycode; +- g_free(keys); +- } +- +- return keycode; +-} +- +-void vnc_display_send_keys_ex(VncDisplay *obj, const guint *keyvals, +- int nkeyvals, VncDisplayKeyEvent kind) +-{ +- int i; +- +- if (obj->priv->gvnc == NULL || !gvnc_is_open(obj->priv->gvnc)) +- return; +- +- if (kind & VNC_DISPLAY_KEY_EVENT_PRESS) { +- for (i = 0 ; i < nkeyvals ; i++) +- gvnc_key_event(obj->priv->gvnc, 1, keyvals[i], +- get_keycode_from_keyval(keyvals[i])); +- } +- +- if (kind & VNC_DISPLAY_KEY_EVENT_RELEASE) { +- for (i = (nkeyvals-1) ; i >= 0 ; i--) +- gvnc_key_event(obj->priv->gvnc, 0, keyvals[i], +- get_keycode_from_keyval(keyvals[i])); +- } +-} +- +-void vnc_display_send_pointer(VncDisplay *obj, gint x, gint y, int button_mask) +-{ +- VncDisplayPrivate *priv = obj->priv; +- +- if (priv->gvnc == NULL || !gvnc_is_open(obj->priv->gvnc)) +- return; +- +- if (priv->absolute) { +- priv->button_mask = button_mask; +- priv->last_x = x; +- priv->last_y = y; +- gvnc_pointer_event(priv->gvnc, priv->button_mask, x, y); +- } +-} +- +-static void vnc_display_destroy (GtkObject *obj) +-{ +- VncDisplay *display = VNC_DISPLAY (obj); +- GVNC_DEBUG("Requesting that VNC close\n"); +- vnc_display_close(display); +- GTK_OBJECT_CLASS (vnc_display_parent_class)->destroy (obj); +-} +- +- +-static void vnc_display_finalize (GObject *obj) +-{ +- VncDisplay *display = VNC_DISPLAY (obj); +- VncDisplayPrivate *priv = display->priv; +- +- GVNC_DEBUG("Releasing VNC widget\n"); +- if (gvnc_is_open(priv->gvnc)) { +- g_warning("VNC widget finalized before the connection finished shutting down\n"); +- } +- gvnc_free(priv->gvnc); +- display->priv->gvnc = NULL; +- +-#if WITH_GTKGLEXT +- if (priv->gl_enabled) { +- gdk_gl_drawable_gl_begin(priv->gl_drawable, +- priv->gl_context); +- glDeleteTextures(1, &priv->gl_tex); +- gdk_gl_drawable_gl_end(priv->gl_drawable); +- if (priv->gl_tex_data) { +- g_free(priv->gl_tex_data); +- priv->gl_tex_data = NULL; +- } +- } +- +- if (priv->gl_config) { +- g_object_unref(G_OBJECT(priv->gl_config)); +- priv->gl_config = NULL; +- } +-#endif +- +- if (priv->image) { +- g_object_unref(priv->image); +- priv->image = NULL; +- } +- +- g_slist_free (priv->preferable_auths); +- +- G_OBJECT_CLASS (vnc_display_parent_class)->finalize (obj); +-} +- +-static void vnc_display_class_init(VncDisplayClass *klass) +-{ +- GObjectClass *object_class = G_OBJECT_CLASS (klass); +- GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass); +- GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass); +- +- gtkwidget_class->expose_event = expose_event; +- gtkwidget_class->motion_notify_event = motion_event; +- gtkwidget_class->button_press_event = button_event; +- gtkwidget_class->button_release_event = button_event; +- gtkwidget_class->scroll_event = scroll_event; +- gtkwidget_class->key_press_event = key_event; +- gtkwidget_class->key_release_event = key_event; +- gtkwidget_class->enter_notify_event = enter_event; +- gtkwidget_class->leave_notify_event = leave_event; +- gtkwidget_class->focus_out_event = focus_event; +-#if WITH_GTKGLEXT +- gtkwidget_class->realize = realize_event; +- gtkwidget_class->configure_event = configure_event; +-#endif +- +- +- object_class->finalize = vnc_display_finalize; +- object_class->get_property = vnc_display_get_property; +- object_class->set_property = vnc_display_set_property; +- +- gtkobject_class->destroy = vnc_display_destroy; +- +- g_object_class_install_property (object_class, +- PROP_POINTER_LOCAL, +- g_param_spec_boolean ( "local-pointer", +- "Local Pointer", +- "Whether we should use the local pointer", +- FALSE, +- G_PARAM_READWRITE | +- G_PARAM_CONSTRUCT | +- G_PARAM_STATIC_NAME | +- G_PARAM_STATIC_NICK | +- G_PARAM_STATIC_BLURB)); +- g_object_class_install_property (object_class, +- PROP_POINTER_GRAB, +- g_param_spec_boolean ( "grab-pointer", +- "Grab Pointer", +- "Whether we should grab the pointer", +- FALSE, +- G_PARAM_READWRITE | +- G_PARAM_CONSTRUCT | +- G_PARAM_STATIC_NAME | +- G_PARAM_STATIC_NICK | +- G_PARAM_STATIC_BLURB)); +- g_object_class_install_property (object_class, +- PROP_KEYBOARD_GRAB, +- g_param_spec_boolean ( "grab-keyboard", +- "Grab Keyboard", +- "Whether we should grab the keyboard", +- FALSE, +- G_PARAM_READWRITE | +- G_PARAM_CONSTRUCT | +- G_PARAM_STATIC_NAME | +- G_PARAM_STATIC_NICK | +- G_PARAM_STATIC_BLURB)); +- g_object_class_install_property (object_class, +- PROP_READ_ONLY, +- g_param_spec_boolean ( "read-only", +- "Read Only", +- "Whether this connection is read-only mode", +- FALSE, +- G_PARAM_READWRITE | +- G_PARAM_CONSTRUCT | +- G_PARAM_STATIC_NAME | +- G_PARAM_STATIC_NICK | +- G_PARAM_STATIC_BLURB)); +- g_object_class_install_property (object_class, +- PROP_WIDTH, +- g_param_spec_int ( "width", +- "Width", +- "The width of the remote screen", +- 0, +- G_MAXINT, +- 0, +- G_PARAM_READABLE | +- G_PARAM_STATIC_NAME | +- G_PARAM_STATIC_NICK | +- G_PARAM_STATIC_BLURB)); +- g_object_class_install_property (object_class, +- PROP_HEIGHT, +- g_param_spec_int ( "height", +- "Height", +- "The height of the remote screen", +- 0, +- G_MAXINT, +- 0, +- G_PARAM_READABLE | +- G_PARAM_STATIC_NAME | +- G_PARAM_STATIC_NICK | +- G_PARAM_STATIC_BLURB)); +- g_object_class_install_property (object_class, +- PROP_NAME, +- g_param_spec_string ( "name", +- "Name", +- "The screen name of the remote connection", +- NULL, +- G_PARAM_READABLE | +- G_PARAM_STATIC_NAME | +- G_PARAM_STATIC_NICK | +- G_PARAM_STATIC_BLURB)); +- g_object_class_install_property (object_class, +- PROP_LOSSY_ENCODING, +- g_param_spec_boolean ( "lossy-encoding", +- "Lossy Encoding", +- "Whether we should use a lossy encoding", +- FALSE, +- G_PARAM_READWRITE | +- G_PARAM_CONSTRUCT | +- G_PARAM_STATIC_NAME | +- G_PARAM_STATIC_NICK | +- G_PARAM_STATIC_BLURB)); +- g_object_class_install_property (object_class, +- PROP_SCALING, +- g_param_spec_boolean ( "scaling", +- "Scaling", +- "Whether we should use scaling", +- FALSE, +- G_PARAM_READWRITE | +- G_PARAM_CONSTRUCT | +- G_PARAM_STATIC_NAME | +- G_PARAM_STATIC_NICK | +- G_PARAM_STATIC_BLURB)); +- g_object_class_install_property (object_class, +- PROP_SHARED_FLAG, +- g_param_spec_boolean ( "shared-flag", +- "Shared Flag", +- "Whether we should leave other clients connected to the server", +- FALSE, +- G_PARAM_READWRITE | +- G_PARAM_CONSTRUCT | +- G_PARAM_STATIC_NAME | +- G_PARAM_STATIC_NICK | +- G_PARAM_STATIC_BLURB)); +- g_object_class_install_property (object_class, +- PROP_FORCE_SIZE, +- g_param_spec_boolean ( "force-size", +- "Force widget size", +- "Whether we should define the widget size", +- TRUE, +- G_PARAM_READWRITE | +- G_PARAM_CONSTRUCT | +- G_PARAM_STATIC_NAME | +- G_PARAM_STATIC_NICK | +- G_PARAM_STATIC_BLURB)); +- +- signalCredParam = g_param_spec_enum("credential", +- "credential", +- "credential", +- vnc_display_credential_get_type(), +- 0, +- G_PARAM_READABLE); +- +- signals[VNC_CONNECTED] = +- g_signal_new ("vnc-connected", +- G_OBJECT_CLASS_TYPE (object_class), +- G_SIGNAL_RUN_FIRST, +- G_STRUCT_OFFSET (VncDisplayClass, vnc_connected), +- NULL, NULL, +- g_cclosure_marshal_VOID__VOID, +- G_TYPE_NONE, +- 0); +- +- signals[VNC_INITIALIZED] = +- g_signal_new ("vnc-initialized", +- G_OBJECT_CLASS_TYPE (object_class), +- G_SIGNAL_RUN_FIRST, +- G_STRUCT_OFFSET (VncDisplayClass, vnc_initialized), +- NULL, NULL, +- g_cclosure_marshal_VOID__VOID, +- G_TYPE_NONE, +- 0); +- +- signals[VNC_DISCONNECTED] = +- g_signal_new ("vnc-disconnected", +- G_OBJECT_CLASS_TYPE (object_class), +- G_SIGNAL_RUN_FIRST, +- G_STRUCT_OFFSET (VncDisplayClass, vnc_disconnected), +- NULL, NULL, +- g_cclosure_marshal_VOID__VOID, +- G_TYPE_NONE, +- 0); +- +- signals[VNC_AUTH_CREDENTIAL] = +- g_signal_new ("vnc-auth-credential", +- G_OBJECT_CLASS_TYPE (object_class), +- G_SIGNAL_RUN_FIRST, +- G_STRUCT_OFFSET (VncDisplayClass, vnc_auth_credential), +- NULL, NULL, +- g_cclosure_marshal_VOID__BOXED, +- G_TYPE_NONE, +- 1, +- G_TYPE_VALUE_ARRAY); +- +- +- signals[VNC_POINTER_GRAB] = +- g_signal_new("vnc-pointer-grab", +- G_TYPE_FROM_CLASS(klass), +- G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS, +- 0, +- NULL, +- NULL, +- g_cclosure_marshal_VOID__VOID, +- G_TYPE_NONE, +- 0); +- +- signals[VNC_POINTER_UNGRAB] = +- g_signal_new("vnc-pointer-ungrab", +- G_TYPE_FROM_CLASS(klass), +- G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS, +- 0, +- NULL, +- NULL, +- g_cclosure_marshal_VOID__VOID, +- G_TYPE_NONE, +- 0); +- +- signals[VNC_KEYBOARD_GRAB] = +- g_signal_new("vnc-keyboard-grab", +- G_TYPE_FROM_CLASS(klass), +- G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS, +- 0, +- NULL, +- NULL, +- g_cclosure_marshal_VOID__VOID, +- G_TYPE_NONE, +- 0); +- +- signals[VNC_KEYBOARD_UNGRAB] = +- g_signal_new("vnc-keyboard-ungrab", +- G_TYPE_FROM_CLASS(klass), +- G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS, +- 0, +- NULL, +- NULL, +- g_cclosure_marshal_VOID__VOID, +- G_TYPE_NONE, +- 0); +- +- +- signals[VNC_DESKTOP_RESIZE] = +- g_signal_new("vnc-desktop-resize", +- G_TYPE_FROM_CLASS(klass), +- G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS, +- 0, +- NULL, +- NULL, +- g_cclosure_user_marshal_VOID__INT_INT, +- G_TYPE_NONE, +- 2, +- G_TYPE_INT, G_TYPE_INT); +- +- signals[VNC_AUTH_FAILURE] = +- g_signal_new("vnc-auth-failure", +- G_TYPE_FROM_CLASS(klass), +- G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS, +- 0, +- NULL, +- NULL, +- g_cclosure_marshal_VOID__STRING, +- G_TYPE_NONE, +- 1, +- G_TYPE_STRING); +- +- signals[VNC_AUTH_UNSUPPORTED] = +- g_signal_new("vnc-auth-unsupported", +- G_TYPE_FROM_CLASS(klass), +- G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS, +- 0, +- NULL, +- NULL, +- g_cclosure_marshal_VOID__UINT, +- G_TYPE_NONE, +- 1, +- G_TYPE_UINT); +- +- signals[VNC_SERVER_CUT_TEXT] = +- g_signal_new("vnc-server-cut-text", +- G_TYPE_FROM_CLASS(klass), +- G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS, +- 0, +- NULL, +- NULL, +- g_cclosure_marshal_VOID__STRING, +- G_TYPE_NONE, +- 1, +- G_TYPE_STRING); +- +- signals[VNC_BELL] = +- g_signal_new("vnc-bell", +- G_TYPE_FROM_CLASS(klass), +- G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS, +- 0, +- NULL, +- NULL, +- g_cclosure_marshal_VOID__VOID, +- G_TYPE_NONE, +- 0); +- +- g_type_class_add_private(klass, sizeof(VncDisplayPrivate)); +-} +- +-static void vnc_display_init(VncDisplay *display) +-{ +- GtkObject *obj = GTK_OBJECT(display); +- GtkWidget *widget = GTK_WIDGET(display); +- VncDisplayPrivate *priv; +- +- GTK_WIDGET_SET_FLAGS(obj, GTK_CAN_FOCUS); +- +- gtk_widget_add_events(widget, +- GDK_POINTER_MOTION_MASK | +- GDK_BUTTON_PRESS_MASK | +- GDK_BUTTON_RELEASE_MASK | +- GDK_BUTTON_MOTION_MASK | +- GDK_ENTER_NOTIFY_MASK | +- GDK_LEAVE_NOTIFY_MASK | +- GDK_SCROLL_MASK | +- GDK_KEY_PRESS_MASK); +- gtk_widget_set_double_buffered(widget, FALSE); +- +- priv = display->priv = VNC_DISPLAY_GET_PRIVATE(display); +- memset(priv, 0, sizeof(VncDisplayPrivate)); +- priv->last_x = -1; +- priv->last_y = -1; +- priv->absolute = 1; +- priv->fd = -1; +- priv->read_only = FALSE; +- priv->allow_lossy = FALSE; +- priv->allow_scaling = FALSE; +- priv->grab_pointer = FALSE; +- priv->grab_keyboard = FALSE; +- priv->local_pointer = FALSE; +- priv->shared_flag = FALSE; +- priv->force_size = TRUE; +- +- priv->preferable_auths = g_slist_append (priv->preferable_auths, GUINT_TO_POINTER (GVNC_AUTH_VENCRYPT)); +- priv->preferable_auths = g_slist_append (priv->preferable_auths, GUINT_TO_POINTER (GVNC_AUTH_TLS)); +- priv->preferable_auths = g_slist_append (priv->preferable_auths, GUINT_TO_POINTER (GVNC_AUTH_VNC)); +- priv->preferable_auths = g_slist_append (priv->preferable_auths, GUINT_TO_POINTER (GVNC_AUTH_NONE)); +- +-#if WITH_GTKGLEXT +- if (gtk_gl_init_check(NULL, NULL)) { +- priv->gl_config = gdk_gl_config_new_by_mode(GDK_GL_MODE_RGB | +- GDK_GL_MODE_DEPTH); +- if (!gtk_widget_set_gl_capability(widget, +- priv->gl_config, +- NULL, +- TRUE, +- GDK_GL_RGBA_TYPE)) { +- g_warning("Could not enable OpenGL"); +- g_object_unref(G_OBJECT(priv->gl_config)); +- priv->gl_config = NULL; +- } +- } else +- priv->gl_config = NULL; +-#endif +- +- priv->gvnc = gvnc_new(&vnc_display_ops, obj); +-} +- +-static int vnc_display_best_path(char *buf, +- int buflen, +- const char *basedir, +- const char *basefile, +- char **dirs, +- unsigned int ndirs) +-{ +- unsigned int i; +- for (i = 0 ; i < ndirs ; i++) { +- struct stat sb; +- snprintf(buf, buflen-1, "%s/%s/%s", dirs[i], basedir, basefile); +- buf[buflen-1] = '\0'; +- if (stat(buf, &sb) == 0) +- return 0; +- } +- return -1; +-} +- +-static int vnc_display_set_x509_credential(VncDisplay *obj, const char *name) +-{ +- char sysdir[PATH_MAX], userdir[PATH_MAX]; +- struct passwd *pw; +- char file[PATH_MAX]; +- char *dirs[] = { sysdir, userdir }; +- +- strncpy(sysdir, SYSCONFDIR "/pki", PATH_MAX-1); +- sysdir[PATH_MAX-1] = '\0'; +- +- if (!(pw = getpwuid(getuid()))) +- return TRUE; +- +- snprintf(userdir, PATH_MAX-1, "%s/.pki", pw->pw_dir); +- userdir[PATH_MAX-1] = '\0'; +- +- if (vnc_display_best_path(file, PATH_MAX, "CA", "cacert.pem", dirs, 2) < 0) +- return TRUE; +- gvnc_set_credential_x509_cacert(obj->priv->gvnc, file); +- +- /* Don't mind failures of CRL */ +- if (vnc_display_best_path(file, PATH_MAX, "CA", "cacrl.pem", dirs, 2) == 0) +- gvnc_set_credential_x509_cacert(obj->priv->gvnc, file); +- +- /* Set client key & cert if we have them. Server will reject auth +- * if it decides it requires them*/ +- if (vnc_display_best_path(file, PATH_MAX, name, "private/clientkey.pem", dirs, 2) == 0) +- gvnc_set_credential_x509_key(obj->priv->gvnc, file); +- if (vnc_display_best_path(file, PATH_MAX, name, "clientcert.pem", dirs, 2) == 0) +- gvnc_set_credential_x509_cert(obj->priv->gvnc, file); +- +- return FALSE; +-} +- +-gboolean vnc_display_set_credential(VncDisplay *obj, int type, const gchar *data) +-{ +- switch (type) { +- case VNC_DISPLAY_CREDENTIAL_PASSWORD: +- if (gvnc_set_credential_password(obj->priv->gvnc, data)) +- return FALSE; +- return TRUE; +- +- case VNC_DISPLAY_CREDENTIAL_USERNAME: +- if (gvnc_set_credential_username(obj->priv->gvnc, data)) +- return FALSE; +- return TRUE; +- +- case VNC_DISPLAY_CREDENTIAL_CLIENTNAME: +- return vnc_display_set_x509_credential(obj, data); +- } +- +- return FALSE; +-} +- +-void vnc_display_set_pointer_local(VncDisplay *obj, gboolean enable) +-{ +- if (obj->priv->gc) { +- if (enable) +- do_pointer_show(obj); +- else if (obj->priv->in_pointer_grab || obj->priv->absolute) +- do_pointer_hide(obj); +- } +- obj->priv->local_pointer = enable; +-} +- +-void vnc_display_set_pointer_grab(VncDisplay *obj, gboolean enable) +-{ +- VncDisplayPrivate *priv = obj->priv; +- +- priv->grab_pointer = enable; +- if (!enable && priv->absolute && priv->in_pointer_grab) +- do_pointer_ungrab(obj, FALSE); +-} +- +-void vnc_display_set_keyboard_grab(VncDisplay *obj, gboolean enable) +-{ +- VncDisplayPrivate *priv = obj->priv; +- +- priv->grab_keyboard = enable; +- if (!enable && priv->in_keyboard_grab && !priv->in_pointer_grab) +- do_keyboard_ungrab(obj, FALSE); +-} +- +-void vnc_display_set_read_only(VncDisplay *obj, gboolean enable) +-{ +- obj->priv->read_only = enable; +-} +- +-GType vnc_display_credential_get_type(void) +-{ +- static GType etype = 0; +- +- if (etype == 0) { +- static const GEnumValue values[] = { +- { VNC_DISPLAY_CREDENTIAL_PASSWORD, "VNC_DISPLAY_CREDENTIAL_PASSWORD", "password" }, +- { VNC_DISPLAY_CREDENTIAL_USERNAME, "VNC_DISPLAY_CREDENTIAL_USERNAME", "username" }, +- { VNC_DISPLAY_CREDENTIAL_CLIENTNAME, "VNC_DISPLAY_CREDENTIAL_CLIENTNAME", "clientname" }, +- { 0, NULL, NULL } +- }; +- etype = g_enum_register_static ("VncDisplayCredentialType", values ); +- } +- +- return etype; +-} +- +-GType vnc_display_key_event_get_type(void) +-{ +- static GType etype = 0; +- +- if (etype == 0) { +- static const GEnumValue values[] = { +- { VNC_DISPLAY_KEY_EVENT_PRESS, "VNC_DISPLAY_KEY_EVENT_PRESS", "press" }, +- { VNC_DISPLAY_KEY_EVENT_RELEASE, "VNC_DISPLAY_KEY_EVENT_RELEASE", "release" }, +- { VNC_DISPLAY_KEY_EVENT_CLICK, "VNC_DISPLAY_KEY_EVENT_CLICK", "click" }, +- { 0, NULL, NULL } +- }; +- etype = g_enum_register_static ("VncDisplayKeyEvents", values ); +- } +- +- return etype; +-} +- +-GdkPixbuf *vnc_display_get_pixbuf(VncDisplay *obj) +-{ +- VncDisplayPrivate *priv = obj->priv; +- GdkPixbuf *pixbuf; +- +- if (!priv->gvnc || +- !gvnc_is_initialized(priv->gvnc)) +- return NULL; +- +- pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, +- priv->image->width, priv->image->height); +- +- if (!gdk_pixbuf_get_from_image(pixbuf, +- priv->image, +- gdk_colormap_get_system(), +- 0, 0, 0, 0, +- priv->image->width, +- priv->image->height)) +- return NULL; +- +- return pixbuf; +-} +- +- +-int vnc_display_get_width(VncDisplay *obj) +-{ +- g_return_val_if_fail (VNC_IS_DISPLAY (obj), -1); +- +- return gvnc_get_width (obj->priv->gvnc); +-} +- +-int vnc_display_get_height(VncDisplay *obj) +-{ +- g_return_val_if_fail (VNC_IS_DISPLAY (obj), -1); +- +- return gvnc_get_height (obj->priv->gvnc); +-} +- +-const char * vnc_display_get_name(VncDisplay *obj) +-{ +- g_return_val_if_fail (VNC_IS_DISPLAY (obj), NULL); +- +- return gvnc_get_name (obj->priv->gvnc); +-} +- +-void vnc_display_client_cut_text(VncDisplay *obj, const gchar *text) +-{ +- g_return_if_fail (VNC_IS_DISPLAY (obj)); +- +- gvnc_client_cut_text(obj->priv->gvnc, text, strlen (text)); +-} +- +-void vnc_display_set_lossy_encoding(VncDisplay *obj, gboolean enable) +-{ +- g_return_if_fail (VNC_IS_DISPLAY (obj)); +- obj->priv->allow_lossy = enable; +-} +- +-void vnc_display_set_shared_flag(VncDisplay *obj, gboolean shared) +-{ +- g_return_if_fail (VNC_IS_DISPLAY (obj)); +- obj->priv->shared_flag = shared; +-} +- +-#if WITH_GTKGLEXT +-gboolean vnc_display_set_scaling(VncDisplay *obj, gboolean enable) +-{ +- GtkWidget *widget = GTK_WIDGET(obj); +- gint width, height; +- +- g_return_val_if_fail (VNC_IS_DISPLAY (obj), FALSE); +- if (obj->priv->gl_config == NULL) +- return FALSE; +- +- obj->priv->allow_scaling = enable; +- if (gvnc_is_open(obj->priv->gvnc) && widget->window) { +- gdk_drawable_get_size(widget->window, &width, &height); +- rescale_display(obj, width, height); +- gtk_widget_queue_draw_area(widget, 0, 0, width, height); +- } +- +- return TRUE; +-} +-#else +-gboolean vnc_display_set_scaling(VncDisplay *obj G_GNUC_UNUSED, +- gboolean enable G_GNUC_UNUSED) +-{ +- return FALSE; +-} +-#endif +- +-void vnc_display_set_force_size(VncDisplay *obj, gboolean enabled) +-{ +- g_return_if_fail (VNC_IS_DISPLAY (obj)); +- obj->priv->force_size = enabled; +-} +- +-gboolean vnc_display_get_force_size(VncDisplay *obj) +-{ +- g_return_val_if_fail (VNC_IS_DISPLAY (obj), FALSE); +- +- return obj->priv->force_size; +-} +- +-gboolean vnc_display_get_scaling(VncDisplay *obj) +-{ +- g_return_val_if_fail (VNC_IS_DISPLAY (obj), FALSE); +- +- return obj->priv->allow_scaling; +-} +- +-gboolean vnc_display_get_lossy_encoding(VncDisplay *obj) +-{ +- g_return_val_if_fail (VNC_IS_DISPLAY (obj), FALSE); +- +- return obj->priv->allow_lossy; +-} +- +-gboolean vnc_display_get_shared_flag(VncDisplay *obj) +-{ +- g_return_val_if_fail (VNC_IS_DISPLAY (obj), FALSE); +- +- return obj->priv->shared_flag; +-} +- +-gboolean vnc_display_get_pointer_local(VncDisplay *obj) +-{ +- g_return_val_if_fail (VNC_IS_DISPLAY (obj), FALSE); +- +- return obj->priv->local_pointer; +-} +- +-gboolean vnc_display_get_pointer_grab(VncDisplay *obj) +-{ +- g_return_val_if_fail (VNC_IS_DISPLAY (obj), FALSE); +- +- return obj->priv->grab_pointer; +-} +- +-gboolean vnc_display_get_keyboard_grab(VncDisplay *obj) +-{ +- g_return_val_if_fail (VNC_IS_DISPLAY (obj), FALSE); +- +- return obj->priv->grab_keyboard; +-} +- +-gboolean vnc_display_get_read_only(VncDisplay *obj) +-{ +- g_return_val_if_fail (VNC_IS_DISPLAY (obj), FALSE); +- +- return obj->priv->read_only; +-} +- +-gboolean vnc_display_is_pointer_absolute(VncDisplay *obj) +-{ +- return obj->priv->absolute; +-} +- +-GOptionGroup * +-vnc_display_get_option_group (void) +-{ +- GOptionGroup *group; +- +- group = g_option_group_new ("gtk-vnc", "GTK-VNC Options", "Show GTK-VNC Options", NULL, NULL); +- +- g_option_group_add_entries (group, gtk_vnc_args); +- +- return group; +-} +- +-/* +- * Local variables: +- * c-indent-level: 8 +- * c-basic-offset: 8 +- * tab-width: 8 +- * End: +- */ +diff -urN gtk-vnc-0.3.7/vc-list-files gtk-vnc-0.3.7.mingw/vc-list-files +--- gtk-vnc-0.3.7/vc-list-files 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.mingw/vc-list-files 2008-10-09 12:19:03.000000000 +0100 +@@ -0,0 +1,107 @@ ++#!/bin/sh ++# List version-controlled file names. ++ ++# Print a version string. ++scriptversion=2008-07-11.19 ++ ++# Copyright (C) 2006-2008 Free Software Foundation, Inc. ++ ++# This program is free software: you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation, either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++ ++# List the specified version-controlled files. ++# With no argument, list them all. With a single DIRECTORY argument, ++# list the version-controlled files in that directory. ++ ++# If there's an argument, it must be a single, "."-relative directory name. ++# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/ ++ ++postprocess= ++case $1 in ++ --help) cat <. ++EOF ++ exit ;; ++ ++ --version) ++ year=`echo "$scriptversion" | sed 's/[^0-9].*//'` ++ cat < ++This is free software: you are free to change and redistribute it. ++There is NO WARRANTY, to the extent permitted by law. ++EOF ++ exit ;; ++ ++ -C) ++ test "$2" = . || postprocess="| sed 's|^|$2/|'" ++ cd "$2" || exit 1 ++ shift; shift ;; ++esac ++ ++dir= ++case $# in ++ 0) ;; ++ 1) dir=$1 ;; ++ *) echo "$0: too many arguments" 1>&2 ++ echo "Usage: $0 [-C srcdir] [DIR]" 1>&2; exit 1;; ++esac ++ ++test "x$dir" = x && dir=. ++ ++if test -d .git; then ++ eval exec git ls-files '"$dir"' $postprocess ++elif test -d .hg; then ++ eval exec hg locate '"$dir/*"' $postprocess ++elif test -d .bzr; then ++ test "$postprocess" = '' && postprocess="| sed 's|^\./||'" ++ eval exec bzr ls --versioned '"$dir"' $postprocess ++elif test -d CVS; then ++ test "$postprocess" = '' && postprocess="| sed 's|^\./||'" ++ if test -x build-aux/cvsu; then ++ eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess ++ elif (cvsu --help) >/dev/null 2>&1; then ++ eval cvsu --find --types=AFGM '"$dir"' $postprocess ++ else ++ eval awk -F/ \''{ \ ++ if (!$1 && $3 !~ /^-/) { \ ++ f=FILENAME; \ ++ if (f ~ /CVS\/Entries$/) \ ++ f = substr(f, 0, length(f)-11); \ ++ print f $2; \ ++ }}'\'' \ ++ `find "$dir" -name Entries -print` /dev/null' $postprocess ++ fi ++else ++ echo "$0: Failed to determine type of version control used in `pwd`" 1>&2 ++ exit 1 ++fi ++ ++# Local variables: ++# eval: (add-hook 'write-file-hooks 'time-stamp) ++# time-stamp-start: "scriptversion=" ++# time-stamp-format: "%:y-%02m-%02d.%02H" ++# time-stamp-end: "$" ++# End: diff --git a/gtk-vnc/gtk-vnc-0.3.7-mingw32-gnulib-files.patch b/gtk-vnc/gtk-vnc-0.3.7-mingw32-gnulib-files.patch new file mode 100644 index 0000000..ed2d9d6 --- /dev/null +++ b/gtk-vnc/gtk-vnc-0.3.7-mingw32-gnulib-files.patch @@ -0,0 +1,17597 @@ +diff -urN gtk-vnc-0.3.7.mingw/bootstrap gtk-vnc-0.3.7.gnulib/bootstrap +--- gtk-vnc-0.3.7.mingw/bootstrap 2008-10-09 12:19:03.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/bootstrap 2008-10-09 12:33:37.000000000 +0100 +@@ -65,6 +65,10 @@ + <$gnulib_tool || exit + + modules=' ++recv ++send ++socket ++connect + getaddrinfo + vc-list-files + ' +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/alloca.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/alloca.in.h +--- gtk-vnc-0.3.7.mingw/gnulib/lib/alloca.in.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/alloca.in.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,56 @@ ++/* Memory allocation on the stack. ++ ++ Copyright (C) 1995, 1999, 2001-2004, 2006-2008 Free Software ++ Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU Lesser General Public License as published ++ by the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this program; if not, write to the Free Software ++ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ++ USA. */ ++ ++/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H ++ means there is a real alloca function. */ ++#ifndef _GL_ALLOCA_H ++#define _GL_ALLOCA_H ++ ++/* alloca (N) returns a pointer to N bytes of memory ++ allocated on the stack, which will last until the function returns. ++ Use of alloca should be avoided: ++ - inside arguments of function calls - undefined behaviour, ++ - in inline functions - the allocation may actually last until the ++ calling function returns, ++ - for huge N (say, N >= 65536) - you never know how large (or small) ++ the stack is, and when the stack cannot fulfill the memory allocation ++ request, the program just crashes. ++ */ ++ ++#ifndef alloca ++# ifdef __GNUC__ ++# define alloca __builtin_alloca ++# elif defined _AIX ++# define alloca __alloca ++# elif defined _MSC_VER ++# include ++# define alloca _alloca ++# elif defined __DECC && defined __VMS ++# define alloca __ALLOCA ++# else ++# include ++# ifdef __cplusplus ++extern "C" ++# endif ++void *alloca (size_t); ++# endif ++#endif ++ ++#endif /* _GL_ALLOCA_H */ +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/arpa_inet.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/arpa_inet.in.h +--- gtk-vnc-0.3.7.mingw/gnulib/lib/arpa_inet.in.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/arpa_inet.in.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,80 @@ ++/* A GNU-like . ++ ++ Copyright (C) 2005-2006, 2008 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef _GL_ARPA_INET_H ++ ++/* Gnulib's sys/socket.h is responsible for pulling in winsock2.h etc ++ under MinGW. */ ++#include ++ ++#if @HAVE_ARPA_INET_H@ ++ ++@PRAGMA_SYSTEM_HEADER@ ++ ++/* The include_next requires a split double-inclusion guard. */ ++# @INCLUDE_NEXT@ @NEXT_ARPA_INET_H@ ++ ++#endif ++ ++#ifndef _GL_ARPA_INET_H ++#define _GL_ARPA_INET_H ++ ++/* The definition of GL_LINK_WARNING is copied here. */ ++ ++#if @GNULIB_INET_NTOP@ ++# if !@HAVE_DECL_INET_NTOP@ ++/* Converts an internet address from internal format to a printable, ++ presentable format. ++ AF is an internet address family, such as AF_INET or AF_INET6. ++ SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr' ++ (for AF_INET6). ++ DST points to a buffer having room for CNT bytes. ++ The printable representation of the address (in numeric form, not ++ surrounded by [...], no reverse DNS is done) is placed in DST, and ++ DST is returned. If an error occurs, the return value is NULL and ++ errno is set. If CNT bytes are not sufficient to hold the result, ++ the return value is NULL and errno is set to ENOSPC. A good value ++ for CNT is 46. ++ ++ For more details, see the POSIX:2001 specification ++ . */ ++extern const char *inet_ntop (int af, const void *restrict src, ++ char *restrict dst, socklen_t cnt); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef inet_ntop ++# define inet_ntop(af,src,dst,cnt) \ ++ (GL_LINK_WARNING ("inet_ntop is unportable - " \ ++ "use gnulib module inet_ntop for portability"), \ ++ inet_ntop (af, src, dst, cnt)) ++#endif ++ ++#if @GNULIB_INET_PTON@ ++# if !@HAVE_DECL_INET_PTON@ ++extern int inet_pton (int af, const char *restrict src, void *restrict dst); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef inet_pton ++# define inet_pton(af,src,dst) \ ++ (GL_LINK_WARNING ("inet_pton is unportable - " \ ++ "use gnulib module inet_pton for portability"), \ ++ inet_pton (af, src, dst)) ++#endif ++ ++#endif /* _GL_ARPA_INET_H */ ++#endif /* _GL_ARPA_INET_H */ +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/asnprintf.c gtk-vnc-0.3.7.gnulib/gnulib/lib/asnprintf.c +--- gtk-vnc-0.3.7.mingw/gnulib/lib/asnprintf.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/asnprintf.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,35 @@ ++/* Formatted output to strings. ++ Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License along ++ with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#include ++ ++/* Specification. */ ++#include "vasnprintf.h" ++ ++#include ++ ++char * ++asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) ++{ ++ va_list args; ++ char *result; ++ ++ va_start (args, format); ++ result = vasnprintf (resultbuf, lengthp, format, args); ++ va_end (args); ++ return result; ++} +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/dummy.c gtk-vnc-0.3.7.gnulib/gnulib/lib/dummy.c +--- gtk-vnc-0.3.7.mingw/gnulib/lib/dummy.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/dummy.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,42 @@ ++/* A dummy file, to prevent empty libraries from breaking builds. ++ Copyright (C) 2004, 2007 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program. If not, see . */ ++ ++/* Some systems, reportedly OpenBSD and Mac OS X, refuse to create ++ libraries without any object files. You might get an error like: ++ ++ > ar cru .libs/libgl.a ++ > ar: no archive members specified ++ ++ Compiling this file, and adding its object file to the library, will ++ prevent the library from being empty. */ ++ ++/* Some systems, such as Solaris with cc 5.0, refuse to work with libraries ++ that don't export any symbol. You might get an error like: ++ ++ > cc ... libgnu.a ++ > ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a ++ ++ Compiling this file, and adding its object file to the library, will ++ prevent the library from exporting no symbols. */ ++ ++#ifdef __sun ++/* This declaration ensures that the library will export at least 1 symbol. */ ++int gl_dummy_symbol; ++#else ++/* This declaration is solely to ensure that after preprocessing ++ this file is never empty. */ ++typedef int dummy; ++#endif +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/errno.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/errno.in.h +--- gtk-vnc-0.3.7.mingw/gnulib/lib/errno.in.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/errno.in.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,153 @@ ++/* A POSIX-like . ++ ++ Copyright (C) 2008 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef _GL_ERRNO_H ++ ++@PRAGMA_SYSTEM_HEADER@ ++ ++/* The include_next requires a split double-inclusion guard. */ ++#@INCLUDE_NEXT@ @NEXT_ERRNO_H@ ++ ++#ifndef _GL_ERRNO_H ++#define _GL_ERRNO_H ++ ++ ++/* On native Windows platforms, many macros are not defined. */ ++# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ ++/* POSIX says that EAGAIN and EWOULDBLOCK may have the same value. */ ++# define EWOULDBLOCK EAGAIN ++ ++/* Values >= 100 seem safe to use. */ ++# define ETXTBSY 100 ++# define GNULIB_defined_ETXTBSY 1 ++ ++/* These are intentionally the same values as the WSA* error numbers, defined ++ in . */ ++# define EINPROGRESS 10036 ++# define EALREADY 10037 ++# define ENOTSOCK 10038 ++# define EDESTADDRREQ 10039 ++# define EMSGSIZE 10040 ++# define EPROTOTYPE 10041 ++# define ENOPROTOOPT 10042 ++# define EPROTONOSUPPORT 10043 ++# define ESOCKTNOSUPPORT 10044 /* not required by POSIX */ ++# define EOPNOTSUPP 10045 ++# define EPFNOSUPPORT 10046 /* not required by POSIX */ ++# define EAFNOSUPPORT 10047 ++# define EADDRINUSE 10048 ++# define EADDRNOTAVAIL 10049 ++# define ENETDOWN 10050 ++# define ENETUNREACH 10051 ++# define ENETRESET 10052 ++# define ECONNABORTED 10053 ++# define ECONNRESET 10054 ++# define ENOBUFS 10055 ++# define EISCONN 10056 ++# define ENOTCONN 10057 ++# define ESHUTDOWN 10058 /* not required by POSIX */ ++# define ETOOMANYREFS 10059 /* not required by POSIX */ ++# define ETIMEDOUT 10060 ++# define ECONNREFUSED 10061 ++# define ELOOP 10062 ++# define EHOSTDOWN 10064 /* not required by POSIX */ ++# define EHOSTUNREACH 10065 ++# define EPROCLIM 10067 /* not required by POSIX */ ++# define EUSERS 10068 /* not required by POSIX */ ++# define EDQUOT 10069 ++# define ESTALE 10070 ++# define EREMOTE 10071 /* not required by POSIX */ ++# define GNULIB_defined_ESOCK 1 ++ ++# endif ++ ++ ++/* On OSF/1 5.1, when _XOPEN_SOURCE_EXTENDED is not defined, the macros ++ EMULTIHOP, ENOLINK, EOVERFLOW are not defined. */ ++# if @EMULTIHOP_HIDDEN@ ++# define EMULTIHOP @EMULTIHOP_VALUE@ ++# define GNULIB_defined_EMULTIHOP 1 ++# endif ++# if @ENOLINK_HIDDEN@ ++# define ENOLINK @ENOLINK_VALUE@ ++# define GNULIB_defined_ENOLINK 1 ++# endif ++# if @EOVERFLOW_HIDDEN@ ++# define EOVERFLOW @EOVERFLOW_VALUE@ ++# define GNULIB_defined_EOVERFLOW 1 ++# endif ++ ++ ++/* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK, ++ EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined. ++ Define them here. Values >= 2000 seem safe to use: Solaris ESTALE = 151, ++ HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133. ++ ++ Note: When one of these systems defines some of these macros some day, ++ binaries will have to be recompiled so that they recognizes the new ++ errno values from the system. */ ++ ++# ifndef ENOMSG ++# define ENOMSG 2000 ++# define GNULIB_defined_ENOMSG 1 ++# endif ++ ++# ifndef EIDRM ++# define EIDRM 2001 ++# define GNULIB_defined_EIDRM 1 ++# endif ++ ++# ifndef ENOLINK ++# define ENOLINK 2002 ++# define GNULIB_defined_ENOLINK 1 ++# endif ++ ++# ifndef EPROTO ++# define EPROTO 2003 ++# define GNULIB_defined_EPROTO 1 ++# endif ++ ++# ifndef EMULTIHOP ++# define EMULTIHOP 2004 ++# define GNULIB_defined_EMULTIHOP 1 ++# endif ++ ++# ifndef EBADMSG ++# define EBADMSG 2005 ++# define GNULIB_defined_EBADMSG 1 ++# endif ++ ++# ifndef EOVERFLOW ++# define EOVERFLOW 2006 ++# define GNULIB_defined_EOVERFLOW 1 ++# endif ++ ++# ifndef ENOTSUP ++# define ENOTSUP 2007 ++# define GNULIB_defined_ENOTSUP 1 ++# endif ++ ++# ifndef ECANCELED ++# define ECANCELED 2008 ++# define GNULIB_defined_ECANCELED 1 ++# endif ++ ++ ++#endif /* _GL_ERRNO_H */ ++#endif /* _GL_ERRNO_H */ +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/float+.h gtk-vnc-0.3.7.gnulib/gnulib/lib/float+.h +--- gtk-vnc-0.3.7.mingw/gnulib/lib/float+.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/float+.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,148 @@ ++/* Supplemental information about the floating-point formats. ++ Copyright (C) 2007 Free Software Foundation, Inc. ++ Written by Bruno Haible , 2007. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef _FLOATPLUS_H ++#define _FLOATPLUS_H ++ ++#include ++#include ++ ++/* Number of bits in the mantissa of a floating-point number, including the ++ "hidden bit". */ ++#if FLT_RADIX == 2 ++# define FLT_MANT_BIT FLT_MANT_DIG ++# define DBL_MANT_BIT DBL_MANT_DIG ++# define LDBL_MANT_BIT LDBL_MANT_DIG ++#elif FLT_RADIX == 4 ++# define FLT_MANT_BIT (FLT_MANT_DIG * 2) ++# define DBL_MANT_BIT (DBL_MANT_DIG * 2) ++# define LDBL_MANT_BIT (LDBL_MANT_DIG * 2) ++#elif FLT_RADIX == 16 ++# define FLT_MANT_BIT (FLT_MANT_DIG * 4) ++# define DBL_MANT_BIT (DBL_MANT_DIG * 4) ++# define LDBL_MANT_BIT (LDBL_MANT_DIG * 4) ++#endif ++ ++/* Bit mask that can be used to mask the exponent, as an unsigned number. */ ++#define FLT_EXP_MASK ((FLT_MAX_EXP - FLT_MIN_EXP) | 7) ++#define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7) ++#define LDBL_EXP_MASK ((LDBL_MAX_EXP - LDBL_MIN_EXP) | 7) ++ ++/* Number of bits used for the exponent of a floating-point number, including ++ the exponent's sign. */ ++#define FLT_EXP_BIT \ ++ (FLT_EXP_MASK < 0x100 ? 8 : \ ++ FLT_EXP_MASK < 0x200 ? 9 : \ ++ FLT_EXP_MASK < 0x400 ? 10 : \ ++ FLT_EXP_MASK < 0x800 ? 11 : \ ++ FLT_EXP_MASK < 0x1000 ? 12 : \ ++ FLT_EXP_MASK < 0x2000 ? 13 : \ ++ FLT_EXP_MASK < 0x4000 ? 14 : \ ++ FLT_EXP_MASK < 0x8000 ? 15 : \ ++ FLT_EXP_MASK < 0x10000 ? 16 : \ ++ FLT_EXP_MASK < 0x20000 ? 17 : \ ++ FLT_EXP_MASK < 0x40000 ? 18 : \ ++ FLT_EXP_MASK < 0x80000 ? 19 : \ ++ FLT_EXP_MASK < 0x100000 ? 20 : \ ++ FLT_EXP_MASK < 0x200000 ? 21 : \ ++ FLT_EXP_MASK < 0x400000 ? 22 : \ ++ FLT_EXP_MASK < 0x800000 ? 23 : \ ++ FLT_EXP_MASK < 0x1000000 ? 24 : \ ++ FLT_EXP_MASK < 0x2000000 ? 25 : \ ++ FLT_EXP_MASK < 0x4000000 ? 26 : \ ++ FLT_EXP_MASK < 0x8000000 ? 27 : \ ++ FLT_EXP_MASK < 0x10000000 ? 28 : \ ++ FLT_EXP_MASK < 0x20000000 ? 29 : \ ++ FLT_EXP_MASK < 0x40000000 ? 30 : \ ++ FLT_EXP_MASK <= 0x7fffffff ? 31 : \ ++ 32) ++#define DBL_EXP_BIT \ ++ (DBL_EXP_MASK < 0x100 ? 8 : \ ++ DBL_EXP_MASK < 0x200 ? 9 : \ ++ DBL_EXP_MASK < 0x400 ? 10 : \ ++ DBL_EXP_MASK < 0x800 ? 11 : \ ++ DBL_EXP_MASK < 0x1000 ? 12 : \ ++ DBL_EXP_MASK < 0x2000 ? 13 : \ ++ DBL_EXP_MASK < 0x4000 ? 14 : \ ++ DBL_EXP_MASK < 0x8000 ? 15 : \ ++ DBL_EXP_MASK < 0x10000 ? 16 : \ ++ DBL_EXP_MASK < 0x20000 ? 17 : \ ++ DBL_EXP_MASK < 0x40000 ? 18 : \ ++ DBL_EXP_MASK < 0x80000 ? 19 : \ ++ DBL_EXP_MASK < 0x100000 ? 20 : \ ++ DBL_EXP_MASK < 0x200000 ? 21 : \ ++ DBL_EXP_MASK < 0x400000 ? 22 : \ ++ DBL_EXP_MASK < 0x800000 ? 23 : \ ++ DBL_EXP_MASK < 0x1000000 ? 24 : \ ++ DBL_EXP_MASK < 0x2000000 ? 25 : \ ++ DBL_EXP_MASK < 0x4000000 ? 26 : \ ++ DBL_EXP_MASK < 0x8000000 ? 27 : \ ++ DBL_EXP_MASK < 0x10000000 ? 28 : \ ++ DBL_EXP_MASK < 0x20000000 ? 29 : \ ++ DBL_EXP_MASK < 0x40000000 ? 30 : \ ++ DBL_EXP_MASK <= 0x7fffffff ? 31 : \ ++ 32) ++#define LDBL_EXP_BIT \ ++ (LDBL_EXP_MASK < 0x100 ? 8 : \ ++ LDBL_EXP_MASK < 0x200 ? 9 : \ ++ LDBL_EXP_MASK < 0x400 ? 10 : \ ++ LDBL_EXP_MASK < 0x800 ? 11 : \ ++ LDBL_EXP_MASK < 0x1000 ? 12 : \ ++ LDBL_EXP_MASK < 0x2000 ? 13 : \ ++ LDBL_EXP_MASK < 0x4000 ? 14 : \ ++ LDBL_EXP_MASK < 0x8000 ? 15 : \ ++ LDBL_EXP_MASK < 0x10000 ? 16 : \ ++ LDBL_EXP_MASK < 0x20000 ? 17 : \ ++ LDBL_EXP_MASK < 0x40000 ? 18 : \ ++ LDBL_EXP_MASK < 0x80000 ? 19 : \ ++ LDBL_EXP_MASK < 0x100000 ? 20 : \ ++ LDBL_EXP_MASK < 0x200000 ? 21 : \ ++ LDBL_EXP_MASK < 0x400000 ? 22 : \ ++ LDBL_EXP_MASK < 0x800000 ? 23 : \ ++ LDBL_EXP_MASK < 0x1000000 ? 24 : \ ++ LDBL_EXP_MASK < 0x2000000 ? 25 : \ ++ LDBL_EXP_MASK < 0x4000000 ? 26 : \ ++ LDBL_EXP_MASK < 0x8000000 ? 27 : \ ++ LDBL_EXP_MASK < 0x10000000 ? 28 : \ ++ LDBL_EXP_MASK < 0x20000000 ? 29 : \ ++ LDBL_EXP_MASK < 0x40000000 ? 30 : \ ++ LDBL_EXP_MASK <= 0x7fffffff ? 31 : \ ++ 32) ++ ++/* Number of bits used for a floating-point number: the mantissa (not ++ counting the "hidden bit", since it may or may not be explicit), the ++ exponent, and the sign. */ ++#define FLT_TOTAL_BIT ((FLT_MANT_BIT - 1) + FLT_EXP_BIT + 1) ++#define DBL_TOTAL_BIT ((DBL_MANT_BIT - 1) + DBL_EXP_BIT + 1) ++#define LDBL_TOTAL_BIT ((LDBL_MANT_BIT - 1) + LDBL_EXP_BIT + 1) ++ ++/* Number of bytes used for a floating-point number. ++ This can be smaller than the 'sizeof'. For example, on i386 systems, ++ 'long double' most often have LDBL_MANT_BIT = 64, LDBL_EXP_BIT = 16, hence ++ LDBL_TOTAL_BIT = 80 bits, i.e. 10 bytes of consecutive memory, but ++ sizeof (long double) = 12 or = 16. */ ++#define SIZEOF_FLT ((FLT_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT) ++#define SIZEOF_DBL ((DBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT) ++#define SIZEOF_LDBL ((LDBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT) ++ ++/* Verify that SIZEOF_FLT <= sizeof (float) etc. */ ++typedef int verify_sizeof_flt[2 * (SIZEOF_FLT <= sizeof (float)) - 1]; ++typedef int verify_sizeof_dbl[2 * (SIZEOF_DBL <= sizeof (double)) - 1]; ++typedef int verify_sizeof_ldbl[2 * (SIZEOF_LDBL <= sizeof (long double)) - 1]; ++ ++#endif /* _FLOATPLUS_H */ +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/float.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/float.in.h +--- gtk-vnc-0.3.7.mingw/gnulib/lib/float.in.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/float.in.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,60 @@ ++/* A correct . ++ ++ Copyright (C) 2007-2008 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program. If not, see . */ ++ ++#ifndef _GL_FLOAT_H ++ ++@PRAGMA_SYSTEM_HEADER@ ++ ++/* The include_next requires a split double-inclusion guard. */ ++#@INCLUDE_NEXT@ @NEXT_FLOAT_H@ ++ ++#ifndef _GL_FLOAT_H ++#define _GL_FLOAT_H ++ ++/* 'long double' properties. */ ++#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__) ++/* Number of mantissa units, in base FLT_RADIX. */ ++# undef LDBL_MANT_DIG ++# define LDBL_MANT_DIG 64 ++/* Number of decimal digits that is sufficient for representing a number. */ ++# undef LDBL_DIG ++# define LDBL_DIG 18 ++/* x-1 where x is the smallest representable number > 1. */ ++# undef LDBL_EPSILON ++# define LDBL_EPSILON 1.0842021724855044340E-19L ++/* Minimum e such that FLT_RADIX^(e-1) is a normalized number. */ ++# undef LDBL_MIN_EXP ++# define LDBL_MIN_EXP (-16381) ++/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number. */ ++# undef LDBL_MAX_EXP ++# define LDBL_MAX_EXP 16384 ++/* Minimum positive normalized number. */ ++# undef LDBL_MIN ++# define LDBL_MIN 3.3621031431120935063E-4932L ++/* Maximum representable finite number. */ ++# undef LDBL_MAX ++# define LDBL_MAX 1.1897314953572317650E+4932L ++/* Minimum e such that 10^e is in the range of normalized numbers. */ ++# undef LDBL_MIN_10_EXP ++# define LDBL_MIN_10_EXP (-4931) ++/* Maximum e such that 10^e is in the range of representable finite numbers. */ ++# undef LDBL_MAX_10_EXP ++# define LDBL_MAX_10_EXP 4932 ++#endif ++ ++#endif /* _GL_FLOAT_H */ ++#endif /* _GL_FLOAT_H */ +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/gai_strerror.c gtk-vnc-0.3.7.gnulib/gnulib/lib/gai_strerror.c +--- gtk-vnc-0.3.7.mingw/gnulib/lib/gai_strerror.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/gai_strerror.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,78 @@ ++/* Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ Contributed by Philip Blundell , 1997. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef _LIBC ++# include ++# include "getaddrinfo.h" ++#endif ++ ++#include ++#ifdef HAVE_NETDB_H ++# include ++#endif ++ ++#ifdef _LIBC ++# include ++#else ++# include "gettext.h" ++# define _(String) gettext (String) ++# define N_(String) String ++#endif ++ ++static struct ++ { ++ int code; ++ const char *msg; ++ } ++values[] = ++ { ++ { EAI_ADDRFAMILY, N_("Address family for hostname not supported") }, ++ { EAI_AGAIN, N_("Temporary failure in name resolution") }, ++ { EAI_BADFLAGS, N_("Bad value for ai_flags") }, ++ { EAI_FAIL, N_("Non-recoverable failure in name resolution") }, ++ { EAI_FAMILY, N_("ai_family not supported") }, ++ { EAI_MEMORY, N_("Memory allocation failure") }, ++ { EAI_NODATA, N_("No address associated with hostname") }, ++ { EAI_NONAME, N_("Name or service not known") }, ++ { EAI_SERVICE, N_("Servname not supported for ai_socktype") }, ++ { EAI_SOCKTYPE, N_("ai_socktype not supported") }, ++ { EAI_SYSTEM, N_("System error") }, ++ { EAI_OVERFLOW, N_("Argument buffer too small") }, ++#ifdef __USE_GNU ++ { EAI_INPROGRESS, N_("Processing request in progress") }, ++ { EAI_CANCELED, N_("Request canceled") }, ++ { EAI_NOTCANCELED, N_("Request not canceled") }, ++ { EAI_ALLDONE, N_("All requests done") }, ++ { EAI_INTR, N_("Interrupted by a signal") }, ++ { EAI_IDN_ENCODE, N_("Parameter string not correctly encoded") } ++#endif ++ }; ++ ++const char * ++gai_strerror (int code) ++{ ++ size_t i; ++ for (i = 0; i < sizeof (values) / sizeof (values[0]); ++i) ++ if (values[i].code == code) ++ return _(values[i].msg); ++ ++ return _("Unknown error"); ++} ++#ifdef _LIBC ++libc_hidden_def (gai_strerror) ++#endif +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/getaddrinfo.c gtk-vnc-0.3.7.gnulib/gnulib/lib/getaddrinfo.c +--- gtk-vnc-0.3.7.mingw/gnulib/lib/getaddrinfo.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/getaddrinfo.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,419 @@ ++/* Get address information (partial implementation). ++ Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software ++ Foundation, Inc. ++ Contributed by Simon Josefsson . ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#include ++ ++#include "getaddrinfo.h" ++ ++#if HAVE_NETINET_IN_H ++# include ++#endif ++ ++/* Get inet_ntop. */ ++#include ++ ++/* Get calloc. */ ++#include ++ ++/* Get memcpy, strdup. */ ++#include ++ ++/* Get snprintf. */ ++#include ++ ++#include ++ ++#include "gettext.h" ++#define _(String) gettext (String) ++#define N_(String) String ++ ++/* BeOS has AF_INET, but not PF_INET. */ ++#ifndef PF_INET ++# define PF_INET AF_INET ++#endif ++/* BeOS also lacks PF_UNSPEC. */ ++#ifndef PF_UNSPEC ++# define PF_UNSPEC 0 ++#endif ++ ++#if defined _WIN32 || defined __WIN32__ ++# define WIN32_NATIVE ++#endif ++ ++#ifdef WIN32_NATIVE ++typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*, ++ const struct addrinfo*, ++ struct addrinfo**); ++typedef void (WSAAPI *freeaddrinfo_func) (struct addrinfo*); ++typedef int (WSAAPI *getnameinfo_func) (const struct sockaddr*, ++ socklen_t, char*, DWORD, ++ char*, DWORD, int); ++ ++static getaddrinfo_func getaddrinfo_ptr = NULL; ++static freeaddrinfo_func freeaddrinfo_ptr = NULL; ++static getnameinfo_func getnameinfo_ptr = NULL; ++ ++static int ++use_win32_p (void) ++{ ++ static int done = 0; ++ HMODULE h; ++ ++ if (done) ++ return getaddrinfo_ptr ? 1 : 0; ++ ++ done = 1; ++ ++ h = GetModuleHandle ("ws2_32.dll"); ++ ++ if (h) ++ { ++ getaddrinfo_ptr = (getaddrinfo_func) GetProcAddress (h, "getaddrinfo"); ++ freeaddrinfo_ptr = (freeaddrinfo_func) GetProcAddress (h, "freeaddrinfo"); ++ getnameinfo_ptr = (getnameinfo_func) GetProcAddress (h, "getnameinfo"); ++ } ++ ++ /* If either is missing, something is odd. */ ++ if (!getaddrinfo_ptr || !freeaddrinfo_ptr || !getnameinfo_ptr) ++ { ++ getaddrinfo_ptr = NULL; ++ freeaddrinfo_ptr = NULL; ++ getnameinfo_ptr = NULL; ++ return 0; ++ } ++ ++ return 1; ++} ++#endif ++ ++static inline bool ++validate_family (int family) ++{ ++ /* FIXME: Support more families. */ ++#if HAVE_IPV4 ++ if (family == PF_INET) ++ return true; ++#endif ++#if HAVE_IPV6 ++ if (family == PF_INET6) ++ return true; ++#endif ++ if (family == PF_UNSPEC) ++ return true; ++ return false; ++} ++ ++/* Translate name of a service location and/or a service name to set of ++ socket addresses. */ ++int ++getaddrinfo (const char *restrict nodename, ++ const char *restrict servname, ++ const struct addrinfo *restrict hints, ++ struct addrinfo **restrict res) ++{ ++ struct addrinfo *tmp; ++ int port = 0; ++ struct hostent *he; ++ void *storage; ++ size_t size; ++#if HAVE_IPV6 ++ struct v6_pair { ++ struct addrinfo addrinfo; ++ struct sockaddr_in6 sockaddr_in6; ++ }; ++#endif ++#if HAVE_IPV4 ++ struct v4_pair { ++ struct addrinfo addrinfo; ++ struct sockaddr_in sockaddr_in; ++ }; ++#endif ++ ++#ifdef WIN32_NATIVE ++ if (use_win32_p ()) ++ return getaddrinfo_ptr (nodename, servname, hints, res); ++#endif ++ ++ if (hints && (hints->ai_flags & ~(AI_CANONNAME|AI_PASSIVE))) ++ /* FIXME: Support more flags. */ ++ return EAI_BADFLAGS; ++ ++ if (hints && !validate_family (hints->ai_family)) ++ return EAI_FAMILY; ++ ++ if (hints && ++ hints->ai_socktype != SOCK_STREAM && hints->ai_socktype != SOCK_DGRAM) ++ /* FIXME: Support other socktype. */ ++ return EAI_SOCKTYPE; /* FIXME: Better return code? */ ++ ++ if (!nodename) ++ { ++ if (!(hints->ai_flags & AI_PASSIVE)) ++ return EAI_NONAME; ++ ++#ifdef HAVE_IPV6 ++ nodename = (hints->ai_family == AF_INET6) ? "::" : "0.0.0.0"; ++#else ++ nodename = "0.0.0.0"; ++#endif ++ } ++ ++ if (servname) ++ { ++ struct servent *se = NULL; ++ const char *proto = ++ (hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp"; ++ ++ if (hints == NULL || !(hints->ai_flags & AI_NUMERICSERV)) ++ /* FIXME: Use getservbyname_r if available. */ ++ se = getservbyname (servname, proto); ++ ++ if (!se) ++ { ++ char *c; ++ if (!(*servname >= '0' && *servname <= '9')) ++ return EAI_NONAME; ++ port = strtoul (servname, &c, 10); ++ if (*c || port > 0xffff) ++ return EAI_NONAME; ++ port = htons (port); ++ } ++ else ++ port = se->s_port; ++ } ++ ++ /* FIXME: Use gethostbyname_r if available. */ ++ he = gethostbyname (nodename); ++ if (!he || he->h_addr_list[0] == NULL) ++ return EAI_NONAME; ++ ++ switch (he->h_addrtype) ++ { ++#if HAVE_IPV6 ++ case PF_INET6: ++ size = sizeof (struct v6_pair); ++ break; ++#endif ++ ++#if HAVE_IPV4 ++ case PF_INET: ++ size = sizeof (struct v4_pair); ++ break; ++#endif ++ ++ default: ++ return EAI_NODATA; ++ } ++ ++ storage = calloc (1, size); ++ if (!storage) ++ return EAI_MEMORY; ++ ++ switch (he->h_addrtype) ++ { ++#if HAVE_IPV6 ++ case PF_INET6: ++ { ++ struct v6_pair *p = storage; ++ struct sockaddr_in6 *sinp = &p->sockaddr_in6; ++ tmp = &p->addrinfo; ++ ++ if (port) ++ sinp->sin6_port = port; ++ ++ if (he->h_length != sizeof (sinp->sin6_addr)) ++ { ++ free (storage); ++ return EAI_SYSTEM; /* FIXME: Better return code? Set errno? */ ++ } ++ ++ memcpy (&sinp->sin6_addr, he->h_addr_list[0], sizeof sinp->sin6_addr); ++ ++ tmp->ai_addr = (struct sockaddr *) sinp; ++ tmp->ai_addrlen = sizeof *sinp; ++ } ++ break; ++#endif ++ ++#if HAVE_IPV4 ++ case PF_INET: ++ { ++ struct v4_pair *p = storage; ++ struct sockaddr_in *sinp = &p->sockaddr_in; ++ tmp = &p->addrinfo; ++ ++ if (port) ++ sinp->sin_port = port; ++ ++ if (he->h_length != sizeof (sinp->sin_addr)) ++ { ++ free (storage); ++ return EAI_SYSTEM; /* FIXME: Better return code? Set errno? */ ++ } ++ ++ memcpy (&sinp->sin_addr, he->h_addr_list[0], sizeof sinp->sin_addr); ++ ++ tmp->ai_addr = (struct sockaddr *) sinp; ++ tmp->ai_addrlen = sizeof *sinp; ++ } ++ break; ++#endif ++ ++ default: ++ free (storage); ++ return EAI_NODATA; ++ } ++ ++ if (hints && hints->ai_flags & AI_CANONNAME) ++ { ++ const char *cn; ++ if (he->h_name) ++ cn = he->h_name; ++ else ++ cn = nodename; ++ ++ tmp->ai_canonname = strdup (cn); ++ if (!tmp->ai_canonname) ++ { ++ free (storage); ++ return EAI_MEMORY; ++ } ++ } ++ ++ tmp->ai_protocol = (hints) ? hints->ai_protocol : 0; ++ tmp->ai_socktype = (hints) ? hints->ai_socktype : 0; ++ tmp->ai_addr->sa_family = he->h_addrtype; ++ tmp->ai_family = he->h_addrtype; ++ ++ /* FIXME: If more than one address, create linked list of addrinfo's. */ ++ ++ *res = tmp; ++ ++ return 0; ++} ++ ++/* Free `addrinfo' structure AI including associated storage. */ ++void ++freeaddrinfo (struct addrinfo *ai) ++{ ++#ifdef WIN32_NATIVE ++ if (use_win32_p ()) ++ { ++ freeaddrinfo_ptr (ai); ++ return; ++ } ++#endif ++ ++ while (ai) ++ { ++ struct addrinfo *cur; ++ ++ cur = ai; ++ ai = ai->ai_next; ++ ++ free (cur->ai_canonname); ++ free (cur); ++ } ++} ++ ++int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen, ++ char *restrict node, socklen_t nodelen, ++ char *restrict service, socklen_t servicelen, ++ int flags) ++{ ++#ifdef WIN32_NATIVE ++ if (use_win32_p ()) ++ return getnameinfo_ptr (sa, salen, node, nodelen, ++ service, servicelen, flags); ++#endif ++ ++ /* FIXME: Support other flags. */ ++ if ((node && nodelen > 0 && !(flags & NI_NUMERICHOST)) || ++ (service && servicelen > 0 && !(flags & NI_NUMERICHOST)) || ++ (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV))) ++ return EAI_BADFLAGS; ++ ++ if (sa == NULL || salen < sizeof (sa->sa_family)) ++ return EAI_FAMILY; ++ ++ switch (sa->sa_family) ++ { ++#if HAVE_IPV4 ++ case AF_INET: ++ if (salen < sizeof (struct sockaddr_in)) ++ return EAI_FAMILY; ++ break; ++#endif ++#if HAVE_IPV6 ++ case AF_INET6: ++ if (salen < sizeof (struct sockaddr_in6)) ++ return EAI_FAMILY; ++ break; ++#endif ++ default: ++ return EAI_FAMILY; ++ } ++ ++ if (node && nodelen > 0 && flags & NI_NUMERICHOST) ++ { ++ switch (sa->sa_family) ++ { ++#if HAVE_IPV4 ++ case AF_INET: ++ if (!inet_ntop (AF_INET, ++ &(((const struct sockaddr_in *) sa)->sin_addr), ++ node, nodelen)) ++ return EAI_SYSTEM; ++ break; ++#endif ++ ++#if HAVE_IPV6 ++ case AF_INET6: ++ if (!inet_ntop (AF_INET6, ++ &(((const struct sockaddr_in6 *) sa)->sin6_addr), ++ node, nodelen)) ++ return EAI_SYSTEM; ++ break; ++#endif ++ ++ default: ++ return EAI_FAMILY; ++ } ++ } ++ ++ if (service && servicelen > 0 && flags & NI_NUMERICSERV) ++ switch (sa->sa_family) ++ { ++#if HAVE_IPV4 ++ case AF_INET: ++#endif ++#if HAVE_IPV6 ++ case AF_INET6: ++#endif ++ { ++ unsigned short int port ++ = ntohs (((const struct sockaddr_in *) sa)->sin_port); ++ if (servicelen <= snprintf (service, servicelen, "%u", port)) ++ return EAI_OVERFLOW; ++ } ++ break; ++ } ++ ++ return 0; ++} +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/getaddrinfo.h gtk-vnc-0.3.7.gnulib/gnulib/lib/getaddrinfo.h +--- gtk-vnc-0.3.7.mingw/gnulib/lib/getaddrinfo.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/getaddrinfo.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,163 @@ ++/* Get address information. ++ Copyright (C) 1996-2002, 2003, 2004, 2005, 2006, 2008 ++ Free Software Foundation, Inc. ++ Contributed by Simon Josefsson . ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef GETADDRINFO_H ++#define GETADDRINFO_H ++ ++/* sys/socket.h in i386-unknown-freebsd4.10 and ++ powerpc-apple-darwin5.5 require sys/types.h, so include it first. ++ Then we'll also get 'socklen_t' and 'struct sockaddr' which are ++ used below. */ ++#include ++/* Get all getaddrinfo related declarations, if available. */ ++#include ++#ifdef HAVE_NETDB_H ++# include ++#endif ++ ++#ifndef HAVE_STRUCT_ADDRINFO ++ ++/* Structure to contain information about address of a service provider. */ ++struct addrinfo ++{ ++ int ai_flags; /* Input flags. */ ++ int ai_family; /* Protocol family for socket. */ ++ int ai_socktype; /* Socket type. */ ++ int ai_protocol; /* Protocol for socket. */ ++ socklen_t ai_addrlen; /* Length of socket address. */ ++ struct sockaddr *ai_addr; /* Socket address for socket. */ ++ char *ai_canonname; /* Canonical name for service location. */ ++ struct addrinfo *ai_next; /* Pointer to next in list. */ ++}; ++#endif ++ ++/* Possible values for `ai_flags' field in `addrinfo' structure. */ ++#ifndef AI_PASSIVE ++# define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */ ++#endif ++#ifndef AI_CANONNAME ++# define AI_CANONNAME 0x0002 /* Request for canonical name. */ ++#endif ++#ifndef AI_NUMERICSERV ++# define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */ ++#endif ++ ++#if 0 ++/* The commented out definitions below are not yet implemented in the ++ GNULIB getaddrinfo() replacement, so are not yet needed and may, in fact, ++ cause conflicts on systems with a getaddrinfo() function which does not ++ define them. ++ ++ If they are restored, be sure to protect the definitions with #ifndef. */ ++#define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */ ++#define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */ ++#define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */ ++#define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose ++ returned address type.. */ ++#endif /* 0 */ ++ ++/* Error values for `getaddrinfo' function. */ ++#ifndef EAI_BADFLAGS ++# define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */ ++# define EAI_NONAME -2 /* NAME or SERVICE is unknown. */ ++# define EAI_AGAIN -3 /* Temporary failure in name resolution. */ ++# define EAI_FAIL -4 /* Non-recoverable failure in name res. */ ++# define EAI_NODATA -5 /* No address associated with NAME. */ ++# define EAI_FAMILY -6 /* `ai_family' not supported. */ ++# define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */ ++# define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */ ++# define EAI_MEMORY -10 /* Memory allocation failure. */ ++#endif ++ ++/* Since EAI_NODATA is deprecated by RFC3493, some systems (at least ++ FreeBSD, which does define EAI_BADFLAGS) have removed the definition ++ in favor of EAI_NONAME. */ ++#if !defined EAI_NODATA && defined EAI_NONAME ++# define EAI_NODATA EAI_NONAME ++#endif ++ ++#ifndef EAI_OVERFLOW ++/* Not defined on mingw32. */ ++# define EAI_OVERFLOW -12 /* Argument buffer overflow. */ ++#endif ++#ifndef EAI_ADDRFAMILY ++/* Not defined on mingw32. */ ++# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */ ++#endif ++#ifndef EAI_SYSTEM ++/* Not defined on mingw32. */ ++# define EAI_SYSTEM -11 /* System error returned in `errno'. */ ++#endif ++ ++#ifdef __USE_GNU ++# ifndef EAI_INPROGRESS ++# define EAI_INPROGRESS -100 /* Processing request in progress. */ ++# define EAI_CANCELED -101 /* Request canceled. */ ++# define EAI_NOTCANCELED -102 /* Request not canceled. */ ++# define EAI_ALLDONE -103 /* All requests done. */ ++# define EAI_INTR -104 /* Interrupted by a signal. */ ++# define EAI_IDN_ENCODE -105 /* IDN encoding failed. */ ++# endif ++#endif ++ ++#if !HAVE_DECL_GETADDRINFO ++/* Translate name of a service location and/or a service name to set of ++ socket addresses. ++ For more details, see the POSIX:2001 specification ++ . */ ++extern int getaddrinfo (const char *restrict nodename, ++ const char *restrict servname, ++ const struct addrinfo *restrict hints, ++ struct addrinfo **restrict res); ++#endif ++ ++#if !HAVE_DECL_FREEADDRINFO ++/* Free `addrinfo' structure AI including associated storage. ++ For more details, see the POSIX:2001 specification ++ . */ ++extern void freeaddrinfo (struct addrinfo *ai); ++#endif ++ ++#if !HAVE_DECL_GAI_STRERROR ++/* Convert error return from getaddrinfo() to a string. ++ For more details, see the POSIX:2001 specification ++ . */ ++extern const char *gai_strerror (int ecode); ++#endif ++ ++#if !HAVE_DECL_GETNAMEINFO ++/* Convert socket address to printable node and service names. ++ For more details, see the POSIX:2001 specification ++ . */ ++extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen, ++ char *restrict node, socklen_t nodelen, ++ char *restrict service, socklen_t servicelen, ++ int flags); ++ ++#endif ++ ++/* Possible flags for getnameinfo. */ ++#ifndef NI_NUMERICHOST ++# define NI_NUMERICHOST 1 ++#endif ++#ifndef NI_NUMERICSERV ++# define NI_NUMERICSERV 2 ++#endif ++ ++#endif /* GETADDRINFO_H */ +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/gettext.h gtk-vnc-0.3.7.gnulib/gnulib/lib/gettext.h +--- gtk-vnc-0.3.7.mingw/gnulib/lib/gettext.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/gettext.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,270 @@ ++/* Convenience header for conditional use of GNU . ++ Copyright (C) 1995-1998, 2000-2002, 2004-2006 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License along ++ with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef _LIBGETTEXT_H ++#define _LIBGETTEXT_H 1 ++ ++/* NLS can be disabled through the configure --disable-nls option. */ ++#if ENABLE_NLS ++ ++/* Get declarations of GNU message catalog functions. */ ++# include ++ ++/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by ++ the gettext() and ngettext() macros. This is an alternative to calling ++ textdomain(), and is useful for libraries. */ ++# ifdef DEFAULT_TEXT_DOMAIN ++# undef gettext ++# define gettext(Msgid) \ ++ dgettext (DEFAULT_TEXT_DOMAIN, Msgid) ++# undef ngettext ++# define ngettext(Msgid1, Msgid2, N) \ ++ dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N) ++# endif ++ ++#else ++ ++/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which ++ chokes if dcgettext is defined as a macro. So include it now, to make ++ later inclusions of a NOP. We don't include ++ as well because people using "gettext.h" will not include , ++ and also including would fail on SunOS 4, whereas ++ is OK. */ ++#if defined(__sun) ++# include ++#endif ++ ++/* Many header files from the libstdc++ coming with g++ 3.3 or newer include ++ , which chokes if dcgettext is defined as a macro. So include ++ it now, to make later inclusions of a NOP. */ ++#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) ++# include ++# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H ++# include ++# endif ++#endif ++ ++/* Disabled NLS. ++ The casts to 'const char *' serve the purpose of producing warnings ++ for invalid uses of the value returned from these functions. ++ On pre-ANSI systems without 'const', the config.h file is supposed to ++ contain "#define const". */ ++# define gettext(Msgid) ((const char *) (Msgid)) ++# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) ++# define dcgettext(Domainname, Msgid, Category) \ ++ ((void) (Category), dgettext (Domainname, Msgid)) ++# define ngettext(Msgid1, Msgid2, N) \ ++ ((N) == 1 \ ++ ? ((void) (Msgid2), (const char *) (Msgid1)) \ ++ : ((void) (Msgid1), (const char *) (Msgid2))) ++# define dngettext(Domainname, Msgid1, Msgid2, N) \ ++ ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) ++# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ ++ ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N)) ++# define textdomain(Domainname) ((const char *) (Domainname)) ++# define bindtextdomain(Domainname, Dirname) \ ++ ((void) (Domainname), (const char *) (Dirname)) ++# define bind_textdomain_codeset(Domainname, Codeset) \ ++ ((void) (Domainname), (const char *) (Codeset)) ++ ++#endif ++ ++/* A pseudo function call that serves as a marker for the automated ++ extraction of messages, but does not call gettext(). The run-time ++ translation is done at a different place in the code. ++ The argument, String, should be a literal string. Concatenated strings ++ and other string expressions won't work. ++ The macro's expansion is not parenthesized, so that it is suitable as ++ initializer for static 'char[]' or 'const char[]' variables. */ ++#define gettext_noop(String) String ++ ++/* The separator between msgctxt and msgid in a .mo file. */ ++#define GETTEXT_CONTEXT_GLUE "\004" ++ ++/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a ++ MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be ++ short and rarely need to change. ++ The letter 'p' stands for 'particular' or 'special'. */ ++#ifdef DEFAULT_TEXT_DOMAIN ++# define pgettext(Msgctxt, Msgid) \ ++ pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) ++#else ++# define pgettext(Msgctxt, Msgid) \ ++ pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) ++#endif ++#define dpgettext(Domainname, Msgctxt, Msgid) \ ++ pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) ++#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \ ++ pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category) ++#ifdef DEFAULT_TEXT_DOMAIN ++# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ ++ npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) ++#else ++# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ ++ npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) ++#endif ++#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ ++ npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) ++#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \ ++ npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category) ++ ++#ifdef __GNUC__ ++__inline ++#else ++#ifdef __cplusplus ++inline ++#endif ++#endif ++static const char * ++pgettext_aux (const char *domain, ++ const char *msg_ctxt_id, const char *msgid, ++ int category) ++{ ++ const char *translation = dcgettext (domain, msg_ctxt_id, category); ++ if (translation == msg_ctxt_id) ++ return msgid; ++ else ++ return translation; ++} ++ ++#ifdef __GNUC__ ++__inline ++#else ++#ifdef __cplusplus ++inline ++#endif ++#endif ++static const char * ++npgettext_aux (const char *domain, ++ const char *msg_ctxt_id, const char *msgid, ++ const char *msgid_plural, unsigned long int n, ++ int category) ++{ ++ const char *translation = ++ dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); ++ if (translation == msg_ctxt_id || translation == msgid_plural) ++ return (n == 1 ? msgid : msgid_plural); ++ else ++ return translation; ++} ++ ++/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID ++ can be arbitrary expressions. But for string literals these macros are ++ less efficient than those above. */ ++ ++#include ++ ++#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ ++ (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \ ++ /* || __STDC_VERSION__ >= 199901L */ ) ++ ++#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS ++#include ++#endif ++ ++#define pgettext_expr(Msgctxt, Msgid) \ ++ dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES) ++#define dpgettext_expr(Domainname, Msgctxt, Msgid) \ ++ dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES) ++ ++#ifdef __GNUC__ ++__inline ++#else ++#ifdef __cplusplus ++inline ++#endif ++#endif ++static const char * ++dcpgettext_expr (const char *domain, ++ const char *msgctxt, const char *msgid, ++ int category) ++{ ++ size_t msgctxt_len = strlen (msgctxt) + 1; ++ size_t msgid_len = strlen (msgid) + 1; ++ const char *translation; ++#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS ++ char msg_ctxt_id[msgctxt_len + msgid_len]; ++#else ++ char buf[1024]; ++ char *msg_ctxt_id = ++ (msgctxt_len + msgid_len <= sizeof (buf) ++ ? buf ++ : (char *) malloc (msgctxt_len + msgid_len)); ++ if (msg_ctxt_id != NULL) ++#endif ++ { ++ memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); ++ msg_ctxt_id[msgctxt_len - 1] = '\004'; ++ memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); ++ translation = dcgettext (domain, msg_ctxt_id, category); ++#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS ++ if (msg_ctxt_id != buf) ++ free (msg_ctxt_id); ++#endif ++ if (translation != msg_ctxt_id) ++ return translation; ++ } ++ return msgid; ++} ++ ++#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \ ++ dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) ++#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ ++ dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) ++ ++#ifdef __GNUC__ ++__inline ++#else ++#ifdef __cplusplus ++inline ++#endif ++#endif ++static const char * ++dcnpgettext_expr (const char *domain, ++ const char *msgctxt, const char *msgid, ++ const char *msgid_plural, unsigned long int n, ++ int category) ++{ ++ size_t msgctxt_len = strlen (msgctxt) + 1; ++ size_t msgid_len = strlen (msgid) + 1; ++ const char *translation; ++#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS ++ char msg_ctxt_id[msgctxt_len + msgid_len]; ++#else ++ char buf[1024]; ++ char *msg_ctxt_id = ++ (msgctxt_len + msgid_len <= sizeof (buf) ++ ? buf ++ : (char *) malloc (msgctxt_len + msgid_len)); ++ if (msg_ctxt_id != NULL) ++#endif ++ { ++ memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); ++ msg_ctxt_id[msgctxt_len - 1] = '\004'; ++ memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); ++ translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); ++#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS ++ if (msg_ctxt_id != buf) ++ free (msg_ctxt_id); ++#endif ++ if (!(translation == msg_ctxt_id || translation == msgid_plural)) ++ return translation; ++ } ++ return (n == 1 ? msgid : msgid_plural); ++} ++ ++#endif /* _LIBGETTEXT_H */ +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/inet_ntop.c gtk-vnc-0.3.7.gnulib/gnulib/lib/inet_ntop.c +--- gtk-vnc-0.3.7.mingw/gnulib/lib/inet_ntop.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/inet_ntop.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,238 @@ ++/* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form ++ ++ Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++/* ++ * Copyright (c) 1996-1999 by Internet Software Consortium. ++ * ++ * Permission to use, copy, modify, and distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * copyright notice and this permission notice appear in all copies. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS ++ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES ++ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE ++ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL ++ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR ++ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ++ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ++ * SOFTWARE. ++ */ ++ ++#include ++ ++/* Specification. */ ++#include ++ ++#include ++#include ++#include ++ ++#ifndef EAFNOSUPPORT ++# define EAFNOSUPPORT EINVAL ++#endif ++ ++#define NS_IN6ADDRSZ 16 ++#define NS_INT16SZ 2 ++ ++/* ++ * WARNING: Don't even consider trying to compile this on a system where ++ * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. ++ */ ++typedef int verify_int_size[2 * sizeof (int) - 7]; ++ ++static const char *inet_ntop4 (const unsigned char *src, char *dst, socklen_t size); ++#if HAVE_IPV6 ++static const char *inet_ntop6 (const unsigned char *src, char *dst, socklen_t size); ++#endif ++ ++ ++/* char * ++ * inet_ntop(af, src, dst, size) ++ * convert a network format address to presentation format. ++ * return: ++ * pointer to presentation format address (`dst'), or NULL (see errno). ++ * author: ++ * Paul Vixie, 1996. ++ */ ++const char * ++inet_ntop (int af, const void *restrict src, ++ char *restrict dst, socklen_t cnt) ++{ ++ switch (af) ++ { ++#if HAVE_IPV4 ++ case AF_INET: ++ return (inet_ntop4 (src, dst, cnt)); ++#endif ++ ++#if HAVE_IPV6 ++ case AF_INET6: ++ return (inet_ntop6 (src, dst, cnt)); ++#endif ++ ++ default: ++ errno = EAFNOSUPPORT; ++ return (NULL); ++ } ++ /* NOTREACHED */ ++} ++ ++/* const char * ++ * inet_ntop4(src, dst, size) ++ * format an IPv4 address ++ * return: ++ * `dst' (as a const) ++ * notes: ++ * (1) uses no statics ++ * (2) takes a u_char* not an in_addr as input ++ * author: ++ * Paul Vixie, 1996. ++ */ ++static const char * ++inet_ntop4 (const unsigned char *src, char *dst, socklen_t size) ++{ ++ char tmp[sizeof "255.255.255.255"]; ++ int len; ++ ++ len = sprintf (tmp, "%u.%u.%u.%u", src[0], src[1], src[2], src[3]); ++ if (len < 0) ++ return NULL; ++ ++ if (len > size) ++ { ++ errno = ENOSPC; ++ return NULL; ++ } ++ ++ return strcpy (dst, tmp); ++} ++ ++#if HAVE_IPV6 ++ ++/* const char * ++ * inet_ntop6(src, dst, size) ++ * convert IPv6 binary address into presentation (printable) format ++ * author: ++ * Paul Vixie, 1996. ++ */ ++static const char * ++inet_ntop6 (const unsigned char *src, char *dst, socklen_t size) ++{ ++ /* ++ * Note that int32_t and int16_t need only be "at least" large enough ++ * to contain a value of the specified size. On some systems, like ++ * Crays, there is no such thing as an integer variable with 16 bits. ++ * Keep this in mind if you think this function should have been coded ++ * to use pointer overlays. All the world's not a VAX. ++ */ ++ char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp; ++ struct ++ { ++ int base, len; ++ } best, cur; ++ unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ]; ++ int i; ++ ++ /* ++ * Preprocess: ++ * Copy the input (bytewise) array into a wordwise array. ++ * Find the longest run of 0x00's in src[] for :: shorthanding. ++ */ ++ memset (words, '\0', sizeof words); ++ for (i = 0; i < NS_IN6ADDRSZ; i += 2) ++ words[i / 2] = (src[i] << 8) | src[i + 1]; ++ best.base = -1; ++ cur.base = -1; ++ for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) ++ { ++ if (words[i] == 0) ++ { ++ if (cur.base == -1) ++ cur.base = i, cur.len = 1; ++ else ++ cur.len++; ++ } ++ else ++ { ++ if (cur.base != -1) ++ { ++ if (best.base == -1 || cur.len > best.len) ++ best = cur; ++ cur.base = -1; ++ } ++ } ++ } ++ if (cur.base != -1) ++ { ++ if (best.base == -1 || cur.len > best.len) ++ best = cur; ++ } ++ if (best.base != -1 && best.len < 2) ++ best.base = -1; ++ ++ /* ++ * Format the result. ++ */ ++ tp = tmp; ++ for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) ++ { ++ /* Are we inside the best run of 0x00's? */ ++ if (best.base != -1 && i >= best.base && i < (best.base + best.len)) ++ { ++ if (i == best.base) ++ *tp++ = ':'; ++ continue; ++ } ++ /* Are we following an initial run of 0x00s or any real hex? */ ++ if (i != 0) ++ *tp++ = ':'; ++ /* Is this address an encapsulated IPv4? */ ++ if (i == 6 && best.base == 0 && ++ (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) ++ { ++ if (!inet_ntop4 (src + 12, tp, sizeof tmp - (tp - tmp))) ++ return (NULL); ++ tp += strlen (tp); ++ break; ++ } ++ { ++ int len = sprintf (tp, "%x", words[i]); ++ if (len < 0) ++ return NULL; ++ tp += len; ++ } ++ } ++ /* Was it a trailing run of 0x00's? */ ++ if (best.base != -1 && (best.base + best.len) == ++ (NS_IN6ADDRSZ / NS_INT16SZ)) ++ *tp++ = ':'; ++ *tp++ = '\0'; ++ ++ /* ++ * Check for overflow, copy, and we're done. ++ */ ++ if ((socklen_t) (tp - tmp) > size) ++ { ++ errno = ENOSPC; ++ return NULL; ++ } ++ ++ return strcpy (dst, tmp); ++} ++ ++#endif +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/Makefile.am gtk-vnc-0.3.7.gnulib/gnulib/lib/Makefile.am +--- gtk-vnc-0.3.7.mingw/gnulib/lib/Makefile.am 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/Makefile.am 2008-10-09 12:33:42.000000000 +0100 +@@ -0,0 +1,484 @@ ++## DO NOT EDIT! GENERATED AUTOMATICALLY! ++## Process this file with automake to produce Makefile.in. ++# Copyright (C) 2002-2008 Free Software Foundation, Inc. ++# ++# This file is free software, distributed under the terms of the GNU ++# General Public License. As a special exception to the GNU General ++# Public License, this file may be distributed as part of a program ++# that contains a configuration script generated by Autoconf, under ++# the same distribution terms as the rest of that program. ++# ++# Generated by gnulib-tool. ++# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --tests-base=gnulib/tests --aux-dir=. --with-tests --lgpl=2 --libtool --macro-prefix=gl connect getaddrinfo recv send socket vc-list-files ++ ++AUTOMAKE_OPTIONS = 1.5 gnits ++ ++SUBDIRS = ++noinst_HEADERS = ++noinst_LIBRARIES = ++noinst_LTLIBRARIES = ++EXTRA_DIST = ++BUILT_SOURCES = ++SUFFIXES = ++MOSTLYCLEANFILES = core *.stackdump ++MOSTLYCLEANDIRS = ++CLEANFILES = ++DISTCLEANFILES = ++MAINTAINERCLEANFILES = ++ ++AM_CPPFLAGS = ++ ++noinst_LTLIBRARIES += libgnu.la ++ ++libgnu_la_SOURCES = ++libgnu_la_LIBADD = $(gl_LTLIBOBJS) ++libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS) ++EXTRA_libgnu_la_SOURCES = ++libgnu_la_LDFLAGS = $(AM_LDFLAGS) ++ ++## begin gnulib module alloca-opt ++ ++BUILT_SOURCES += $(ALLOCA_H) ++ ++# We need the following in order to create when the system ++# doesn't have one that works with the given compiler. ++alloca.h: alloca.in.h ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ cat $(srcdir)/alloca.in.h; \ ++ } > $@-t ++ mv -f $@-t $@ ++MOSTLYCLEANFILES += alloca.h alloca.h-t ++ ++EXTRA_DIST += alloca.in.h ++ ++## end gnulib module alloca-opt ++ ++## begin gnulib module arpa_inet ++ ++BUILT_SOURCES += $(ARPA_INET_H) ++ ++# We need the following in order to create when the system ++# doesn't have one. ++arpa/inet.h: ++ @MKDIR_P@ arpa ++ rm -f $@-t $@ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''NEXT_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \ ++ -e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \ ++ -e 's|@''GNULIB_INET_NTOP''@|$(GNULIB_INET_NTOP)|g' \ ++ -e 's|@''GNULIB_INET_PTON''@|$(GNULIB_INET_PTON)|g' \ ++ -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \ ++ -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \ ++ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ ++ < $(srcdir)/arpa_inet.in.h; \ ++ } > $@-t ++ mv $@-t $@ ++MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t ++MOSTLYCLEANDIRS += arpa ++ ++EXTRA_DIST += arpa_inet.in.h ++ ++## end gnulib module arpa_inet ++ ++## begin gnulib module connect ++ ++ ++EXTRA_DIST += winsock.c ++ ++EXTRA_libgnu_la_SOURCES += winsock.c ++ ++## end gnulib module connect ++ ++## begin gnulib module errno ++ ++BUILT_SOURCES += $(ERRNO_H) ++ ++# We need the following in order to create when the system ++# doesn't have one that is POSIX compliant. ++errno.h: errno.in.h ++ rm -f $@-t $@ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ ++ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \ ++ -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \ ++ -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \ ++ -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \ ++ -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \ ++ -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \ ++ -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \ ++ < $(srcdir)/errno.in.h; \ ++ } > $@-t ++ mv $@-t $@ ++MOSTLYCLEANFILES += errno.h errno.h-t ++ ++EXTRA_DIST += errno.in.h ++ ++## end gnulib module errno ++ ++## begin gnulib module float ++ ++BUILT_SOURCES += $(FLOAT_H) ++ ++# We need the following in order to create when the system ++# doesn't have one that works with the given compiler. ++float.h: float.in.h ++ rm -f $@-t $@ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ ++ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \ ++ < $(srcdir)/float.in.h; \ ++ } > $@-t ++ mv $@-t $@ ++MOSTLYCLEANFILES += float.h float.h-t ++ ++EXTRA_DIST += float.in.h ++ ++## end gnulib module float ++ ++## begin gnulib module getaddrinfo ++ ++ ++EXTRA_DIST += gai_strerror.c getaddrinfo.c getaddrinfo.h ++ ++EXTRA_libgnu_la_SOURCES += gai_strerror.c getaddrinfo.c ++ ++## end gnulib module getaddrinfo ++ ++## begin gnulib module gettext-h ++ ++libgnu_la_SOURCES += gettext.h ++ ++## end gnulib module gettext-h ++ ++## begin gnulib module inet_ntop ++ ++ ++EXTRA_DIST += inet_ntop.c ++ ++EXTRA_libgnu_la_SOURCES += inet_ntop.c ++ ++## end gnulib module inet_ntop ++ ++## begin gnulib module link-warning ++ ++LINK_WARNING_H=$(top_srcdir)/./link-warning.h ++ ++EXTRA_DIST += $(top_srcdir)/./link-warning.h ++ ++## end gnulib module link-warning ++ ++## begin gnulib module netinet_in ++ ++BUILT_SOURCES += $(NETINET_IN_H) ++ ++# We need the following in order to create when the system ++# doesn't have one. ++netinet/in.h: netinet_in.in.h ++ @MKDIR_P@ netinet ++ rm -f $@-t $@ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''NEXT_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \ ++ -e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \ ++ < $(srcdir)/netinet_in.in.h; \ ++ } > $@-t ++ mv $@-t $@ ++MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t ++MOSTLYCLEANDIRS += netinet ++ ++EXTRA_DIST += netinet_in.in.h ++ ++## end gnulib module netinet_in ++ ++## begin gnulib module recv ++ ++ ++EXTRA_DIST += winsock.c ++ ++EXTRA_libgnu_la_SOURCES += winsock.c ++ ++## end gnulib module recv ++ ++## begin gnulib module send ++ ++ ++EXTRA_DIST += winsock.c ++ ++EXTRA_libgnu_la_SOURCES += winsock.c ++ ++## end gnulib module send ++ ++## begin gnulib module size_max ++ ++libgnu_la_SOURCES += size_max.h ++ ++## end gnulib module size_max ++ ++## begin gnulib module snprintf ++ ++ ++EXTRA_DIST += snprintf.c ++ ++EXTRA_libgnu_la_SOURCES += snprintf.c ++ ++## end gnulib module snprintf ++ ++## begin gnulib module socket ++ ++ ++EXTRA_DIST += winsock.c ++ ++EXTRA_libgnu_la_SOURCES += winsock.c ++ ++## end gnulib module socket ++ ++## begin gnulib module stdbool ++ ++BUILT_SOURCES += $(STDBOOL_H) ++ ++# We need the following in order to create when the system ++# doesn't have one that works. ++stdbool.h: stdbool.in.h ++ rm -f $@-t $@ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ ++ } > $@-t ++ mv $@-t $@ ++MOSTLYCLEANFILES += stdbool.h stdbool.h-t ++ ++EXTRA_DIST += stdbool.in.h ++ ++## end gnulib module stdbool ++ ++## begin gnulib module stdint ++ ++BUILT_SOURCES += $(STDINT_H) ++ ++# We need the following in order to create when the system ++# doesn't have one that works with the given compiler. ++stdint.h: stdint.in.h ++ rm -f $@-t $@ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ ++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ ++ -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ ++ -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ ++ -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ ++ -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ ++ -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ ++ -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ ++ -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ ++ -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ ++ -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ ++ -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \ ++ -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \ ++ -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \ ++ -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \ ++ -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \ ++ -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \ ++ -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \ ++ -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ ++ -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ ++ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ ++ < $(srcdir)/stdint.in.h; \ ++ } > $@-t ++ mv $@-t $@ ++MOSTLYCLEANFILES += stdint.h stdint.h-t ++ ++EXTRA_DIST += stdint.in.h ++ ++## end gnulib module stdint ++ ++## begin gnulib module stdio ++ ++BUILT_SOURCES += stdio.h ++ ++# We need the following in order to create when the system ++# doesn't have one that works with the given compiler. ++stdio.h: stdio.in.h ++ rm -f $@-t $@ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ ++ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ ++ -e 's|@''GNULIB_FPRINTF''@|$(GNULIB_FPRINTF)|g' \ ++ -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \ ++ -e 's|@''GNULIB_PRINTF''@|$(GNULIB_PRINTF)|g' \ ++ -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \ ++ -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \ ++ -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \ ++ -e 's|@''GNULIB_VFPRINTF''@|$(GNULIB_VFPRINTF)|g' \ ++ -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \ ++ -e 's|@''GNULIB_VPRINTF''@|$(GNULIB_VPRINTF)|g' \ ++ -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \ ++ -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \ ++ -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \ ++ -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \ ++ -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \ ++ -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \ ++ -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \ ++ -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \ ++ -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \ ++ -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \ ++ -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \ ++ -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \ ++ -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \ ++ -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \ ++ -e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \ ++ -e 's|@''GNULIB_PUTCHAR''@|$(GNULIB_PUTCHAR)|g' \ ++ -e 's|@''GNULIB_FPUTS''@|$(GNULIB_FPUTS)|g' \ ++ -e 's|@''GNULIB_PUTS''@|$(GNULIB_PUTS)|g' \ ++ -e 's|@''GNULIB_FWRITE''@|$(GNULIB_FWRITE)|g' \ ++ -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \ ++ -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \ ++ -e 's|@''GNULIB_PERROR''@|$(GNULIB_PERROR)|g' \ ++ -e 's|@''GNULIB_STDIO_H_SIGPIPE''@|$(GNULIB_STDIO_H_SIGPIPE)|g' \ ++ -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \ ++ -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \ ++ -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \ ++ -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \ ++ -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \ ++ -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \ ++ -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \ ++ -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \ ++ -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \ ++ -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \ ++ -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \ ++ -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ ++ -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ ++ -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \ ++ -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \ ++ -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \ ++ -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \ ++ -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \ ++ -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \ ++ -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \ ++ -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \ ++ -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \ ++ -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ ++ -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ ++ -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \ ++ -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \ ++ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ ++ < $(srcdir)/stdio.in.h; \ ++ } > $@-t ++ mv $@-t $@ ++MOSTLYCLEANFILES += stdio.h stdio.h-t ++ ++EXTRA_DIST += stdio-write.c stdio.in.h ++ ++EXTRA_libgnu_la_SOURCES += stdio-write.c ++ ++## end gnulib module stdio ++ ++## begin gnulib module sys_socket ++ ++BUILT_SOURCES += $(SYS_SOCKET_H) ++ ++# We need the following in order to create when the system ++# doesn't have one that works with the given compiler. ++sys/socket.h: sys_socket.in.h ++ @MKDIR_P@ sys ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \ ++ -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \ ++ -e 's|@''GNULIB_SOCKET''@|$(GNULIB_SOCKET)|g' \ ++ -e 's|@''GNULIB_CONNECT''@|$(GNULIB_CONNECT)|g' \ ++ -e 's|@''GNULIB_ACCEPT''@|$(GNULIB_ACCEPT)|g' \ ++ -e 's|@''GNULIB_BIND''@|$(GNULIB_BIND)|g' \ ++ -e 's|@''GNULIB_GETPEERNAME''@|$(GNULIB_GETPEERNAME)|g' \ ++ -e 's|@''GNULIB_GETSOCKNAME''@|$(GNULIB_GETSOCKNAME)|g' \ ++ -e 's|@''GNULIB_GETSOCKOPT''@|$(GNULIB_GETSOCKOPT)|g' \ ++ -e 's|@''GNULIB_LISTEN''@|$(GNULIB_LISTEN)|g' \ ++ -e 's|@''GNULIB_RECV''@|$(GNULIB_RECV)|g' \ ++ -e 's|@''GNULIB_SEND''@|$()GNULIB_SEND|g' \ ++ -e 's|@''GNULIB_RECVFROM''@|$(GNULIB_RECVFROM)|g' \ ++ -e 's|@''GNULIB_SENDTO''@|$(GNULIB_SENDTO)|g' \ ++ -e 's|@''GNULIB_SETSOCKOPT''@|$(GNULIB_SETSOCKOPT)|g' \ ++ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ ++ -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ ++ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ ++ < $(srcdir)/sys_socket.in.h; \ ++ } > $@-t ++ mv -f $@-t $@ ++MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t ++MOSTLYCLEANDIRS += sys ++ ++EXTRA_DIST += sys_socket.in.h winsock.c ++ ++EXTRA_libgnu_la_SOURCES += winsock.c ++ ++## end gnulib module sys_socket ++ ++## begin gnulib module vasnprintf ++ ++ ++EXTRA_DIST += asnprintf.c float+.h printf-args.c printf-args.h printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h ++ ++EXTRA_libgnu_la_SOURCES += asnprintf.c printf-args.c printf-parse.c vasnprintf.c ++ ++## end gnulib module vasnprintf ++ ++## begin gnulib module vc-list-files ++ ++ ++EXTRA_DIST += $(top_srcdir)/./vc-list-files ++ ++## end gnulib module vc-list-files ++ ++## begin gnulib module wchar ++ ++BUILT_SOURCES += $(WCHAR_H) ++ ++# We need the following in order to create when the system ++# version does not work standalone. ++wchar.h: wchar.in.h ++ rm -f $@-t $@ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ ++ -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ ++ -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \ ++ -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ ++ -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ ++ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ ++ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ ++ < $(srcdir)/wchar.in.h; \ ++ } > $@-t ++ mv $@-t $@ ++MOSTLYCLEANFILES += wchar.h wchar.h-t ++ ++EXTRA_DIST += wchar.in.h ++ ++## end gnulib module wchar ++ ++## begin gnulib module xsize ++ ++libgnu_la_SOURCES += xsize.h ++ ++## end gnulib module xsize ++ ++## begin gnulib module dummy ++ ++libgnu_la_SOURCES += dummy.c ++ ++## end gnulib module dummy ++ ++ ++mostlyclean-local: mostlyclean-generic ++ @for dir in '' $(MOSTLYCLEANDIRS); do \ ++ if test -n "$$dir" && test -d $$dir; then \ ++ echo "rmdir $$dir"; rmdir $$dir; \ ++ fi; \ ++ done; \ ++ : +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/Makefile.am~ gtk-vnc-0.3.7.gnulib/gnulib/lib/Makefile.am~ +--- gtk-vnc-0.3.7.mingw/gnulib/lib/Makefile.am~ 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/Makefile.am~ 2008-10-09 12:24:40.000000000 +0100 +@@ -0,0 +1,448 @@ ++## DO NOT EDIT! GENERATED AUTOMATICALLY! ++## Process this file with automake to produce Makefile.in. ++# Copyright (C) 2002-2008 Free Software Foundation, Inc. ++# ++# This file is free software, distributed under the terms of the GNU ++# General Public License. As a special exception to the GNU General ++# Public License, this file may be distributed as part of a program ++# that contains a configuration script generated by Autoconf, under ++# the same distribution terms as the rest of that program. ++# ++# Generated by gnulib-tool. ++# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --tests-base=gnulib/tests --aux-dir=. --with-tests --lgpl=2 --libtool --macro-prefix=gl getaddrinfo vc-list-files ++ ++AUTOMAKE_OPTIONS = 1.5 gnits ++ ++SUBDIRS = ++noinst_HEADERS = ++noinst_LIBRARIES = ++noinst_LTLIBRARIES = ++EXTRA_DIST = ++BUILT_SOURCES = ++SUFFIXES = ++MOSTLYCLEANFILES = core *.stackdump ++MOSTLYCLEANDIRS = ++CLEANFILES = ++DISTCLEANFILES = ++MAINTAINERCLEANFILES = ++ ++AM_CPPFLAGS = ++ ++noinst_LTLIBRARIES += libgnu.la ++ ++libgnu_la_SOURCES = ++libgnu_la_LIBADD = $(gl_LTLIBOBJS) ++libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS) ++EXTRA_libgnu_la_SOURCES = ++libgnu_la_LDFLAGS = $(AM_LDFLAGS) ++ ++## begin gnulib module alloca-opt ++ ++BUILT_SOURCES += $(ALLOCA_H) ++ ++# We need the following in order to create when the system ++# doesn't have one that works with the given compiler. ++alloca.h: alloca.in.h ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ cat $(srcdir)/alloca.in.h; \ ++ } > $@-t ++ mv -f $@-t $@ ++MOSTLYCLEANFILES += alloca.h alloca.h-t ++ ++EXTRA_DIST += alloca.in.h ++ ++## end gnulib module alloca-opt ++ ++## begin gnulib module arpa_inet ++ ++BUILT_SOURCES += $(ARPA_INET_H) ++ ++# We need the following in order to create when the system ++# doesn't have one. ++arpa/inet.h: ++ @MKDIR_P@ arpa ++ rm -f $@-t $@ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''NEXT_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \ ++ -e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \ ++ -e 's|@''GNULIB_INET_NTOP''@|$(GNULIB_INET_NTOP)|g' \ ++ -e 's|@''GNULIB_INET_PTON''@|$(GNULIB_INET_PTON)|g' \ ++ -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \ ++ -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \ ++ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ ++ < $(srcdir)/arpa_inet.in.h; \ ++ } > $@-t ++ mv $@-t $@ ++MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t ++MOSTLYCLEANDIRS += arpa ++ ++EXTRA_DIST += arpa_inet.in.h ++ ++## end gnulib module arpa_inet ++ ++## begin gnulib module errno ++ ++BUILT_SOURCES += $(ERRNO_H) ++ ++# We need the following in order to create when the system ++# doesn't have one that is POSIX compliant. ++errno.h: errno.in.h ++ rm -f $@-t $@ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ ++ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \ ++ -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \ ++ -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \ ++ -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \ ++ -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \ ++ -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \ ++ -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \ ++ < $(srcdir)/errno.in.h; \ ++ } > $@-t ++ mv $@-t $@ ++MOSTLYCLEANFILES += errno.h errno.h-t ++ ++EXTRA_DIST += errno.in.h ++ ++## end gnulib module errno ++ ++## begin gnulib module float ++ ++BUILT_SOURCES += $(FLOAT_H) ++ ++# We need the following in order to create when the system ++# doesn't have one that works with the given compiler. ++float.h: float.in.h ++ rm -f $@-t $@ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ ++ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \ ++ < $(srcdir)/float.in.h; \ ++ } > $@-t ++ mv $@-t $@ ++MOSTLYCLEANFILES += float.h float.h-t ++ ++EXTRA_DIST += float.in.h ++ ++## end gnulib module float ++ ++## begin gnulib module getaddrinfo ++ ++ ++EXTRA_DIST += gai_strerror.c getaddrinfo.c getaddrinfo.h ++ ++EXTRA_libgnu_la_SOURCES += gai_strerror.c getaddrinfo.c ++ ++## end gnulib module getaddrinfo ++ ++## begin gnulib module gettext-h ++ ++libgnu_la_SOURCES += gettext.h ++ ++## end gnulib module gettext-h ++ ++## begin gnulib module inet_ntop ++ ++ ++EXTRA_DIST += inet_ntop.c ++ ++EXTRA_libgnu_la_SOURCES += inet_ntop.c ++ ++## end gnulib module inet_ntop ++ ++## begin gnulib module link-warning ++ ++LINK_WARNING_H=$(top_srcdir)/./link-warning.h ++ ++EXTRA_DIST += $(top_srcdir)/./link-warning.h ++ ++## end gnulib module link-warning ++ ++## begin gnulib module netinet_in ++ ++BUILT_SOURCES += $(NETINET_IN_H) ++ ++# We need the following in order to create when the system ++# doesn't have one. ++netinet/in.h: netinet_in.in.h ++ @MKDIR_P@ netinet ++ rm -f $@-t $@ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''NEXT_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \ ++ -e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \ ++ < $(srcdir)/netinet_in.in.h; \ ++ } > $@-t ++ mv $@-t $@ ++MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t ++MOSTLYCLEANDIRS += netinet ++ ++EXTRA_DIST += netinet_in.in.h ++ ++## end gnulib module netinet_in ++ ++## begin gnulib module size_max ++ ++libgnu_la_SOURCES += size_max.h ++ ++## end gnulib module size_max ++ ++## begin gnulib module snprintf ++ ++ ++EXTRA_DIST += snprintf.c ++ ++EXTRA_libgnu_la_SOURCES += snprintf.c ++ ++## end gnulib module snprintf ++ ++## begin gnulib module stdbool ++ ++BUILT_SOURCES += $(STDBOOL_H) ++ ++# We need the following in order to create when the system ++# doesn't have one that works. ++stdbool.h: stdbool.in.h ++ rm -f $@-t $@ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ ++ } > $@-t ++ mv $@-t $@ ++MOSTLYCLEANFILES += stdbool.h stdbool.h-t ++ ++EXTRA_DIST += stdbool.in.h ++ ++## end gnulib module stdbool ++ ++## begin gnulib module stdint ++ ++BUILT_SOURCES += $(STDINT_H) ++ ++# We need the following in order to create when the system ++# doesn't have one that works with the given compiler. ++stdint.h: stdint.in.h ++ rm -f $@-t $@ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ ++ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ ++ -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ ++ -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ ++ -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ ++ -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ ++ -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ ++ -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ ++ -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ ++ -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ ++ -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ ++ -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \ ++ -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \ ++ -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \ ++ -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \ ++ -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \ ++ -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \ ++ -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \ ++ -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ ++ -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ ++ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ ++ < $(srcdir)/stdint.in.h; \ ++ } > $@-t ++ mv $@-t $@ ++MOSTLYCLEANFILES += stdint.h stdint.h-t ++ ++EXTRA_DIST += stdint.in.h ++ ++## end gnulib module stdint ++ ++## begin gnulib module stdio ++ ++BUILT_SOURCES += stdio.h ++ ++# We need the following in order to create when the system ++# doesn't have one that works with the given compiler. ++stdio.h: stdio.in.h ++ rm -f $@-t $@ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ ++ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ ++ -e 's|@''GNULIB_FPRINTF''@|$(GNULIB_FPRINTF)|g' \ ++ -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \ ++ -e 's|@''GNULIB_PRINTF''@|$(GNULIB_PRINTF)|g' \ ++ -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \ ++ -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \ ++ -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \ ++ -e 's|@''GNULIB_VFPRINTF''@|$(GNULIB_VFPRINTF)|g' \ ++ -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \ ++ -e 's|@''GNULIB_VPRINTF''@|$(GNULIB_VPRINTF)|g' \ ++ -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \ ++ -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \ ++ -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \ ++ -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \ ++ -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \ ++ -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \ ++ -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \ ++ -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \ ++ -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \ ++ -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \ ++ -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \ ++ -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \ ++ -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \ ++ -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \ ++ -e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \ ++ -e 's|@''GNULIB_PUTCHAR''@|$(GNULIB_PUTCHAR)|g' \ ++ -e 's|@''GNULIB_FPUTS''@|$(GNULIB_FPUTS)|g' \ ++ -e 's|@''GNULIB_PUTS''@|$(GNULIB_PUTS)|g' \ ++ -e 's|@''GNULIB_FWRITE''@|$(GNULIB_FWRITE)|g' \ ++ -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \ ++ -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \ ++ -e 's|@''GNULIB_PERROR''@|$(GNULIB_PERROR)|g' \ ++ -e 's|@''GNULIB_STDIO_H_SIGPIPE''@|$(GNULIB_STDIO_H_SIGPIPE)|g' \ ++ -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \ ++ -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \ ++ -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \ ++ -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \ ++ -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \ ++ -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \ ++ -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \ ++ -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \ ++ -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \ ++ -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \ ++ -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \ ++ -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ ++ -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ ++ -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \ ++ -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \ ++ -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \ ++ -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \ ++ -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \ ++ -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \ ++ -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \ ++ -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \ ++ -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \ ++ -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ ++ -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ ++ -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \ ++ -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \ ++ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ ++ < $(srcdir)/stdio.in.h; \ ++ } > $@-t ++ mv $@-t $@ ++MOSTLYCLEANFILES += stdio.h stdio.h-t ++ ++EXTRA_DIST += stdio-write.c stdio.in.h ++ ++EXTRA_libgnu_la_SOURCES += stdio-write.c ++ ++## end gnulib module stdio ++ ++## begin gnulib module sys_socket ++ ++BUILT_SOURCES += $(SYS_SOCKET_H) ++ ++# We need the following in order to create when the system ++# doesn't have one that works with the given compiler. ++sys/socket.h: sys_socket.in.h ++ @MKDIR_P@ sys ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \ ++ -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \ ++ -e 's|@''GNULIB_SOCKET''@|$(GNULIB_SOCKET)|g' \ ++ -e 's|@''GNULIB_CONNECT''@|$(GNULIB_CONNECT)|g' \ ++ -e 's|@''GNULIB_ACCEPT''@|$(GNULIB_ACCEPT)|g' \ ++ -e 's|@''GNULIB_BIND''@|$(GNULIB_BIND)|g' \ ++ -e 's|@''GNULIB_GETPEERNAME''@|$(GNULIB_GETPEERNAME)|g' \ ++ -e 's|@''GNULIB_GETSOCKNAME''@|$(GNULIB_GETSOCKNAME)|g' \ ++ -e 's|@''GNULIB_GETSOCKOPT''@|$(GNULIB_GETSOCKOPT)|g' \ ++ -e 's|@''GNULIB_LISTEN''@|$(GNULIB_LISTEN)|g' \ ++ -e 's|@''GNULIB_RECV''@|$(GNULIB_RECV)|g' \ ++ -e 's|@''GNULIB_SEND''@|$()GNULIB_SEND|g' \ ++ -e 's|@''GNULIB_RECVFROM''@|$(GNULIB_RECVFROM)|g' \ ++ -e 's|@''GNULIB_SENDTO''@|$(GNULIB_SENDTO)|g' \ ++ -e 's|@''GNULIB_SETSOCKOPT''@|$(GNULIB_SETSOCKOPT)|g' \ ++ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ ++ -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ ++ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ ++ < $(srcdir)/sys_socket.in.h; \ ++ } > $@-t ++ mv -f $@-t $@ ++MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t ++MOSTLYCLEANDIRS += sys ++ ++EXTRA_DIST += sys_socket.in.h winsock.c ++ ++EXTRA_libgnu_la_SOURCES += winsock.c ++ ++## end gnulib module sys_socket ++ ++## begin gnulib module vasnprintf ++ ++ ++EXTRA_DIST += asnprintf.c float+.h printf-args.c printf-args.h printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h ++ ++EXTRA_libgnu_la_SOURCES += asnprintf.c printf-args.c printf-parse.c vasnprintf.c ++ ++## end gnulib module vasnprintf ++ ++## begin gnulib module vc-list-files ++ ++ ++EXTRA_DIST += $(top_srcdir)/./vc-list-files ++ ++## end gnulib module vc-list-files ++ ++## begin gnulib module wchar ++ ++BUILT_SOURCES += $(WCHAR_H) ++ ++# We need the following in order to create when the system ++# version does not work standalone. ++wchar.h: wchar.in.h ++ rm -f $@-t $@ ++ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ++ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ ++ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ ++ -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ ++ -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ ++ -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \ ++ -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ ++ -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ ++ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ ++ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ ++ < $(srcdir)/wchar.in.h; \ ++ } > $@-t ++ mv $@-t $@ ++MOSTLYCLEANFILES += wchar.h wchar.h-t ++ ++EXTRA_DIST += wchar.in.h ++ ++## end gnulib module wchar ++ ++## begin gnulib module xsize ++ ++libgnu_la_SOURCES += xsize.h ++ ++## end gnulib module xsize ++ ++## begin gnulib module dummy ++ ++libgnu_la_SOURCES += dummy.c ++ ++## end gnulib module dummy ++ ++ ++mostlyclean-local: mostlyclean-generic ++ @for dir in '' $(MOSTLYCLEANDIRS); do \ ++ if test -n "$$dir" && test -d $$dir; then \ ++ echo "rmdir $$dir"; rmdir $$dir; \ ++ fi; \ ++ done; \ ++ : +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/netinet_in.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/netinet_in.in.h +--- gtk-vnc-0.3.7.mingw/gnulib/lib/netinet_in.in.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/netinet_in.in.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,45 @@ ++/* Substitute for . ++ Copyright (C) 2007-2008 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef _GL_NETINET_IN_H ++ ++#if @HAVE_NETINET_IN_H@ ++ ++@PRAGMA_SYSTEM_HEADER@ ++ ++/* On many platforms, assumes prior inclusion of ++ . */ ++# include ++ ++/* The include_next requires a split double-inclusion guard. */ ++# @INCLUDE_NEXT@ @NEXT_NETINET_IN_H@ ++ ++#endif ++ ++#ifndef _GL_NETINET_IN_H ++#define _GL_NETINET_IN_H ++ ++#if !@HAVE_NETINET_IN_H@ ++ ++/* A platform that lacks . */ ++ ++# include ++ ++#endif ++ ++#endif /* _GL_NETINET_IN_H */ ++#endif /* _GL_NETINET_IN_H */ +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/printf-args.c gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-args.c +--- gtk-vnc-0.3.7.mingw/gnulib/lib/printf-args.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-args.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,187 @@ ++/* Decomposed printf argument list. ++ Copyright (C) 1999, 2002-2003, 2005-2007 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License along ++ with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++/* This file can be parametrized with the following macros: ++ ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. ++ PRINTF_FETCHARGS Name of the function to be defined. ++ STATIC Set to 'static' to declare the function static. */ ++ ++#ifndef PRINTF_FETCHARGS ++# include ++#endif ++ ++/* Specification. */ ++#ifndef PRINTF_FETCHARGS ++# include "printf-args.h" ++#endif ++ ++#ifdef STATIC ++STATIC ++#endif ++int ++PRINTF_FETCHARGS (va_list args, arguments *a) ++{ ++ size_t i; ++ argument *ap; ++ ++ for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++) ++ switch (ap->type) ++ { ++ case TYPE_SCHAR: ++ ap->a.a_schar = va_arg (args, /*signed char*/ int); ++ break; ++ case TYPE_UCHAR: ++ ap->a.a_uchar = va_arg (args, /*unsigned char*/ int); ++ break; ++ case TYPE_SHORT: ++ ap->a.a_short = va_arg (args, /*short*/ int); ++ break; ++ case TYPE_USHORT: ++ ap->a.a_ushort = va_arg (args, /*unsigned short*/ int); ++ break; ++ case TYPE_INT: ++ ap->a.a_int = va_arg (args, int); ++ break; ++ case TYPE_UINT: ++ ap->a.a_uint = va_arg (args, unsigned int); ++ break; ++ case TYPE_LONGINT: ++ ap->a.a_longint = va_arg (args, long int); ++ break; ++ case TYPE_ULONGINT: ++ ap->a.a_ulongint = va_arg (args, unsigned long int); ++ break; ++#if HAVE_LONG_LONG_INT ++ case TYPE_LONGLONGINT: ++ ap->a.a_longlongint = va_arg (args, long long int); ++ break; ++ case TYPE_ULONGLONGINT: ++ ap->a.a_ulonglongint = va_arg (args, unsigned long long int); ++ break; ++#endif ++ case TYPE_DOUBLE: ++ ap->a.a_double = va_arg (args, double); ++ break; ++ case TYPE_LONGDOUBLE: ++ ap->a.a_longdouble = va_arg (args, long double); ++ break; ++ case TYPE_CHAR: ++ ap->a.a_char = va_arg (args, int); ++ break; ++#if HAVE_WINT_T ++ case TYPE_WIDE_CHAR: ++ /* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by ++ default argument promotions", this is not the case in mingw32, ++ where wint_t is 'unsigned short'. */ ++ ap->a.a_wide_char = ++ (sizeof (wint_t) < sizeof (int) ++ ? va_arg (args, int) ++ : va_arg (args, wint_t)); ++ break; ++#endif ++ case TYPE_STRING: ++ ap->a.a_string = va_arg (args, const char *); ++ /* A null pointer is an invalid argument for "%s", but in practice ++ it occurs quite frequently in printf statements that produce ++ debug output. Use a fallback in this case. */ ++ if (ap->a.a_string == NULL) ++ ap->a.a_string = "(NULL)"; ++ break; ++#if HAVE_WCHAR_T ++ case TYPE_WIDE_STRING: ++ ap->a.a_wide_string = va_arg (args, const wchar_t *); ++ /* A null pointer is an invalid argument for "%ls", but in practice ++ it occurs quite frequently in printf statements that produce ++ debug output. Use a fallback in this case. */ ++ if (ap->a.a_wide_string == NULL) ++ { ++ static const wchar_t wide_null_string[] = ++ { ++ (wchar_t)'(', ++ (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L', ++ (wchar_t)')', ++ (wchar_t)0 ++ }; ++ ap->a.a_wide_string = wide_null_string; ++ } ++ break; ++#endif ++ case TYPE_POINTER: ++ ap->a.a_pointer = va_arg (args, void *); ++ break; ++ case TYPE_COUNT_SCHAR_POINTER: ++ ap->a.a_count_schar_pointer = va_arg (args, signed char *); ++ break; ++ case TYPE_COUNT_SHORT_POINTER: ++ ap->a.a_count_short_pointer = va_arg (args, short *); ++ break; ++ case TYPE_COUNT_INT_POINTER: ++ ap->a.a_count_int_pointer = va_arg (args, int *); ++ break; ++ case TYPE_COUNT_LONGINT_POINTER: ++ ap->a.a_count_longint_pointer = va_arg (args, long int *); ++ break; ++#if HAVE_LONG_LONG_INT ++ case TYPE_COUNT_LONGLONGINT_POINTER: ++ ap->a.a_count_longlongint_pointer = va_arg (args, long long int *); ++ break; ++#endif ++#if ENABLE_UNISTDIO ++ /* The unistdio extensions. */ ++ case TYPE_U8_STRING: ++ ap->a.a_u8_string = va_arg (args, const uint8_t *); ++ /* A null pointer is an invalid argument for "%U", but in practice ++ it occurs quite frequently in printf statements that produce ++ debug output. Use a fallback in this case. */ ++ if (ap->a.a_u8_string == NULL) ++ { ++ static const uint8_t u8_null_string[] = ++ { '(', 'N', 'U', 'L', 'L', ')', 0 }; ++ ap->a.a_u8_string = u8_null_string; ++ } ++ break; ++ case TYPE_U16_STRING: ++ ap->a.a_u16_string = va_arg (args, const uint16_t *); ++ /* A null pointer is an invalid argument for "%lU", but in practice ++ it occurs quite frequently in printf statements that produce ++ debug output. Use a fallback in this case. */ ++ if (ap->a.a_u16_string == NULL) ++ { ++ static const uint16_t u16_null_string[] = ++ { '(', 'N', 'U', 'L', 'L', ')', 0 }; ++ ap->a.a_u16_string = u16_null_string; ++ } ++ break; ++ case TYPE_U32_STRING: ++ ap->a.a_u32_string = va_arg (args, const uint32_t *); ++ /* A null pointer is an invalid argument for "%llU", but in practice ++ it occurs quite frequently in printf statements that produce ++ debug output. Use a fallback in this case. */ ++ if (ap->a.a_u32_string == NULL) ++ { ++ static const uint32_t u32_null_string[] = ++ { '(', 'N', 'U', 'L', 'L', ')', 0 }; ++ ap->a.a_u32_string = u32_null_string; ++ } ++ break; ++#endif ++ default: ++ /* Unknown type. */ ++ return -1; ++ } ++ return 0; ++} +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/printf-args.h gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-args.h +--- gtk-vnc-0.3.7.mingw/gnulib/lib/printf-args.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-args.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,154 @@ ++/* Decomposed printf argument list. ++ Copyright (C) 1999, 2002-2003, 2006-2007 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License along ++ with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef _PRINTF_ARGS_H ++#define _PRINTF_ARGS_H ++ ++/* This file can be parametrized with the following macros: ++ ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. ++ PRINTF_FETCHARGS Name of the function to be declared. ++ STATIC Set to 'static' to declare the function static. */ ++ ++/* Default parameters. */ ++#ifndef PRINTF_FETCHARGS ++# define PRINTF_FETCHARGS printf_fetchargs ++#endif ++ ++/* Get size_t. */ ++#include ++ ++/* Get wchar_t. */ ++#if HAVE_WCHAR_T ++# include ++#endif ++ ++/* Get wint_t. */ ++#if HAVE_WINT_T ++# include ++#endif ++ ++/* Get va_list. */ ++#include ++ ++ ++/* Argument types */ ++typedef enum ++{ ++ TYPE_NONE, ++ TYPE_SCHAR, ++ TYPE_UCHAR, ++ TYPE_SHORT, ++ TYPE_USHORT, ++ TYPE_INT, ++ TYPE_UINT, ++ TYPE_LONGINT, ++ TYPE_ULONGINT, ++#if HAVE_LONG_LONG_INT ++ TYPE_LONGLONGINT, ++ TYPE_ULONGLONGINT, ++#endif ++ TYPE_DOUBLE, ++ TYPE_LONGDOUBLE, ++ TYPE_CHAR, ++#if HAVE_WINT_T ++ TYPE_WIDE_CHAR, ++#endif ++ TYPE_STRING, ++#if HAVE_WCHAR_T ++ TYPE_WIDE_STRING, ++#endif ++ TYPE_POINTER, ++ TYPE_COUNT_SCHAR_POINTER, ++ TYPE_COUNT_SHORT_POINTER, ++ TYPE_COUNT_INT_POINTER, ++ TYPE_COUNT_LONGINT_POINTER ++#if HAVE_LONG_LONG_INT ++, TYPE_COUNT_LONGLONGINT_POINTER ++#endif ++#if ENABLE_UNISTDIO ++ /* The unistdio extensions. */ ++, TYPE_U8_STRING ++, TYPE_U16_STRING ++, TYPE_U32_STRING ++#endif ++} arg_type; ++ ++/* Polymorphic argument */ ++typedef struct ++{ ++ arg_type type; ++ union ++ { ++ signed char a_schar; ++ unsigned char a_uchar; ++ short a_short; ++ unsigned short a_ushort; ++ int a_int; ++ unsigned int a_uint; ++ long int a_longint; ++ unsigned long int a_ulongint; ++#if HAVE_LONG_LONG_INT ++ long long int a_longlongint; ++ unsigned long long int a_ulonglongint; ++#endif ++ float a_float; ++ double a_double; ++ long double a_longdouble; ++ int a_char; ++#if HAVE_WINT_T ++ wint_t a_wide_char; ++#endif ++ const char* a_string; ++#if HAVE_WCHAR_T ++ const wchar_t* a_wide_string; ++#endif ++ void* a_pointer; ++ signed char * a_count_schar_pointer; ++ short * a_count_short_pointer; ++ int * a_count_int_pointer; ++ long int * a_count_longint_pointer; ++#if HAVE_LONG_LONG_INT ++ long long int * a_count_longlongint_pointer; ++#endif ++#if ENABLE_UNISTDIO ++ /* The unistdio extensions. */ ++ const uint8_t * a_u8_string; ++ const uint16_t * a_u16_string; ++ const uint32_t * a_u32_string; ++#endif ++ } ++ a; ++} ++argument; ++ ++typedef struct ++{ ++ size_t count; ++ argument *arg; ++} ++arguments; ++ ++ ++/* Fetch the arguments, putting them into a. */ ++#ifdef STATIC ++STATIC ++#else ++extern ++#endif ++int PRINTF_FETCHARGS (va_list args, arguments *a); ++ ++#endif /* _PRINTF_ARGS_H */ +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/printf-parse.c gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-parse.c +--- gtk-vnc-0.3.7.mingw/gnulib/lib/printf-parse.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-parse.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,627 @@ ++/* Formatted output to strings. ++ Copyright (C) 1999-2000, 2002-2003, 2006-2008 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License along ++ with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++/* This file can be parametrized with the following macros: ++ CHAR_T The element type of the format string. ++ CHAR_T_ONLY_ASCII Set to 1 to enable verification that all characters ++ in the format string are ASCII. ++ DIRECTIVE Structure denoting a format directive. ++ Depends on CHAR_T. ++ DIRECTIVES Structure denoting the set of format directives of a ++ format string. Depends on CHAR_T. ++ PRINTF_PARSE Function that parses a format string. ++ Depends on CHAR_T. ++ STATIC Set to 'static' to declare the function static. ++ ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. */ ++ ++#ifndef PRINTF_PARSE ++# include ++#endif ++ ++/* Specification. */ ++#ifndef PRINTF_PARSE ++# include "printf-parse.h" ++#endif ++ ++/* Default parameters. */ ++#ifndef PRINTF_PARSE ++# define PRINTF_PARSE printf_parse ++# define CHAR_T char ++# define DIRECTIVE char_directive ++# define DIRECTIVES char_directives ++#endif ++ ++/* Get size_t, NULL. */ ++#include ++ ++/* Get intmax_t. */ ++#if defined IN_LIBINTL || defined IN_LIBASPRINTF ++# if HAVE_STDINT_H_WITH_UINTMAX ++# include ++# endif ++# if HAVE_INTTYPES_H_WITH_UINTMAX ++# include ++# endif ++#else ++# include ++#endif ++ ++/* malloc(), realloc(), free(). */ ++#include ++ ++/* errno. */ ++#include ++ ++/* Checked size_t computations. */ ++#include "xsize.h" ++ ++#if CHAR_T_ONLY_ASCII ++/* c_isascii(). */ ++# include "c-ctype.h" ++#endif ++ ++#ifdef STATIC ++STATIC ++#endif ++int ++PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) ++{ ++ const CHAR_T *cp = format; /* pointer into format */ ++ size_t arg_posn = 0; /* number of regular arguments consumed */ ++ size_t d_allocated; /* allocated elements of d->dir */ ++ size_t a_allocated; /* allocated elements of a->arg */ ++ size_t max_width_length = 0; ++ size_t max_precision_length = 0; ++ ++ d->count = 0; ++ d_allocated = 1; ++ d->dir = (DIRECTIVE *) malloc (d_allocated * sizeof (DIRECTIVE)); ++ if (d->dir == NULL) ++ /* Out of memory. */ ++ goto out_of_memory_1; ++ ++ a->count = 0; ++ a_allocated = 0; ++ a->arg = NULL; ++ ++#define REGISTER_ARG(_index_,_type_) \ ++ { \ ++ size_t n = (_index_); \ ++ if (n >= a_allocated) \ ++ { \ ++ size_t memory_size; \ ++ argument *memory; \ ++ \ ++ a_allocated = xtimes (a_allocated, 2); \ ++ if (a_allocated <= n) \ ++ a_allocated = xsum (n, 1); \ ++ memory_size = xtimes (a_allocated, sizeof (argument)); \ ++ if (size_overflow_p (memory_size)) \ ++ /* Overflow, would lead to out of memory. */ \ ++ goto out_of_memory; \ ++ memory = (argument *) (a->arg \ ++ ? realloc (a->arg, memory_size) \ ++ : malloc (memory_size)); \ ++ if (memory == NULL) \ ++ /* Out of memory. */ \ ++ goto out_of_memory; \ ++ a->arg = memory; \ ++ } \ ++ while (a->count <= n) \ ++ a->arg[a->count++].type = TYPE_NONE; \ ++ if (a->arg[n].type == TYPE_NONE) \ ++ a->arg[n].type = (_type_); \ ++ else if (a->arg[n].type != (_type_)) \ ++ /* Ambiguous type for positional argument. */ \ ++ goto error; \ ++ } ++ ++ while (*cp != '\0') ++ { ++ CHAR_T c = *cp++; ++ if (c == '%') ++ { ++ size_t arg_index = ARG_NONE; ++ DIRECTIVE *dp = &d->dir[d->count]; /* pointer to next directive */ ++ ++ /* Initialize the next directive. */ ++ dp->dir_start = cp - 1; ++ dp->flags = 0; ++ dp->width_start = NULL; ++ dp->width_end = NULL; ++ dp->width_arg_index = ARG_NONE; ++ dp->precision_start = NULL; ++ dp->precision_end = NULL; ++ dp->precision_arg_index = ARG_NONE; ++ dp->arg_index = ARG_NONE; ++ ++ /* Test for positional argument. */ ++ if (*cp >= '0' && *cp <= '9') ++ { ++ const CHAR_T *np; ++ ++ for (np = cp; *np >= '0' && *np <= '9'; np++) ++ ; ++ if (*np == '$') ++ { ++ size_t n = 0; ++ ++ for (np = cp; *np >= '0' && *np <= '9'; np++) ++ n = xsum (xtimes (n, 10), *np - '0'); ++ if (n == 0) ++ /* Positional argument 0. */ ++ goto error; ++ if (size_overflow_p (n)) ++ /* n too large, would lead to out of memory later. */ ++ goto error; ++ arg_index = n - 1; ++ cp = np + 1; ++ } ++ } ++ ++ /* Read the flags. */ ++ for (;;) ++ { ++ if (*cp == '\'') ++ { ++ dp->flags |= FLAG_GROUP; ++ cp++; ++ } ++ else if (*cp == '-') ++ { ++ dp->flags |= FLAG_LEFT; ++ cp++; ++ } ++ else if (*cp == '+') ++ { ++ dp->flags |= FLAG_SHOWSIGN; ++ cp++; ++ } ++ else if (*cp == ' ') ++ { ++ dp->flags |= FLAG_SPACE; ++ cp++; ++ } ++ else if (*cp == '#') ++ { ++ dp->flags |= FLAG_ALT; ++ cp++; ++ } ++ else if (*cp == '0') ++ { ++ dp->flags |= FLAG_ZERO; ++ cp++; ++ } ++ else ++ break; ++ } ++ ++ /* Parse the field width. */ ++ if (*cp == '*') ++ { ++ dp->width_start = cp; ++ cp++; ++ dp->width_end = cp; ++ if (max_width_length < 1) ++ max_width_length = 1; ++ ++ /* Test for positional argument. */ ++ if (*cp >= '0' && *cp <= '9') ++ { ++ const CHAR_T *np; ++ ++ for (np = cp; *np >= '0' && *np <= '9'; np++) ++ ; ++ if (*np == '$') ++ { ++ size_t n = 0; ++ ++ for (np = cp; *np >= '0' && *np <= '9'; np++) ++ n = xsum (xtimes (n, 10), *np - '0'); ++ if (n == 0) ++ /* Positional argument 0. */ ++ goto error; ++ if (size_overflow_p (n)) ++ /* n too large, would lead to out of memory later. */ ++ goto error; ++ dp->width_arg_index = n - 1; ++ cp = np + 1; ++ } ++ } ++ if (dp->width_arg_index == ARG_NONE) ++ { ++ dp->width_arg_index = arg_posn++; ++ if (dp->width_arg_index == ARG_NONE) ++ /* arg_posn wrapped around. */ ++ goto error; ++ } ++ REGISTER_ARG (dp->width_arg_index, TYPE_INT); ++ } ++ else if (*cp >= '0' && *cp <= '9') ++ { ++ size_t width_length; ++ ++ dp->width_start = cp; ++ for (; *cp >= '0' && *cp <= '9'; cp++) ++ ; ++ dp->width_end = cp; ++ width_length = dp->width_end - dp->width_start; ++ if (max_width_length < width_length) ++ max_width_length = width_length; ++ } ++ ++ /* Parse the precision. */ ++ if (*cp == '.') ++ { ++ cp++; ++ if (*cp == '*') ++ { ++ dp->precision_start = cp - 1; ++ cp++; ++ dp->precision_end = cp; ++ if (max_precision_length < 2) ++ max_precision_length = 2; ++ ++ /* Test for positional argument. */ ++ if (*cp >= '0' && *cp <= '9') ++ { ++ const CHAR_T *np; ++ ++ for (np = cp; *np >= '0' && *np <= '9'; np++) ++ ; ++ if (*np == '$') ++ { ++ size_t n = 0; ++ ++ for (np = cp; *np >= '0' && *np <= '9'; np++) ++ n = xsum (xtimes (n, 10), *np - '0'); ++ if (n == 0) ++ /* Positional argument 0. */ ++ goto error; ++ if (size_overflow_p (n)) ++ /* n too large, would lead to out of memory ++ later. */ ++ goto error; ++ dp->precision_arg_index = n - 1; ++ cp = np + 1; ++ } ++ } ++ if (dp->precision_arg_index == ARG_NONE) ++ { ++ dp->precision_arg_index = arg_posn++; ++ if (dp->precision_arg_index == ARG_NONE) ++ /* arg_posn wrapped around. */ ++ goto error; ++ } ++ REGISTER_ARG (dp->precision_arg_index, TYPE_INT); ++ } ++ else ++ { ++ size_t precision_length; ++ ++ dp->precision_start = cp - 1; ++ for (; *cp >= '0' && *cp <= '9'; cp++) ++ ; ++ dp->precision_end = cp; ++ precision_length = dp->precision_end - dp->precision_start; ++ if (max_precision_length < precision_length) ++ max_precision_length = precision_length; ++ } ++ } ++ ++ { ++ arg_type type; ++ ++ /* Parse argument type/size specifiers. */ ++ { ++ int flags = 0; ++ ++ for (;;) ++ { ++ if (*cp == 'h') ++ { ++ flags |= (1 << (flags & 1)); ++ cp++; ++ } ++ else if (*cp == 'L') ++ { ++ flags |= 4; ++ cp++; ++ } ++ else if (*cp == 'l') ++ { ++ flags += 8; ++ cp++; ++ } ++ else if (*cp == 'j') ++ { ++ if (sizeof (intmax_t) > sizeof (long)) ++ { ++ /* intmax_t = long long */ ++ flags += 16; ++ } ++ else if (sizeof (intmax_t) > sizeof (int)) ++ { ++ /* intmax_t = long */ ++ flags += 8; ++ } ++ cp++; ++ } ++ else if (*cp == 'z' || *cp == 'Z') ++ { ++ /* 'z' is standardized in ISO C 99, but glibc uses 'Z' ++ because the warning facility in gcc-2.95.2 understands ++ only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784). */ ++ if (sizeof (size_t) > sizeof (long)) ++ { ++ /* size_t = long long */ ++ flags += 16; ++ } ++ else if (sizeof (size_t) > sizeof (int)) ++ { ++ /* size_t = long */ ++ flags += 8; ++ } ++ cp++; ++ } ++ else if (*cp == 't') ++ { ++ if (sizeof (ptrdiff_t) > sizeof (long)) ++ { ++ /* ptrdiff_t = long long */ ++ flags += 16; ++ } ++ else if (sizeof (ptrdiff_t) > sizeof (int)) ++ { ++ /* ptrdiff_t = long */ ++ flags += 8; ++ } ++ cp++; ++ } ++#if defined __APPLE__ && defined __MACH__ ++ /* On MacOS X 10.3, PRIdMAX is defined as "qd". ++ We cannot change it to "lld" because PRIdMAX must also ++ be understood by the system's printf routines. */ ++ else if (*cp == 'q') ++ { ++ if (64 / 8 > sizeof (long)) ++ { ++ /* int64_t = long long */ ++ flags += 16; ++ } ++ else ++ { ++ /* int64_t = long */ ++ flags += 8; ++ } ++ cp++; ++ } ++#endif ++#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ /* On native Win32, PRIdMAX is defined as "I64d". ++ We cannot change it to "lld" because PRIdMAX must also ++ be understood by the system's printf routines. */ ++ else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4') ++ { ++ if (64 / 8 > sizeof (long)) ++ { ++ /* __int64 = long long */ ++ flags += 16; ++ } ++ else ++ { ++ /* __int64 = long */ ++ flags += 8; ++ } ++ cp += 3; ++ } ++#endif ++ else ++ break; ++ } ++ ++ /* Read the conversion character. */ ++ c = *cp++; ++ switch (c) ++ { ++ case 'd': case 'i': ++#if HAVE_LONG_LONG_INT ++ /* If 'long long' exists and is larger than 'long': */ ++ if (flags >= 16 || (flags & 4)) ++ type = TYPE_LONGLONGINT; ++ else ++#endif ++ /* If 'long long' exists and is the same as 'long', we parse ++ "lld" into TYPE_LONGINT. */ ++ if (flags >= 8) ++ type = TYPE_LONGINT; ++ else if (flags & 2) ++ type = TYPE_SCHAR; ++ else if (flags & 1) ++ type = TYPE_SHORT; ++ else ++ type = TYPE_INT; ++ break; ++ case 'o': case 'u': case 'x': case 'X': ++#if HAVE_LONG_LONG_INT ++ /* If 'long long' exists and is larger than 'long': */ ++ if (flags >= 16 || (flags & 4)) ++ type = TYPE_ULONGLONGINT; ++ else ++#endif ++ /* If 'unsigned long long' exists and is the same as ++ 'unsigned long', we parse "llu" into TYPE_ULONGINT. */ ++ if (flags >= 8) ++ type = TYPE_ULONGINT; ++ else if (flags & 2) ++ type = TYPE_UCHAR; ++ else if (flags & 1) ++ type = TYPE_USHORT; ++ else ++ type = TYPE_UINT; ++ break; ++ case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': ++ case 'a': case 'A': ++ if (flags >= 16 || (flags & 4)) ++ type = TYPE_LONGDOUBLE; ++ else ++ type = TYPE_DOUBLE; ++ break; ++ case 'c': ++ if (flags >= 8) ++#if HAVE_WINT_T ++ type = TYPE_WIDE_CHAR; ++#else ++ goto error; ++#endif ++ else ++ type = TYPE_CHAR; ++ break; ++#if HAVE_WINT_T ++ case 'C': ++ type = TYPE_WIDE_CHAR; ++ c = 'c'; ++ break; ++#endif ++ case 's': ++ if (flags >= 8) ++#if HAVE_WCHAR_T ++ type = TYPE_WIDE_STRING; ++#else ++ goto error; ++#endif ++ else ++ type = TYPE_STRING; ++ break; ++#if HAVE_WCHAR_T ++ case 'S': ++ type = TYPE_WIDE_STRING; ++ c = 's'; ++ break; ++#endif ++ case 'p': ++ type = TYPE_POINTER; ++ break; ++ case 'n': ++#if HAVE_LONG_LONG_INT ++ /* If 'long long' exists and is larger than 'long': */ ++ if (flags >= 16 || (flags & 4)) ++ type = TYPE_COUNT_LONGLONGINT_POINTER; ++ else ++#endif ++ /* If 'long long' exists and is the same as 'long', we parse ++ "lln" into TYPE_COUNT_LONGINT_POINTER. */ ++ if (flags >= 8) ++ type = TYPE_COUNT_LONGINT_POINTER; ++ else if (flags & 2) ++ type = TYPE_COUNT_SCHAR_POINTER; ++ else if (flags & 1) ++ type = TYPE_COUNT_SHORT_POINTER; ++ else ++ type = TYPE_COUNT_INT_POINTER; ++ break; ++#if ENABLE_UNISTDIO ++ /* The unistdio extensions. */ ++ case 'U': ++ if (flags >= 16) ++ type = TYPE_U32_STRING; ++ else if (flags >= 8) ++ type = TYPE_U16_STRING; ++ else ++ type = TYPE_U8_STRING; ++ break; ++#endif ++ case '%': ++ type = TYPE_NONE; ++ break; ++ default: ++ /* Unknown conversion character. */ ++ goto error; ++ } ++ } ++ ++ if (type != TYPE_NONE) ++ { ++ dp->arg_index = arg_index; ++ if (dp->arg_index == ARG_NONE) ++ { ++ dp->arg_index = arg_posn++; ++ if (dp->arg_index == ARG_NONE) ++ /* arg_posn wrapped around. */ ++ goto error; ++ } ++ REGISTER_ARG (dp->arg_index, type); ++ } ++ dp->conversion = c; ++ dp->dir_end = cp; ++ } ++ ++ d->count++; ++ if (d->count >= d_allocated) ++ { ++ size_t memory_size; ++ DIRECTIVE *memory; ++ ++ d_allocated = xtimes (d_allocated, 2); ++ memory_size = xtimes (d_allocated, sizeof (DIRECTIVE)); ++ if (size_overflow_p (memory_size)) ++ /* Overflow, would lead to out of memory. */ ++ goto out_of_memory; ++ memory = (DIRECTIVE *) realloc (d->dir, memory_size); ++ if (memory == NULL) ++ /* Out of memory. */ ++ goto out_of_memory; ++ d->dir = memory; ++ } ++ } ++#if CHAR_T_ONLY_ASCII ++ else if (!c_isascii (c)) ++ { ++ /* Non-ASCII character. Not supported. */ ++ goto error; ++ } ++#endif ++ } ++ d->dir[d->count].dir_start = cp; ++ ++ d->max_width_length = max_width_length; ++ d->max_precision_length = max_precision_length; ++ return 0; ++ ++error: ++ if (a->arg) ++ free (a->arg); ++ if (d->dir) ++ free (d->dir); ++ errno = EINVAL; ++ return -1; ++ ++out_of_memory: ++ if (a->arg) ++ free (a->arg); ++ if (d->dir) ++ free (d->dir); ++out_of_memory_1: ++ errno = ENOMEM; ++ return -1; ++} ++ ++#undef PRINTF_PARSE ++#undef DIRECTIVES ++#undef DIRECTIVE ++#undef CHAR_T_ONLY_ASCII ++#undef CHAR_T +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/printf-parse.h gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-parse.h +--- gtk-vnc-0.3.7.mingw/gnulib/lib/printf-parse.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/printf-parse.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,179 @@ ++/* Parse printf format string. ++ Copyright (C) 1999, 2002-2003, 2005, 2007 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License along ++ with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef _PRINTF_PARSE_H ++#define _PRINTF_PARSE_H ++ ++/* This file can be parametrized with the following macros: ++ ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. ++ STATIC Set to 'static' to declare the function static. */ ++ ++#include "printf-args.h" ++ ++ ++/* Flags */ ++#define FLAG_GROUP 1 /* ' flag */ ++#define FLAG_LEFT 2 /* - flag */ ++#define FLAG_SHOWSIGN 4 /* + flag */ ++#define FLAG_SPACE 8 /* space flag */ ++#define FLAG_ALT 16 /* # flag */ ++#define FLAG_ZERO 32 ++ ++/* arg_index value indicating that no argument is consumed. */ ++#define ARG_NONE (~(size_t)0) ++ ++/* xxx_directive: A parsed directive. ++ xxx_directives: A parsed format string. */ ++ ++/* A parsed directive. */ ++typedef struct ++{ ++ const char* dir_start; ++ const char* dir_end; ++ int flags; ++ const char* width_start; ++ const char* width_end; ++ size_t width_arg_index; ++ const char* precision_start; ++ const char* precision_end; ++ size_t precision_arg_index; ++ char conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ ++ size_t arg_index; ++} ++char_directive; ++ ++/* A parsed format string. */ ++typedef struct ++{ ++ size_t count; ++ char_directive *dir; ++ size_t max_width_length; ++ size_t max_precision_length; ++} ++char_directives; ++ ++#if ENABLE_UNISTDIO ++ ++/* A parsed directive. */ ++typedef struct ++{ ++ const uint8_t* dir_start; ++ const uint8_t* dir_end; ++ int flags; ++ const uint8_t* width_start; ++ const uint8_t* width_end; ++ size_t width_arg_index; ++ const uint8_t* precision_start; ++ const uint8_t* precision_end; ++ size_t precision_arg_index; ++ uint8_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ ++ size_t arg_index; ++} ++u8_directive; ++ ++/* A parsed format string. */ ++typedef struct ++{ ++ size_t count; ++ u8_directive *dir; ++ size_t max_width_length; ++ size_t max_precision_length; ++} ++u8_directives; ++ ++/* A parsed directive. */ ++typedef struct ++{ ++ const uint16_t* dir_start; ++ const uint16_t* dir_end; ++ int flags; ++ const uint16_t* width_start; ++ const uint16_t* width_end; ++ size_t width_arg_index; ++ const uint16_t* precision_start; ++ const uint16_t* precision_end; ++ size_t precision_arg_index; ++ uint16_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ ++ size_t arg_index; ++} ++u16_directive; ++ ++/* A parsed format string. */ ++typedef struct ++{ ++ size_t count; ++ u16_directive *dir; ++ size_t max_width_length; ++ size_t max_precision_length; ++} ++u16_directives; ++ ++/* A parsed directive. */ ++typedef struct ++{ ++ const uint32_t* dir_start; ++ const uint32_t* dir_end; ++ int flags; ++ const uint32_t* width_start; ++ const uint32_t* width_end; ++ size_t width_arg_index; ++ const uint32_t* precision_start; ++ const uint32_t* precision_end; ++ size_t precision_arg_index; ++ uint32_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ ++ size_t arg_index; ++} ++u32_directive; ++ ++/* A parsed format string. */ ++typedef struct ++{ ++ size_t count; ++ u32_directive *dir; ++ size_t max_width_length; ++ size_t max_precision_length; ++} ++u32_directives; ++ ++#endif ++ ++ ++/* Parses the format string. Fills in the number N of directives, and fills ++ in directives[0], ..., directives[N-1], and sets directives[N].dir_start ++ to the end of the format string. Also fills in the arg_type fields of the ++ arguments and the needed count of arguments. */ ++#if ENABLE_UNISTDIO ++extern int ++ ulc_printf_parse (const char *format, char_directives *d, arguments *a); ++extern int ++ u8_printf_parse (const uint8_t *format, u8_directives *d, arguments *a); ++extern int ++ u16_printf_parse (const uint16_t *format, u16_directives *d, ++ arguments *a); ++extern int ++ u32_printf_parse (const uint32_t *format, u32_directives *d, ++ arguments *a); ++#else ++# ifdef STATIC ++STATIC ++# else ++extern ++# endif ++int printf_parse (const char *format, char_directives *d, arguments *a); ++#endif ++ ++#endif /* _PRINTF_PARSE_H */ +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/size_max.h gtk-vnc-0.3.7.gnulib/gnulib/lib/size_max.h +--- gtk-vnc-0.3.7.mingw/gnulib/lib/size_max.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/size_max.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,31 @@ ++/* size_max.h -- declare SIZE_MAX through system headers ++ Copyright (C) 2005-2006 Free Software Foundation, Inc. ++ Written by Simon Josefsson. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef GNULIB_SIZE_MAX_H ++#define GNULIB_SIZE_MAX_H ++ ++/* Get SIZE_MAX declaration on systems like Solaris 7/8/9. */ ++# include ++/* Get SIZE_MAX declaration on systems like glibc 2. */ ++# if HAVE_STDINT_H ++# include ++# endif ++/* On systems where these include files don't define it, SIZE_MAX is defined ++ in config.h. */ ++ ++#endif /* GNULIB_SIZE_MAX_H */ +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/snprintf.c gtk-vnc-0.3.7.gnulib/gnulib/lib/snprintf.c +--- gtk-vnc-0.3.7.mingw/gnulib/lib/snprintf.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/snprintf.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,72 @@ ++/* Formatted output to strings. ++ Copyright (C) 2004, 2006-2008 Free Software Foundation, Inc. ++ Written by Simon Josefsson and Paul Eggert. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License along ++ with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#include ++ ++/* Specification. */ ++#include ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "vasnprintf.h" ++ ++/* Print formatted output to string STR. Similar to sprintf, but ++ additional length SIZE limit how much is written into STR. Returns ++ string length of formatted string (which may be larger than SIZE). ++ STR may be NULL, in which case nothing will be written. On error, ++ return a negative value. */ ++int ++snprintf (char *str, size_t size, const char *format, ...) ++{ ++ char *output; ++ size_t len; ++ size_t lenbuf = size; ++ va_list args; ++ ++ va_start (args, format); ++ output = vasnprintf (str, &lenbuf, format, args); ++ len = lenbuf; ++ va_end (args); ++ ++ if (!output) ++ return -1; ++ ++ if (output != str) ++ { ++ if (size) ++ { ++ size_t pruned_len = (len < size ? len : size - 1); ++ memcpy (str, output, pruned_len); ++ str[pruned_len] = '\0'; ++ } ++ ++ free (output); ++ } ++ ++ if (INT_MAX < len) ++ { ++ errno = EOVERFLOW; ++ return -1; ++ } ++ ++ return len; ++} +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/stdbool.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/stdbool.in.h +--- gtk-vnc-0.3.7.mingw/gnulib/lib/stdbool.in.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/stdbool.in.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,119 @@ ++/* Copyright (C) 2001-2003, 2006-2008 Free Software Foundation, Inc. ++ Written by Bruno Haible , 2001. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef _GL_STDBOOL_H ++#define _GL_STDBOOL_H ++ ++/* ISO C 99 for platforms that lack it. */ ++ ++/* Usage suggestions: ++ ++ Programs that use should be aware of some limitations ++ and standards compliance issues. ++ ++ Standards compliance: ++ ++ - must be #included before 'bool', 'false', 'true' ++ can be used. ++ ++ - You cannot assume that sizeof (bool) == 1. ++ ++ - Programs should not undefine the macros bool, true, and false, ++ as C99 lists that as an "obsolescent feature". ++ ++ Limitations of this substitute, when used in a C89 environment: ++ ++ - must be #included before the '_Bool' type can be used. ++ ++ - You cannot assume that _Bool is a typedef; it might be a macro. ++ ++ - Bit-fields of type 'bool' are not supported. Portable code ++ should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'. ++ ++ - In C99, casts and automatic conversions to '_Bool' or 'bool' are ++ performed in such a way that every nonzero value gets converted ++ to 'true', and zero gets converted to 'false'. This doesn't work ++ with this substitute. With this substitute, only the values 0 and 1 ++ give the expected result when converted to _Bool' or 'bool'. ++ ++ Also, it is suggested that programs use 'bool' rather than '_Bool'; ++ this isn't required, but 'bool' is more common. */ ++ ++ ++/* 7.16. Boolean type and values */ ++ ++/* BeOS already #defines false 0, true 1. We use the same ++ definitions below, but temporarily we have to #undef them. */ ++#if defined __BEOS__ && !defined __HAIKU__ ++# include /* defines bool but not _Bool */ ++# undef false ++# undef true ++#endif ++ ++/* For the sake of symbolic names in gdb, we define true and false as ++ enum constants, not only as macros. ++ It is tempting to write ++ typedef enum { false = 0, true = 1 } _Bool; ++ so that gdb prints values of type 'bool' symbolically. But if we do ++ this, values of type '_Bool' may promote to 'int' or 'unsigned int' ++ (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' ++ (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the ++ enum; this ensures that '_Bool' promotes to 'int'. */ ++#if defined __cplusplus || (defined __BEOS__ && !defined __HAIKU__) ++ /* A compiler known to have 'bool'. */ ++ /* If the compiler already has both 'bool' and '_Bool', we can assume they ++ are the same types. */ ++# if !@HAVE__BOOL@ ++typedef bool _Bool; ++# endif ++#else ++# if !defined __GNUC__ ++ /* If @HAVE__BOOL@: ++ Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when ++ the built-in _Bool type is used. See ++ http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html ++ http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html ++ http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html ++ Similar bugs are likely with other compilers as well; this file ++ wouldn't be used if was working. ++ So we override the _Bool type. ++ If !@HAVE__BOOL@: ++ Need to define _Bool ourselves. As 'signed char' or as an enum type? ++ Use of a typedef, with SunPRO C, leads to a stupid ++ "warning: _Bool is a keyword in ISO C99". ++ Use of an enum type, with IRIX cc, leads to a stupid ++ "warning(1185): enumerated type mixed with another type". ++ Even the existence of an enum type, without a typedef, ++ "Invalid enumerator. (badenum)" with HP-UX cc on Tru64. ++ The only benefit of the enum, debuggability, is not important ++ with these compilers. So use 'signed char' and no enum. */ ++# define _Bool signed char ++# else ++ /* With this compiler, trust the _Bool type if the compiler has it. */ ++# if !@HAVE__BOOL@ ++typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; ++# endif ++# endif ++#endif ++#define bool _Bool ++ ++/* The other macros must be usable in preprocessor directives. */ ++#define false 0 ++#define true 1 ++#define __bool_true_false_are_defined 1 ++ ++#endif /* _GL_STDBOOL_H */ +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/stdint.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/stdint.in.h +--- gtk-vnc-0.3.7.mingw/gnulib/lib/stdint.in.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/stdint.in.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,523 @@ ++/* Copyright (C) 2001-2002, 2004-2008 Free Software Foundation, Inc. ++ Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. ++ This file is part of gnulib. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++/* ++ * ISO C 99 for platforms that lack it. ++ * ++ */ ++ ++#ifndef _GL_STDINT_H ++ ++/* When including a system file that in turn includes , ++ use the system , not our substitute. This avoids ++ problems with (for example) VMS, whose includes ++ . */ ++#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H ++ ++/* Get those types that are already defined in other system include ++ files, so that we can "#define int8_t signed char" below without ++ worrying about a later system include file containing a "typedef ++ signed char int8_t;" that will get messed up by our macro. Our ++ macros should all be consistent with the system versions, except ++ for the "fast" types and macros, which we recommend against using ++ in public interfaces due to compiler differences. */ ++ ++#if @HAVE_STDINT_H@ ++# if defined __sgi && ! defined __c99 ++ /* Bypass IRIX's if in C89 mode, since it merely annoys users ++ with "This header file is to be used only for c99 mode compilations" ++ diagnostics. */ ++# define __STDINT_H__ ++# endif ++ /* Other systems may have an incomplete or buggy . ++ Include it before , since any "#include " ++ in would reinclude us, skipping our contents because ++ _GL_STDINT_H is defined. ++ The include_next requires a split double-inclusion guard. */ ++@PRAGMA_SYSTEM_HEADER@ ++# @INCLUDE_NEXT@ @NEXT_STDINT_H@ ++#endif ++ ++#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H ++#define _GL_STDINT_H ++ ++/* defines some of the stdint.h types as well, on glibc, ++ IRIX 6.5, and OpenBSD 3.8 (via ). ++ AIX 5.2 isn't needed and causes troubles. ++ MacOS X 10.4.6 includes (which is us), but ++ relies on the system definitions, so include ++ after @NEXT_STDINT_H@. */ ++#if @HAVE_SYS_TYPES_H@ && ! defined _AIX ++# include ++#endif ++ ++/* Get LONG_MIN, LONG_MAX, ULONG_MAX. */ ++#include ++ ++#if @HAVE_INTTYPES_H@ ++ /* In OpenBSD 3.8, includes , which defines ++ int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. ++ also defines intptr_t and uintptr_t. */ ++# include ++#elif @HAVE_SYS_INTTYPES_H@ ++ /* Solaris 7 has the types except the *_fast*_t types, and ++ the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ ++# include ++#endif ++ ++#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ ++ /* Linux libc4 >= 4.6.7 and libc5 have a that defines ++ int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is ++ included by . */ ++# include ++#endif ++ ++#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS ++ ++/* Get WCHAR_MIN, WCHAR_MAX. */ ++# if ! (defined WCHAR_MIN && defined WCHAR_MAX) ++# include ++# endif ++ ++#endif ++ ++#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H ++ ++/* Minimum and maximum values for a integer type under the usual assumption. ++ Return an unspecified value if BITS == 0, adding a check to pacify ++ picky compilers. */ ++ ++#define _STDINT_MIN(signed, bits, zero) \ ++ ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero)) ++ ++#define _STDINT_MAX(signed, bits, zero) \ ++ ((signed) \ ++ ? ~ _STDINT_MIN (signed, bits, zero) \ ++ : /* The expression for the unsigned case. The subtraction of (signed) \ ++ is a nop in the unsigned case and avoids "signed integer overflow" \ ++ warnings in the signed case. */ \ ++ ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) ++ ++/* 7.18.1.1. Exact-width integer types */ ++ ++/* Here we assume a standard architecture where the hardware integer ++ types have 8, 16, 32, optionally 64 bits. */ ++ ++#undef int8_t ++#undef uint8_t ++#define int8_t signed char ++#define uint8_t unsigned char ++ ++#undef int16_t ++#undef uint16_t ++#define int16_t short int ++#define uint16_t unsigned short int ++ ++#undef int32_t ++#undef uint32_t ++#define int32_t int ++#define uint32_t unsigned int ++ ++/* Do not undefine int64_t if gnulib is not being used with 64-bit ++ types, since otherwise it breaks platforms like Tandem/NSK. */ ++#if LONG_MAX >> 31 >> 31 == 1 ++# undef int64_t ++# define int64_t long int ++# define GL_INT64_T ++#elif defined _MSC_VER ++# undef int64_t ++# define int64_t __int64 ++# define GL_INT64_T ++#elif @HAVE_LONG_LONG_INT@ ++# undef int64_t ++# define int64_t long long int ++# define GL_INT64_T ++#endif ++ ++#if ULONG_MAX >> 31 >> 31 >> 1 == 1 ++# undef uint64_t ++# define uint64_t unsigned long int ++# define GL_UINT64_T ++#elif defined _MSC_VER ++# undef uint64_t ++# define uint64_t unsigned __int64 ++# define GL_UINT64_T ++#elif @HAVE_UNSIGNED_LONG_LONG_INT@ ++# undef uint64_t ++# define uint64_t unsigned long long int ++# define GL_UINT64_T ++#endif ++ ++/* Avoid collision with Solaris 2.5.1 etc. */ ++#define _UINT8_T ++#define _UINT32_T ++#define _UINT64_T ++ ++ ++/* 7.18.1.2. Minimum-width integer types */ ++ ++/* Here we assume a standard architecture where the hardware integer ++ types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types ++ are the same as the corresponding N_t types. */ ++ ++#undef int_least8_t ++#undef uint_least8_t ++#undef int_least16_t ++#undef uint_least16_t ++#undef int_least32_t ++#undef uint_least32_t ++#undef int_least64_t ++#undef uint_least64_t ++#define int_least8_t int8_t ++#define uint_least8_t uint8_t ++#define int_least16_t int16_t ++#define uint_least16_t uint16_t ++#define int_least32_t int32_t ++#define uint_least32_t uint32_t ++#ifdef GL_INT64_T ++# define int_least64_t int64_t ++#endif ++#ifdef GL_UINT64_T ++# define uint_least64_t uint64_t ++#endif ++ ++/* 7.18.1.3. Fastest minimum-width integer types */ ++ ++/* Note: Other substitutes may define these types differently. ++ It is not recommended to use these types in public header files. */ ++ ++/* Here we assume a standard architecture where the hardware integer ++ types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types ++ are taken from the same list of types. Assume that 'long int' ++ is fast enough for all narrower integers. */ ++ ++#undef int_fast8_t ++#undef uint_fast8_t ++#undef int_fast16_t ++#undef uint_fast16_t ++#undef int_fast32_t ++#undef uint_fast32_t ++#undef int_fast64_t ++#undef uint_fast64_t ++#define int_fast8_t long int ++#define uint_fast8_t unsigned int_fast8_t ++#define int_fast16_t long int ++#define uint_fast16_t unsigned int_fast16_t ++#define int_fast32_t long int ++#define uint_fast32_t unsigned int_fast32_t ++#ifdef GL_INT64_T ++# define int_fast64_t int64_t ++#endif ++#ifdef GL_UINT64_T ++# define uint_fast64_t uint64_t ++#endif ++ ++/* 7.18.1.4. Integer types capable of holding object pointers */ ++ ++#undef intptr_t ++#undef uintptr_t ++#define intptr_t long int ++#define uintptr_t unsigned long int ++ ++/* 7.18.1.5. Greatest-width integer types */ ++ ++/* Note: These types are compiler dependent. It may be unwise to use them in ++ public header files. */ ++ ++#undef intmax_t ++#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 ++# define intmax_t long long int ++#elif defined GL_INT64_T ++# define intmax_t int64_t ++#else ++# define intmax_t long int ++#endif ++ ++#undef uintmax_t ++#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 ++# define uintmax_t unsigned long long int ++#elif defined GL_UINT64_T ++# define uintmax_t uint64_t ++#else ++# define uintmax_t unsigned long int ++#endif ++ ++/* Verify that intmax_t and uintmax_t have the same size. Too much code ++ breaks if this is not the case. If this check fails, the reason is likely ++ to be found in the autoconf macros. */ ++typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 1]; ++ ++/* 7.18.2. Limits of specified-width integer types */ ++ ++#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS ++ ++/* 7.18.2.1. Limits of exact-width integer types */ ++ ++/* Here we assume a standard architecture where the hardware integer ++ types have 8, 16, 32, optionally 64 bits. */ ++ ++#undef INT8_MIN ++#undef INT8_MAX ++#undef UINT8_MAX ++#define INT8_MIN (~ INT8_MAX) ++#define INT8_MAX 127 ++#define UINT8_MAX 255 ++ ++#undef INT16_MIN ++#undef INT16_MAX ++#undef UINT16_MAX ++#define INT16_MIN (~ INT16_MAX) ++#define INT16_MAX 32767 ++#define UINT16_MAX 65535 ++ ++#undef INT32_MIN ++#undef INT32_MAX ++#undef UINT32_MAX ++#define INT32_MIN (~ INT32_MAX) ++#define INT32_MAX 2147483647 ++#define UINT32_MAX 4294967295U ++ ++#undef INT64_MIN ++#undef INT64_MAX ++#ifdef GL_INT64_T ++/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 ++ evaluates the latter incorrectly in preprocessor expressions. */ ++# define INT64_MIN (- INTMAX_C (1) << 63) ++# define INT64_MAX INTMAX_C (9223372036854775807) ++#endif ++ ++#undef UINT64_MAX ++#ifdef GL_UINT64_T ++# define UINT64_MAX UINTMAX_C (18446744073709551615) ++#endif ++ ++/* 7.18.2.2. Limits of minimum-width integer types */ ++ ++/* Here we assume a standard architecture where the hardware integer ++ types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types ++ are the same as the corresponding N_t types. */ ++ ++#undef INT_LEAST8_MIN ++#undef INT_LEAST8_MAX ++#undef UINT_LEAST8_MAX ++#define INT_LEAST8_MIN INT8_MIN ++#define INT_LEAST8_MAX INT8_MAX ++#define UINT_LEAST8_MAX UINT8_MAX ++ ++#undef INT_LEAST16_MIN ++#undef INT_LEAST16_MAX ++#undef UINT_LEAST16_MAX ++#define INT_LEAST16_MIN INT16_MIN ++#define INT_LEAST16_MAX INT16_MAX ++#define UINT_LEAST16_MAX UINT16_MAX ++ ++#undef INT_LEAST32_MIN ++#undef INT_LEAST32_MAX ++#undef UINT_LEAST32_MAX ++#define INT_LEAST32_MIN INT32_MIN ++#define INT_LEAST32_MAX INT32_MAX ++#define UINT_LEAST32_MAX UINT32_MAX ++ ++#undef INT_LEAST64_MIN ++#undef INT_LEAST64_MAX ++#ifdef GL_INT64_T ++# define INT_LEAST64_MIN INT64_MIN ++# define INT_LEAST64_MAX INT64_MAX ++#endif ++ ++#undef UINT_LEAST64_MAX ++#ifdef GL_UINT64_T ++# define UINT_LEAST64_MAX UINT64_MAX ++#endif ++ ++/* 7.18.2.3. Limits of fastest minimum-width integer types */ ++ ++/* Here we assume a standard architecture where the hardware integer ++ types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types ++ are taken from the same list of types. */ ++ ++#undef INT_FAST8_MIN ++#undef INT_FAST8_MAX ++#undef UINT_FAST8_MAX ++#define INT_FAST8_MIN LONG_MIN ++#define INT_FAST8_MAX LONG_MAX ++#define UINT_FAST8_MAX ULONG_MAX ++ ++#undef INT_FAST16_MIN ++#undef INT_FAST16_MAX ++#undef UINT_FAST16_MAX ++#define INT_FAST16_MIN LONG_MIN ++#define INT_FAST16_MAX LONG_MAX ++#define UINT_FAST16_MAX ULONG_MAX ++ ++#undef INT_FAST32_MIN ++#undef INT_FAST32_MAX ++#undef UINT_FAST32_MAX ++#define INT_FAST32_MIN LONG_MIN ++#define INT_FAST32_MAX LONG_MAX ++#define UINT_FAST32_MAX ULONG_MAX ++ ++#undef INT_FAST64_MIN ++#undef INT_FAST64_MAX ++#ifdef GL_INT64_T ++# define INT_FAST64_MIN INT64_MIN ++# define INT_FAST64_MAX INT64_MAX ++#endif ++ ++#undef UINT_FAST64_MAX ++#ifdef GL_UINT64_T ++# define UINT_FAST64_MAX UINT64_MAX ++#endif ++ ++/* 7.18.2.4. Limits of integer types capable of holding object pointers */ ++ ++#undef INTPTR_MIN ++#undef INTPTR_MAX ++#undef UINTPTR_MAX ++#define INTPTR_MIN LONG_MIN ++#define INTPTR_MAX LONG_MAX ++#define UINTPTR_MAX ULONG_MAX ++ ++/* 7.18.2.5. Limits of greatest-width integer types */ ++ ++#undef INTMAX_MIN ++#undef INTMAX_MAX ++#ifdef INT64_MAX ++# define INTMAX_MIN INT64_MIN ++# define INTMAX_MAX INT64_MAX ++#else ++# define INTMAX_MIN INT32_MIN ++# define INTMAX_MAX INT32_MAX ++#endif ++ ++#undef UINTMAX_MAX ++#ifdef UINT64_MAX ++# define UINTMAX_MAX UINT64_MAX ++#else ++# define UINTMAX_MAX UINT32_MAX ++#endif ++ ++/* 7.18.3. Limits of other integer types */ ++ ++/* ptrdiff_t limits */ ++#undef PTRDIFF_MIN ++#undef PTRDIFF_MAX ++#define PTRDIFF_MIN \ ++ _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) ++#define PTRDIFF_MAX \ ++ _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) ++ ++/* sig_atomic_t limits */ ++#undef SIG_ATOMIC_MIN ++#undef SIG_ATOMIC_MAX ++#define SIG_ATOMIC_MIN \ ++ _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ ++ 0@SIG_ATOMIC_T_SUFFIX@) ++#define SIG_ATOMIC_MAX \ ++ _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ ++ 0@SIG_ATOMIC_T_SUFFIX@) ++ ++ ++/* size_t limit */ ++#undef SIZE_MAX ++#define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) ++ ++/* wchar_t limits */ ++#undef WCHAR_MIN ++#undef WCHAR_MAX ++#define WCHAR_MIN \ ++ _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) ++#define WCHAR_MAX \ ++ _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) ++ ++/* wint_t limits */ ++#undef WINT_MIN ++#undef WINT_MAX ++#define WINT_MIN \ ++ _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) ++#define WINT_MAX \ ++ _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) ++ ++#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */ ++ ++/* 7.18.4. Macros for integer constants */ ++ ++#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS ++ ++/* 7.18.4.1. Macros for minimum-width integer constants */ ++/* According to ISO C 99 Technical Corrigendum 1 */ ++ ++/* Here we assume a standard architecture where the hardware integer ++ types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ ++ ++#undef INT8_C ++#undef UINT8_C ++#define INT8_C(x) x ++#define UINT8_C(x) x ++ ++#undef INT16_C ++#undef UINT16_C ++#define INT16_C(x) x ++#define UINT16_C(x) x ++ ++#undef INT32_C ++#undef UINT32_C ++#define INT32_C(x) x ++#define UINT32_C(x) x ## U ++ ++#undef INT64_C ++#undef UINT64_C ++#if LONG_MAX >> 31 >> 31 == 1 ++# define INT64_C(x) x##L ++#elif defined _MSC_VER ++# define INT64_C(x) x##i64 ++#elif @HAVE_LONG_LONG_INT@ ++# define INT64_C(x) x##LL ++#endif ++#if ULONG_MAX >> 31 >> 31 >> 1 == 1 ++# define UINT64_C(x) x##UL ++#elif defined _MSC_VER ++# define UINT64_C(x) x##ui64 ++#elif @HAVE_UNSIGNED_LONG_LONG_INT@ ++# define UINT64_C(x) x##ULL ++#endif ++ ++/* 7.18.4.2. Macros for greatest-width integer constants */ ++ ++#undef INTMAX_C ++#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 ++# define INTMAX_C(x) x##LL ++#elif defined GL_INT64_T ++# define INTMAX_C(x) INT64_C(x) ++#else ++# define INTMAX_C(x) x##L ++#endif ++ ++#undef UINTMAX_C ++#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 ++# define UINTMAX_C(x) x##ULL ++#elif defined GL_UINT64_T ++# define UINTMAX_C(x) UINT64_C(x) ++#else ++# define UINTMAX_C(x) x##UL ++#endif ++ ++#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */ ++ ++#endif /* _GL_STDINT_H */ ++#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/stdio.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/stdio.in.h +--- gtk-vnc-0.3.7.mingw/gnulib/lib/stdio.in.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/stdio.in.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,475 @@ ++/* A GNU-like . ++ ++ Copyright (C) 2004, 2007-2008 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++@PRAGMA_SYSTEM_HEADER@ ++ ++#if defined __need_FILE || defined __need___FILE ++/* Special invocation convention inside glibc header files. */ ++ ++#@INCLUDE_NEXT@ @NEXT_STDIO_H@ ++ ++#else ++/* Normal invocation convention. */ ++ ++#ifndef _GL_STDIO_H ++ ++/* The include_next requires a split double-inclusion guard. */ ++#@INCLUDE_NEXT@ @NEXT_STDIO_H@ ++ ++#ifndef _GL_STDIO_H ++#define _GL_STDIO_H ++ ++#include ++#include ++ ++#if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \ ++ || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \ ++ || (@GNULIB_GETDELIM@ && !@HAVE_DECL_GETDELIM@) \ ++ || (@GNULIB_GETLINE@ && (!@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@)) ++/* Get off_t and ssize_t. */ ++# include ++#endif ++ ++#ifndef __attribute__ ++/* This feature is available in gcc versions 2.5 and later. */ ++# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) ++# define __attribute__(Spec) /* empty */ ++# endif ++/* The __-protected variants of `format' and `printf' attributes ++ are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ ++# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ++# define __format__ format ++# define __printf__ printf ++# endif ++#endif ++ ++ ++/* The definition of GL_LINK_WARNING is copied here. */ ++ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++#if @GNULIB_FPRINTF_POSIX@ ++# if @REPLACE_FPRINTF@ ++# define fprintf rpl_fprintf ++extern int fprintf (FILE *fp, const char *format, ...) ++ __attribute__ ((__format__ (__printf__, 2, 3))); ++# endif ++#elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ ++# define fprintf rpl_fprintf ++extern int fprintf (FILE *fp, const char *format, ...) ++ __attribute__ ((__format__ (__printf__, 2, 3))); ++#elif defined GNULIB_POSIXCHECK ++# undef fprintf ++# define fprintf \ ++ (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \ ++ "use gnulib module fprintf-posix for portable " \ ++ "POSIX compliance"), \ ++ fprintf) ++#endif ++ ++#if @GNULIB_VFPRINTF_POSIX@ ++# if @REPLACE_VFPRINTF@ ++# define vfprintf rpl_vfprintf ++extern int vfprintf (FILE *fp, const char *format, va_list args) ++ __attribute__ ((__format__ (__printf__, 2, 0))); ++# endif ++#elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ ++# define vfprintf rpl_vfprintf ++extern int vfprintf (FILE *fp, const char *format, va_list args) ++ __attribute__ ((__format__ (__printf__, 2, 0))); ++#elif defined GNULIB_POSIXCHECK ++# undef vfprintf ++# define vfprintf(s,f,a) \ ++ (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \ ++ "use gnulib module vfprintf-posix for portable " \ ++ "POSIX compliance"), \ ++ vfprintf (s, f, a)) ++#endif ++ ++#if @GNULIB_PRINTF_POSIX@ ++# if @REPLACE_PRINTF@ ++/* Don't break __attribute__((format(printf,M,N))). */ ++# define printf __printf__ ++extern int printf (const char *format, ...) ++ __attribute__ ((__format__ (__printf__, 1, 2))); ++# endif ++#elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ ++/* Don't break __attribute__((format(printf,M,N))). */ ++# define printf __printf__ ++extern int printf (const char *format, ...) ++ __attribute__ ((__format__ (__printf__, 1, 2))); ++#elif defined GNULIB_POSIXCHECK ++# undef printf ++# define printf \ ++ (GL_LINK_WARNING ("printf is not always POSIX compliant - " \ ++ "use gnulib module printf-posix for portable " \ ++ "POSIX compliance"), \ ++ printf) ++/* Don't break __attribute__((format(printf,M,N))). */ ++# define format(kind,m,n) format (__##kind##__, m, n) ++# define __format__(kind,m,n) __format__ (__##kind##__, m, n) ++# define ____printf____ __printf__ ++# define ____scanf____ __scanf__ ++# define ____strftime____ __strftime__ ++# define ____strfmon____ __strfmon__ ++#endif ++ ++#if @GNULIB_VPRINTF_POSIX@ ++# if @REPLACE_VPRINTF@ ++# define vprintf rpl_vprintf ++extern int vprintf (const char *format, va_list args) ++ __attribute__ ((__format__ (__printf__, 1, 0))); ++# endif ++#elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ ++# define vprintf rpl_vprintf ++extern int vprintf (const char *format, va_list args) ++ __attribute__ ((__format__ (__printf__, 1, 0))); ++#elif defined GNULIB_POSIXCHECK ++# undef vprintf ++# define vprintf(f,a) \ ++ (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \ ++ "use gnulib module vprintf-posix for portable " \ ++ "POSIX compliance"), \ ++ vprintf (f, a)) ++#endif ++ ++#if @GNULIB_SNPRINTF@ ++# if @REPLACE_SNPRINTF@ ++# define snprintf rpl_snprintf ++# endif ++# if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@ ++extern int snprintf (char *str, size_t size, const char *format, ...) ++ __attribute__ ((__format__ (__printf__, 3, 4))); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef snprintf ++# define snprintf \ ++ (GL_LINK_WARNING ("snprintf is unportable - " \ ++ "use gnulib module snprintf for portability"), \ ++ snprintf) ++#endif ++ ++#if @GNULIB_VSNPRINTF@ ++# if @REPLACE_VSNPRINTF@ ++# define vsnprintf rpl_vsnprintf ++# endif ++# if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@ ++extern int vsnprintf (char *str, size_t size, const char *format, va_list args) ++ __attribute__ ((__format__ (__printf__, 3, 0))); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef vsnprintf ++# define vsnprintf(b,s,f,a) \ ++ (GL_LINK_WARNING ("vsnprintf is unportable - " \ ++ "use gnulib module vsnprintf for portability"), \ ++ vsnprintf (b, s, f, a)) ++#endif ++ ++#if @GNULIB_SPRINTF_POSIX@ ++# if @REPLACE_SPRINTF@ ++# define sprintf rpl_sprintf ++extern int sprintf (char *str, const char *format, ...) ++ __attribute__ ((__format__ (__printf__, 2, 3))); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef sprintf ++# define sprintf \ ++ (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \ ++ "use gnulib module sprintf-posix for portable " \ ++ "POSIX compliance"), \ ++ sprintf) ++#endif ++ ++#if @GNULIB_VSPRINTF_POSIX@ ++# if @REPLACE_VSPRINTF@ ++# define vsprintf rpl_vsprintf ++extern int vsprintf (char *str, const char *format, va_list args) ++ __attribute__ ((__format__ (__printf__, 2, 0))); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef vsprintf ++# define vsprintf(b,f,a) \ ++ (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \ ++ "use gnulib module vsprintf-posix for portable " \ ++ "POSIX compliance"), \ ++ vsprintf (b, f, a)) ++#endif ++ ++#if @GNULIB_VASPRINTF@ ++# if @REPLACE_VASPRINTF@ ++# define asprintf rpl_asprintf ++# define vasprintf rpl_vasprintf ++# endif ++# if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@ ++ /* Write formatted output to a string dynamically allocated with malloc(). ++ If the memory allocation succeeds, store the address of the string in ++ *RESULT and return the number of resulting bytes, excluding the trailing ++ NUL. Upon memory allocation error, or some other error, return -1. */ ++ extern int asprintf (char **result, const char *format, ...) ++ __attribute__ ((__format__ (__printf__, 2, 3))); ++ extern int vasprintf (char **result, const char *format, va_list args) ++ __attribute__ ((__format__ (__printf__, 2, 0))); ++# endif ++#endif ++ ++#if @GNULIB_OBSTACK_PRINTF@ ++# if @REPLACE_OBSTACK_PRINTF@ ++# define obstack_printf rpl_osbtack_printf ++# define obstack_vprintf rpl_obstack_vprintf ++# endif ++# if @REPLACE_OBSTACK_PRINTF@ || !@HAVE_DECL_OBSTACK_PRINTF@ ++ struct obstack; ++ /* Grow an obstack with formatted output. Return the number of ++ bytes added to OBS. No trailing nul byte is added, and the ++ object should be closed with obstack_finish before use. Upon ++ memory allocation error, call obstack_alloc_failed_handler. Upon ++ other error, return -1. */ ++ extern int obstack_printf (struct obstack *obs, const char *format, ...) ++ __attribute__ ((__format__ (__printf__, 2, 3))); ++ extern int obstack_vprintf (struct obstack *obs, const char *format, ++ va_list args) ++ __attribute__ ((__format__ (__printf__, 2, 0))); ++# endif ++#endif ++ ++#if @GNULIB_FOPEN@ ++# if @REPLACE_FOPEN@ ++# undef fopen ++# define fopen rpl_fopen ++extern FILE * fopen (const char *filename, const char *mode); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef fopen ++# define fopen(f,m) \ ++ (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \ ++ "use gnulib module fopen for portability"), \ ++ fopen (f, m)) ++#endif ++ ++#if @GNULIB_FREOPEN@ ++# if @REPLACE_FREOPEN@ ++# undef freopen ++# define freopen rpl_freopen ++extern FILE * freopen (const char *filename, const char *mode, FILE *stream); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef freopen ++# define freopen(f,m,s) \ ++ (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \ ++ "use gnulib module freopen for portability"), \ ++ freopen (f, m, s)) ++#endif ++ ++#if @GNULIB_FSEEKO@ ++# if @REPLACE_FSEEKO@ ++/* Provide fseek, fseeko functions that are aware of a preceding ++ fflush(), and which detect pipes. */ ++# define fseeko rpl_fseeko ++extern int fseeko (FILE *fp, off_t offset, int whence); ++# define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence) ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef fseeko ++# define fseeko(f,o,w) \ ++ (GL_LINK_WARNING ("fseeko is unportable - " \ ++ "use gnulib module fseeko for portability"), \ ++ fseeko (f, o, w)) ++#endif ++ ++#if @GNULIB_FSEEK@ && @REPLACE_FSEEK@ ++extern int rpl_fseek (FILE *fp, long offset, int whence); ++# undef fseek ++# if defined GNULIB_POSIXCHECK ++# define fseek(f,o,w) \ ++ (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \ ++ "on 32-bit platforms - " \ ++ "use fseeko function for handling of large files"), \ ++ rpl_fseek (f, o, w)) ++# else ++# define fseek rpl_fseek ++# endif ++#elif defined GNULIB_POSIXCHECK ++# ifndef fseek ++# define fseek(f,o,w) \ ++ (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \ ++ "on 32-bit platforms - " \ ++ "use fseeko function for handling of large files"), \ ++ fseek (f, o, w)) ++# endif ++#endif ++ ++#if @GNULIB_FTELLO@ ++# if @REPLACE_FTELLO@ ++# define ftello rpl_ftello ++extern off_t ftello (FILE *fp); ++# define ftell(fp) ftello (fp) ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef ftello ++# define ftello(f) \ ++ (GL_LINK_WARNING ("ftello is unportable - " \ ++ "use gnulib module ftello for portability"), \ ++ ftello (f)) ++#endif ++ ++#if @GNULIB_FTELL@ && @REPLACE_FTELL@ ++extern long rpl_ftell (FILE *fp); ++# undef ftell ++# if GNULIB_POSIXCHECK ++# define ftell(f) \ ++ (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \ ++ "on 32-bit platforms - " \ ++ "use ftello function for handling of large files"), \ ++ rpl_ftell (f)) ++# else ++# define ftell rpl_ftell ++# endif ++#elif defined GNULIB_POSIXCHECK ++# ifndef ftell ++# define ftell(f) \ ++ (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \ ++ "on 32-bit platforms - " \ ++ "use ftello function for handling of large files"), \ ++ ftell (f)) ++# endif ++#endif ++ ++#if @GNULIB_FFLUSH@ ++# if @REPLACE_FFLUSH@ ++# define fflush rpl_fflush ++ /* Flush all pending data on STREAM according to POSIX rules. Both ++ output and seekable input streams are supported. ++ Note! LOSS OF DATA can occur if fflush is applied on an input stream ++ that is _not_seekable_ or on an update stream that is _not_seekable_ ++ and in which the most recent operation was input. Seekability can ++ be tested with lseek(fileno(fp),0,SEEK_CUR). */ ++ extern int fflush (FILE *gl_stream); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef fflush ++# define fflush(f) \ ++ (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \ ++ "use gnulib module fflush for portable " \ ++ "POSIX compliance"), \ ++ fflush (f)) ++#endif ++ ++#if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ ++# undef fputc ++# define fputc rpl_fputc ++extern int fputc (int c, FILE *stream); ++#endif ++ ++#if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ ++# undef putc ++# define putc rpl_fputc ++extern int putc (int c, FILE *stream); ++#endif ++ ++#if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ ++# undef putchar ++# define putchar rpl_putchar ++extern int putchar (int c); ++#endif ++ ++#if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ ++# undef fputs ++# define fputs rpl_fputs ++extern int fputs (const char *string, FILE *stream); ++#endif ++ ++#if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ ++# undef puts ++# define puts rpl_puts ++extern int puts (const char *string); ++#endif ++ ++#if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ ++# undef fwrite ++# define fwrite rpl_fwrite ++extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream); ++#endif ++ ++#if @GNULIB_GETDELIM@ ++# if !@HAVE_DECL_GETDELIM@ ++/* Read input, up to (and including) the next occurrence of DELIMITER, from ++ STREAM, store it in *LINEPTR (and NUL-terminate it). ++ *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE ++ bytes of space. It is realloc'd as necessary. ++ Return the number of bytes read and stored at *LINEPTR (not including the ++ NUL terminator), or -1 on error or EOF. */ ++extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter, ++ FILE *stream); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef getdelim ++# define getdelim(l, s, d, f) \ ++ (GL_LINK_WARNING ("getdelim is unportable - " \ ++ "use gnulib module getdelim for portability"), \ ++ getdelim (l, s, d, f)) ++#endif ++ ++#if @GNULIB_GETLINE@ ++# if @REPLACE_GETLINE@ ++# undef getline ++# define getline rpl_getline ++# endif ++# if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@ ++/* Read a line, up to (and including) the next newline, from STREAM, store it ++ in *LINEPTR (and NUL-terminate it). ++ *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE ++ bytes of space. It is realloc'd as necessary. ++ Return the number of bytes read and stored at *LINEPTR (not including the ++ NUL terminator), or -1 on error or EOF. */ ++extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef getline ++# define getline(l, s, f) \ ++ (GL_LINK_WARNING ("getline is unportable - " \ ++ "use gnulib module getline for portability"), \ ++ getline (l, s, f)) ++#endif ++ ++#if @GNULIB_PERROR@ ++# if @REPLACE_PERROR@ ++# define perror rpl_perror ++/* Print a message to standard error, describing the value of ERRNO, ++ (if STRING is not NULL and not empty) prefixed with STRING and ": ", ++ and terminated with a newline. */ ++extern void perror (const char *string); ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef perror ++# define perror(s) \ ++ (GL_LINK_WARNING ("perror is not always POSIX compliant - " \ ++ "use gnulib module perror for portability"), \ ++ perror (s)) ++#endif ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _GL_STDIO_H */ ++#endif /* _GL_STDIO_H */ ++#endif +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/stdio-write.c gtk-vnc-0.3.7.gnulib/gnulib/lib/stdio-write.c +--- gtk-vnc-0.3.7.mingw/gnulib/lib/stdio-write.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/stdio-write.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,148 @@ ++/* POSIX compatible FILE stream write function. ++ Copyright (C) 2008 Free Software Foundation, Inc. ++ Written by Bruno Haible , 2008. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program. If not, see . */ ++ ++#include ++ ++/* Specification. */ ++#include ++ ++/* Replace these functions only if module 'sigpipe' is requested. */ ++#if GNULIB_SIGPIPE ++ ++/* On native Windows platforms, SIGPIPE does not exist. When write() is ++ called on a pipe with no readers, WriteFile() fails with error ++ GetLastError() = ERROR_NO_DATA, and write() in consequence fails with ++ error EINVAL. This write() function is at the basis of the function ++ which flushes the buffer of a FILE stream. */ ++ ++# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ ++# include ++# include ++# include ++ ++# define WIN32_LEAN_AND_MEAN /* avoid including junk */ ++# include ++ ++# define CALL_WITH_SIGPIPE_EMULATION(RETTYPE, EXPRESSION, FAILED) \ ++ if (ferror (stream)) \ ++ return (EXPRESSION); \ ++ else \ ++ { \ ++ RETTYPE ret; \ ++ SetLastError (0); \ ++ ret = (EXPRESSION); \ ++ if (FAILED && GetLastError () == ERROR_NO_DATA && ferror (stream)) \ ++ { \ ++ int fd = fileno (stream); \ ++ if (fd >= 0 \ ++ && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)\ ++ { \ ++ /* Try to raise signal SIGPIPE. */ \ ++ raise (SIGPIPE); \ ++ /* If it is currently blocked or ignored, change errno from \ ++ EINVAL to EPIPE. */ \ ++ errno = EPIPE; \ ++ } \ ++ } \ ++ return ret; \ ++ } ++ ++# if !REPLACE_PRINTF_POSIX /* avoid collision with printf.c */ ++int ++printf (const char *format, ...) ++{ ++ int retval; ++ va_list args; ++ ++ va_start (args, format); ++ retval = vfprintf (stdout, format, args); ++ va_end (args); ++ ++ return retval; ++} ++# endif ++ ++# if !REPLACE_FPRINTF_POSIX /* avoid collision with fprintf.c */ ++int ++fprintf (FILE *stream, const char *format, ...) ++{ ++ int retval; ++ va_list args; ++ ++ va_start (args, format); ++ retval = vfprintf (stream, format, args); ++ va_end (args); ++ ++ return retval; ++} ++# endif ++ ++# if !REPLACE_VFPRINTF_POSIX /* avoid collision with vprintf.c */ ++int ++vprintf (const char *format, va_list args) ++{ ++ return vfprintf (stdout, format, args); ++} ++# endif ++ ++# if !REPLACE_VPRINTF_POSIX /* avoid collision with vfprintf.c */ ++int ++vfprintf (FILE *stream, const char *format, va_list args) ++#undef vfprintf ++{ ++ CALL_WITH_SIGPIPE_EMULATION (int, vfprintf (stream, format, args), ret == EOF) ++} ++# endif ++ ++int ++putchar (int c) ++{ ++ return fputc (c, stdout); ++} ++ ++int ++fputc (int c, FILE *stream) ++#undef fputc ++{ ++ CALL_WITH_SIGPIPE_EMULATION (int, fputc (c, stream), ret == EOF) ++} ++ ++int ++fputs (const char *string, FILE *stream) ++#undef fputs ++{ ++ CALL_WITH_SIGPIPE_EMULATION (int, fputs (string, stream), ret == EOF) ++} ++ ++int ++puts (const char *string) ++#undef puts ++{ ++ FILE *stream = stdout; ++ CALL_WITH_SIGPIPE_EMULATION (int, puts (string), ret == EOF) ++} ++ ++size_t ++fwrite (const void *ptr, size_t s, size_t n, FILE *stream) ++#undef fwrite ++{ ++ CALL_WITH_SIGPIPE_EMULATION (size_t, fwrite (ptr, s, n, stream), ret < n) ++} ++ ++# endif ++#endif +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/sys_socket.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/sys_socket.in.h +--- gtk-vnc-0.3.7.mingw/gnulib/lib/sys_socket.in.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/sys_socket.in.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,386 @@ ++/* Provide a sys/socket header file for systems lacking it (read: MinGW) ++ and for systems where it is incomplete. ++ Copyright (C) 2005-2008 Free Software Foundation, Inc. ++ Written by Simon Josefsson. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++/* This file is supposed to be used on platforms that lack , ++ on platforms where cannot be included standalone, and on ++ platforms where does not provide all necessary definitions. ++ It is intended to provide definitions and prototypes needed by an ++ application. */ ++ ++#ifndef _GL_SYS_SOCKET_H ++ ++#if @HAVE_SYS_SOCKET_H@ ++ ++@PRAGMA_SYSTEM_HEADER@ ++ ++/* On many platforms, assumes prior inclusion of ++ . */ ++# include ++ ++/* The include_next requires a split double-inclusion guard. */ ++# @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@ ++ ++#endif ++ ++#ifndef _GL_SYS_SOCKET_H ++#define _GL_SYS_SOCKET_H ++ ++#if @HAVE_SYS_SOCKET_H@ ++ ++/* A platform that has . */ ++ ++/* For shutdown(). */ ++# if !defined SHUT_RD ++# define SHUT_RD 0 ++# endif ++# if !defined SHUT_WR ++# define SHUT_WR 1 ++# endif ++# if !defined SHUT_RDWR ++# define SHUT_RDWR 2 ++# endif ++ ++#else ++ ++# ifdef __CYGWIN__ ++# error "Cygwin does have a sys/socket.h, doesn't it?!?" ++# endif ++ ++/* A platform that lacks . ++ ++ Currently only MinGW is supported. See the gnulib manual regarding ++ Windows sockets. MinGW has the header files winsock2.h and ++ ws2tcpip.h that declare the sys/socket.h definitions we need. Note ++ that you can influence which definitions you get by setting the ++ WINVER symbol before including these two files. For example, ++ getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that ++ symbol is set indiriectly through WINVER). You can set this by ++ adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your ++ code may not run on older Windows releases then. My Windows 2000 ++ box was not able to run the code, for example. The situation is ++ slightly confusing because: ++ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp ++ suggests that getaddrinfo should be available on all Windows ++ releases. */ ++ ++ ++# if @HAVE_WINSOCK2_H@ ++# include ++# endif ++# if @HAVE_WS2TCPIP_H@ ++# include ++# endif ++ ++/* For shutdown(). */ ++# if !defined SHUT_RD && defined SD_RECEIVE ++# define SHUT_RD SD_RECEIVE ++# endif ++# if !defined SHUT_WR && defined SD_SEND ++# define SHUT_WR SD_SEND ++# endif ++# if !defined SHUT_RDWR && defined SD_BOTH ++# define SHUT_RDWR SD_BOTH ++# endif ++ ++/* The definition of GL_LINK_WARNING is copied here. */ ++ ++# if @HAVE_WINSOCK2_H@ ++/* Include headers needed by the emulation code. */ ++# include ++# include ++ ++typedef int socklen_t; ++ ++# endif ++ ++# ifdef __cplusplus ++extern "C" { ++# endif ++ ++# if @HAVE_WINSOCK2_H@ ++ ++/* Re-define FD_ISSET to avoid a WSA call while we are not using ++ network sockets. */ ++static inline int ++rpl_fd_isset (int fd, fd_set * set) ++{ ++ int i; ++ if (set == NULL) ++ return 0; ++ ++ for (i = 0; i < set->fd_count; i++) ++ if (set->fd_array[i] == fd) ++ return 1; ++ ++ return 0; ++} ++ ++# undef FD_ISSET ++# define FD_ISSET(fd, set) rpl_fd_isset(fd, set) ++ ++# endif ++ ++/* Wrap everything else to use libc file descriptors for sockets. */ ++ ++# if @HAVE_WINSOCK2_H@ ++# undef close ++# define close rpl_close ++extern int rpl_close(int); ++# endif ++ ++# if @GNULIB_SOCKET@ ++# if @HAVE_WINSOCK2_H@ ++# undef socket ++# define socket rpl_socket ++extern int rpl_socket (int, int, int protocol); ++# endif ++# elif @HAVE_WINSOCK2_H@ ++# undef socket ++# define socket socket_used_without_requesting_gnulib_module_socket ++# elif defined GNULIB_POSIXCHECK ++# undef socket ++# define socket(d,t,p) \ ++ (GL_LINK_WARNING ("socket is not always POSIX compliant - " \ ++ "use gnulib module socket for portability"), \ ++ socket (d, t, p)) ++# endif ++ ++# if @GNULIB_CONNECT@ ++# if @HAVE_WINSOCK2_H@ ++# undef connect ++# define connect rpl_connect ++extern int rpl_connect (int, struct sockaddr *, int); ++# endif ++# elif @HAVE_WINSOCK2_H@ ++# undef connect ++# define connect socket_used_without_requesting_gnulib_module_connect ++# elif defined GNULIB_POSIXCHECK ++# undef connect ++# define connect(s,a,l) \ ++ (GL_LINK_WARNING ("connect is not always POSIX compliant - " \ ++ "use gnulib module connect for portability"), \ ++ connect (s, a, l)) ++# endif ++ ++# if @GNULIB_ACCEPT@ ++# if @HAVE_WINSOCK2_H@ ++# undef accept ++# define accept rpl_accept ++extern int rpl_accept (int, struct sockaddr *, int *); ++# endif ++# elif @HAVE_WINSOCK2_H@ ++# undef accept ++# define accept accept_used_without_requesting_gnulib_module_accept ++# elif defined GNULIB_POSIXCHECK ++# undef accept ++# define accept(s,a,l) \ ++ (GL_LINK_WARNING ("accept is not always POSIX compliant - " \ ++ "use gnulib module accept for portability"), \ ++ accept (s, a, l)) ++# endif ++ ++# if @GNULIB_BIND@ ++# if @HAVE_WINSOCK2_H@ ++# undef bind ++# define bind rpl_bind ++extern int rpl_bind (int, struct sockaddr *, int); ++# endif ++# elif @HAVE_WINSOCK2_H@ ++# undef bind ++# define bind bind_used_without_requesting_gnulib_module_bind ++# elif defined GNULIB_POSIXCHECK ++# undef bind ++# define bind(s,a,l) \ ++ (GL_LINK_WARNING ("bind is not always POSIX compliant - " \ ++ "use gnulib module bind for portability"), \ ++ bind (s, a, l)) ++# endif ++ ++# if @GNULIB_GETPEERNAME@ ++# if @HAVE_WINSOCK2_H@ ++# undef getpeername ++# define getpeername rpl_getpeername ++extern int rpl_getpeername (int, struct sockaddr *, int *); ++# endif ++# elif @HAVE_WINSOCK2_H@ ++# undef getpeername ++# define getpeername getpeername_used_without_requesting_gnulib_module_getpeername ++# elif defined GNULIB_POSIXCHECK ++# undef getpeername ++# define getpeername(s,a,l) \ ++ (GL_LINK_WARNING ("getpeername is not always POSIX compliant - " \ ++ "use gnulib module getpeername for portability"), \ ++ getpeername (s, a, l)) ++# endif ++ ++# if @GNULIB_GETSOCKNAME@ ++# if @HAVE_WINSOCK2_H@ ++# undef getsockname ++# define getsockname rpl_getsockname ++extern int rpl_getsockname (int, struct sockaddr *, int *); ++# endif ++# elif @HAVE_WINSOCK2_H@ ++# undef getsockname ++# define getsockname getsockname_used_without_requesting_gnulib_module_getsockname ++# elif defined GNULIB_POSIXCHECK ++# undef getsockname ++# define getsockname(s,a,l) \ ++ (GL_LINK_WARNING ("getsockname is not always POSIX compliant - " \ ++ "use gnulib module getsockname for portability"), \ ++ getsockname (s, a, l)) ++# endif ++ ++# if @GNULIB_GETSOCKOPT@ ++# if @HAVE_WINSOCK2_H@ ++# undef getsockopt ++# define getsockopt rpl_getsockopt ++extern int rpl_getsockopt (int, int, int, void *, int *); ++# endif ++# elif @HAVE_WINSOCK2_H@ ++# undef getsockopt ++# define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt ++# elif defined GNULIB_POSIXCHECK ++# undef getsockopt ++# define getsockopt(s,lvl,o,v,l) \ ++ (GL_LINK_WARNING ("getsockopt is not always POSIX compliant - " \ ++ "use gnulib module getsockopt for portability"), \ ++ getsockopt (s, lvl, o, v, l)) ++# endif ++ ++# if @GNULIB_LISTEN@ ++# if @HAVE_WINSOCK2_H@ ++# undef listen ++# define listen rpl_listen ++extern int rpl_listen (int, int); ++# endif ++# elif @HAVE_WINSOCK2_H@ ++# undef listen ++# define listen listen_used_without_requesting_gnulib_module_listen ++# elif defined GNULIB_POSIXCHECK ++# undef listen ++# define listen(s,b) \ ++ (GL_LINK_WARNING ("listen is not always POSIX compliant - " \ ++ "use gnulib module listen for portability"), \ ++ listen (s, b)) ++# endif ++ ++# if @HAVE_WINSOCK2_H@ ++# undef ioctl ++# define ioctl rpl_ioctl ++extern int rpl_ioctl (int, unsigned long, char *); ++# endif ++ ++# if @GNULIB_RECV@ ++# if @HAVE_WINSOCK2_H@ ++# undef recv ++# define recv rpl_recv ++extern int rpl_recv (int, void *, int, int); ++# endif ++# elif @HAVE_WINSOCK2_H@ ++# undef recv ++# define recv recv_used_without_requesting_gnulib_module_recv ++# elif defined GNULIB_POSIXCHECK ++# undef recv ++# define recv(s,b,n,f) \ ++ (GL_LINK_WARNING ("recv is not always POSIX compliant - " \ ++ "use gnulib module recv for portability"), \ ++ recv (s, b, n, f)) ++# endif ++ ++# if @GNULIB_SEND@ ++# if @HAVE_WINSOCK2_H@ ++# undef send ++# define send rpl_send ++extern int rpl_send (int, const void *, int, int); ++# endif ++# elif @HAVE_WINSOCK2_H@ ++# undef send ++# define send send_used_without_requesting_gnulib_module_send ++# elif defined GNULIB_POSIXCHECK ++# undef send ++# define send(s,b,n,f) \ ++ (GL_LINK_WARNING ("send is not always POSIX compliant - " \ ++ "use gnulib module send for portability"), \ ++ send (s, b, n, f)) ++# endif ++ ++# if @GNULIB_RECVFROM@ ++# if @HAVE_WINSOCK2_H@ ++# undef recvfrom ++# define recvfrom rpl_recvfrom ++extern int rpl_recvfrom (int, void *, int, int, struct sockaddr *, int *); ++# endif ++# elif @HAVE_WINSOCK2_H@ ++# undef recvfrom ++# define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom ++# elif defined GNULIB_POSIXCHECK ++# undef recvfrom ++# define recvfrom(s,b,n,f,a,l) \ ++ (GL_LINK_WARNING ("recvfrom is not always POSIX compliant - " \ ++ "use gnulib module recvfrom for portability"), \ ++ recvfrom (s, b, n, f, a, l)) ++# endif ++ ++# if @GNULIB_SENDTO@ ++# if @HAVE_WINSOCK2_H@ ++# undef sendto ++# define sendto rpl_sendto ++extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int); ++# endif ++# elif @HAVE_WINSOCK2_H@ ++# undef sendto ++# define sendto sendto_used_without_requesting_gnulib_module_sendto ++# elif defined GNULIB_POSIXCHECK ++# undef sendto ++# define sendto(s,b,n,f,a,l) \ ++ (GL_LINK_WARNING ("sendto is not always POSIX compliant - " \ ++ "use gnulib module sendto for portability"), \ ++ sendto (s, b, n, f, a, l)) ++# endif ++ ++# if @GNULIB_SETSOCKOPT@ ++# if @HAVE_WINSOCK2_H@ ++# undef setsockopt ++# define setsockopt rpl_setsockopt ++extern int rpl_setsockopt (int, int, int, const void *, int); ++# endif ++# elif @HAVE_WINSOCK2_H@ ++# undef setsockopt ++# define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt ++# elif defined GNULIB_POSIXCHECK ++# undef setsockopt ++# define setsockopt(s,lvl,o,v,l) \ ++ (GL_LINK_WARNING ("setsockopt is not always POSIX compliant - " \ ++ "use gnulib module setsockopt for portability"), \ ++ setsockopt (s, lvl, o, v, l)) ++# endif ++ ++# if @HAVE_WINSOCK2_H@ ++# undef select ++# define select select_used_without_including_sys_select_h ++# endif ++ ++# ifdef __cplusplus ++} ++# endif ++ ++#endif /* HAVE_SYS_SOCKET_H */ ++ ++#endif /* _GL_SYS_SOCKET_H */ ++#endif /* _GL_SYS_SOCKET_H */ +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/vasnprintf.c gtk-vnc-0.3.7.gnulib/gnulib/lib/vasnprintf.c +--- gtk-vnc-0.3.7.mingw/gnulib/lib/vasnprintf.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/vasnprintf.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,4887 @@ ++/* vsprintf with automatic memory allocation. ++ Copyright (C) 1999, 2002-2008 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License along ++ with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++/* This file can be parametrized with the following macros: ++ VASNPRINTF The name of the function being defined. ++ FCHAR_T The element type of the format string. ++ DCHAR_T The element type of the destination (result) string. ++ FCHAR_T_ONLY_ASCII Set to 1 to enable verification that all characters ++ in the format string are ASCII. MUST be set if ++ FCHAR_T and DCHAR_T are not the same type. ++ DIRECTIVE Structure denoting a format directive. ++ Depends on FCHAR_T. ++ DIRECTIVES Structure denoting the set of format directives of a ++ format string. Depends on FCHAR_T. ++ PRINTF_PARSE Function that parses a format string. ++ Depends on FCHAR_T. ++ DCHAR_CPY memcpy like function for DCHAR_T[] arrays. ++ DCHAR_SET memset like function for DCHAR_T[] arrays. ++ DCHAR_MBSNLEN mbsnlen like function for DCHAR_T[] arrays. ++ SNPRINTF The system's snprintf (or similar) function. ++ This may be either snprintf or swprintf. ++ TCHAR_T The element type of the argument and result string ++ of the said SNPRINTF function. This may be either ++ char or wchar_t. The code exploits that ++ sizeof (TCHAR_T) | sizeof (DCHAR_T) and ++ alignof (TCHAR_T) <= alignof (DCHAR_T). ++ DCHAR_IS_TCHAR Set to 1 if DCHAR_T and TCHAR_T are the same type. ++ DCHAR_CONV_FROM_ENCODING A function to convert from char[] to DCHAR[]. ++ DCHAR_IS_UINT8_T Set to 1 if DCHAR_T is uint8_t. ++ DCHAR_IS_UINT16_T Set to 1 if DCHAR_T is uint16_t. ++ DCHAR_IS_UINT32_T Set to 1 if DCHAR_T is uint32_t. */ ++ ++/* Tell glibc's to provide a prototype for snprintf(). ++ This must come before because may include ++ , and once has been included, it's too late. */ ++#ifndef _GNU_SOURCE ++# define _GNU_SOURCE 1 ++#endif ++ ++#ifndef VASNPRINTF ++# include ++#endif ++#ifndef IN_LIBINTL ++# include ++#endif ++ ++/* Specification. */ ++#ifndef VASNPRINTF ++# if WIDE_CHAR_VERSION ++# include "vasnwprintf.h" ++# else ++# include "vasnprintf.h" ++# endif ++#endif ++ ++#include /* localeconv() */ ++#include /* snprintf(), sprintf() */ ++#include /* abort(), malloc(), realloc(), free() */ ++#include /* memcpy(), strlen() */ ++#include /* errno */ ++#include /* CHAR_BIT */ ++#include /* DBL_MAX_EXP, LDBL_MAX_EXP */ ++#if HAVE_NL_LANGINFO ++# include ++#endif ++#ifndef VASNPRINTF ++# if WIDE_CHAR_VERSION ++# include "wprintf-parse.h" ++# else ++# include "printf-parse.h" ++# endif ++#endif ++ ++/* Checked size_t computations. */ ++#include "xsize.h" ++ ++#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL ++# include ++# include "float+.h" ++#endif ++ ++#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL ++# include ++# include "isnand-nolibm.h" ++#endif ++ ++#if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) && !defined IN_LIBINTL ++# include ++# include "isnanl-nolibm.h" ++# include "fpucw.h" ++#endif ++ ++#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL ++# include ++# include "isnand-nolibm.h" ++# include "printf-frexp.h" ++#endif ++ ++#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL ++# include ++# include "isnanl-nolibm.h" ++# include "printf-frexpl.h" ++# include "fpucw.h" ++#endif ++ ++#if HAVE_WCHAR_T ++# if HAVE_WCSLEN ++# define local_wcslen wcslen ++# else ++ /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid ++ a dependency towards this library, here is a local substitute. ++ Define this substitute only once, even if this file is included ++ twice in the same compilation unit. */ ++# ifndef local_wcslen_defined ++# define local_wcslen_defined 1 ++static size_t ++local_wcslen (const wchar_t *s) ++{ ++ const wchar_t *ptr; ++ ++ for (ptr = s; *ptr != (wchar_t) 0; ptr++) ++ ; ++ return ptr - s; ++} ++# endif ++# endif ++#endif ++ ++/* Default parameters. */ ++#ifndef VASNPRINTF ++# if WIDE_CHAR_VERSION ++# define VASNPRINTF vasnwprintf ++# define FCHAR_T wchar_t ++# define DCHAR_T wchar_t ++# define TCHAR_T wchar_t ++# define DCHAR_IS_TCHAR 1 ++# define DIRECTIVE wchar_t_directive ++# define DIRECTIVES wchar_t_directives ++# define PRINTF_PARSE wprintf_parse ++# define DCHAR_CPY wmemcpy ++# else ++# define VASNPRINTF vasnprintf ++# define FCHAR_T char ++# define DCHAR_T char ++# define TCHAR_T char ++# define DCHAR_IS_TCHAR 1 ++# define DIRECTIVE char_directive ++# define DIRECTIVES char_directives ++# define PRINTF_PARSE printf_parse ++# define DCHAR_CPY memcpy ++# endif ++#endif ++#if WIDE_CHAR_VERSION ++ /* TCHAR_T is wchar_t. */ ++# define USE_SNPRINTF 1 ++# if HAVE_DECL__SNWPRINTF ++ /* On Windows, the function swprintf() has a different signature than ++ on Unix; we use the _snwprintf() function instead. */ ++# define SNPRINTF _snwprintf ++# else ++ /* Unix. */ ++# define SNPRINTF swprintf ++# endif ++#else ++ /* TCHAR_T is char. */ ++ /* Use snprintf if it exists under the name 'snprintf' or '_snprintf'. ++ But don't use it on BeOS, since BeOS snprintf produces no output if the ++ size argument is >= 0x3000000. ++ Also don't use it on Linux libc5, since there snprintf with size = 1 ++ writes any output without bounds, like sprintf. */ ++# if (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF) && !defined __BEOS__ && !(__GNU_LIBRARY__ == 1) ++# define USE_SNPRINTF 1 ++# else ++# define USE_SNPRINTF 0 ++# endif ++# if HAVE_DECL__SNPRINTF ++ /* Windows. */ ++# define SNPRINTF _snprintf ++# else ++ /* Unix. */ ++# define SNPRINTF snprintf ++ /* Here we need to call the native snprintf, not rpl_snprintf. */ ++# undef snprintf ++# endif ++#endif ++/* Here we need to call the native sprintf, not rpl_sprintf. */ ++#undef sprintf ++ ++/* GCC >= 4.0 with -Wall emits unjustified "... may be used uninitialized" ++ warnings in this file. Use -Dlint to suppress them. */ ++#ifdef lint ++# define IF_LINT(Code) Code ++#else ++# define IF_LINT(Code) /* empty */ ++#endif ++ ++/* Avoid some warnings from "gcc -Wshadow". ++ This file doesn't use the exp() and remainder() functions. */ ++#undef exp ++#define exp expo ++#undef remainder ++#define remainder rem ++ ++#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL ++/* Determine the decimal-point character according to the current locale. */ ++# ifndef decimal_point_char_defined ++# define decimal_point_char_defined 1 ++static char ++decimal_point_char () ++{ ++ const char *point; ++ /* Determine it in a multithread-safe way. We know nl_langinfo is ++ multithread-safe on glibc systems, but is not required to be multithread- ++ safe by POSIX. sprintf(), however, is multithread-safe. localeconv() ++ is rarely multithread-safe. */ ++# if HAVE_NL_LANGINFO && __GLIBC__ ++ point = nl_langinfo (RADIXCHAR); ++# elif 1 ++ char pointbuf[5]; ++ sprintf (pointbuf, "%#.0f", 1.0); ++ point = &pointbuf[1]; ++# else ++ point = localeconv () -> decimal_point; ++# endif ++ /* The decimal point is always a single byte: either '.' or ','. */ ++ return (point[0] != '\0' ? point[0] : '.'); ++} ++# endif ++#endif ++ ++#if NEED_PRINTF_INFINITE_DOUBLE && !NEED_PRINTF_DOUBLE && !defined IN_LIBINTL ++ ++/* Equivalent to !isfinite(x) || x == 0, but does not require libm. */ ++static int ++is_infinite_or_zero (double x) ++{ ++ return isnand (x) || x + x == x; ++} ++ ++#endif ++ ++#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL ++ ++/* Equivalent to !isfinite(x) || x == 0, but does not require libm. */ ++static int ++is_infinite_or_zerol (long double x) ++{ ++ return isnanl (x) || x + x == x; ++} ++ ++#endif ++ ++#if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL ++ ++/* Converting 'long double' to decimal without rare rounding bugs requires ++ real bignums. We use the naming conventions of GNU gmp, but vastly simpler ++ (and slower) algorithms. */ ++ ++typedef unsigned int mp_limb_t; ++# define GMP_LIMB_BITS 32 ++typedef int mp_limb_verify[2 * (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS) - 1]; ++ ++typedef unsigned long long mp_twolimb_t; ++# define GMP_TWOLIMB_BITS 64 ++typedef int mp_twolimb_verify[2 * (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS) - 1]; ++ ++/* Representation of a bignum >= 0. */ ++typedef struct ++{ ++ size_t nlimbs; ++ mp_limb_t *limbs; /* Bits in little-endian order, allocated with malloc(). */ ++} mpn_t; ++ ++/* Compute the product of two bignums >= 0. ++ Return the allocated memory in case of success, NULL in case of memory ++ allocation failure. */ ++static void * ++multiply (mpn_t src1, mpn_t src2, mpn_t *dest) ++{ ++ const mp_limb_t *p1; ++ const mp_limb_t *p2; ++ size_t len1; ++ size_t len2; ++ ++ if (src1.nlimbs <= src2.nlimbs) ++ { ++ len1 = src1.nlimbs; ++ p1 = src1.limbs; ++ len2 = src2.nlimbs; ++ p2 = src2.limbs; ++ } ++ else ++ { ++ len1 = src2.nlimbs; ++ p1 = src2.limbs; ++ len2 = src1.nlimbs; ++ p2 = src1.limbs; ++ } ++ /* Now 0 <= len1 <= len2. */ ++ if (len1 == 0) ++ { ++ /* src1 or src2 is zero. */ ++ dest->nlimbs = 0; ++ dest->limbs = (mp_limb_t *) malloc (1); ++ } ++ else ++ { ++ /* Here 1 <= len1 <= len2. */ ++ size_t dlen; ++ mp_limb_t *dp; ++ size_t k, i, j; ++ ++ dlen = len1 + len2; ++ dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t)); ++ if (dp == NULL) ++ return NULL; ++ for (k = len2; k > 0; ) ++ dp[--k] = 0; ++ for (i = 0; i < len1; i++) ++ { ++ mp_limb_t digit1 = p1[i]; ++ mp_twolimb_t carry = 0; ++ for (j = 0; j < len2; j++) ++ { ++ mp_limb_t digit2 = p2[j]; ++ carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2; ++ carry += dp[i + j]; ++ dp[i + j] = (mp_limb_t) carry; ++ carry = carry >> GMP_LIMB_BITS; ++ } ++ dp[i + len2] = (mp_limb_t) carry; ++ } ++ /* Normalise. */ ++ while (dlen > 0 && dp[dlen - 1] == 0) ++ dlen--; ++ dest->nlimbs = dlen; ++ dest->limbs = dp; ++ } ++ return dest->limbs; ++} ++ ++/* Compute the quotient of a bignum a >= 0 and a bignum b > 0. ++ a is written as a = q * b + r with 0 <= r < b. q is the quotient, r ++ the remainder. ++ Finally, round-to-even is performed: If r > b/2 or if r = b/2 and q is odd, ++ q is incremented. ++ Return the allocated memory in case of success, NULL in case of memory ++ allocation failure. */ ++static void * ++divide (mpn_t a, mpn_t b, mpn_t *q) ++{ ++ /* Algorithm: ++ First normalise a and b: a=[a[m-1],...,a[0]], b=[b[n-1],...,b[0]] ++ with m>=0 and n>0 (in base beta = 2^GMP_LIMB_BITS). ++ If m=n=1, perform a single-precision division: ++ r:=0, j:=m, ++ while j>0 do ++ {Here (q[m-1]*beta^(m-1)+...+q[j]*beta^j) * b[0] + r*beta^j = ++ = a[m-1]*beta^(m-1)+...+a[j]*beta^j und 0<=r=n>1, perform a multiple-precision division: ++ We have a/b < beta^(m-n+1). ++ s:=intDsize-1-(hightest bit in b[n-1]), 0<=s=beta/2. ++ For j=m-n,...,0: {Here 0 <= r < b*beta^(j+1).} ++ Compute q* : ++ q* := floor((r[j+n]*beta+r[j+n-1])/b[n-1]). ++ In case of overflow (q* >= beta) set q* := beta-1. ++ Compute c2 := ((r[j+n]*beta+r[j+n-1]) - q* * b[n-1])*beta + r[j+n-2] ++ and c3 := b[n-2] * q*. ++ {We have 0 <= c2 < 2*beta^2, even 0 <= c2 < beta^2 if no overflow ++ occurred. Furthermore 0 <= c3 < beta^2. ++ If there was overflow and ++ r[j+n]*beta+r[j+n-1] - q* * b[n-1] >= beta, i.e. c2 >= beta^2, ++ the next test can be skipped.} ++ While c3 > c2, {Here 0 <= c2 < c3 < beta^2} ++ Put q* := q* - 1, c2 := c2 + b[n-1]*beta, c3 := c3 - b[n-2]. ++ If q* > 0: ++ Put r := r - b * q* * beta^j. In detail: ++ [r[n+j],...,r[j]] := [r[n+j],...,r[j]] - q* * [b[n-1],...,b[0]]. ++ hence: u:=0, for i:=0 to n-1 do ++ u := u + q* * b[i], ++ r[j+i]:=r[j+i]-(u mod beta) (+ beta, if carry), ++ u:=u div beta (+ 1, if carry in subtraction) ++ r[n+j]:=r[n+j]-u. ++ {Since always u = (q* * [b[i-1],...,b[0]] div beta^i) + 1 ++ < q* + 1 <= beta, ++ the carry u does not overflow.} ++ If a negative carry occurs, put q* := q* - 1 ++ and [r[n+j],...,r[j]] := [r[n+j],...,r[j]] + [0,b[n-1],...,b[0]]. ++ Set q[j] := q*. ++ Normalise [q[m-n],..,q[0]]; this yields the quotient q. ++ Shift [r[n-1],...,r[0]] right by s bits and normalise; this yields the ++ rest r. ++ The room for q[j] can be allocated at the memory location of r[n+j]. ++ Finally, round-to-even: ++ Shift r left by 1 bit. ++ If r > b or if r = b and q[0] is odd, q := q+1. ++ */ ++ const mp_limb_t *a_ptr = a.limbs; ++ size_t a_len = a.nlimbs; ++ const mp_limb_t *b_ptr = b.limbs; ++ size_t b_len = b.nlimbs; ++ mp_limb_t *roomptr; ++ mp_limb_t *tmp_roomptr = NULL; ++ mp_limb_t *q_ptr; ++ size_t q_len; ++ mp_limb_t *r_ptr; ++ size_t r_len; ++ ++ /* Allocate room for a_len+2 digits. ++ (Need a_len+1 digits for the real division and 1 more digit for the ++ final rounding of q.) */ ++ roomptr = (mp_limb_t *) malloc ((a_len + 2) * sizeof (mp_limb_t)); ++ if (roomptr == NULL) ++ return NULL; ++ ++ /* Normalise a. */ ++ while (a_len > 0 && a_ptr[a_len - 1] == 0) ++ a_len--; ++ ++ /* Normalise b. */ ++ for (;;) ++ { ++ if (b_len == 0) ++ /* Division by zero. */ ++ abort (); ++ if (b_ptr[b_len - 1] == 0) ++ b_len--; ++ else ++ break; ++ } ++ ++ /* Here m = a_len >= 0 and n = b_len > 0. */ ++ ++ if (a_len < b_len) ++ { ++ /* m beta^(m-2) <= a/b < beta^m */ ++ r_ptr = roomptr; ++ q_ptr = roomptr + 1; ++ { ++ mp_limb_t den = b_ptr[0]; ++ mp_limb_t remainder = 0; ++ const mp_limb_t *sourceptr = a_ptr + a_len; ++ mp_limb_t *destptr = q_ptr + a_len; ++ size_t count; ++ for (count = a_len; count > 0; count--) ++ { ++ mp_twolimb_t num = ++ ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr; ++ *--destptr = num / den; ++ remainder = num % den; ++ } ++ /* Normalise and store r. */ ++ if (remainder > 0) ++ { ++ r_ptr[0] = remainder; ++ r_len = 1; ++ } ++ else ++ r_len = 0; ++ /* Normalise q. */ ++ q_len = a_len; ++ if (q_ptr[q_len - 1] == 0) ++ q_len--; ++ } ++ } ++ else ++ { ++ /* n>1: multiple precision division. ++ beta^(m-1) <= a < beta^m, beta^(n-1) <= b < beta^n ==> ++ beta^(m-n-1) <= a/b < beta^(m-n+1). */ ++ /* Determine s. */ ++ size_t s; ++ { ++ mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */ ++ s = 31; ++ if (msd >= 0x10000) ++ { ++ msd = msd >> 16; ++ s -= 16; ++ } ++ if (msd >= 0x100) ++ { ++ msd = msd >> 8; ++ s -= 8; ++ } ++ if (msd >= 0x10) ++ { ++ msd = msd >> 4; ++ s -= 4; ++ } ++ if (msd >= 0x4) ++ { ++ msd = msd >> 2; ++ s -= 2; ++ } ++ if (msd >= 0x2) ++ { ++ msd = msd >> 1; ++ s -= 1; ++ } ++ } ++ /* 0 <= s < GMP_LIMB_BITS. ++ Copy b, shifting it left by s bits. */ ++ if (s > 0) ++ { ++ tmp_roomptr = (mp_limb_t *) malloc (b_len * sizeof (mp_limb_t)); ++ if (tmp_roomptr == NULL) ++ { ++ free (roomptr); ++ return NULL; ++ } ++ { ++ const mp_limb_t *sourceptr = b_ptr; ++ mp_limb_t *destptr = tmp_roomptr; ++ mp_twolimb_t accu = 0; ++ size_t count; ++ for (count = b_len; count > 0; count--) ++ { ++ accu += (mp_twolimb_t) *sourceptr++ << s; ++ *destptr++ = (mp_limb_t) accu; ++ accu = accu >> GMP_LIMB_BITS; ++ } ++ /* accu must be zero, since that was how s was determined. */ ++ if (accu != 0) ++ abort (); ++ } ++ b_ptr = tmp_roomptr; ++ } ++ /* Copy a, shifting it left by s bits, yields r. ++ Memory layout: ++ At the beginning: r = roomptr[0..a_len], ++ at the end: r = roomptr[0..b_len-1], q = roomptr[b_len..a_len] */ ++ r_ptr = roomptr; ++ if (s == 0) ++ { ++ memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t)); ++ r_ptr[a_len] = 0; ++ } ++ else ++ { ++ const mp_limb_t *sourceptr = a_ptr; ++ mp_limb_t *destptr = r_ptr; ++ mp_twolimb_t accu = 0; ++ size_t count; ++ for (count = a_len; count > 0; count--) ++ { ++ accu += (mp_twolimb_t) *sourceptr++ << s; ++ *destptr++ = (mp_limb_t) accu; ++ accu = accu >> GMP_LIMB_BITS; ++ } ++ *destptr++ = (mp_limb_t) accu; ++ } ++ q_ptr = roomptr + b_len; ++ q_len = a_len - b_len + 1; /* q will have m-n+1 limbs */ ++ { ++ size_t j = a_len - b_len; /* m-n */ ++ mp_limb_t b_msd = b_ptr[b_len - 1]; /* b[n-1] */ ++ mp_limb_t b_2msd = b_ptr[b_len - 2]; /* b[n-2] */ ++ mp_twolimb_t b_msdd = /* b[n-1]*beta+b[n-2] */ ++ ((mp_twolimb_t) b_msd << GMP_LIMB_BITS) | b_2msd; ++ /* Division loop, traversed m-n+1 times. ++ j counts down, b is unchanged, beta/2 <= b[n-1] < beta. */ ++ for (;;) ++ { ++ mp_limb_t q_star; ++ mp_limb_t c1; ++ if (r_ptr[j + b_len] < b_msd) /* r[j+n] < b[n-1] ? */ ++ { ++ /* Divide r[j+n]*beta+r[j+n-1] by b[n-1], no overflow. */ ++ mp_twolimb_t num = ++ ((mp_twolimb_t) r_ptr[j + b_len] << GMP_LIMB_BITS) ++ | r_ptr[j + b_len - 1]; ++ q_star = num / b_msd; ++ c1 = num % b_msd; ++ } ++ else ++ { ++ /* Overflow, hence r[j+n]*beta+r[j+n-1] >= beta*b[n-1]. */ ++ q_star = (mp_limb_t)~(mp_limb_t)0; /* q* = beta-1 */ ++ /* Test whether r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta ++ <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta ++ <==> b[n-1] < floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) ++ {<= beta !}. ++ If yes, jump directly to the subtraction loop. ++ (Otherwise, r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] < beta ++ <==> floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) = b[n-1] ) */ ++ if (r_ptr[j + b_len] > b_msd ++ || (c1 = r_ptr[j + b_len - 1] + b_msd) < b_msd) ++ /* r[j+n] >= b[n-1]+1 or ++ r[j+n] = b[n-1] and the addition r[j+n-1]+b[n-1] gives a ++ carry. */ ++ goto subtract; ++ } ++ /* q_star = q*, ++ c1 = (r[j+n]*beta+r[j+n-1]) - q* * b[n-1] (>=0, 0, decrease it by ++ b[n-1]*beta+b[n-2]. Because of b[n-1]*beta+b[n-2] >= beta^2/2 ++ this can happen only twice. */ ++ if (c3 > c2) ++ { ++ q_star = q_star - 1; /* q* := q* - 1 */ ++ if (c3 - c2 > b_msdd) ++ q_star = q_star - 1; /* q* := q* - 1 */ ++ } ++ } ++ if (q_star > 0) ++ subtract: ++ { ++ /* Subtract r := r - b * q* * beta^j. */ ++ mp_limb_t cr; ++ { ++ const mp_limb_t *sourceptr = b_ptr; ++ mp_limb_t *destptr = r_ptr + j; ++ mp_twolimb_t carry = 0; ++ size_t count; ++ for (count = b_len; count > 0; count--) ++ { ++ /* Here 0 <= carry <= q*. */ ++ carry = ++ carry ++ + (mp_twolimb_t) q_star * (mp_twolimb_t) *sourceptr++ ++ + (mp_limb_t) ~(*destptr); ++ /* Here 0 <= carry <= beta*q* + beta-1. */ ++ *destptr++ = ~(mp_limb_t) carry; ++ carry = carry >> GMP_LIMB_BITS; /* <= q* */ ++ } ++ cr = (mp_limb_t) carry; ++ } ++ /* Subtract cr from r_ptr[j + b_len], then forget about ++ r_ptr[j + b_len]. */ ++ if (cr > r_ptr[j + b_len]) ++ { ++ /* Subtraction gave a carry. */ ++ q_star = q_star - 1; /* q* := q* - 1 */ ++ /* Add b back. */ ++ { ++ const mp_limb_t *sourceptr = b_ptr; ++ mp_limb_t *destptr = r_ptr + j; ++ mp_limb_t carry = 0; ++ size_t count; ++ for (count = b_len; count > 0; count--) ++ { ++ mp_limb_t source1 = *sourceptr++; ++ mp_limb_t source2 = *destptr; ++ *destptr++ = source1 + source2 + carry; ++ carry = ++ (carry ++ ? source1 >= (mp_limb_t) ~source2 ++ : source1 > (mp_limb_t) ~source2); ++ } ++ } ++ /* Forget about the carry and about r[j+n]. */ ++ } ++ } ++ /* q* is determined. Store it as q[j]. */ ++ q_ptr[j] = q_star; ++ if (j == 0) ++ break; ++ j--; ++ } ++ } ++ r_len = b_len; ++ /* Normalise q. */ ++ if (q_ptr[q_len - 1] == 0) ++ q_len--; ++# if 0 /* Not needed here, since we need r only to compare it with b/2, and ++ b is shifted left by s bits. */ ++ /* Shift r right by s bits. */ ++ if (s > 0) ++ { ++ mp_limb_t ptr = r_ptr + r_len; ++ mp_twolimb_t accu = 0; ++ size_t count; ++ for (count = r_len; count > 0; count--) ++ { ++ accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS; ++ accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s); ++ *ptr = (mp_limb_t) (accu >> GMP_LIMB_BITS); ++ } ++ } ++# endif ++ /* Normalise r. */ ++ while (r_len > 0 && r_ptr[r_len - 1] == 0) ++ r_len--; ++ } ++ /* Compare r << 1 with b. */ ++ if (r_len > b_len) ++ goto increment_q; ++ { ++ size_t i; ++ for (i = b_len;;) ++ { ++ mp_limb_t r_i = ++ (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0) ++ | (i < r_len ? r_ptr[i] << 1 : 0); ++ mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0); ++ if (r_i > b_i) ++ goto increment_q; ++ if (r_i < b_i) ++ goto keep_q; ++ if (i == 0) ++ break; ++ i--; ++ } ++ } ++ if (q_len > 0 && ((q_ptr[0] & 1) != 0)) ++ /* q is odd. */ ++ increment_q: ++ { ++ size_t i; ++ for (i = 0; i < q_len; i++) ++ if (++(q_ptr[i]) != 0) ++ goto keep_q; ++ q_ptr[q_len++] = 1; ++ } ++ keep_q: ++ if (tmp_roomptr != NULL) ++ free (tmp_roomptr); ++ q->limbs = q_ptr; ++ q->nlimbs = q_len; ++ return roomptr; ++} ++ ++/* Convert a bignum a >= 0, multiplied with 10^extra_zeroes, to decimal ++ representation. ++ Destroys the contents of a. ++ Return the allocated memory - containing the decimal digits in low-to-high ++ order, terminated with a NUL character - in case of success, NULL in case ++ of memory allocation failure. */ ++static char * ++convert_to_decimal (mpn_t a, size_t extra_zeroes) ++{ ++ mp_limb_t *a_ptr = a.limbs; ++ size_t a_len = a.nlimbs; ++ /* 0.03345 is slightly larger than log(2)/(9*log(10)). */ ++ size_t c_len = 9 * ((size_t)(a_len * (GMP_LIMB_BITS * 0.03345f)) + 1); ++ char *c_ptr = (char *) malloc (xsum (c_len, extra_zeroes)); ++ if (c_ptr != NULL) ++ { ++ char *d_ptr = c_ptr; ++ for (; extra_zeroes > 0; extra_zeroes--) ++ *d_ptr++ = '0'; ++ while (a_len > 0) ++ { ++ /* Divide a by 10^9, in-place. */ ++ mp_limb_t remainder = 0; ++ mp_limb_t *ptr = a_ptr + a_len; ++ size_t count; ++ for (count = a_len; count > 0; count--) ++ { ++ mp_twolimb_t num = ++ ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr; ++ *ptr = num / 1000000000; ++ remainder = num % 1000000000; ++ } ++ /* Store the remainder as 9 decimal digits. */ ++ for (count = 9; count > 0; count--) ++ { ++ *d_ptr++ = '0' + (remainder % 10); ++ remainder = remainder / 10; ++ } ++ /* Normalize a. */ ++ if (a_ptr[a_len - 1] == 0) ++ a_len--; ++ } ++ /* Remove leading zeroes. */ ++ while (d_ptr > c_ptr && d_ptr[-1] == '0') ++ d_ptr--; ++ /* But keep at least one zero. */ ++ if (d_ptr == c_ptr) ++ *d_ptr++ = '0'; ++ /* Terminate the string. */ ++ *d_ptr = '\0'; ++ } ++ return c_ptr; ++} ++ ++# if NEED_PRINTF_LONG_DOUBLE ++ ++/* Assuming x is finite and >= 0: ++ write x as x = 2^e * m, where m is a bignum. ++ Return the allocated memory in case of success, NULL in case of memory ++ allocation failure. */ ++static void * ++decode_long_double (long double x, int *ep, mpn_t *mp) ++{ ++ mpn_t m; ++ int exp; ++ long double y; ++ size_t i; ++ ++ /* Allocate memory for result. */ ++ m.nlimbs = (LDBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS; ++ m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t)); ++ if (m.limbs == NULL) ++ return NULL; ++ /* Split into exponential part and mantissa. */ ++ y = frexpl (x, &exp); ++ if (!(y >= 0.0L && y < 1.0L)) ++ abort (); ++ /* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * LDBL_MANT_BIT), and the ++ latter is an integer. */ ++ /* Convert the mantissa (y * LDBL_MANT_BIT) to a sequence of limbs. ++ I'm not sure whether it's safe to cast a 'long double' value between ++ 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only ++ 'long double' values between 0 and 2^16 (to 'unsigned int' or 'int', ++ doesn't matter). */ ++# if (LDBL_MANT_BIT % GMP_LIMB_BITS) != 0 ++# if (LDBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2 ++ { ++ mp_limb_t hi, lo; ++ y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % (GMP_LIMB_BITS / 2)); ++ hi = (int) y; ++ y -= hi; ++ if (!(y >= 0.0L && y < 1.0L)) ++ abort (); ++ y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); ++ lo = (int) y; ++ y -= lo; ++ if (!(y >= 0.0L && y < 1.0L)) ++ abort (); ++ m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo; ++ } ++# else ++ { ++ mp_limb_t d; ++ y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % GMP_LIMB_BITS); ++ d = (int) y; ++ y -= d; ++ if (!(y >= 0.0L && y < 1.0L)) ++ abort (); ++ m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = d; ++ } ++# endif ++# endif ++ for (i = LDBL_MANT_BIT / GMP_LIMB_BITS; i > 0; ) ++ { ++ mp_limb_t hi, lo; ++ y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); ++ hi = (int) y; ++ y -= hi; ++ if (!(y >= 0.0L && y < 1.0L)) ++ abort (); ++ y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); ++ lo = (int) y; ++ y -= lo; ++ if (!(y >= 0.0L && y < 1.0L)) ++ abort (); ++ m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo; ++ } ++#if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess ++ precision. */ ++ if (!(y == 0.0L)) ++ abort (); ++#endif ++ /* Normalise. */ ++ while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0) ++ m.nlimbs--; ++ *mp = m; ++ *ep = exp - LDBL_MANT_BIT; ++ return m.limbs; ++} ++ ++# endif ++ ++# if NEED_PRINTF_DOUBLE ++ ++/* Assuming x is finite and >= 0: ++ write x as x = 2^e * m, where m is a bignum. ++ Return the allocated memory in case of success, NULL in case of memory ++ allocation failure. */ ++static void * ++decode_double (double x, int *ep, mpn_t *mp) ++{ ++ mpn_t m; ++ int exp; ++ double y; ++ size_t i; ++ ++ /* Allocate memory for result. */ ++ m.nlimbs = (DBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS; ++ m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t)); ++ if (m.limbs == NULL) ++ return NULL; ++ /* Split into exponential part and mantissa. */ ++ y = frexp (x, &exp); ++ if (!(y >= 0.0 && y < 1.0)) ++ abort (); ++ /* x = 2^exp * y = 2^(exp - DBL_MANT_BIT) * (y * DBL_MANT_BIT), and the ++ latter is an integer. */ ++ /* Convert the mantissa (y * DBL_MANT_BIT) to a sequence of limbs. ++ I'm not sure whether it's safe to cast a 'double' value between ++ 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only ++ 'double' values between 0 and 2^16 (to 'unsigned int' or 'int', ++ doesn't matter). */ ++# if (DBL_MANT_BIT % GMP_LIMB_BITS) != 0 ++# if (DBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2 ++ { ++ mp_limb_t hi, lo; ++ y *= (mp_limb_t) 1 << (DBL_MANT_BIT % (GMP_LIMB_BITS / 2)); ++ hi = (int) y; ++ y -= hi; ++ if (!(y >= 0.0 && y < 1.0)) ++ abort (); ++ y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); ++ lo = (int) y; ++ y -= lo; ++ if (!(y >= 0.0 && y < 1.0)) ++ abort (); ++ m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo; ++ } ++# else ++ { ++ mp_limb_t d; ++ y *= (mp_limb_t) 1 << (DBL_MANT_BIT % GMP_LIMB_BITS); ++ d = (int) y; ++ y -= d; ++ if (!(y >= 0.0 && y < 1.0)) ++ abort (); ++ m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = d; ++ } ++# endif ++# endif ++ for (i = DBL_MANT_BIT / GMP_LIMB_BITS; i > 0; ) ++ { ++ mp_limb_t hi, lo; ++ y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); ++ hi = (int) y; ++ y -= hi; ++ if (!(y >= 0.0 && y < 1.0)) ++ abort (); ++ y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); ++ lo = (int) y; ++ y -= lo; ++ if (!(y >= 0.0 && y < 1.0)) ++ abort (); ++ m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo; ++ } ++ if (!(y == 0.0)) ++ abort (); ++ /* Normalise. */ ++ while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0) ++ m.nlimbs--; ++ *mp = m; ++ *ep = exp - DBL_MANT_BIT; ++ return m.limbs; ++} ++ ++# endif ++ ++/* Assuming x = 2^e * m is finite and >= 0, and n is an integer: ++ Returns the decimal representation of round (x * 10^n). ++ Return the allocated memory - containing the decimal digits in low-to-high ++ order, terminated with a NUL character - in case of success, NULL in case ++ of memory allocation failure. */ ++static char * ++scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n) ++{ ++ int s; ++ size_t extra_zeroes; ++ unsigned int abs_n; ++ unsigned int abs_s; ++ mp_limb_t *pow5_ptr; ++ size_t pow5_len; ++ unsigned int s_limbs; ++ unsigned int s_bits; ++ mpn_t pow5; ++ mpn_t z; ++ void *z_memory; ++ char *digits; ++ ++ if (memory == NULL) ++ return NULL; ++ /* x = 2^e * m, hence ++ y = round (2^e * 10^n * m) = round (2^(e+n) * 5^n * m) ++ = round (2^s * 5^n * m). */ ++ s = e + n; ++ extra_zeroes = 0; ++ /* Factor out a common power of 10 if possible. */ ++ if (s > 0 && n > 0) ++ { ++ extra_zeroes = (s < n ? s : n); ++ s -= extra_zeroes; ++ n -= extra_zeroes; ++ } ++ /* Here y = round (2^s * 5^n * m) * 10^extra_zeroes. ++ Before converting to decimal, we need to compute ++ z = round (2^s * 5^n * m). */ ++ /* Compute 5^|n|, possibly shifted by |s| bits if n and s have the same ++ sign. 2.322 is slightly larger than log(5)/log(2). */ ++ abs_n = (n >= 0 ? n : -n); ++ abs_s = (s >= 0 ? s : -s); ++ pow5_ptr = (mp_limb_t *) malloc (((int)(abs_n * (2.322f / GMP_LIMB_BITS)) + 1 ++ + abs_s / GMP_LIMB_BITS + 1) ++ * sizeof (mp_limb_t)); ++ if (pow5_ptr == NULL) ++ { ++ free (memory); ++ return NULL; ++ } ++ /* Initialize with 1. */ ++ pow5_ptr[0] = 1; ++ pow5_len = 1; ++ /* Multiply with 5^|n|. */ ++ if (abs_n > 0) ++ { ++ static mp_limb_t const small_pow5[13 + 1] = ++ { ++ 1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625, ++ 48828125, 244140625, 1220703125 ++ }; ++ unsigned int n13; ++ for (n13 = 0; n13 <= abs_n; n13 += 13) ++ { ++ mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13]; ++ size_t j; ++ mp_twolimb_t carry = 0; ++ for (j = 0; j < pow5_len; j++) ++ { ++ mp_limb_t digit2 = pow5_ptr[j]; ++ carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2; ++ pow5_ptr[j] = (mp_limb_t) carry; ++ carry = carry >> GMP_LIMB_BITS; ++ } ++ if (carry > 0) ++ pow5_ptr[pow5_len++] = (mp_limb_t) carry; ++ } ++ } ++ s_limbs = abs_s / GMP_LIMB_BITS; ++ s_bits = abs_s % GMP_LIMB_BITS; ++ if (n >= 0 ? s >= 0 : s <= 0) ++ { ++ /* Multiply with 2^|s|. */ ++ if (s_bits > 0) ++ { ++ mp_limb_t *ptr = pow5_ptr; ++ mp_twolimb_t accu = 0; ++ size_t count; ++ for (count = pow5_len; count > 0; count--) ++ { ++ accu += (mp_twolimb_t) *ptr << s_bits; ++ *ptr++ = (mp_limb_t) accu; ++ accu = accu >> GMP_LIMB_BITS; ++ } ++ if (accu > 0) ++ { ++ *ptr = (mp_limb_t) accu; ++ pow5_len++; ++ } ++ } ++ if (s_limbs > 0) ++ { ++ size_t count; ++ for (count = pow5_len; count > 0;) ++ { ++ count--; ++ pow5_ptr[s_limbs + count] = pow5_ptr[count]; ++ } ++ for (count = s_limbs; count > 0;) ++ { ++ count--; ++ pow5_ptr[count] = 0; ++ } ++ pow5_len += s_limbs; ++ } ++ pow5.limbs = pow5_ptr; ++ pow5.nlimbs = pow5_len; ++ if (n >= 0) ++ { ++ /* Multiply m with pow5. No division needed. */ ++ z_memory = multiply (m, pow5, &z); ++ } ++ else ++ { ++ /* Divide m by pow5 and round. */ ++ z_memory = divide (m, pow5, &z); ++ } ++ } ++ else ++ { ++ pow5.limbs = pow5_ptr; ++ pow5.nlimbs = pow5_len; ++ if (n >= 0) ++ { ++ /* n >= 0, s < 0. ++ Multiply m with pow5, then divide by 2^|s|. */ ++ mpn_t numerator; ++ mpn_t denominator; ++ void *tmp_memory; ++ tmp_memory = multiply (m, pow5, &numerator); ++ if (tmp_memory == NULL) ++ { ++ free (pow5_ptr); ++ free (memory); ++ return NULL; ++ } ++ /* Construct 2^|s|. */ ++ { ++ mp_limb_t *ptr = pow5_ptr + pow5_len; ++ size_t i; ++ for (i = 0; i < s_limbs; i++) ++ ptr[i] = 0; ++ ptr[s_limbs] = (mp_limb_t) 1 << s_bits; ++ denominator.limbs = ptr; ++ denominator.nlimbs = s_limbs + 1; ++ } ++ z_memory = divide (numerator, denominator, &z); ++ free (tmp_memory); ++ } ++ else ++ { ++ /* n < 0, s > 0. ++ Multiply m with 2^s, then divide by pow5. */ ++ mpn_t numerator; ++ mp_limb_t *num_ptr; ++ num_ptr = (mp_limb_t *) malloc ((m.nlimbs + s_limbs + 1) ++ * sizeof (mp_limb_t)); ++ if (num_ptr == NULL) ++ { ++ free (pow5_ptr); ++ free (memory); ++ return NULL; ++ } ++ { ++ mp_limb_t *destptr = num_ptr; ++ { ++ size_t i; ++ for (i = 0; i < s_limbs; i++) ++ *destptr++ = 0; ++ } ++ if (s_bits > 0) ++ { ++ const mp_limb_t *sourceptr = m.limbs; ++ mp_twolimb_t accu = 0; ++ size_t count; ++ for (count = m.nlimbs; count > 0; count--) ++ { ++ accu += (mp_twolimb_t) *sourceptr++ << s_bits; ++ *destptr++ = (mp_limb_t) accu; ++ accu = accu >> GMP_LIMB_BITS; ++ } ++ if (accu > 0) ++ *destptr++ = (mp_limb_t) accu; ++ } ++ else ++ { ++ const mp_limb_t *sourceptr = m.limbs; ++ size_t count; ++ for (count = m.nlimbs; count > 0; count--) ++ *destptr++ = *sourceptr++; ++ } ++ numerator.limbs = num_ptr; ++ numerator.nlimbs = destptr - num_ptr; ++ } ++ z_memory = divide (numerator, pow5, &z); ++ free (num_ptr); ++ } ++ } ++ free (pow5_ptr); ++ free (memory); ++ ++ /* Here y = round (x * 10^n) = z * 10^extra_zeroes. */ ++ ++ if (z_memory == NULL) ++ return NULL; ++ digits = convert_to_decimal (z, extra_zeroes); ++ free (z_memory); ++ return digits; ++} ++ ++# if NEED_PRINTF_LONG_DOUBLE ++ ++/* Assuming x is finite and >= 0, and n is an integer: ++ Returns the decimal representation of round (x * 10^n). ++ Return the allocated memory - containing the decimal digits in low-to-high ++ order, terminated with a NUL character - in case of success, NULL in case ++ of memory allocation failure. */ ++static char * ++scale10_round_decimal_long_double (long double x, int n) ++{ ++ int e IF_LINT(= 0); ++ mpn_t m; ++ void *memory = decode_long_double (x, &e, &m); ++ return scale10_round_decimal_decoded (e, m, memory, n); ++} ++ ++# endif ++ ++# if NEED_PRINTF_DOUBLE ++ ++/* Assuming x is finite and >= 0, and n is an integer: ++ Returns the decimal representation of round (x * 10^n). ++ Return the allocated memory - containing the decimal digits in low-to-high ++ order, terminated with a NUL character - in case of success, NULL in case ++ of memory allocation failure. */ ++static char * ++scale10_round_decimal_double (double x, int n) ++{ ++ int e IF_LINT(= 0); ++ mpn_t m; ++ void *memory = decode_double (x, &e, &m); ++ return scale10_round_decimal_decoded (e, m, memory, n); ++} ++ ++# endif ++ ++# if NEED_PRINTF_LONG_DOUBLE ++ ++/* Assuming x is finite and > 0: ++ Return an approximation for n with 10^n <= x < 10^(n+1). ++ The approximation is usually the right n, but may be off by 1 sometimes. */ ++static int ++floorlog10l (long double x) ++{ ++ int exp; ++ long double y; ++ double z; ++ double l; ++ ++ /* Split into exponential part and mantissa. */ ++ y = frexpl (x, &exp); ++ if (!(y >= 0.0L && y < 1.0L)) ++ abort (); ++ if (y == 0.0L) ++ return INT_MIN; ++ if (y < 0.5L) ++ { ++ while (y < (1.0L / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2)))) ++ { ++ y *= 1.0L * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2)); ++ exp -= GMP_LIMB_BITS; ++ } ++ if (y < (1.0L / (1 << 16))) ++ { ++ y *= 1.0L * (1 << 16); ++ exp -= 16; ++ } ++ if (y < (1.0L / (1 << 8))) ++ { ++ y *= 1.0L * (1 << 8); ++ exp -= 8; ++ } ++ if (y < (1.0L / (1 << 4))) ++ { ++ y *= 1.0L * (1 << 4); ++ exp -= 4; ++ } ++ if (y < (1.0L / (1 << 2))) ++ { ++ y *= 1.0L * (1 << 2); ++ exp -= 2; ++ } ++ if (y < (1.0L / (1 << 1))) ++ { ++ y *= 1.0L * (1 << 1); ++ exp -= 1; ++ } ++ } ++ if (!(y >= 0.5L && y < 1.0L)) ++ abort (); ++ /* Compute an approximation for l = log2(x) = exp + log2(y). */ ++ l = exp; ++ z = y; ++ if (z < 0.70710678118654752444) ++ { ++ z *= 1.4142135623730950488; ++ l -= 0.5; ++ } ++ if (z < 0.8408964152537145431) ++ { ++ z *= 1.1892071150027210667; ++ l -= 0.25; ++ } ++ if (z < 0.91700404320467123175) ++ { ++ z *= 1.0905077326652576592; ++ l -= 0.125; ++ } ++ if (z < 0.9576032806985736469) ++ { ++ z *= 1.0442737824274138403; ++ l -= 0.0625; ++ } ++ /* Now 0.95 <= z <= 1.01. */ ++ z = 1 - z; ++ /* log2(1-z) = 1/log(2) * (- z - z^2/2 - z^3/3 - z^4/4 - ...) ++ Four terms are enough to get an approximation with error < 10^-7. */ ++ l -= 1.4426950408889634074 * z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25))); ++ /* Finally multiply with log(2)/log(10), yields an approximation for ++ log10(x). */ ++ l *= 0.30102999566398119523; ++ /* Round down to the next integer. */ ++ return (int) l + (l < 0 ? -1 : 0); ++} ++ ++# endif ++ ++# if NEED_PRINTF_DOUBLE ++ ++/* Assuming x is finite and > 0: ++ Return an approximation for n with 10^n <= x < 10^(n+1). ++ The approximation is usually the right n, but may be off by 1 sometimes. */ ++static int ++floorlog10 (double x) ++{ ++ int exp; ++ double y; ++ double z; ++ double l; ++ ++ /* Split into exponential part and mantissa. */ ++ y = frexp (x, &exp); ++ if (!(y >= 0.0 && y < 1.0)) ++ abort (); ++ if (y == 0.0) ++ return INT_MIN; ++ if (y < 0.5) ++ { ++ while (y < (1.0 / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2)))) ++ { ++ y *= 1.0 * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2)); ++ exp -= GMP_LIMB_BITS; ++ } ++ if (y < (1.0 / (1 << 16))) ++ { ++ y *= 1.0 * (1 << 16); ++ exp -= 16; ++ } ++ if (y < (1.0 / (1 << 8))) ++ { ++ y *= 1.0 * (1 << 8); ++ exp -= 8; ++ } ++ if (y < (1.0 / (1 << 4))) ++ { ++ y *= 1.0 * (1 << 4); ++ exp -= 4; ++ } ++ if (y < (1.0 / (1 << 2))) ++ { ++ y *= 1.0 * (1 << 2); ++ exp -= 2; ++ } ++ if (y < (1.0 / (1 << 1))) ++ { ++ y *= 1.0 * (1 << 1); ++ exp -= 1; ++ } ++ } ++ if (!(y >= 0.5 && y < 1.0)) ++ abort (); ++ /* Compute an approximation for l = log2(x) = exp + log2(y). */ ++ l = exp; ++ z = y; ++ if (z < 0.70710678118654752444) ++ { ++ z *= 1.4142135623730950488; ++ l -= 0.5; ++ } ++ if (z < 0.8408964152537145431) ++ { ++ z *= 1.1892071150027210667; ++ l -= 0.25; ++ } ++ if (z < 0.91700404320467123175) ++ { ++ z *= 1.0905077326652576592; ++ l -= 0.125; ++ } ++ if (z < 0.9576032806985736469) ++ { ++ z *= 1.0442737824274138403; ++ l -= 0.0625; ++ } ++ /* Now 0.95 <= z <= 1.01. */ ++ z = 1 - z; ++ /* log2(1-z) = 1/log(2) * (- z - z^2/2 - z^3/3 - z^4/4 - ...) ++ Four terms are enough to get an approximation with error < 10^-7. */ ++ l -= 1.4426950408889634074 * z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25))); ++ /* Finally multiply with log(2)/log(10), yields an approximation for ++ log10(x). */ ++ l *= 0.30102999566398119523; ++ /* Round down to the next integer. */ ++ return (int) l + (l < 0 ? -1 : 0); ++} ++ ++# endif ++ ++/* Tests whether a string of digits consists of exactly PRECISION zeroes and ++ a single '1' digit. */ ++static int ++is_borderline (const char *digits, size_t precision) ++{ ++ for (; precision > 0; precision--, digits++) ++ if (*digits != '0') ++ return 0; ++ if (*digits != '1') ++ return 0; ++ digits++; ++ return *digits == '\0'; ++} ++ ++#endif ++ ++DCHAR_T * ++VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, ++ const FCHAR_T *format, va_list args) ++{ ++ DIRECTIVES d; ++ arguments a; ++ ++ if (PRINTF_PARSE (format, &d, &a) < 0) ++ /* errno is already set. */ ++ return NULL; ++ ++#define CLEANUP() \ ++ free (d.dir); \ ++ if (a.arg) \ ++ free (a.arg); ++ ++ if (PRINTF_FETCHARGS (args, &a) < 0) ++ { ++ CLEANUP (); ++ errno = EINVAL; ++ return NULL; ++ } ++ ++ { ++ size_t buf_neededlength; ++ TCHAR_T *buf; ++ TCHAR_T *buf_malloced; ++ const FCHAR_T *cp; ++ size_t i; ++ DIRECTIVE *dp; ++ /* Output string accumulator. */ ++ DCHAR_T *result; ++ size_t allocated; ++ size_t length; ++ ++ /* Allocate a small buffer that will hold a directive passed to ++ sprintf or snprintf. */ ++ buf_neededlength = ++ xsum4 (7, d.max_width_length, d.max_precision_length, 6); ++#if HAVE_ALLOCA ++ if (buf_neededlength < 4000 / sizeof (TCHAR_T)) ++ { ++ buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T)); ++ buf_malloced = NULL; ++ } ++ else ++#endif ++ { ++ size_t buf_memsize = xtimes (buf_neededlength, sizeof (TCHAR_T)); ++ if (size_overflow_p (buf_memsize)) ++ goto out_of_memory_1; ++ buf = (TCHAR_T *) malloc (buf_memsize); ++ if (buf == NULL) ++ goto out_of_memory_1; ++ buf_malloced = buf; ++ } ++ ++ if (resultbuf != NULL) ++ { ++ result = resultbuf; ++ allocated = *lengthp; ++ } ++ else ++ { ++ result = NULL; ++ allocated = 0; ++ } ++ length = 0; ++ /* Invariants: ++ result is either == resultbuf or == NULL or malloc-allocated. ++ If length > 0, then result != NULL. */ ++ ++ /* Ensures that allocated >= needed. Aborts through a jump to ++ out_of_memory if needed is SIZE_MAX or otherwise too big. */ ++#define ENSURE_ALLOCATION(needed) \ ++ if ((needed) > allocated) \ ++ { \ ++ size_t memory_size; \ ++ DCHAR_T *memory; \ ++ \ ++ allocated = (allocated > 0 ? xtimes (allocated, 2) : 12); \ ++ if ((needed) > allocated) \ ++ allocated = (needed); \ ++ memory_size = xtimes (allocated, sizeof (DCHAR_T)); \ ++ if (size_overflow_p (memory_size)) \ ++ goto out_of_memory; \ ++ if (result == resultbuf || result == NULL) \ ++ memory = (DCHAR_T *) malloc (memory_size); \ ++ else \ ++ memory = (DCHAR_T *) realloc (result, memory_size); \ ++ if (memory == NULL) \ ++ goto out_of_memory; \ ++ if (result == resultbuf && length > 0) \ ++ DCHAR_CPY (memory, result, length); \ ++ result = memory; \ ++ } ++ ++ for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++) ++ { ++ if (cp != dp->dir_start) ++ { ++ size_t n = dp->dir_start - cp; ++ size_t augmented_length = xsum (length, n); ++ ++ ENSURE_ALLOCATION (augmented_length); ++ /* This copies a piece of FCHAR_T[] into a DCHAR_T[]. Here we ++ need that the format string contains only ASCII characters ++ if FCHAR_T and DCHAR_T are not the same type. */ ++ if (sizeof (FCHAR_T) == sizeof (DCHAR_T)) ++ { ++ DCHAR_CPY (result + length, (const DCHAR_T *) cp, n); ++ length = augmented_length; ++ } ++ else ++ { ++ do ++ result[length++] = (unsigned char) *cp++; ++ while (--n > 0); ++ } ++ } ++ if (i == d.count) ++ break; ++ ++ /* Execute a single directive. */ ++ if (dp->conversion == '%') ++ { ++ size_t augmented_length; ++ ++ if (!(dp->arg_index == ARG_NONE)) ++ abort (); ++ augmented_length = xsum (length, 1); ++ ENSURE_ALLOCATION (augmented_length); ++ result[length] = '%'; ++ length = augmented_length; ++ } ++ else ++ { ++ if (!(dp->arg_index != ARG_NONE)) ++ abort (); ++ ++ if (dp->conversion == 'n') ++ { ++ switch (a.arg[dp->arg_index].type) ++ { ++ case TYPE_COUNT_SCHAR_POINTER: ++ *a.arg[dp->arg_index].a.a_count_schar_pointer = length; ++ break; ++ case TYPE_COUNT_SHORT_POINTER: ++ *a.arg[dp->arg_index].a.a_count_short_pointer = length; ++ break; ++ case TYPE_COUNT_INT_POINTER: ++ *a.arg[dp->arg_index].a.a_count_int_pointer = length; ++ break; ++ case TYPE_COUNT_LONGINT_POINTER: ++ *a.arg[dp->arg_index].a.a_count_longint_pointer = length; ++ break; ++#if HAVE_LONG_LONG_INT ++ case TYPE_COUNT_LONGLONGINT_POINTER: ++ *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length; ++ break; ++#endif ++ default: ++ abort (); ++ } ++ } ++#if ENABLE_UNISTDIO ++ /* The unistdio extensions. */ ++ else if (dp->conversion == 'U') ++ { ++ arg_type type = a.arg[dp->arg_index].type; ++ int flags = dp->flags; ++ int has_width; ++ size_t width; ++ int has_precision; ++ size_t precision; ++ ++ has_width = 0; ++ width = 0; ++ if (dp->width_start != dp->width_end) ++ { ++ if (dp->width_arg_index != ARG_NONE) ++ { ++ int arg; ++ ++ if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) ++ abort (); ++ arg = a.arg[dp->width_arg_index].a.a_int; ++ if (arg < 0) ++ { ++ /* "A negative field width is taken as a '-' flag ++ followed by a positive field width." */ ++ flags |= FLAG_LEFT; ++ width = (unsigned int) (-arg); ++ } ++ else ++ width = arg; ++ } ++ else ++ { ++ const FCHAR_T *digitp = dp->width_start; ++ ++ do ++ width = xsum (xtimes (width, 10), *digitp++ - '0'); ++ while (digitp != dp->width_end); ++ } ++ has_width = 1; ++ } ++ ++ has_precision = 0; ++ precision = 0; ++ if (dp->precision_start != dp->precision_end) ++ { ++ if (dp->precision_arg_index != ARG_NONE) ++ { ++ int arg; ++ ++ if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) ++ abort (); ++ arg = a.arg[dp->precision_arg_index].a.a_int; ++ /* "A negative precision is taken as if the precision ++ were omitted." */ ++ if (arg >= 0) ++ { ++ precision = arg; ++ has_precision = 1; ++ } ++ } ++ else ++ { ++ const FCHAR_T *digitp = dp->precision_start + 1; ++ ++ precision = 0; ++ while (digitp != dp->precision_end) ++ precision = xsum (xtimes (precision, 10), *digitp++ - '0'); ++ has_precision = 1; ++ } ++ } ++ ++ switch (type) ++ { ++ case TYPE_U8_STRING: ++ { ++ const uint8_t *arg = a.arg[dp->arg_index].a.a_u8_string; ++ const uint8_t *arg_end; ++ size_t characters; ++ ++ if (has_precision) ++ { ++ /* Use only PRECISION characters, from the left. */ ++ arg_end = arg; ++ characters = 0; ++ for (; precision > 0; precision--) ++ { ++ int count = u8_strmblen (arg_end); ++ if (count == 0) ++ break; ++ if (count < 0) ++ { ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EILSEQ; ++ return NULL; ++ } ++ arg_end += count; ++ characters++; ++ } ++ } ++ else if (has_width) ++ { ++ /* Use the entire string, and count the number of ++ characters. */ ++ arg_end = arg; ++ characters = 0; ++ for (;;) ++ { ++ int count = u8_strmblen (arg_end); ++ if (count == 0) ++ break; ++ if (count < 0) ++ { ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EILSEQ; ++ return NULL; ++ } ++ arg_end += count; ++ characters++; ++ } ++ } ++ else ++ { ++ /* Use the entire string. */ ++ arg_end = arg + u8_strlen (arg); ++ /* The number of characters doesn't matter. */ ++ characters = 0; ++ } ++ ++ if (has_width && width > characters ++ && !(dp->flags & FLAG_LEFT)) ++ { ++ size_t n = width - characters; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_SET (result + length, ' ', n); ++ length += n; ++ } ++ ++# if DCHAR_IS_UINT8_T ++ { ++ size_t n = arg_end - arg; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_CPY (result + length, arg, n); ++ length += n; ++ } ++# else ++ { /* Convert. */ ++ DCHAR_T *converted = result + length; ++ size_t converted_len = allocated - length; ++# if DCHAR_IS_TCHAR ++ /* Convert from UTF-8 to locale encoding. */ ++ if (u8_conv_to_encoding (locale_charset (), ++ iconveh_question_mark, ++ arg, arg_end - arg, NULL, ++ &converted, &converted_len) ++ < 0) ++# else ++ /* Convert from UTF-8 to UTF-16/UTF-32. */ ++ converted = ++ U8_TO_DCHAR (arg, arg_end - arg, ++ converted, &converted_len); ++ if (converted == NULL) ++# endif ++ { ++ int saved_errno = errno; ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = saved_errno; ++ return NULL; ++ } ++ if (converted != result + length) ++ { ++ ENSURE_ALLOCATION (xsum (length, converted_len)); ++ DCHAR_CPY (result + length, converted, converted_len); ++ free (converted); ++ } ++ length += converted_len; ++ } ++# endif ++ ++ if (has_width && width > characters ++ && (dp->flags & FLAG_LEFT)) ++ { ++ size_t n = width - characters; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_SET (result + length, ' ', n); ++ length += n; ++ } ++ } ++ break; ++ ++ case TYPE_U16_STRING: ++ { ++ const uint16_t *arg = a.arg[dp->arg_index].a.a_u16_string; ++ const uint16_t *arg_end; ++ size_t characters; ++ ++ if (has_precision) ++ { ++ /* Use only PRECISION characters, from the left. */ ++ arg_end = arg; ++ characters = 0; ++ for (; precision > 0; precision--) ++ { ++ int count = u16_strmblen (arg_end); ++ if (count == 0) ++ break; ++ if (count < 0) ++ { ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EILSEQ; ++ return NULL; ++ } ++ arg_end += count; ++ characters++; ++ } ++ } ++ else if (has_width) ++ { ++ /* Use the entire string, and count the number of ++ characters. */ ++ arg_end = arg; ++ characters = 0; ++ for (;;) ++ { ++ int count = u16_strmblen (arg_end); ++ if (count == 0) ++ break; ++ if (count < 0) ++ { ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EILSEQ; ++ return NULL; ++ } ++ arg_end += count; ++ characters++; ++ } ++ } ++ else ++ { ++ /* Use the entire string. */ ++ arg_end = arg + u16_strlen (arg); ++ /* The number of characters doesn't matter. */ ++ characters = 0; ++ } ++ ++ if (has_width && width > characters ++ && !(dp->flags & FLAG_LEFT)) ++ { ++ size_t n = width - characters; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_SET (result + length, ' ', n); ++ length += n; ++ } ++ ++# if DCHAR_IS_UINT16_T ++ { ++ size_t n = arg_end - arg; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_CPY (result + length, arg, n); ++ length += n; ++ } ++# else ++ { /* Convert. */ ++ DCHAR_T *converted = result + length; ++ size_t converted_len = allocated - length; ++# if DCHAR_IS_TCHAR ++ /* Convert from UTF-16 to locale encoding. */ ++ if (u16_conv_to_encoding (locale_charset (), ++ iconveh_question_mark, ++ arg, arg_end - arg, NULL, ++ &converted, &converted_len) ++ < 0) ++# else ++ /* Convert from UTF-16 to UTF-8/UTF-32. */ ++ converted = ++ U16_TO_DCHAR (arg, arg_end - arg, ++ converted, &converted_len); ++ if (converted == NULL) ++# endif ++ { ++ int saved_errno = errno; ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = saved_errno; ++ return NULL; ++ } ++ if (converted != result + length) ++ { ++ ENSURE_ALLOCATION (xsum (length, converted_len)); ++ DCHAR_CPY (result + length, converted, converted_len); ++ free (converted); ++ } ++ length += converted_len; ++ } ++# endif ++ ++ if (has_width && width > characters ++ && (dp->flags & FLAG_LEFT)) ++ { ++ size_t n = width - characters; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_SET (result + length, ' ', n); ++ length += n; ++ } ++ } ++ break; ++ ++ case TYPE_U32_STRING: ++ { ++ const uint32_t *arg = a.arg[dp->arg_index].a.a_u32_string; ++ const uint32_t *arg_end; ++ size_t characters; ++ ++ if (has_precision) ++ { ++ /* Use only PRECISION characters, from the left. */ ++ arg_end = arg; ++ characters = 0; ++ for (; precision > 0; precision--) ++ { ++ int count = u32_strmblen (arg_end); ++ if (count == 0) ++ break; ++ if (count < 0) ++ { ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EILSEQ; ++ return NULL; ++ } ++ arg_end += count; ++ characters++; ++ } ++ } ++ else if (has_width) ++ { ++ /* Use the entire string, and count the number of ++ characters. */ ++ arg_end = arg; ++ characters = 0; ++ for (;;) ++ { ++ int count = u32_strmblen (arg_end); ++ if (count == 0) ++ break; ++ if (count < 0) ++ { ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EILSEQ; ++ return NULL; ++ } ++ arg_end += count; ++ characters++; ++ } ++ } ++ else ++ { ++ /* Use the entire string. */ ++ arg_end = arg + u32_strlen (arg); ++ /* The number of characters doesn't matter. */ ++ characters = 0; ++ } ++ ++ if (has_width && width > characters ++ && !(dp->flags & FLAG_LEFT)) ++ { ++ size_t n = width - characters; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_SET (result + length, ' ', n); ++ length += n; ++ } ++ ++# if DCHAR_IS_UINT32_T ++ { ++ size_t n = arg_end - arg; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_CPY (result + length, arg, n); ++ length += n; ++ } ++# else ++ { /* Convert. */ ++ DCHAR_T *converted = result + length; ++ size_t converted_len = allocated - length; ++# if DCHAR_IS_TCHAR ++ /* Convert from UTF-32 to locale encoding. */ ++ if (u32_conv_to_encoding (locale_charset (), ++ iconveh_question_mark, ++ arg, arg_end - arg, NULL, ++ &converted, &converted_len) ++ < 0) ++# else ++ /* Convert from UTF-32 to UTF-8/UTF-16. */ ++ converted = ++ U32_TO_DCHAR (arg, arg_end - arg, ++ converted, &converted_len); ++ if (converted == NULL) ++# endif ++ { ++ int saved_errno = errno; ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = saved_errno; ++ return NULL; ++ } ++ if (converted != result + length) ++ { ++ ENSURE_ALLOCATION (xsum (length, converted_len)); ++ DCHAR_CPY (result + length, converted, converted_len); ++ free (converted); ++ } ++ length += converted_len; ++ } ++# endif ++ ++ if (has_width && width > characters ++ && (dp->flags & FLAG_LEFT)) ++ { ++ size_t n = width - characters; ++ ENSURE_ALLOCATION (xsum (length, n)); ++ DCHAR_SET (result + length, ' ', n); ++ length += n; ++ } ++ } ++ break; ++ ++ default: ++ abort (); ++ } ++ } ++#endif ++#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL ++ else if ((dp->conversion == 'a' || dp->conversion == 'A') ++# if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && NEED_PRINTF_DOUBLE)) ++ && (0 ++# if NEED_PRINTF_DOUBLE ++ || a.arg[dp->arg_index].type == TYPE_DOUBLE ++# endif ++# if NEED_PRINTF_LONG_DOUBLE ++ || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE ++# endif ++ ) ++# endif ++ ) ++ { ++ arg_type type = a.arg[dp->arg_index].type; ++ int flags = dp->flags; ++ int has_width; ++ size_t width; ++ int has_precision; ++ size_t precision; ++ size_t tmp_length; ++ DCHAR_T tmpbuf[700]; ++ DCHAR_T *tmp; ++ DCHAR_T *pad_ptr; ++ DCHAR_T *p; ++ ++ has_width = 0; ++ width = 0; ++ if (dp->width_start != dp->width_end) ++ { ++ if (dp->width_arg_index != ARG_NONE) ++ { ++ int arg; ++ ++ if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) ++ abort (); ++ arg = a.arg[dp->width_arg_index].a.a_int; ++ if (arg < 0) ++ { ++ /* "A negative field width is taken as a '-' flag ++ followed by a positive field width." */ ++ flags |= FLAG_LEFT; ++ width = (unsigned int) (-arg); ++ } ++ else ++ width = arg; ++ } ++ else ++ { ++ const FCHAR_T *digitp = dp->width_start; ++ ++ do ++ width = xsum (xtimes (width, 10), *digitp++ - '0'); ++ while (digitp != dp->width_end); ++ } ++ has_width = 1; ++ } ++ ++ has_precision = 0; ++ precision = 0; ++ if (dp->precision_start != dp->precision_end) ++ { ++ if (dp->precision_arg_index != ARG_NONE) ++ { ++ int arg; ++ ++ if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) ++ abort (); ++ arg = a.arg[dp->precision_arg_index].a.a_int; ++ /* "A negative precision is taken as if the precision ++ were omitted." */ ++ if (arg >= 0) ++ { ++ precision = arg; ++ has_precision = 1; ++ } ++ } ++ else ++ { ++ const FCHAR_T *digitp = dp->precision_start + 1; ++ ++ precision = 0; ++ while (digitp != dp->precision_end) ++ precision = xsum (xtimes (precision, 10), *digitp++ - '0'); ++ has_precision = 1; ++ } ++ } ++ ++ /* Allocate a temporary buffer of sufficient size. */ ++ if (type == TYPE_LONGDOUBLE) ++ tmp_length = ++ (unsigned int) ((LDBL_DIG + 1) ++ * 0.831 /* decimal -> hexadecimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ else ++ tmp_length = ++ (unsigned int) ((DBL_DIG + 1) ++ * 0.831 /* decimal -> hexadecimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ if (tmp_length < precision) ++ tmp_length = precision; ++ /* Account for sign, decimal point etc. */ ++ tmp_length = xsum (tmp_length, 12); ++ ++ if (tmp_length < width) ++ tmp_length = width; ++ ++ tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ ++ ++ if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) ++ tmp = tmpbuf; ++ else ++ { ++ size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T)); ++ ++ if (size_overflow_p (tmp_memsize)) ++ /* Overflow, would lead to out of memory. */ ++ goto out_of_memory; ++ tmp = (DCHAR_T *) malloc (tmp_memsize); ++ if (tmp == NULL) ++ /* Out of memory. */ ++ goto out_of_memory; ++ } ++ ++ pad_ptr = NULL; ++ p = tmp; ++ if (type == TYPE_LONGDOUBLE) ++ { ++# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE ++ long double arg = a.arg[dp->arg_index].a.a_longdouble; ++ ++ if (isnanl (arg)) ++ { ++ if (dp->conversion == 'A') ++ { ++ *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; ++ } ++ else ++ { ++ *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; ++ } ++ } ++ else ++ { ++ int sign = 0; ++ DECL_LONG_DOUBLE_ROUNDING ++ ++ BEGIN_LONG_DOUBLE_ROUNDING (); ++ ++ if (signbit (arg)) /* arg < 0.0L or negative zero */ ++ { ++ sign = -1; ++ arg = -arg; ++ } ++ ++ if (sign < 0) ++ *p++ = '-'; ++ else if (flags & FLAG_SHOWSIGN) ++ *p++ = '+'; ++ else if (flags & FLAG_SPACE) ++ *p++ = ' '; ++ ++ if (arg > 0.0L && arg + arg == arg) ++ { ++ if (dp->conversion == 'A') ++ { ++ *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; ++ } ++ else ++ { ++ *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; ++ } ++ } ++ else ++ { ++ int exponent; ++ long double mantissa; ++ ++ if (arg > 0.0L) ++ mantissa = printf_frexpl (arg, &exponent); ++ else ++ { ++ exponent = 0; ++ mantissa = 0.0L; ++ } ++ ++ if (has_precision ++ && precision < (unsigned int) ((LDBL_DIG + 1) * 0.831) + 1) ++ { ++ /* Round the mantissa. */ ++ long double tail = mantissa; ++ size_t q; ++ ++ for (q = precision; ; q--) ++ { ++ int digit = (int) tail; ++ tail -= digit; ++ if (q == 0) ++ { ++ if (digit & 1 ? tail >= 0.5L : tail > 0.5L) ++ tail = 1 - tail; ++ else ++ tail = - tail; ++ break; ++ } ++ tail *= 16.0L; ++ } ++ if (tail != 0.0L) ++ for (q = precision; q > 0; q--) ++ tail *= 0.0625L; ++ mantissa += tail; ++ } ++ ++ *p++ = '0'; ++ *p++ = dp->conversion - 'A' + 'X'; ++ pad_ptr = p; ++ { ++ int digit; ++ ++ digit = (int) mantissa; ++ mantissa -= digit; ++ *p++ = '0' + digit; ++ if ((flags & FLAG_ALT) ++ || mantissa > 0.0L || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ /* This loop terminates because we assume ++ that FLT_RADIX is a power of 2. */ ++ while (mantissa > 0.0L) ++ { ++ mantissa *= 16.0L; ++ digit = (int) mantissa; ++ mantissa -= digit; ++ *p++ = digit ++ + (digit < 10 ++ ? '0' ++ : dp->conversion - 10); ++ if (precision > 0) ++ precision--; ++ } ++ while (precision > 0) ++ { ++ *p++ = '0'; ++ precision--; ++ } ++ } ++ } ++ *p++ = dp->conversion - 'A' + 'P'; ++# if WIDE_CHAR_VERSION ++ { ++ static const wchar_t decimal_format[] = ++ { '%', '+', 'd', '\0' }; ++ SNPRINTF (p, 6 + 1, decimal_format, exponent); ++ } ++ while (*p != '\0') ++ p++; ++# else ++ if (sizeof (DCHAR_T) == 1) ++ { ++ sprintf ((char *) p, "%+d", exponent); ++ while (*p != '\0') ++ p++; ++ } ++ else ++ { ++ char expbuf[6 + 1]; ++ const char *ep; ++ sprintf (expbuf, "%+d", exponent); ++ for (ep = expbuf; (*p = *ep) != '\0'; ep++) ++ p++; ++ } ++# endif ++ } ++ ++ END_LONG_DOUBLE_ROUNDING (); ++ } ++# else ++ abort (); ++# endif ++ } ++ else ++ { ++# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE ++ double arg = a.arg[dp->arg_index].a.a_double; ++ ++ if (isnand (arg)) ++ { ++ if (dp->conversion == 'A') ++ { ++ *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; ++ } ++ else ++ { ++ *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; ++ } ++ } ++ else ++ { ++ int sign = 0; ++ ++ if (signbit (arg)) /* arg < 0.0 or negative zero */ ++ { ++ sign = -1; ++ arg = -arg; ++ } ++ ++ if (sign < 0) ++ *p++ = '-'; ++ else if (flags & FLAG_SHOWSIGN) ++ *p++ = '+'; ++ else if (flags & FLAG_SPACE) ++ *p++ = ' '; ++ ++ if (arg > 0.0 && arg + arg == arg) ++ { ++ if (dp->conversion == 'A') ++ { ++ *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; ++ } ++ else ++ { ++ *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; ++ } ++ } ++ else ++ { ++ int exponent; ++ double mantissa; ++ ++ if (arg > 0.0) ++ mantissa = printf_frexp (arg, &exponent); ++ else ++ { ++ exponent = 0; ++ mantissa = 0.0; ++ } ++ ++ if (has_precision ++ && precision < (unsigned int) ((DBL_DIG + 1) * 0.831) + 1) ++ { ++ /* Round the mantissa. */ ++ double tail = mantissa; ++ size_t q; ++ ++ for (q = precision; ; q--) ++ { ++ int digit = (int) tail; ++ tail -= digit; ++ if (q == 0) ++ { ++ if (digit & 1 ? tail >= 0.5 : tail > 0.5) ++ tail = 1 - tail; ++ else ++ tail = - tail; ++ break; ++ } ++ tail *= 16.0; ++ } ++ if (tail != 0.0) ++ for (q = precision; q > 0; q--) ++ tail *= 0.0625; ++ mantissa += tail; ++ } ++ ++ *p++ = '0'; ++ *p++ = dp->conversion - 'A' + 'X'; ++ pad_ptr = p; ++ { ++ int digit; ++ ++ digit = (int) mantissa; ++ mantissa -= digit; ++ *p++ = '0' + digit; ++ if ((flags & FLAG_ALT) ++ || mantissa > 0.0 || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ /* This loop terminates because we assume ++ that FLT_RADIX is a power of 2. */ ++ while (mantissa > 0.0) ++ { ++ mantissa *= 16.0; ++ digit = (int) mantissa; ++ mantissa -= digit; ++ *p++ = digit ++ + (digit < 10 ++ ? '0' ++ : dp->conversion - 10); ++ if (precision > 0) ++ precision--; ++ } ++ while (precision > 0) ++ { ++ *p++ = '0'; ++ precision--; ++ } ++ } ++ } ++ *p++ = dp->conversion - 'A' + 'P'; ++# if WIDE_CHAR_VERSION ++ { ++ static const wchar_t decimal_format[] = ++ { '%', '+', 'd', '\0' }; ++ SNPRINTF (p, 6 + 1, decimal_format, exponent); ++ } ++ while (*p != '\0') ++ p++; ++# else ++ if (sizeof (DCHAR_T) == 1) ++ { ++ sprintf ((char *) p, "%+d", exponent); ++ while (*p != '\0') ++ p++; ++ } ++ else ++ { ++ char expbuf[6 + 1]; ++ const char *ep; ++ sprintf (expbuf, "%+d", exponent); ++ for (ep = expbuf; (*p = *ep) != '\0'; ep++) ++ p++; ++ } ++# endif ++ } ++ } ++# else ++ abort (); ++# endif ++ } ++ /* The generated string now extends from tmp to p, with the ++ zero padding insertion point being at pad_ptr. */ ++ if (has_width && p - tmp < width) ++ { ++ size_t pad = width - (p - tmp); ++ DCHAR_T *end = p + pad; ++ ++ if (flags & FLAG_LEFT) ++ { ++ /* Pad with spaces on the right. */ ++ for (; pad > 0; pad--) ++ *p++ = ' '; ++ } ++ else if ((flags & FLAG_ZERO) && pad_ptr != NULL) ++ { ++ /* Pad with zeroes. */ ++ DCHAR_T *q = end; ++ ++ while (p > pad_ptr) ++ *--q = *--p; ++ for (; pad > 0; pad--) ++ *p++ = '0'; ++ } ++ else ++ { ++ /* Pad with spaces on the left. */ ++ DCHAR_T *q = end; ++ ++ while (p > tmp) ++ *--q = *--p; ++ for (; pad > 0; pad--) ++ *p++ = ' '; ++ } ++ ++ p = end; ++ } ++ ++ { ++ size_t count = p - tmp; ++ ++ if (count >= tmp_length) ++ /* tmp_length was incorrectly calculated - fix the ++ code above! */ ++ abort (); ++ ++ /* Make room for the result. */ ++ if (count >= allocated - length) ++ { ++ size_t n = xsum (length, count); ++ ++ ENSURE_ALLOCATION (n); ++ } ++ ++ /* Append the result. */ ++ memcpy (result + length, tmp, count * sizeof (DCHAR_T)); ++ if (tmp != tmpbuf) ++ free (tmp); ++ length += count; ++ } ++ } ++#endif ++#if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL ++ else if ((dp->conversion == 'f' || dp->conversion == 'F' ++ || dp->conversion == 'e' || dp->conversion == 'E' ++ || dp->conversion == 'g' || dp->conversion == 'G' ++ || dp->conversion == 'a' || dp->conversion == 'A') ++ && (0 ++# if NEED_PRINTF_DOUBLE ++ || a.arg[dp->arg_index].type == TYPE_DOUBLE ++# elif NEED_PRINTF_INFINITE_DOUBLE ++ || (a.arg[dp->arg_index].type == TYPE_DOUBLE ++ /* The systems (mingw) which produce wrong output ++ for Inf, -Inf, and NaN also do so for -0.0. ++ Therefore we treat this case here as well. */ ++ && is_infinite_or_zero (a.arg[dp->arg_index].a.a_double)) ++# endif ++# if NEED_PRINTF_LONG_DOUBLE ++ || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE ++# elif NEED_PRINTF_INFINITE_LONG_DOUBLE ++ || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE ++ /* Some systems produce wrong output for Inf, ++ -Inf, and NaN. Some systems in this category ++ (IRIX 5.3) also do so for -0.0. Therefore we ++ treat this case here as well. */ ++ && is_infinite_or_zerol (a.arg[dp->arg_index].a.a_longdouble)) ++# endif ++ )) ++ { ++# if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) ++ arg_type type = a.arg[dp->arg_index].type; ++# endif ++ int flags = dp->flags; ++ int has_width; ++ size_t width; ++ int has_precision; ++ size_t precision; ++ size_t tmp_length; ++ DCHAR_T tmpbuf[700]; ++ DCHAR_T *tmp; ++ DCHAR_T *pad_ptr; ++ DCHAR_T *p; ++ ++ has_width = 0; ++ width = 0; ++ if (dp->width_start != dp->width_end) ++ { ++ if (dp->width_arg_index != ARG_NONE) ++ { ++ int arg; ++ ++ if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) ++ abort (); ++ arg = a.arg[dp->width_arg_index].a.a_int; ++ if (arg < 0) ++ { ++ /* "A negative field width is taken as a '-' flag ++ followed by a positive field width." */ ++ flags |= FLAG_LEFT; ++ width = (unsigned int) (-arg); ++ } ++ else ++ width = arg; ++ } ++ else ++ { ++ const FCHAR_T *digitp = dp->width_start; ++ ++ do ++ width = xsum (xtimes (width, 10), *digitp++ - '0'); ++ while (digitp != dp->width_end); ++ } ++ has_width = 1; ++ } ++ ++ has_precision = 0; ++ precision = 0; ++ if (dp->precision_start != dp->precision_end) ++ { ++ if (dp->precision_arg_index != ARG_NONE) ++ { ++ int arg; ++ ++ if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) ++ abort (); ++ arg = a.arg[dp->precision_arg_index].a.a_int; ++ /* "A negative precision is taken as if the precision ++ were omitted." */ ++ if (arg >= 0) ++ { ++ precision = arg; ++ has_precision = 1; ++ } ++ } ++ else ++ { ++ const FCHAR_T *digitp = dp->precision_start + 1; ++ ++ precision = 0; ++ while (digitp != dp->precision_end) ++ precision = xsum (xtimes (precision, 10), *digitp++ - '0'); ++ has_precision = 1; ++ } ++ } ++ ++ /* POSIX specifies the default precision to be 6 for %f, %F, ++ %e, %E, but not for %g, %G. Implementations appear to use ++ the same default precision also for %g, %G. But for %a, %A, ++ the default precision is 0. */ ++ if (!has_precision) ++ if (!(dp->conversion == 'a' || dp->conversion == 'A')) ++ precision = 6; ++ ++ /* Allocate a temporary buffer of sufficient size. */ ++# if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE ++ tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG + 1); ++# elif NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE ++ tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0); ++# elif NEED_PRINTF_LONG_DOUBLE ++ tmp_length = LDBL_DIG + 1; ++# elif NEED_PRINTF_DOUBLE ++ tmp_length = DBL_DIG + 1; ++# else ++ tmp_length = 0; ++# endif ++ if (tmp_length < precision) ++ tmp_length = precision; ++# if NEED_PRINTF_LONG_DOUBLE ++# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE ++ if (type == TYPE_LONGDOUBLE) ++# endif ++ if (dp->conversion == 'f' || dp->conversion == 'F') ++ { ++ long double arg = a.arg[dp->arg_index].a.a_longdouble; ++ if (!(isnanl (arg) || arg + arg == arg)) ++ { ++ /* arg is finite and nonzero. */ ++ int exponent = floorlog10l (arg < 0 ? -arg : arg); ++ if (exponent >= 0 && tmp_length < exponent + precision) ++ tmp_length = exponent + precision; ++ } ++ } ++# endif ++# if NEED_PRINTF_DOUBLE ++# if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE ++ if (type == TYPE_DOUBLE) ++# endif ++ if (dp->conversion == 'f' || dp->conversion == 'F') ++ { ++ double arg = a.arg[dp->arg_index].a.a_double; ++ if (!(isnand (arg) || arg + arg == arg)) ++ { ++ /* arg is finite and nonzero. */ ++ int exponent = floorlog10 (arg < 0 ? -arg : arg); ++ if (exponent >= 0 && tmp_length < exponent + precision) ++ tmp_length = exponent + precision; ++ } ++ } ++# endif ++ /* Account for sign, decimal point etc. */ ++ tmp_length = xsum (tmp_length, 12); ++ ++ if (tmp_length < width) ++ tmp_length = width; ++ ++ tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ ++ ++ if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) ++ tmp = tmpbuf; ++ else ++ { ++ size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T)); ++ ++ if (size_overflow_p (tmp_memsize)) ++ /* Overflow, would lead to out of memory. */ ++ goto out_of_memory; ++ tmp = (DCHAR_T *) malloc (tmp_memsize); ++ if (tmp == NULL) ++ /* Out of memory. */ ++ goto out_of_memory; ++ } ++ ++ pad_ptr = NULL; ++ p = tmp; ++ ++# if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE ++# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE ++ if (type == TYPE_LONGDOUBLE) ++# endif ++ { ++ long double arg = a.arg[dp->arg_index].a.a_longdouble; ++ ++ if (isnanl (arg)) ++ { ++ if (dp->conversion >= 'A' && dp->conversion <= 'Z') ++ { ++ *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; ++ } ++ else ++ { ++ *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; ++ } ++ } ++ else ++ { ++ int sign = 0; ++ DECL_LONG_DOUBLE_ROUNDING ++ ++ BEGIN_LONG_DOUBLE_ROUNDING (); ++ ++ if (signbit (arg)) /* arg < 0.0L or negative zero */ ++ { ++ sign = -1; ++ arg = -arg; ++ } ++ ++ if (sign < 0) ++ *p++ = '-'; ++ else if (flags & FLAG_SHOWSIGN) ++ *p++ = '+'; ++ else if (flags & FLAG_SPACE) ++ *p++ = ' '; ++ ++ if (arg > 0.0L && arg + arg == arg) ++ { ++ if (dp->conversion >= 'A' && dp->conversion <= 'Z') ++ { ++ *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; ++ } ++ else ++ { ++ *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; ++ } ++ } ++ else ++ { ++# if NEED_PRINTF_LONG_DOUBLE ++ pad_ptr = p; ++ ++ if (dp->conversion == 'f' || dp->conversion == 'F') ++ { ++ char *digits; ++ size_t ndigits; ++ ++ digits = ++ scale10_round_decimal_long_double (arg, precision); ++ if (digits == NULL) ++ { ++ END_LONG_DOUBLE_ROUNDING (); ++ goto out_of_memory; ++ } ++ ndigits = strlen (digits); ++ ++ if (ndigits > precision) ++ do ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ while (ndigits > precision); ++ else ++ *p++ = '0'; ++ /* Here ndigits <= precision. */ ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ for (; precision > ndigits; precision--) ++ *p++ = '0'; ++ while (ndigits > 0) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ ++ free (digits); ++ } ++ else if (dp->conversion == 'e' || dp->conversion == 'E') ++ { ++ int exponent; ++ ++ if (arg == 0.0L) ++ { ++ exponent = 0; ++ *p++ = '0'; ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ for (; precision > 0; precision--) ++ *p++ = '0'; ++ } ++ } ++ else ++ { ++ /* arg > 0.0L. */ ++ int adjusted; ++ char *digits; ++ size_t ndigits; ++ ++ exponent = floorlog10l (arg); ++ adjusted = 0; ++ for (;;) ++ { ++ digits = ++ scale10_round_decimal_long_double (arg, ++ (int)precision - exponent); ++ if (digits == NULL) ++ { ++ END_LONG_DOUBLE_ROUNDING (); ++ goto out_of_memory; ++ } ++ ndigits = strlen (digits); ++ ++ if (ndigits == precision + 1) ++ break; ++ if (ndigits < precision ++ || ndigits > precision + 2) ++ /* The exponent was not guessed ++ precisely enough. */ ++ abort (); ++ if (adjusted) ++ /* None of two values of exponent is ++ the right one. Prevent an endless ++ loop. */ ++ abort (); ++ free (digits); ++ if (ndigits == precision) ++ exponent -= 1; ++ else ++ exponent += 1; ++ adjusted = 1; ++ } ++ /* Here ndigits = precision+1. */ ++ if (is_borderline (digits, precision)) ++ { ++ /* Maybe the exponent guess was too high ++ and a smaller exponent can be reached ++ by turning a 10...0 into 9...9x. */ ++ char *digits2 = ++ scale10_round_decimal_long_double (arg, ++ (int)precision - exponent + 1); ++ if (digits2 == NULL) ++ { ++ free (digits); ++ END_LONG_DOUBLE_ROUNDING (); ++ goto out_of_memory; ++ } ++ if (strlen (digits2) == precision + 1) ++ { ++ free (digits); ++ digits = digits2; ++ exponent -= 1; ++ } ++ else ++ free (digits2); ++ } ++ /* Here ndigits = precision+1. */ ++ ++ *p++ = digits[--ndigits]; ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ while (ndigits > 0) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ ++ free (digits); ++ } ++ ++ *p++ = dp->conversion; /* 'e' or 'E' */ ++# if WIDE_CHAR_VERSION ++ { ++ static const wchar_t decimal_format[] = ++ { '%', '+', '.', '2', 'd', '\0' }; ++ SNPRINTF (p, 6 + 1, decimal_format, exponent); ++ } ++ while (*p != '\0') ++ p++; ++# else ++ if (sizeof (DCHAR_T) == 1) ++ { ++ sprintf ((char *) p, "%+.2d", exponent); ++ while (*p != '\0') ++ p++; ++ } ++ else ++ { ++ char expbuf[6 + 1]; ++ const char *ep; ++ sprintf (expbuf, "%+.2d", exponent); ++ for (ep = expbuf; (*p = *ep) != '\0'; ep++) ++ p++; ++ } ++# endif ++ } ++ else if (dp->conversion == 'g' || dp->conversion == 'G') ++ { ++ if (precision == 0) ++ precision = 1; ++ /* precision >= 1. */ ++ ++ if (arg == 0.0L) ++ /* The exponent is 0, >= -4, < precision. ++ Use fixed-point notation. */ ++ { ++ size_t ndigits = precision; ++ /* Number of trailing zeroes that have to be ++ dropped. */ ++ size_t nzeroes = ++ (flags & FLAG_ALT ? 0 : precision - 1); ++ ++ --ndigits; ++ *p++ = '0'; ++ if ((flags & FLAG_ALT) || ndigits > nzeroes) ++ { ++ *p++ = decimal_point_char (); ++ while (ndigits > nzeroes) ++ { ++ --ndigits; ++ *p++ = '0'; ++ } ++ } ++ } ++ else ++ { ++ /* arg > 0.0L. */ ++ int exponent; ++ int adjusted; ++ char *digits; ++ size_t ndigits; ++ size_t nzeroes; ++ ++ exponent = floorlog10l (arg); ++ adjusted = 0; ++ for (;;) ++ { ++ digits = ++ scale10_round_decimal_long_double (arg, ++ (int)(precision - 1) - exponent); ++ if (digits == NULL) ++ { ++ END_LONG_DOUBLE_ROUNDING (); ++ goto out_of_memory; ++ } ++ ndigits = strlen (digits); ++ ++ if (ndigits == precision) ++ break; ++ if (ndigits < precision - 1 ++ || ndigits > precision + 1) ++ /* The exponent was not guessed ++ precisely enough. */ ++ abort (); ++ if (adjusted) ++ /* None of two values of exponent is ++ the right one. Prevent an endless ++ loop. */ ++ abort (); ++ free (digits); ++ if (ndigits < precision) ++ exponent -= 1; ++ else ++ exponent += 1; ++ adjusted = 1; ++ } ++ /* Here ndigits = precision. */ ++ if (is_borderline (digits, precision - 1)) ++ { ++ /* Maybe the exponent guess was too high ++ and a smaller exponent can be reached ++ by turning a 10...0 into 9...9x. */ ++ char *digits2 = ++ scale10_round_decimal_long_double (arg, ++ (int)(precision - 1) - exponent + 1); ++ if (digits2 == NULL) ++ { ++ free (digits); ++ END_LONG_DOUBLE_ROUNDING (); ++ goto out_of_memory; ++ } ++ if (strlen (digits2) == precision) ++ { ++ free (digits); ++ digits = digits2; ++ exponent -= 1; ++ } ++ else ++ free (digits2); ++ } ++ /* Here ndigits = precision. */ ++ ++ /* Determine the number of trailing zeroes ++ that have to be dropped. */ ++ nzeroes = 0; ++ if ((flags & FLAG_ALT) == 0) ++ while (nzeroes < ndigits ++ && digits[nzeroes] == '0') ++ nzeroes++; ++ ++ /* The exponent is now determined. */ ++ if (exponent >= -4 ++ && exponent < (long)precision) ++ { ++ /* Fixed-point notation: ++ max(exponent,0)+1 digits, then the ++ decimal point, then the remaining ++ digits without trailing zeroes. */ ++ if (exponent >= 0) ++ { ++ size_t count = exponent + 1; ++ /* Note: count <= precision = ndigits. */ ++ for (; count > 0; count--) ++ *p++ = digits[--ndigits]; ++ if ((flags & FLAG_ALT) || ndigits > nzeroes) ++ { ++ *p++ = decimal_point_char (); ++ while (ndigits > nzeroes) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ } ++ else ++ { ++ size_t count = -exponent - 1; ++ *p++ = '0'; ++ *p++ = decimal_point_char (); ++ for (; count > 0; count--) ++ *p++ = '0'; ++ while (ndigits > nzeroes) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ } ++ else ++ { ++ /* Exponential notation. */ ++ *p++ = digits[--ndigits]; ++ if ((flags & FLAG_ALT) || ndigits > nzeroes) ++ { ++ *p++ = decimal_point_char (); ++ while (ndigits > nzeroes) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ ++# if WIDE_CHAR_VERSION ++ { ++ static const wchar_t decimal_format[] = ++ { '%', '+', '.', '2', 'd', '\0' }; ++ SNPRINTF (p, 6 + 1, decimal_format, exponent); ++ } ++ while (*p != '\0') ++ p++; ++# else ++ if (sizeof (DCHAR_T) == 1) ++ { ++ sprintf ((char *) p, "%+.2d", exponent); ++ while (*p != '\0') ++ p++; ++ } ++ else ++ { ++ char expbuf[6 + 1]; ++ const char *ep; ++ sprintf (expbuf, "%+.2d", exponent); ++ for (ep = expbuf; (*p = *ep) != '\0'; ep++) ++ p++; ++ } ++# endif ++ } ++ ++ free (digits); ++ } ++ } ++ else ++ abort (); ++# else ++ /* arg is finite. */ ++ if (!(arg == 0.0L)) ++ abort (); ++ ++ pad_ptr = p; ++ ++ if (dp->conversion == 'f' || dp->conversion == 'F') ++ { ++ *p++ = '0'; ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ for (; precision > 0; precision--) ++ *p++ = '0'; ++ } ++ } ++ else if (dp->conversion == 'e' || dp->conversion == 'E') ++ { ++ *p++ = '0'; ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ for (; precision > 0; precision--) ++ *p++ = '0'; ++ } ++ *p++ = dp->conversion; /* 'e' or 'E' */ ++ *p++ = '+'; ++ *p++ = '0'; ++ *p++ = '0'; ++ } ++ else if (dp->conversion == 'g' || dp->conversion == 'G') ++ { ++ *p++ = '0'; ++ if (flags & FLAG_ALT) ++ { ++ size_t ndigits = ++ (precision > 0 ? precision - 1 : 0); ++ *p++ = decimal_point_char (); ++ for (; ndigits > 0; --ndigits) ++ *p++ = '0'; ++ } ++ } ++ else if (dp->conversion == 'a' || dp->conversion == 'A') ++ { ++ *p++ = '0'; ++ *p++ = dp->conversion - 'A' + 'X'; ++ pad_ptr = p; ++ *p++ = '0'; ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ for (; precision > 0; precision--) ++ *p++ = '0'; ++ } ++ *p++ = dp->conversion - 'A' + 'P'; ++ *p++ = '+'; ++ *p++ = '0'; ++ } ++ else ++ abort (); ++# endif ++ } ++ ++ END_LONG_DOUBLE_ROUNDING (); ++ } ++ } ++# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE ++ else ++# endif ++# endif ++# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE ++ { ++ double arg = a.arg[dp->arg_index].a.a_double; ++ ++ if (isnand (arg)) ++ { ++ if (dp->conversion >= 'A' && dp->conversion <= 'Z') ++ { ++ *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; ++ } ++ else ++ { ++ *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; ++ } ++ } ++ else ++ { ++ int sign = 0; ++ ++ if (signbit (arg)) /* arg < 0.0 or negative zero */ ++ { ++ sign = -1; ++ arg = -arg; ++ } ++ ++ if (sign < 0) ++ *p++ = '-'; ++ else if (flags & FLAG_SHOWSIGN) ++ *p++ = '+'; ++ else if (flags & FLAG_SPACE) ++ *p++ = ' '; ++ ++ if (arg > 0.0 && arg + arg == arg) ++ { ++ if (dp->conversion >= 'A' && dp->conversion <= 'Z') ++ { ++ *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; ++ } ++ else ++ { ++ *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; ++ } ++ } ++ else ++ { ++# if NEED_PRINTF_DOUBLE ++ pad_ptr = p; ++ ++ if (dp->conversion == 'f' || dp->conversion == 'F') ++ { ++ char *digits; ++ size_t ndigits; ++ ++ digits = ++ scale10_round_decimal_double (arg, precision); ++ if (digits == NULL) ++ goto out_of_memory; ++ ndigits = strlen (digits); ++ ++ if (ndigits > precision) ++ do ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ while (ndigits > precision); ++ else ++ *p++ = '0'; ++ /* Here ndigits <= precision. */ ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ for (; precision > ndigits; precision--) ++ *p++ = '0'; ++ while (ndigits > 0) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ ++ free (digits); ++ } ++ else if (dp->conversion == 'e' || dp->conversion == 'E') ++ { ++ int exponent; ++ ++ if (arg == 0.0) ++ { ++ exponent = 0; ++ *p++ = '0'; ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ for (; precision > 0; precision--) ++ *p++ = '0'; ++ } ++ } ++ else ++ { ++ /* arg > 0.0. */ ++ int adjusted; ++ char *digits; ++ size_t ndigits; ++ ++ exponent = floorlog10 (arg); ++ adjusted = 0; ++ for (;;) ++ { ++ digits = ++ scale10_round_decimal_double (arg, ++ (int)precision - exponent); ++ if (digits == NULL) ++ goto out_of_memory; ++ ndigits = strlen (digits); ++ ++ if (ndigits == precision + 1) ++ break; ++ if (ndigits < precision ++ || ndigits > precision + 2) ++ /* The exponent was not guessed ++ precisely enough. */ ++ abort (); ++ if (adjusted) ++ /* None of two values of exponent is ++ the right one. Prevent an endless ++ loop. */ ++ abort (); ++ free (digits); ++ if (ndigits == precision) ++ exponent -= 1; ++ else ++ exponent += 1; ++ adjusted = 1; ++ } ++ /* Here ndigits = precision+1. */ ++ if (is_borderline (digits, precision)) ++ { ++ /* Maybe the exponent guess was too high ++ and a smaller exponent can be reached ++ by turning a 10...0 into 9...9x. */ ++ char *digits2 = ++ scale10_round_decimal_double (arg, ++ (int)precision - exponent + 1); ++ if (digits2 == NULL) ++ { ++ free (digits); ++ goto out_of_memory; ++ } ++ if (strlen (digits2) == precision + 1) ++ { ++ free (digits); ++ digits = digits2; ++ exponent -= 1; ++ } ++ else ++ free (digits2); ++ } ++ /* Here ndigits = precision+1. */ ++ ++ *p++ = digits[--ndigits]; ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ while (ndigits > 0) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ ++ free (digits); ++ } ++ ++ *p++ = dp->conversion; /* 'e' or 'E' */ ++# if WIDE_CHAR_VERSION ++ { ++ static const wchar_t decimal_format[] = ++ /* Produce the same number of exponent digits ++ as the native printf implementation. */ ++# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ { '%', '+', '.', '3', 'd', '\0' }; ++# else ++ { '%', '+', '.', '2', 'd', '\0' }; ++# endif ++ SNPRINTF (p, 6 + 1, decimal_format, exponent); ++ } ++ while (*p != '\0') ++ p++; ++# else ++ { ++ static const char decimal_format[] = ++ /* Produce the same number of exponent digits ++ as the native printf implementation. */ ++# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ "%+.3d"; ++# else ++ "%+.2d"; ++# endif ++ if (sizeof (DCHAR_T) == 1) ++ { ++ sprintf ((char *) p, decimal_format, exponent); ++ while (*p != '\0') ++ p++; ++ } ++ else ++ { ++ char expbuf[6 + 1]; ++ const char *ep; ++ sprintf (expbuf, decimal_format, exponent); ++ for (ep = expbuf; (*p = *ep) != '\0'; ep++) ++ p++; ++ } ++ } ++# endif ++ } ++ else if (dp->conversion == 'g' || dp->conversion == 'G') ++ { ++ if (precision == 0) ++ precision = 1; ++ /* precision >= 1. */ ++ ++ if (arg == 0.0) ++ /* The exponent is 0, >= -4, < precision. ++ Use fixed-point notation. */ ++ { ++ size_t ndigits = precision; ++ /* Number of trailing zeroes that have to be ++ dropped. */ ++ size_t nzeroes = ++ (flags & FLAG_ALT ? 0 : precision - 1); ++ ++ --ndigits; ++ *p++ = '0'; ++ if ((flags & FLAG_ALT) || ndigits > nzeroes) ++ { ++ *p++ = decimal_point_char (); ++ while (ndigits > nzeroes) ++ { ++ --ndigits; ++ *p++ = '0'; ++ } ++ } ++ } ++ else ++ { ++ /* arg > 0.0. */ ++ int exponent; ++ int adjusted; ++ char *digits; ++ size_t ndigits; ++ size_t nzeroes; ++ ++ exponent = floorlog10 (arg); ++ adjusted = 0; ++ for (;;) ++ { ++ digits = ++ scale10_round_decimal_double (arg, ++ (int)(precision - 1) - exponent); ++ if (digits == NULL) ++ goto out_of_memory; ++ ndigits = strlen (digits); ++ ++ if (ndigits == precision) ++ break; ++ if (ndigits < precision - 1 ++ || ndigits > precision + 1) ++ /* The exponent was not guessed ++ precisely enough. */ ++ abort (); ++ if (adjusted) ++ /* None of two values of exponent is ++ the right one. Prevent an endless ++ loop. */ ++ abort (); ++ free (digits); ++ if (ndigits < precision) ++ exponent -= 1; ++ else ++ exponent += 1; ++ adjusted = 1; ++ } ++ /* Here ndigits = precision. */ ++ if (is_borderline (digits, precision - 1)) ++ { ++ /* Maybe the exponent guess was too high ++ and a smaller exponent can be reached ++ by turning a 10...0 into 9...9x. */ ++ char *digits2 = ++ scale10_round_decimal_double (arg, ++ (int)(precision - 1) - exponent + 1); ++ if (digits2 == NULL) ++ { ++ free (digits); ++ goto out_of_memory; ++ } ++ if (strlen (digits2) == precision) ++ { ++ free (digits); ++ digits = digits2; ++ exponent -= 1; ++ } ++ else ++ free (digits2); ++ } ++ /* Here ndigits = precision. */ ++ ++ /* Determine the number of trailing zeroes ++ that have to be dropped. */ ++ nzeroes = 0; ++ if ((flags & FLAG_ALT) == 0) ++ while (nzeroes < ndigits ++ && digits[nzeroes] == '0') ++ nzeroes++; ++ ++ /* The exponent is now determined. */ ++ if (exponent >= -4 ++ && exponent < (long)precision) ++ { ++ /* Fixed-point notation: ++ max(exponent,0)+1 digits, then the ++ decimal point, then the remaining ++ digits without trailing zeroes. */ ++ if (exponent >= 0) ++ { ++ size_t count = exponent + 1; ++ /* Note: count <= precision = ndigits. */ ++ for (; count > 0; count--) ++ *p++ = digits[--ndigits]; ++ if ((flags & FLAG_ALT) || ndigits > nzeroes) ++ { ++ *p++ = decimal_point_char (); ++ while (ndigits > nzeroes) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ } ++ else ++ { ++ size_t count = -exponent - 1; ++ *p++ = '0'; ++ *p++ = decimal_point_char (); ++ for (; count > 0; count--) ++ *p++ = '0'; ++ while (ndigits > nzeroes) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ } ++ else ++ { ++ /* Exponential notation. */ ++ *p++ = digits[--ndigits]; ++ if ((flags & FLAG_ALT) || ndigits > nzeroes) ++ { ++ *p++ = decimal_point_char (); ++ while (ndigits > nzeroes) ++ { ++ --ndigits; ++ *p++ = digits[ndigits]; ++ } ++ } ++ *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ ++# if WIDE_CHAR_VERSION ++ { ++ static const wchar_t decimal_format[] = ++ /* Produce the same number of exponent digits ++ as the native printf implementation. */ ++# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ { '%', '+', '.', '3', 'd', '\0' }; ++# else ++ { '%', '+', '.', '2', 'd', '\0' }; ++# endif ++ SNPRINTF (p, 6 + 1, decimal_format, exponent); ++ } ++ while (*p != '\0') ++ p++; ++# else ++ { ++ static const char decimal_format[] = ++ /* Produce the same number of exponent digits ++ as the native printf implementation. */ ++# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ "%+.3d"; ++# else ++ "%+.2d"; ++# endif ++ if (sizeof (DCHAR_T) == 1) ++ { ++ sprintf ((char *) p, decimal_format, exponent); ++ while (*p != '\0') ++ p++; ++ } ++ else ++ { ++ char expbuf[6 + 1]; ++ const char *ep; ++ sprintf (expbuf, decimal_format, exponent); ++ for (ep = expbuf; (*p = *ep) != '\0'; ep++) ++ p++; ++ } ++ } ++# endif ++ } ++ ++ free (digits); ++ } ++ } ++ else ++ abort (); ++# else ++ /* arg is finite. */ ++ if (!(arg == 0.0)) ++ abort (); ++ ++ pad_ptr = p; ++ ++ if (dp->conversion == 'f' || dp->conversion == 'F') ++ { ++ *p++ = '0'; ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ for (; precision > 0; precision--) ++ *p++ = '0'; ++ } ++ } ++ else if (dp->conversion == 'e' || dp->conversion == 'E') ++ { ++ *p++ = '0'; ++ if ((flags & FLAG_ALT) || precision > 0) ++ { ++ *p++ = decimal_point_char (); ++ for (; precision > 0; precision--) ++ *p++ = '0'; ++ } ++ *p++ = dp->conversion; /* 'e' or 'E' */ ++ *p++ = '+'; ++ /* Produce the same number of exponent digits as ++ the native printf implementation. */ ++# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ *p++ = '0'; ++# endif ++ *p++ = '0'; ++ *p++ = '0'; ++ } ++ else if (dp->conversion == 'g' || dp->conversion == 'G') ++ { ++ *p++ = '0'; ++ if (flags & FLAG_ALT) ++ { ++ size_t ndigits = ++ (precision > 0 ? precision - 1 : 0); ++ *p++ = decimal_point_char (); ++ for (; ndigits > 0; --ndigits) ++ *p++ = '0'; ++ } ++ } ++ else ++ abort (); ++# endif ++ } ++ } ++ } ++# endif ++ ++ /* The generated string now extends from tmp to p, with the ++ zero padding insertion point being at pad_ptr. */ ++ if (has_width && p - tmp < width) ++ { ++ size_t pad = width - (p - tmp); ++ DCHAR_T *end = p + pad; ++ ++ if (flags & FLAG_LEFT) ++ { ++ /* Pad with spaces on the right. */ ++ for (; pad > 0; pad--) ++ *p++ = ' '; ++ } ++ else if ((flags & FLAG_ZERO) && pad_ptr != NULL) ++ { ++ /* Pad with zeroes. */ ++ DCHAR_T *q = end; ++ ++ while (p > pad_ptr) ++ *--q = *--p; ++ for (; pad > 0; pad--) ++ *p++ = '0'; ++ } ++ else ++ { ++ /* Pad with spaces on the left. */ ++ DCHAR_T *q = end; ++ ++ while (p > tmp) ++ *--q = *--p; ++ for (; pad > 0; pad--) ++ *p++ = ' '; ++ } ++ ++ p = end; ++ } ++ ++ { ++ size_t count = p - tmp; ++ ++ if (count >= tmp_length) ++ /* tmp_length was incorrectly calculated - fix the ++ code above! */ ++ abort (); ++ ++ /* Make room for the result. */ ++ if (count >= allocated - length) ++ { ++ size_t n = xsum (length, count); ++ ++ ENSURE_ALLOCATION (n); ++ } ++ ++ /* Append the result. */ ++ memcpy (result + length, tmp, count * sizeof (DCHAR_T)); ++ if (tmp != tmpbuf) ++ free (tmp); ++ length += count; ++ } ++ } ++#endif ++ else ++ { ++ arg_type type = a.arg[dp->arg_index].type; ++ int flags = dp->flags; ++#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION ++ int has_width; ++ size_t width; ++#endif ++#if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION ++ int has_precision; ++ size_t precision; ++#endif ++#if NEED_PRINTF_UNBOUNDED_PRECISION ++ int prec_ourselves; ++#else ++# define prec_ourselves 0 ++#endif ++#if NEED_PRINTF_FLAG_LEFTADJUST ++# define pad_ourselves 1 ++#elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION ++ int pad_ourselves; ++#else ++# define pad_ourselves 0 ++#endif ++ TCHAR_T *fbp; ++ unsigned int prefix_count; ++ int prefixes[2] IF_LINT (= { 0 }); ++#if !USE_SNPRINTF ++ size_t tmp_length; ++ TCHAR_T tmpbuf[700]; ++ TCHAR_T *tmp; ++#endif ++ ++#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION ++ has_width = 0; ++ width = 0; ++ if (dp->width_start != dp->width_end) ++ { ++ if (dp->width_arg_index != ARG_NONE) ++ { ++ int arg; ++ ++ if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) ++ abort (); ++ arg = a.arg[dp->width_arg_index].a.a_int; ++ if (arg < 0) ++ { ++ /* "A negative field width is taken as a '-' flag ++ followed by a positive field width." */ ++ flags |= FLAG_LEFT; ++ width = (unsigned int) (-arg); ++ } ++ else ++ width = arg; ++ } ++ else ++ { ++ const FCHAR_T *digitp = dp->width_start; ++ ++ do ++ width = xsum (xtimes (width, 10), *digitp++ - '0'); ++ while (digitp != dp->width_end); ++ } ++ has_width = 1; ++ } ++#endif ++ ++#if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION ++ has_precision = 0; ++ precision = 6; ++ if (dp->precision_start != dp->precision_end) ++ { ++ if (dp->precision_arg_index != ARG_NONE) ++ { ++ int arg; ++ ++ if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) ++ abort (); ++ arg = a.arg[dp->precision_arg_index].a.a_int; ++ /* "A negative precision is taken as if the precision ++ were omitted." */ ++ if (arg >= 0) ++ { ++ precision = arg; ++ has_precision = 1; ++ } ++ } ++ else ++ { ++ const FCHAR_T *digitp = dp->precision_start + 1; ++ ++ precision = 0; ++ while (digitp != dp->precision_end) ++ precision = xsum (xtimes (precision, 10), *digitp++ - '0'); ++ has_precision = 1; ++ } ++ } ++#endif ++ ++ /* Decide whether to handle the precision ourselves. */ ++#if NEED_PRINTF_UNBOUNDED_PRECISION ++ switch (dp->conversion) ++ { ++ case 'd': case 'i': case 'u': ++ case 'o': ++ case 'x': case 'X': case 'p': ++ prec_ourselves = has_precision && (precision > 0); ++ break; ++ default: ++ prec_ourselves = 0; ++ break; ++ } ++#endif ++ ++ /* Decide whether to perform the padding ourselves. */ ++#if !NEED_PRINTF_FLAG_LEFTADJUST && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION) ++ switch (dp->conversion) ++ { ++# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO ++ /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need ++ to perform the padding after this conversion. Functions ++ with unistdio extensions perform the padding based on ++ character count rather than element count. */ ++ case 'c': case 's': ++# endif ++# if NEED_PRINTF_FLAG_ZERO ++ case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': ++ case 'a': case 'A': ++# endif ++ pad_ourselves = 1; ++ break; ++ default: ++ pad_ourselves = prec_ourselves; ++ break; ++ } ++#endif ++ ++#if !USE_SNPRINTF ++ /* Allocate a temporary buffer of sufficient size for calling ++ sprintf. */ ++ { ++ switch (dp->conversion) ++ { ++ ++ case 'd': case 'i': case 'u': ++# if HAVE_LONG_LONG_INT ++ if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) ++ tmp_length = ++ (unsigned int) (sizeof (unsigned long long) * CHAR_BIT ++ * 0.30103 /* binary -> decimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ else ++# endif ++ if (type == TYPE_LONGINT || type == TYPE_ULONGINT) ++ tmp_length = ++ (unsigned int) (sizeof (unsigned long) * CHAR_BIT ++ * 0.30103 /* binary -> decimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ else ++ tmp_length = ++ (unsigned int) (sizeof (unsigned int) * CHAR_BIT ++ * 0.30103 /* binary -> decimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ if (tmp_length < precision) ++ tmp_length = precision; ++ /* Multiply by 2, as an estimate for FLAG_GROUP. */ ++ tmp_length = xsum (tmp_length, tmp_length); ++ /* Add 1, to account for a leading sign. */ ++ tmp_length = xsum (tmp_length, 1); ++ break; ++ ++ case 'o': ++# if HAVE_LONG_LONG_INT ++ if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) ++ tmp_length = ++ (unsigned int) (sizeof (unsigned long long) * CHAR_BIT ++ * 0.333334 /* binary -> octal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ else ++# endif ++ if (type == TYPE_LONGINT || type == TYPE_ULONGINT) ++ tmp_length = ++ (unsigned int) (sizeof (unsigned long) * CHAR_BIT ++ * 0.333334 /* binary -> octal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ else ++ tmp_length = ++ (unsigned int) (sizeof (unsigned int) * CHAR_BIT ++ * 0.333334 /* binary -> octal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ if (tmp_length < precision) ++ tmp_length = precision; ++ /* Add 1, to account for a leading sign. */ ++ tmp_length = xsum (tmp_length, 1); ++ break; ++ ++ case 'x': case 'X': ++# if HAVE_LONG_LONG_INT ++ if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) ++ tmp_length = ++ (unsigned int) (sizeof (unsigned long long) * CHAR_BIT ++ * 0.25 /* binary -> hexadecimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ else ++# endif ++ if (type == TYPE_LONGINT || type == TYPE_ULONGINT) ++ tmp_length = ++ (unsigned int) (sizeof (unsigned long) * CHAR_BIT ++ * 0.25 /* binary -> hexadecimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ else ++ tmp_length = ++ (unsigned int) (sizeof (unsigned int) * CHAR_BIT ++ * 0.25 /* binary -> hexadecimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ if (tmp_length < precision) ++ tmp_length = precision; ++ /* Add 2, to account for a leading sign or alternate form. */ ++ tmp_length = xsum (tmp_length, 2); ++ break; ++ ++ case 'f': case 'F': ++ if (type == TYPE_LONGDOUBLE) ++ tmp_length = ++ (unsigned int) (LDBL_MAX_EXP ++ * 0.30103 /* binary -> decimal */ ++ * 2 /* estimate for FLAG_GROUP */ ++ ) ++ + 1 /* turn floor into ceil */ ++ + 10; /* sign, decimal point etc. */ ++ else ++ tmp_length = ++ (unsigned int) (DBL_MAX_EXP ++ * 0.30103 /* binary -> decimal */ ++ * 2 /* estimate for FLAG_GROUP */ ++ ) ++ + 1 /* turn floor into ceil */ ++ + 10; /* sign, decimal point etc. */ ++ tmp_length = xsum (tmp_length, precision); ++ break; ++ ++ case 'e': case 'E': case 'g': case 'G': ++ tmp_length = ++ 12; /* sign, decimal point, exponent etc. */ ++ tmp_length = xsum (tmp_length, precision); ++ break; ++ ++ case 'a': case 'A': ++ if (type == TYPE_LONGDOUBLE) ++ tmp_length = ++ (unsigned int) (LDBL_DIG ++ * 0.831 /* decimal -> hexadecimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ else ++ tmp_length = ++ (unsigned int) (DBL_DIG ++ * 0.831 /* decimal -> hexadecimal */ ++ ) ++ + 1; /* turn floor into ceil */ ++ if (tmp_length < precision) ++ tmp_length = precision; ++ /* Account for sign, decimal point etc. */ ++ tmp_length = xsum (tmp_length, 12); ++ break; ++ ++ case 'c': ++# if HAVE_WINT_T && !WIDE_CHAR_VERSION ++ if (type == TYPE_WIDE_CHAR) ++ tmp_length = MB_CUR_MAX; ++ else ++# endif ++ tmp_length = 1; ++ break; ++ ++ case 's': ++# if HAVE_WCHAR_T ++ if (type == TYPE_WIDE_STRING) ++ { ++ tmp_length = ++ local_wcslen (a.arg[dp->arg_index].a.a_wide_string); ++ ++# if !WIDE_CHAR_VERSION ++ tmp_length = xtimes (tmp_length, MB_CUR_MAX); ++# endif ++ } ++ else ++# endif ++ tmp_length = strlen (a.arg[dp->arg_index].a.a_string); ++ break; ++ ++ case 'p': ++ tmp_length = ++ (unsigned int) (sizeof (void *) * CHAR_BIT ++ * 0.25 /* binary -> hexadecimal */ ++ ) ++ + 1 /* turn floor into ceil */ ++ + 2; /* account for leading 0x */ ++ break; ++ ++ default: ++ abort (); ++ } ++ ++ if (!pad_ourselves) ++ { ++# if ENABLE_UNISTDIO ++ /* Padding considers the number of characters, therefore ++ the number of elements after padding may be ++ > max (tmp_length, width) ++ but is certainly ++ <= tmp_length + width. */ ++ tmp_length = xsum (tmp_length, width); ++# else ++ /* Padding considers the number of elements, ++ says POSIX. */ ++ if (tmp_length < width) ++ tmp_length = width; ++# endif ++ } ++ ++ tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ ++ } ++ ++ if (tmp_length <= sizeof (tmpbuf) / sizeof (TCHAR_T)) ++ tmp = tmpbuf; ++ else ++ { ++ size_t tmp_memsize = xtimes (tmp_length, sizeof (TCHAR_T)); ++ ++ if (size_overflow_p (tmp_memsize)) ++ /* Overflow, would lead to out of memory. */ ++ goto out_of_memory; ++ tmp = (TCHAR_T *) malloc (tmp_memsize); ++ if (tmp == NULL) ++ /* Out of memory. */ ++ goto out_of_memory; ++ } ++#endif ++ ++ /* Construct the format string for calling snprintf or ++ sprintf. */ ++ fbp = buf; ++ *fbp++ = '%'; ++#if NEED_PRINTF_FLAG_GROUPING ++ /* The underlying implementation doesn't support the ' flag. ++ Produce no grouping characters in this case; this is ++ acceptable because the grouping is locale dependent. */ ++#else ++ if (flags & FLAG_GROUP) ++ *fbp++ = '\''; ++#endif ++ if (flags & FLAG_LEFT) ++ *fbp++ = '-'; ++ if (flags & FLAG_SHOWSIGN) ++ *fbp++ = '+'; ++ if (flags & FLAG_SPACE) ++ *fbp++ = ' '; ++ if (flags & FLAG_ALT) ++ *fbp++ = '#'; ++ if (!pad_ourselves) ++ { ++ if (flags & FLAG_ZERO) ++ *fbp++ = '0'; ++ if (dp->width_start != dp->width_end) ++ { ++ size_t n = dp->width_end - dp->width_start; ++ /* The width specification is known to consist only ++ of standard ASCII characters. */ ++ if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) ++ { ++ memcpy (fbp, dp->width_start, n * sizeof (TCHAR_T)); ++ fbp += n; ++ } ++ else ++ { ++ const FCHAR_T *mp = dp->width_start; ++ do ++ *fbp++ = (unsigned char) *mp++; ++ while (--n > 0); ++ } ++ } ++ } ++ if (!prec_ourselves) ++ { ++ if (dp->precision_start != dp->precision_end) ++ { ++ size_t n = dp->precision_end - dp->precision_start; ++ /* The precision specification is known to consist only ++ of standard ASCII characters. */ ++ if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) ++ { ++ memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T)); ++ fbp += n; ++ } ++ else ++ { ++ const FCHAR_T *mp = dp->precision_start; ++ do ++ *fbp++ = (unsigned char) *mp++; ++ while (--n > 0); ++ } ++ } ++ } ++ ++ switch (type) ++ { ++#if HAVE_LONG_LONG_INT ++ case TYPE_LONGLONGINT: ++ case TYPE_ULONGLONGINT: ++# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ ++ *fbp++ = 'I'; ++ *fbp++ = '6'; ++ *fbp++ = '4'; ++ break; ++# else ++ *fbp++ = 'l'; ++ /*FALLTHROUGH*/ ++# endif ++#endif ++ case TYPE_LONGINT: ++ case TYPE_ULONGINT: ++#if HAVE_WINT_T ++ case TYPE_WIDE_CHAR: ++#endif ++#if HAVE_WCHAR_T ++ case TYPE_WIDE_STRING: ++#endif ++ *fbp++ = 'l'; ++ break; ++ case TYPE_LONGDOUBLE: ++ *fbp++ = 'L'; ++ break; ++ default: ++ break; ++ } ++#if NEED_PRINTF_DIRECTIVE_F ++ if (dp->conversion == 'F') ++ *fbp = 'f'; ++ else ++#endif ++ *fbp = dp->conversion; ++#if USE_SNPRINTF ++# if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) ++ fbp[1] = '%'; ++ fbp[2] = 'n'; ++ fbp[3] = '\0'; ++# else ++ /* On glibc2 systems from glibc >= 2.3 - probably also older ++ ones - we know that snprintf's returns value conforms to ++ ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes. ++ Therefore we can avoid using %n in this situation. ++ On glibc2 systems from 2004-10-18 or newer, the use of %n ++ in format strings in writable memory may crash the program ++ (if compiled with _FORTIFY_SOURCE=2), so we should avoid it ++ in this situation. */ ++ /* On native Win32 systems (such as mingw), we can avoid using ++ %n because: ++ - Although the gl_SNPRINTF_TRUNCATION_C99 test fails, ++ snprintf does not write more than the specified number ++ of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes ++ '4', '5', '6' into buf, not '4', '5', '\0'.) ++ - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf ++ allows us to recognize the case of an insufficient ++ buffer size: it returns -1 in this case. ++ On native Win32 systems (such as mingw) where the OS is ++ Windows Vista, the use of %n in format strings by default ++ crashes the program. See ++ and ++ ++ So we should avoid %n in this situation. */ ++ fbp[1] = '\0'; ++# endif ++#else ++ fbp[1] = '\0'; ++#endif ++ ++ /* Construct the arguments for calling snprintf or sprintf. */ ++ prefix_count = 0; ++ if (!pad_ourselves && dp->width_arg_index != ARG_NONE) ++ { ++ if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) ++ abort (); ++ prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int; ++ } ++ if (!prec_ourselves && dp->precision_arg_index != ARG_NONE) ++ { ++ if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) ++ abort (); ++ prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int; ++ } ++ ++#if USE_SNPRINTF ++ /* The SNPRINTF result is appended after result[0..length]. ++ The latter is an array of DCHAR_T; SNPRINTF appends an ++ array of TCHAR_T to it. This is possible because ++ sizeof (TCHAR_T) divides sizeof (DCHAR_T) and ++ alignof (TCHAR_T) <= alignof (DCHAR_T). */ ++# define TCHARS_PER_DCHAR (sizeof (DCHAR_T) / sizeof (TCHAR_T)) ++ /* Ensure that maxlen below will be >= 2. Needed on BeOS, ++ where an snprintf() with maxlen==1 acts like sprintf(). */ ++ ENSURE_ALLOCATION (xsum (length, ++ (2 + TCHARS_PER_DCHAR - 1) ++ / TCHARS_PER_DCHAR)); ++ /* Prepare checking whether snprintf returns the count ++ via %n. */ ++ *(TCHAR_T *) (result + length) = '\0'; ++#endif ++ ++ for (;;) ++ { ++ int count = -1; ++ ++#if USE_SNPRINTF ++ int retcount = 0; ++ size_t maxlen = allocated - length; ++ /* SNPRINTF can fail if its second argument is ++ > INT_MAX. */ ++ if (maxlen > INT_MAX / TCHARS_PER_DCHAR) ++ maxlen = INT_MAX / TCHARS_PER_DCHAR; ++ maxlen = maxlen * TCHARS_PER_DCHAR; ++# define SNPRINTF_BUF(arg) \ ++ switch (prefix_count) \ ++ { \ ++ case 0: \ ++ retcount = SNPRINTF ((TCHAR_T *) (result + length), \ ++ maxlen, buf, \ ++ arg, &count); \ ++ break; \ ++ case 1: \ ++ retcount = SNPRINTF ((TCHAR_T *) (result + length), \ ++ maxlen, buf, \ ++ prefixes[0], arg, &count); \ ++ break; \ ++ case 2: \ ++ retcount = SNPRINTF ((TCHAR_T *) (result + length), \ ++ maxlen, buf, \ ++ prefixes[0], prefixes[1], arg, \ ++ &count); \ ++ break; \ ++ default: \ ++ abort (); \ ++ } ++#else ++# define SNPRINTF_BUF(arg) \ ++ switch (prefix_count) \ ++ { \ ++ case 0: \ ++ count = sprintf (tmp, buf, arg); \ ++ break; \ ++ case 1: \ ++ count = sprintf (tmp, buf, prefixes[0], arg); \ ++ break; \ ++ case 2: \ ++ count = sprintf (tmp, buf, prefixes[0], prefixes[1],\ ++ arg); \ ++ break; \ ++ default: \ ++ abort (); \ ++ } ++#endif ++ ++ switch (type) ++ { ++ case TYPE_SCHAR: ++ { ++ int arg = a.arg[dp->arg_index].a.a_schar; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_UCHAR: ++ { ++ unsigned int arg = a.arg[dp->arg_index].a.a_uchar; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_SHORT: ++ { ++ int arg = a.arg[dp->arg_index].a.a_short; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_USHORT: ++ { ++ unsigned int arg = a.arg[dp->arg_index].a.a_ushort; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_INT: ++ { ++ int arg = a.arg[dp->arg_index].a.a_int; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_UINT: ++ { ++ unsigned int arg = a.arg[dp->arg_index].a.a_uint; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_LONGINT: ++ { ++ long int arg = a.arg[dp->arg_index].a.a_longint; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_ULONGINT: ++ { ++ unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++#if HAVE_LONG_LONG_INT ++ case TYPE_LONGLONGINT: ++ { ++ long long int arg = a.arg[dp->arg_index].a.a_longlongint; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_ULONGLONGINT: ++ { ++ unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++#endif ++ case TYPE_DOUBLE: ++ { ++ double arg = a.arg[dp->arg_index].a.a_double; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_LONGDOUBLE: ++ { ++ long double arg = a.arg[dp->arg_index].a.a_longdouble; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ case TYPE_CHAR: ++ { ++ int arg = a.arg[dp->arg_index].a.a_char; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++#if HAVE_WINT_T ++ case TYPE_WIDE_CHAR: ++ { ++ wint_t arg = a.arg[dp->arg_index].a.a_wide_char; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++#endif ++ case TYPE_STRING: ++ { ++ const char *arg = a.arg[dp->arg_index].a.a_string; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++#if HAVE_WCHAR_T ++ case TYPE_WIDE_STRING: ++ { ++ const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++#endif ++ case TYPE_POINTER: ++ { ++ void *arg = a.arg[dp->arg_index].a.a_pointer; ++ SNPRINTF_BUF (arg); ++ } ++ break; ++ default: ++ abort (); ++ } ++ ++#if USE_SNPRINTF ++ /* Portability: Not all implementations of snprintf() ++ are ISO C 99 compliant. Determine the number of ++ bytes that snprintf() has produced or would have ++ produced. */ ++ if (count >= 0) ++ { ++ /* Verify that snprintf() has NUL-terminated its ++ result. */ ++ if (count < maxlen ++ && ((TCHAR_T *) (result + length)) [count] != '\0') ++ abort (); ++ /* Portability hack. */ ++ if (retcount > count) ++ count = retcount; ++ } ++ else ++ { ++ /* snprintf() doesn't understand the '%n' ++ directive. */ ++ if (fbp[1] != '\0') ++ { ++ /* Don't use the '%n' directive; instead, look ++ at the snprintf() return value. */ ++ fbp[1] = '\0'; ++ continue; ++ } ++ else ++ { ++ /* Look at the snprintf() return value. */ ++ if (retcount < 0) ++ { ++ /* HP-UX 10.20 snprintf() is doubly deficient: ++ It doesn't understand the '%n' directive, ++ *and* it returns -1 (rather than the length ++ that would have been required) when the ++ buffer is too small. */ ++ size_t bigger_need = ++ xsum (xtimes (allocated, 2), 12); ++ ENSURE_ALLOCATION (bigger_need); ++ continue; ++ } ++ else ++ count = retcount; ++ } ++ } ++#endif ++ ++ /* Attempt to handle failure. */ ++ if (count < 0) ++ { ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EINVAL; ++ return NULL; ++ } ++ ++#if USE_SNPRINTF ++ /* Handle overflow of the allocated buffer. ++ If such an overflow occurs, a C99 compliant snprintf() ++ returns a count >= maxlen. However, a non-compliant ++ snprintf() function returns only count = maxlen - 1. To ++ cover both cases, test whether count >= maxlen - 1. */ ++ if ((unsigned int) count + 1 >= maxlen) ++ { ++ /* If maxlen already has attained its allowed maximum, ++ allocating more memory will not increase maxlen. ++ Instead of looping, bail out. */ ++ if (maxlen == INT_MAX / TCHARS_PER_DCHAR) ++ goto overflow; ++ else ++ { ++ /* Need at least (count + 1) * sizeof (TCHAR_T) ++ bytes. (The +1 is for the trailing NUL.) ++ But ask for (count + 2) * sizeof (TCHAR_T) ++ bytes, so that in the next round, we likely get ++ maxlen > (unsigned int) count + 1 ++ and so we don't get here again. ++ And allocate proportionally, to avoid looping ++ eternally if snprintf() reports a too small ++ count. */ ++ size_t n = ++ xmax (xsum (length, ++ ((unsigned int) count + 2 ++ + TCHARS_PER_DCHAR - 1) ++ / TCHARS_PER_DCHAR), ++ xtimes (allocated, 2)); ++ ++ ENSURE_ALLOCATION (n); ++ continue; ++ } ++ } ++#endif ++ ++#if NEED_PRINTF_UNBOUNDED_PRECISION ++ if (prec_ourselves) ++ { ++ /* Handle the precision. */ ++ TCHAR_T *prec_ptr = ++# if USE_SNPRINTF ++ (TCHAR_T *) (result + length); ++# else ++ tmp; ++# endif ++ size_t prefix_count; ++ size_t move; ++ ++ prefix_count = 0; ++ /* Put the additional zeroes after the sign. */ ++ if (count >= 1 ++ && (*prec_ptr == '-' || *prec_ptr == '+' ++ || *prec_ptr == ' ')) ++ prefix_count = 1; ++ /* Put the additional zeroes after the 0x prefix if ++ (flags & FLAG_ALT) || (dp->conversion == 'p'). */ ++ else if (count >= 2 ++ && prec_ptr[0] == '0' ++ && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X')) ++ prefix_count = 2; ++ ++ move = count - prefix_count; ++ if (precision > move) ++ { ++ /* Insert zeroes. */ ++ size_t insert = precision - move; ++ TCHAR_T *prec_end; ++ ++# if USE_SNPRINTF ++ size_t n = ++ xsum (length, ++ (count + insert + TCHARS_PER_DCHAR - 1) ++ / TCHARS_PER_DCHAR); ++ length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR; ++ ENSURE_ALLOCATION (n); ++ length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR; ++ prec_ptr = (TCHAR_T *) (result + length); ++# endif ++ ++ prec_end = prec_ptr + count; ++ prec_ptr += prefix_count; ++ ++ while (prec_end > prec_ptr) ++ { ++ prec_end--; ++ prec_end[insert] = prec_end[0]; ++ } ++ ++ prec_end += insert; ++ do ++ *--prec_end = '0'; ++ while (prec_end > prec_ptr); ++ ++ count += insert; ++ } ++ } ++#endif ++ ++#if !USE_SNPRINTF ++ if (count >= tmp_length) ++ /* tmp_length was incorrectly calculated - fix the ++ code above! */ ++ abort (); ++#endif ++ ++#if !DCHAR_IS_TCHAR ++ /* Convert from TCHAR_T[] to DCHAR_T[]. */ ++ if (dp->conversion == 'c' || dp->conversion == 's') ++ { ++ /* type = TYPE_CHAR or TYPE_WIDE_CHAR or TYPE_STRING ++ TYPE_WIDE_STRING. ++ The result string is not certainly ASCII. */ ++ const TCHAR_T *tmpsrc; ++ DCHAR_T *tmpdst; ++ size_t tmpdst_len; ++ /* This code assumes that TCHAR_T is 'char'. */ ++ typedef int TCHAR_T_verify ++ [2 * (sizeof (TCHAR_T) == 1) - 1]; ++# if USE_SNPRINTF ++ tmpsrc = (TCHAR_T *) (result + length); ++# else ++ tmpsrc = tmp; ++# endif ++ tmpdst = NULL; ++ tmpdst_len = 0; ++ if (DCHAR_CONV_FROM_ENCODING (locale_charset (), ++ iconveh_question_mark, ++ tmpsrc, count, ++ NULL, ++ &tmpdst, &tmpdst_len) ++ < 0) ++ { ++ int saved_errno = errno; ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = saved_errno; ++ return NULL; ++ } ++ ENSURE_ALLOCATION (xsum (length, tmpdst_len)); ++ DCHAR_CPY (result + length, tmpdst, tmpdst_len); ++ free (tmpdst); ++ count = tmpdst_len; ++ } ++ else ++ { ++ /* The result string is ASCII. ++ Simple 1:1 conversion. */ ++# if USE_SNPRINTF ++ /* If sizeof (DCHAR_T) == sizeof (TCHAR_T), it's a ++ no-op conversion, in-place on the array starting ++ at (result + length). */ ++ if (sizeof (DCHAR_T) != sizeof (TCHAR_T)) ++# endif ++ { ++ const TCHAR_T *tmpsrc; ++ DCHAR_T *tmpdst; ++ size_t n; ++ ++# if USE_SNPRINTF ++ if (result == resultbuf) ++ { ++ tmpsrc = (TCHAR_T *) (result + length); ++ /* ENSURE_ALLOCATION will not move tmpsrc ++ (because it's part of resultbuf). */ ++ ENSURE_ALLOCATION (xsum (length, count)); ++ } ++ else ++ { ++ /* ENSURE_ALLOCATION will move the array ++ (because it uses realloc(). */ ++ ENSURE_ALLOCATION (xsum (length, count)); ++ tmpsrc = (TCHAR_T *) (result + length); ++ } ++# else ++ tmpsrc = tmp; ++ ENSURE_ALLOCATION (xsum (length, count)); ++# endif ++ tmpdst = result + length; ++ /* Copy backwards, because of overlapping. */ ++ tmpsrc += count; ++ tmpdst += count; ++ for (n = count; n > 0; n--) ++ *--tmpdst = (unsigned char) *--tmpsrc; ++ } ++ } ++#endif ++ ++#if DCHAR_IS_TCHAR && !USE_SNPRINTF ++ /* Make room for the result. */ ++ if (count > allocated - length) ++ { ++ /* Need at least count elements. But allocate ++ proportionally. */ ++ size_t n = ++ xmax (xsum (length, count), xtimes (allocated, 2)); ++ ++ ENSURE_ALLOCATION (n); ++ } ++#endif ++ ++ /* Here count <= allocated - length. */ ++ ++ /* Perform padding. */ ++#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION ++ if (pad_ourselves && has_width) ++ { ++ size_t w; ++# if ENABLE_UNISTDIO ++ /* Outside POSIX, it's preferrable to compare the width ++ against the number of _characters_ of the converted ++ value. */ ++ w = DCHAR_MBSNLEN (result + length, count); ++# else ++ /* The width is compared against the number of _bytes_ ++ of the converted value, says POSIX. */ ++ w = count; ++# endif ++ if (w < width) ++ { ++ size_t pad = width - w; ++ ++ /* Make room for the result. */ ++ if (xsum (count, pad) > allocated - length) ++ { ++ /* Need at least count + pad elements. But ++ allocate proportionally. */ ++ size_t n = ++ xmax (xsum3 (length, count, pad), ++ xtimes (allocated, 2)); ++ ++# if USE_SNPRINTF ++ length += count; ++ ENSURE_ALLOCATION (n); ++ length -= count; ++# else ++ ENSURE_ALLOCATION (n); ++# endif ++ } ++ /* Here count + pad <= allocated - length. */ ++ ++ { ++# if !DCHAR_IS_TCHAR || USE_SNPRINTF ++ DCHAR_T * const rp = result + length; ++# else ++ DCHAR_T * const rp = tmp; ++# endif ++ DCHAR_T *p = rp + count; ++ DCHAR_T *end = p + pad; ++ DCHAR_T *pad_ptr; ++# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO ++ if (dp->conversion == 'c' ++ || dp->conversion == 's') ++ /* No zero-padding for string directives. */ ++ pad_ptr = NULL; ++ else ++# endif ++ { ++ pad_ptr = (*rp == '-' ? rp + 1 : rp); ++ /* No zero-padding of "inf" and "nan". */ ++ if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z') ++ || (*pad_ptr >= 'a' && *pad_ptr <= 'z')) ++ pad_ptr = NULL; ++ } ++ /* The generated string now extends from rp to p, ++ with the zero padding insertion point being at ++ pad_ptr. */ ++ ++ count = count + pad; /* = end - rp */ ++ ++ if (flags & FLAG_LEFT) ++ { ++ /* Pad with spaces on the right. */ ++ for (; pad > 0; pad--) ++ *p++ = ' '; ++ } ++ else if ((flags & FLAG_ZERO) && pad_ptr != NULL) ++ { ++ /* Pad with zeroes. */ ++ DCHAR_T *q = end; ++ ++ while (p > pad_ptr) ++ *--q = *--p; ++ for (; pad > 0; pad--) ++ *p++ = '0'; ++ } ++ else ++ { ++ /* Pad with spaces on the left. */ ++ DCHAR_T *q = end; ++ ++ while (p > rp) ++ *--q = *--p; ++ for (; pad > 0; pad--) ++ *p++ = ' '; ++ } ++ } ++ } ++ } ++#endif ++ ++ /* Here still count <= allocated - length. */ ++ ++#if !DCHAR_IS_TCHAR || USE_SNPRINTF ++ /* The snprintf() result did fit. */ ++#else ++ /* Append the sprintf() result. */ ++ memcpy (result + length, tmp, count * sizeof (DCHAR_T)); ++#endif ++#if !USE_SNPRINTF ++ if (tmp != tmpbuf) ++ free (tmp); ++#endif ++ ++#if NEED_PRINTF_DIRECTIVE_F ++ if (dp->conversion == 'F') ++ { ++ /* Convert the %f result to upper case for %F. */ ++ DCHAR_T *rp = result + length; ++ size_t rc; ++ for (rc = count; rc > 0; rc--, rp++) ++ if (*rp >= 'a' && *rp <= 'z') ++ *rp = *rp - 'a' + 'A'; ++ } ++#endif ++ ++ length += count; ++ break; ++ } ++ } ++ } ++ } ++ ++ /* Add the final NUL. */ ++ ENSURE_ALLOCATION (xsum (length, 1)); ++ result[length] = '\0'; ++ ++ if (result != resultbuf && length + 1 < allocated) ++ { ++ /* Shrink the allocated memory if possible. */ ++ DCHAR_T *memory; ++ ++ memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T)); ++ if (memory != NULL) ++ result = memory; ++ } ++ ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ *lengthp = length; ++ /* Note that we can produce a big string of a length > INT_MAX. POSIX ++ says that snprintf() fails with errno = EOVERFLOW in this case, but ++ that's only because snprintf() returns an 'int'. This function does ++ not have this limitation. */ ++ return result; ++ ++#if USE_SNPRINTF ++ overflow: ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ CLEANUP (); ++ errno = EOVERFLOW; ++ return NULL; ++#endif ++ ++ out_of_memory: ++ if (!(result == resultbuf || result == NULL)) ++ free (result); ++ if (buf_malloced != NULL) ++ free (buf_malloced); ++ out_of_memory_1: ++ CLEANUP (); ++ errno = ENOMEM; ++ return NULL; ++ } ++} ++ ++#undef TCHARS_PER_DCHAR ++#undef SNPRINTF ++#undef USE_SNPRINTF ++#undef DCHAR_CPY ++#undef PRINTF_PARSE ++#undef DIRECTIVES ++#undef DIRECTIVE ++#undef DCHAR_IS_TCHAR ++#undef TCHAR_T ++#undef DCHAR_T ++#undef FCHAR_T ++#undef VASNPRINTF +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/vasnprintf.h gtk-vnc-0.3.7.gnulib/gnulib/lib/vasnprintf.h +--- gtk-vnc-0.3.7.mingw/gnulib/lib/vasnprintf.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/vasnprintf.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,81 @@ ++/* vsprintf with automatic memory allocation. ++ Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License along ++ with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef _VASNPRINTF_H ++#define _VASNPRINTF_H ++ ++/* Get va_list. */ ++#include ++ ++/* Get size_t. */ ++#include ++ ++#ifndef __attribute__ ++/* This feature is available in gcc versions 2.5 and later. */ ++# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) ++# define __attribute__(Spec) /* empty */ ++# endif ++/* The __-protected variants of `format' and `printf' attributes ++ are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ ++# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ++# define __format__ format ++# define __printf__ printf ++# endif ++#endif ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/* Write formatted output to a string dynamically allocated with malloc(). ++ You can pass a preallocated buffer for the result in RESULTBUF and its ++ size in *LENGTHP; otherwise you pass RESULTBUF = NULL. ++ If successful, return the address of the string (this may be = RESULTBUF ++ if no dynamic memory allocation was necessary) and set *LENGTHP to the ++ number of resulting bytes, excluding the trailing NUL. Upon error, set ++ errno and return NULL. ++ ++ When dynamic memory allocation occurs, the preallocated buffer is left ++ alone (with possibly modified contents). This makes it possible to use ++ a statically allocated or stack-allocated buffer, like this: ++ ++ char buf[100]; ++ size_t len = sizeof (buf); ++ char *output = vasnprintf (buf, &len, format, args); ++ if (output == NULL) ++ ... error handling ...; ++ else ++ { ++ ... use the output string ...; ++ if (output != buf) ++ free (output); ++ } ++ */ ++#if REPLACE_VASNPRINTF ++# define asnprintf rpl_asnprintf ++# define vasnprintf rpl_vasnprintf ++#endif ++extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) ++ __attribute__ ((__format__ (__printf__, 3, 4))); ++extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args) ++ __attribute__ ((__format__ (__printf__, 3, 0))); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _VASNPRINTF_H */ +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/wchar.in.h gtk-vnc-0.3.7.gnulib/gnulib/lib/wchar.in.h +--- gtk-vnc-0.3.7.mingw/gnulib/lib/wchar.in.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/wchar.in.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,99 @@ ++/* A substitute for ISO C99 , for platforms that have issues. ++ ++ Copyright (C) 2007-2008 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++/* Written by Eric Blake. */ ++ ++/* ++ * ISO C 99 for platforms that have issues. ++ * ++ * ++ * For now, this just ensures proper prerequisite inclusion order and ++ * the declaration of wcwidth(). ++ */ ++ ++@PRAGMA_SYSTEM_HEADER@ ++ ++#ifdef __need_mbstate_t ++/* Special invocation convention inside uClibc header files. */ ++ ++#@INCLUDE_NEXT@ @NEXT_WCHAR_H@ ++ ++#else ++/* Normal invocation convention. */ ++ ++#ifndef _GL_WCHAR_H ++ ++/* Tru64 with Desktop Toolkit C has a bug: must be included before ++ . ++ BSD/OS 4.0.1 has a bug: , and must be ++ included before . */ ++#include ++#include ++#include ++ ++/* Include the original if it exists. ++ Some builds of uClibc lack it. */ ++/* The include_next requires a split double-inclusion guard. */ ++#if @HAVE_WCHAR_H@ ++# @INCLUDE_NEXT@ @NEXT_WCHAR_H@ ++#endif ++ ++#ifndef _GL_WCHAR_H ++#define _GL_WCHAR_H ++ ++/* The definition of GL_LINK_WARNING is copied here. */ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++/* Define wint_t. (Also done in wctype.in.h.) */ ++#if !@HAVE_WINT_T@ && !defined wint_t ++# define wint_t int ++#endif ++ ++ ++/* Return the number of screen columns needed for WC. */ ++#if @GNULIB_WCWIDTH@ ++# if @REPLACE_WCWIDTH@ ++# undef wcwidth ++# define wcwidth rpl_wcwidth ++extern int wcwidth (wchar_t); ++# else ++# if !defined wcwidth && !@HAVE_DECL_WCWIDTH@ ++/* wcwidth exists but is not declared. */ ++extern int wcwidth (int /* actually wchar_t */); ++# endif ++# endif ++#elif defined GNULIB_POSIXCHECK ++# undef wcwidth ++# define wcwidth(w) \ ++ (GL_LINK_WARNING ("wcwidth is unportable - " \ ++ "use gnulib module wcwidth for portability"), \ ++ wcwidth (w)) ++#endif ++ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _GL_WCHAR_H */ ++#endif /* _GL_WCHAR_H */ ++#endif +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/winsock.c gtk-vnc-0.3.7.gnulib/gnulib/lib/winsock.c +--- gtk-vnc-0.3.7.mingw/gnulib/lib/winsock.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/winsock.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,308 @@ ++/* winsock.c --- wrappers for Windows socket functions ++ ++ Copyright (C) 2008 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program. If not, see . */ ++ ++/* Written by Paolo Bonzini */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#undef close ++#undef socket ++#undef connect ++#undef accept ++#undef bind ++#undef getpeername ++#undef getsockname ++#undef getsockopt ++#undef listen ++#undef recv ++#undef send ++#undef recvfrom ++#undef sendto ++#undef setsockopt ++ ++# define FD_TO_SOCKET(fd) ((SOCKET) _get_osfhandle ((fd))) ++# define SOCKET_TO_FD(fh) (_open_osfhandle ((long) (fh), O_RDWR | O_BINARY)) ++ ++ ++/* Wrappers for libc functions. */ ++ ++int ++rpl_close (int fd) ++{ ++ SOCKET sock = FD_TO_SOCKET (fd); ++ WSANETWORKEVENTS ev; ++ ++ ev.lNetworkEvents = 0xDEADBEEF; ++ WSAEnumNetworkEvents (sock, NULL, &ev); ++ if (ev.lNetworkEvents != 0xDEADBEEF) ++ { ++ /* FIXME: other applications, like squid, use an undocumented ++ _free_osfhnd free function. Instead, here we just close twice ++ the file descriptor. I could not get the former to work ++ (pb, Sep 22 2008). */ ++ int r = closesocket (sock); ++ _close (fd); ++ return r; ++ } ++ else ++ return _close (fd); ++} ++ ++ ++/* Wrappers for WinSock functions. */ ++ ++static inline void ++set_winsock_errno (void) ++{ ++ int err = WSAGetLastError (); ++ WSASetLastError (0); ++ ++ /* Map some WSAE* errors to the runtime library's error codes. */ ++ switch (err) ++ { ++ case WSA_INVALID_HANDLE: ++ errno = EBADF; ++ break; ++ case WSA_NOT_ENOUGH_MEMORY: ++ errno = ENOMEM; ++ break; ++ case WSA_INVALID_PARAMETER: ++ errno = EINVAL; ++ break; ++ case WSAEWOULDBLOCK: ++ errno = EWOULDBLOCK; ++ break; ++ case WSAENAMETOOLONG: ++ errno = ENAMETOOLONG; ++ break; ++ case WSAENOTEMPTY: ++ errno = ENOTEMPTY; ++ break; ++ default: ++ errno = (err > 10000 && err < 10025) ? err - 10000 : err; ++ break; ++ } ++} ++ ++#if GNULIB_SOCKET ++int ++rpl_socket (int domain, int type, int protocol) ++{ ++ /* We have to use WSASocket() to create non-overlapped IO sockets. ++ Overlapped IO sockets cannot be used with read/write. */ ++ SOCKET fh = WSASocket (domain, type, protocol, NULL, 0, 0); ++ ++ if (fh == INVALID_SOCKET) ++ { ++ set_winsock_errno (); ++ return -1; ++ } ++ else ++ return SOCKET_TO_FD (fh); ++} ++#endif ++ ++#if GNULIB_CONNECT ++int ++rpl_connect (int fd, struct sockaddr *sockaddr, int len) ++{ ++ SOCKET sock = FD_TO_SOCKET (fd); ++ int r = connect (sock, sockaddr, len); ++ if (r < 0) ++ { ++ /* EINPROGRESS is not returned by WinSock 2.0; for backwards ++ compatibility, connect(2) uses EWOULDBLOCK. */ ++ if (WSAGetLastError () == WSAEWOULDBLOCK) ++ WSASetLastError (WSAEINPROGRESS); ++ ++ set_winsock_errno (); ++ } ++ ++ return r; ++} ++#endif ++ ++#if GNULIB_ACCEPT ++int ++rpl_accept (int fd, struct sockaddr *addr, int *addrlen) ++{ ++ SOCKET fh = accept (FD_TO_SOCKET (fd), addr, addrlen); ++ if (fh == INVALID_SOCKET) ++ { ++ set_winsock_errno (); ++ return -1; ++ } ++ else ++ return SOCKET_TO_FD (fh); ++} ++#endif ++ ++#if GNULIB_BIND ++int ++rpl_bind (int fd, struct sockaddr *sockaddr, int len) ++{ ++ SOCKET sock = FD_TO_SOCKET (fd); ++ int r = bind (sock, sockaddr, len); ++ if (r < 0) ++ set_winsock_errno (); ++ ++ return r; ++} ++#endif ++ ++#if GNULIB_GETPEERNAME ++int ++rpl_getpeername (int fd, struct sockaddr *addr, int *addrlen) ++{ ++ SOCKET sock = FD_TO_SOCKET (fd); ++ int r = getpeername (sock, addr, addrlen); ++ if (r < 0) ++ set_winsock_errno (); ++ ++ return r; ++} ++#endif ++ ++#if GNULIB_GETSOCKNAME ++int ++rpl_getsockname (int fd, struct sockaddr *addr, int *addrlen) ++{ ++ SOCKET sock = FD_TO_SOCKET (fd); ++ int r = getsockname (sock, addr, addrlen); ++ if (r < 0) ++ set_winsock_errno (); ++ ++ return r; ++} ++#endif ++ ++#if GNULIB_GETSOCKOPT ++int ++rpl_getsockopt (int fd, int level, int optname, void *optval, int *optlen) ++{ ++ SOCKET sock = FD_TO_SOCKET (fd); ++ int r = getsockopt (sock, level, optname, optval, optlen); ++ if (r < 0) ++ set_winsock_errno (); ++ ++ return r; ++} ++#endif ++ ++#if GNULIB_LISTEN ++int ++rpl_listen (int fd, int backlog) ++{ ++ SOCKET sock = FD_TO_SOCKET (fd); ++ int r = listen (sock, backlog); ++ if (r < 0) ++ set_winsock_errno (); ++ ++ return r; ++} ++#endif ++ ++int ++rpl_ioctl (int fd, unsigned long req, char *buf) ++{ ++ SOCKET sock = FD_TO_SOCKET (fd); ++ int r = ioctlsocket (sock, req, (void *) buf); ++ if (r < 0) ++ set_winsock_errno (); ++ ++ return r; ++} ++ ++#if GNULIB_RECV ++int ++rpl_recv (int fd, void *buf, int len, int flags) ++{ ++ SOCKET sock = FD_TO_SOCKET (fd); ++ int r = recv (sock, buf, len, flags); ++ if (r < 0) ++ set_winsock_errno (); ++ ++ return r; ++} ++#endif ++ ++#if GNULIB_SEND ++int ++rpl_send (int fd, const void *buf, int len, int flags) ++{ ++ SOCKET sock = FD_TO_SOCKET (fd); ++ int r = send (sock, buf, len, flags); ++ if (r < 0) ++ set_winsock_errno (); ++ ++ return r; ++} ++#endif ++ ++#if GNULIB_RECVFROM ++int ++rpl_recvfrom (int fd, void *buf, int len, int flags, struct sockaddr *from, ++ int *fromlen) ++{ ++ int frombufsize = *fromlen; ++ SOCKET sock = FD_TO_SOCKET (fd); ++ int r = recvfrom (sock, buf, len, flags, from, fromlen); ++ ++ if (r < 0) ++ set_winsock_errno (); ++ ++ /* Winsock recvfrom() only returns a valid 'from' when the socket is ++ connectionless. POSIX gives a valid 'from' for all types of sockets. */ ++ else if (*fromlen == frombufsize) ++ rpl_getpeername (fd, from, fromlen); ++ ++ return r; ++} ++#endif ++ ++#if GNULIB_SENDTO ++int ++rpl_sendto (int fd, const void *buf, int len, int flags, ++ struct sockaddr *to, int tolen) ++{ ++ SOCKET sock = FD_TO_SOCKET (fd); ++ int r = sendto (sock, buf, len, flags, to, tolen); ++ if (r < 0) ++ set_winsock_errno (); ++ ++ return r; ++} ++#endif ++ ++#if GNULIB_SETSOCKOPT ++int ++rpl_setsockopt (int fd, int level, int optname, const void *optval, int optlen) ++{ ++ SOCKET sock = FD_TO_SOCKET (fd); ++ int r = setsockopt (sock, level, optname, optval, optlen); ++ if (r < 0) ++ set_winsock_errno (); ++ ++ return r; ++} ++#endif +diff -urN gtk-vnc-0.3.7.mingw/gnulib/lib/xsize.h gtk-vnc-0.3.7.gnulib/gnulib/lib/xsize.h +--- gtk-vnc-0.3.7.mingw/gnulib/lib/xsize.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/lib/xsize.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,108 @@ ++/* xsize.h -- Checked size_t computations. ++ ++ Copyright (C) 2003, 2008 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#ifndef _XSIZE_H ++#define _XSIZE_H ++ ++/* Get size_t. */ ++#include ++ ++/* Get SIZE_MAX. */ ++#include ++#if HAVE_STDINT_H ++# include ++#endif ++ ++/* The size of memory objects is often computed through expressions of ++ type size_t. Example: ++ void* p = malloc (header_size + n * element_size). ++ These computations can lead to overflow. When this happens, malloc() ++ returns a piece of memory that is way too small, and the program then ++ crashes while attempting to fill the memory. ++ To avoid this, the functions and macros in this file check for overflow. ++ The convention is that SIZE_MAX represents overflow. ++ malloc (SIZE_MAX) is not guaranteed to fail -- think of a malloc ++ implementation that uses mmap --, it's recommended to use size_overflow_p() ++ or size_in_bounds_p() before invoking malloc(). ++ The example thus becomes: ++ size_t size = xsum (header_size, xtimes (n, element_size)); ++ void *p = (size_in_bounds_p (size) ? malloc (size) : NULL); ++*/ ++ ++/* Convert an arbitrary value >= 0 to type size_t. */ ++#define xcast_size_t(N) \ ++ ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX) ++ ++/* Sum of two sizes, with overflow check. */ ++static inline size_t ++#if __GNUC__ >= 3 ++__attribute__ ((__pure__)) ++#endif ++xsum (size_t size1, size_t size2) ++{ ++ size_t sum = size1 + size2; ++ return (sum >= size1 ? sum : SIZE_MAX); ++} ++ ++/* Sum of three sizes, with overflow check. */ ++static inline size_t ++#if __GNUC__ >= 3 ++__attribute__ ((__pure__)) ++#endif ++xsum3 (size_t size1, size_t size2, size_t size3) ++{ ++ return xsum (xsum (size1, size2), size3); ++} ++ ++/* Sum of four sizes, with overflow check. */ ++static inline size_t ++#if __GNUC__ >= 3 ++__attribute__ ((__pure__)) ++#endif ++xsum4 (size_t size1, size_t size2, size_t size3, size_t size4) ++{ ++ return xsum (xsum (xsum (size1, size2), size3), size4); ++} ++ ++/* Maximum of two sizes, with overflow check. */ ++static inline size_t ++#if __GNUC__ >= 3 ++__attribute__ ((__pure__)) ++#endif ++xmax (size_t size1, size_t size2) ++{ ++ /* No explicit check is needed here, because for any n: ++ max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX. */ ++ return (size1 >= size2 ? size1 : size2); ++} ++ ++/* Multiplication of a count with an element size, with overflow check. ++ The count must be >= 0 and the element size must be > 0. ++ This is a macro, not an inline function, so that it works correctly even ++ when N is of a wider type and N > SIZE_MAX. */ ++#define xtimes(N, ELSIZE) \ ++ ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX) ++ ++/* Check for overflow. */ ++#define size_overflow_p(SIZE) \ ++ ((SIZE) == SIZE_MAX) ++/* Check against overflow. */ ++#define size_in_bounds_p(SIZE) \ ++ ((SIZE) != SIZE_MAX) ++ ++#endif /* _XSIZE_H */ +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/alloca.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/alloca.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/alloca.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/alloca.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,46 @@ ++# alloca.m4 serial 8 ++dnl Copyright (C) 2002-2004, 2006, 2007 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_FUNC_ALLOCA], ++[ ++ dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57. ++ AC_REQUIRE([AC_PROG_CPP]) ++ AC_REQUIRE([AC_PROG_EGREP]) ++ ++ AC_REQUIRE([AC_FUNC_ALLOCA]) ++ if test $ac_cv_func_alloca_works = no; then ++ gl_PREREQ_ALLOCA ++ fi ++ ++ # Define an additional variable used in the Makefile substitution. ++ if test $ac_cv_working_alloca_h = yes; then ++ AC_CACHE_CHECK([for alloca as a compiler built-in], [gl_cv_rpl_alloca], [ ++ AC_EGREP_CPP([Need own alloca], [ ++#if defined __GNUC__ || defined _AIX || defined _MSC_VER ++ Need own alloca ++#endif ++ ], [gl_cv_rpl_alloca=yes], [gl_cv_rpl_alloca=no]) ++ ]) ++ if test $gl_cv_rpl_alloca = yes; then ++ dnl OK, alloca can be implemented through a compiler built-in. ++ AC_DEFINE([HAVE_ALLOCA], 1, ++ [Define to 1 if you have 'alloca' after including , ++ a header that may be supplied by this distribution.]) ++ ALLOCA_H=alloca.h ++ else ++ dnl alloca exists as a library function, i.e. it is slow and probably ++ dnl a memory leak. Don't define HAVE_ALLOCA in this case. ++ ALLOCA_H= ++ fi ++ else ++ ALLOCA_H=alloca.h ++ fi ++ AC_SUBST([ALLOCA_H]) ++]) ++ ++# Prerequisites of lib/alloca.c. ++# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA. ++AC_DEFUN([gl_PREREQ_ALLOCA], [:]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/arpa_inet_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/arpa_inet_h.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/arpa_inet_h.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/arpa_inet_h.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,50 @@ ++# arpa_inet_h.m4 serial 5 ++dnl Copyright (C) 2006, 2008 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl Written by Simon Josefsson and Bruno Haible ++ ++AC_DEFUN([gl_HEADER_ARPA_INET], ++[ ++ dnl Use AC_REQUIRE here, so that the default behavior below is expanded ++ dnl once only, before all statements that occur in other macros. ++ AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) ++ ++ AC_CHECK_HEADERS_ONCE([arpa/inet.h]) ++ if test $ac_cv_header_arpa_inet_h = yes; then ++ HAVE_ARPA_INET_H=1 ++ else ++ ARPA_INET_H='arpa/inet.h' ++ HAVE_ARPA_INET_H=0 ++ fi ++ AC_SUBST([HAVE_ARPA_INET_H]) ++ dnl Execute this unconditionally, because ARPA_INET_H may be set by other ++ dnl modules, after this code is executed. ++ gl_CHECK_NEXT_HEADERS([arpa/inet.h]) ++]) ++ ++dnl Unconditionally enables the replacement of . ++AC_DEFUN([gl_REPLACE_ARPA_INET_H], ++[ ++ AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) ++ ARPA_INET_H='arpa/inet.h' ++]) ++ ++AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR], ++[ ++ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. ++ AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) ++ GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 ++]) ++ ++AC_DEFUN([gl_ARPA_INET_H_DEFAULTS], ++[ ++ GNULIB_INET_NTOP=0; AC_SUBST([GNULIB_INET_NTOP]) ++ GNULIB_INET_PTON=0; AC_SUBST([GNULIB_INET_PTON]) ++ dnl Assume proper GNU behavior unless another module says otherwise. ++ HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP]) ++ HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON]) ++ ARPA_INET_H=''; AC_SUBST([ARPA_INET_H]) ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/errno_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/errno_h.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/errno_h.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/errno_h.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,113 @@ ++# errno_h.m4 serial 1 ++dnl Copyright (C) 2004, 2006, 2008 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_HEADER_ERRNO_H], ++[ ++ dnl Use AC_REQUIRE here, so that the default behavior below is expanded ++ dnl once only, before all statements that occur in other macros. ++ AC_REQUIRE([gl_HEADER_ERRNO_H_BODY]) ++]) ++ ++AC_DEFUN([gl_HEADER_ERRNO_H_BODY], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_CACHE_CHECK([for complete errno.h], gl_cv_header_errno_h_complete, [ ++ AC_EGREP_CPP(booboo,[ ++#include ++#if !defined ENOMSG ++booboo ++#endif ++#if !defined EIDRM ++booboo ++#endif ++#if !defined ENOLINK ++booboo ++#endif ++#if !defined EPROTO ++booboo ++#endif ++#if !defined EMULTIHOP ++booboo ++#endif ++#if !defined EBADMSG ++booboo ++#endif ++#if !defined EOVERFLOW ++booboo ++#endif ++#if !defined ENOTSUP ++booboo ++#endif ++#if !defined ECANCELED ++booboo ++#endif ++ ], ++ [gl_cv_header_errno_h_complete=no], ++ [gl_cv_header_errno_h_complete=yes]) ++ ]) ++ if test $gl_cv_header_errno_h_complete = yes; then ++ ERRNO_H='' ++ else ++ gl_CHECK_NEXT_HEADERS([errno.h]) ++ ERRNO_H='errno.h' ++ fi ++ AC_SUBST([ERRNO_H]) ++ gl_REPLACE_ERRNO_VALUE([EMULTIHOP]) ++ gl_REPLACE_ERRNO_VALUE([ENOLINK]) ++ gl_REPLACE_ERRNO_VALUE([EOVERFLOW]) ++]) ++ ++# Assuming $1 = EOVERFLOW. ++# The EOVERFLOW errno value ought to be defined in , according to ++# POSIX. But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and ++# some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined. ++# Check for the value of EOVERFLOW. ++# Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE. ++AC_DEFUN([gl_REPLACE_ERRNO_VALUE], ++[ ++ if test -n "$ERRNO_H"; then ++ AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [ ++ AC_EGREP_CPP(yes,[ ++#include ++#ifdef ]$1[ ++yes ++#endif ++ ], ++ [gl_cv_header_errno_h_]$1[=yes], ++ [gl_cv_header_errno_h_]$1[=no]) ++ if test $gl_cv_header_errno_h_]$1[ = no; then ++ AC_EGREP_CPP(yes,[ ++#define _XOPEN_SOURCE_EXTENDED 1 ++#include ++#ifdef ]$1[ ++yes ++#endif ++ ], [gl_cv_header_errno_h_]$1[=hidden]) ++ if test $gl_cv_header_errno_h_]$1[ = hidden; then ++ dnl The macro exists but is hidden. ++ dnl Define it to the same value. ++ AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [ ++#define _XOPEN_SOURCE_EXTENDED 1 ++#include ++/* The following two lines are a workaround against an autoconf-2.52 bug. */ ++#include ++#include ++]) ++ fi ++ fi ++ ]) ++ case $gl_cv_header_errno_h_]$1[ in ++ yes | no) ++ ]$1[_HIDDEN=0; ]$1[_VALUE= ++ ;; ++ *) ++ ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1[" ++ ;; ++ esac ++ AC_SUBST($1[_HIDDEN]) ++ AC_SUBST($1[_VALUE]) ++ fi ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/extensions.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/extensions.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/extensions.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/extensions.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,82 @@ ++# serial 5 -*- Autoconf -*- ++# Enable extensions on systems that normally disable them. ++ ++# Copyright (C) 2003, 2006-2008 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. ++ ++# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS ++# Autoconf. Perhaps we can remove this once we can assume Autoconf ++# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly ++# enough in this area it's likely we'll need to redefine ++# AC_USE_SYSTEM_EXTENSIONS for quite some time. ++ ++# AC_USE_SYSTEM_EXTENSIONS ++# ------------------------ ++# Enable extensions on systems that normally disable them, ++# typically due to standards-conformance issues. ++# Remember that #undef in AH_VERBATIM gets replaced with #define by ++# AC_DEFINE. The goal here is to define all known feature-enabling ++# macros, then, if reports of conflicts are made, disable macros that ++# cause problems on some platforms (such as __EXTENSIONS__). ++AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], ++[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl ++AC_BEFORE([$0], [AC_RUN_IFELSE])dnl ++ ++ AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) ++ if test "$MINIX" = yes; then ++ AC_DEFINE([_POSIX_SOURCE], [1], ++ [Define to 1 if you need to in order for `stat' and other ++ things to work.]) ++ AC_DEFINE([_POSIX_1_SOURCE], [2], ++ [Define to 2 if the system does not provide POSIX.1 features ++ except with this defined.]) ++ AC_DEFINE([_MINIX], [1], ++ [Define to 1 if on MINIX.]) ++ fi ++ ++ AH_VERBATIM([__EXTENSIONS__], ++[/* Enable extensions on AIX 3, Interix. */ ++#ifndef _ALL_SOURCE ++# undef _ALL_SOURCE ++#endif ++/* Enable GNU extensions on systems that have them. */ ++#ifndef _GNU_SOURCE ++# undef _GNU_SOURCE ++#endif ++/* Enable threading extensions on Solaris. */ ++#ifndef _POSIX_PTHREAD_SEMANTICS ++# undef _POSIX_PTHREAD_SEMANTICS ++#endif ++/* Enable extensions on HP NonStop. */ ++#ifndef _TANDEM_SOURCE ++# undef _TANDEM_SOURCE ++#endif ++/* Enable general extensions on Solaris. */ ++#ifndef __EXTENSIONS__ ++# undef __EXTENSIONS__ ++#endif ++]) ++ AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], ++ [ac_cv_safe_to_define___extensions__], ++ [AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM([[ ++# define __EXTENSIONS__ 1 ++ ]AC_INCLUDES_DEFAULT])], ++ [ac_cv_safe_to_define___extensions__=yes], ++ [ac_cv_safe_to_define___extensions__=no])]) ++ test $ac_cv_safe_to_define___extensions__ = yes && ++ AC_DEFINE([__EXTENSIONS__]) ++ AC_DEFINE([_ALL_SOURCE]) ++ AC_DEFINE([_GNU_SOURCE]) ++ AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) ++ AC_DEFINE([_TANDEM_SOURCE]) ++])# AC_USE_SYSTEM_EXTENSIONS ++ ++# gl_USE_SYSTEM_EXTENSIONS ++# ------------------------ ++# Enable extensions on systems that normally disable them, ++# typically due to standards-conformance issues. ++AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], ++ [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/float_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/float_h.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/float_h.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/float_h.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,19 @@ ++# float_h.m4 serial 3 ++dnl Copyright (C) 2007 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_FLOAT_H], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) ++ FLOAT_H= ++ case "$host_os" in ++ beos* | openbsd*) ++ FLOAT_H=float.h ++ gl_CHECK_NEXT_HEADERS([float.h]) ++ ;; ++ esac ++ AC_SUBST([FLOAT_H]) ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/getaddrinfo.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/getaddrinfo.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/getaddrinfo.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/getaddrinfo.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,130 @@ ++# getaddrinfo.m4 serial 15 ++dnl Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_GETADDRINFO], ++[ ++ AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H ++ AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo]) ++ ++ AC_CHECK_HEADERS_ONCE(netdb.h) ++ ++ AC_SEARCH_LIBS(getaddrinfo, [nsl socket]) ++ AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [ ++ AC_TRY_LINK([ ++#include ++#ifdef HAVE_SYS_SOCKET_H ++#include ++#endif ++#ifdef HAVE_NETDB_H ++#include ++#endif ++#include ++], [getaddrinfo("", "", NULL, NULL);], ++ [gl_cv_func_getaddrinfo=yes], ++ [gl_cv_func_getaddrinfo=no])]) ++ if test $gl_cv_func_getaddrinfo = no; then ++ AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32, ++ gl_cv_w32_getaddrinfo, [ ++ gl_cv_w32_getaddrinfo=no ++ am_save_LIBS="$LIBS" ++ LIBS="$LIBS -lws2_32" ++ AC_TRY_LINK([ ++#ifdef HAVE_WS2TCPIP_H ++#include ++#endif ++#include ++], [getaddrinfo(NULL, NULL, NULL, NULL);], gl_cv_w32_getaddrinfo=yes) ++ LIBS="$am_save_LIBS"]) ++ if test "$gl_cv_w32_getaddrinfo" = "yes"; then ++ LIBS="$LIBS -lws2_32" ++ else ++ AC_LIBOBJ(getaddrinfo) ++ fi ++ fi ++ ++ # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an ++ # inline function declared in ws2tcpip.h, so we need to get that ++ # header included somehow. ++ AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)], ++ gl_cv_func_gai_strerror, [ ++ AC_TRY_LINK([ ++#include ++#ifdef HAVE_SYS_SOCKET_H ++#include ++#endif ++#ifdef HAVE_NETDB_H ++#include ++#endif ++#ifdef HAVE_WS2TCPIP_H ++#include ++#endif ++#include ++], [gai_strerror (NULL);], ++ [gl_cv_func_gai_strerror=yes], ++ [gl_cv_func_gai_strerror=no])]) ++ if test $gl_cv_func_gai_strerror = no; then ++ AC_LIBOBJ(gai_strerror) ++ fi ++ ++ gl_PREREQ_GETADDRINFO ++]) ++ ++# Prerequisites of lib/getaddrinfo.h and lib/getaddrinfo.c. ++AC_DEFUN([gl_PREREQ_GETADDRINFO], [ ++ AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H ++ AC_SEARCH_LIBS(gethostbyname, [inet nsl]) ++ AC_SEARCH_LIBS(getservbyname, [inet nsl socket xnet]) ++ AC_CHECK_FUNCS(gethostbyname,, [ ++ AC_CACHE_CHECK(for gethostbyname in winsock2.h and -lws2_32, ++ gl_cv_w32_gethostbyname, [ ++ gl_cv_w32_gethostbyname=no ++ am_save_LIBS="$LIBS" ++ LIBS="$LIBS -lws2_32" ++ AC_TRY_LINK([ ++#ifdef HAVE_WINSOCK2_H ++#include ++#endif ++#include ++], [gethostbyname(NULL);], gl_cv_w32_gethostbyname=yes) ++ LIBS="$am_save_LIBS"]) ++ if test "$gl_cv_w32_gethostbyname" = "yes"; then ++ LIBS="$LIBS -lws2_32" ++ fi ++ ]) ++ AC_REQUIRE([AC_C_RESTRICT]) ++ AC_REQUIRE([gl_SOCKET_FAMILIES]) ++ AC_REQUIRE([gl_HEADER_SYS_SOCKET]) ++ AC_REQUIRE([AC_C_INLINE]) ++ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) ++ AC_CHECK_HEADERS_ONCE(netinet/in.h netdb.h) ++ AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[ ++ /* sys/types.h is not needed according to POSIX, but the ++ sys/socket.h in i386-unknown-freebsd4.10 and ++ powerpc-apple-darwin5.5 required it. */ ++#include ++#ifdef HAVE_SYS_SOCKET_H ++#include ++#endif ++#ifdef HAVE_NETDB_H ++#include ++#endif ++#ifdef HAVE_WS2TCPIP_H ++#include ++#endif ++]) ++ AC_CHECK_TYPES([struct addrinfo],,,[ ++#include ++#ifdef HAVE_SYS_SOCKET_H ++#include ++#endif ++#ifdef HAVE_NETDB_H ++#include ++#endif ++#ifdef HAVE_WS2TCPIP_H ++#include ++#endif ++]) ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-cache.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-cache.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-cache.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-cache.m4 2008-10-09 12:33:42.000000000 +0100 +@@ -0,0 +1,42 @@ ++# Copyright (C) 2002-2008 Free Software Foundation, Inc. ++# ++# This file is free software, distributed under the terms of the GNU ++# General Public License. As a special exception to the GNU General ++# Public License, this file may be distributed as part of a program ++# that contains a configuration script generated by Autoconf, under ++# the same distribution terms as the rest of that program. ++# ++# Generated by gnulib-tool. ++# ++# This file represents the specification of how gnulib-tool is used. ++# It acts as a cache: It is written and read by gnulib-tool. ++# In projects using CVS, this file is meant to be stored in CVS, ++# like the configure.ac and various Makefile.am files. ++ ++ ++# Specification in the form of a command-line invocation: ++# gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --tests-base=gnulib/tests --aux-dir=. --with-tests --lgpl=2 --libtool --macro-prefix=gl connect getaddrinfo recv send socket vc-list-files ++ ++# Specification in the form of a few gnulib-tool.m4 macro invocations: ++gl_LOCAL_DIR([]) ++gl_MODULES([ ++ connect ++ getaddrinfo ++ recv ++ send ++ socket ++ vc-list-files ++]) ++gl_AVOID([]) ++gl_SOURCE_BASE([gnulib/lib]) ++gl_M4_BASE([gnulib/m4]) ++gl_PO_BASE([]) ++gl_DOC_BASE([doc]) ++gl_TESTS_BASE([gnulib/tests]) ++gl_WITH_TESTS ++gl_LIB([libgnu]) ++gl_LGPL([2]) ++gl_MAKEFILE_NAME([]) ++gl_LIBTOOL ++gl_MACRO_PREFIX([gl]) ++gl_PO_DOMAIN([]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-cache.m4~ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-cache.m4~ +--- gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-cache.m4~ 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-cache.m4~ 2008-10-09 12:24:40.000000000 +0100 +@@ -0,0 +1,38 @@ ++# Copyright (C) 2002-2008 Free Software Foundation, Inc. ++# ++# This file is free software, distributed under the terms of the GNU ++# General Public License. As a special exception to the GNU General ++# Public License, this file may be distributed as part of a program ++# that contains a configuration script generated by Autoconf, under ++# the same distribution terms as the rest of that program. ++# ++# Generated by gnulib-tool. ++# ++# This file represents the specification of how gnulib-tool is used. ++# It acts as a cache: It is written and read by gnulib-tool. ++# In projects using CVS, this file is meant to be stored in CVS, ++# like the configure.ac and various Makefile.am files. ++ ++ ++# Specification in the form of a command-line invocation: ++# gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --tests-base=gnulib/tests --aux-dir=. --with-tests --lgpl=2 --libtool --macro-prefix=gl getaddrinfo vc-list-files ++ ++# Specification in the form of a few gnulib-tool.m4 macro invocations: ++gl_LOCAL_DIR([]) ++gl_MODULES([ ++ getaddrinfo ++ vc-list-files ++]) ++gl_AVOID([]) ++gl_SOURCE_BASE([gnulib/lib]) ++gl_M4_BASE([gnulib/m4]) ++gl_PO_BASE([]) ++gl_DOC_BASE([doc]) ++gl_TESTS_BASE([gnulib/tests]) ++gl_WITH_TESTS ++gl_LIB([libgnu]) ++gl_LGPL([2]) ++gl_MAKEFILE_NAME([]) ++gl_LIBTOOL ++gl_MACRO_PREFIX([gl]) ++gl_PO_DOMAIN([]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-common.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-common.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-common.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-common.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,91 @@ ++# gnulib-common.m4 serial 5 ++dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++# gl_COMMON ++# is expanded unconditionally through gnulib-tool magic. ++AC_DEFUN([gl_COMMON], [ ++ dnl Use AC_REQUIRE here, so that the code is expanded once only. ++ AC_REQUIRE([gl_COMMON_BODY]) ++]) ++AC_DEFUN([gl_COMMON_BODY], [ ++ AH_VERBATIM([isoc99_inline], ++[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports ++ the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of ++ earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. ++ __APPLE__ && __MACH__ test for MacOS X. ++ __APPLE_CC__ tests for the Apple compiler and its version. ++ __STDC_VERSION__ tests for the C99 mode. */ ++#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ ++# define __GNUC_STDC_INLINE__ 1 ++#endif]) ++]) ++ ++# gl_MODULE_INDICATOR([modulename]) ++# defines a C macro indicating the presence of the given module. ++AC_DEFUN([gl_MODULE_INDICATOR], ++[ ++ AC_DEFINE([GNULIB_]translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1], ++ [Define to 1 when using the gnulib module ]$1[.]) ++]) ++ ++# m4_foreach_w ++# is a backport of autoconf-2.59c's m4_foreach_w. ++# Remove this macro when we can assume autoconf >= 2.60. ++m4_ifndef([m4_foreach_w], ++ [m4_define([m4_foreach_w], ++ [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) ++ ++# AC_PROG_MKDIR_P ++# is a backport of autoconf-2.60's AC_PROG_MKDIR_P. ++# Remove this macro when we can assume autoconf >= 2.60. ++m4_ifdef([AC_PROG_MKDIR_P], [], [ ++ AC_DEFUN([AC_PROG_MKDIR_P], ++ [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake ++ MKDIR_P='$(mkdir_p)' ++ AC_SUBST([MKDIR_P])])]) ++ ++# AC_C_RESTRICT ++# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61, ++# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++ ++# works. ++# This definition can be removed once autoconf >= 2.62 can be assumed. ++AC_DEFUN([AC_C_RESTRICT], ++[AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict, ++ [ac_cv_c_restrict=no ++ # The order here caters to the fact that C++ does not require restrict. ++ for ac_kw in __restrict __restrict__ _Restrict restrict; do ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM( ++ [[typedef int * int_ptr; ++ int foo (int_ptr $ac_kw ip) { ++ return ip[0]; ++ }]], ++ [[int s[1]; ++ int * $ac_kw t = s; ++ t[0] = 0; ++ return foo(t)]])], ++ [ac_cv_c_restrict=$ac_kw]) ++ test "$ac_cv_c_restrict" != no && break ++ done ++ ]) ++ AH_VERBATIM([restrict], ++[/* Define to the equivalent of the C99 'restrict' keyword, or to ++ nothing if this is not supported. Do not define if restrict is ++ supported directly. */ ++#undef restrict ++/* Work around a bug in Sun C++: it does not support _Restrict, even ++ though the corresponding Sun C compiler does, which causes ++ "#define restrict _Restrict" in the previous line. Perhaps some future ++ version of Sun C++ will work with _Restrict; if so, it'll probably ++ define __RESTRICT, just as Sun C does. */ ++#if defined __SUNPRO_CC && !defined __RESTRICT ++# define _Restrict ++#endif]) ++ case $ac_cv_c_restrict in ++ restrict) ;; ++ no) AC_DEFINE([restrict], []) ;; ++ *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; ++ esac ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-comp.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-comp.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-comp.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-comp.m4 2008-10-09 12:33:42.000000000 +0100 +@@ -0,0 +1,300 @@ ++# DO NOT EDIT! GENERATED AUTOMATICALLY! ++# Copyright (C) 2002-2008 Free Software Foundation, Inc. ++# ++# This file is free software, distributed under the terms of the GNU ++# General Public License. As a special exception to the GNU General ++# Public License, this file may be distributed as part of a program ++# that contains a configuration script generated by Autoconf, under ++# the same distribution terms as the rest of that program. ++# ++# Generated by gnulib-tool. ++# ++# This file represents the compiled summary of the specification in ++# gnulib-cache.m4. It lists the computed macro invocations that need ++# to be invoked from configure.ac. ++# In projects using CVS, this file can be treated like other built files. ++ ++ ++# This macro should be invoked from ./configure.ac, in the section ++# "Checks for programs", right after AC_PROG_CC, and certainly before ++# any checks for libraries, header files, types and library functions. ++AC_DEFUN([gl_EARLY], ++[ ++ m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace ++ m4_pattern_allow([^gl_ES$])dnl a valid locale name ++ m4_pattern_allow([^gl_LIBOBJS$])dnl a variable ++ m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable ++ AC_REQUIRE([AC_PROG_RANLIB]) ++ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) ++]) ++ ++# This macro should be invoked from ./configure.ac, in the section ++# "Check for header files, types and library functions". ++AC_DEFUN([gl_INIT], ++[ ++ AM_CONDITIONAL([GL_COND_LIBTOOL], [true]) ++ gl_cond_libtool=true ++ m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ])) ++ m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS])) ++ m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES])) ++ m4_pushdef([gl_LIBSOURCES_LIST], []) ++ m4_pushdef([gl_LIBSOURCES_DIR], []) ++ gl_COMMON ++ gl_source_base='gnulib/lib' ++ gl_FUNC_ALLOCA ++ gl_HEADER_ARPA_INET ++ AC_PROG_MKDIR_P ++ AC_REQUIRE([gl_HEADER_SYS_SOCKET]) ++ if test "$ac_cv_header_winsock2_h" = yes; then ++ AC_LIBOBJ([winsock]) ++ fi ++ gl_SYS_SOCKET_MODULE_INDICATOR([connect]) ++ gl_HEADER_ERRNO_H ++ gl_FLOAT_H ++ gl_GETADDRINFO ++ AC_SUBST([LIBINTL]) ++ AC_SUBST([LTLIBINTL]) ++ gl_INET_NTOP ++ gl_ARPA_INET_MODULE_INDICATOR([inet_ntop]) ++ gl_HEADER_NETINET_IN ++ AC_PROG_MKDIR_P ++ AC_REQUIRE([gl_HEADER_SYS_SOCKET]) ++ if test "$ac_cv_header_winsock2_h" = yes; then ++ AC_LIBOBJ([winsock]) ++ fi ++ gl_SYS_SOCKET_MODULE_INDICATOR([recv]) ++ AC_REQUIRE([gl_HEADER_SYS_SOCKET]) ++ if test "$ac_cv_header_winsock2_h" = yes; then ++ AC_LIBOBJ([winsock]) ++ fi ++ gl_SYS_SOCKET_MODULE_INDICATOR([send]) ++ gl_SIZE_MAX ++ gl_FUNC_SNPRINTF ++ gl_STDIO_MODULE_INDICATOR([snprintf]) ++ AC_REQUIRE([gl_HEADER_SYS_SOCKET]) ++ if test "$ac_cv_header_winsock2_h" = yes; then ++ AC_LIBOBJ([winsock]) ++ fi ++ gl_SYS_SOCKET_MODULE_INDICATOR([socket]) ++ gl_TYPE_SOCKLEN_T ++ AM_STDBOOL_H ++ gl_STDINT_H ++ gl_STDIO_H ++ gl_HEADER_SYS_SOCKET ++ AC_PROG_MKDIR_P ++ gl_FUNC_VASNPRINTF ++ gl_WCHAR_H ++ gl_XSIZE ++ m4_ifval(gl_LIBSOURCES_LIST, [ ++ m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || ++ for gl_file in ]gl_LIBSOURCES_LIST[ ; do ++ if test ! -r ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file ; then ++ echo "missing file ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file" >&2 ++ exit 1 ++ fi ++ done])dnl ++ m4_if(m4_sysval, [0], [], ++ [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) ++ ]) ++ m4_popdef([gl_LIBSOURCES_DIR]) ++ m4_popdef([gl_LIBSOURCES_LIST]) ++ m4_popdef([AC_LIBSOURCES]) ++ m4_popdef([AC_REPLACE_FUNCS]) ++ m4_popdef([AC_LIBOBJ]) ++ AC_CONFIG_COMMANDS_PRE([ ++ gl_libobjs= ++ gl_ltlibobjs= ++ if test -n "$gl_LIBOBJS"; then ++ # Remove the extension. ++ sed_drop_objext='s/\.o$//;s/\.obj$//' ++ for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do ++ gl_libobjs="$gl_libobjs $i.$ac_objext" ++ gl_ltlibobjs="$gl_ltlibobjs $i.lo" ++ done ++ fi ++ AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) ++ AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) ++ ]) ++ gltests_libdeps= ++ gltests_ltlibdeps= ++ m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ])) ++ m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS])) ++ m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES])) ++ m4_pushdef([gltests_LIBSOURCES_LIST], []) ++ m4_pushdef([gltests_LIBSOURCES_DIR], []) ++ gl_COMMON ++ gl_source_base='gnulib/tests' ++ gt_TYPE_WCHAR_T ++ gt_TYPE_WINT_T ++ AC_CHECK_FUNCS([shutdown]) ++ abs_aux_dir=`cd "$ac_aux_dir"; pwd` ++ AC_SUBST([abs_aux_dir]) ++ m4_ifval(gltests_LIBSOURCES_LIST, [ ++ m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ || ++ for gl_file in ]gltests_LIBSOURCES_LIST[ ; do ++ if test ! -r ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file ; then ++ echo "missing file ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file" >&2 ++ exit 1 ++ fi ++ done])dnl ++ m4_if(m4_sysval, [0], [], ++ [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) ++ ]) ++ m4_popdef([gltests_LIBSOURCES_DIR]) ++ m4_popdef([gltests_LIBSOURCES_LIST]) ++ m4_popdef([AC_LIBSOURCES]) ++ m4_popdef([AC_REPLACE_FUNCS]) ++ m4_popdef([AC_LIBOBJ]) ++ AC_CONFIG_COMMANDS_PRE([ ++ gltests_libobjs= ++ gltests_ltlibobjs= ++ if test -n "$gltests_LIBOBJS"; then ++ # Remove the extension. ++ sed_drop_objext='s/\.o$//;s/\.obj$//' ++ for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do ++ gltests_libobjs="$gltests_libobjs $i.$ac_objext" ++ gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" ++ done ++ fi ++ AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs]) ++ AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs]) ++ ]) ++ LIBTESTS_LIBDEPS="$gltests_libdeps" ++ AC_SUBST([LIBTESTS_LIBDEPS]) ++]) ++ ++# Like AC_LIBOBJ, except that the module name goes ++# into gl_LIBOBJS instead of into LIBOBJS. ++AC_DEFUN([gl_LIBOBJ], [ ++ AS_LITERAL_IF([$1], [gl_LIBSOURCES([$1.c])])dnl ++ gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext" ++]) ++ ++# Like AC_REPLACE_FUNCS, except that the module name goes ++# into gl_LIBOBJS instead of into LIBOBJS. ++AC_DEFUN([gl_REPLACE_FUNCS], [ ++ m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl ++ AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)]) ++]) ++ ++# Like AC_LIBSOURCES, except the directory where the source file is ++# expected is derived from the gnulib-tool parameterization, ++# and alloca is special cased (for the alloca-opt module). ++# We could also entirely rely on EXTRA_lib..._SOURCES. ++AC_DEFUN([gl_LIBSOURCES], [ ++ m4_foreach([_gl_NAME], [$1], [ ++ m4_if(_gl_NAME, [alloca.c], [], [ ++ m4_define([gl_LIBSOURCES_DIR], [gnulib/lib]) ++ m4_append([gl_LIBSOURCES_LIST], _gl_NAME, [ ]) ++ ]) ++ ]) ++]) ++ ++# Like AC_LIBOBJ, except that the module name goes ++# into gltests_LIBOBJS instead of into LIBOBJS. ++AC_DEFUN([gltests_LIBOBJ], [ ++ AS_LITERAL_IF([$1], [gltests_LIBSOURCES([$1.c])])dnl ++ gltests_LIBOBJS="$gltests_LIBOBJS $1.$ac_objext" ++]) ++ ++# Like AC_REPLACE_FUNCS, except that the module name goes ++# into gltests_LIBOBJS instead of into LIBOBJS. ++AC_DEFUN([gltests_REPLACE_FUNCS], [ ++ m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl ++ AC_CHECK_FUNCS([$1], , [gltests_LIBOBJ($ac_func)]) ++]) ++ ++# Like AC_LIBSOURCES, except the directory where the source file is ++# expected is derived from the gnulib-tool parameterization, ++# and alloca is special cased (for the alloca-opt module). ++# We could also entirely rely on EXTRA_lib..._SOURCES. ++AC_DEFUN([gltests_LIBSOURCES], [ ++ m4_foreach([_gl_NAME], [$1], [ ++ m4_if(_gl_NAME, [alloca.c], [], [ ++ m4_define([gltests_LIBSOURCES_DIR], [gnulib/tests]) ++ m4_append([gltests_LIBSOURCES_LIST], _gl_NAME, [ ]) ++ ]) ++ ]) ++]) ++ ++# This macro records the list of files which have been installed by ++# gnulib-tool and may be removed by future gnulib-tool invocations. ++AC_DEFUN([gl_FILE_LIST], [ ++ build-aux/link-warning.h ++ build-aux/vc-list-files ++ lib/alloca.in.h ++ lib/arpa_inet.in.h ++ lib/asnprintf.c ++ lib/dummy.c ++ lib/errno.in.h ++ lib/float+.h ++ lib/float.in.h ++ lib/gai_strerror.c ++ lib/getaddrinfo.c ++ lib/getaddrinfo.h ++ lib/gettext.h ++ lib/inet_ntop.c ++ lib/netinet_in.in.h ++ lib/printf-args.c ++ lib/printf-args.h ++ lib/printf-parse.c ++ lib/printf-parse.h ++ lib/size_max.h ++ lib/snprintf.c ++ lib/stdbool.in.h ++ lib/stdint.in.h ++ lib/stdio-write.c ++ lib/stdio.in.h ++ lib/sys_socket.in.h ++ lib/vasnprintf.c ++ lib/vasnprintf.h ++ lib/wchar.in.h ++ lib/winsock.c ++ lib/xsize.h ++ m4/alloca.m4 ++ m4/arpa_inet_h.m4 ++ m4/errno_h.m4 ++ m4/extensions.m4 ++ m4/float_h.m4 ++ m4/getaddrinfo.m4 ++ m4/gnulib-common.m4 ++ m4/include_next.m4 ++ m4/inet_ntop.m4 ++ m4/intmax_t.m4 ++ m4/inttypes_h.m4 ++ m4/longlong.m4 ++ m4/netinet_in_h.m4 ++ m4/onceonly.m4 ++ m4/printf.m4 ++ m4/size_max.m4 ++ m4/snprintf.m4 ++ m4/socklen.m4 ++ m4/sockpfaf.m4 ++ m4/stdbool.m4 ++ m4/stdint.m4 ++ m4/stdint_h.m4 ++ m4/stdio_h.m4 ++ m4/sys_socket_h.m4 ++ m4/vasnprintf.m4 ++ m4/wchar.m4 ++ m4/wchar_t.m4 ++ m4/wint_t.m4 ++ m4/xsize.m4 ++ tests/test-alloca-opt.c ++ tests/test-arpa_inet.c ++ tests/test-errno.c ++ tests/test-getaddrinfo.c ++ tests/test-netinet_in.c ++ tests/test-snprintf.c ++ tests/test-stdbool.c ++ tests/test-stdint.c ++ tests/test-stdio.c ++ tests/test-sys_socket.c ++ tests/test-vasnprintf.c ++ tests/test-vc-list-files-cvs.sh ++ tests/test-vc-list-files-git.sh ++ tests/test-wchar.c ++ tests=lib/dummy.c ++ tests=lib/intprops.h ++ tests=lib/verify.h ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-comp.m4~ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-comp.m4~ +--- gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-comp.m4~ 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-comp.m4~ 2008-10-09 12:24:40.000000000 +0100 +@@ -0,0 +1,280 @@ ++# DO NOT EDIT! GENERATED AUTOMATICALLY! ++# Copyright (C) 2002-2008 Free Software Foundation, Inc. ++# ++# This file is free software, distributed under the terms of the GNU ++# General Public License. As a special exception to the GNU General ++# Public License, this file may be distributed as part of a program ++# that contains a configuration script generated by Autoconf, under ++# the same distribution terms as the rest of that program. ++# ++# Generated by gnulib-tool. ++# ++# This file represents the compiled summary of the specification in ++# gnulib-cache.m4. It lists the computed macro invocations that need ++# to be invoked from configure.ac. ++# In projects using CVS, this file can be treated like other built files. ++ ++ ++# This macro should be invoked from ./configure.ac, in the section ++# "Checks for programs", right after AC_PROG_CC, and certainly before ++# any checks for libraries, header files, types and library functions. ++AC_DEFUN([gl_EARLY], ++[ ++ m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace ++ m4_pattern_allow([^gl_ES$])dnl a valid locale name ++ m4_pattern_allow([^gl_LIBOBJS$])dnl a variable ++ m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable ++ AC_REQUIRE([AC_PROG_RANLIB]) ++ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) ++]) ++ ++# This macro should be invoked from ./configure.ac, in the section ++# "Check for header files, types and library functions". ++AC_DEFUN([gl_INIT], ++[ ++ AM_CONDITIONAL([GL_COND_LIBTOOL], [true]) ++ gl_cond_libtool=true ++ m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ])) ++ m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS])) ++ m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES])) ++ m4_pushdef([gl_LIBSOURCES_LIST], []) ++ m4_pushdef([gl_LIBSOURCES_DIR], []) ++ gl_COMMON ++ gl_source_base='gnulib/lib' ++ gl_FUNC_ALLOCA ++ gl_HEADER_ARPA_INET ++ AC_PROG_MKDIR_P ++ gl_HEADER_ERRNO_H ++ gl_FLOAT_H ++ gl_GETADDRINFO ++ AC_SUBST([LIBINTL]) ++ AC_SUBST([LTLIBINTL]) ++ gl_INET_NTOP ++ gl_ARPA_INET_MODULE_INDICATOR([inet_ntop]) ++ gl_HEADER_NETINET_IN ++ AC_PROG_MKDIR_P ++ gl_SIZE_MAX ++ gl_FUNC_SNPRINTF ++ gl_STDIO_MODULE_INDICATOR([snprintf]) ++ gl_TYPE_SOCKLEN_T ++ AM_STDBOOL_H ++ gl_STDINT_H ++ gl_STDIO_H ++ gl_HEADER_SYS_SOCKET ++ AC_PROG_MKDIR_P ++ gl_FUNC_VASNPRINTF ++ gl_WCHAR_H ++ gl_XSIZE ++ m4_ifval(gl_LIBSOURCES_LIST, [ ++ m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || ++ for gl_file in ]gl_LIBSOURCES_LIST[ ; do ++ if test ! -r ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file ; then ++ echo "missing file ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file" >&2 ++ exit 1 ++ fi ++ done])dnl ++ m4_if(m4_sysval, [0], [], ++ [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) ++ ]) ++ m4_popdef([gl_LIBSOURCES_DIR]) ++ m4_popdef([gl_LIBSOURCES_LIST]) ++ m4_popdef([AC_LIBSOURCES]) ++ m4_popdef([AC_REPLACE_FUNCS]) ++ m4_popdef([AC_LIBOBJ]) ++ AC_CONFIG_COMMANDS_PRE([ ++ gl_libobjs= ++ gl_ltlibobjs= ++ if test -n "$gl_LIBOBJS"; then ++ # Remove the extension. ++ sed_drop_objext='s/\.o$//;s/\.obj$//' ++ for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do ++ gl_libobjs="$gl_libobjs $i.$ac_objext" ++ gl_ltlibobjs="$gl_ltlibobjs $i.lo" ++ done ++ fi ++ AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) ++ AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) ++ ]) ++ gltests_libdeps= ++ gltests_ltlibdeps= ++ m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ])) ++ m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS])) ++ m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES])) ++ m4_pushdef([gltests_LIBSOURCES_LIST], []) ++ m4_pushdef([gltests_LIBSOURCES_DIR], []) ++ gl_COMMON ++ gl_source_base='gnulib/tests' ++ gt_TYPE_WCHAR_T ++ gt_TYPE_WINT_T ++ AC_CHECK_FUNCS([shutdown]) ++ abs_aux_dir=`cd "$ac_aux_dir"; pwd` ++ AC_SUBST([abs_aux_dir]) ++ m4_ifval(gltests_LIBSOURCES_LIST, [ ++ m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ || ++ for gl_file in ]gltests_LIBSOURCES_LIST[ ; do ++ if test ! -r ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file ; then ++ echo "missing file ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file" >&2 ++ exit 1 ++ fi ++ done])dnl ++ m4_if(m4_sysval, [0], [], ++ [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) ++ ]) ++ m4_popdef([gltests_LIBSOURCES_DIR]) ++ m4_popdef([gltests_LIBSOURCES_LIST]) ++ m4_popdef([AC_LIBSOURCES]) ++ m4_popdef([AC_REPLACE_FUNCS]) ++ m4_popdef([AC_LIBOBJ]) ++ AC_CONFIG_COMMANDS_PRE([ ++ gltests_libobjs= ++ gltests_ltlibobjs= ++ if test -n "$gltests_LIBOBJS"; then ++ # Remove the extension. ++ sed_drop_objext='s/\.o$//;s/\.obj$//' ++ for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do ++ gltests_libobjs="$gltests_libobjs $i.$ac_objext" ++ gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" ++ done ++ fi ++ AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs]) ++ AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs]) ++ ]) ++ LIBTESTS_LIBDEPS="$gltests_libdeps" ++ AC_SUBST([LIBTESTS_LIBDEPS]) ++]) ++ ++# Like AC_LIBOBJ, except that the module name goes ++# into gl_LIBOBJS instead of into LIBOBJS. ++AC_DEFUN([gl_LIBOBJ], [ ++ AS_LITERAL_IF([$1], [gl_LIBSOURCES([$1.c])])dnl ++ gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext" ++]) ++ ++# Like AC_REPLACE_FUNCS, except that the module name goes ++# into gl_LIBOBJS instead of into LIBOBJS. ++AC_DEFUN([gl_REPLACE_FUNCS], [ ++ m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl ++ AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)]) ++]) ++ ++# Like AC_LIBSOURCES, except the directory where the source file is ++# expected is derived from the gnulib-tool parameterization, ++# and alloca is special cased (for the alloca-opt module). ++# We could also entirely rely on EXTRA_lib..._SOURCES. ++AC_DEFUN([gl_LIBSOURCES], [ ++ m4_foreach([_gl_NAME], [$1], [ ++ m4_if(_gl_NAME, [alloca.c], [], [ ++ m4_define([gl_LIBSOURCES_DIR], [gnulib/lib]) ++ m4_append([gl_LIBSOURCES_LIST], _gl_NAME, [ ]) ++ ]) ++ ]) ++]) ++ ++# Like AC_LIBOBJ, except that the module name goes ++# into gltests_LIBOBJS instead of into LIBOBJS. ++AC_DEFUN([gltests_LIBOBJ], [ ++ AS_LITERAL_IF([$1], [gltests_LIBSOURCES([$1.c])])dnl ++ gltests_LIBOBJS="$gltests_LIBOBJS $1.$ac_objext" ++]) ++ ++# Like AC_REPLACE_FUNCS, except that the module name goes ++# into gltests_LIBOBJS instead of into LIBOBJS. ++AC_DEFUN([gltests_REPLACE_FUNCS], [ ++ m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl ++ AC_CHECK_FUNCS([$1], , [gltests_LIBOBJ($ac_func)]) ++]) ++ ++# Like AC_LIBSOURCES, except the directory where the source file is ++# expected is derived from the gnulib-tool parameterization, ++# and alloca is special cased (for the alloca-opt module). ++# We could also entirely rely on EXTRA_lib..._SOURCES. ++AC_DEFUN([gltests_LIBSOURCES], [ ++ m4_foreach([_gl_NAME], [$1], [ ++ m4_if(_gl_NAME, [alloca.c], [], [ ++ m4_define([gltests_LIBSOURCES_DIR], [gnulib/tests]) ++ m4_append([gltests_LIBSOURCES_LIST], _gl_NAME, [ ]) ++ ]) ++ ]) ++]) ++ ++# This macro records the list of files which have been installed by ++# gnulib-tool and may be removed by future gnulib-tool invocations. ++AC_DEFUN([gl_FILE_LIST], [ ++ build-aux/link-warning.h ++ build-aux/vc-list-files ++ lib/alloca.in.h ++ lib/arpa_inet.in.h ++ lib/asnprintf.c ++ lib/dummy.c ++ lib/errno.in.h ++ lib/float+.h ++ lib/float.in.h ++ lib/gai_strerror.c ++ lib/getaddrinfo.c ++ lib/getaddrinfo.h ++ lib/gettext.h ++ lib/inet_ntop.c ++ lib/netinet_in.in.h ++ lib/printf-args.c ++ lib/printf-args.h ++ lib/printf-parse.c ++ lib/printf-parse.h ++ lib/size_max.h ++ lib/snprintf.c ++ lib/stdbool.in.h ++ lib/stdint.in.h ++ lib/stdio-write.c ++ lib/stdio.in.h ++ lib/sys_socket.in.h ++ lib/vasnprintf.c ++ lib/vasnprintf.h ++ lib/wchar.in.h ++ lib/winsock.c ++ lib/xsize.h ++ m4/alloca.m4 ++ m4/arpa_inet_h.m4 ++ m4/errno_h.m4 ++ m4/extensions.m4 ++ m4/float_h.m4 ++ m4/getaddrinfo.m4 ++ m4/gnulib-common.m4 ++ m4/include_next.m4 ++ m4/inet_ntop.m4 ++ m4/intmax_t.m4 ++ m4/inttypes_h.m4 ++ m4/longlong.m4 ++ m4/netinet_in_h.m4 ++ m4/onceonly.m4 ++ m4/printf.m4 ++ m4/size_max.m4 ++ m4/snprintf.m4 ++ m4/socklen.m4 ++ m4/sockpfaf.m4 ++ m4/stdbool.m4 ++ m4/stdint.m4 ++ m4/stdint_h.m4 ++ m4/stdio_h.m4 ++ m4/sys_socket_h.m4 ++ m4/vasnprintf.m4 ++ m4/wchar.m4 ++ m4/wchar_t.m4 ++ m4/wint_t.m4 ++ m4/xsize.m4 ++ tests/test-alloca-opt.c ++ tests/test-arpa_inet.c ++ tests/test-errno.c ++ tests/test-getaddrinfo.c ++ tests/test-netinet_in.c ++ tests/test-snprintf.c ++ tests/test-stdbool.c ++ tests/test-stdint.c ++ tests/test-stdio.c ++ tests/test-sys_socket.c ++ tests/test-vasnprintf.c ++ tests/test-vc-list-files-cvs.sh ++ tests/test-vc-list-files-git.sh ++ tests/test-wchar.c ++ tests=lib/dummy.c ++ tests=lib/intprops.h ++ tests=lib/verify.h ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-tool.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-tool.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/gnulib-tool.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/gnulib-tool.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,57 @@ ++# gnulib-tool.m4 serial 2 ++dnl Copyright (C) 2004-2005 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl The following macros need not be invoked explicitly. ++dnl Invoking them does nothing except to declare default arguments ++dnl for "gnulib-tool --import". ++ ++dnl Usage: gl_LOCAL_DIR([DIR]) ++AC_DEFUN([gl_LOCAL_DIR], []) ++ ++dnl Usage: gl_MODULES([module1 module2 ...]) ++AC_DEFUN([gl_MODULES], []) ++ ++dnl Usage: gl_AVOID([module1 module2 ...]) ++AC_DEFUN([gl_AVOID], []) ++ ++dnl Usage: gl_SOURCE_BASE([DIR]) ++AC_DEFUN([gl_SOURCE_BASE], []) ++ ++dnl Usage: gl_M4_BASE([DIR]) ++AC_DEFUN([gl_M4_BASE], []) ++ ++dnl Usage: gl_PO_BASE([DIR]) ++AC_DEFUN([gl_PO_BASE], []) ++ ++dnl Usage: gl_DOC_BASE([DIR]) ++AC_DEFUN([gl_DOC_BASE], []) ++ ++dnl Usage: gl_TESTS_BASE([DIR]) ++AC_DEFUN([gl_TESTS_BASE], []) ++ ++dnl Usage: gl_WITH_TESTS ++AC_DEFUN([gl_WITH_TESTS], []) ++ ++dnl Usage: gl_LIB([LIBNAME]) ++AC_DEFUN([gl_LIB], []) ++ ++dnl Usage: gl_LGPL or gl_LGPL([VERSION]) ++AC_DEFUN([gl_LGPL], []) ++ ++dnl Usage: gl_MAKEFILE_NAME([FILENAME]) ++AC_DEFUN([gl_MAKEFILE_NAME], []) ++ ++dnl Usage: gl_LIBTOOL ++AC_DEFUN([gl_LIBTOOL], []) ++ ++dnl Usage: gl_MACRO_PREFIX([PREFIX]) ++AC_DEFUN([gl_MACRO_PREFIX], []) ++ ++dnl Usage: gl_PO_DOMAIN([DOMAIN]) ++AC_DEFUN([gl_PO_DOMAIN], []) ++ ++dnl Usage: gl_VC_FILES([BOOLEAN]) ++AC_DEFUN([gl_VC_FILES], []) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/include_next.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/include_next.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/include_next.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/include_next.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,128 @@ ++# include_next.m4 serial 8 ++dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl From Paul Eggert and Derek Price. ++ ++dnl Sets INCLUDE_NEXT and PRAGMA_SYSTEM_HEADER. ++dnl ++dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to ++dnl 'include' otherwise. ++dnl ++dnl PRAGMA_SYSTEM_HEADER can be used in files that contain #include_next, ++dnl so as to avoid GCC warnings when the gcc option -pedantic is used. ++dnl '#pragma GCC system_header' has the same effect as if the file was found ++dnl through the include search path specified with '-isystem' options (as ++dnl opposed to the search path specified with '-I' options). Namely, gcc ++dnl does not warn about some things, and on some systems (Solaris and Interix) ++dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side ++dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead ++dnl of plain '__STDC__'. ++ ++AC_DEFUN([gl_INCLUDE_NEXT], ++[ ++ AC_LANG_PREPROC_REQUIRE() ++ AC_CACHE_CHECK([whether the preprocessor supports include_next], ++ [gl_cv_have_include_next], ++ [rm -rf conftestd1 conftestd2 ++ mkdir conftestd1 conftestd2 ++ dnl The include of is because IBM C 9.0 on AIX 6.1 supports ++ dnl include_next when used as first preprocessor directive in a file, ++ dnl but not when preceded by another include directive. ++ cat < conftestd1/conftest.h ++#define DEFINED_IN_CONFTESTD1 ++#include ++#include_next ++#ifdef DEFINED_IN_CONFTESTD2 ++int foo; ++#else ++#error "include_next doesn't work" ++#endif ++EOF ++ cat < conftestd2/conftest.h ++#ifndef DEFINED_IN_CONFTESTD1 ++#error "include_next test doesn't work" ++#endif ++#define DEFINED_IN_CONFTESTD2 ++EOF ++ save_CPPFLAGS="$CPPFLAGS" ++ CPPFLAGS="$CPPFLAGS -Iconftestd1 -Iconftestd2" ++ AC_COMPILE_IFELSE([#include ], ++ [gl_cv_have_include_next=yes], ++ [gl_cv_have_include_next=no]) ++ CPPFLAGS="$save_CPPFLAGS" ++ rm -rf conftestd1 conftestd2 ++ ]) ++ PRAGMA_SYSTEM_HEADER= ++ if test $gl_cv_have_include_next = yes; then ++ INCLUDE_NEXT=include_next ++ if test -n "$GCC"; then ++ PRAGMA_SYSTEM_HEADER='#pragma GCC system_header' ++ fi ++ else ++ INCLUDE_NEXT=include ++ fi ++ AC_SUBST([INCLUDE_NEXT]) ++ AC_SUBST([PRAGMA_SYSTEM_HEADER]) ++]) ++ ++# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...) ++# ------------------------------------------ ++# For each arg foo.h, if #include_next works, define NEXT_FOO_H to be ++# ''; otherwise define it to be ++# '"///usr/include/foo.h"', or whatever other absolute file name is suitable. ++# That way, a header file with the following line: ++# #@INCLUDE_NEXT@ @NEXT_FOO_H@ ++# behaves (after sed substitution) as if it contained ++# #include_next ++# even if the compiler does not support include_next. ++# The three "///" are to pacify Sun C 5.8, which otherwise would say ++# "warning: #include of /usr/include/... may be non-portable". ++# Use `""', not `<>', so that the /// cannot be confused with a C99 comment. ++# Note: This macro assumes that the header file is not empty after ++# preprocessing, i.e. it does not only define preprocessor macros but also ++# provides some type/enum definitions or function/variable declarations. ++AC_DEFUN([gl_CHECK_NEXT_HEADERS], ++[ ++ AC_REQUIRE([gl_INCLUDE_NEXT]) ++ AC_CHECK_HEADERS_ONCE([$1]) ++ ++ m4_foreach_w([gl_HEADER_NAME], [$1], ++ [AS_VAR_PUSHDEF([gl_next_header], ++ [gl_cv_next_]m4_quote(m4_defn([gl_HEADER_NAME]))) ++ if test $gl_cv_have_include_next = yes; then ++ AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) ++ else ++ AC_CACHE_CHECK( ++ [absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>], ++ m4_quote(m4_defn([gl_next_header])), ++ [AS_VAR_PUSHDEF([gl_header_exists], ++ [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME]))) ++ if test AS_VAR_GET(gl_header_exists) = yes; then ++ AC_LANG_CONFTEST( ++ [AC_LANG_SOURCE( ++ [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] ++ )]) ++ dnl eval is necessary to expand ac_cpp. ++ dnl Ultrix and Pyramid sh refuse to redirect output of eval, ++ dnl so use subshell. ++ AS_VAR_SET([gl_next_header], ++ ['"'`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | ++ sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{ ++ s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1# ++ s#^/[^/]#//&# ++ p ++ q ++ }'`'"']) ++ else ++ AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) ++ fi ++ AS_VAR_POPDEF([gl_header_exists])]) ++ fi ++ AC_SUBST( ++ AS_TR_CPP([NEXT_]m4_quote(m4_defn([gl_HEADER_NAME]))), ++ [AS_VAR_GET([gl_next_header])]) ++ AS_VAR_POPDEF([gl_next_header])]) ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/inet_ntop.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/inet_ntop.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/inet_ntop.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/inet_ntop.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,26 @@ ++# inet_ntop.m4 serial 7 ++dnl Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_INET_NTOP], ++[ ++ dnl Persuade Solaris to declare inet_ntop. ++ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) ++ ++ gl_REPLACE_ARPA_INET_H ++ ++ AC_REPLACE_FUNCS(inet_ntop) ++ gl_PREREQ_INET_NTOP ++]) ++ ++# Prerequisites of lib/inet_ntop.c. ++AC_DEFUN([gl_PREREQ_INET_NTOP], [ ++ AC_CHECK_DECLS([inet_ntop],,,[#include ]) ++ if test $ac_cv_have_decl_inet_ntop = no; then ++ HAVE_DECL_INET_NTOP=0 ++ fi ++ AC_REQUIRE([gl_SOCKET_FAMILIES]) ++ AC_REQUIRE([AC_C_RESTRICT]) ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/intmax_t.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/intmax_t.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/intmax_t.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/intmax_t.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,61 @@ ++# intmax_t.m4 serial 6 ++dnl Copyright (C) 1997-2004, 2006-2007 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl From Paul Eggert. ++ ++AC_PREREQ(2.13) ++ ++# Define intmax_t to 'long' or 'long long' ++# if it is not already defined in or . ++ ++AC_DEFUN([gl_AC_TYPE_INTMAX_T], ++[ ++ dnl For simplicity, we assume that a header file defines 'intmax_t' if and ++ dnl only if it defines 'uintmax_t'. ++ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) ++ AC_REQUIRE([gl_AC_HEADER_STDINT_H]) ++ if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then ++ AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) ++ test $ac_cv_type_long_long_int = yes \ ++ && ac_type='long long' \ ++ || ac_type='long' ++ AC_DEFINE_UNQUOTED(intmax_t, $ac_type, ++ [Define to long or long long if and don't define.]) ++ else ++ AC_DEFINE(HAVE_INTMAX_T, 1, ++ [Define if you have the 'intmax_t' type in or .]) ++ fi ++]) ++ ++dnl An alternative would be to explicitly test for 'intmax_t'. ++ ++AC_DEFUN([gt_AC_TYPE_INTMAX_T], ++[ ++ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) ++ AC_REQUIRE([gl_AC_HEADER_STDINT_H]) ++ AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t, ++ [AC_TRY_COMPILE([ ++#include ++#include ++#if HAVE_STDINT_H_WITH_UINTMAX ++#include ++#endif ++#if HAVE_INTTYPES_H_WITH_UINTMAX ++#include ++#endif ++], [intmax_t x = -1; return !x;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)]) ++ if test $gt_cv_c_intmax_t = yes; then ++ AC_DEFINE(HAVE_INTMAX_T, 1, ++ [Define if you have the 'intmax_t' type in or .]) ++ else ++ AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) ++ test $ac_cv_type_long_long_int = yes \ ++ && ac_type='long long' \ ++ || ac_type='long' ++ AC_DEFINE_UNQUOTED(intmax_t, $ac_type, ++ [Define to long or long long if and don't define.]) ++ fi ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/inttypes_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/inttypes_h.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/inttypes_h.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/inttypes_h.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,26 @@ ++# inttypes_h.m4 serial 7 ++dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl From Paul Eggert. ++ ++# Define HAVE_INTTYPES_H_WITH_UINTMAX if exists, ++# doesn't clash with , and declares uintmax_t. ++ ++AC_DEFUN([gl_AC_HEADER_INTTYPES_H], ++[ ++ AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h, ++ [AC_TRY_COMPILE( ++ [#include ++#include ], ++ [uintmax_t i = (uintmax_t) -1; return !i;], ++ gl_cv_header_inttypes_h=yes, ++ gl_cv_header_inttypes_h=no)]) ++ if test $gl_cv_header_inttypes_h = yes; then ++ AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, ++ [Define if exists, doesn't clash with , ++ and declares uintmax_t. ]) ++ fi ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/longlong.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/longlong.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/longlong.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/longlong.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,106 @@ ++# longlong.m4 serial 13 ++dnl Copyright (C) 1999-2007 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl From Paul Eggert. ++ ++# Define HAVE_LONG_LONG_INT if 'long long int' works. ++# This fixes a bug in Autoconf 2.61, but can be removed once we ++# assume 2.62 everywhere. ++ ++# Note: If the type 'long long int' exists but is only 32 bits large ++# (as on some very old compilers), HAVE_LONG_LONG_INT will not be ++# defined. In this case you can treat 'long long int' like 'long int'. ++ ++AC_DEFUN([AC_TYPE_LONG_LONG_INT], ++[ ++ AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], ++ [AC_LINK_IFELSE( ++ [_AC_TYPE_LONG_LONG_SNIPPET], ++ [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. ++ dnl If cross compiling, assume the bug isn't important, since ++ dnl nobody cross compiles for this platform as far as we know. ++ AC_RUN_IFELSE( ++ [AC_LANG_PROGRAM( ++ [[@%:@include ++ @%:@ifndef LLONG_MAX ++ @%:@ define HALF \ ++ (1LL << (sizeof (long long int) * CHAR_BIT - 2)) ++ @%:@ define LLONG_MAX (HALF - 1 + HALF) ++ @%:@endif]], ++ [[long long int n = 1; ++ int i; ++ for (i = 0; ; i++) ++ { ++ long long int m = n << i; ++ if (m >> i != n) ++ return 1; ++ if (LLONG_MAX / 2 < m) ++ break; ++ } ++ return 0;]])], ++ [ac_cv_type_long_long_int=yes], ++ [ac_cv_type_long_long_int=no], ++ [ac_cv_type_long_long_int=yes])], ++ [ac_cv_type_long_long_int=no])]) ++ if test $ac_cv_type_long_long_int = yes; then ++ AC_DEFINE([HAVE_LONG_LONG_INT], 1, ++ [Define to 1 if the system has the type `long long int'.]) ++ fi ++]) ++ ++# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. ++# This fixes a bug in Autoconf 2.61, but can be removed once we ++# assume 2.62 everywhere. ++ ++# Note: If the type 'unsigned long long int' exists but is only 32 bits ++# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT ++# will not be defined. In this case you can treat 'unsigned long long int' ++# like 'unsigned long int'. ++ ++AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], ++[ ++ AC_CACHE_CHECK([for unsigned long long int], ++ [ac_cv_type_unsigned_long_long_int], ++ [AC_LINK_IFELSE( ++ [_AC_TYPE_LONG_LONG_SNIPPET], ++ [ac_cv_type_unsigned_long_long_int=yes], ++ [ac_cv_type_unsigned_long_long_int=no])]) ++ if test $ac_cv_type_unsigned_long_long_int = yes; then ++ AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1, ++ [Define to 1 if the system has the type `unsigned long long int'.]) ++ fi ++]) ++ ++# Expands to a C program that can be used to test for simultaneous support ++# of 'long long' and 'unsigned long long'. We don't want to say that ++# 'long long' is available if 'unsigned long long' is not, or vice versa, ++# because too many programs rely on the symmetry between signed and unsigned ++# integer types (excluding 'bool'). ++AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET], ++[ ++ AC_LANG_PROGRAM( ++ [[/* For now, do not test the preprocessor; as of 2007 there are too many ++ implementations with broken preprocessors. Perhaps this can ++ be revisited in 2012. In the meantime, code should not expect ++ #if to work with literals wider than 32 bits. */ ++ /* Test literals. */ ++ long long int ll = 9223372036854775807ll; ++ long long int nll = -9223372036854775807LL; ++ unsigned long long int ull = 18446744073709551615ULL; ++ /* Test constant expressions. */ ++ typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) ++ ? 1 : -1)]; ++ typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 ++ ? 1 : -1)]; ++ int i = 63;]], ++ [[/* Test availability of runtime routines for shift and division. */ ++ long long int llmax = 9223372036854775807ll; ++ unsigned long long int ullmax = 18446744073709551615ull; ++ return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) ++ | (llmax / ll) | (llmax % ll) ++ | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) ++ | (ullmax / ull) | (ullmax % ull));]]) ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/netinet_in_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/netinet_in_h.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/netinet_in_h.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/netinet_in_h.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,30 @@ ++# netinet_in_h.m4 serial 4 ++dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_HEADER_NETINET_IN], ++[ ++ AC_CACHE_CHECK([whether is self-contained], ++ [gl_cv_header_netinet_in_h_selfcontained], ++ [ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])], ++ [gl_cv_header_netinet_in_h_selfcontained=yes], ++ [gl_cv_header_netinet_in_h_selfcontained=no]) ++ ]) ++ if test $gl_cv_header_netinet_in_h_selfcontained = yes; then ++ NETINET_IN_H='' ++ else ++ NETINET_IN_H='netinet/in.h' ++ AC_CHECK_HEADERS([netinet/in.h]) ++ gl_CHECK_NEXT_HEADERS([netinet/in.h]) ++ if test $ac_cv_header_netinet_in_h = yes; then ++ HAVE_NETINET_IN_H=1 ++ else ++ HAVE_NETINET_IN_H=0 ++ fi ++ AC_SUBST([HAVE_NETINET_IN_H]) ++ fi ++ AC_SUBST([NETINET_IN_H]) ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/onceonly.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/onceonly.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/onceonly.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/onceonly.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,90 @@ ++# onceonly.m4 serial 6 ++dnl Copyright (C) 2002-2003, 2005-2006, 2008 Free Software Foundation, Inc. ++dnl This file is free software, distributed under the terms of the GNU ++dnl General Public License. As a special exception to the GNU General ++dnl Public License, this file may be distributed as part of a program ++dnl that contains a configuration script generated by Autoconf, under ++dnl the same distribution terms as the rest of that program. ++ ++dnl This file defines some "once only" variants of standard autoconf macros. ++dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS ++dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS ++dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS ++dnl AC_REQUIRE([AC_FUNC_STRCOLL]) like AC_FUNC_STRCOLL ++dnl The advantage is that the check for each of the headers/functions/decls ++dnl will be put only once into the 'configure' file. It keeps the size of ++dnl the 'configure' file down, and avoids redundant output when 'configure' ++dnl is run. ++dnl The drawback is that the checks cannot be conditionalized. If you write ++dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi ++dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to ++dnl empty, and the check will be inserted before the body of the AC_DEFUNed ++dnl function. ++ ++dnl The original code implemented AC_CHECK_HEADERS_ONCE and AC_CHECK_FUNCS_ONCE ++dnl in terms of AC_DEFUN and AC_REQUIRE. This implementation uses diversions to ++dnl named sections DEFAULTS and INIT_PREPARE in order to check all requested ++dnl headers at once, thus reducing the size of 'configure'. It is known to work ++dnl with autoconf 2.57..2.62 at least . The size reduction is ca. 9%. ++ ++dnl Autoconf version 2.59 plus gnulib is required; this file is not needed ++dnl with Autoconf 2.60 or greater. But note that autoconf's implementation of ++dnl AC_CHECK_DECLS_ONCE expects a comma-separated list of symbols as first ++dnl argument! ++AC_PREREQ([2.59]) ++ ++# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of ++# AC_CHECK_HEADERS(HEADER1 HEADER2 ...). ++AC_DEFUN([AC_CHECK_HEADERS_ONCE], [ ++ : ++ m4_foreach_w([gl_HEADER_NAME], [$1], [ ++ AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME, ++ [./-], [___])), [ ++ m4_divert_text([INIT_PREPARE], ++ [gl_header_list="$gl_header_list gl_HEADER_NAME"]) ++ gl_HEADERS_EXPANSION ++ AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])), ++ [Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.]) ++ ]) ++ AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME, ++ [./-], [___]))) ++ ]) ++]) ++m4_define([gl_HEADERS_EXPANSION], [ ++ m4_divert_text([DEFAULTS], [gl_header_list=]) ++ AC_CHECK_HEADERS([$gl_header_list]) ++ m4_define([gl_HEADERS_EXPANSION], []) ++]) ++ ++# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of ++# AC_CHECK_FUNCS(FUNC1 FUNC2 ...). ++AC_DEFUN([AC_CHECK_FUNCS_ONCE], [ ++ : ++ m4_foreach_w([gl_FUNC_NAME], [$1], [ ++ AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [ ++ m4_divert_text([INIT_PREPARE], ++ [gl_func_list="$gl_func_list gl_FUNC_NAME"]) ++ gl_FUNCS_EXPANSION ++ AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])), ++ [Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.]) ++ ]) ++ AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME])) ++ ]) ++]) ++m4_define([gl_FUNCS_EXPANSION], [ ++ m4_divert_text([DEFAULTS], [gl_func_list=]) ++ AC_CHECK_FUNCS([$gl_func_list]) ++ m4_define([gl_FUNCS_EXPANSION], []) ++]) ++ ++# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of ++# AC_CHECK_DECLS(DECL1, DECL2, ...). ++AC_DEFUN([AC_CHECK_DECLS_ONCE], [ ++ : ++ m4_foreach_w([gl_DECL_NAME], [$1], [ ++ AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [ ++ AC_CHECK_DECLS(m4_defn([gl_DECL_NAME])) ++ ]) ++ AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME])) ++ ]) ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/printf.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/printf.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/printf.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/printf.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,1309 @@ ++# printf.m4 serial 23 ++dnl Copyright (C) 2003, 2007-2008 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl Test whether the *printf family of functions supports the 'j', 'z', 't', ++dnl 'L' size specifiers. (ISO C99, POSIX:2001) ++dnl Result is gl_cv_func_printf_sizes_c99. ++ ++AC_DEFUN([gl_PRINTF_SIZES_C99], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([gl_AC_HEADER_STDINT_H]) ++ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports size specifiers as in C99], ++ [gl_cv_func_printf_sizes_c99], ++ [ ++ AC_TRY_RUN([ ++#include ++#include ++#include ++#include ++#if HAVE_STDINT_H_WITH_UINTMAX ++# include ++#endif ++#if HAVE_INTTYPES_H_WITH_UINTMAX ++# include ++#endif ++static char buf[100]; ++int main () ++{ ++#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX ++ buf[0] = '\0'; ++ if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0 ++ || strcmp (buf, "12345671 33") != 0) ++ return 1; ++#endif ++ buf[0] = '\0'; ++ if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0 ++ || strcmp (buf, "12345672 33") != 0) ++ return 1; ++ buf[0] = '\0'; ++ if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0 ++ || strcmp (buf, "12345673 33") != 0) ++ return 1; ++ buf[0] = '\0'; ++ if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0 ++ || strcmp (buf, "1.5 33") != 0) ++ return 1; ++ return 0; ++}], [gl_cv_func_printf_sizes_c99=yes], [gl_cv_func_printf_sizes_c99=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; ++ # Guess yes on FreeBSD >= 5. ++ freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";; ++ freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; ++ # Guess yes on MacOS X >= 10.3. ++ darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; ++ darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; ++ # Guess yes on OpenBSD >= 3.9. ++ openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) ++ gl_cv_func_printf_sizes_c99="guessing no";; ++ openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; ++ # Guess yes on Solaris >= 2.10. ++ solaris2.[0-9]*) gl_cv_func_printf_sizes_c99="guessing no";; ++ solaris*) gl_cv_func_printf_sizes_c99="guessing yes";; ++ # Guess yes on NetBSD >= 3. ++ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) ++ gl_cv_func_printf_sizes_c99="guessing no";; ++ netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_printf_sizes_c99="guessing no";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports 'long double' ++dnl arguments together with the 'L' size specifier. (ISO C99, POSIX:2001) ++dnl Result is gl_cv_func_printf_long_double. ++ ++AC_DEFUN([gl_PRINTF_LONG_DOUBLE], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports 'long double' arguments], ++ [gl_cv_func_printf_long_double], ++ [ ++ AC_TRY_RUN([ ++#include ++#include ++static char buf[10000]; ++int main () ++{ ++ buf[0] = '\0'; ++ if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0 ++ || strcmp (buf, "1.750000 33") != 0) ++ return 1; ++ buf[0] = '\0'; ++ if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0 ++ || strcmp (buf, "1.750000e+00 33") != 0) ++ return 1; ++ buf[0] = '\0'; ++ if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0 ++ || strcmp (buf, "1.75 33") != 0) ++ return 1; ++ return 0; ++}], [gl_cv_func_printf_long_double=yes], [gl_cv_func_printf_long_double=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ beos*) gl_cv_func_printf_long_double="guessing no";; ++ mingw* | pw*) gl_cv_func_printf_long_double="guessing no";; ++ *) gl_cv_func_printf_long_double="guessing yes";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports infinite and NaN ++dnl 'double' arguments in the %f, %e, %g directives. (ISO C99, POSIX:2001) ++dnl Result is gl_cv_func_printf_infinite. ++ ++AC_DEFUN([gl_PRINTF_INFINITE], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports infinite 'double' arguments], ++ [gl_cv_func_printf_infinite], ++ [ ++ AC_TRY_RUN([ ++#include ++#include ++static int ++strisnan (const char *string, size_t start_index, size_t end_index) ++{ ++ if (start_index < end_index) ++ { ++ if (string[start_index] == '-') ++ start_index++; ++ if (start_index + 3 <= end_index ++ && memcmp (string + start_index, "nan", 3) == 0) ++ { ++ start_index += 3; ++ if (start_index == end_index ++ || (string[start_index] == '(' && string[end_index - 1] == ')')) ++ return 1; ++ } ++ } ++ return 0; ++} ++static char buf[10000]; ++static double zero = 0.0; ++int main () ++{ ++ if (sprintf (buf, "%f", 1.0 / 0.0) < 0 ++ || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) ++ return 1; ++ if (sprintf (buf, "%f", -1.0 / 0.0) < 0 ++ || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) ++ return 1; ++ if (sprintf (buf, "%f", zero / zero) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ if (sprintf (buf, "%e", 1.0 / 0.0) < 0 ++ || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) ++ return 1; ++ if (sprintf (buf, "%e", -1.0 / 0.0) < 0 ++ || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) ++ return 1; ++ if (sprintf (buf, "%e", zero / zero) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ if (sprintf (buf, "%g", 1.0 / 0.0) < 0 ++ || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) ++ return 1; ++ if (sprintf (buf, "%g", -1.0 / 0.0) < 0 ++ || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) ++ return 1; ++ if (sprintf (buf, "%g", zero / zero) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ return 0; ++}], [gl_cv_func_printf_infinite=yes], [gl_cv_func_printf_infinite=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_printf_infinite="guessing yes";; ++ # Guess yes on FreeBSD >= 6. ++ freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";; ++ freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; ++ # Guess yes on MacOS X >= 10.3. ++ darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; ++ darwin*) gl_cv_func_printf_infinite="guessing yes";; ++ # Guess yes on HP-UX >= 11. ++ hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";; ++ hpux*) gl_cv_func_printf_infinite="guessing yes";; ++ # Guess yes on NetBSD >= 3. ++ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) ++ gl_cv_func_printf_infinite="guessing no";; ++ netbsd*) gl_cv_func_printf_infinite="guessing yes";; ++ # Guess yes on BeOS. ++ beos*) gl_cv_func_printf_infinite="guessing yes";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_printf_infinite="guessing no";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports infinite and NaN ++dnl 'long double' arguments in the %f, %e, %g directives. (ISO C99, POSIX:2001) ++dnl Result is gl_cv_func_printf_infinite_long_double. ++ ++AC_DEFUN([gl_PRINTF_INFINITE_LONG_DOUBLE], ++[ ++ AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_C_BIGENDIAN]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ dnl The user can set or unset the variable gl_printf_safe to indicate ++ dnl that he wishes a safe handling of non-IEEE-754 'long double' values. ++ if test -n "$gl_printf_safe"; then ++ AC_DEFINE([CHECK_PRINTF_SAFE], 1, ++ [Define if you wish *printf() functions that have a safe handling of ++ non-IEEE-754 'long double' values.]) ++ fi ++ case "$gl_cv_func_printf_long_double" in ++ *yes) ++ AC_CACHE_CHECK([whether printf supports infinite 'long double' arguments], ++ [gl_cv_func_printf_infinite_long_double], ++ [ ++ AC_TRY_RUN([ ++]GL_NOCRASH[ ++#include ++#include ++#include ++static int ++strisnan (const char *string, size_t start_index, size_t end_index) ++{ ++ if (start_index < end_index) ++ { ++ if (string[start_index] == '-') ++ start_index++; ++ if (start_index + 3 <= end_index ++ && memcmp (string + start_index, "nan", 3) == 0) ++ { ++ start_index += 3; ++ if (start_index == end_index ++ || (string[start_index] == '(' && string[end_index - 1] == ')')) ++ return 1; ++ } ++ } ++ return 0; ++} ++static char buf[10000]; ++static long double zeroL = 0.0L; ++int main () ++{ ++ nocrash_init(); ++ if (sprintf (buf, "%Lf", 1.0L / 0.0L) < 0 ++ || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) ++ return 1; ++ if (sprintf (buf, "%Lf", -1.0L / 0.0L) < 0 ++ || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) ++ return 1; ++ if (sprintf (buf, "%Lf", zeroL / zeroL) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ if (sprintf (buf, "%Le", 1.0L / 0.0L) < 0 ++ || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) ++ return 1; ++ if (sprintf (buf, "%Le", -1.0L / 0.0L) < 0 ++ || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) ++ return 1; ++ if (sprintf (buf, "%Le", zeroL / zeroL) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ if (sprintf (buf, "%Lg", 1.0L / 0.0L) < 0 ++ || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) ++ return 1; ++ if (sprintf (buf, "%Lg", -1.0L / 0.0L) < 0 ++ || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) ++ return 1; ++ if (sprintf (buf, "%Lg", zeroL / zeroL) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) ++/* Representation of an 80-bit 'long double' as an initializer for a sequence ++ of 'unsigned int' words. */ ++# ifdef WORDS_BIGENDIAN ++# define LDBL80_WORDS(exponent,manthi,mantlo) \ ++ { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ ++ ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16), \ ++ (unsigned int) (mantlo) << 16 \ ++ } ++# else ++# define LDBL80_WORDS(exponent,manthi,mantlo) \ ++ { mantlo, manthi, exponent } ++# endif ++ { /* Quiet NaN. */ ++ static union { unsigned int word[4]; long double value; } x = ++ { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; ++ if (sprintf (buf, "%Lf", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ if (sprintf (buf, "%Le", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ if (sprintf (buf, "%Lg", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ } ++ { ++ /* Signalling NaN. */ ++ static union { unsigned int word[4]; long double value; } x = ++ { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; ++ if (sprintf (buf, "%Lf", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ if (sprintf (buf, "%Le", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ if (sprintf (buf, "%Lg", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ } ++ { /* Pseudo-NaN. */ ++ static union { unsigned int word[4]; long double value; } x = ++ { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; ++ if (sprintf (buf, "%Lf", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ if (sprintf (buf, "%Le", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ if (sprintf (buf, "%Lg", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ } ++ { /* Pseudo-Infinity. */ ++ static union { unsigned int word[4]; long double value; } x = ++ { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; ++ if (sprintf (buf, "%Lf", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ if (sprintf (buf, "%Le", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ if (sprintf (buf, "%Lg", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ } ++ { /* Pseudo-Zero. */ ++ static union { unsigned int word[4]; long double value; } x = ++ { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; ++ if (sprintf (buf, "%Lf", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ if (sprintf (buf, "%Le", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ if (sprintf (buf, "%Lg", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ } ++ { /* Unnormalized number. */ ++ static union { unsigned int word[4]; long double value; } x = ++ { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; ++ if (sprintf (buf, "%Lf", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ if (sprintf (buf, "%Le", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ if (sprintf (buf, "%Lg", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ } ++ { /* Pseudo-Denormal. */ ++ static union { unsigned int word[4]; long double value; } x = ++ { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; ++ if (sprintf (buf, "%Lf", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ if (sprintf (buf, "%Le", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ if (sprintf (buf, "%Lg", x.value) < 0 ++ || !strisnan (buf, 0, strlen (buf))) ++ return 1; ++ } ++#endif ++ return 0; ++}], ++ [gl_cv_func_printf_infinite_long_double=yes], ++ [gl_cv_func_printf_infinite_long_double=no], ++ [ ++changequote(,)dnl ++ case "$host_cpu" in ++ # Guess no on ia64, x86_64, i386. ++ ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";; ++ *) ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; ++ # Guess yes on FreeBSD >= 6. ++ freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";; ++ freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; ++ # Guess yes on MacOS X >= 10.3. ++ darwin[1-6].*) gl_cv_func_printf_infinite_long_double="guessing no";; ++ darwin*) gl_cv_func_printf_infinite_long_double="guessing yes";; ++ # Guess yes on HP-UX >= 11. ++ hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; ++ hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; ++ # Guess yes on NetBSD >= 3. ++ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) ++ gl_cv_func_printf_infinite_long_double="guessing no";; ++ netbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_printf_infinite_long_double="guessing no";; ++ esac ++ ;; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++ ;; ++ *) ++ gl_cv_func_printf_infinite_long_double="irrelevant" ++ ;; ++ esac ++]) ++ ++dnl Test whether the *printf family of functions supports the 'a' and 'A' ++dnl conversion specifier for hexadecimal output of floating-point numbers. ++dnl (ISO C99, POSIX:2001) ++dnl Result is gl_cv_func_printf_directive_a. ++ ++AC_DEFUN([gl_PRINTF_DIRECTIVE_A], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports the 'a' and 'A' directives], ++ [gl_cv_func_printf_directive_a], ++ [ ++ AC_TRY_RUN([ ++#include ++#include ++static char buf[100]; ++int main () ++{ ++ if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 ++ || (strcmp (buf, "0x1.922p+1 33") != 0 ++ && strcmp (buf, "0x3.244p+0 33") != 0 ++ && strcmp (buf, "0x6.488p-1 33") != 0 ++ && strcmp (buf, "0xc.91p-2 33") != 0)) ++ return 1; ++ if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0 ++ || (strcmp (buf, "-0X1.922P+1 33") != 0 ++ && strcmp (buf, "-0X3.244P+0 33") != 0 ++ && strcmp (buf, "-0X6.488P-1 33") != 0 ++ && strcmp (buf, "-0XC.91P-2 33") != 0)) ++ return 1; ++ /* This catches a FreeBSD 6.1 bug: it doesn't round. */ ++ if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 ++ || (strcmp (buf, "0x1.83p+0 33") != 0 ++ && strcmp (buf, "0x3.05p-1 33") != 0 ++ && strcmp (buf, "0x6.0ap-2 33") != 0 ++ && strcmp (buf, "0xc.14p-3 33") != 0)) ++ return 1; ++ /* This catches a FreeBSD 6.1 bug. See ++ */ ++ if (sprintf (buf, "%010a %d", 1.0 / 0.0, 33, 44, 55) < 0 ++ || buf[0] == '0') ++ return 1; ++ /* This catches a MacOS X 10.3.9 (Darwin 7.9) bug. */ ++ if (sprintf (buf, "%.1a", 1.999) < 0 ++ || (strcmp (buf, "0x1.0p+1") != 0 ++ && strcmp (buf, "0x2.0p+0") != 0 ++ && strcmp (buf, "0x4.0p-1") != 0 ++ && strcmp (buf, "0x8.0p-2") != 0)) ++ return 1; ++ /* This catches the same MacOS X 10.3.9 (Darwin 7.9) bug and also a ++ glibc 2.4 bug . */ ++ if (sprintf (buf, "%.1La", 1.999L) < 0 ++ || (strcmp (buf, "0x1.0p+1") != 0 ++ && strcmp (buf, "0x2.0p+0") != 0 ++ && strcmp (buf, "0x4.0p-1") != 0 ++ && strcmp (buf, "0x8.0p-2") != 0)) ++ return 1; ++ return 0; ++}], [gl_cv_func_printf_directive_a=yes], [gl_cv_func_printf_directive_a=no], ++ [ ++ case "$host_os" in ++ # Guess yes on glibc >= 2.5 systems. ++ *-gnu*) ++ AC_EGREP_CPP([BZ2908], [ ++ #include ++ #ifdef __GNU_LIBRARY__ ++ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2) ++ BZ2908 ++ #endif ++ #endif ++ ], ++ [gl_cv_func_printf_directive_a="guessing yes"], ++ [gl_cv_func_printf_directive_a="guessing no"]) ++ ;; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_printf_directive_a="guessing no";; ++ esac ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports the %F format ++dnl directive. (ISO C99, POSIX:2001) ++dnl Result is gl_cv_func_printf_directive_f. ++ ++AC_DEFUN([gl_PRINTF_DIRECTIVE_F], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports the 'F' directive], ++ [gl_cv_func_printf_directive_f], ++ [ ++ AC_TRY_RUN([ ++#include ++#include ++static char buf[100]; ++int main () ++{ ++ if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0 ++ || strcmp (buf, "1234567.000000 33") != 0) ++ return 1; ++ if (sprintf (buf, "%F", 1.0 / 0.0) < 0 ++ || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) ++ return 1; ++ /* This catches a Cygwin 2007 bug. */ ++ if (sprintf (buf, "%.F", 1234.0) < 0 ++ || strcmp (buf, "1234") != 0) ++ return 1; ++ return 0; ++}], [gl_cv_func_printf_directive_f=yes], [gl_cv_func_printf_directive_f=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_printf_directive_f="guessing yes";; ++ # Guess yes on FreeBSD >= 6. ++ freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";; ++ freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; ++ # Guess yes on MacOS X >= 10.3. ++ darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; ++ darwin*) gl_cv_func_printf_directive_f="guessing yes";; ++ # Guess yes on Solaris >= 2.10. ++ solaris2.[0-9]*) gl_cv_func_printf_directive_f="guessing no";; ++ solaris*) gl_cv_func_printf_directive_f="guessing yes";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_printf_directive_f="guessing no";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports the %n format ++dnl directive. (ISO C99, POSIX:2001) ++dnl Result is gl_cv_func_printf_directive_n. ++ ++AC_DEFUN([gl_PRINTF_DIRECTIVE_N], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports the 'n' directive], ++ [gl_cv_func_printf_directive_n], ++ [ ++ AC_TRY_RUN([ ++#include ++#include ++static char fmtstring[10]; ++static char buf[100]; ++int main () ++{ ++ int count = -1; ++ /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) ++ support %n in format strings in read-only memory but not in writable ++ memory. */ ++ strcpy (fmtstring, "%d %n"); ++ if (sprintf (buf, fmtstring, 123, &count, 33, 44, 55) < 0 ++ || strcmp (buf, "123 ") != 0 ++ || count != 4) ++ return 1; ++ return 0; ++}], [gl_cv_func_printf_directive_n=yes], [gl_cv_func_printf_directive_n=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ *) gl_cv_func_printf_directive_n="guessing yes";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports POSIX/XSI format ++dnl strings with positions. (POSIX:2001) ++dnl Result is gl_cv_func_printf_positions. ++ ++AC_DEFUN([gl_PRINTF_POSITIONS], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports POSIX/XSI format strings with positions], ++ [gl_cv_func_printf_positions], ++ [ ++ AC_TRY_RUN([ ++#include ++#include ++/* The string "%2$d %1$d", with dollar characters protected from the shell's ++ dollar expansion (possibly an autoconf bug). */ ++static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; ++static char buf[100]; ++int main () ++{ ++ sprintf (buf, format, 33, 55); ++ return (strcmp (buf, "55 33") != 0); ++}], [gl_cv_func_printf_positions=yes], [gl_cv_func_printf_positions=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) ++ gl_cv_func_printf_positions="guessing no";; ++ beos*) gl_cv_func_printf_positions="guessing no";; ++ mingw* | pw*) gl_cv_func_printf_positions="guessing no";; ++ *) gl_cv_func_printf_positions="guessing yes";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports POSIX/XSI format ++dnl strings with the ' flag for grouping of decimal digits. (POSIX:2001) ++dnl Result is gl_cv_func_printf_flag_grouping. ++ ++AC_DEFUN([gl_PRINTF_FLAG_GROUPING], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports the grouping flag], ++ [gl_cv_func_printf_flag_grouping], ++ [ ++ AC_TRY_RUN([ ++#include ++#include ++static char buf[100]; ++int main () ++{ ++ if (sprintf (buf, "%'d %d", 1234567, 99) < 0 ++ || buf[strlen (buf) - 1] != '9') ++ return 1; ++ return 0; ++}], [gl_cv_func_printf_flag_grouping=yes], [gl_cv_func_printf_flag_grouping=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; ++ netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; ++ mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; ++ *) gl_cv_func_printf_flag_grouping="guessing yes";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports the - flag correctly. ++dnl (ISO C99.) See ++dnl ++dnl Result is gl_cv_func_printf_flag_leftadjust. ++ ++AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports the left-adjust flag correctly], ++ [gl_cv_func_printf_flag_leftadjust], ++ [ ++ AC_TRY_RUN([ ++#include ++#include ++static char buf[100]; ++int main () ++{ ++ /* Check that a '-' flag is not annihilated by a negative width. */ ++ if (sprintf (buf, "a%-*sc", -3, "b") < 0 ++ || strcmp (buf, "ab c") != 0) ++ return 1; ++ return 0; ++}], ++ [gl_cv_func_printf_flag_leftadjust=yes], ++ [gl_cv_func_printf_flag_leftadjust=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on HP-UX 11. ++ hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; ++ # Guess no on HP-UX 10 and older. ++ hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; ++ # Guess yes otherwise. ++ *) gl_cv_func_printf_flag_leftadjust="guessing yes";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports padding of non-finite ++dnl values with the 0 flag correctly. (ISO C99 + TC1 + TC2.) See ++dnl ++dnl Result is gl_cv_func_printf_flag_zero. ++ ++AC_DEFUN([gl_PRINTF_FLAG_ZERO], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports the zero flag correctly], ++ [gl_cv_func_printf_flag_zero], ++ [ ++ AC_TRY_RUN([ ++#include ++#include ++static char buf[100]; ++int main () ++{ ++ if (sprintf (buf, "%010f", 1.0 / 0.0, 33, 44, 55) < 0 ++ || (strcmp (buf, " inf") != 0 ++ && strcmp (buf, " infinity") != 0)) ++ return 1; ++ return 0; ++}], [gl_cv_func_printf_flag_zero=yes], [gl_cv_func_printf_flag_zero=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";; ++ # Guess yes on BeOS. ++ beos*) gl_cv_func_printf_flag_zero="guessing yes";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_printf_flag_zero="guessing no";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions supports large precisions. ++dnl On mingw, precisions larger than 512 are treated like 512, in integer, ++dnl floating-point or pointer output. On BeOS, precisions larger than 1044 ++dnl crash the program. ++dnl Result is gl_cv_func_printf_precision. ++ ++AC_DEFUN([gl_PRINTF_PRECISION], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf supports large precisions], ++ [gl_cv_func_printf_precision], ++ [ ++ AC_TRY_RUN([ ++#include ++#include ++static char buf[5000]; ++int main () ++{ ++#ifdef __BEOS__ ++ /* On BeOS, this would crash and show a dialog box. Avoid the crash. */ ++ return 1; ++#endif ++ if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3) ++ return 1; ++ return 0; ++}], [gl_cv_func_printf_precision=yes], [gl_cv_func_printf_precision=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess no only on native Win32 and BeOS systems. ++ mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; ++ beos*) gl_cv_func_printf_precision="guessing no" ;; ++ *) gl_cv_func_printf_precision="guessing yes" ;; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the *printf family of functions recovers gracefully in case ++dnl of an out-of-memory condition, or whether it crashes the entire program. ++dnl Result is gl_cv_func_printf_enomem. ++ ++AC_DEFUN([gl_PRINTF_ENOMEM], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether printf survives out-of-memory conditions], ++ [gl_cv_func_printf_enomem], ++ [ ++ if test "$cross_compiling" = no; then ++ AC_LANG_CONFTEST([AC_LANG_SOURCE([ ++]GL_NOCRASH[ ++changequote(,)dnl ++#include ++#include ++#include ++#include ++#include ++int main() ++{ ++ struct rlimit limit; ++ int ret; ++ nocrash_init (); ++ /* Some printf implementations allocate temporary space with malloc. */ ++ /* On BSD systems, malloc() is limited by RLIMIT_DATA. */ ++#ifdef RLIMIT_DATA ++ if (getrlimit (RLIMIT_DATA, &limit) < 0) ++ return 77; ++ if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) ++ limit.rlim_max = 5000000; ++ limit.rlim_cur = limit.rlim_max; ++ if (setrlimit (RLIMIT_DATA, &limit) < 0) ++ return 77; ++#endif ++ /* On Linux systems, malloc() is limited by RLIMIT_AS. */ ++#ifdef RLIMIT_AS ++ if (getrlimit (RLIMIT_AS, &limit) < 0) ++ return 77; ++ if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) ++ limit.rlim_max = 5000000; ++ limit.rlim_cur = limit.rlim_max; ++ if (setrlimit (RLIMIT_AS, &limit) < 0) ++ return 77; ++#endif ++ /* Some printf implementations allocate temporary space on the stack. */ ++#ifdef RLIMIT_STACK ++ if (getrlimit (RLIMIT_STACK, &limit) < 0) ++ return 77; ++ if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) ++ limit.rlim_max = 5000000; ++ limit.rlim_cur = limit.rlim_max; ++ if (setrlimit (RLIMIT_STACK, &limit) < 0) ++ return 77; ++#endif ++ ret = printf ("%.5000000f", 1.0); ++ return !(ret == 5000002 || (ret < 0 && errno == ENOMEM)); ++} ++changequote([,])dnl ++ ])]) ++ if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then ++ (./conftest ++ result=$? ++ if test $result != 0 && test $result != 77; then result=1; fi ++ exit $result ++ ) >/dev/null 2>/dev/null ++ case $? in ++ 0) gl_cv_func_printf_enomem="yes" ;; ++ 77) gl_cv_func_printf_enomem="guessing no" ;; ++ *) gl_cv_func_printf_enomem="no" ;; ++ esac ++ else ++ gl_cv_func_printf_enomem="guessing no" ++ fi ++ rm -fr conftest* ++ else ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_printf_enomem="guessing yes";; ++ # Guess yes on Solaris. ++ solaris*) gl_cv_func_printf_enomem="guessing yes";; ++ # Guess yes on AIX. ++ aix*) gl_cv_func_printf_enomem="guessing yes";; ++ # Guess yes on HP-UX/hppa. ++ hpux*) case "$host_cpu" in ++ hppa*) gl_cv_func_printf_enomem="guessing yes";; ++ *) gl_cv_func_printf_enomem="guessing no";; ++ esac ++ ;; ++ # Guess yes on IRIX. ++ irix*) gl_cv_func_printf_enomem="guessing yes";; ++ # Guess yes on OSF/1. ++ osf*) gl_cv_func_printf_enomem="guessing yes";; ++ # Guess yes on BeOS. ++ beos*) gl_cv_func_printf_enomem="guessing yes";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_printf_enomem="guessing no";; ++ esac ++changequote([,])dnl ++ fi ++ ]) ++]) ++ ++dnl Test whether the snprintf function exists. (ISO C99, POSIX:2001) ++dnl Result is ac_cv_func_snprintf. ++ ++AC_DEFUN([gl_SNPRINTF_PRESENCE], ++[ ++ AC_CHECK_FUNCS_ONCE([snprintf]) ++]) ++ ++dnl Test whether the string produced by the snprintf function is always NUL ++dnl terminated. (ISO C99, POSIX:2001) ++dnl Result is gl_cv_func_snprintf_truncation_c99. ++ ++AC_DEFUN([gl_SNPRINTF_TRUNCATION_C99], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether snprintf truncates the result as in C99], ++ [gl_cv_func_snprintf_truncation_c99], ++ [ ++ AC_TRY_RUN([ ++#include ++#include ++static char buf[100]; ++int main () ++{ ++ strcpy (buf, "ABCDEF"); ++ snprintf (buf, 3, "%d %d", 4567, 89); ++ if (memcmp (buf, "45\0DEF", 6) != 0) ++ return 1; ++ return 0; ++}], [gl_cv_func_snprintf_truncation_c99=yes], [gl_cv_func_snprintf_truncation_c99=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on FreeBSD >= 5. ++ freebsd[1-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; ++ freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on MacOS X >= 10.3. ++ darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; ++ darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on OpenBSD >= 3.9. ++ openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) ++ gl_cv_func_snprintf_truncation_c99="guessing no";; ++ openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on Solaris >= 2.6. ++ solaris2.[0-5]*) gl_cv_func_snprintf_truncation_c99="guessing no";; ++ solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on AIX >= 4. ++ aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";; ++ aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on HP-UX >= 11. ++ hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";; ++ hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on IRIX >= 6.5. ++ irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on OSF/1 >= 5. ++ osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; ++ osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on NetBSD >= 3. ++ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) ++ gl_cv_func_snprintf_truncation_c99="guessing no";; ++ netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # Guess yes on BeOS. ++ beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_snprintf_truncation_c99="guessing no";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the return value of the snprintf function is the number ++dnl of bytes (excluding the terminating NUL) that would have been produced ++dnl if the buffer had been large enough. (ISO C99, POSIX:2001) ++dnl For example, this test program fails on IRIX 6.5: ++dnl --------------------------------------------------------------------- ++dnl #include ++dnl int main() ++dnl { ++dnl static char buf[8]; ++dnl int retval = snprintf (buf, 3, "%d", 12345); ++dnl return retval >= 0 && retval < 3; ++dnl } ++dnl --------------------------------------------------------------------- ++dnl Result is gl_cv_func_snprintf_retval_c99. ++ ++AC_DEFUN([gl_SNPRINTF_RETVAL_C99], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether snprintf returns a byte count as in C99], ++ [gl_cv_func_snprintf_retval_c99], ++ [ ++ AC_TRY_RUN([ ++#include ++#include ++static char buf[100]; ++int main () ++{ ++ strcpy (buf, "ABCDEF"); ++ if (snprintf (buf, 3, "%d %d", 4567, 89) != 7) ++ return 1; ++ return 0; ++}], [gl_cv_func_snprintf_retval_c99=yes], [gl_cv_func_snprintf_retval_c99=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; ++ # Guess yes on FreeBSD >= 5. ++ freebsd[1-4]*) gl_cv_func_snprintf_retval_c99="guessing no";; ++ freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; ++ # Guess yes on MacOS X >= 10.3. ++ darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; ++ darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; ++ # Guess yes on OpenBSD >= 3.9. ++ openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) ++ gl_cv_func_snprintf_retval_c99="guessing no";; ++ openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; ++ # Guess yes on Solaris >= 2.6. ++ solaris2.[0-5]*) gl_cv_func_snprintf_retval_c99="guessing no";; ++ solaris*) gl_cv_func_snprintf_retval_c99="guessing yes";; ++ # Guess yes on AIX >= 4. ++ aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";; ++ aix*) gl_cv_func_snprintf_retval_c99="guessing yes";; ++ # Guess yes on NetBSD >= 3. ++ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) ++ gl_cv_func_snprintf_retval_c99="guessing no";; ++ netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; ++ # Guess yes on BeOS. ++ beos*) gl_cv_func_snprintf_retval_c99="guessing yes";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_snprintf_retval_c99="guessing no";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the snprintf function supports the %n format directive ++dnl also in truncated portions of the format string. (ISO C99, POSIX:2001) ++dnl Result is gl_cv_func_snprintf_directive_n. ++ ++AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether snprintf fully supports the 'n' directive], ++ [gl_cv_func_snprintf_directive_n], ++ [ ++ AC_TRY_RUN([ ++#include ++#include ++static char fmtstring[10]; ++static char buf[100]; ++int main () ++{ ++ int count = -1; ++ /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) ++ support %n in format strings in read-only memory but not in writable ++ memory. */ ++ strcpy (fmtstring, "%d %n"); ++ snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55); ++ if (count != 6) ++ return 1; ++ return 0; ++}], [gl_cv_func_snprintf_directive_n=yes], [gl_cv_func_snprintf_directive_n=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_snprintf_directive_n="guessing yes";; ++ # Guess yes on FreeBSD >= 5. ++ freebsd[1-4]*) gl_cv_func_snprintf_directive_n="guessing no";; ++ freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; ++ # Guess yes on MacOS X >= 10.3. ++ darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; ++ darwin*) gl_cv_func_snprintf_directive_n="guessing yes";; ++ # Guess yes on Solaris >= 2.6. ++ solaris2.[0-5]*) gl_cv_func_snprintf_directive_n="guessing no";; ++ solaris*) gl_cv_func_snprintf_directive_n="guessing yes";; ++ # Guess yes on AIX >= 4. ++ aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";; ++ aix*) gl_cv_func_snprintf_directive_n="guessing yes";; ++ # Guess yes on IRIX >= 6.5. ++ irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";; ++ # Guess yes on OSF/1 >= 5. ++ osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";; ++ osf*) gl_cv_func_snprintf_directive_n="guessing yes";; ++ # Guess yes on NetBSD >= 3. ++ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) ++ gl_cv_func_snprintf_directive_n="guessing no";; ++ netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; ++ # Guess yes on BeOS. ++ beos*) gl_cv_func_snprintf_directive_n="guessing yes";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_snprintf_directive_n="guessing no";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl Test whether the snprintf function, when passed a size = 1, writes any ++dnl output without bounds in this case, behaving like sprintf. This is the ++dnl case on Linux libc5. ++dnl Result is gl_cv_func_snprintf_size1. ++ ++AC_DEFUN([gl_SNPRINTF_SIZE1], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_CACHE_CHECK([whether snprintf respects a size of 1], ++ [gl_cv_func_snprintf_size1], ++ [ ++ AC_TRY_RUN([ ++#include ++int main() ++{ ++ static char buf[8] = "DEADBEEF"; ++ snprintf (buf, 1, "%d", 12345); ++ return buf[1] != 'E'; ++}], ++ [gl_cv_func_snprintf_size1=yes], ++ [gl_cv_func_snprintf_size1=no], ++ [gl_cv_func_snprintf_size1="guessing yes"]) ++ ]) ++]) ++ ++dnl Test whether the vsnprintf function, when passed a zero size, produces no ++dnl output. (ISO C99, POSIX:2001) ++dnl For example, snprintf nevertheless writes a NUL byte in this case ++dnl on OSF/1 5.1: ++dnl --------------------------------------------------------------------- ++dnl #include ++dnl int main() ++dnl { ++dnl static char buf[8] = "DEADBEEF"; ++dnl snprintf (buf, 0, "%d", 12345); ++dnl return buf[0] != 'D'; ++dnl } ++dnl --------------------------------------------------------------------- ++dnl And vsnprintf writes any output without bounds in this case, behaving like ++dnl vsprintf, on HP-UX 11 and OSF/1 5.1: ++dnl --------------------------------------------------------------------- ++dnl #include ++dnl #include ++dnl static int my_snprintf (char *buf, int size, const char *format, ...) ++dnl { ++dnl va_list args; ++dnl int ret; ++dnl va_start (args, format); ++dnl ret = vsnprintf (buf, size, format, args); ++dnl va_end (args); ++dnl return ret; ++dnl } ++dnl int main() ++dnl { ++dnl static char buf[8] = "DEADBEEF"; ++dnl my_snprintf (buf, 0, "%d", 12345); ++dnl return buf[0] != 'D'; ++dnl } ++dnl --------------------------------------------------------------------- ++dnl Result is gl_cv_func_vsnprintf_zerosize_c99. ++ ++AC_DEFUN([gl_VSNPRINTF_ZEROSIZE_C99], ++[ ++ AC_REQUIRE([AC_PROG_CC]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles ++ AC_CACHE_CHECK([whether vsnprintf respects a zero size as in C99], ++ [gl_cv_func_vsnprintf_zerosize_c99], ++ [ ++ AC_TRY_RUN([ ++#include ++#include ++static int my_snprintf (char *buf, int size, const char *format, ...) ++{ ++ va_list args; ++ int ret; ++ va_start (args, format); ++ ret = vsnprintf (buf, size, format, args); ++ va_end (args); ++ return ret; ++} ++int main() ++{ ++ static char buf[8] = "DEADBEEF"; ++ my_snprintf (buf, 0, "%d", 12345); ++ return buf[0] != 'D'; ++}], ++ [gl_cv_func_vsnprintf_zerosize_c99=yes], ++ [gl_cv_func_vsnprintf_zerosize_c99=no], ++ [ ++changequote(,)dnl ++ case "$host_os" in ++ # Guess yes on glibc systems. ++ *-gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # Guess yes on FreeBSD >= 5. ++ freebsd[1-4]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; ++ freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # Guess yes on MacOS X >= 10.3. ++ darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; ++ darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # Guess yes on Cygwin. ++ cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # Guess yes on Solaris >= 2.6. ++ solaris2.[0-5]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; ++ solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # Guess yes on AIX >= 4. ++ aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; ++ aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # Guess yes on IRIX >= 6.5. ++ irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # Guess yes on NetBSD >= 3. ++ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) ++ gl_cv_func_vsnprintf_zerosize_c99="guessing no";; ++ netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # Guess yes on BeOS. ++ beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # Guess yes on mingw. ++ mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; ++ # If we don't know, assume the worst. ++ *) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; ++ esac ++changequote([,])dnl ++ ]) ++ ]) ++]) ++ ++dnl The results of these tests on various platforms are: ++dnl ++dnl 1 = gl_PRINTF_SIZES_C99 ++dnl 2 = gl_PRINTF_LONG_DOUBLE ++dnl 3 = gl_PRINTF_INFINITE ++dnl 4 = gl_PRINTF_INFINITE_LONG_DOUBLE ++dnl 5 = gl_PRINTF_DIRECTIVE_A ++dnl 6 = gl_PRINTF_DIRECTIVE_F ++dnl 7 = gl_PRINTF_DIRECTIVE_N ++dnl 8 = gl_PRINTF_POSITIONS ++dnl 9 = gl_PRINTF_FLAG_GROUPING ++dnl 10 = gl_PRINTF_FLAG_LEFTADJUST ++dnl 11 = gl_PRINTF_FLAG_ZERO ++dnl 12 = gl_PRINTF_PRECISION ++dnl 13 = gl_PRINTF_ENOMEM ++dnl 14 = gl_SNPRINTF_PRESENCE ++dnl 15 = gl_SNPRINTF_TRUNCATION_C99 ++dnl 16 = gl_SNPRINTF_RETVAL_C99 ++dnl 17 = gl_SNPRINTF_DIRECTIVE_N ++dnl 18 = gl_SNPRINTF_SIZE1 ++dnl 19 = gl_VSNPRINTF_ZEROSIZE_C99 ++dnl ++dnl 1 = checking whether printf supports size specifiers as in C99... ++dnl 2 = checking whether printf supports 'long double' arguments... ++dnl 3 = checking whether printf supports infinite 'double' arguments... ++dnl 4 = checking whether printf supports infinite 'long double' arguments... ++dnl 5 = checking whether printf supports the 'a' and 'A' directives... ++dnl 6 = checking whether printf supports the 'F' directive... ++dnl 7 = checking whether printf supports the 'n' directive... ++dnl 8 = checking whether printf supports POSIX/XSI format strings with positions... ++dnl 9 = checking whether printf supports the grouping flag... ++dnl 10 = checking whether printf supports the left-adjust flag correctly... ++dnl 11 = checking whether printf supports the zero flag correctly... ++dnl 12 = checking whether printf supports large precisions... ++dnl 13 = checking whether printf survives out-of-memory conditions... ++dnl 14 = checking for snprintf... ++dnl 15 = checking whether snprintf truncates the result as in C99... ++dnl 16 = checking whether snprintf returns a byte count as in C99... ++dnl 17 = checking whether snprintf fully supports the 'n' directive... ++dnl 18 = checking whether snprintf respects a size of 1... ++dnl 19 = checking whether vsnprintf respects a zero size as in C99... ++dnl ++dnl . = yes, # = no. ++dnl ++dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ++dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . ++dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . ++dnl FreeBSD 5.4, 6.1 . . . . # . . . . . # . # . . . . . . ++dnl MacOS X 10.3.9 . . . . # . . . . . # . # . . . . . . ++dnl OpenBSD 3.9, 4.0 . . # # # # . . # . # . # . . . . . . ++dnl Cygwin 2007 (= Cygwin 1.5.24) . . . . # # . . . ? # ? ? . . . . . . ++dnl Cygwin 2006 (= Cygwin 1.5.19) # . . . # # . . # ? # ? ? . . . . . . ++dnl Solaris 10 . . # # # . . . . . # . . . . . . . . ++dnl Solaris 2.6 ... 9 # . # # # # . . . . # . . . . . . . . ++dnl Solaris 2.5.1 # . # # # # . . . . # . . # # # # # # ++dnl AIX 5.2 . . # # # . . . . . # . . . . . . . . ++dnl AIX 4.3.2, 5.1 # . # # # # . . . . # . . . . . . . . ++dnl HP-UX 11.31 . . . . # . . . . . # . . . . # # . . ++dnl HP-UX 11.{00,11,23} # . . . # # . . . . # . . . . # # . # ++dnl HP-UX 10.20 # . . . # # . . . # # . . . . # # ? # ++dnl IRIX 6.5 # . # # # # . . . . # . . . . # . . . ++dnl OSF/1 5.1 # . # # # # . . . . # . . . . # . . # ++dnl OSF/1 4.0d # . # # # # . . . . # . . # # # # # # ++dnl NetBSD 4.0 . ? ? ? ? ? . . ? ? ? ? ? . . . ? ? ? ++dnl NetBSD 3.0 . . . . # # . # # ? # . # . . . . . . ++dnl BeOS # # . # # # . # . ? . # ? . . . . . . ++dnl mingw # # # # # # . # # . # # ? . # # # . . +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/size_max.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/size_max.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/size_max.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/size_max.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,68 @@ ++# size_max.m4 serial 6 ++dnl Copyright (C) 2003, 2005-2006 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl From Bruno Haible. ++ ++AC_DEFUN([gl_SIZE_MAX], ++[ ++ AC_CHECK_HEADERS(stdint.h) ++ dnl First test whether the system already has SIZE_MAX. ++ AC_MSG_CHECKING([for SIZE_MAX]) ++ AC_CACHE_VAL([gl_cv_size_max], [ ++ gl_cv_size_max= ++ AC_EGREP_CPP([Found it], [ ++#include ++#if HAVE_STDINT_H ++#include ++#endif ++#ifdef SIZE_MAX ++Found it ++#endif ++], gl_cv_size_max=yes) ++ if test -z "$gl_cv_size_max"; then ++ dnl Define it ourselves. Here we assume that the type 'size_t' is not wider ++ dnl than the type 'unsigned long'. Try hard to find a definition that can ++ dnl be used in a preprocessor #if, i.e. doesn't contain a cast. ++ AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1], ++ [#include ++#include ], size_t_bits_minus_1=) ++ AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)], ++ [#include ], fits_in_uint=) ++ if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then ++ if test $fits_in_uint = 1; then ++ dnl Even though SIZE_MAX fits in an unsigned int, it must be of type ++ dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. ++ AC_TRY_COMPILE([#include ++ extern size_t foo; ++ extern unsigned long foo; ++ ], [], fits_in_uint=0) ++ fi ++ dnl We cannot use 'expr' to simplify this expression, because 'expr' ++ dnl works only with 'long' integers in the host environment, while we ++ dnl might be cross-compiling from a 32-bit platform to a 64-bit platform. ++ if test $fits_in_uint = 1; then ++ gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" ++ else ++ gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" ++ fi ++ else ++ dnl Shouldn't happen, but who knows... ++ gl_cv_size_max='((size_t)~(size_t)0)' ++ fi ++ fi ++ ]) ++ AC_MSG_RESULT([$gl_cv_size_max]) ++ if test "$gl_cv_size_max" != yes; then ++ AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max], ++ [Define as the maximum value of type 'size_t', if the system doesn't define it.]) ++ fi ++]) ++ ++dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. ++dnl Remove this when we can assume autoconf >= 2.61. ++m4_ifdef([AC_COMPUTE_INT], [], [ ++ AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/snprintf.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/snprintf.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/snprintf.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/snprintf.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,40 @@ ++# snprintf.m4 serial 5 ++dnl Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_FUNC_SNPRINTF], ++[ ++ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) ++ gl_cv_func_snprintf_usable=no ++ AC_CHECK_FUNCS([snprintf]) ++ if test $ac_cv_func_snprintf = yes; then ++ gl_SNPRINTF_SIZE1 ++ case "$gl_cv_func_snprintf_size1" in ++ *yes) ++ gl_cv_func_snprintf_usable=yes ++ ;; ++ esac ++ fi ++ if test $gl_cv_func_snprintf_usable = no; then ++ gl_REPLACE_SNPRINTF ++ fi ++ AC_CHECK_DECLS_ONCE([snprintf]) ++ if test $ac_cv_have_decl_snprintf = no; then ++ HAVE_DECL_SNPRINTF=0 ++ fi ++]) ++ ++AC_DEFUN([gl_REPLACE_SNPRINTF], ++[ ++ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) ++ AC_LIBOBJ([snprintf]) ++ if test $ac_cv_func_snprintf = yes; then ++ REPLACE_SNPRINTF=1 ++ fi ++ gl_PREREQ_SNPRINTF ++]) ++ ++# Prerequisites of lib/snprintf.c. ++AC_DEFUN([gl_PREREQ_SNPRINTF], [:]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/socklen.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/socklen.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/socklen.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/socklen.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,52 @@ ++# socklen.m4 serial 6 ++dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl From Albert Chin, Windows fixes from Simon Josefsson. ++ ++dnl Check for socklen_t: historically on BSD it is an int, and in ++dnl POSIX 1g it is a type of its own, but some platforms use different ++dnl types for the argument to getsockopt, getpeername, etc. So we ++dnl have to test to find something that will work. ++ ++dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find ++dnl it there first. That file is included by gnulib's sys_socket.in.h, which ++dnl all users of this module should include. Cygwin must not include ++dnl ws2tcpip.h. ++AC_DEFUN([gl_TYPE_SOCKLEN_T], ++ [AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl ++ AC_CHECK_TYPE([socklen_t], , ++ [AC_MSG_CHECKING([for socklen_t equivalent]) ++ AC_CACHE_VAL([gl_cv_socklen_t_equiv], ++ [# Systems have either "struct sockaddr *" or ++ # "void *" as the second argument to getpeername ++ gl_cv_socklen_t_equiv= ++ for arg2 in "struct sockaddr" void; do ++ for t in int size_t "unsigned int" "long int" "unsigned long int"; do ++ AC_TRY_COMPILE( ++ [#include ++ #include ++ ++ int getpeername (int, $arg2 *, $t *);], ++ [$t len; ++ getpeername (0, 0, &len);], ++ [gl_cv_socklen_t_equiv="$t"]) ++ test "$gl_cv_socklen_t_equiv" != "" && break ++ done ++ test "$gl_cv_socklen_t_equiv" != "" && break ++ done ++ ]) ++ if test "$gl_cv_socklen_t_equiv" = ""; then ++ AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) ++ fi ++ AC_MSG_RESULT([$gl_cv_socklen_t_equiv]) ++ AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv], ++ [type to use in place of socklen_t if not defined])], ++ [#include ++ #if HAVE_SYS_SOCKET_H ++ # include ++ #elif HAVE_WS2TCPIP_H ++ # include ++ #endif])]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/sockpfaf.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/sockpfaf.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/sockpfaf.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/sockpfaf.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,58 @@ ++# sockpfaf.m4 serial 5 ++dnl Copyright (C) 2004, 2006 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...) ++dnl and some common address families (AF_INET, AF_INET6, ...). ++dnl This test assumes that a system supports an address family if and only if ++dnl it supports the corresponding protocol family. ++ ++dnl From Bruno Haible. ++ ++AC_DEFUN([gl_SOCKET_FAMILIES], ++[ ++ AC_REQUIRE([gl_HEADER_SYS_SOCKET]) ++ AC_CHECK_HEADERS_ONCE([netinet/in.h]) ++ ++ AC_MSG_CHECKING(for IPv4 sockets) ++ AC_CACHE_VAL(gl_cv_socket_ipv4, ++ [AC_TRY_COMPILE([#include ++#ifdef HAVE_SYS_SOCKET_H ++#include ++#endif ++#ifdef HAVE_NETINET_IN_H ++#include ++#endif ++#ifdef HAVE_WINSOCK2_H ++#include ++#endif], ++[int x = AF_INET; struct in_addr y; struct sockaddr_in z; ++ if (&x && &y && &z) return 0;], ++ gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)]) ++ AC_MSG_RESULT($gl_cv_socket_ipv4) ++ if test $gl_cv_socket_ipv4 = yes; then ++ AC_DEFINE(HAVE_IPV4, 1, [Define to 1 if defines AF_INET.]) ++ fi ++ ++ AC_MSG_CHECKING(for IPv6 sockets) ++ AC_CACHE_VAL(gl_cv_socket_ipv6, ++ [AC_TRY_COMPILE([#include ++#ifdef HAVE_SYS_SOCKET_H ++#include ++#endif ++#ifdef HAVE_NETINET_IN_H ++#include ++#endif ++#ifdef HAVE_WINSOCK2_H ++#include ++#endif], ++[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z; ++ if (&x && &y && &z) return 0;], ++ gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)]) ++ AC_MSG_RESULT($gl_cv_socket_ipv6) ++ if test $gl_cv_socket_ipv6 = yes; then ++ AC_DEFINE(HAVE_IPV6, 1, [Define to 1 if defines AF_INET6.]) ++ fi ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/stdbool.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/stdbool.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/stdbool.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/stdbool.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,115 @@ ++# Check for stdbool.h that conforms to C99. ++ ++dnl Copyright (C) 2002-2006 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++# Prepare for substituting if it is not supported. ++ ++AC_DEFUN([AM_STDBOOL_H], ++[ ++ AC_REQUIRE([AC_HEADER_STDBOOL]) ++ ++ # Define two additional variables used in the Makefile substitution. ++ ++ if test "$ac_cv_header_stdbool_h" = yes; then ++ STDBOOL_H='' ++ else ++ STDBOOL_H='stdbool.h' ++ fi ++ AC_SUBST([STDBOOL_H]) ++ ++ if test "$ac_cv_type__Bool" = yes; then ++ HAVE__BOOL=1 ++ else ++ HAVE__BOOL=0 ++ fi ++ AC_SUBST([HAVE__BOOL]) ++]) ++ ++# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. ++AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) ++ ++# This macro is only needed in autoconf <= 2.59. Newer versions of autoconf ++# have this macro built-in. ++ ++AC_DEFUN([AC_HEADER_STDBOOL], ++ [AC_CACHE_CHECK([for stdbool.h that conforms to C99], ++ [ac_cv_header_stdbool_h], ++ [AC_TRY_COMPILE( ++ [ ++ #include ++ #ifndef bool ++ "error: bool is not defined" ++ #endif ++ #ifndef false ++ "error: false is not defined" ++ #endif ++ #if false ++ "error: false is not 0" ++ #endif ++ #ifndef true ++ "error: true is not defined" ++ #endif ++ #if true != 1 ++ "error: true is not 1" ++ #endif ++ #ifndef __bool_true_false_are_defined ++ "error: __bool_true_false_are_defined is not defined" ++ #endif ++ ++ struct s { _Bool s: 1; _Bool t; } s; ++ ++ char a[true == 1 ? 1 : -1]; ++ char b[false == 0 ? 1 : -1]; ++ char c[__bool_true_false_are_defined == 1 ? 1 : -1]; ++ char d[(bool) 0.5 == true ? 1 : -1]; ++ bool e = &s; ++ char f[(_Bool) 0.0 == false ? 1 : -1]; ++ char g[true]; ++ char h[sizeof (_Bool)]; ++ char i[sizeof s.t]; ++ enum { j = false, k = true, l = false * true, m = true * 256 }; ++ _Bool n[m]; ++ char o[sizeof n == m * sizeof n[0] ? 1 : -1]; ++ char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; ++ #if defined __xlc__ || defined __GNUC__ ++ /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 ++ reported by James Lemley on 2005-10-05; see ++ http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html ++ This test is not quite right, since xlc is allowed to ++ reject this program, as the initializer for xlcbug is ++ not one of the forms that C requires support for. ++ However, doing the test right would require a run-time ++ test, and that would make cross-compilation harder. ++ Let us hope that IBM fixes the xlc bug, and also adds ++ support for this kind of constant expression. In the ++ meantime, this test will reject xlc, which is OK, since ++ our stdbool.h substitute should suffice. We also test ++ this with GCC, where it should work, to detect more ++ quickly whether someone messes up the test in the ++ future. */ ++ char digs[] = "0123456789"; ++ int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); ++ #endif ++ /* Catch a bug in an HP-UX C compiler. See ++ http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html ++ http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html ++ */ ++ _Bool q = true; ++ _Bool *pq = &q; ++ ], ++ [ ++ *pq |= q; ++ *pq |= ! q; ++ /* Refer to every declared value, to avoid compiler optimizations. */ ++ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l ++ + !m + !n + !o + !p + !q + !pq); ++ ], ++ [ac_cv_header_stdbool_h=yes], ++ [ac_cv_header_stdbool_h=no])]) ++ AC_CHECK_TYPES([_Bool]) ++ if test $ac_cv_header_stdbool_h = yes; then ++ AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.]) ++ fi]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/stdint_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/stdint_h.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/stdint_h.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/stdint_h.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,26 @@ ++# stdint_h.m4 serial 6 ++dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl From Paul Eggert. ++ ++# Define HAVE_STDINT_H_WITH_UINTMAX if exists, ++# doesn't clash with , and declares uintmax_t. ++ ++AC_DEFUN([gl_AC_HEADER_STDINT_H], ++[ ++ AC_CACHE_CHECK([for stdint.h], gl_cv_header_stdint_h, ++ [AC_TRY_COMPILE( ++ [#include ++#include ], ++ [uintmax_t i = (uintmax_t) -1; return !i;], ++ gl_cv_header_stdint_h=yes, ++ gl_cv_header_stdint_h=no)]) ++ if test $gl_cv_header_stdint_h = yes; then ++ AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, ++ [Define if exists, doesn't clash with , ++ and declares uintmax_t. ]) ++ fi ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/stdint.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/stdint.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/stdint.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/stdint.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,395 @@ ++# stdint.m4 serial 31 ++dnl Copyright (C) 2001-2008 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl From Paul Eggert and Bruno Haible. ++dnl Test whether is supported or must be substituted. ++ ++AC_DEFUN([gl_STDINT_H], ++[ ++ AC_PREREQ(2.59)dnl ++ ++ dnl Check for long long int and unsigned long long int. ++ AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) ++ if test $ac_cv_type_long_long_int = yes; then ++ HAVE_LONG_LONG_INT=1 ++ else ++ HAVE_LONG_LONG_INT=0 ++ fi ++ AC_SUBST([HAVE_LONG_LONG_INT]) ++ AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) ++ if test $ac_cv_type_unsigned_long_long_int = yes; then ++ HAVE_UNSIGNED_LONG_LONG_INT=1 ++ else ++ HAVE_UNSIGNED_LONG_LONG_INT=0 ++ fi ++ AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT]) ++ ++ dnl Check for . ++ dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h. ++ if test $ac_cv_header_inttypes_h = yes; then ++ HAVE_INTTYPES_H=1 ++ else ++ HAVE_INTTYPES_H=0 ++ fi ++ AC_SUBST([HAVE_INTTYPES_H]) ++ ++ dnl Check for . ++ dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h. ++ if test $ac_cv_header_sys_types_h = yes; then ++ HAVE_SYS_TYPES_H=1 ++ else ++ HAVE_SYS_TYPES_H=0 ++ fi ++ AC_SUBST([HAVE_SYS_TYPES_H]) ++ ++ gl_CHECK_NEXT_HEADERS([stdint.h]) ++ if test $ac_cv_header_stdint_h = yes; then ++ HAVE_STDINT_H=1 ++ else ++ HAVE_STDINT_H=0 ++ fi ++ AC_SUBST([HAVE_STDINT_H]) ++ ++ dnl Now see whether we need a substitute . ++ if test $ac_cv_header_stdint_h = yes; then ++ AC_CACHE_CHECK([whether stdint.h conforms to C99], ++ [gl_cv_header_working_stdint_h], ++ [gl_cv_header_working_stdint_h=no ++ AC_COMPILE_IFELSE([ ++ AC_LANG_PROGRAM([[ ++#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ ++#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ ++#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ ++#include ++/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in . */ ++#if !(defined WCHAR_MIN && defined WCHAR_MAX) ++#error "WCHAR_MIN, WCHAR_MAX not defined in " ++#endif ++] ++gl_STDINT_INCLUDES ++[ ++#ifdef INT8_MAX ++int8_t a1 = INT8_MAX; ++int8_t a1min = INT8_MIN; ++#endif ++#ifdef INT16_MAX ++int16_t a2 = INT16_MAX; ++int16_t a2min = INT16_MIN; ++#endif ++#ifdef INT32_MAX ++int32_t a3 = INT32_MAX; ++int32_t a3min = INT32_MIN; ++#endif ++#ifdef INT64_MAX ++int64_t a4 = INT64_MAX; ++int64_t a4min = INT64_MIN; ++#endif ++#ifdef UINT8_MAX ++uint8_t b1 = UINT8_MAX; ++#else ++typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; ++#endif ++#ifdef UINT16_MAX ++uint16_t b2 = UINT16_MAX; ++#endif ++#ifdef UINT32_MAX ++uint32_t b3 = UINT32_MAX; ++#endif ++#ifdef UINT64_MAX ++uint64_t b4 = UINT64_MAX; ++#endif ++int_least8_t c1 = INT8_C (0x7f); ++int_least8_t c1max = INT_LEAST8_MAX; ++int_least8_t c1min = INT_LEAST8_MIN; ++int_least16_t c2 = INT16_C (0x7fff); ++int_least16_t c2max = INT_LEAST16_MAX; ++int_least16_t c2min = INT_LEAST16_MIN; ++int_least32_t c3 = INT32_C (0x7fffffff); ++int_least32_t c3max = INT_LEAST32_MAX; ++int_least32_t c3min = INT_LEAST32_MIN; ++int_least64_t c4 = INT64_C (0x7fffffffffffffff); ++int_least64_t c4max = INT_LEAST64_MAX; ++int_least64_t c4min = INT_LEAST64_MIN; ++uint_least8_t d1 = UINT8_C (0xff); ++uint_least8_t d1max = UINT_LEAST8_MAX; ++uint_least16_t d2 = UINT16_C (0xffff); ++uint_least16_t d2max = UINT_LEAST16_MAX; ++uint_least32_t d3 = UINT32_C (0xffffffff); ++uint_least32_t d3max = UINT_LEAST32_MAX; ++uint_least64_t d4 = UINT64_C (0xffffffffffffffff); ++uint_least64_t d4max = UINT_LEAST64_MAX; ++int_fast8_t e1 = INT_FAST8_MAX; ++int_fast8_t e1min = INT_FAST8_MIN; ++int_fast16_t e2 = INT_FAST16_MAX; ++int_fast16_t e2min = INT_FAST16_MIN; ++int_fast32_t e3 = INT_FAST32_MAX; ++int_fast32_t e3min = INT_FAST32_MIN; ++int_fast64_t e4 = INT_FAST64_MAX; ++int_fast64_t e4min = INT_FAST64_MIN; ++uint_fast8_t f1 = UINT_FAST8_MAX; ++uint_fast16_t f2 = UINT_FAST16_MAX; ++uint_fast32_t f3 = UINT_FAST32_MAX; ++uint_fast64_t f4 = UINT_FAST64_MAX; ++#ifdef INTPTR_MAX ++intptr_t g = INTPTR_MAX; ++intptr_t gmin = INTPTR_MIN; ++#endif ++#ifdef UINTPTR_MAX ++uintptr_t h = UINTPTR_MAX; ++#endif ++intmax_t i = INTMAX_MAX; ++uintmax_t j = UINTMAX_MAX; ++ ++#include /* for CHAR_BIT */ ++#define TYPE_MINIMUM(t) \ ++ ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) ++#define TYPE_MAXIMUM(t) \ ++ ((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) ++struct s { ++ int check_PTRDIFF: ++ PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) ++ && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) ++ ? 1 : -1; ++ /* Detect bug in FreeBSD 6.0 / ia64. */ ++ int check_SIG_ATOMIC: ++ SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) ++ && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) ++ ? 1 : -1; ++ int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; ++ int check_WCHAR: ++ WCHAR_MIN == TYPE_MINIMUM (wchar_t) ++ && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) ++ ? 1 : -1; ++ /* Detect bug in mingw. */ ++ int check_WINT: ++ WINT_MIN == TYPE_MINIMUM (wint_t) ++ && WINT_MAX == TYPE_MAXIMUM (wint_t) ++ ? 1 : -1; ++ ++ /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ ++ int check_UINT8_C: ++ (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; ++ int check_UINT16_C: ++ (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; ++ ++ /* Detect bugs in OpenBSD 3.9 stdint.h. */ ++#ifdef UINT8_MAX ++ int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; ++#endif ++#ifdef UINT16_MAX ++ int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; ++#endif ++#ifdef UINT32_MAX ++ int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; ++#endif ++#ifdef UINT64_MAX ++ int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; ++#endif ++ int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; ++ int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; ++ int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; ++ int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; ++ int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; ++ int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; ++ int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; ++ int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; ++ int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; ++ int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; ++ int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; ++}; ++ ]])], ++ [gl_cv_header_working_stdint_h=yes])]) ++ fi ++ if test "$gl_cv_header_working_stdint_h" = yes; then ++ STDINT_H= ++ else ++ dnl Check for , and for ++ dnl (used in Linux libc4 >= 4.6.7 and libc5). ++ AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h]) ++ if test $ac_cv_header_sys_inttypes_h = yes; then ++ HAVE_SYS_INTTYPES_H=1 ++ else ++ HAVE_SYS_INTTYPES_H=0 ++ fi ++ AC_SUBST([HAVE_SYS_INTTYPES_H]) ++ if test $ac_cv_header_sys_bitypes_h = yes; then ++ HAVE_SYS_BITYPES_H=1 ++ else ++ HAVE_SYS_BITYPES_H=0 ++ fi ++ AC_SUBST([HAVE_SYS_BITYPES_H]) ++ ++ dnl Check for (missing in Linux uClibc when built without wide ++ dnl character support). ++ AC_CHECK_HEADERS_ONCE([wchar.h]) ++ ++ gl_STDINT_TYPE_PROPERTIES ++ STDINT_H=stdint.h ++ fi ++ AC_SUBST(STDINT_H) ++]) ++ ++dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES) ++dnl Determine the size of each of the given types in bits. ++AC_DEFUN([gl_STDINT_BITSIZEOF], ++[ ++ dnl Use a shell loop, to avoid bloating configure, and ++ dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into ++ dnl config.h.in, ++ dnl - extra AC_SUBST calls, so that the right substitutions are made. ++ m4_foreach_w([gltype], [$1], ++ [AH_TEMPLATE([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), ++ [Define to the number of bits in type ']gltype['.])]) ++ for gltype in $1 ; do ++ AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}], ++ [AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT], ++ [$2 ++#include ], [result=unknown]) ++ eval gl_cv_bitsizeof_${gltype}=\$result ++ ]) ++ eval result=\$gl_cv_bitsizeof_${gltype} ++ if test $result = unknown; then ++ dnl Use a nonempty default, because some compilers, such as IRIX 5 cc, ++ dnl do a syntax check even on unused #if conditions and give an error ++ dnl on valid C code like this: ++ dnl #if 0 ++ dnl # if > 32 ++ dnl # endif ++ dnl #endif ++ result=0 ++ fi ++ GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` ++ AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result]) ++ eval BITSIZEOF_${GLTYPE}=\$result ++ done ++ m4_foreach_w([gltype], [$1], ++ [AC_SUBST([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) ++]) ++ ++dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES) ++dnl Determine the signedness of each of the given types. ++dnl Define HAVE_SIGNED_TYPE if type is signed. ++AC_DEFUN([gl_CHECK_TYPES_SIGNED], ++[ ++ dnl Use a shell loop, to avoid bloating configure, and ++ dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into ++ dnl config.h.in, ++ dnl - extra AC_SUBST calls, so that the right substitutions are made. ++ m4_foreach_w([gltype], [$1], ++ [AH_TEMPLATE([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), ++ [Define to 1 if ']gltype[' is a signed integer type.])]) ++ for gltype in $1 ; do ++ AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed], ++ [AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM([$2[ ++ int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])], ++ result=yes, result=no) ++ eval gl_cv_type_${gltype}_signed=\$result ++ ]) ++ eval result=\$gl_cv_type_${gltype}_signed ++ GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` ++ if test "$result" = yes; then ++ AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], 1) ++ eval HAVE_SIGNED_${GLTYPE}=1 ++ else ++ eval HAVE_SIGNED_${GLTYPE}=0 ++ fi ++ done ++ m4_foreach_w([gltype], [$1], ++ [AC_SUBST([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) ++]) ++ ++dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES) ++dnl Determine the suffix to use for integer constants of the given types. ++dnl Define t_SUFFIX for each such type. ++AC_DEFUN([gl_INTEGER_TYPE_SUFFIX], ++[ ++ dnl Use a shell loop, to avoid bloating configure, and ++ dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into ++ dnl config.h.in, ++ dnl - extra AC_SUBST calls, so that the right substitutions are made. ++ m4_foreach_w([gltype], [$1], ++ [AH_TEMPLATE(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX], ++ [Define to l, ll, u, ul, ull, etc., as suitable for ++ constants of type ']gltype['.])]) ++ for gltype in $1 ; do ++ AC_CACHE_CHECK([for $gltype integer literal suffix], ++ [gl_cv_type_${gltype}_suffix], ++ [eval gl_cv_type_${gltype}_suffix=no ++ eval result=\$gl_cv_type_${gltype}_signed ++ if test "$result" = yes; then ++ glsufu= ++ else ++ glsufu=u ++ fi ++ for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do ++ case $glsuf in ++ '') gltype1='int';; ++ l) gltype1='long int';; ++ ll) gltype1='long long int';; ++ i64) gltype1='__int64';; ++ u) gltype1='unsigned int';; ++ ul) gltype1='unsigned long int';; ++ ull) gltype1='unsigned long long int';; ++ ui64)gltype1='unsigned __int64';; ++ esac ++ AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM([$2[ ++ extern $gltype foo; ++ extern $gltype1 foo;]])], ++ [eval gl_cv_type_${gltype}_suffix=\$glsuf]) ++ eval result=\$gl_cv_type_${gltype}_suffix ++ test "$result" != no && break ++ done]) ++ GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` ++ eval result=\$gl_cv_type_${gltype}_suffix ++ test "$result" = no && result= ++ eval ${GLTYPE}_SUFFIX=\$result ++ AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], $result) ++ done ++ m4_foreach_w([gltype], [$1], ++ [AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])]) ++]) ++ ++dnl gl_STDINT_INCLUDES ++AC_DEFUN([gl_STDINT_INCLUDES], ++[[ ++ /* BSD/OS 4.0.1 has a bug: , and must be ++ included before . */ ++ #include ++ #include ++ #if HAVE_WCHAR_H ++ # include ++ # include ++ # include ++ #endif ++]]) ++ ++dnl gl_STDINT_TYPE_PROPERTIES ++dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t ++dnl of interest to stdint.in.h. ++AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], ++[ ++ gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t], ++ [gl_STDINT_INCLUDES]) ++ gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t], ++ [gl_STDINT_INCLUDES]) ++ gl_cv_type_ptrdiff_t_signed=yes ++ gl_cv_type_size_t_signed=no ++ gl_INTEGER_TYPE_SUFFIX([ptrdiff_t sig_atomic_t size_t wchar_t wint_t], ++ [gl_STDINT_INCLUDES]) ++]) ++ ++dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. ++dnl Remove this when we can assume autoconf >= 2.61. ++m4_ifdef([AC_COMPUTE_INT], [], [ ++ AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) ++]) ++ ++# Hey Emacs! ++# Local Variables: ++# indent-tabs-mode: nil ++# End: +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/stdio_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/stdio_h.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/stdio_h.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/stdio_h.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,125 @@ ++# stdio_h.m4 serial 13 ++dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_STDIO_H], ++[ ++ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) ++ gl_CHECK_NEXT_HEADERS([stdio.h]) ++ dnl No need to create extra modules for these functions. Everyone who uses ++ dnl likely needs them. ++ GNULIB_FPRINTF=1 ++ GNULIB_PRINTF=1 ++ GNULIB_VFPRINTF=1 ++ GNULIB_VPRINTF=1 ++ GNULIB_FPUTC=1 ++ GNULIB_PUTC=1 ++ GNULIB_PUTCHAR=1 ++ GNULIB_FPUTS=1 ++ GNULIB_PUTS=1 ++ GNULIB_FWRITE=1 ++ dnl This ifdef is just an optimization, to avoid performing a configure ++ dnl check whose result is not used. It does not make the test of ++ dnl GNULIB_STDIO_H_SIGPIPE or GNULIB_SIGPIPE redundant. ++ m4_ifdef([gl_SIGNAL_SIGPIPE], [ ++ gl_SIGNAL_SIGPIPE ++ if test $gl_cv_header_signal_h_SIGPIPE != yes; then ++ REPLACE_STDIO_WRITE_FUNCS=1 ++ AC_LIBOBJ([stdio-write]) ++ fi ++ ]) ++]) ++ ++AC_DEFUN([gl_STDIO_MODULE_INDICATOR], ++[ ++ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. ++ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) ++ GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 ++]) ++ ++AC_DEFUN([gl_STDIO_H_DEFAULTS], ++[ ++ GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF]) ++ GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX]) ++ GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF]) ++ GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX]) ++ GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) ++ GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX]) ++ GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF]) ++ GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX]) ++ GNULIB_VPRINTF=0; AC_SUBST([GNULIB_VPRINTF]) ++ GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX]) ++ GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF]) ++ GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) ++ GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) ++ GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) ++ GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) ++ GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN]) ++ GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN]) ++ GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK]) ++ GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO]) ++ GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL]) ++ GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO]) ++ GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH]) ++ GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC]) ++ GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC]) ++ GNULIB_PUTCHAR=0; AC_SUBST([GNULIB_PUTCHAR]) ++ GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS]) ++ GNULIB_PUTS=0; AC_SUBST([GNULIB_PUTS]) ++ GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE]) ++ GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM]) ++ GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE]) ++ GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR]) ++ GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE]) ++ dnl Assume proper GNU behavior unless another module says otherwise. ++ REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS]) ++ REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF]) ++ REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF]) ++ REPLACE_PRINTF=0; AC_SUBST([REPLACE_PRINTF]) ++ REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF]) ++ REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF]) ++ HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF]) ++ REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF]) ++ HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF]) ++ REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF]) ++ REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF]) ++ HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) ++ REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF]) ++ HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) ++ REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF]) ++ REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN]) ++ REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN]) ++ HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO]) ++ REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO]) ++ REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK]) ++ HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO]) ++ REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO]) ++ REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL]) ++ REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) ++ HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) ++ HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) ++ REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE]) ++ REPLACE_PERROR=0; AC_SUBST([REPLACE_PERROR]) ++]) ++ ++dnl Code shared by fseeko and ftello. Determine if large files are supported, ++dnl but stdin does not start as a large file by default. ++AC_DEFUN([gl_STDIN_LARGE_OFFSET], ++ [ ++ AC_CACHE_CHECK([whether stdin defaults to large file offsets], ++ [gl_cv_var_stdin_large_offset], ++ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], ++[[#if defined __SL64 && defined __SCLE /* cygwin */ ++ /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making ++ fseeko/ftello needlessly fail. This bug was fixed in 1.5.25, and ++ it is easier to do a version check than building a runtime test. */ ++# include ++# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25) ++ choke me ++# endif ++#endif]])], ++ [gl_cv_var_stdin_large_offset=yes], ++ [gl_cv_var_stdin_large_offset=no])]) ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/sys_socket_h.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/sys_socket_h.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/sys_socket_h.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/sys_socket_h.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,113 @@ ++# sys_socket_h.m4 serial 8 ++dnl Copyright (C) 2005-2008 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl From Simon Josefsson. ++ ++AC_DEFUN([gl_HEADER_SYS_SOCKET], ++[ ++ AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) ++ AC_REQUIRE([AC_C_INLINE]) ++ ++ AC_CACHE_CHECK([whether is self-contained], ++ [gl_cv_header_sys_socket_h_selfcontained], ++ [ ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])], ++ [gl_cv_header_sys_socket_h_selfcontained=yes], ++ [gl_cv_header_sys_socket_h_selfcontained=no]) ++ ]) ++ if test $gl_cv_header_sys_socket_h_selfcontained = yes; then ++ SYS_SOCKET_H='' ++ dnl If the shutdown function exists, should define ++ dnl SHUT_RD, SHUT_WR, SHUT_RDWR. ++ AC_CHECK_FUNCS([shutdown]) ++ if test $ac_cv_func_shutdown = yes; then ++ AC_CACHE_CHECK([whether defines the SHUT_* macros], ++ [gl_cv_header_sys_socket_h_shut], ++ [ ++ AC_COMPILE_IFELSE( ++ [AC_LANG_PROGRAM([[#include ]], ++ [[int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };]])], ++ [gl_cv_header_sys_socket_h_shut=yes], ++ [gl_cv_header_sys_socket_h_shut=no]) ++ ]) ++ if test $gl_cv_header_sys_socket_h_shut = no; then ++ SYS_SOCKET_H='sys/socket.h' ++ fi ++ fi ++ else ++ SYS_SOCKET_H='sys/socket.h' ++ fi ++ if test -n "$SYS_SOCKET_H"; then ++ dnl Check prerequisites of the replacement. ++ gl_CHECK_NEXT_HEADERS([sys/socket.h]) ++ if test $ac_cv_header_sys_socket_h = yes; then ++ HAVE_SYS_SOCKET_H=1 ++ HAVE_WS2TCPIP_H=0 ++ else ++ HAVE_SYS_SOCKET_H=0 ++ dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make ++ dnl the check for those headers unconditional; yet cygwin reports ++ dnl that the headers are present but cannot be compiled (since on ++ dnl cygwin, all socket information should come from sys/socket.h). ++ AC_CHECK_HEADERS([ws2tcpip.h]) ++ if test $ac_cv_header_ws2tcpip_h = yes; then ++ HAVE_WS2TCPIP_H=1 ++ else ++ HAVE_WS2TCPIP_H=0 ++ fi ++ fi ++ gl_PREREQ_SYS_H_WINSOCK2 ++ AC_SUBST([HAVE_SYS_SOCKET_H]) ++ AC_SUBST([HAVE_WS2TCPIP_H]) ++ fi ++ AC_SUBST([SYS_SOCKET_H]) ++]) ++ ++# Common prerequisites of of the replacement and of the ++# replacement. ++# Sets and substitutes HAVE_WINSOCK2_H. ++AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2], ++[ ++ AC_CHECK_HEADERS_ONCE([sys/socket.h]) ++ if test $ac_cv_header_sys_socket_h != yes; then ++ dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make ++ dnl the check for those headers unconditional; yet cygwin reports ++ dnl that the headers are present but cannot be compiled (since on ++ dnl cygwin, all socket information should come from sys/socket.h). ++ AC_CHECK_HEADERS([winsock2.h]) ++ fi ++ if test "$ac_cv_header_winsock2_h" = yes; then ++ HAVE_WINSOCK2_H=1 ++ else ++ HAVE_WINSOCK2_H=0 ++ fi ++ AC_SUBST([HAVE_WINSOCK2_H]) ++]) ++ ++AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR], ++[ ++ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. ++ AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) ++ GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 ++ gl_MODULE_INDICATOR([$1]) ++]) ++ ++AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], ++[ ++ GNULIB_SOCKET=0; AC_SUBST([GNULIB_SOCKET]) ++ GNULIB_CONNECT=0; AC_SUBST([GNULIB_CONNECT]) ++ GNULIB_ACCEPT=0; AC_SUBST([GNULIB_ACCEPT]) ++ GNULIB_BIND=0; AC_SUBST([GNULIB_BIND]) ++ GNULIB_GETPEERNAME=0; AC_SUBST([GNULIB_GETPEERNAME]) ++ GNULIB_GETSOCKNAME=0; AC_SUBST([GNULIB_GETSOCKNAME]) ++ GNULIB_GETSOCKOPT=0; AC_SUBST([GNULIB_GETSOCKOPT]) ++ GNULIB_LISTEN=0; AC_SUBST([GNULIB_LISTEN]) ++ GNULIB_RECV=0; AC_SUBST([GNULIB_RECV]) ++ GNULIB_SEND=0; AC_SUBST([GNULIB_SEND]) ++ GNULIB_RECVFROM=0; AC_SUBST([GNULIB_RECVFROM]) ++ GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO]) ++ GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT]) ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/vasnprintf.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/vasnprintf.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/vasnprintf.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/vasnprintf.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,260 @@ ++# vasnprintf.m4 serial 25 ++dnl Copyright (C) 2002-2004, 2006-2008 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_FUNC_VASNPRINTF], ++[ ++ AC_CHECK_FUNCS_ONCE([vasnprintf]) ++ if test $ac_cv_func_vasnprintf = no; then ++ gl_REPLACE_VASNPRINTF ++ fi ++]) ++ ++AC_DEFUN([gl_REPLACE_VASNPRINTF], ++[ ++ AC_CHECK_FUNCS_ONCE([vasnprintf]) ++ AC_LIBOBJ([vasnprintf]) ++ AC_LIBOBJ([printf-args]) ++ AC_LIBOBJ([printf-parse]) ++ AC_LIBOBJ([asnprintf]) ++ if test $ac_cv_func_vasnprintf = yes; then ++ AC_DEFINE([REPLACE_VASNPRINTF], 1, ++ [Define if vasnprintf exists but is overridden by gnulib.]) ++ fi ++ gl_PREREQ_PRINTF_ARGS ++ gl_PREREQ_PRINTF_PARSE ++ gl_PREREQ_VASNPRINTF ++ gl_PREREQ_ASNPRINTF ++]) ++ ++# Prequisites of lib/printf-args.h, lib/printf-args.c. ++AC_DEFUN([gl_PREREQ_PRINTF_ARGS], ++[ ++ AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) ++ AC_REQUIRE([gt_TYPE_WCHAR_T]) ++ AC_REQUIRE([gt_TYPE_WINT_T]) ++]) ++ ++# Prequisites of lib/printf-parse.h, lib/printf-parse.c. ++AC_DEFUN([gl_PREREQ_PRINTF_PARSE], ++[ ++ AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) ++ AC_REQUIRE([gt_TYPE_WCHAR_T]) ++ AC_REQUIRE([gt_TYPE_WINT_T]) ++ AC_REQUIRE([AC_TYPE_SIZE_T]) ++ AC_CHECK_TYPE([ptrdiff_t], , ++ [AC_DEFINE([ptrdiff_t], [long], ++ [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) ++ ]) ++ AC_REQUIRE([gt_AC_TYPE_INTMAX_T]) ++]) ++ ++# Prerequisites of lib/vasnprintf.c. ++AC_DEFUN([gl_PREREQ_VASNPRINTF], ++[ ++ AC_REQUIRE([AC_FUNC_ALLOCA]) ++ AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) ++ AC_REQUIRE([gt_TYPE_WCHAR_T]) ++ AC_REQUIRE([gt_TYPE_WINT_T]) ++ AC_CHECK_FUNCS(snprintf wcslen) ++ dnl Use the _snprintf function only if it is declared (because on NetBSD it ++ dnl is defined as a weak alias of snprintf; we prefer to use the latter). ++ AC_CHECK_DECLS([_snprintf], , , [#include ]) ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for supporting 'long double' ++# arguments. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_LONG_DOUBLE], ++[ ++ AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) ++ case "$gl_cv_func_printf_long_double" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1, ++ [Define if the vasnprintf implementation needs special code for ++ 'long double' arguments.]) ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double' ++# arguments. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE], ++[ ++ AC_REQUIRE([gl_PRINTF_INFINITE]) ++ case "$gl_cv_func_printf_infinite" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], 1, ++ [Define if the vasnprintf implementation needs special code for ++ infinite 'double' arguments.]) ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double' ++# arguments. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE], ++[ ++ AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE]) ++ dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if ++ dnl NEED_PRINTF_LONG_DOUBLE is already set. ++ AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE]) ++ case "$gl_cv_func_printf_long_double" in ++ *yes) ++ case "$gl_cv_func_printf_infinite_long_double" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], 1, ++ [Define if the vasnprintf implementation needs special code for ++ infinite 'long double' arguments.]) ++ ;; ++ esac ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A], ++[ ++ AC_REQUIRE([gl_PRINTF_DIRECTIVE_A]) ++ case "$gl_cv_func_printf_directive_a" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], 1, ++ [Define if the vasnprintf implementation needs special code for ++ the 'a' and 'A' directives.]) ++ AC_CHECK_FUNCS([nl_langinfo]) ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F], ++[ ++ AC_REQUIRE([gl_PRINTF_DIRECTIVE_F]) ++ case "$gl_cv_func_printf_directive_f" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], 1, ++ [Define if the vasnprintf implementation needs special code for ++ the 'F' directive.]) ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], ++[ ++ AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) ++ case "$gl_cv_func_printf_flag_grouping" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], 1, ++ [Define if the vasnprintf implementation needs special code for the ++ ' flag.]) ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST], ++[ ++ AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST]) ++ case "$gl_cv_func_printf_flag_leftadjust" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], 1, ++ [Define if the vasnprintf implementation needs special code for the ++ '-' flag.]) ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO], ++[ ++ AC_REQUIRE([gl_PRINTF_FLAG_ZERO]) ++ case "$gl_cv_func_printf_flag_zero" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_FLAG_ZERO], 1, ++ [Define if the vasnprintf implementation needs special code for the ++ 0 flag.]) ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for supporting large precisions. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION], ++[ ++ AC_REQUIRE([gl_PRINTF_PRECISION]) ++ case "$gl_cv_func_printf_precision" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], 1, ++ [Define if the vasnprintf implementation needs special code for ++ supporting large precisions without arbitrary bounds.]) ++ AC_DEFINE([NEED_PRINTF_DOUBLE], 1, ++ [Define if the vasnprintf implementation needs special code for ++ 'double' arguments.]) ++ AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1, ++ [Define if the vasnprintf implementation needs special code for ++ 'long double' arguments.]) ++ ;; ++ esac ++]) ++ ++# Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory ++# conditions. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM], ++[ ++ AC_REQUIRE([gl_PRINTF_ENOMEM]) ++ case "$gl_cv_func_printf_enomem" in ++ *yes) ++ ;; ++ *) ++ AC_DEFINE([NEED_PRINTF_ENOMEM], 1, ++ [Define if the vasnprintf implementation needs special code for ++ surviving out-of-memory conditions.]) ++ AC_DEFINE([NEED_PRINTF_DOUBLE], 1, ++ [Define if the vasnprintf implementation needs special code for ++ 'double' arguments.]) ++ AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1, ++ [Define if the vasnprintf implementation needs special code for ++ 'long double' arguments.]) ++ ;; ++ esac ++]) ++ ++# Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance. ++AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS], ++[ ++ AC_REQUIRE([gl_PREREQ_VASNPRINTF]) ++ gl_PREREQ_VASNPRINTF_LONG_DOUBLE ++ gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE ++ gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE ++ gl_PREREQ_VASNPRINTF_DIRECTIVE_A ++ gl_PREREQ_VASNPRINTF_DIRECTIVE_F ++ gl_PREREQ_VASNPRINTF_FLAG_GROUPING ++ gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST ++ gl_PREREQ_VASNPRINTF_FLAG_ZERO ++ gl_PREREQ_VASNPRINTF_PRECISION ++ gl_PREREQ_VASNPRINTF_ENOMEM ++]) ++ ++# Prerequisites of lib/asnprintf.c. ++AC_DEFUN([gl_PREREQ_ASNPRINTF], ++[ ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/wchar.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/wchar.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/wchar.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/wchar.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,69 @@ ++dnl A placeholder for ISO C99 , for platforms that have issues. ++ ++dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl Written by Eric Blake. ++ ++# wchar.m4 serial 6 ++ ++AC_DEFUN([gl_WCHAR_H], ++[ ++ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) ++ AC_CACHE_CHECK([whether is standalone], ++ [gl_cv_header_wchar_h_standalone], ++ [AC_COMPILE_IFELSE([[#include ++wchar_t w;]], ++ [gl_cv_header_wchar_h_standalone=yes], ++ [gl_cv_header_wchar_h_standalone=no])]) ++ ++ AC_REQUIRE([gt_TYPE_WINT_T]) ++ if test $gt_cv_c_wint_t = yes; then ++ HAVE_WINT_T=1 ++ else ++ HAVE_WINT_T=0 ++ fi ++ AC_SUBST([HAVE_WINT_T]) ++ ++ if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes; then ++ WCHAR_H=wchar.h ++ fi ++ ++ dnl Prepare for creating substitute . ++ dnl Do it always: WCHAR_H may be empty here but can be set later. ++ dnl Check for (missing in Linux uClibc when built without wide ++ dnl character support). ++ AC_CHECK_HEADERS_ONCE([wchar.h]) ++ if test $ac_cv_header_wchar_h = yes; then ++ HAVE_WCHAR_H=1 ++ else ++ HAVE_WCHAR_H=0 ++ fi ++ AC_SUBST([HAVE_WCHAR_H]) ++ gl_CHECK_NEXT_HEADERS([wchar.h]) ++]) ++ ++dnl Unconditionally enables the replacement of . ++AC_DEFUN([gl_REPLACE_WCHAR_H], ++[ ++ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) ++ WCHAR_H=wchar.h ++]) ++ ++AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], ++[ ++ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. ++ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) ++ GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 ++]) ++ ++AC_DEFUN([gl_WCHAR_H_DEFAULTS], ++[ ++ GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) ++ dnl Assume proper GNU behavior unless another module says otherwise. ++ HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) ++ REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) ++ WCHAR_H=''; AC_SUBST([WCHAR_H]) ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/wchar_t.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/wchar_t.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/wchar_t.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/wchar_t.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,20 @@ ++# wchar_t.m4 serial 1 (gettext-0.12) ++dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl From Bruno Haible. ++dnl Test whether has the 'wchar_t' type. ++dnl Prerequisite: AC_PROG_CC ++ ++AC_DEFUN([gt_TYPE_WCHAR_T], ++[ ++ AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t, ++ [AC_TRY_COMPILE([#include ++ wchar_t foo = (wchar_t)'\0';], , ++ gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)]) ++ if test $gt_cv_c_wchar_t = yes; then ++ AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.]) ++ fi ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/wint_t.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/wint_t.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/wint_t.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/wint_t.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,28 @@ ++# wint_t.m4 serial 2 (gettext-0.17) ++dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl From Bruno Haible. ++dnl Test whether has the 'wint_t' type. ++dnl Prerequisite: AC_PROG_CC ++ ++AC_DEFUN([gt_TYPE_WINT_T], ++[ ++ AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t, ++ [AC_TRY_COMPILE([ ++/* Tru64 with Desktop Toolkit C has a bug: must be included before ++ . ++ BSD/OS 4.0.1 has a bug: , and must be included ++ before . */ ++#include ++#include ++#include ++#include ++ wint_t foo = (wchar_t)'\0';], , ++ gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)]) ++ if test $gt_cv_c_wint_t = yes; then ++ AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.]) ++ fi ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/m4/xsize.m4 gtk-vnc-0.3.7.gnulib/gnulib/m4/xsize.m4 +--- gtk-vnc-0.3.7.mingw/gnulib/m4/xsize.m4 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/m4/xsize.m4 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,13 @@ ++# xsize.m4 serial 3 ++dnl Copyright (C) 2003-2004 Free Software Foundation, Inc. ++dnl This file is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++AC_DEFUN([gl_XSIZE], ++[ ++ dnl Prerequisites of lib/xsize.h. ++ AC_REQUIRE([gl_SIZE_MAX]) ++ AC_REQUIRE([AC_C_INLINE]) ++ AC_CHECK_HEADERS(stdint.h) ++]) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/dummy.c gtk-vnc-0.3.7.gnulib/gnulib/tests/dummy.c +--- gtk-vnc-0.3.7.mingw/gnulib/tests/dummy.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/tests/dummy.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,42 @@ ++/* A dummy file, to prevent empty libraries from breaking builds. ++ Copyright (C) 2004, 2007 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Some systems, reportedly OpenBSD and Mac OS X, refuse to create ++ libraries without any object files. You might get an error like: ++ ++ > ar cru .libs/libgl.a ++ > ar: no archive members specified ++ ++ Compiling this file, and adding its object file to the library, will ++ prevent the library from being empty. */ ++ ++/* Some systems, such as Solaris with cc 5.0, refuse to work with libraries ++ that don't export any symbol. You might get an error like: ++ ++ > cc ... libgnu.a ++ > ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a ++ ++ Compiling this file, and adding its object file to the library, will ++ prevent the library from exporting no symbols. */ ++ ++#ifdef __sun ++/* This declaration ensures that the library will export at least 1 symbol. */ ++int gl_dummy_symbol; ++#else ++/* This declaration is solely to ensure that after preprocessing ++ this file is never empty. */ ++typedef int dummy; ++#endif +diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/intprops.h gtk-vnc-0.3.7.gnulib/gnulib/tests/intprops.h +--- gtk-vnc-0.3.7.mingw/gnulib/tests/intprops.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/tests/intprops.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,77 @@ ++/* intprops.h -- properties of integer types ++ ++ Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Written by Paul Eggert. */ ++ ++#include ++ ++/* The extra casts in the following macros work around compiler bugs, ++ e.g., in Cray C 5.0.3.0. */ ++ ++/* True if the arithmetic type T is an integer type. bool counts as ++ an integer. */ ++#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) ++ ++/* True if negative values of the signed integer type T use two's ++ complement, ones' complement, or signed magnitude representation, ++ respectively. Much GNU code assumes two's complement, but some ++ people like to be portable to all possible C hosts. */ ++#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) ++#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) ++#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) ++ ++/* True if the arithmetic type T is signed. */ ++#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) ++ ++/* The maximum and minimum values for the integer type T. These ++ macros have undefined behavior if T is signed and has padding bits. ++ If this is a problem for you, please let us know how to fix it for ++ your host. */ ++#define TYPE_MINIMUM(t) \ ++ ((t) (! TYPE_SIGNED (t) \ ++ ? (t) 0 \ ++ : TYPE_SIGNED_MAGNITUDE (t) \ ++ ? ~ (t) 0 \ ++ : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) ++#define TYPE_MAXIMUM(t) \ ++ ((t) (! TYPE_SIGNED (t) \ ++ ? (t) -1 \ ++ : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) ++ ++/* Return zero if T can be determined to be an unsigned type. ++ Otherwise, return 1. ++ When compiling with GCC, INT_STRLEN_BOUND uses this macro to obtain a ++ tighter bound. Otherwise, it overestimates the true bound by one byte ++ when applied to unsigned types of size 2, 4, 16, ... bytes. ++ The symbol signed_type_or_expr__ is private to this header file. */ ++#if __GNUC__ >= 2 ++# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t)) ++#else ++# define signed_type_or_expr__(t) 1 ++#endif ++ ++/* Bound on length of the string representing an integer type or expression T. ++ Subtract 1 for the sign bit if T is signed; log10 (2.0) < 146/485; ++ add 1 for integer division truncation; add 1 more for a minus sign ++ if needed. */ ++#define INT_STRLEN_BOUND(t) \ ++ ((sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) * 146 / 485 \ ++ + signed_type_or_expr__ (t) + 1) ++ ++/* Bound on buffer size needed to represent an integer type or expression T, ++ including the terminating null. */ ++#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) +diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/Makefile.am gtk-vnc-0.3.7.gnulib/gnulib/tests/Makefile.am +--- gtk-vnc-0.3.7.mingw/gnulib/tests/Makefile.am 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/tests/Makefile.am 2008-10-09 12:24:40.000000000 +0100 +@@ -0,0 +1,192 @@ ++## DO NOT EDIT! GENERATED AUTOMATICALLY! ++## Process this file with automake to produce Makefile.in. ++# Copyright (C) 2002-2008 Free Software Foundation, Inc. ++# ++# This file is free software, distributed under the terms of the GNU ++# General Public License. As a special exception to the GNU General ++# Public License, this file may be distributed as part of a program ++# that contains a configuration script generated by Autoconf, under ++# the same distribution terms as the rest of that program. ++# ++# Generated by gnulib-tool. ++ ++AUTOMAKE_OPTIONS = 1.5 foreign ++ ++SUBDIRS = ++TESTS = ++TESTS_ENVIRONMENT = ++noinst_PROGRAMS = ++check_PROGRAMS = ++noinst_HEADERS = ++noinst_LIBRARIES = ++check_LIBRARIES = libtests.a ++EXTRA_DIST = ++BUILT_SOURCES = ++SUFFIXES = ++MOSTLYCLEANFILES = core *.stackdump ++MOSTLYCLEANDIRS = ++CLEANFILES = ++DISTCLEANFILES = ++MAINTAINERCLEANFILES = ++ ++AM_CPPFLAGS = \ ++ -I. -I$(srcdir) \ ++ -I../.. -I$(srcdir)/../.. \ ++ -I../../gnulib/lib -I$(srcdir)/../../gnulib/lib ++ ++LDADD = libtests.a ../../gnulib/lib/libgnu.la libtests.a $(LIBTESTS_LIBDEPS) ++ ++libtests_a_SOURCES = ++libtests_a_LIBADD = $(gltests_LIBOBJS) ++libtests_a_DEPENDENCIES = $(gltests_LIBOBJS) ++EXTRA_libtests_a_SOURCES = ++AM_LIBTOOLFLAGS = --preserve-dup-deps ++ ++## begin gnulib module alloca-opt-tests ++ ++TESTS += test-alloca-opt ++check_PROGRAMS += test-alloca-opt ++ ++EXTRA_DIST += test-alloca-opt.c ++ ++## end gnulib module alloca-opt-tests ++ ++## begin gnulib module arpa_inet-tests ++ ++TESTS += test-arpa_inet ++check_PROGRAMS += test-arpa_inet ++ ++EXTRA_DIST += test-arpa_inet.c ++ ++## end gnulib module arpa_inet-tests ++ ++## begin gnulib module errno-tests ++ ++TESTS += test-errno ++check_PROGRAMS += test-errno ++ ++EXTRA_DIST += test-errno.c ++ ++## end gnulib module errno-tests ++ ++## begin gnulib module getaddrinfo-tests ++ ++TESTS += test-getaddrinfo ++check_PROGRAMS += test-getaddrinfo ++test_getaddrinfo_LDADD = $(LDADD) @LIBINTL@ ++ ++EXTRA_DIST += test-getaddrinfo.c ++ ++## end gnulib module getaddrinfo-tests ++ ++## begin gnulib module intprops ++ ++ ++EXTRA_DIST += intprops.h ++ ++## end gnulib module intprops ++ ++## begin gnulib module netinet_in-tests ++ ++TESTS += test-netinet_in ++check_PROGRAMS += test-netinet_in ++ ++EXTRA_DIST += test-netinet_in.c ++ ++## end gnulib module netinet_in-tests ++ ++## begin gnulib module snprintf-tests ++ ++TESTS += test-snprintf ++check_PROGRAMS += test-snprintf ++ ++EXTRA_DIST += test-snprintf.c ++ ++## end gnulib module snprintf-tests ++ ++## begin gnulib module stdbool-tests ++ ++TESTS += test-stdbool ++check_PROGRAMS += test-stdbool ++ ++EXTRA_DIST += test-stdbool.c ++ ++## end gnulib module stdbool-tests ++ ++## begin gnulib module stdint-tests ++ ++TESTS += test-stdint ++check_PROGRAMS += test-stdint ++ ++EXTRA_DIST += test-stdint.c ++ ++## end gnulib module stdint-tests ++ ++## begin gnulib module stdio-tests ++ ++TESTS += test-stdio ++check_PROGRAMS += test-stdio ++ ++EXTRA_DIST += test-stdio.c ++ ++## end gnulib module stdio-tests ++ ++## begin gnulib module sys_socket-tests ++ ++TESTS += test-sys_socket ++check_PROGRAMS += test-sys_socket ++ ++EXTRA_DIST += test-sys_socket.c ++ ++## end gnulib module sys_socket-tests ++ ++## begin gnulib module vasnprintf-tests ++ ++TESTS += test-vasnprintf ++check_PROGRAMS += test-vasnprintf ++ ++EXTRA_DIST += test-vasnprintf.c ++ ++## end gnulib module vasnprintf-tests ++ ++## begin gnulib module vc-list-files-tests ++ ++TESTS += test-vc-list-files-git.sh ++TESTS += test-vc-list-files-cvs.sh ++TESTS_ENVIRONMENT += PATH='$(abs_aux_dir)':"$$PATH" ++EXTRA_DIST += test-vc-list-files-git.sh test-vc-list-files-cvs.sh ++ ++## end gnulib module vc-list-files-tests ++ ++## begin gnulib module verify ++ ++libtests_a_SOURCES += verify.h ++ ++## end gnulib module verify ++ ++## begin gnulib module wchar-tests ++ ++TESTS += test-wchar ++check_PROGRAMS += test-wchar ++ ++EXTRA_DIST += test-wchar.c ++ ++## end gnulib module wchar-tests ++ ++## begin gnulib module dummy ++ ++libtests_a_SOURCES += dummy.c ++ ++## end gnulib module dummy ++ ++# Clean up after Solaris cc. ++clean-local: ++ rm -rf SunWS_cache ++ ++mostlyclean-local: mostlyclean-generic ++ @for dir in '' $(MOSTLYCLEANDIRS); do \ ++ if test -n "$$dir" && test -d $$dir; then \ ++ echo "rmdir $$dir"; rmdir $$dir; \ ++ fi; \ ++ done; \ ++ : +diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-alloca-opt.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-alloca-opt.c +--- gtk-vnc-0.3.7.mingw/gnulib/tests/test-alloca-opt.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-alloca-opt.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,62 @@ ++/* Test of optional automatic memory allocation. ++ Copyright (C) 2005, 2007 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Written by Bruno Haible , 2007. */ ++ ++#include ++ ++#include ++ ++#if HAVE_ALLOCA ++ ++static void ++do_allocation (int n) ++{ ++ void *ptr = alloca (n); ++ (void) ptr; ++} ++ ++void (*func) (int) = do_allocation; ++ ++#endif ++ ++int ++main () ++{ ++#if HAVE_ALLOCA ++ int i; ++ ++ /* Repeat a lot of times, to make sure there's no memory leak. */ ++ for (i = 0; i < 100000; i++) ++ { ++ /* Try various values. ++ n = 0 gave a crash on Alpha with gcc-2.5.8. ++ Some versions of MacOS X have a stack size limit of 512 KB. */ ++ func (34); ++ func (134); ++ func (399); ++ func (510823); ++ func (129321); ++ func (0); ++ func (4070); ++ func (4095); ++ func (1); ++ func (16582); ++ } ++#endif ++ ++ return 0; ++} +diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-arpa_inet.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-arpa_inet.c +--- gtk-vnc-0.3.7.mingw/gnulib/tests/test-arpa_inet.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-arpa_inet.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,27 @@ ++/* Test of substitute. ++ Copyright (C) 2007 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Written by Bruno Haible , 2007. */ ++ ++#include ++ ++#include ++ ++int ++main () ++{ ++ return 0; ++} +diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-errno.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-errno.c +--- gtk-vnc-0.3.7.mingw/gnulib/tests/test-errno.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-errno.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,117 @@ ++/* Test of substitute. ++ Copyright (C) 2008 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Written by Bruno Haible , 2008. */ ++ ++#include ++ ++#include ++ ++/* Verify that the POSIX mandated errno values exist and can be used as ++ initializers outside of a function. ++ The variable names happen to match the Linux/x86 error numbers. */ ++int e1 = EPERM; ++int e2 = ENOENT; ++int e3 = ESRCH; ++int e4 = EINTR; ++int e5 = EIO; ++int e6 = ENXIO; ++int e7 = E2BIG; ++int e8 = ENOEXEC; ++int e9 = EBADF; ++int e10 = ECHILD; ++int e11 = EAGAIN; ++int e11a = EWOULDBLOCK; ++int e12 = ENOMEM; ++int e13 = EACCES; ++int e14 = EFAULT; ++int e16 = EBUSY; ++int e17 = EEXIST; ++int e18 = EXDEV; ++int e19 = ENODEV; ++int e20 = ENOTDIR; ++int e21 = EISDIR; ++int e22 = EINVAL; ++int e23 = ENFILE; ++int e24 = EMFILE; ++int e25 = ENOTTY; ++int e26 = ETXTBSY; ++int e27 = EFBIG; ++int e28 = ENOSPC; ++int e29 = ESPIPE; ++int e30 = EROFS; ++int e31 = EMLINK; ++int e32 = EPIPE; ++int e33 = EDOM; ++int e34 = ERANGE; ++int e35 = EDEADLK; ++int e36 = ENAMETOOLONG; ++int e37 = ENOLCK; ++int e38 = ENOSYS; ++int e39 = ENOTEMPTY; ++int e40 = ELOOP; ++int e42 = ENOMSG; ++int e43 = EIDRM; ++int e67 = ENOLINK; ++int e71 = EPROTO; ++int e72 = EMULTIHOP; ++int e74 = EBADMSG; ++int e75 = EOVERFLOW; ++int e84 = EILSEQ; ++int e88 = ENOTSOCK; ++int e89 = EDESTADDRREQ; ++int e90 = EMSGSIZE; ++int e91 = EPROTOTYPE; ++int e92 = ENOPROTOOPT; ++int e93 = EPROTONOSUPPORT; ++int e95 = EOPNOTSUPP; ++int e95a = ENOTSUP; ++int e97 = EAFNOSUPPORT; ++int e98 = EADDRINUSE; ++int e99 = EADDRNOTAVAIL; ++int e100 = ENETDOWN; ++int e101 = ENETUNREACH; ++int e102 = ENETRESET; ++int e103 = ECONNABORTED; ++int e104 = ECONNRESET; ++int e105 = ENOBUFS; ++int e106 = EISCONN; ++int e107 = ENOTCONN; ++int e110 = ETIMEDOUT; ++int e111 = ECONNREFUSED; ++int e113 = EHOSTUNREACH; ++int e114 = EALREADY; ++int e115 = EINPROGRESS; ++int e116 = ESTALE; ++int e122 = EDQUOT; ++int e125 = ECANCELED; ++ ++/* Don't verify that these errno values are all different, except for possibly ++ EWOULDBLOCK == EAGAIN. Even Linux/x86 does not pass this check: it has ++ ENOTSUP == EOPNOTSUPP. */ ++ ++int ++main () ++{ ++ /* Verify that errno can be assigned. */ ++ errno = EOVERFLOW; ++ ++ /* snprintf() callers want to distinguish EINVAL and EOVERFLOW. */ ++ if (errno == EINVAL) ++ return 1; ++ ++ return 0; ++} +diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-getaddrinfo.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-getaddrinfo.c +--- gtk-vnc-0.3.7.mingw/gnulib/tests/test-getaddrinfo.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-getaddrinfo.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,155 @@ ++/* Test the getaddrinfo module. ++ ++ Copyright (C) 2006-2008 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Written by Simon Josefsson. */ ++ ++#include ++#include "getaddrinfo.h" ++#include ++#include ++#include ++#include ++ ++/* Whether to print debugging messages. */ ++#define ENABLE_DEBUGGING 0 ++ ++#if ENABLE_DEBUGGING ++# define dbgprintf printf ++#else ++# define dbgprintf if (0) printf ++#endif ++ ++/* BeOS does not have AF_UNSPEC. */ ++#ifndef AF_UNSPEC ++# define AF_UNSPEC 0 ++#endif ++ ++#ifndef EAI_SERVICE ++# define EAI_SERVICE 0 ++#endif ++ ++int simple (char *host, char *service) ++{ ++ char buf[BUFSIZ]; ++ struct addrinfo hints; ++ struct addrinfo *ai0, *ai; ++ int res; ++ ++ dbgprintf ("Finding %s service %s...\n", host, service); ++ ++ /* This initializes "hints" but does not use it. Is there a reason ++ for this? If so, please fix this comment. */ ++ memset (&hints, 0, sizeof (hints)); ++ hints.ai_flags = AI_CANONNAME; ++ hints.ai_family = AF_UNSPEC; ++ hints.ai_socktype = SOCK_STREAM; ++ ++ res = getaddrinfo (host, service, 0, &ai0); ++ ++ dbgprintf ("res %d: %s\n", res, gai_strerror (res)); ++ ++ if (res != 0) ++ { ++ /* IRIX reports EAI_NONAME for "https". Don't fail the test ++ merely because of this. */ ++ if (res == EAI_NONAME) ++ return 0; ++ /* Solaris reports EAI_SERVICE for "http" and "https". Don't ++ fail the test merely because of this. */ ++ if (res == EAI_SERVICE) ++ return 0; ++ /* AIX reports EAI_NODATA for "https". Don't fail the test ++ merely because of this. */ ++ if (res == EAI_NODATA) ++ return 0; ++ ++ return 1; ++ } ++ ++ for (ai = ai0; ai; ai = ai->ai_next) ++ { ++ dbgprintf ("\tflags %x\n", ai->ai_flags); ++ dbgprintf ("\tfamily %x\n", ai->ai_family); ++ dbgprintf ("\tsocktype %x\n", ai->ai_socktype); ++ dbgprintf ("\tprotocol %x\n", ai->ai_protocol); ++ dbgprintf ("\taddrlen %ld: ", (unsigned long) ai->ai_addrlen); ++ dbgprintf ("\tFound %s\n", ++ inet_ntop (ai->ai_family, ++ &((struct sockaddr_in *) ++ ai->ai_addr)->sin_addr, ++ buf, sizeof (buf) - 1)); ++ if (ai->ai_canonname) ++ dbgprintf ("\tFound %s...\n", ai->ai_canonname); ++ ++ { ++ char ipbuf[BUFSIZ]; ++ char portbuf[BUFSIZ]; ++ ++ res = getnameinfo (ai->ai_addr, ai->ai_addrlen, ++ ipbuf, sizeof (ipbuf) - 1, ++ portbuf, sizeof (portbuf) - 1, ++ NI_NUMERICHOST|NI_NUMERICSERV); ++ dbgprintf ("\t\tgetnameinfo %d: %s\n", res, gai_strerror (res)); ++ if (res == 0) ++ { ++ dbgprintf ("\t\tip %s\n", ipbuf); ++ dbgprintf ("\t\tport %s\n", portbuf); ++ } ++ } ++ ++ } ++ ++ freeaddrinfo (ai0); ++ ++ return 0; ++} ++ ++#define HOST1 "www.gnu.org" ++#define SERV1 "http" ++#define HOST2 "www.ibm.com" ++#define SERV2 "https" ++#define HOST3 "microsoft.com" ++#define SERV3 "http" ++#define HOST4 "google.org" ++#define SERV4 "ldap" ++ ++int main (void) ++{ ++#if _WIN32 ++ { ++ WORD requested; ++ WSADATA data; ++ int err; ++ ++ requested = MAKEWORD (1, 1); ++ err = WSAStartup (requested, &data); ++ if (err != 0) ++ return 1; ++ ++ if (data.wVersion < requested) ++ { ++ WSACleanup (); ++ return 2; ++ } ++ } ++#endif ++ ++ return simple (HOST1, SERV1) ++ + simple (HOST2, SERV2) ++ + simple (HOST3, SERV3) ++ + simple (HOST4, SERV4); ++} +diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-netinet_in.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-netinet_in.c +--- gtk-vnc-0.3.7.mingw/gnulib/tests/test-netinet_in.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-netinet_in.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,27 @@ ++/* Test of substitute. ++ Copyright (C) 2007 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Written by Bruno Haible , 2007. */ ++ ++#include ++ ++#include ++ ++int ++main () ++{ ++ return 0; ++} +diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-snprintf.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-snprintf.c +--- gtk-vnc-0.3.7.mingw/gnulib/tests/test-snprintf.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-snprintf.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,72 @@ ++/* Test of snprintf() function. ++ Copyright (C) 2007-2008 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Written by Bruno Haible , 2007. */ ++ ++#include ++ ++#include ++ ++#include ++#include ++ ++#define ASSERT(expr) \ ++ do \ ++ { \ ++ if (!(expr)) \ ++ { \ ++ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ ++ fflush (stderr); \ ++ abort (); \ ++ } \ ++ } \ ++ while (0) ++ ++int ++main (int argc, char *argv[]) ++{ ++ char buf[8]; ++ int size; ++ int retval; ++ ++ for (size = 0; size <= 8; size++) ++ { ++ memcpy (buf, "DEADBEEF", 8); ++ retval = snprintf (buf, size, "%d", 12345); ++ if (size < 6) ++ { ++#if CHECK_SNPRINTF_POSIX ++ ASSERT (retval < 0 || retval >= size); ++#endif ++ if (size > 0) ++ { ++ ASSERT (memcmp (buf, "12345", size - 1) == 0); ++ ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size); ++ } ++#if !CHECK_SNPRINTF_POSIX ++ if (size > 0) ++#endif ++ ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); ++ } ++ else ++ { ++ ASSERT (retval == 5); ++ ASSERT (memcmp (buf, "12345\0EF", 8) == 0); ++ } ++ } ++ ++ return 0; ++} +diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-stdbool.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdbool.c +--- gtk-vnc-0.3.7.mingw/gnulib/tests/test-stdbool.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdbool.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,95 @@ ++/* Test of substitute. ++ Copyright (C) 2002-2007 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Written by Bruno Haible , 2007. */ ++ ++#include ++ ++#include ++ ++#ifndef bool ++ "error: bool is not defined" ++#endif ++#ifndef false ++ "error: false is not defined" ++#endif ++#if false ++ "error: false is not 0" ++#endif ++#ifndef true ++ "error: true is not defined" ++#endif ++#if true != 1 ++ "error: true is not 1" ++#endif ++#ifndef __bool_true_false_are_defined ++ "error: __bool_true_false_are_defined is not defined" ++#endif ++ ++#if 0 /* Cannot be guaranteed with gnulib's . */ ++struct s { _Bool s: 1; _Bool t; } s; ++#endif ++ ++char a[true == 1 ? 1 : -1]; ++char b[false == 0 ? 1 : -1]; ++char c[__bool_true_false_are_defined == 1 ? 1 : -1]; ++#if 0 /* Cannot be guaranteed with gnulib's . */ ++char d[(bool) 0.5 == true ? 1 : -1]; ++bool e = &s; ++#endif ++char f[(_Bool) 0.0 == false ? 1 : -1]; ++char g[true]; ++char h[sizeof (_Bool)]; ++#if 0 /* See above. */ ++char i[sizeof s.t]; ++#endif ++enum { j = false, k = true, l = false * true, m = true * 256 }; ++_Bool n[m]; ++char o[sizeof n == m * sizeof n[0] ? 1 : -1]; ++char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; ++#if 0 /* Cannot be guaranteed with gnulib's . */ ++#if defined __xlc__ || defined __GNUC__ ++ /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 ++ reported by James Lemley on 2005-10-05; see ++ http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html ++ This test is not quite right, since xlc is allowed to ++ reject this program, as the initializer for xlcbug is ++ not one of the forms that C requires support for. ++ However, doing the test right would require a run-time ++ test, and that would make cross-compilation harder. ++ Let us hope that IBM fixes the xlc bug, and also adds ++ support for this kind of constant expression. In the ++ meantime, this test will reject xlc, which is OK, since ++ our stdbool.h substitute should suffice. We also test ++ this with GCC, where it should work, to detect more ++ quickly whether someone messes up the test in the ++ future. */ ++ char digs[] = "0123456789"; ++ int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); ++#endif ++#endif ++/* Catch a bug in an HP-UX C compiler. See ++ http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html ++ http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html ++ */ ++_Bool q = true; ++_Bool *pq = &q; ++ ++int ++main () ++{ ++ return 0; ++} +diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-stdint.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdint.c +--- gtk-vnc-0.3.7.mingw/gnulib/tests/test-stdint.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdint.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,360 @@ ++/* Test of substitute. ++ Copyright (C) 2006-2008 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Written by Bruno Haible , 2006. */ ++ ++#include ++ ++/* Whether to enable pedantic checks. */ ++#define DO_PEDANTIC 0 ++ ++#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ ++#include ++ ++#include "verify.h" ++#include "intprops.h" ++ ++#if __GNUC__ >= 2 && DO_PEDANTIC ++# define verify_same_types(expr1,expr2) \ ++ extern void _verify_func(__LINE__) (__typeof__ (expr1) *); \ ++ extern void _verify_func(__LINE__) (__typeof__ (expr2) *); ++# define _verify_func(line) _verify_func2(line) ++# define _verify_func2(line) verify_func_ ## line ++#else ++# define verify_same_types(expr1,expr2) extern void verify_func (int) ++#endif ++ ++/* 7.18.1.1. Exact-width integer types */ ++/* 7.18.2.1. Limits of exact-width integer types */ ++ ++int8_t a1[3] = { INT8_C (17), INT8_MIN, INT8_MAX }; ++verify (TYPE_MINIMUM (int8_t) == INT8_MIN); ++verify (TYPE_MAXIMUM (int8_t) == INT8_MAX); ++verify_same_types (INT8_MIN, (int8_t) 0 + 0); ++verify_same_types (INT8_MAX, (int8_t) 0 + 0); ++ ++int16_t a2[3] = { INT16_C (17), INT16_MIN, INT16_MAX }; ++verify (TYPE_MINIMUM (int16_t) == INT16_MIN); ++verify (TYPE_MAXIMUM (int16_t) == INT16_MAX); ++verify_same_types (INT16_MIN, (int16_t) 0 + 0); ++verify_same_types (INT16_MAX, (int16_t) 0 + 0); ++ ++int32_t a3[3] = { INT32_C (17), INT32_MIN, INT32_MAX }; ++verify (TYPE_MINIMUM (int32_t) == INT32_MIN); ++verify (TYPE_MAXIMUM (int32_t) == INT32_MAX); ++verify_same_types (INT32_MIN, (int32_t) 0 + 0); ++verify_same_types (INT32_MAX, (int32_t) 0 + 0); ++ ++#ifdef INT64_MAX ++int64_t a4[3] = { INT64_C (17), INT64_MIN, INT64_MAX }; ++verify (TYPE_MINIMUM (int64_t) == INT64_MIN); ++verify (TYPE_MAXIMUM (int64_t) == INT64_MAX); ++verify_same_types (INT64_MIN, (int64_t) 0 + 0); ++verify_same_types (INT64_MAX, (int64_t) 0 + 0); ++#endif ++ ++uint8_t b1[2] = { UINT8_C (17), UINT8_MAX }; ++verify (TYPE_MAXIMUM (uint8_t) == UINT8_MAX); ++verify_same_types (UINT8_MAX, (uint8_t) 0 + 0); ++ ++uint16_t b2[2] = { UINT16_C (17), UINT16_MAX }; ++verify (TYPE_MAXIMUM (uint16_t) == UINT16_MAX); ++verify_same_types (UINT16_MAX, (uint16_t) 0 + 0); ++ ++uint32_t b3[2] = { UINT32_C (17), UINT32_MAX }; ++verify (TYPE_MAXIMUM (uint32_t) == UINT32_MAX); ++verify_same_types (UINT32_MAX, (uint32_t) 0 + 0); ++ ++#ifdef UINT64_MAX ++uint64_t b4[2] = { UINT64_C (17), UINT64_MAX }; ++verify (TYPE_MAXIMUM (uint64_t) == UINT64_MAX); ++verify_same_types (UINT64_MAX, (uint64_t) 0 + 0); ++#endif ++ ++#if INT8_MIN && INT8_MAX && INT16_MIN && INT16_MAX && INT32_MIN && INT32_MAX ++/* ok */ ++#else ++err or; ++#endif ++ ++#if UINT8_MAX && UINT16_MAX && UINT32_MAX ++/* ok */ ++#else ++err or; ++#endif ++ ++/* 7.18.1.2. Minimum-width integer types */ ++/* 7.18.2.2. Limits of minimum-width integer types */ ++ ++int_least8_t c1[3] = { 17, INT_LEAST8_MIN, INT_LEAST8_MAX }; ++verify (TYPE_MINIMUM (int_least8_t) == INT_LEAST8_MIN); ++verify (TYPE_MAXIMUM (int_least8_t) == INT_LEAST8_MAX); ++verify_same_types (INT_LEAST8_MIN, (int_least8_t) 0 + 0); ++verify_same_types (INT_LEAST8_MAX, (int_least8_t) 0 + 0); ++ ++int_least16_t c2[3] = { 17, INT_LEAST16_MIN, INT_LEAST16_MAX }; ++verify (TYPE_MINIMUM (int_least16_t) == INT_LEAST16_MIN); ++verify (TYPE_MAXIMUM (int_least16_t) == INT_LEAST16_MAX); ++verify_same_types (INT_LEAST16_MIN, (int_least16_t) 0 + 0); ++verify_same_types (INT_LEAST16_MAX, (int_least16_t) 0 + 0); ++ ++int_least32_t c3[3] = { 17, INT_LEAST32_MIN, INT_LEAST32_MAX }; ++verify (TYPE_MINIMUM (int_least32_t) == INT_LEAST32_MIN); ++verify (TYPE_MAXIMUM (int_least32_t) == INT_LEAST32_MAX); ++verify_same_types (INT_LEAST32_MIN, (int_least32_t) 0 + 0); ++verify_same_types (INT_LEAST32_MAX, (int_least32_t) 0 + 0); ++ ++#ifdef INT_LEAST64_MAX ++int_least64_t c4[3] = { 17, INT_LEAST64_MIN, INT_LEAST64_MAX }; ++verify (TYPE_MINIMUM (int_least64_t) == INT_LEAST64_MIN); ++verify (TYPE_MAXIMUM (int_least64_t) == INT_LEAST64_MAX); ++verify_same_types (INT_LEAST64_MIN, (int_least64_t) 0 + 0); ++verify_same_types (INT_LEAST64_MAX, (int_least64_t) 0 + 0); ++#endif ++ ++uint_least8_t d1[2] = { 17, UINT_LEAST8_MAX }; ++verify (TYPE_MAXIMUM (uint_least8_t) == UINT_LEAST8_MAX); ++verify_same_types (UINT_LEAST8_MAX, (uint_least8_t) 0 + 0); ++ ++uint_least16_t d2[2] = { 17, UINT_LEAST16_MAX }; ++verify (TYPE_MAXIMUM (uint_least16_t) == UINT_LEAST16_MAX); ++verify_same_types (UINT_LEAST16_MAX, (uint_least16_t) 0 + 0); ++ ++uint_least32_t d3[2] = { 17, UINT_LEAST32_MAX }; ++verify (TYPE_MAXIMUM (uint_least32_t) == UINT_LEAST32_MAX); ++verify_same_types (UINT_LEAST32_MAX, (uint_least32_t) 0 + 0); ++ ++#ifdef UINT_LEAST64_MAX ++uint_least64_t d4[2] = { 17, UINT_LEAST64_MAX }; ++verify (TYPE_MAXIMUM (uint_least64_t) == UINT_LEAST64_MAX); ++verify_same_types (UINT_LEAST64_MAX, (uint_least64_t) 0 + 0); ++#endif ++ ++#if INT_LEAST8_MIN && INT_LEAST8_MAX && INT_LEAST16_MIN && INT_LEAST16_MAX && INT_LEAST32_MIN && INT_LEAST32_MAX ++/* ok */ ++#else ++err or; ++#endif ++ ++#if UINT_LEAST8_MAX && UINT_LEAST16_MAX && UINT_LEAST32_MAX ++/* ok */ ++#else ++err or; ++#endif ++ ++/* 7.18.1.3. Fastest minimum-width integer types */ ++/* 7.18.2.3. Limits of fastest minimum-width integer types */ ++ ++int_fast8_t e1[3] = { 17, INT_FAST8_MIN, INT_FAST8_MAX }; ++verify (TYPE_MINIMUM (int_fast8_t) == INT_FAST8_MIN); ++verify (TYPE_MAXIMUM (int_fast8_t) == INT_FAST8_MAX); ++verify_same_types (INT_FAST8_MIN, (int_fast8_t) 0 + 0); ++verify_same_types (INT_FAST8_MAX, (int_fast8_t) 0 + 0); ++ ++int_fast16_t e2[3] = { 17, INT_FAST16_MIN, INT_FAST16_MAX }; ++verify (TYPE_MINIMUM (int_fast16_t) == INT_FAST16_MIN); ++verify (TYPE_MAXIMUM (int_fast16_t) == INT_FAST16_MAX); ++verify_same_types (INT_FAST16_MIN, (int_fast16_t) 0 + 0); ++verify_same_types (INT_FAST16_MAX, (int_fast16_t) 0 + 0); ++ ++int_fast32_t e3[3] = { 17, INT_FAST32_MIN, INT_FAST32_MAX }; ++verify (TYPE_MINIMUM (int_fast32_t) == INT_FAST32_MIN); ++verify (TYPE_MAXIMUM (int_fast32_t) == INT_FAST32_MAX); ++verify_same_types (INT_FAST32_MIN, (int_fast32_t) 0 + 0); ++verify_same_types (INT_FAST32_MAX, (int_fast32_t) 0 + 0); ++ ++#ifdef INT_FAST64_MAX ++int_fast64_t e4[3] = { 17, INT_FAST64_MIN, INT_FAST64_MAX }; ++verify (TYPE_MINIMUM (int_fast64_t) == INT_FAST64_MIN); ++verify (TYPE_MAXIMUM (int_fast64_t) == INT_FAST64_MAX); ++verify_same_types (INT_FAST64_MIN, (int_fast64_t) 0 + 0); ++verify_same_types (INT_FAST64_MAX, (int_fast64_t) 0 + 0); ++#endif ++ ++uint_fast8_t f1[2] = { 17, UINT_FAST8_MAX }; ++verify (TYPE_MAXIMUM (uint_fast8_t) == UINT_FAST8_MAX); ++verify_same_types (UINT_FAST8_MAX, (uint_fast8_t) 0 + 0); ++ ++uint_fast16_t f2[2] = { 17, UINT_FAST16_MAX }; ++verify (TYPE_MAXIMUM (uint_fast16_t) == UINT_FAST16_MAX); ++verify_same_types (UINT_FAST16_MAX, (uint_fast16_t) 0 + 0); ++ ++uint_fast32_t f3[2] = { 17, UINT_FAST32_MAX }; ++verify (TYPE_MAXIMUM (uint_fast32_t) == UINT_FAST32_MAX); ++verify_same_types (UINT_FAST32_MAX, (uint_fast32_t) 0 + 0); ++ ++#ifdef UINT_FAST64_MAX ++uint_fast64_t f4[2] = { 17, UINT_FAST64_MAX }; ++verify (TYPE_MAXIMUM (uint_fast64_t) == UINT_FAST64_MAX); ++verify_same_types (UINT_FAST64_MAX, (uint_fast64_t) 0 + 0); ++#endif ++ ++#if INT_FAST8_MIN && INT_FAST8_MAX && INT_FAST16_MIN && INT_FAST16_MAX && INT_FAST32_MIN && INT_FAST32_MAX ++/* ok */ ++#else ++err or; ++#endif ++ ++#if UINT_FAST8_MAX && UINT_FAST16_MAX && UINT_FAST32_MAX ++/* ok */ ++#else ++err or; ++#endif ++ ++/* 7.18.1.4. Integer types capable of holding object pointers */ ++/* 7.18.2.4. Limits of integer types capable of holding object pointers */ ++ ++intptr_t g[3] = { 17, INTPTR_MIN, INTPTR_MAX }; ++verify (TYPE_MINIMUM (intptr_t) == INTPTR_MIN); ++verify (TYPE_MAXIMUM (intptr_t) == INTPTR_MAX); ++verify_same_types (INTPTR_MIN, (intptr_t) 0 + 0); ++verify_same_types (INTPTR_MAX, (intptr_t) 0 + 0); ++ ++uintptr_t h[2] = { 17, UINTPTR_MAX }; ++verify (TYPE_MAXIMUM (uintptr_t) == UINTPTR_MAX); ++verify_same_types (UINTPTR_MAX, (uintptr_t) 0 + 0); ++ ++#if INTPTR_MIN && INTPTR_MAX && UINTPTR_MAX ++/* ok */ ++#else ++err or; ++#endif ++ ++/* 7.18.1.5. Greatest-width integer types */ ++/* 7.18.2.5. Limits of greatest-width integer types */ ++ ++intmax_t i[3] = { INTMAX_C (17), INTMAX_MIN, INTMAX_MAX }; ++verify (TYPE_MINIMUM (intmax_t) == INTMAX_MIN); ++verify (TYPE_MAXIMUM (intmax_t) == INTMAX_MAX); ++verify_same_types (INTMAX_MIN, (intmax_t) 0 + 0); ++verify_same_types (INTMAX_MAX, (intmax_t) 0 + 0); ++ ++uintmax_t j[2] = { UINTMAX_C (17), UINTMAX_MAX }; ++verify (TYPE_MAXIMUM (uintmax_t) == UINTMAX_MAX); ++verify_same_types (UINTMAX_MAX, (uintmax_t) 0 + 0); ++ ++/* As of 2007, Sun C and HP-UX 10.20 cc don't support 'long long' constants in ++ the preprocessor. */ ++#if !(defined __SUNPRO_C || (defined __hpux && !defined __GNUC__)) ++#if INTMAX_MIN && INTMAX_MAX && UINTMAX_MAX ++/* ok */ ++#else ++err or; ++#endif ++#endif ++ ++/* 7.18.3. Limits of other integer types */ ++ ++#include ++ ++verify (TYPE_MINIMUM (ptrdiff_t) == PTRDIFF_MIN); ++verify (TYPE_MAXIMUM (ptrdiff_t) == PTRDIFF_MAX); ++verify_same_types (PTRDIFF_MIN, (ptrdiff_t) 0 + 0); ++verify_same_types (PTRDIFF_MAX, (ptrdiff_t) 0 + 0); ++ ++#if PTRDIFF_MIN && PTRDIFF_MAX ++/* ok */ ++#else ++err or; ++#endif ++ ++#include ++ ++verify (TYPE_MINIMUM (sig_atomic_t) == SIG_ATOMIC_MIN); ++verify (TYPE_MAXIMUM (sig_atomic_t) == SIG_ATOMIC_MAX); ++verify_same_types (SIG_ATOMIC_MIN, (sig_atomic_t) 0 + 0); ++verify_same_types (SIG_ATOMIC_MAX, (sig_atomic_t) 0 + 0); ++ ++#if SIG_ATOMIC_MIN != 17 && SIG_ATOMIC_MAX ++/* ok */ ++#else ++err or; ++#endif ++ ++verify (TYPE_MAXIMUM (size_t) == SIZE_MAX); ++verify_same_types (SIZE_MAX, (size_t) 0 + 0); ++ ++#if SIZE_MAX ++/* ok */ ++#else ++err or; ++#endif ++ ++#if HAVE_WCHAR_T ++verify (TYPE_MINIMUM (wchar_t) == WCHAR_MIN); ++verify (TYPE_MAXIMUM (wchar_t) == WCHAR_MAX); ++verify_same_types (WCHAR_MIN, (wchar_t) 0 + 0); ++verify_same_types (WCHAR_MAX, (wchar_t) 0 + 0); ++ ++# if WCHAR_MIN != 17 && WCHAR_MAX ++/* ok */ ++# else ++err or; ++# endif ++#endif ++ ++#if HAVE_WINT_T ++# include ++ ++verify (TYPE_MINIMUM (wint_t) == WINT_MIN); ++verify (TYPE_MAXIMUM (wint_t) == WINT_MAX); ++verify_same_types (WINT_MIN, (wint_t) 0 + 0); ++verify_same_types (WINT_MAX, (wint_t) 0 + 0); ++ ++# if WINT_MIN != 17 && WINT_MAX ++/* ok */ ++# else ++err or; ++# endif ++#endif ++ ++/* 7.18.4. Macros for integer constants */ ++ ++verify (INT8_C (17) == 17); ++verify_same_types (INT8_C (17), (int_least8_t)0 + 0); ++verify (UINT8_C (17) == 17); ++verify_same_types (UINT8_C (17), (uint_least8_t)0 + 0); ++ ++verify (INT16_C (17) == 17); ++verify_same_types (INT16_C (17), (int_least16_t)0 + 0); ++verify (UINT16_C (17) == 17); ++verify_same_types (UINT16_C (17), (uint_least16_t)0 + 0); ++ ++verify (INT32_C (17) == 17); ++verify_same_types (INT32_C (17), (int_least32_t)0 + 0); ++verify (UINT32_C (17) == 17); ++verify_same_types (UINT32_C (17), (uint_least32_t)0 + 0); ++ ++#ifdef INT64_C ++verify (INT64_C (17) == 17); ++verify_same_types (INT64_C (17), (int_least64_t)0 + 0); ++#endif ++#ifdef UINT64_C ++verify (UINT64_C (17) == 17); ++verify_same_types (UINT64_C (17), (uint_least64_t)0 + 0); ++#endif ++ ++verify (INTMAX_C (17) == 17); ++verify_same_types (INTMAX_C (17), (intmax_t)0 + 0); ++verify (UINTMAX_C (17) == 17); ++verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0); ++ ++ ++int ++main () ++{ ++ return 0; ++} +diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-stdio.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdio.c +--- gtk-vnc-0.3.7.mingw/gnulib/tests/test-stdio.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-stdio.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,30 @@ ++/* Test of substitute. ++ Copyright (C) 2007 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Written by Bruno Haible , 2007. */ ++ ++#include ++ ++#include ++ ++/* Check that the various SEEK_* macros are defined. */ ++int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET }; ++ ++int ++main () ++{ ++ return 0; ++} +diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-sys_socket.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-sys_socket.c +--- gtk-vnc-0.3.7.mingw/gnulib/tests/test-sys_socket.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-sys_socket.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,47 @@ ++/* Test of substitute. ++ Copyright (C) 2007 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Written by Bruno Haible , 2007. */ ++ ++#include ++ ++#include ++ ++#include ++ ++#if HAVE_SHUTDOWN ++/* Check some integer constant expressions. */ ++int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR }; ++#endif ++ ++int ++main () ++{ ++ /* Check some errno values. */ ++ switch (0) ++ { ++ case ENOTSOCK: ++ case EADDRINUSE: ++ case ENETRESET: ++ case ECONNABORTED: ++ case ECONNRESET: ++ case ENOTCONN: ++ case ESHUTDOWN: ++ break; ++ } ++ ++ return 0; ++} +diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-vasnprintf.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-vasnprintf.c +--- gtk-vnc-0.3.7.mingw/gnulib/tests/test-vasnprintf.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-vasnprintf.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,128 @@ ++/* Test of vasnprintf() and asnprintf() functions. ++ Copyright (C) 2007-2008 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Written by Bruno Haible , 2007. */ ++ ++#include ++ ++#include "vasnprintf.h" ++ ++#include ++#include ++#include ++#include ++ ++#define ASSERT(expr) \ ++ do \ ++ { \ ++ if (!(expr)) \ ++ { \ ++ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ ++ fflush (stderr); \ ++ abort (); \ ++ } \ ++ } \ ++ while (0) ++ ++static char * ++my_asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) ++{ ++ va_list args; ++ char *ret; ++ ++ va_start (args, format); ++ ret = vasnprintf (resultbuf, lengthp, format, args); ++ va_end (args); ++ return ret; ++} ++ ++static void ++test_vasnprintf () ++{ ++ char buf[8]; ++ int size; ++ ++ for (size = 0; size <= 8; size++) ++ { ++ size_t length = size; ++ char *result = my_asnprintf (NULL, &length, "%d", 12345); ++ ASSERT (result != NULL); ++ ASSERT (strcmp (result, "12345") == 0); ++ ASSERT (length == 5); ++ free (result); ++ } ++ ++ for (size = 0; size <= 8; size++) ++ { ++ size_t length; ++ char *result; ++ ++ memcpy (buf, "DEADBEEF", 8); ++ length = size; ++ result = my_asnprintf (buf, &length, "%d", 12345); ++ ASSERT (result != NULL); ++ ASSERT (strcmp (result, "12345") == 0); ++ ASSERT (length == 5); ++ if (size < 6) ++ ASSERT (result != buf); ++ ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); ++ if (result != buf) ++ free (result); ++ } ++} ++ ++static void ++test_asnprintf () ++{ ++ char buf[8]; ++ int size; ++ ++ for (size = 0; size <= 8; size++) ++ { ++ size_t length = size; ++ char *result = asnprintf (NULL, &length, "%d", 12345); ++ ASSERT (result != NULL); ++ ASSERT (strcmp (result, "12345") == 0); ++ ASSERT (length == 5); ++ free (result); ++ } ++ ++ for (size = 0; size <= 8; size++) ++ { ++ size_t length; ++ char *result; ++ ++ memcpy (buf, "DEADBEEF", 8); ++ length = size; ++ result = asnprintf (buf, &length, "%d", 12345); ++ ASSERT (result != NULL); ++ ASSERT (strcmp (result, "12345") == 0); ++ ASSERT (length == 5); ++ if (size < 6) ++ ASSERT (result != buf); ++ ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); ++ if (result != buf) ++ free (result); ++ } ++} ++ ++int ++main (int argc, char *argv[]) ++{ ++ test_vasnprintf (); ++ test_asnprintf (); ++ return 0; ++} +diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-vc-list-files-cvs.sh gtk-vnc-0.3.7.gnulib/gnulib/tests/test-vc-list-files-cvs.sh +--- gtk-vnc-0.3.7.mingw/gnulib/tests/test-vc-list-files-cvs.sh 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-vc-list-files-cvs.sh 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,62 @@ ++#!/bin/sh ++# Unit tests for vc-list-files ++# Copyright (C) 2008 Free Software Foundation, Inc. ++# This file is part of the GNUlib Library. ++# ++# This program is free software: you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . */ ++ ++tmpdir=vc-cvs-$$ ++trap 'st=$?; cd '"`pwd`"' && rm -rf $tmpdir; exit $st' 0 ++trap '(exit $?); exit $?' 1 2 13 15 ++ ++if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then ++ compare() { diff -u "$@"; } ++elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then ++ compare() { cmp -s "$@"; } ++else ++ compare() { cmp "$@"; } ++fi ++ ++repo=`pwd`/$tmpdir/repo ++ ++fail=0 ++for i in with-cvsu without; do ++ # On the first iteration, test using cvsu, if it's in your path. ++ # On the second iteration, ensure that cvsu fails, so we'll ++ # exercise the awk-using code. ++ if test $i = without; then ++ printf '%s\n' '#!/bin/sh' 'exit 1' > cvsu ++ chmod a+x cvsu ++ PATH=`pwd`:$PATH ++ export PATH ++ fi ++ ok=0 ++ mkdir $tmpdir && cd $tmpdir && ++ # without cvs, skip the test ++ # The double use of 'exit' is needed for the reference to $? inside the trap. ++ { ( cvs -Q -d "$repo" init ) > /dev/null 2>&1 \ ++ || { echo "Skipping test: cvs not found in PATH"; (exit 77); exit 77; }; } && ++ mkdir w && cd w && ++ mkdir d && ++ touch d/a b c && ++ cvs -Q -d "$repo" import -m imp m M M0 && ++ cvs -Q -d "$repo" co m && cd m && ++ printf '%s\n' b c d/a > expected && ++ vc-list-files | sort > actual && ++ compare expected actual && ++ ok=1 ++ test $ok = 0 && fail=1 ++done ++ ++(exit $fail); exit $fail +diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-vc-list-files-git.sh gtk-vnc-0.3.7.gnulib/gnulib/tests/test-vc-list-files-git.sh +--- gtk-vnc-0.3.7.mingw/gnulib/tests/test-vc-list-files-git.sh 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-vc-list-files-git.sh 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,46 @@ ++#!/bin/sh ++# Unit tests for vc-list-files ++# Copyright (C) 2008 Free Software Foundation, Inc. ++# This file is part of the GNUlib Library. ++# ++# This program is free software: you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . */ ++ ++if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then ++ compare() { diff -u "$@"; } ++elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then ++ compare() { cmp -s "$@"; } ++else ++ compare() { cmp "$@"; } ++fi ++ ++tmpdir=vc-git-$$ ++trap 'st=$?; cd '"`pwd`"' && rm -rf $tmpdir; exit $st' 0 ++trap '(exit $?); exit $?' 1 2 13 15 ++ ++fail=1 ++mkdir $tmpdir && cd $tmpdir && ++ # without git, skip the test ++ # The double use of 'exit' is needed for the reference to $? inside the trap. ++ { ( git init -q ) > /dev/null 2>&1 \ ++ || { echo "Skipping test: git not found in PATH"; (exit 77); exit 77; }; } && ++ mkdir d && ++ touch d/a b c && ++ git add . > /dev/null && ++ git commit -q -a -m log && ++ printf '%s\n' b c d/a > expected && ++ vc-list-files > actual && ++ compare expected actual && ++ fail=0 ++ ++(exit $fail); exit $fail +diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/test-wchar.c gtk-vnc-0.3.7.gnulib/gnulib/tests/test-wchar.c +--- gtk-vnc-0.3.7.mingw/gnulib/tests/test-wchar.c 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/tests/test-wchar.c 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,31 @@ ++/* Test of substitute. ++ Copyright (C) 2007-2008 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Written by Bruno Haible , 2007. */ ++ ++#include ++ ++#include ++ ++/* Check that the types wchar_t and wint_t are defined. */ ++wchar_t a = 'c'; ++wint_t b = 'x'; ++ ++int ++main () ++{ ++ return 0; ++} +diff -urN gtk-vnc-0.3.7.mingw/gnulib/tests/verify.h gtk-vnc-0.3.7.gnulib/gnulib/tests/verify.h +--- gtk-vnc-0.3.7.mingw/gnulib/tests/verify.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/gnulib/tests/verify.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,140 @@ ++/* Compile-time assert-like macros. ++ ++ Copyright (C) 2005, 2006 Free Software Foundation, Inc. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ ++ ++#ifndef VERIFY_H ++# define VERIFY_H 1 ++ ++/* Each of these macros verifies that its argument R is nonzero. To ++ be portable, R should be an integer constant expression. Unlike ++ assert (R), there is no run-time overhead. ++ ++ There are two macros, since no single macro can be used in all ++ contexts in C. verify_true (R) is for scalar contexts, including ++ integer constant expression contexts. verify (R) is for declaration ++ contexts, e.g., the top level. ++ ++ Symbols ending in "__" are private to this header. ++ ++ The code below uses several ideas. ++ ++ * The first step is ((R) ? 1 : -1). Given an expression R, of ++ integral or boolean or floating-point type, this yields an ++ expression of integral type, whose value is later verified to be ++ constant and nonnegative. ++ ++ * Next this expression W is wrapped in a type ++ struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }. ++ If W is negative, this yields a compile-time error. No compiler can ++ deal with a bit-field of negative size. ++ ++ One might think that an array size check would have the same ++ effect, that is, that the type struct { unsigned int dummy[W]; } ++ would work as well. However, inside a function, some compilers ++ (such as C++ compilers and GNU C) allow local parameters and ++ variables inside array size expressions. With these compilers, ++ an array size check would not properly diagnose this misuse of ++ the verify macro: ++ ++ void function (int n) { verify (n < 0); } ++ ++ * For the verify macro, the struct verify_type__ will need to ++ somehow be embedded into a declaration. To be portable, this ++ declaration must declare an object, a constant, a function, or a ++ typedef name. If the declared entity uses the type directly, ++ such as in ++ ++ struct dummy {...}; ++ typedef struct {...} dummy; ++ extern struct {...} *dummy; ++ extern void dummy (struct {...} *); ++ extern struct {...} *dummy (void); ++ ++ two uses of the verify macro would yield colliding declarations ++ if the entity names are not disambiguated. A workaround is to ++ attach the current line number to the entity name: ++ ++ #define GL_CONCAT0(x, y) x##y ++ #define GL_CONCAT(x, y) GL_CONCAT0 (x, y) ++ extern struct {...} * GL_CONCAT(dummy,__LINE__); ++ ++ But this has the problem that two invocations of verify from ++ within the same macro would collide, since the __LINE__ value ++ would be the same for both invocations. ++ ++ A solution is to use the sizeof operator. It yields a number, ++ getting rid of the identity of the type. Declarations like ++ ++ extern int dummy [sizeof (struct {...})]; ++ extern void dummy (int [sizeof (struct {...})]); ++ extern int (*dummy (void)) [sizeof (struct {...})]; ++ ++ can be repeated. ++ ++ * Should the implementation use a named struct or an unnamed struct? ++ Which of the following alternatives can be used? ++ ++ extern int dummy [sizeof (struct {...})]; ++ extern int dummy [sizeof (struct verify_type__ {...})]; ++ extern void dummy (int [sizeof (struct {...})]); ++ extern void dummy (int [sizeof (struct verify_type__ {...})]); ++ extern int (*dummy (void)) [sizeof (struct {...})]; ++ extern int (*dummy (void)) [sizeof (struct verify_type__ {...})]; ++ ++ In the second and sixth case, the struct type is exported to the ++ outer scope; two such declarations therefore collide. GCC warns ++ about the first, third, and fourth cases. So the only remaining ++ possibility is the fifth case: ++ ++ extern int (*dummy (void)) [sizeof (struct {...})]; ++ ++ * This implementation exploits the fact that GCC does not warn about ++ the last declaration mentioned above. If a future version of GCC ++ introduces a warning for this, the problem could be worked around ++ by using code specialized to GCC, e.g.,: ++ ++ #if 4 <= __GNUC__ ++ # define verify(R) \ ++ extern int (* verify_function__ (void)) \ ++ [__builtin_constant_p (R) && (R) ? 1 : -1] ++ #endif ++ ++ * In C++, any struct definition inside sizeof is invalid. ++ Use a template type to work around the problem. */ ++ ++ ++/* Verify requirement R at compile-time, as an integer constant expression. ++ Return 1. */ ++ ++# ifdef __cplusplus ++template ++ struct verify_type__ { unsigned int verify_error_if_negative_size__: w; }; ++# define verify_true(R) \ ++ (!!sizeof (verify_type__<(R) ? 1 : -1>)) ++# else ++# define verify_true(R) \ ++ (!!sizeof \ ++ (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; })) ++# endif ++ ++/* Verify requirement R at compile-time, as a declaration without a ++ trailing ';'. */ ++ ++# define verify(R) extern int (* verify_function__ (void)) [verify_true (R)] ++ ++#endif +diff -urN gtk-vnc-0.3.7.mingw/link-warning.h gtk-vnc-0.3.7.gnulib/link-warning.h +--- gtk-vnc-0.3.7.mingw/link-warning.h 1970-01-01 01:00:00.000000000 +0100 ++++ gtk-vnc-0.3.7.gnulib/link-warning.h 2008-10-09 12:24:39.000000000 +0100 +@@ -0,0 +1,28 @@ ++/* GL_LINK_WARNING("literal string") arranges to emit the literal string as ++ a linker warning on most glibc systems. ++ We use a linker warning rather than a preprocessor warning, because ++ #warning cannot be used inside macros. */ ++#ifndef GL_LINK_WARNING ++ /* This works on platforms with GNU ld and ELF object format. ++ Testing __GLIBC__ is sufficient for asserting that GNU ld is in use. ++ Testing __ELF__ guarantees the ELF object format. ++ Testing __GNUC__ is necessary for the compound expression syntax. */ ++# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__ ++# define GL_LINK_WARNING(message) \ ++ GL_LINK_WARNING1 (__FILE__, __LINE__, message) ++# define GL_LINK_WARNING1(file, line, message) \ ++ GL_LINK_WARNING2 (file, line, message) /* macroexpand file and line */ ++# define GL_LINK_WARNING2(file, line, message) \ ++ GL_LINK_WARNING3 (file ":" #line ": warning: " message) ++# define GL_LINK_WARNING3(message) \ ++ ({ static const char warning[sizeof (message)] \ ++ __attribute__ ((__unused__, \ ++ __section__ (".gnu.warning"), \ ++ __aligned__ (1))) \ ++ = message "\n"; \ ++ (void)0; \ ++ }) ++# else ++# define GL_LINK_WARNING(message) ((void) 0) ++# endif ++#endif diff --git a/gtk-vnc/gtk-vnc-0.3.7-mingw32-socketcompat.patch b/gtk-vnc/gtk-vnc-0.3.7-mingw32-socketcompat.patch new file mode 100644 index 0000000..2c92930 --- /dev/null +++ b/gtk-vnc/gtk-vnc-0.3.7-mingw32-socketcompat.patch @@ -0,0 +1,17 @@ +diff -urN gtk-vnc-0.3.7.mingw/src/socketcompat.h gtk-vnc-0.3.7.socketcompat/src/socketcompat.h +--- gtk-vnc-0.3.7.mingw/src/socketcompat.h 2008-10-09 12:19:03.000000000 +0100 ++++ gtk-vnc-0.3.7.socketcompat/src/socketcompat.h 2008-10-09 12:38:04.000000000 +0100 +@@ -52,13 +52,6 @@ + return WSAGetLastError (); + } + +-/* Compatibility. */ +-#define EWOULDBLOCK WSAEWOULDBLOCK +-#define ECONNREFUSED WSAECONNREFUSED +-#define EINPROGRESS WSAEINPROGRESS +-#define EHOSTUNREACH WSAEHOSTUNREACH +-#define EISCONN WSAEISCONN +- + #endif /* HAVE_WINSOCK2_H */ + + #endif /* __WINSOCKWRAPPER_H__ */ diff --git a/gtk-vnc/mingw32-gtk-vnc.spec b/gtk-vnc/mingw32-gtk-vnc.spec new file mode 100644 index 0000000..e8636d3 --- /dev/null +++ b/gtk-vnc/mingw32-gtk-vnc.spec @@ -0,0 +1,86 @@ +%define __strip %{_mingw32_strip} +%define __objdump %{_mingw32_objdump} +%define _use_internal_dependency_generator 0 +%define __find_requires %{_mingw32_findrequires} +%define __find_provides %{_mingw32_findprovides} + +Name: mingw32-gtk-vnc +Version: 0.3.7 +Release: 1%{?dist} +Summary: MinGW Windows port of VNC client GTK widget + +License: LGPLv2+ +Group: Development/Libraries +URL: http://gtk-vnc.sf.net/ +Source0: http://downloads.sourceforge.net/gtk-vnc/gtk-vnc-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +Patch1: gtk-vnc-0.3.7-abs-ungrab.patch + +# Dan's MinGW patch version 2, fixed so it can apply to the tarball. +Patch100: gtk-vnc-0.3.7-mingw32-dan2.patch + +# Extra files required by Gnulib. +Patch101: gtk-vnc-0.3.7-mingw32-gnulib-files.patch + +# Fix redefined symbols in socketcompat.h. +Patch102: gtk-vnc-0.3.7-mingw32-socketcompat.patch + +BuildArch: noarch + +BuildRequires: mingw32-filesystem >= 30 +BuildRequires: mingw32-gcc +BuildRequires: mingw32-binutils +# XXX + + +%description +# description + + +%prep +%setup -q -n gtk-vnc-%{version} + +%patch1 -p1 + +%patch100 -p1 +%patch101 -p1 +%patch102 -p1 + +autoreconf + + +%build +%{_mingw32_configure} --without-python --with-examples +make + + +%install +rm -rf $RPM_BUILD_ROOT +make DESTDIR=$RPM_BUILD_ROOT install + +# Remove static libraries but DON'T remove *.dll.a files. +rm $RPM_BUILD_ROOT%{_mingw32_libdir}/libgtk-vnc-1.0.a + +# automake gives gvncviewer a strange name ... +mv $RPM_BUILD_ROOT%{_mingw32_bindir}/i686-pc-mingw32-gvncviewer.exe \ + $RPM_BUILD_ROOT%{_mingw32_bindir}/gvncviewer.exe \ + + +%clean +rm -rf $RPM_BUILD_ROOT + + +%files +%defattr(-,root,root) +%{_mingw32_bindir}/gvncviewer.exe +%{_mingw32_bindir}/libgtk-vnc-1.0-0.dll +%{_mingw32_libdir}/libgtk-vnc-1.0.dll.a +%{_mingw32_libdir}/libgtk-vnc-1.0.la +%{_mingw32_libdir}/pkgconfig/gtk-vnc-1.0.pc +%{_mingw32_includedir}/gtk-vnc-1.0 + + +%changelog +* Wed Sep 24 2008 Your Name - 1.2.3-1 +- Initial RPM release. -- 1.8.3.1