gl_SOURCE_BASE(gl)
gl_M4_BASE(gl/m4)
-gl_MODULES(getline error exit progname getpass-gnu)
+gl_MODULES(getline error exit progname getpass-gnu minmax)
gl_INIT
AC_MSG_RESULT([***
# Generated by gnulib-tool.
#
# Invoked as: gnulib-tool --import
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --libtool error exit extensions getline getpass-gnu gettext progname stdbool unlocked-io
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --libtool error exit extensions getline getpass-gnu gettext minmax progname stdbool unlocked-io
AUTOMAKE_OPTIONS = 1.8 gnits
libgnu_la_SOURCES += gettext.h
+libgnu_la_SOURCES += minmax.h
+
libgnu_la_SOURCES += progname.h progname.c
BUILT_SOURCES += $(STDBOOL_H)
# Generated by gnulib-tool.
#
# Invoked as: gnulib-tool --import
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --libtool error exit extensions getline getpass-gnu gettext progname stdbool unlocked-io
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --libtool error exit extensions getline getpass-gnu gettext minmax progname stdbool unlocked-io
AC_DEFUN([gl_EARLY],
[
--- /dev/null
+/* MIN, MAX macros.
+ Copyright (C) 1995, 1998, 2001, 2003 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 2, 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, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef _MINMAX_H
+#define _MINMAX_H
+
+/* Note: MIN, MAX are also defined in <sys/param.h> on some systems
+ (glibc, IRIX, HP-UX, OSF/1). Therefore you might get warnings about
+ MIN, MAX macro redefinitions on some systems; the workaround is to
+ #include this file as the last one among the #include list. */
+
+/* Before we define the following symbols we get the <limits.h> file
+ since otherwise we get redefinitions on some systems. */
+#include <limits.h>
+
+/* Note: MIN and MAX should be used with two arguments of the
+ same type. They might not return the minimum and maximum of their two
+ arguments, if the arguments have different types or have unusual
+ floating-point values. For example, on a typical host with 32-bit 'int',
+ 64-bit 'long long', and 64-bit IEEE 754 'double' types:
+
+ MAX (-1, 2147483648) returns 4294967295.
+ MAX (9007199254740992.0, 9007199254740993) returns 9007199254740992.0.
+ MAX (NaN, 0.0) returns 0.0.
+ MAX (+0.0, -0.0) returns -0.0.
+
+ and in each case the answer is in some sense bogus. */
+
+/* MAX(a,b) returns the maximum of A and B. */
+#ifndef MAX
+# define MAX(a,b) ((a) > (b) ? (a) : (b))
+#endif
+
+/* MIN(a,b) returns the minimum of A and B. */
+#ifndef MIN
+# define MIN(a,b) ((a) < (b) ? (a) : (b))
+#endif
+
+#endif /* _MINMAX_H */
-INCLUDES = -I$(top_srcdir)/crypto -I$(top_srcdir)/libextra -I$(srcdir)/minitasn1 -I$(top_srcdir)/libextra/openpgp/ -I$(top_srcdir)/libextra/opencdk -I$(srcdir)/x509 -I$(top_srcdir)/includes $(LIBOPENCDK_CFLAGS) $(LIBTASN1_CFLAGS) $(LIBGCRYPT_CFLAGS)
+INCLUDES = -I$(top_srcdir)/crypto -I$(top_srcdir)/gl -I$(top_srcdir)/libextra -I$(srcdir)/minitasn1 -I$(top_srcdir)/libextra/openpgp/ -I$(top_srcdir)/libextra/opencdk -I$(srcdir)/x509 -I$(top_srcdir)/includes $(LIBOPENCDK_CFLAGS) $(LIBTASN1_CFLAGS) $(LIBGCRYPT_CFLAGS)
bin_SCRIPTS = libgnutls-config
m4datadir = $(datadir)/aclocal
while ((line[i] != ':') && (line[i] != '\0') && (i < sizeof(line))) {
i++;
}
- if (strncmp(indexstr, line, GMAX(i, len)) == 0) {
+ if (strncmp(indexstr, line, MAX(i, len)) == 0) {
if ((index = pwd_put_values2(entry, line)) >= 0)
return 0;
else {
i++;
}
- if (strncmp(username, line, GMAX(i, len)) == 0) {
+ if (strncmp(username, line, MAX(i, len)) == 0) {
if ((index = pwd_put_values(entry, line)) >= 0) {
/* Keep the last index in memory, so we can retrieve fake parameters (g,n)
* when the user does not exist.
return 0;
if (cred->username != NULL) { /* send username */
- len = GMIN(strlen(cred->username), 255);
+ len = MIN(strlen(cred->username), 255);
if (data_size < len + 1) {
gnutls_assert();
return 0;
}
- len = GMIN(strlen(username), 255);
+ len = MIN(strlen(username), 255);
if (data_size < len + 1) {
gnutls_free(username);
/* calculate the actual size, ie. get the minimum of the
* buffered data and the requested data.
*/
- min = GMIN(session->internals.record_recv_buffer.length, sizeOfPtr);
+ min = MIN(session->internals.record_recv_buffer.length, sizeOfPtr);
if (min > 0) {
/* if we have enough buffered data
* then just return them.
if (ret < 0 || ret2 < 0) {
gnutls_assert();
/* that's because they are initialized to 0 */
- return GMIN(ret, ret2);
+ return MIN(ret, ret2);
}
ret += ret2;
/*
+ * Copyright (C) 2004 Simon Josefsson
* Copyright (C) 2000,2003 Nikos Mavroyanopoulos
*
* This file is part of GNUTLS.
#include <gnutls_int.h>
-#define GMIN(x,y) ((x<y)?x:y)
-#define GMAX(x,y) ((x>y)?x:y)
+#include <minmax.h>
#define rotl32(x,n) (((x) << ((uint16)(n))) | ((x) >> (32 - (uint16)(n))))
#define rotr32(x,n) (((x) >> ((uint16)(n))) | ((x) << (32 - (uint16)(n))))
if (i < 2)
ps[i] = rnd[i];
else
- ps[i] = GMAX(rnd[2] + ps[i - 1] + ps[i - 2], rnd[1]);
+ ps[i] = MAX(rnd[2] + ps[i - 1] + ps[i - 2], rnd[1]);
}
}
break;
return src_len;
} else {
dest->data =
- dest->realloc_func(dest->data, GMAX(src_len, MIN_CHUNK));
+ dest->realloc_func(dest->data, MAX(src_len, MIN_CHUNK));
if (dest->data == NULL) {
gnutls_assert();
return GNUTLS_E_MEMORY_ERROR;
}
- dest->max_length = GMAX(MIN_CHUNK, src_len);
+ dest->max_length = MAX(MIN_CHUNK, src_len);
memcpy(dest->data, src, src_len);
dest->length = src_len;
return tot_len;
} else {
size_t new_len =
- GMAX(src_len, MIN_CHUNK) + GMAX(dest->max_length, MIN_CHUNK);
+ MAX(src_len, MIN_CHUNK) + MAX(dest->max_length, MIN_CHUNK);
dest->data = dest->realloc_func(dest->data, new_len);
if (dest->data == NULL) {
return tot_len;
} else {
size_t new_len =
- GMAX(data_size, MIN_CHUNK) + GMAX(dest->max_length, MIN_CHUNK);
+ MAX(data_size, MIN_CHUNK) + MAX(dest->max_length, MIN_CHUNK);
dest->data = dest->realloc_func(dest->data, new_len);
if (dest->data == NULL) {
if (str == NULL || buffer == NULL)
return NULL;
- str_length = GMIN(strlen(str), buffer_size - 1);
+ str_length = MIN(strlen(str), buffer_size - 1);
for (i = j = 0; i < str_length; i++) {
if (str[i] == ',' || str[i] == '+' || str[i] == '"'
goto cleanup;
}
- bag->bag_elements = GMIN(MAX_BAG_ELEMENTS, count);
+ bag->bag_elements = MIN(MAX_BAG_ELEMENTS, count);
for (i = 0; i < bag->bag_elements; i++) {
if (schema == PBES2)
kdf_params->salt_size =
- GMIN(sizeof(kdf_params->salt), (uint) (10 + (rnd[1] % 10)));
+ MIN(sizeof(kdf_params->salt), (uint) (10 + (rnd[1] % 10)));
else
kdf_params->salt_size = 8;
#include <gnutls_cert.h>
#include <libtasn1.h>
#include <gnutls_global.h>
-#include <gnutls_num.h> /* GMAX */
+#include <gnutls_num.h> /* MAX */
#include <gnutls_sig.h>
#include <gnutls_str.h>
#include <gnutls_datum.h>
#include <gnutls_cert.h>
#include <libtasn1.h>
#include <gnutls_global.h>
-#include <gnutls_num.h> /* GMAX */
+#include <gnutls_num.h> /* MAX */
#include <gnutls_sig.h>
#include <gnutls_str.h>
#include <gnutls_datum.h>
-INCLUDES = -I$(top_srcdir)/crypto -I$(top_srcdir)/lib -I$(top_srcdir)/includes -I$(top_srcdir)/lib/minitasn1 $(LIBOPENCDK_CFLAGS) $(LIBGCRYPT_CFLAGS) $(LIBTASN1_CFLAGS) -I$(srcdir)/opencdk -I$(srcdir)/openpgp
+INCLUDES = -I$(top_srcdir)/crypto -I$(top_srcdir)/gl -I$(top_srcdir)/lib -I$(top_srcdir)/includes -I$(top_srcdir)/lib/minitasn1 $(LIBOPENCDK_CFLAGS) $(LIBGCRYPT_CFLAGS) $(LIBTASN1_CFLAGS) -I$(srcdir)/opencdk -I$(srcdir)/openpgp
AM_CFLAGS = -DVERSION=\"gnutls/opencdk\"
bin_SCRIPTS = libgnutls-extra-config
DIST_SUBDIRS = openpgp opencdk