diff options
| author | Paul Eggert | 2011-02-20 00:48:52 -0800 |
|---|---|---|
| committer | Paul Eggert | 2011-02-20 00:48:52 -0800 |
| commit | 61353ac8cdbdda53d75f5ab9aa7f0b637aee5a00 (patch) | |
| tree | 2cfc088246ad9c97eea1ba1c7a1b7e5af64bea2d /lib | |
| parent | 01baa1e6f227a87530f65b7e45049968a1afc12a (diff) | |
| parent | ff05203ec64be4e2148ca607d4f7e04375426916 (diff) | |
| download | emacs-61353ac8cdbdda53d75f5ab9aa7f0b637aee5a00.tar.gz emacs-61353ac8cdbdda53d75f5ab9aa7f0b637aee5a00.zip | |
Merge: Import crypto/md5 and stdint modules from gnulib.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Makefile.in | 95 | ||||
| -rw-r--r-- | lib/gnulib.mk | 55 | ||||
| -rw-r--r-- | lib/md5.c | 462 | ||||
| -rw-r--r-- | lib/md5.h | 126 | ||||
| -rw-r--r-- | lib/stdint.in.h | 592 |
5 files changed, 1313 insertions, 17 deletions
diff --git a/lib/Makefile.in b/lib/Makefile.in index 82e23967865..0029719373a 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | # the same distribution terms as the rest of that program. | 24 | # the same distribution terms as the rest of that program. |
| 25 | # | 25 | # |
| 26 | # Generated by gnulib-tool. | 26 | # Generated by gnulib-tool. |
| 27 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr getloadavg getopt-gnu ignore-value mktime strftime | 27 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr getloadavg getopt-gnu ignore-value mktime strftime |
| 28 | 28 | ||
| 29 | VPATH = @srcdir@ | 29 | VPATH = @srcdir@ |
| 30 | pkgdatadir = $(datadir)/@PACKAGE@ | 30 | pkgdatadir = $(datadir)/@PACKAGE@ |
| @@ -53,13 +53,14 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ | |||
| 53 | $(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/extensions.m4 \ | 53 | $(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/extensions.m4 \ |
| 54 | $(top_srcdir)/m4/getloadavg.m4 $(top_srcdir)/m4/getopt.m4 \ | 54 | $(top_srcdir)/m4/getloadavg.m4 $(top_srcdir)/m4/getopt.m4 \ |
| 55 | $(top_srcdir)/m4/gl-comp.m4 $(top_srcdir)/m4/gnulib-common.m4 \ | 55 | $(top_srcdir)/m4/gl-comp.m4 $(top_srcdir)/m4/gnulib-common.m4 \ |
| 56 | $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/mktime.m4 \ | 56 | $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/longlong.m4 \ |
| 57 | $(top_srcdir)/m4/md5.m4 $(top_srcdir)/m4/mktime.m4 \ | ||
| 57 | $(top_srcdir)/m4/multiarch.m4 $(top_srcdir)/m4/stdbool.m4 \ | 58 | $(top_srcdir)/m4/multiarch.m4 $(top_srcdir)/m4/stdbool.m4 \ |
| 58 | $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \ | 59 | $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \ |
| 59 | $(top_srcdir)/m4/strftime.m4 $(top_srcdir)/m4/time_h.m4 \ | 60 | $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strftime.m4 \ |
| 60 | $(top_srcdir)/m4/time_r.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \ | 61 | $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \ |
| 61 | $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/wchar_t.m4 \ | 62 | $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/unistd_h.m4 \ |
| 62 | $(top_srcdir)/configure.in | 63 | $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/configure.in |
| 63 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ | 64 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
| 64 | $(ACLOCAL_M4) | 65 | $(ACLOCAL_M4) |
| 65 | mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs | 66 | mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs |
| @@ -95,6 +96,11 @@ AUTOCONF = @AUTOCONF@ | |||
| 95 | AUTOHEADER = @AUTOHEADER@ | 96 | AUTOHEADER = @AUTOHEADER@ |
| 96 | AUTOMAKE = @AUTOMAKE@ | 97 | AUTOMAKE = @AUTOMAKE@ |
| 97 | AWK = @AWK@ | 98 | AWK = @AWK@ |
| 99 | BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ | ||
| 100 | BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ | ||
| 101 | BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ | ||
| 102 | BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ | ||
| 103 | BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ | ||
| 98 | BLESSMAIL_TARGET = @BLESSMAIL_TARGET@ | 104 | BLESSMAIL_TARGET = @BLESSMAIL_TARGET@ |
| 99 | CANNOT_DUMP = @CANNOT_DUMP@ | 105 | CANNOT_DUMP = @CANNOT_DUMP@ |
| 100 | CC = @CC@ | 106 | CC = @CC@ |
| @@ -244,9 +250,11 @@ HAVE_GETOPT_H = @HAVE_GETOPT_H@ | |||
| 244 | HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ | 250 | HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ |
| 245 | HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ | 251 | HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ |
| 246 | HAVE_GRANTPT = @HAVE_GRANTPT@ | 252 | HAVE_GRANTPT = @HAVE_GRANTPT@ |
| 253 | HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ | ||
| 247 | HAVE_LCHOWN = @HAVE_LCHOWN@ | 254 | HAVE_LCHOWN = @HAVE_LCHOWN@ |
| 248 | HAVE_LINK = @HAVE_LINK@ | 255 | HAVE_LINK = @HAVE_LINK@ |
| 249 | HAVE_LINKAT = @HAVE_LINKAT@ | 256 | HAVE_LINKAT = @HAVE_LINKAT@ |
| 257 | HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ | ||
| 250 | HAVE_MAKEINFO = @HAVE_MAKEINFO@ | 258 | HAVE_MAKEINFO = @HAVE_MAKEINFO@ |
| 251 | HAVE_MKDTEMP = @HAVE_MKDTEMP@ | 259 | HAVE_MKDTEMP = @HAVE_MKDTEMP@ |
| 252 | HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ | 260 | HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ |
| @@ -267,7 +275,11 @@ HAVE_READLINKAT = @HAVE_READLINKAT@ | |||
| 267 | HAVE_REALPATH = @HAVE_REALPATH@ | 275 | HAVE_REALPATH = @HAVE_REALPATH@ |
| 268 | HAVE_RPMATCH = @HAVE_RPMATCH@ | 276 | HAVE_RPMATCH = @HAVE_RPMATCH@ |
| 269 | HAVE_SETENV = @HAVE_SETENV@ | 277 | HAVE_SETENV = @HAVE_SETENV@ |
| 278 | HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ | ||
| 279 | HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ | ||
| 280 | HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ | ||
| 270 | HAVE_SLEEP = @HAVE_SLEEP@ | 281 | HAVE_SLEEP = @HAVE_SLEEP@ |
| 282 | HAVE_STDINT_H = @HAVE_STDINT_H@ | ||
| 271 | HAVE_STRPTIME = @HAVE_STRPTIME@ | 283 | HAVE_STRPTIME = @HAVE_STRPTIME@ |
| 272 | HAVE_STRTOD = @HAVE_STRTOD@ | 284 | HAVE_STRTOD = @HAVE_STRTOD@ |
| 273 | HAVE_STRTOLL = @HAVE_STRTOLL@ | 285 | HAVE_STRTOLL = @HAVE_STRTOLL@ |
| @@ -275,13 +287,18 @@ HAVE_STRTOULL = @HAVE_STRTOULL@ | |||
| 275 | HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ | 287 | HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ |
| 276 | HAVE_SYMLINK = @HAVE_SYMLINK@ | 288 | HAVE_SYMLINK = @HAVE_SYMLINK@ |
| 277 | HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ | 289 | HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ |
| 290 | HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ | ||
| 291 | HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ | ||
| 278 | HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ | 292 | HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ |
| 279 | HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ | 293 | HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ |
| 294 | HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ | ||
| 280 | HAVE_TIMEGM = @HAVE_TIMEGM@ | 295 | HAVE_TIMEGM = @HAVE_TIMEGM@ |
| 281 | HAVE_UNISTD_H = @HAVE_UNISTD_H@ | 296 | HAVE_UNISTD_H = @HAVE_UNISTD_H@ |
| 282 | HAVE_UNLINKAT = @HAVE_UNLINKAT@ | 297 | HAVE_UNLINKAT = @HAVE_UNLINKAT@ |
| 283 | HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ | 298 | HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ |
| 299 | HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ | ||
| 284 | HAVE_USLEEP = @HAVE_USLEEP@ | 300 | HAVE_USLEEP = @HAVE_USLEEP@ |
| 301 | HAVE_WCHAR_H = @HAVE_WCHAR_H@ | ||
| 285 | HAVE_WCHAR_T = @HAVE_WCHAR_T@ | 302 | HAVE_WCHAR_T = @HAVE_WCHAR_T@ |
| 286 | HAVE_XSERVER = @HAVE_XSERVER@ | 303 | HAVE_XSERVER = @HAVE_XSERVER@ |
| 287 | HAVE__BOOL = @HAVE__BOOL@ | 304 | HAVE__BOOL = @HAVE__BOOL@ |
| @@ -350,11 +367,13 @@ MOUSE_SUPPORT = @MOUSE_SUPPORT@ | |||
| 350 | M_FILE = @M_FILE@ | 367 | M_FILE = @M_FILE@ |
| 351 | NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ | 368 | NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ |
| 352 | NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ | 369 | NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ |
| 370 | NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ | ||
| 353 | NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@ | 371 | NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@ |
| 354 | NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ | 372 | NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ |
| 355 | NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ | 373 | NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ |
| 356 | NEXT_GETOPT_H = @NEXT_GETOPT_H@ | 374 | NEXT_GETOPT_H = @NEXT_GETOPT_H@ |
| 357 | NEXT_STDDEF_H = @NEXT_STDDEF_H@ | 375 | NEXT_STDDEF_H = @NEXT_STDDEF_H@ |
| 376 | NEXT_STDINT_H = @NEXT_STDINT_H@ | ||
| 358 | NEXT_STDLIB_H = @NEXT_STDLIB_H@ | 377 | NEXT_STDLIB_H = @NEXT_STDLIB_H@ |
| 359 | NEXT_TIME_H = @NEXT_TIME_H@ | 378 | NEXT_TIME_H = @NEXT_TIME_H@ |
| 360 | NEXT_UNISTD_H = @NEXT_UNISTD_H@ | 379 | NEXT_UNISTD_H = @NEXT_UNISTD_H@ |
| @@ -381,6 +400,7 @@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ | |||
| 381 | PRE_ALLOC_OBJ = @PRE_ALLOC_OBJ@ | 400 | PRE_ALLOC_OBJ = @PRE_ALLOC_OBJ@ |
| 382 | PROFILING_CFLAGS = @PROFILING_CFLAGS@ | 401 | PROFILING_CFLAGS = @PROFILING_CFLAGS@ |
| 383 | PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ | 402 | PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ |
| 403 | PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ | ||
| 384 | RALLOC_OBJ = @RALLOC_OBJ@ | 404 | RALLOC_OBJ = @RALLOC_OBJ@ |
| 385 | RANLIB = @RANLIB@ | 405 | RANLIB = @RANLIB@ |
| 386 | REPLACE_CALLOC = @REPLACE_CALLOC@ | 406 | REPLACE_CALLOC = @REPLACE_CALLOC@ |
| @@ -427,9 +447,12 @@ RSVG_CFLAGS = @RSVG_CFLAGS@ | |||
| 427 | RSVG_LIBS = @RSVG_LIBS@ | 447 | RSVG_LIBS = @RSVG_LIBS@ |
| 428 | SET_MAKE = @SET_MAKE@ | 448 | SET_MAKE = @SET_MAKE@ |
| 429 | SHELL = @SHELL@ | 449 | SHELL = @SHELL@ |
| 450 | SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ | ||
| 451 | SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ | ||
| 430 | START_FILES = @START_FILES@ | 452 | START_FILES = @START_FILES@ |
| 431 | STDBOOL_H = @STDBOOL_H@ | 453 | STDBOOL_H = @STDBOOL_H@ |
| 432 | STDDEF_H = @STDDEF_H@ | 454 | STDDEF_H = @STDDEF_H@ |
| 455 | STDINT_H = @STDINT_H@ | ||
| 433 | STRIP = @STRIP@ | 456 | STRIP = @STRIP@ |
| 434 | SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ | 457 | SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ |
| 435 | S_FILE = @S_FILE@ | 458 | S_FILE = @S_FILE@ |
| @@ -443,8 +466,10 @@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ | |||
| 443 | UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ | 466 | UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ |
| 444 | VERSION = @VERSION@ | 467 | VERSION = @VERSION@ |
| 445 | VMLIMIT_OBJ = @VMLIMIT_OBJ@ | 468 | VMLIMIT_OBJ = @VMLIMIT_OBJ@ |
| 469 | WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ | ||
| 446 | WIDGET_OBJ = @WIDGET_OBJ@ | 470 | WIDGET_OBJ = @WIDGET_OBJ@ |
| 447 | WINDOW_SUPPORT = @WINDOW_SUPPORT@ | 471 | WINDOW_SUPPORT = @WINDOW_SUPPORT@ |
| 472 | WINT_T_SUFFIX = @WINT_T_SUFFIX@ | ||
| 448 | XFT_CFLAGS = @XFT_CFLAGS@ | 473 | XFT_CFLAGS = @XFT_CFLAGS@ |
| 449 | XFT_LIBS = @XFT_LIBS@ | 474 | XFT_LIBS = @XFT_LIBS@ |
| 450 | XMENU_OBJ = @XMENU_OBJ@ | 475 | XMENU_OBJ = @XMENU_OBJ@ |
| @@ -534,23 +559,25 @@ x_default_search_path = @x_default_search_path@ | |||
| 534 | # present in all Makefile.am that need it. This is ensured by the applicability | 559 | # present in all Makefile.am that need it. This is ensured by the applicability |
| 535 | # 'all' defined above. | 560 | # 'all' defined above. |
| 536 | BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) $(STDBOOL_H) \ | 561 | BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) $(STDBOOL_H) \ |
| 537 | $(STDDEF_H) stdlib.h time.h unistd.h warn-on-use.h | 562 | $(STDDEF_H) $(STDINT_H) stdlib.h time.h unistd.h warn-on-use.h |
| 538 | EXTRA_DIST = $(top_srcdir)/./arg-nonnull.h $(top_srcdir)/./c++defs.h \ | 563 | EXTRA_DIST = $(top_srcdir)/./arg-nonnull.h $(top_srcdir)/./c++defs.h \ |
| 539 | ftoastr.c ftoastr.h getloadavg.c getopt.c getopt.in.h \ | 564 | md5.c md5.h ftoastr.c ftoastr.h getloadavg.c getopt.c \ |
| 540 | getopt1.c getopt_int.h intprops.h mktime-internal.h mktime.c \ | 565 | getopt.in.h getopt1.c getopt_int.h intprops.h \ |
| 541 | stdbool.in.h stddef.in.h stdlib.in.h strftime.c strftime.h \ | 566 | mktime-internal.h mktime.c stdbool.in.h stddef.in.h \ |
| 542 | time.in.h time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h | 567 | stdint.in.h stdlib.in.h strftime.c strftime.h time.in.h \ |
| 568 | time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h | ||
| 543 | MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ | 569 | MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ |
| 544 | c++defs.h c++defs.h-t getopt.h getopt.h-t stdbool.h \ | 570 | c++defs.h c++defs.h-t getopt.h getopt.h-t stdbool.h \ |
| 545 | stdbool.h-t stddef.h stddef.h-t stdlib.h stdlib.h-t time.h \ | 571 | stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t stdlib.h \ |
| 546 | time.h-t unistd.h unistd.h-t warn-on-use.h warn-on-use.h-t | 572 | stdlib.h-t time.h time.h-t unistd.h unistd.h-t warn-on-use.h \ |
| 573 | warn-on-use.h-t | ||
| 547 | noinst_LIBRARIES = libgnu.a | 574 | noinst_LIBRARIES = libgnu.a |
| 548 | DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src | 575 | DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src |
| 549 | libgnu_a_SOURCES = dtoastr.c gettext.h ignore-value.h | 576 | libgnu_a_SOURCES = dtoastr.c gettext.h ignore-value.h |
| 550 | libgnu_a_LIBADD = $(gl_LIBOBJS) | 577 | libgnu_a_LIBADD = $(gl_LIBOBJS) |
| 551 | libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) | 578 | libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) |
| 552 | EXTRA_libgnu_a_SOURCES = ftoastr.c getloadavg.c getopt.c getopt1.c \ | 579 | EXTRA_libgnu_a_SOURCES = md5.c ftoastr.c getloadavg.c getopt.c \ |
| 553 | mktime.c strftime.c time_r.c | 580 | getopt1.c mktime.c strftime.c time_r.c |
| 554 | ARG_NONNULL_H = arg-nonnull.h | 581 | ARG_NONNULL_H = arg-nonnull.h |
| 555 | CXXDEFS_H = c++defs.h | 582 | CXXDEFS_H = c++defs.h |
| 556 | WARN_ON_USE_H = warn-on-use.h | 583 | WARN_ON_USE_H = warn-on-use.h |
| @@ -608,6 +635,7 @@ distclean-compile: | |||
| 608 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getloadavg.Po@am__quote@ | 635 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getloadavg.Po@am__quote@ |
| 609 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ | 636 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ |
| 610 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ | 637 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ |
| 638 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Po@am__quote@ | ||
| 611 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mktime.Po@am__quote@ | 639 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mktime.Po@am__quote@ |
| 612 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strftime.Po@am__quote@ | 640 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strftime.Po@am__quote@ |
| 613 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time_r.Po@am__quote@ | 641 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time_r.Po@am__quote@ |
| @@ -882,6 +910,41 @@ stddef.h: stddef.in.h | |||
| 882 | } > $@-t && \ | 910 | } > $@-t && \ |
| 883 | mv $@-t $@ | 911 | mv $@-t $@ |
| 884 | 912 | ||
| 913 | # We need the following in order to create <stdint.h> when the system | ||
| 914 | # doesn't have one that works with the given compiler. | ||
| 915 | stdint.h: stdint.in.h | ||
| 916 | $(AM_V_GEN)rm -f $@-t $@ && \ | ||
| 917 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 918 | sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ | ||
| 919 | -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ | ||
| 920 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 921 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ | ||
| 922 | -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ | ||
| 923 | -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ | ||
| 924 | -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ | ||
| 925 | -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ | ||
| 926 | -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ | ||
| 927 | -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ | ||
| 928 | -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ | ||
| 929 | -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ | ||
| 930 | -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ | ||
| 931 | -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ | ||
| 932 | -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ | ||
| 933 | -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ | ||
| 934 | -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \ | ||
| 935 | -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \ | ||
| 936 | -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \ | ||
| 937 | -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \ | ||
| 938 | -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \ | ||
| 939 | -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \ | ||
| 940 | -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \ | ||
| 941 | -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ | ||
| 942 | -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ | ||
| 943 | -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ | ||
| 944 | < $(srcdir)/stdint.in.h; \ | ||
| 945 | } > $@-t && \ | ||
| 946 | mv $@-t $@ | ||
| 947 | |||
| 885 | # We need the following in order to create <stdlib.h> when the system | 948 | # We need the following in order to create <stdlib.h> when the system |
| 886 | # doesn't have one that works with the given compiler. | 949 | # doesn't have one that works with the given compiler. |
| 887 | stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) | 950 | stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) |
diff --git a/lib/gnulib.mk b/lib/gnulib.mk index 0e7263a002b..3e93e12d9bf 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | # the same distribution terms as the rest of that program. | 9 | # the same distribution terms as the rest of that program. |
| 10 | # | 10 | # |
| 11 | # Generated by gnulib-tool. | 11 | # Generated by gnulib-tool. |
| 12 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr getloadavg getopt-gnu ignore-value mktime strftime | 12 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr getloadavg getopt-gnu ignore-value mktime strftime |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | MOSTLYCLEANFILES += core *.stackdump | 15 | MOSTLYCLEANFILES += core *.stackdump |
| @@ -69,6 +69,15 @@ EXTRA_DIST += $(top_srcdir)/./c++defs.h | |||
| 69 | 69 | ||
| 70 | ## end gnulib module c++defs | 70 | ## end gnulib module c++defs |
| 71 | 71 | ||
| 72 | ## begin gnulib module crypto/md5 | ||
| 73 | |||
| 74 | |||
| 75 | EXTRA_DIST += md5.c md5.h | ||
| 76 | |||
| 77 | EXTRA_libgnu_a_SOURCES += md5.c | ||
| 78 | |||
| 79 | ## end gnulib module crypto/md5 | ||
| 80 | |||
| 72 | ## begin gnulib module dtoastr | 81 | ## begin gnulib module dtoastr |
| 73 | 82 | ||
| 74 | libgnu_a_SOURCES += dtoastr.c | 83 | libgnu_a_SOURCES += dtoastr.c |
| @@ -184,6 +193,50 @@ EXTRA_DIST += stddef.in.h | |||
| 184 | 193 | ||
| 185 | ## end gnulib module stddef | 194 | ## end gnulib module stddef |
| 186 | 195 | ||
| 196 | ## begin gnulib module stdint | ||
| 197 | |||
| 198 | BUILT_SOURCES += $(STDINT_H) | ||
| 199 | |||
| 200 | # We need the following in order to create <stdint.h> when the system | ||
| 201 | # doesn't have one that works with the given compiler. | ||
| 202 | stdint.h: stdint.in.h | ||
| 203 | $(AM_V_GEN)rm -f $@-t $@ && \ | ||
| 204 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | ||
| 205 | sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ | ||
| 206 | -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ | ||
| 207 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | ||
| 208 | -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ | ||
| 209 | -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ | ||
| 210 | -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ | ||
| 211 | -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ | ||
| 212 | -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ | ||
| 213 | -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ | ||
| 214 | -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ | ||
| 215 | -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ | ||
| 216 | -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ | ||
| 217 | -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ | ||
| 218 | -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ | ||
| 219 | -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ | ||
| 220 | -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ | ||
| 221 | -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \ | ||
| 222 | -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \ | ||
| 223 | -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \ | ||
| 224 | -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \ | ||
| 225 | -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \ | ||
| 226 | -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \ | ||
| 227 | -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \ | ||
| 228 | -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ | ||
| 229 | -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ | ||
| 230 | -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ | ||
| 231 | < $(srcdir)/stdint.in.h; \ | ||
| 232 | } > $@-t && \ | ||
| 233 | mv $@-t $@ | ||
| 234 | MOSTLYCLEANFILES += stdint.h stdint.h-t | ||
| 235 | |||
| 236 | EXTRA_DIST += stdint.in.h | ||
| 237 | |||
| 238 | ## end gnulib module stdint | ||
| 239 | |||
| 187 | ## begin gnulib module stdlib | 240 | ## begin gnulib module stdlib |
| 188 | 241 | ||
| 189 | BUILT_SOURCES += stdlib.h | 242 | BUILT_SOURCES += stdlib.h |
diff --git a/lib/md5.c b/lib/md5.c new file mode 100644 index 00000000000..b7fad633364 --- /dev/null +++ b/lib/md5.c | |||
| @@ -0,0 +1,462 @@ | |||
| 1 | /* Functions to compute MD5 message digest of files or memory blocks. | ||
| 2 | according to the definition of MD5 in RFC 1321 from April 1992. | ||
| 3 | Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2011 Free Software | ||
| 4 | Foundation, Inc. | ||
| 5 | This file is part of the GNU C Library. | ||
| 6 | |||
| 7 | This program is free software; you can redistribute it and/or modify it | ||
| 8 | under the terms of the GNU General Public License as published by the | ||
| 9 | Free Software Foundation; either version 3, or (at your option) any | ||
| 10 | later version. | ||
| 11 | |||
| 12 | This program is distributed in the hope that it will be useful, | ||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | GNU General Public License for more details. | ||
| 16 | |||
| 17 | You should have received a copy of the GNU General Public License | ||
| 18 | along with this program; if not, write to the Free Software Foundation, | ||
| 19 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | ||
| 20 | |||
| 21 | /* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */ | ||
| 22 | |||
| 23 | #include <config.h> | ||
| 24 | |||
| 25 | #include "md5.h" | ||
| 26 | |||
| 27 | #include <stddef.h> | ||
| 28 | #include <stdlib.h> | ||
| 29 | #include <string.h> | ||
| 30 | #include <sys/types.h> | ||
| 31 | |||
| 32 | #if USE_UNLOCKED_IO | ||
| 33 | # include "unlocked-io.h" | ||
| 34 | #endif | ||
| 35 | |||
| 36 | #ifdef _LIBC | ||
| 37 | # include <endian.h> | ||
| 38 | # if __BYTE_ORDER == __BIG_ENDIAN | ||
| 39 | # define WORDS_BIGENDIAN 1 | ||
| 40 | # endif | ||
| 41 | /* We need to keep the namespace clean so define the MD5 function | ||
| 42 | protected using leading __ . */ | ||
| 43 | # define md5_init_ctx __md5_init_ctx | ||
| 44 | # define md5_process_block __md5_process_block | ||
| 45 | # define md5_process_bytes __md5_process_bytes | ||
| 46 | # define md5_finish_ctx __md5_finish_ctx | ||
| 47 | # define md5_read_ctx __md5_read_ctx | ||
| 48 | # define md5_stream __md5_stream | ||
| 49 | # define md5_buffer __md5_buffer | ||
| 50 | #endif | ||
| 51 | |||
| 52 | #ifdef WORDS_BIGENDIAN | ||
| 53 | # define SWAP(n) \ | ||
| 54 | (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) | ||
| 55 | #else | ||
| 56 | # define SWAP(n) (n) | ||
| 57 | #endif | ||
| 58 | |||
| 59 | #define BLOCKSIZE 32768 | ||
| 60 | #if BLOCKSIZE % 64 != 0 | ||
| 61 | # error "invalid BLOCKSIZE" | ||
| 62 | #endif | ||
| 63 | |||
| 64 | /* This array contains the bytes used to pad the buffer to the next | ||
| 65 | 64-byte boundary. (RFC 1321, 3.1: Step 1) */ | ||
| 66 | static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; | ||
| 67 | |||
| 68 | |||
| 69 | /* Initialize structure containing state of computation. | ||
| 70 | (RFC 1321, 3.3: Step 3) */ | ||
| 71 | void | ||
| 72 | md5_init_ctx (struct md5_ctx *ctx) | ||
| 73 | { | ||
| 74 | ctx->A = 0x67452301; | ||
| 75 | ctx->B = 0xefcdab89; | ||
| 76 | ctx->C = 0x98badcfe; | ||
| 77 | ctx->D = 0x10325476; | ||
| 78 | |||
| 79 | ctx->total[0] = ctx->total[1] = 0; | ||
| 80 | ctx->buflen = 0; | ||
| 81 | } | ||
| 82 | |||
| 83 | /* Copy the 4 byte value from v into the memory location pointed to by *cp, | ||
| 84 | If your architecture allows unaligned access this is equivalent to | ||
| 85 | * (uint32_t *) cp = v */ | ||
| 86 | static inline void | ||
| 87 | set_uint32 (char *cp, uint32_t v) | ||
| 88 | { | ||
| 89 | memcpy (cp, &v, sizeof v); | ||
| 90 | } | ||
| 91 | |||
| 92 | /* Put result from CTX in first 16 bytes following RESBUF. The result | ||
| 93 | must be in little endian byte order. */ | ||
| 94 | void * | ||
| 95 | md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) | ||
| 96 | { | ||
| 97 | char *r = resbuf; | ||
| 98 | set_uint32 (r + 0 * sizeof ctx->A, SWAP (ctx->A)); | ||
| 99 | set_uint32 (r + 1 * sizeof ctx->B, SWAP (ctx->B)); | ||
| 100 | set_uint32 (r + 2 * sizeof ctx->C, SWAP (ctx->C)); | ||
| 101 | set_uint32 (r + 3 * sizeof ctx->D, SWAP (ctx->D)); | ||
| 102 | |||
| 103 | return resbuf; | ||
| 104 | } | ||
| 105 | |||
| 106 | /* Process the remaining bytes in the internal buffer and the usual | ||
| 107 | prolog according to the standard and write the result to RESBUF. */ | ||
| 108 | void * | ||
| 109 | md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) | ||
| 110 | { | ||
| 111 | /* Take yet unprocessed bytes into account. */ | ||
| 112 | uint32_t bytes = ctx->buflen; | ||
| 113 | size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4; | ||
| 114 | |||
| 115 | /* Now count remaining bytes. */ | ||
| 116 | ctx->total[0] += bytes; | ||
| 117 | if (ctx->total[0] < bytes) | ||
| 118 | ++ctx->total[1]; | ||
| 119 | |||
| 120 | /* Put the 64-bit file length in *bits* at the end of the buffer. */ | ||
| 121 | ctx->buffer[size - 2] = SWAP (ctx->total[0] << 3); | ||
| 122 | ctx->buffer[size - 1] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); | ||
| 123 | |||
| 124 | memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes); | ||
| 125 | |||
| 126 | /* Process last bytes. */ | ||
| 127 | md5_process_block (ctx->buffer, size * 4, ctx); | ||
| 128 | |||
| 129 | return md5_read_ctx (ctx, resbuf); | ||
| 130 | } | ||
| 131 | |||
| 132 | /* Compute MD5 message digest for bytes read from STREAM. The | ||
| 133 | resulting message digest number will be written into the 16 bytes | ||
| 134 | beginning at RESBLOCK. */ | ||
| 135 | int | ||
| 136 | md5_stream (FILE *stream, void *resblock) | ||
| 137 | { | ||
| 138 | struct md5_ctx ctx; | ||
| 139 | size_t sum; | ||
| 140 | |||
| 141 | char *buffer = malloc (BLOCKSIZE + 72); | ||
| 142 | if (!buffer) | ||
| 143 | return 1; | ||
| 144 | |||
| 145 | /* Initialize the computation context. */ | ||
| 146 | md5_init_ctx (&ctx); | ||
| 147 | |||
| 148 | /* Iterate over full file contents. */ | ||
| 149 | while (1) | ||
| 150 | { | ||
| 151 | /* We read the file in blocks of BLOCKSIZE bytes. One call of the | ||
| 152 | computation function processes the whole buffer so that with the | ||
| 153 | next round of the loop another block can be read. */ | ||
| 154 | size_t n; | ||
| 155 | sum = 0; | ||
| 156 | |||
| 157 | /* Read block. Take care for partial reads. */ | ||
| 158 | while (1) | ||
| 159 | { | ||
| 160 | n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); | ||
| 161 | |||
| 162 | sum += n; | ||
| 163 | |||
| 164 | if (sum == BLOCKSIZE) | ||
| 165 | break; | ||
| 166 | |||
| 167 | if (n == 0) | ||
| 168 | { | ||
| 169 | /* Check for the error flag IFF N == 0, so that we don't | ||
| 170 | exit the loop after a partial read due to e.g., EAGAIN | ||
| 171 | or EWOULDBLOCK. */ | ||
| 172 | if (ferror (stream)) | ||
| 173 | { | ||
| 174 | free (buffer); | ||
| 175 | return 1; | ||
| 176 | } | ||
| 177 | goto process_partial_block; | ||
| 178 | } | ||
| 179 | |||
| 180 | /* We've read at least one byte, so ignore errors. But always | ||
| 181 | check for EOF, since feof may be true even though N > 0. | ||
| 182 | Otherwise, we could end up calling fread after EOF. */ | ||
| 183 | if (feof (stream)) | ||
| 184 | goto process_partial_block; | ||
| 185 | } | ||
| 186 | |||
| 187 | /* Process buffer with BLOCKSIZE bytes. Note that | ||
| 188 | BLOCKSIZE % 64 == 0 | ||
| 189 | */ | ||
| 190 | md5_process_block (buffer, BLOCKSIZE, &ctx); | ||
| 191 | } | ||
| 192 | |||
| 193 | process_partial_block: | ||
| 194 | |||
| 195 | /* Process any remaining bytes. */ | ||
| 196 | if (sum > 0) | ||
| 197 | md5_process_bytes (buffer, sum, &ctx); | ||
| 198 | |||
| 199 | /* Construct result in desired memory. */ | ||
| 200 | md5_finish_ctx (&ctx, resblock); | ||
| 201 | free (buffer); | ||
| 202 | return 0; | ||
| 203 | } | ||
| 204 | |||
| 205 | /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The | ||
| 206 | result is always in little endian byte order, so that a byte-wise | ||
| 207 | output yields to the wanted ASCII representation of the message | ||
| 208 | digest. */ | ||
| 209 | void * | ||
| 210 | md5_buffer (const char *buffer, size_t len, void *resblock) | ||
| 211 | { | ||
| 212 | struct md5_ctx ctx; | ||
| 213 | |||
| 214 | /* Initialize the computation context. */ | ||
| 215 | md5_init_ctx (&ctx); | ||
| 216 | |||
| 217 | /* Process whole buffer but last len % 64 bytes. */ | ||
| 218 | md5_process_bytes (buffer, len, &ctx); | ||
| 219 | |||
| 220 | /* Put result in desired memory area. */ | ||
| 221 | return md5_finish_ctx (&ctx, resblock); | ||
| 222 | } | ||
| 223 | |||
| 224 | |||
| 225 | void | ||
| 226 | md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx) | ||
| 227 | { | ||
| 228 | /* When we already have some bits in our internal buffer concatenate | ||
| 229 | both inputs first. */ | ||
| 230 | if (ctx->buflen != 0) | ||
| 231 | { | ||
| 232 | size_t left_over = ctx->buflen; | ||
| 233 | size_t add = 128 - left_over > len ? len : 128 - left_over; | ||
| 234 | |||
| 235 | memcpy (&((char *) ctx->buffer)[left_over], buffer, add); | ||
| 236 | ctx->buflen += add; | ||
| 237 | |||
| 238 | if (ctx->buflen > 64) | ||
| 239 | { | ||
| 240 | md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx); | ||
| 241 | |||
| 242 | ctx->buflen &= 63; | ||
| 243 | /* The regions in the following copy operation cannot overlap. */ | ||
| 244 | memcpy (ctx->buffer, | ||
| 245 | &((char *) ctx->buffer)[(left_over + add) & ~63], | ||
| 246 | ctx->buflen); | ||
| 247 | } | ||
| 248 | |||
| 249 | buffer = (const char *) buffer + add; | ||
| 250 | len -= add; | ||
| 251 | } | ||
| 252 | |||
| 253 | /* Process available complete blocks. */ | ||
| 254 | if (len >= 64) | ||
| 255 | { | ||
| 256 | #if !_STRING_ARCH_unaligned | ||
| 257 | # define alignof(type) offsetof (struct { char c; type x; }, x) | ||
| 258 | # define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0) | ||
| 259 | if (UNALIGNED_P (buffer)) | ||
| 260 | while (len > 64) | ||
| 261 | { | ||
| 262 | md5_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); | ||
| 263 | buffer = (const char *) buffer + 64; | ||
| 264 | len -= 64; | ||
| 265 | } | ||
| 266 | else | ||
| 267 | #endif | ||
| 268 | { | ||
| 269 | md5_process_block (buffer, len & ~63, ctx); | ||
| 270 | buffer = (const char *) buffer + (len & ~63); | ||
| 271 | len &= 63; | ||
| 272 | } | ||
| 273 | } | ||
| 274 | |||
| 275 | /* Move remaining bytes in internal buffer. */ | ||
| 276 | if (len > 0) | ||
| 277 | { | ||
| 278 | size_t left_over = ctx->buflen; | ||
| 279 | |||
| 280 | memcpy (&((char *) ctx->buffer)[left_over], buffer, len); | ||
| 281 | left_over += len; | ||
| 282 | if (left_over >= 64) | ||
| 283 | { | ||
| 284 | md5_process_block (ctx->buffer, 64, ctx); | ||
| 285 | left_over -= 64; | ||
| 286 | memcpy (ctx->buffer, &ctx->buffer[16], left_over); | ||
| 287 | } | ||
| 288 | ctx->buflen = left_over; | ||
| 289 | } | ||
| 290 | } | ||
| 291 | |||
| 292 | |||
| 293 | /* These are the four functions used in the four steps of the MD5 algorithm | ||
| 294 | and defined in the RFC 1321. The first function is a little bit optimized | ||
| 295 | (as found in Colin Plumbs public domain implementation). */ | ||
| 296 | /* #define FF(b, c, d) ((b & c) | (~b & d)) */ | ||
| 297 | #define FF(b, c, d) (d ^ (b & (c ^ d))) | ||
| 298 | #define FG(b, c, d) FF (d, b, c) | ||
| 299 | #define FH(b, c, d) (b ^ c ^ d) | ||
| 300 | #define FI(b, c, d) (c ^ (b | ~d)) | ||
| 301 | |||
| 302 | /* Process LEN bytes of BUFFER, accumulating context into CTX. | ||
| 303 | It is assumed that LEN % 64 == 0. */ | ||
| 304 | |||
| 305 | void | ||
| 306 | md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx) | ||
| 307 | { | ||
| 308 | uint32_t correct_words[16]; | ||
| 309 | const uint32_t *words = buffer; | ||
| 310 | size_t nwords = len / sizeof (uint32_t); | ||
| 311 | const uint32_t *endp = words + nwords; | ||
| 312 | uint32_t A = ctx->A; | ||
| 313 | uint32_t B = ctx->B; | ||
| 314 | uint32_t C = ctx->C; | ||
| 315 | uint32_t D = ctx->D; | ||
| 316 | |||
| 317 | /* First increment the byte count. RFC 1321 specifies the possible | ||
| 318 | length of the file up to 2^64 bits. Here we only compute the | ||
| 319 | number of bytes. Do a double word increment. */ | ||
| 320 | ctx->total[0] += len; | ||
| 321 | if (ctx->total[0] < len) | ||
| 322 | ++ctx->total[1]; | ||
| 323 | |||
| 324 | /* Process all bytes in the buffer with 64 bytes in each round of | ||
| 325 | the loop. */ | ||
| 326 | while (words < endp) | ||
| 327 | { | ||
| 328 | uint32_t *cwp = correct_words; | ||
| 329 | uint32_t A_save = A; | ||
| 330 | uint32_t B_save = B; | ||
| 331 | uint32_t C_save = C; | ||
| 332 | uint32_t D_save = D; | ||
| 333 | |||
| 334 | /* First round: using the given function, the context and a constant | ||
| 335 | the next context is computed. Because the algorithms processing | ||
| 336 | unit is a 32-bit word and it is determined to work on words in | ||
| 337 | little endian byte order we perhaps have to change the byte order | ||
| 338 | before the computation. To reduce the work for the next steps | ||
| 339 | we store the swapped words in the array CORRECT_WORDS. */ | ||
| 340 | |||
| 341 | #define OP(a, b, c, d, s, T) \ | ||
| 342 | do \ | ||
| 343 | { \ | ||
| 344 | a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \ | ||
| 345 | ++words; \ | ||
| 346 | CYCLIC (a, s); \ | ||
| 347 | a += b; \ | ||
| 348 | } \ | ||
| 349 | while (0) | ||
| 350 | |||
| 351 | /* It is unfortunate that C does not provide an operator for | ||
| 352 | cyclic rotation. Hope the C compiler is smart enough. */ | ||
| 353 | #define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s))) | ||
| 354 | |||
| 355 | /* Before we start, one word to the strange constants. | ||
| 356 | They are defined in RFC 1321 as | ||
| 357 | |||
| 358 | T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64 | ||
| 359 | |||
| 360 | Here is an equivalent invocation using Perl: | ||
| 361 | |||
| 362 | perl -e 'foreach(1..64){printf "0x%08x\n", int (4294967296 * abs (sin $_))}' | ||
| 363 | */ | ||
| 364 | |||
| 365 | /* Round 1. */ | ||
| 366 | OP (A, B, C, D, 7, 0xd76aa478); | ||
| 367 | OP (D, A, B, C, 12, 0xe8c7b756); | ||
| 368 | OP (C, D, A, B, 17, 0x242070db); | ||
| 369 | OP (B, C, D, A, 22, 0xc1bdceee); | ||
| 370 | OP (A, B, C, D, 7, 0xf57c0faf); | ||
| 371 | OP (D, A, B, C, 12, 0x4787c62a); | ||
| 372 | OP (C, D, A, B, 17, 0xa8304613); | ||
| 373 | OP (B, C, D, A, 22, 0xfd469501); | ||
| 374 | OP (A, B, C, D, 7, 0x698098d8); | ||
| 375 | OP (D, A, B, C, 12, 0x8b44f7af); | ||
| 376 | OP (C, D, A, B, 17, 0xffff5bb1); | ||
| 377 | OP (B, C, D, A, 22, 0x895cd7be); | ||
| 378 | OP (A, B, C, D, 7, 0x6b901122); | ||
| 379 | OP (D, A, B, C, 12, 0xfd987193); | ||
| 380 | OP (C, D, A, B, 17, 0xa679438e); | ||
| 381 | OP (B, C, D, A, 22, 0x49b40821); | ||
| 382 | |||
| 383 | /* For the second to fourth round we have the possibly swapped words | ||
| 384 | in CORRECT_WORDS. Redefine the macro to take an additional first | ||
| 385 | argument specifying the function to use. */ | ||
| 386 | #undef OP | ||
| 387 | #define OP(f, a, b, c, d, k, s, T) \ | ||
| 388 | do \ | ||
| 389 | { \ | ||
| 390 | a += f (b, c, d) + correct_words[k] + T; \ | ||
| 391 | CYCLIC (a, s); \ | ||
| 392 | a += b; \ | ||
| 393 | } \ | ||
| 394 | while (0) | ||
| 395 | |||
| 396 | /* Round 2. */ | ||
| 397 | OP (FG, A, B, C, D, 1, 5, 0xf61e2562); | ||
| 398 | OP (FG, D, A, B, C, 6, 9, 0xc040b340); | ||
| 399 | OP (FG, C, D, A, B, 11, 14, 0x265e5a51); | ||
| 400 | OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa); | ||
| 401 | OP (FG, A, B, C, D, 5, 5, 0xd62f105d); | ||
| 402 | OP (FG, D, A, B, C, 10, 9, 0x02441453); | ||
| 403 | OP (FG, C, D, A, B, 15, 14, 0xd8a1e681); | ||
| 404 | OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8); | ||
| 405 | OP (FG, A, B, C, D, 9, 5, 0x21e1cde6); | ||
| 406 | OP (FG, D, A, B, C, 14, 9, 0xc33707d6); | ||
| 407 | OP (FG, C, D, A, B, 3, 14, 0xf4d50d87); | ||
| 408 | OP (FG, B, C, D, A, 8, 20, 0x455a14ed); | ||
| 409 | OP (FG, A, B, C, D, 13, 5, 0xa9e3e905); | ||
| 410 | OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8); | ||
| 411 | OP (FG, C, D, A, B, 7, 14, 0x676f02d9); | ||
| 412 | OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a); | ||
| 413 | |||
| 414 | /* Round 3. */ | ||
| 415 | OP (FH, A, B, C, D, 5, 4, 0xfffa3942); | ||
| 416 | OP (FH, D, A, B, C, 8, 11, 0x8771f681); | ||
| 417 | OP (FH, C, D, A, B, 11, 16, 0x6d9d6122); | ||
| 418 | OP (FH, B, C, D, A, 14, 23, 0xfde5380c); | ||
| 419 | OP (FH, A, B, C, D, 1, 4, 0xa4beea44); | ||
| 420 | OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9); | ||
| 421 | OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60); | ||
| 422 | OP (FH, B, C, D, A, 10, 23, 0xbebfbc70); | ||
| 423 | OP (FH, A, B, C, D, 13, 4, 0x289b7ec6); | ||
| 424 | OP (FH, D, A, B, C, 0, 11, 0xeaa127fa); | ||
| 425 | OP (FH, C, D, A, B, 3, 16, 0xd4ef3085); | ||
| 426 | OP (FH, B, C, D, A, 6, 23, 0x04881d05); | ||
| 427 | OP (FH, A, B, C, D, 9, 4, 0xd9d4d039); | ||
| 428 | OP (FH, D, A, B, C, 12, 11, 0xe6db99e5); | ||
| 429 | OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8); | ||
| 430 | OP (FH, B, C, D, A, 2, 23, 0xc4ac5665); | ||
| 431 | |||
| 432 | /* Round 4. */ | ||
| 433 | OP (FI, A, B, C, D, 0, 6, 0xf4292244); | ||
| 434 | OP (FI, D, A, B, C, 7, 10, 0x432aff97); | ||
| 435 | OP (FI, C, D, A, B, 14, 15, 0xab9423a7); | ||
| 436 | OP (FI, B, C, D, A, 5, 21, 0xfc93a039); | ||
| 437 | OP (FI, A, B, C, D, 12, 6, 0x655b59c3); | ||
| 438 | OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92); | ||
| 439 | OP (FI, C, D, A, B, 10, 15, 0xffeff47d); | ||
| 440 | OP (FI, B, C, D, A, 1, 21, 0x85845dd1); | ||
| 441 | OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f); | ||
| 442 | OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0); | ||
| 443 | OP (FI, C, D, A, B, 6, 15, 0xa3014314); | ||
| 444 | OP (FI, B, C, D, A, 13, 21, 0x4e0811a1); | ||
| 445 | OP (FI, A, B, C, D, 4, 6, 0xf7537e82); | ||
| 446 | OP (FI, D, A, B, C, 11, 10, 0xbd3af235); | ||
| 447 | OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb); | ||
| 448 | OP (FI, B, C, D, A, 9, 21, 0xeb86d391); | ||
| 449 | |||
| 450 | /* Add the starting values of the context. */ | ||
| 451 | A += A_save; | ||
| 452 | B += B_save; | ||
| 453 | C += C_save; | ||
| 454 | D += D_save; | ||
| 455 | } | ||
| 456 | |||
| 457 | /* Put checksum in context given as argument. */ | ||
| 458 | ctx->A = A; | ||
| 459 | ctx->B = B; | ||
| 460 | ctx->C = C; | ||
| 461 | ctx->D = D; | ||
| 462 | } | ||
diff --git a/lib/md5.h b/lib/md5.h new file mode 100644 index 00000000000..53e60480292 --- /dev/null +++ b/lib/md5.h | |||
| @@ -0,0 +1,126 @@ | |||
| 1 | /* Declaration of functions and data types used for MD5 sum computing | ||
| 2 | library functions. | ||
| 3 | Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2011 Free Software | ||
| 4 | Foundation, Inc. | ||
| 5 | This file is part of the GNU C Library. | ||
| 6 | |||
| 7 | This program is free software; you can redistribute it and/or modify it | ||
| 8 | under the terms of the GNU General Public License as published by the | ||
| 9 | Free Software Foundation; either version 3, or (at your option) any | ||
| 10 | later version. | ||
| 11 | |||
| 12 | This program is distributed in the hope that it will be useful, | ||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | GNU General Public License for more details. | ||
| 16 | |||
| 17 | You should have received a copy of the GNU General Public License | ||
| 18 | along with this program; if not, write to the Free Software Foundation, | ||
| 19 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | ||
| 20 | |||
| 21 | #ifndef _MD5_H | ||
| 22 | #define _MD5_H 1 | ||
| 23 | |||
| 24 | #include <stdio.h> | ||
| 25 | #include <stdint.h> | ||
| 26 | |||
| 27 | #define MD5_DIGEST_SIZE 16 | ||
| 28 | #define MD5_BLOCK_SIZE 64 | ||
| 29 | |||
| 30 | #ifndef __GNUC_PREREQ | ||
| 31 | # if defined __GNUC__ && defined __GNUC_MINOR__ | ||
| 32 | # define __GNUC_PREREQ(maj, min) \ | ||
| 33 | ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) | ||
| 34 | # else | ||
| 35 | # define __GNUC_PREREQ(maj, min) 0 | ||
| 36 | # endif | ||
| 37 | #endif | ||
| 38 | |||
| 39 | #ifndef __THROW | ||
| 40 | # if defined __cplusplus && __GNUC_PREREQ (2,8) | ||
| 41 | # define __THROW throw () | ||
| 42 | # else | ||
| 43 | # define __THROW | ||
| 44 | # endif | ||
| 45 | #endif | ||
| 46 | |||
| 47 | #ifndef _LIBC | ||
| 48 | # define __md5_buffer md5_buffer | ||
| 49 | # define __md5_finish_ctx md5_finish_ctx | ||
| 50 | # define __md5_init_ctx md5_init_ctx | ||
| 51 | # define __md5_process_block md5_process_block | ||
| 52 | # define __md5_process_bytes md5_process_bytes | ||
| 53 | # define __md5_read_ctx md5_read_ctx | ||
| 54 | # define __md5_stream md5_stream | ||
| 55 | #endif | ||
| 56 | |||
| 57 | # ifdef __cplusplus | ||
| 58 | extern "C" { | ||
| 59 | # endif | ||
| 60 | |||
| 61 | /* Structure to save state of computation between the single steps. */ | ||
| 62 | struct md5_ctx | ||
| 63 | { | ||
| 64 | uint32_t A; | ||
| 65 | uint32_t B; | ||
| 66 | uint32_t C; | ||
| 67 | uint32_t D; | ||
| 68 | |||
| 69 | uint32_t total[2]; | ||
| 70 | uint32_t buflen; | ||
| 71 | uint32_t buffer[32]; | ||
| 72 | }; | ||
| 73 | |||
| 74 | /* | ||
| 75 | * The following three functions are build up the low level used in | ||
| 76 | * the functions `md5_stream' and `md5_buffer'. | ||
| 77 | */ | ||
| 78 | |||
| 79 | /* Initialize structure containing state of computation. | ||
| 80 | (RFC 1321, 3.3: Step 3) */ | ||
| 81 | extern void __md5_init_ctx (struct md5_ctx *ctx) __THROW; | ||
| 82 | |||
| 83 | /* Starting with the result of former calls of this function (or the | ||
| 84 | initialization function update the context for the next LEN bytes | ||
| 85 | starting at BUFFER. | ||
| 86 | It is necessary that LEN is a multiple of 64!!! */ | ||
| 87 | extern void __md5_process_block (const void *buffer, size_t len, | ||
| 88 | struct md5_ctx *ctx) __THROW; | ||
| 89 | |||
| 90 | /* Starting with the result of former calls of this function (or the | ||
| 91 | initialization function update the context for the next LEN bytes | ||
| 92 | starting at BUFFER. | ||
| 93 | It is NOT required that LEN is a multiple of 64. */ | ||
| 94 | extern void __md5_process_bytes (const void *buffer, size_t len, | ||
| 95 | struct md5_ctx *ctx) __THROW; | ||
| 96 | |||
| 97 | /* Process the remaining bytes in the buffer and put result from CTX | ||
| 98 | in first 16 bytes following RESBUF. The result is always in little | ||
| 99 | endian byte order, so that a byte-wise output yields to the wanted | ||
| 100 | ASCII representation of the message digest. */ | ||
| 101 | extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW; | ||
| 102 | |||
| 103 | |||
| 104 | /* Put result from CTX in first 16 bytes following RESBUF. The result is | ||
| 105 | always in little endian byte order, so that a byte-wise output yields | ||
| 106 | to the wanted ASCII representation of the message digest. */ | ||
| 107 | extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW; | ||
| 108 | |||
| 109 | |||
| 110 | /* Compute MD5 message digest for bytes read from STREAM. The | ||
| 111 | resulting message digest number will be written into the 16 bytes | ||
| 112 | beginning at RESBLOCK. */ | ||
| 113 | extern int __md5_stream (FILE *stream, void *resblock) __THROW; | ||
| 114 | |||
| 115 | /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The | ||
| 116 | result is always in little endian byte order, so that a byte-wise | ||
| 117 | output yields to the wanted ASCII representation of the message | ||
| 118 | digest. */ | ||
| 119 | extern void *__md5_buffer (const char *buffer, size_t len, | ||
| 120 | void *resblock) __THROW; | ||
| 121 | |||
| 122 | # ifdef __cplusplus | ||
| 123 | } | ||
| 124 | # endif | ||
| 125 | |||
| 126 | #endif /* md5.h */ | ||
diff --git a/lib/stdint.in.h b/lib/stdint.in.h new file mode 100644 index 00000000000..b32227bb04c --- /dev/null +++ b/lib/stdint.in.h | |||
| @@ -0,0 +1,592 @@ | |||
| 1 | /* Copyright (C) 2001-2002, 2004-2011 Free Software Foundation, Inc. | ||
| 2 | Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. | ||
| 3 | This file is part of gnulib. | ||
| 4 | |||
| 5 | This program is free software; you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU General Public License as published by | ||
| 7 | the Free Software Foundation; either version 3, or (at your option) | ||
| 8 | any later version. | ||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, | ||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | GNU General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License | ||
| 16 | along with this program; if not, write to the Free Software Foundation, | ||
| 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | ||
| 18 | |||
| 19 | /* | ||
| 20 | * ISO C 99 <stdint.h> for platforms that lack it. | ||
| 21 | * <http://www.opengroup.org/susv3xbd/stdint.h.html> | ||
| 22 | */ | ||
| 23 | |||
| 24 | #ifndef _GL_STDINT_H | ||
| 25 | |||
| 26 | #if __GNUC__ >= 3 | ||
| 27 | @PRAGMA_SYSTEM_HEADER@ | ||
| 28 | #endif | ||
| 29 | @PRAGMA_COLUMNS@ | ||
| 30 | |||
| 31 | /* When including a system file that in turn includes <inttypes.h>, | ||
| 32 | use the system <inttypes.h>, not our substitute. This avoids | ||
| 33 | problems with (for example) VMS, whose <sys/bitypes.h> includes | ||
| 34 | <inttypes.h>. */ | ||
| 35 | #define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H | ||
| 36 | |||
| 37 | /* Get those types that are already defined in other system include | ||
| 38 | files, so that we can "#define int8_t signed char" below without | ||
| 39 | worrying about a later system include file containing a "typedef | ||
| 40 | signed char int8_t;" that will get messed up by our macro. Our | ||
| 41 | macros should all be consistent with the system versions, except | ||
| 42 | for the "fast" types and macros, which we recommend against using | ||
| 43 | in public interfaces due to compiler differences. */ | ||
| 44 | |||
| 45 | #if @HAVE_STDINT_H@ | ||
| 46 | # if defined __sgi && ! defined __c99 | ||
| 47 | /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users | ||
| 48 | with "This header file is to be used only for c99 mode compilations" | ||
| 49 | diagnostics. */ | ||
| 50 | # define __STDINT_H__ | ||
| 51 | # endif | ||
| 52 | /* Other systems may have an incomplete or buggy <stdint.h>. | ||
| 53 | Include it before <inttypes.h>, since any "#include <stdint.h>" | ||
| 54 | in <inttypes.h> would reinclude us, skipping our contents because | ||
| 55 | _GL_STDINT_H is defined. | ||
| 56 | The include_next requires a split double-inclusion guard. */ | ||
| 57 | # @INCLUDE_NEXT@ @NEXT_STDINT_H@ | ||
| 58 | #endif | ||
| 59 | |||
| 60 | #if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H | ||
| 61 | #define _GL_STDINT_H | ||
| 62 | |||
| 63 | /* <sys/types.h> defines some of the stdint.h types as well, on glibc, | ||
| 64 | IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>). | ||
| 65 | AIX 5.2 <sys/types.h> isn't needed and causes troubles. | ||
| 66 | MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but | ||
| 67 | relies on the system <stdint.h> definitions, so include | ||
| 68 | <sys/types.h> after @NEXT_STDINT_H@. */ | ||
| 69 | #if @HAVE_SYS_TYPES_H@ && ! defined _AIX | ||
| 70 | # include <sys/types.h> | ||
| 71 | #endif | ||
| 72 | |||
| 73 | /* Get LONG_MIN, LONG_MAX, ULONG_MAX. */ | ||
| 74 | #include <limits.h> | ||
| 75 | |||
| 76 | #if @HAVE_INTTYPES_H@ | ||
| 77 | /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines | ||
| 78 | int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. | ||
| 79 | <inttypes.h> also defines intptr_t and uintptr_t. */ | ||
| 80 | # include <inttypes.h> | ||
| 81 | #elif @HAVE_SYS_INTTYPES_H@ | ||
| 82 | /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and | ||
| 83 | the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ | ||
| 84 | # include <sys/inttypes.h> | ||
| 85 | #endif | ||
| 86 | |||
| 87 | #if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ | ||
| 88 | /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines | ||
| 89 | int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is | ||
| 90 | included by <sys/types.h>. */ | ||
| 91 | # include <sys/bitypes.h> | ||
| 92 | #endif | ||
| 93 | |||
| 94 | #undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H | ||
| 95 | |||
| 96 | /* Minimum and maximum values for a integer type under the usual assumption. | ||
| 97 | Return an unspecified value if BITS == 0, adding a check to pacify | ||
| 98 | picky compilers. */ | ||
| 99 | |||
| 100 | #define _STDINT_MIN(signed, bits, zero) \ | ||
| 101 | ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero)) | ||
| 102 | |||
| 103 | #define _STDINT_MAX(signed, bits, zero) \ | ||
| 104 | ((signed) \ | ||
| 105 | ? ~ _STDINT_MIN (signed, bits, zero) \ | ||
| 106 | : /* The expression for the unsigned case. The subtraction of (signed) \ | ||
| 107 | is a nop in the unsigned case and avoids "signed integer overflow" \ | ||
| 108 | warnings in the signed case. */ \ | ||
| 109 | ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) | ||
| 110 | |||
| 111 | #if !GNULIB_defined_stdint_types | ||
| 112 | |||
| 113 | /* 7.18.1.1. Exact-width integer types */ | ||
| 114 | |||
| 115 | /* Here we assume a standard architecture where the hardware integer | ||
| 116 | types have 8, 16, 32, optionally 64 bits. */ | ||
| 117 | |||
| 118 | #undef int8_t | ||
| 119 | #undef uint8_t | ||
| 120 | typedef signed char gl_int8_t; | ||
| 121 | typedef unsigned char gl_uint8_t; | ||
| 122 | #define int8_t gl_int8_t | ||
| 123 | #define uint8_t gl_uint8_t | ||
| 124 | |||
| 125 | #undef int16_t | ||
| 126 | #undef uint16_t | ||
| 127 | typedef short int gl_int16_t; | ||
| 128 | typedef unsigned short int gl_uint16_t; | ||
| 129 | #define int16_t gl_int16_t | ||
| 130 | #define uint16_t gl_uint16_t | ||
| 131 | |||
| 132 | #undef int32_t | ||
| 133 | #undef uint32_t | ||
| 134 | typedef int gl_int32_t; | ||
| 135 | typedef unsigned int gl_uint32_t; | ||
| 136 | #define int32_t gl_int32_t | ||
| 137 | #define uint32_t gl_uint32_t | ||
| 138 | |||
| 139 | /* If the system defines INT64_MAX, assume int64_t works. That way, | ||
| 140 | if the underlying platform defines int64_t to be a 64-bit long long | ||
| 141 | int, the code below won't mistakenly define it to be a 64-bit long | ||
| 142 | int, which would mess up C++ name mangling. We must use #ifdef | ||
| 143 | rather than #if, to avoid an error with HP-UX 10.20 cc. */ | ||
| 144 | |||
| 145 | #ifdef INT64_MAX | ||
| 146 | # define GL_INT64_T | ||
| 147 | #else | ||
| 148 | /* Do not undefine int64_t if gnulib is not being used with 64-bit | ||
| 149 | types, since otherwise it breaks platforms like Tandem/NSK. */ | ||
| 150 | # if LONG_MAX >> 31 >> 31 == 1 | ||
| 151 | # undef int64_t | ||
| 152 | typedef long int gl_int64_t; | ||
| 153 | # define int64_t gl_int64_t | ||
| 154 | # define GL_INT64_T | ||
| 155 | # elif defined _MSC_VER | ||
| 156 | # undef int64_t | ||
| 157 | typedef __int64 gl_int64_t; | ||
| 158 | # define int64_t gl_int64_t | ||
| 159 | # define GL_INT64_T | ||
| 160 | # elif @HAVE_LONG_LONG_INT@ | ||
| 161 | # undef int64_t | ||
| 162 | typedef long long int gl_int64_t; | ||
| 163 | # define int64_t gl_int64_t | ||
| 164 | # define GL_INT64_T | ||
| 165 | # endif | ||
| 166 | #endif | ||
| 167 | |||
| 168 | #ifdef UINT64_MAX | ||
| 169 | # define GL_UINT64_T | ||
| 170 | #else | ||
| 171 | # if ULONG_MAX >> 31 >> 31 >> 1 == 1 | ||
| 172 | # undef uint64_t | ||
| 173 | typedef unsigned long int gl_uint64_t; | ||
| 174 | # define uint64_t gl_uint64_t | ||
| 175 | # define GL_UINT64_T | ||
| 176 | # elif defined _MSC_VER | ||
| 177 | # undef uint64_t | ||
| 178 | typedef unsigned __int64 gl_uint64_t; | ||
| 179 | # define uint64_t gl_uint64_t | ||
| 180 | # define GL_UINT64_T | ||
| 181 | # elif @HAVE_UNSIGNED_LONG_LONG_INT@ | ||
| 182 | # undef uint64_t | ||
| 183 | typedef unsigned long long int gl_uint64_t; | ||
| 184 | # define uint64_t gl_uint64_t | ||
| 185 | # define GL_UINT64_T | ||
| 186 | # endif | ||
| 187 | #endif | ||
| 188 | |||
| 189 | /* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */ | ||
| 190 | #define _UINT8_T | ||
| 191 | #define _UINT32_T | ||
| 192 | #define _UINT64_T | ||
| 193 | |||
| 194 | |||
| 195 | /* 7.18.1.2. Minimum-width integer types */ | ||
| 196 | |||
| 197 | /* Here we assume a standard architecture where the hardware integer | ||
| 198 | types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types | ||
| 199 | are the same as the corresponding N_t types. */ | ||
| 200 | |||
| 201 | #undef int_least8_t | ||
| 202 | #undef uint_least8_t | ||
| 203 | #undef int_least16_t | ||
| 204 | #undef uint_least16_t | ||
| 205 | #undef int_least32_t | ||
| 206 | #undef uint_least32_t | ||
| 207 | #undef int_least64_t | ||
| 208 | #undef uint_least64_t | ||
| 209 | #define int_least8_t int8_t | ||
| 210 | #define uint_least8_t uint8_t | ||
| 211 | #define int_least16_t int16_t | ||
| 212 | #define uint_least16_t uint16_t | ||
| 213 | #define int_least32_t int32_t | ||
| 214 | #define uint_least32_t uint32_t | ||
| 215 | #ifdef GL_INT64_T | ||
| 216 | # define int_least64_t int64_t | ||
| 217 | #endif | ||
| 218 | #ifdef GL_UINT64_T | ||
| 219 | # define uint_least64_t uint64_t | ||
| 220 | #endif | ||
| 221 | |||
| 222 | /* 7.18.1.3. Fastest minimum-width integer types */ | ||
| 223 | |||
| 224 | /* Note: Other <stdint.h> substitutes may define these types differently. | ||
| 225 | It is not recommended to use these types in public header files. */ | ||
| 226 | |||
| 227 | /* Here we assume a standard architecture where the hardware integer | ||
| 228 | types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types | ||
| 229 | are taken from the same list of types. Assume that 'long int' | ||
| 230 | is fast enough for all narrower integers. */ | ||
| 231 | |||
| 232 | #undef int_fast8_t | ||
| 233 | #undef uint_fast8_t | ||
| 234 | #undef int_fast16_t | ||
| 235 | #undef uint_fast16_t | ||
| 236 | #undef int_fast32_t | ||
| 237 | #undef uint_fast32_t | ||
| 238 | #undef int_fast64_t | ||
| 239 | #undef uint_fast64_t | ||
| 240 | typedef long int gl_int_fast8_t; | ||
| 241 | typedef unsigned long int gl_uint_fast8_t; | ||
| 242 | typedef long int gl_int_fast16_t; | ||
| 243 | typedef unsigned long int gl_uint_fast16_t; | ||
| 244 | typedef long int gl_int_fast32_t; | ||
| 245 | typedef unsigned long int gl_uint_fast32_t; | ||
| 246 | #define int_fast8_t gl_int_fast8_t | ||
| 247 | #define uint_fast8_t gl_uint_fast8_t | ||
| 248 | #define int_fast16_t gl_int_fast16_t | ||
| 249 | #define uint_fast16_t gl_uint_fast16_t | ||
| 250 | #define int_fast32_t gl_int_fast32_t | ||
| 251 | #define uint_fast32_t gl_uint_fast32_t | ||
| 252 | #ifdef GL_INT64_T | ||
| 253 | # define int_fast64_t int64_t | ||
| 254 | #endif | ||
| 255 | #ifdef GL_UINT64_T | ||
| 256 | # define uint_fast64_t uint64_t | ||
| 257 | #endif | ||
| 258 | |||
| 259 | /* 7.18.1.4. Integer types capable of holding object pointers */ | ||
| 260 | |||
| 261 | #undef intptr_t | ||
| 262 | #undef uintptr_t | ||
| 263 | typedef long int gl_intptr_t; | ||
| 264 | typedef unsigned long int gl_uintptr_t; | ||
| 265 | #define intptr_t gl_intptr_t | ||
| 266 | #define uintptr_t gl_uintptr_t | ||
| 267 | |||
| 268 | /* 7.18.1.5. Greatest-width integer types */ | ||
| 269 | |||
| 270 | /* Note: These types are compiler dependent. It may be unwise to use them in | ||
| 271 | public header files. */ | ||
| 272 | |||
| 273 | #undef intmax_t | ||
| 274 | #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 | ||
| 275 | typedef long long int gl_intmax_t; | ||
| 276 | # define intmax_t gl_intmax_t | ||
| 277 | #elif defined GL_INT64_T | ||
| 278 | # define intmax_t int64_t | ||
| 279 | #else | ||
| 280 | typedef long int gl_intmax_t; | ||
| 281 | # define intmax_t gl_intmax_t | ||
| 282 | #endif | ||
| 283 | |||
| 284 | #undef uintmax_t | ||
| 285 | #if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 | ||
| 286 | typedef unsigned long long int gl_uintmax_t; | ||
| 287 | # define uintmax_t gl_uintmax_t | ||
| 288 | #elif defined GL_UINT64_T | ||
| 289 | # define uintmax_t uint64_t | ||
| 290 | #else | ||
| 291 | typedef unsigned long int gl_uintmax_t; | ||
| 292 | # define uintmax_t gl_uintmax_t | ||
| 293 | #endif | ||
| 294 | |||
| 295 | /* Verify that intmax_t and uintmax_t have the same size. Too much code | ||
| 296 | breaks if this is not the case. If this check fails, the reason is likely | ||
| 297 | to be found in the autoconf macros. */ | ||
| 298 | typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) | ||
| 299 | ? 1 : -1]; | ||
| 300 | |||
| 301 | #define GNULIB_defined_stdint_types 1 | ||
| 302 | #endif /* !GNULIB_defined_stdint_types */ | ||
| 303 | |||
| 304 | /* 7.18.2. Limits of specified-width integer types */ | ||
| 305 | |||
| 306 | #if ! defined __cplusplus || defined __STDC_LIMIT_MACROS | ||
| 307 | |||
| 308 | /* 7.18.2.1. Limits of exact-width integer types */ | ||
| 309 | |||
| 310 | /* Here we assume a standard architecture where the hardware integer | ||
| 311 | types have 8, 16, 32, optionally 64 bits. */ | ||
| 312 | |||
| 313 | #undef INT8_MIN | ||
| 314 | #undef INT8_MAX | ||
| 315 | #undef UINT8_MAX | ||
| 316 | #define INT8_MIN (~ INT8_MAX) | ||
| 317 | #define INT8_MAX 127 | ||
| 318 | #define UINT8_MAX 255 | ||
| 319 | |||
| 320 | #undef INT16_MIN | ||
| 321 | #undef INT16_MAX | ||
| 322 | #undef UINT16_MAX | ||
| 323 | #define INT16_MIN (~ INT16_MAX) | ||
| 324 | #define INT16_MAX 32767 | ||
| 325 | #define UINT16_MAX 65535 | ||
| 326 | |||
| 327 | #undef INT32_MIN | ||
| 328 | #undef INT32_MAX | ||
| 329 | #undef UINT32_MAX | ||
| 330 | #define INT32_MIN (~ INT32_MAX) | ||
| 331 | #define INT32_MAX 2147483647 | ||
| 332 | #define UINT32_MAX 4294967295U | ||
| 333 | |||
| 334 | #if defined GL_INT64_T && ! defined INT64_MAX | ||
| 335 | /* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 | ||
| 336 | evaluates the latter incorrectly in preprocessor expressions. */ | ||
| 337 | # define INT64_MIN (- INTMAX_C (1) << 63) | ||
| 338 | # define INT64_MAX INTMAX_C (9223372036854775807) | ||
| 339 | #endif | ||
| 340 | |||
| 341 | #if defined GL_UINT64_T && ! defined UINT64_MAX | ||
| 342 | # define UINT64_MAX UINTMAX_C (18446744073709551615) | ||
| 343 | #endif | ||
| 344 | |||
| 345 | /* 7.18.2.2. Limits of minimum-width integer types */ | ||
| 346 | |||
| 347 | /* Here we assume a standard architecture where the hardware integer | ||
| 348 | types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types | ||
| 349 | are the same as the corresponding N_t types. */ | ||
| 350 | |||
| 351 | #undef INT_LEAST8_MIN | ||
| 352 | #undef INT_LEAST8_MAX | ||
| 353 | #undef UINT_LEAST8_MAX | ||
| 354 | #define INT_LEAST8_MIN INT8_MIN | ||
| 355 | #define INT_LEAST8_MAX INT8_MAX | ||
| 356 | #define UINT_LEAST8_MAX UINT8_MAX | ||
| 357 | |||
| 358 | #undef INT_LEAST16_MIN | ||
| 359 | #undef INT_LEAST16_MAX | ||
| 360 | #undef UINT_LEAST16_MAX | ||
| 361 | #define INT_LEAST16_MIN INT16_MIN | ||
| 362 | #define INT_LEAST16_MAX INT16_MAX | ||
| 363 | #define UINT_LEAST16_MAX UINT16_MAX | ||
| 364 | |||
| 365 | #undef INT_LEAST32_MIN | ||
| 366 | #undef INT_LEAST32_MAX | ||
| 367 | #undef UINT_LEAST32_MAX | ||
| 368 | #define INT_LEAST32_MIN INT32_MIN | ||
| 369 | #define INT_LEAST32_MAX INT32_MAX | ||
| 370 | #define UINT_LEAST32_MAX UINT32_MAX | ||
| 371 | |||
| 372 | #undef INT_LEAST64_MIN | ||
| 373 | #undef INT_LEAST64_MAX | ||
| 374 | #ifdef GL_INT64_T | ||
| 375 | # define INT_LEAST64_MIN INT64_MIN | ||
| 376 | # define INT_LEAST64_MAX INT64_MAX | ||
| 377 | #endif | ||
| 378 | |||
| 379 | #undef UINT_LEAST64_MAX | ||
| 380 | #ifdef GL_UINT64_T | ||
| 381 | # define UINT_LEAST64_MAX UINT64_MAX | ||
| 382 | #endif | ||
| 383 | |||
| 384 | /* 7.18.2.3. Limits of fastest minimum-width integer types */ | ||
| 385 | |||
| 386 | /* Here we assume a standard architecture where the hardware integer | ||
| 387 | types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types | ||
| 388 | are taken from the same list of types. */ | ||
| 389 | |||
| 390 | #undef INT_FAST8_MIN | ||
| 391 | #undef INT_FAST8_MAX | ||
| 392 | #undef UINT_FAST8_MAX | ||
| 393 | #define INT_FAST8_MIN LONG_MIN | ||
| 394 | #define INT_FAST8_MAX LONG_MAX | ||
| 395 | #define UINT_FAST8_MAX ULONG_MAX | ||
| 396 | |||
| 397 | #undef INT_FAST16_MIN | ||
| 398 | #undef INT_FAST16_MAX | ||
| 399 | #undef UINT_FAST16_MAX | ||
| 400 | #define INT_FAST16_MIN LONG_MIN | ||
| 401 | #define INT_FAST16_MAX LONG_MAX | ||
| 402 | #define UINT_FAST16_MAX ULONG_MAX | ||
| 403 | |||
| 404 | #undef INT_FAST32_MIN | ||
| 405 | #undef INT_FAST32_MAX | ||
| 406 | #undef UINT_FAST32_MAX | ||
| 407 | #define INT_FAST32_MIN LONG_MIN | ||
| 408 | #define INT_FAST32_MAX LONG_MAX | ||
| 409 | #define UINT_FAST32_MAX ULONG_MAX | ||
| 410 | |||
| 411 | #undef INT_FAST64_MIN | ||
| 412 | #undef INT_FAST64_MAX | ||
| 413 | #ifdef GL_INT64_T | ||
| 414 | # define INT_FAST64_MIN INT64_MIN | ||
| 415 | # define INT_FAST64_MAX INT64_MAX | ||
| 416 | #endif | ||
| 417 | |||
| 418 | #undef UINT_FAST64_MAX | ||
| 419 | #ifdef GL_UINT64_T | ||
| 420 | # define UINT_FAST64_MAX UINT64_MAX | ||
| 421 | #endif | ||
| 422 | |||
| 423 | /* 7.18.2.4. Limits of integer types capable of holding object pointers */ | ||
| 424 | |||
| 425 | #undef INTPTR_MIN | ||
| 426 | #undef INTPTR_MAX | ||
| 427 | #undef UINTPTR_MAX | ||
| 428 | #define INTPTR_MIN LONG_MIN | ||
| 429 | #define INTPTR_MAX LONG_MAX | ||
| 430 | #define UINTPTR_MAX ULONG_MAX | ||
| 431 | |||
| 432 | /* 7.18.2.5. Limits of greatest-width integer types */ | ||
| 433 | |||
| 434 | #undef INTMAX_MIN | ||
| 435 | #undef INTMAX_MAX | ||
| 436 | #ifdef INT64_MAX | ||
| 437 | # define INTMAX_MIN INT64_MIN | ||
| 438 | # define INTMAX_MAX INT64_MAX | ||
| 439 | #else | ||
| 440 | # define INTMAX_MIN INT32_MIN | ||
| 441 | # define INTMAX_MAX INT32_MAX | ||
| 442 | #endif | ||
| 443 | |||
| 444 | #undef UINTMAX_MAX | ||
| 445 | #ifdef UINT64_MAX | ||
| 446 | # define UINTMAX_MAX UINT64_MAX | ||
| 447 | #else | ||
| 448 | # define UINTMAX_MAX UINT32_MAX | ||
| 449 | #endif | ||
| 450 | |||
| 451 | /* 7.18.3. Limits of other integer types */ | ||
| 452 | |||
| 453 | /* ptrdiff_t limits */ | ||
| 454 | #undef PTRDIFF_MIN | ||
| 455 | #undef PTRDIFF_MAX | ||
| 456 | #if @APPLE_UNIVERSAL_BUILD@ | ||
| 457 | # ifdef _LP64 | ||
| 458 | # define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) | ||
| 459 | # define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) | ||
| 460 | # else | ||
| 461 | # define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) | ||
| 462 | # define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) | ||
| 463 | # endif | ||
| 464 | #else | ||
| 465 | # define PTRDIFF_MIN \ | ||
| 466 | _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) | ||
| 467 | # define PTRDIFF_MAX \ | ||
| 468 | _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) | ||
| 469 | #endif | ||
| 470 | |||
| 471 | /* sig_atomic_t limits */ | ||
| 472 | #undef SIG_ATOMIC_MIN | ||
| 473 | #undef SIG_ATOMIC_MAX | ||
| 474 | #define SIG_ATOMIC_MIN \ | ||
| 475 | _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ | ||
| 476 | 0@SIG_ATOMIC_T_SUFFIX@) | ||
| 477 | #define SIG_ATOMIC_MAX \ | ||
| 478 | _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ | ||
| 479 | 0@SIG_ATOMIC_T_SUFFIX@) | ||
| 480 | |||
| 481 | |||
| 482 | /* size_t limit */ | ||
| 483 | #undef SIZE_MAX | ||
| 484 | #if @APPLE_UNIVERSAL_BUILD@ | ||
| 485 | # ifdef _LP64 | ||
| 486 | # define SIZE_MAX _STDINT_MAX (0, 64, 0ul) | ||
| 487 | # else | ||
| 488 | # define SIZE_MAX _STDINT_MAX (0, 32, 0ul) | ||
| 489 | # endif | ||
| 490 | #else | ||
| 491 | # define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) | ||
| 492 | #endif | ||
| 493 | |||
| 494 | /* wchar_t limits */ | ||
| 495 | /* Get WCHAR_MIN, WCHAR_MAX. | ||
| 496 | This include is not on the top, above, because on OSF/1 4.0 we have a | ||
| 497 | sequence of nested includes | ||
| 498 | <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes | ||
| 499 | <stdint.h> and assumes its types are already defined. */ | ||
| 500 | #if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) | ||
| 501 | /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
| 502 | included before <wchar.h>. */ | ||
| 503 | # include <stddef.h> | ||
| 504 | # include <stdio.h> | ||
| 505 | # include <time.h> | ||
| 506 | # define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H | ||
| 507 | # include <wchar.h> | ||
| 508 | # undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H | ||
| 509 | #endif | ||
| 510 | #undef WCHAR_MIN | ||
| 511 | #undef WCHAR_MAX | ||
| 512 | #define WCHAR_MIN \ | ||
| 513 | _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) | ||
| 514 | #define WCHAR_MAX \ | ||
| 515 | _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) | ||
| 516 | |||
| 517 | /* wint_t limits */ | ||
| 518 | #undef WINT_MIN | ||
| 519 | #undef WINT_MAX | ||
| 520 | #define WINT_MIN \ | ||
| 521 | _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) | ||
| 522 | #define WINT_MAX \ | ||
| 523 | _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) | ||
| 524 | |||
| 525 | #endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */ | ||
| 526 | |||
| 527 | /* 7.18.4. Macros for integer constants */ | ||
| 528 | |||
| 529 | #if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS | ||
| 530 | |||
| 531 | /* 7.18.4.1. Macros for minimum-width integer constants */ | ||
| 532 | /* According to ISO C 99 Technical Corrigendum 1 */ | ||
| 533 | |||
| 534 | /* Here we assume a standard architecture where the hardware integer | ||
| 535 | types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ | ||
| 536 | |||
| 537 | #undef INT8_C | ||
| 538 | #undef UINT8_C | ||
| 539 | #define INT8_C(x) x | ||
| 540 | #define UINT8_C(x) x | ||
| 541 | |||
| 542 | #undef INT16_C | ||
| 543 | #undef UINT16_C | ||
| 544 | #define INT16_C(x) x | ||
| 545 | #define UINT16_C(x) x | ||
| 546 | |||
| 547 | #undef INT32_C | ||
| 548 | #undef UINT32_C | ||
| 549 | #define INT32_C(x) x | ||
| 550 | #define UINT32_C(x) x ## U | ||
| 551 | |||
| 552 | #undef INT64_C | ||
| 553 | #undef UINT64_C | ||
| 554 | #if LONG_MAX >> 31 >> 31 == 1 | ||
| 555 | # define INT64_C(x) x##L | ||
| 556 | #elif defined _MSC_VER | ||
| 557 | # define INT64_C(x) x##i64 | ||
| 558 | #elif @HAVE_LONG_LONG_INT@ | ||
| 559 | # define INT64_C(x) x##LL | ||
| 560 | #endif | ||
| 561 | #if ULONG_MAX >> 31 >> 31 >> 1 == 1 | ||
| 562 | # define UINT64_C(x) x##UL | ||
| 563 | #elif defined _MSC_VER | ||
| 564 | # define UINT64_C(x) x##ui64 | ||
| 565 | #elif @HAVE_UNSIGNED_LONG_LONG_INT@ | ||
| 566 | # define UINT64_C(x) x##ULL | ||
| 567 | #endif | ||
| 568 | |||
| 569 | /* 7.18.4.2. Macros for greatest-width integer constants */ | ||
| 570 | |||
| 571 | #undef INTMAX_C | ||
| 572 | #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 | ||
| 573 | # define INTMAX_C(x) x##LL | ||
| 574 | #elif defined GL_INT64_T | ||
| 575 | # define INTMAX_C(x) INT64_C(x) | ||
| 576 | #else | ||
| 577 | # define INTMAX_C(x) x##L | ||
| 578 | #endif | ||
| 579 | |||
| 580 | #undef UINTMAX_C | ||
| 581 | #if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 | ||
| 582 | # define UINTMAX_C(x) x##ULL | ||
| 583 | #elif defined GL_UINT64_T | ||
| 584 | # define UINTMAX_C(x) UINT64_C(x) | ||
| 585 | #else | ||
| 586 | # define UINTMAX_C(x) x##UL | ||
| 587 | #endif | ||
| 588 | |||
| 589 | #endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */ | ||
| 590 | |||
| 591 | #endif /* _GL_STDINT_H */ | ||
| 592 | #endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ | ||