diff --git a/Makefile.in b/Makefile.in index 96a26f8..e230db0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -115,7 +115,7 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ @@ -138,7 +138,7 @@ am__recursive_targets = \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - cscope distdir dist dist-all distcheck + cscope distdir distdir-am dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config.h.in # Read a list of newline-separated strings from the standard input, @@ -307,6 +307,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -347,8 +348,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -481,7 +482,10 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ diff --git a/README.md b/README.md index 7591e7f..82da185 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,7 @@ The ```make install``` target installs OST to the configured location, and ```ma ## License The developer of the original code and/or files is Tripwire, Inc. -Portions created by Tripwire, Inc. are copyright 2000-2018 Tripwire, Inc. +Portions created by Tripwire, Inc. are copyright 2000-2019 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights reserved. This program is free software. The contents of this file are subject to the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. You may redistribute it and/or modify it only in compliance with the GNU General Public License. diff --git a/TRADEMARK b/TRADEMARK index 15825ba..7cfb8f5 100644 --- a/TRADEMARK +++ b/TRADEMARK @@ -2,7 +2,7 @@ TRIPWIRE COPYRIGHT & TRADEMARK NOTICE COPYRIGHT The developer of the original code and/or files is Tripwire, Inc. Portions -created by Tripwire, Inc. are copyright 2000-2018 Tripwire, Inc. +created by Tripwire, Inc. are copyright 2000-2019 Tripwire, Inc. TRADEMARK Tripwire is a registered trademark (the "Trademark") of Tripwire, Inc. All diff --git a/acinclude.m4 b/acinclude.m4 index dc6d0f4..2d13d20 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1,24 +1,78 @@ -# Custom m4 macros for Open Source Tripwire 2.4.3 -# a non-symlinky variant of AC_PROG_LN_S, via: http://www.opensource.apple.com/source/zsh/zsh-34/zsh/aclocal.m4 -# -AC_DEFUN([AC_PROG_LN], -[AC_MSG_CHECKING(whether ln works) -AC_CACHE_VAL(ac_cv_prog_LN, -[rm -f conftestdata conftestlink -echo > conftestdata -if ln conftestdata conftestlink 2>/dev/null -then - rm -f conftestdata conftestlink - ac_cv_prog_LN="ln" -else - rm -f conftestdata - ac_cv_prog_LN="cp" -fi])dnl -LN="$ac_cv_prog_LN" -if test "$ac_cv_prog_LN" = "ln"; then - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi -AC_SUBST(LN)dnl -]) \ No newline at end of file +# Custom m4 macros for Open Source Tripwire 2.4.3 + +# a non-symlinky variant of AC_PROG_LN_S, via: http://www.opensource.apple.com/source/zsh/zsh-34/zsh/aclocal.m4 +# +AC_DEFUN([AC_PROG_LN], +[AC_MSG_CHECKING(whether ln works) +AC_CACHE_VAL(ac_cv_prog_LN, +[rm -f conftestdata conftestlink +echo > conftestdata +if ln conftestdata conftestlink 2>/dev/null +then + rm -f conftestdata conftestlink + ac_cv_prog_LN="ln" +else + rm -f conftestdata + ac_cv_prog_LN="cp" +fi])dnl +LN="$ac_cv_prog_LN" +if test "$ac_cv_prog_LN" = "ln"; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi +AC_SUBST(LN)dnl +]) + +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the current language's compiler +# or gives an error. (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +AC_DEFUN([AX_CHECK_COMPILE_FLAG], +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl +AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" + AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) +AS_VAR_IF(CACHEVAR,yes, + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_COMPILE_FLAGS + diff --git a/aclocal.m4 b/aclocal.m4 index 1995959..6ef15cd 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.15.1 -*- Autoconf -*- +# generated automatically by aclocal 1.16.1 -*- Autoconf -*- -# Copyright (C) 1996-2017 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2017 Free Software Foundation, Inc. +# Copyright (C) 2002-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.]) # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.15' +[am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.15.1], [], +m4_if([$1], [1.16.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.15.1])dnl +[AM_AUTOMAKE_VERSION([1.16.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2017 Free Software Foundation, Inc. +# Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -141,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -332,13 +332,12 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. - # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], @@ -346,49 +345,41 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + AS_CASE([$CONFIG_FILES], + [*\'*], [eval set x "$CONFIG_FILES"], + [*], [set x $CONFIG_FILES]) shift - for mf + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf do # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line + am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`AS_DIRNAME(["$am_mf"])` + am_filepart=`AS_BASENAME(["$am_mf"])` + AM_RUN_LOG([cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles]) || am_rc=$? done + if test $am_rc -ne 0; then + AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. Try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking).]) + fi + AS_UNSET([am_dirpart]) + AS_UNSET([am_filepart]) + AS_UNSET([am_mf]) + AS_UNSET([am_rc]) + rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS @@ -397,18 +388,17 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each '.P' file that we will -# need in order to bootstrap the dependency handling code. +# This code is only required when automatic dependency tracking is enabled. +# This creates each '.Po' and '.Plo' makefile fragment that we'll need in +# order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) + [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2017 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -495,8 +485,8 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# -# +# +# AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. @@ -563,7 +553,7 @@ END Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . +that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM @@ -605,7 +595,7 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -626,7 +616,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2017 Free Software Foundation, Inc. +# Copyright (C) 2003-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -647,7 +637,7 @@ AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -655,49 +645,42 @@ AC_SUBST([am__leading_dot])]) # AM_MAKE_INCLUDE() # ----------------- -# Check to see how make treats includes. +# Check whether make has an 'include' directive that can support all +# the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' +[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) +cat > confinc.mk << 'END' am__doit: - @echo this is the am__doit target + @echo this is the am__doit target >confinc.out .PHONY: am__doit END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) + AS_CASE([$?:`cat confinc.out 2>/dev/null`], + ['0:this is the am__doit target'], + [AS_CASE([$s], + [BSD], [am__include='.include' am__quote='"'], + [am__include='include' am__quote=''])]) + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +AC_MSG_RESULT([${_am_result}]) +AC_SUBST([am__include])]) +AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2017 Free Software Foundation, Inc. +# Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -738,7 +721,7 @@ fi # Obsolete and "removed" macros, that must however still report explicit # error messages when used, to smooth transition. # -# Copyright (C) 1996-2017 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -765,7 +748,7 @@ AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES]) # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -794,7 +777,7 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -841,7 +824,7 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -860,7 +843,7 @@ AC_DEFUN([AM_RUN_LOG], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2017 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -941,7 +924,7 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2017 Free Software Foundation, Inc. +# Copyright (C) 2009-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1001,7 +984,7 @@ AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1029,7 +1012,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2017 Free Software Foundation, Inc. +# Copyright (C) 2006-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1048,7 +1031,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2017 Free Software Foundation, Inc. +# Copyright (C) 2004-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/config.h.in b/config.h.in index f3f1b37..f2875d4 100644 --- a/config.h.in +++ b/config.h.in @@ -3,6 +3,15 @@ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD +/* The normal alignment of `int', in bytes. */ +#undef ALIGNOF_INT + +/* The normal alignment of `long', in bytes. */ +#undef ALIGNOF_LONG + +/* The normal alignment of `long long', in bytes. */ +#undef ALIGNOF_LONG_LONG + /* Compile with debug code */ #undef DEBUG @@ -12,20 +21,51 @@ /* this is the prefix for STL exception functions */ #undef EXCEPTION_NAMESPACE +/* Define to 1 if you have the `bind' function. */ +#undef HAVE_BIND + /* Define to 1 if you have the header file. */ #undef HAVE_BITS_SIGNUM_H +/* Define to 1 if you have the `broken_ac_check_func' function. */ +#undef HAVE_BROKEN_AC_CHECK_FUNC + +/* Define to 1 if you have the header file. */ +#undef HAVE_BSDSOCKET_SOCKETBASETAGS_H + +/* Define to 1 if you have the `chmod' function. */ +#undef HAVE_CHMOD + +/* Define to 1 if you have the `chown' function. */ +#undef HAVE_CHOWN + +/* Uses the Clang compiler */ +#undef HAVE_CLANG + +/* Define to 1 if you have the `close' function. */ +#undef HAVE_CLOSE + +/* Define to 1 if you have the `closedir' function. */ +#undef HAVE_CLOSEDIR + +/* Define to 1 if you have the `closelog' function. */ +#undef HAVE_CLOSELOG + /* Define to 1 if you have the header file. */ #undef HAVE_COMMONCRYPTO_COMMONDIGEST_H -/* Has /dev/arandom */ -#undef HAVE_DEV_ARANDOM +/* Define to 1 if you have the `connect' function. */ +#undef HAVE_CONNECT -/* Has /dev/random */ -#undef HAVE_DEV_RANDOM +/* Define to 1 if you have the header file. */ +#undef HAVE_CTYPE_H -/* Has /dev/urandom */ -#undef HAVE_DEV_URANDOM +/* Define to 1 if you have the `directio' function. */ +#undef HAVE_DIRECTIO + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_DIRENT_H /* Define to 1 if you have the `door_create' function. */ #undef HAVE_DOOR_CREATE @@ -33,45 +73,165 @@ /* Define to 1 if you have the header file. */ #undef HAVE_DOOR_H +/* Define to 1 if you have the `execve' function. */ +#undef HAVE_EXECVE + +/* Define to 1 if you have the `fclose' function. */ +#undef HAVE_FCLOSE + /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H -/* Uses the GNU gcc compiler */ +/* Define to 1 if you have the header file. */ +#undef HAVE_FEATURES_H + +/* Define to 1 if you have the `fopen' function. */ +#undef HAVE_FOPEN + +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Define to 1 if you have the `fread' function. */ +#undef HAVE_FREAD + +/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ +#undef HAVE_FSEEKO + +/* Define to 1 if you have the `fstatat' function. */ +#undef HAVE_FSTATAT + +/* Define to 1 if you have the `ftruncate' function. */ +#undef HAVE_FTRUNCATE + +/* Uses the GNU g++ compiler */ #undef HAVE_GCC +/* Define to 1 if you have the `getaddrinfo' function. */ +#undef HAVE_GETADDRINFO + +/* Define to 1 if you have the `getgid' function. */ +#undef HAVE_GETGID + +/* Define to 1 if you have the `getgrgid' function. */ +#undef HAVE_GETGRGID + +/* Define to 1 if you have the `gethostbyname' function. */ +#undef HAVE_GETHOSTBYNAME + /* Define to 1 if you have the `gethostid' function. */ #undef HAVE_GETHOSTID /* Define to 1 if you have the `gethostname' function. */ #undef HAVE_GETHOSTNAME +/* Define to 1 if you have the `getuid' function. */ +#undef HAVE_GETUID + +/* Compiler supports GNU C++ dialect & args */ +#undef HAVE_GNUC + +/* Define to 1 if you have the header file. */ +#undef HAVE_GRP_H + +/* Uses the aCC compiler */ +#undef HAVE_HP_ACC + +/* Uses the gxlc++ compiler */ +#undef HAVE_IBM_GXLC + +/* Uses the IBM XL C++ compiler */ +#undef HAVE_IBM_XLC + /* Define to 1 if you have the header file. */ #undef HAVE_ICONV_H +/* Uses the Intel ICC compiler */ +#undef HAVE_INTEL_ICC + /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the `isprint' function. */ +#undef HAVE_ISPRINT + /* Define to 1 if you have the header file. */ #undef HAVE_LANGINFO_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if you have the `link' function. */ +#undef HAVE_LINK + +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE + +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE_H + +/* Define to 1 if you have the `lstat' function. */ +#undef HAVE_LSTAT + /* Define to 1 if you have the header file. */ #undef HAVE_MALLOC_H +/* Define to 1 if you have the `mblen' function. */ +#undef HAVE_MBLEN + +/* Define to 1 if you have the `mbtowc' function. */ +#undef HAVE_MBTOWC + +/* Define to 1 if you have the `memcpy_s' function. */ +#undef HAVE_MEMCPY_S + /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the `mkfifo' function. */ +#undef HAVE_MKFIFO + +/* Define to 1 if you have the `mknod' function. */ +#undef HAVE_MKNOD + /* Define to 1 if you have the `mkstemp' function. */ #undef HAVE_MKSTEMP /* Define to 1 if you have the `mktemp' function. */ #undef HAVE_MKTEMP +/* Define to 1 if you have the header file, and it defines `DIR'. */ +#undef HAVE_NDIR_H + +/* Define to 1 if you have the `open' function. */ +#undef HAVE_OPEN + +/* Define to 1 if you have the `openat' function. */ +#undef HAVE_OPENAT + +/* Define to 1 if you have the `opendir' function. */ +#undef HAVE_OPENDIR + +/* Define to 1 if you have the `openlog' function. */ +#undef HAVE_OPENLOG + /* Define to 1 if you have the header file. */ #undef HAVE_OPENSSL_MD5_H /* Define to 1 if you have the header file. */ #undef HAVE_OPENSSL_SHA_H +/* Uses the OpenWatcom compiler */ +#undef HAVE_OPENWATCOM + +/* Uses the sunCC compiler */ +#undef HAVE_ORACLE_SUNCC + +/* Define to 1 if you have the `popen' function. */ +#undef HAVE_POPEN + /* Define to 1 if you have the `port_create' function. */ #undef HAVE_PORT_CREATE @@ -81,9 +241,60 @@ /* Define to 1 if you have the `posix_fadvise' function. */ #undef HAVE_POSIX_FADVISE +/* Define to 1 if you have the `posix_spawn' function. */ +#undef HAVE_POSIX_SPAWN + +/* Define to 1 if you have the header file. */ +#undef HAVE_PROTO_BSDSOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PROTO_EXEC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PTHREAD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PWD_H + +/* Define to 1 if you have the `read' function. */ +#undef HAVE_READ + +/* Define to 1 if you have the `readdir' function. */ +#undef HAVE_READDIR + +/* Define to 1 if you have the `readlink' function. */ +#undef HAVE_READLINK + +/* Define to 1 if you have the `readlinkat' function. */ +#undef HAVE_READLINKAT + +/* Define to 1 if you have the `rename' function. */ +#undef HAVE_RENAME + +/* Define to 1 if you have the `setgid' function. */ +#undef HAVE_SETGID + +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if you have the `setuid' function. */ +#undef HAVE_SETUID + /* Define to 1 if you have the header file. */ #undef HAVE_SIGNUM_H +/* Define to 1 if you have the `socket' function. */ +#undef HAVE_SOCKET + +/* Define to 1 if you have the header file. */ +#undef HAVE_SSTREAM + +/* Define to 1 if you have the `stat' function. */ +#undef HAVE_STAT + +/* Define to 1 if you have the `statx' function. */ +#undef HAVE_STATX + /* Define to 1 if you have the header file. */ #undef HAVE_STDARG_H @@ -93,6 +304,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H +/* Define if STLport library is used */ +#undef HAVE_STLPORT + /* Define to 1 if you have the `strftime' function. */ #undef HAVE_STRFTIME @@ -102,24 +316,59 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H +/* Define to 1 if you have the header file. */ +#undef HAVE_STRSTREAM + +/* Define to 1 if `st_attrib' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_ATTRIB + +/* Define to 1 if `st_blksize' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_BLKSIZE + /* Define to 1 if `st_blocks' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLOCKS +/* Define to 1 if `st_flag' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_FLAG + +/* Define to 1 if `st_flags' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_FLAGS + +/* Define to 1 if `st_gen' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_GEN + /* Define to 1 if `st_rdev' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_RDEV /* Define to 1 if you have the `swab' function. */ #undef HAVE_SWAB +/* Define to 1 if you have the `symlink' function. */ +#undef HAVE_SYMLINK + +/* Define to 1 if you have the `syslog' function. */ +#undef HAVE_SYSLOG + /* Define to 1 if you have the header file. */ #undef HAVE_SYSLOG_H +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_DIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_FILE_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_FS_VX_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MOUNT_H +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_NDIR_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H @@ -141,6 +390,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SYSMACROS_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H @@ -153,22 +405,52 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_UTSNAME_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TERMIOS_H + +/* Define to 1 if you have the `tmpnam' function. */ +#undef HAVE_TMPNAM + +/* Define to 1 if you have the `tzset' function. */ +#undef HAVE_TZSET + +/* Define to 1 if the system has the type `uintptr_t'. */ +#undef HAVE_UINTPTR_T + /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if you have the header file. */ +#undef HAVE_UNIXLIB_LOCAL_H + +/* Define to 1 if you have the `unlink' function. */ +#undef HAVE_UNLINK + /* Define to 1 if you have the header file. */ #undef HAVE_VARARGS_H +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK + /* Define to 1 if you have the header file. */ #undef HAVE_WCHAR_H -/* Is byte aligned */ -#undef IS_BYTE_ALIGNED +/* Define to 1 if you have the file `/dev/arandom'. */ +#undef HAVE__DEV_ARANDOM -/* Is a unix type platform */ -#undef IS_UNIX +/* Define to 1 if you have the file `/dev/random'. */ +#undef HAVE__DEV_RANDOM -/* don't generate debuging code */ +/* Define to 1 if you have the file `/dev/urandom'. */ +#undef HAVE__DEV_URANDOM + +/* Define to 1 if you have the `_exit' function. */ +#undef HAVE__EXIT + +/* Compile without debug code */ #undef NDEBUG /* Name of package */ @@ -204,6 +486,9 @@ /* The size of `time_t', as computed by sizeof. */ #undef SIZEOF_TIME_T +/* The size of `wchar_t', as computed by sizeof. */ +#undef SIZEOF_WCHAR_T + /* Don't use gethostbyname() on Solaris */ #undef SOLARIS_NO_GETHOSTBYNAME @@ -225,6 +510,28 @@ /* Uses signed magnitute */ #undef USES_SIGNED_MAGNITUDE +/* 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 + + /* Version number of package */ #undef VERSION @@ -240,8 +547,63 @@ # endif #endif +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ +#undef _LARGEFILE_SOURCE + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE + +/* Define to 1 if type `char' is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +# undef __CHAR_UNSIGNED__ +#endif + /* Define to empty if `const' does not conform to ANSI C. */ #undef const +/* Define to `int' if doesn't define. */ +#undef gid_t + +/* 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 or + __restrict__, even though the corresponding Sun C compiler ends up with + "#define restrict _Restrict" or "#define restrict __restrict__" in the + previous line. Perhaps some future version of Sun C++ will work with + restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ +#if defined __SUNPRO_CC && !defined __RESTRICT +# define _Restrict +# define __restrict__ +#endif + /* Define to `unsigned int' if does not define. */ #undef size_t + +/* Define to `int' if doesn't define. */ +#undef uid_t + +/* Define to the type of an unsigned integer type wide enough to hold a + pointer, if such a type exists, and if the system does not define it. */ +#undef uintptr_t + +#include "core/fixups.h" diff --git a/configure b/configure index 2b35c0d..4833d48 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.ac Revision: 2.4.3.7 . +# From configure.ac Revision: 2.4.3.8 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for tripwire 2.4.3.7. +# Generated by GNU Autoconf 2.69 for tripwire 2.4.3.8. # # Report bugs to . # @@ -12,7 +12,7 @@ # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # -# The developer of the original code and/or files is Tripwire, Inc. Portions created by Tripwire, Inc. are copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights reserved. +# The developer of the original code and/or files is Tripwire, Inc. Portions created by Tripwire, Inc. are copyright 2000-2019 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights reserved. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## @@ -584,8 +584,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='tripwire' PACKAGE_TARNAME='tripwire' -PACKAGE_VERSION='2.4.3.7' -PACKAGE_STRING='tripwire 2.4.3.7' +PACKAGE_VERSION='2.4.3.8' +PACKAGE_STRING='tripwire 2.4.3.8' PACKAGE_BUGREPORT='https://github.com/Tripwire/tripwire-open-source/issues' PACKAGE_URL='https://github.com/Tripwire/tripwire-open-source' @@ -632,9 +632,6 @@ LTLIBOBJS LIBOBJS CORE_CRYPT_O CXXCPP -EGREP -GREP -CPP path_to_sendmail path_to_vi AR @@ -649,6 +646,9 @@ CXXDEPMODE ac_ct_CXX CXXFLAGS CXX +EGREP +GREP +CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE @@ -656,7 +656,6 @@ am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE -am__quote am__include DEPDIR OBJEXT @@ -724,6 +723,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -742,18 +742,19 @@ PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR -SHELL' +SHELL +am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules -enable_extrawarnings +enable_dependency_tracking enable_static enable_debug enable_coverage enable_profiling enable_urandom -enable_dependency_tracking +enable_largefile enable_commoncrypto enable_iconv enable_openssl @@ -767,12 +768,12 @@ CFLAGS LDFLAGS LIBS CPPFLAGS +CPP CXX CXXFLAGS CCC YACC YFLAGS -CPP CXXCPP' @@ -812,6 +813,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1064,6 +1066,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1201,7 +1212,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1314,7 +1325,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures tripwire 2.4.3.7 to adapt to many kinds of systems. +\`configure' configures tripwire 2.4.3.8 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1354,6 +1365,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1385,7 +1397,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of tripwire 2.4.3.7:";; + short | recursive ) echo "Configuration of tripwire 2.4.3.8:";; esac cat <<\_ACEOF @@ -1395,16 +1407,16 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") - —-disable-extrawarnings do not compile with -Wextra warnings enabled + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build --enable-static compile static binaries --enable-debug compile with debuging enabled --enable-coverage enable code coverage --enable-profiling enable profiling --enable-urandom use /dev/urandom - --enable-dependency-tracking - do not reject slow dependency extractors - --disable-dependency-tracking - speeds up one-time build + --disable-largefile omit support for large files --disable-commoncrypto Don't use CommonCrypto hash implementations (OSX only) --enable-iconv Use iconv for locale-independent report and db files --disable-openssl Don't link against OpenSSL libraries @@ -1422,6 +1434,7 @@ Some influential environment variables: LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory + CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags YACC The `Yet Another Compiler Compiler' implementation to use. @@ -1430,7 +1443,6 @@ Some influential environment variables: YFLAGS The list of arguments that will be passed by default to $YACC. This script will default YFLAGS to the empty string to avoid a default value of `-d' given by some make applications. - CPP C preprocessor CXXCPP C++ preprocessor Use these variables to override the choices made by `configure' or to help @@ -1500,14 +1512,14 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -tripwire configure 2.4.3.7 +tripwire configure 2.4.3.8 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. -The developer of the original code and/or files is Tripwire, Inc. Portions created by Tripwire, Inc. are copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights reserved. +The developer of the original code and/or files is Tripwire, Inc. Portions created by Tripwire, Inc. are copyright 2000-2019 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights reserved. _ACEOF exit fi @@ -1554,44 +1566,6 @@ fi } # ac_fn_c_try_compile -# ac_fn_cxx_try_compile LINENO -# ---------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_compile - # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. @@ -1629,48 +1603,6 @@ fi } # ac_fn_c_try_cpp -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using @@ -1762,6 +1694,48 @@ fi } # ac_fn_c_check_header_mongrel +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in @@ -1793,315 +1767,21 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_header_compile -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_type - -# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES -# -------------------------------------------- -# Tries to find the compile-time value of EXPR in a program that includes -# INCLUDES, setting VAR accordingly. Returns whether the value could be -# computed -ac_fn_c_compute_int () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) >= 0)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=0 ac_mid=0 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid; break -else - as_fn_arith $ac_mid + 1 && ac_lo=$as_val - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) < 0)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=-1 ac_mid=-1 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) >= $ac_mid)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=$ac_mid; break -else - as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - ac_lo= ac_hi= -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid -else - as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in #(( -?*) eval "$3=\$ac_lo"; ac_retval=0 ;; -'') ac_retval=1 ;; -esac - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -static long int longval () { return $2; } -static unsigned long int ulongval () { return $2; } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if (($2) < 0) - { - long int i = longval (); - if (i != ($2)) - return 1; - fprintf (f, "%ld", i); - } - else - { - unsigned long int i = ulongval (); - if (i != ($2)) - return 1; - fprintf (f, "%lu", i); - } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - echo >>conftest.val; read $3 &5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (sizeof ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - eval "$4=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$4 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_member - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err + (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 @@ -2110,12 +1790,9 @@ $as_echo "$ac_try_echo"; } >&5 fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || + test -z "$ac_cxx_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : + } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 @@ -2123,82 +1800,10 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval -} # ac_fn_c_try_link - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_func +} # ac_fn_cxx_try_compile # ac_fn_cxx_try_cpp LINENO # ------------------------ @@ -2237,6 +1842,94 @@ fi } # ac_fn_cxx_try_cpp +# ac_fn_cxx_try_run LINENO +# ------------------------ +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_cxx_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_run + +# ac_fn_cxx_try_link LINENO +# ------------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_link + # ac_fn_cxx_check_header_mongrel LINENO HEADER VAR INCLUDES # --------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using @@ -2328,51 +2021,330 @@ fi } # ac_fn_cxx_check_header_mongrel -# ac_fn_cxx_try_link LINENO -# ------------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_link () +# ac_fn_cxx_check_header_compile LINENO HEADER VAR INCLUDES +# --------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_cxx_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_cxx_check_header_compile + +# ac_fn_cxx_check_type LINENO TYPE VAR INCLUDES +# --------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_cxx_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_cxx_check_type + +# ac_fn_cxx_compute_int LINENO EXPR VAR INCLUDES +# ---------------------------------------------- +# Tries to find the compile-time value of EXPR in a program that includes +# INCLUDES, setting VAR accordingly. Returns whether the value could be +# computed +ac_fn_cxx_compute_int () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_lo=0 ac_mid=0 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_hi=$ac_mid; break +else + as_fn_arith $ac_mid + 1 && ac_lo=$as_val + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) < 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_hi=-1 ac_mid=-1 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_lo=$ac_mid; break +else + as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + ac_lo= ac_hi= +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_hi=$ac_mid +else + as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in #(( +?*) eval "$3=\$ac_lo"; ac_retval=0 ;; +'') ac_retval=1 ;; +esac + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +static long int longval () { return $2; } +static unsigned long int ulongval () { return $2; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (($2) < 0) + { + long int i = longval (); + if (i != ($2)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ($2)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_run "$LINENO"; then : + echo >>conftest.val; read $3 &5 +$as_echo_n "checking for $2.$3... " >&6; } +if eval \${$4+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main () +{ +static $2 ac_aggr; +if (ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + eval "$4=yes" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main () +{ +static $2 ac_aggr; +if (sizeof ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + eval "$4=yes" +else + eval "$4=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$4 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_cxx_check_member # ac_fn_cxx_check_func LINENO FUNC VAR # ------------------------------------ @@ -2444,7 +2416,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by tripwire $as_me 2.4.3.7, which was +It was created by tripwire $as_me 2.4.3.8, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2932,7 +2904,7 @@ test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- -am__api_version='1.15' +am__api_version='1.16' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -3418,7 +3390,7 @@ fi # Define the identity of the package. PACKAGE='tripwire' - VERSION='2.4.3.7' + VERSION='2.4.3.8' cat >>confdefs.h <<_ACEOF @@ -3448,8 +3420,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# -# +# +# mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The @@ -3500,7 +3472,7 @@ END Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . +that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM @@ -3517,84 +3489,68 @@ ac_config_headers="$ac_config_headers config.h" -CFLAGS=${CFLAGS:-"-O -pipe -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"} -CXXFLAGS=${CXXFLAGS:-"-O -pipe -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"} +DEPDIR="${am__leading_dot}deps" +ac_config_commands="$ac_config_commands depfiles" -# This is primarily to support old compilers that don’t understand -Wextra -# Check whether --enable-extrawarnings was given. -if test "${enable_extrawarnings+set}" = set; then : - enableval=$enable_extrawarnings; +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in #( + '0:this is the am__doit target') : + case $s in #( + BSD) : + am__include='.include' am__quote='"' ;; #( + *) : + am__include='include' am__quote='' ;; +esac ;; #( + *) : + ;; +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +$as_echo "${_am_result}" >&6; } + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; fi -if test "x$enable_extrawarnings" != "xno" -then - CFLAGS="${CFLAGS} -Wextra -Wno-unused-parameter" - CXXFLAGS="${CXXFLAGS} -Wextra -Wno-unused-parameter" +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' fi - -# Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : - enableval=$enable_static; -fi - -if test "x$enable_static" = xyes -then LDFLAGS="${LDFLAGS} -static" -fi - -# Check whether --enable-debug was given. -if test "${enable_debug+set}" = set; then : - enableval=$enable_debug; -fi - -if test "x$enable_debug" = xyes -then - CFLAGS="${CFLAGS} -g" - CXXFLAGS="${CXXFLAGS} -g" - -$as_echo "#define DEBUG 1" >>confdefs.h - + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' else - -$as_echo "#define NDEBUG 1" >>confdefs.h - + AMDEP_TRUE='#' + AMDEP_FALSE= fi -# Check whether --enable-coverage was given. -if test "${enable_coverage+set}" = set; then : - enableval=$enable_coverage; -fi - -if test "x$enable_coverage" = xyes -then - CFLAGS="${CFLAGS} --coverage" - CXXFLAGS="${CXXFLAGS} --coverage" - LDFLAGS="${LDFLAGS} --coverage" -fi - -# Check whether --enable-profiling was given. -if test "${enable_profiling+set}" = set; then : - enableval=$enable_profiling; -fi - -if test "x$enable_profiling" = xyes -then - CFLAGS="${CFLAGS} -pg" - CXXFLAGS="${CXXFLAGS} -pg" - LDFLAGS="${LDFLAGS} -pg" -fi - -# Check whether --enable-urandom was given. -if test "${enable_urandom+set}" = set; then : - enableval=$enable_urandom; -fi - -if test "x$enable_urandom" = xyes -then - -$as_echo "#define ENABLE_DEV_URANDOM 1" >>confdefs.h - -fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -3602,7 +3558,197 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then - for ac_prog in gcc clang suncc aCC xlC_r xlC cl.exe + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 @@ -3646,7 +3792,7 @@ fi fi if test -z "$CC"; then ac_ct_CC=$CC - for ac_prog in gcc clang suncc aCC xlC_r xlC cl.exe + for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -3701,6 +3847,8 @@ esac fi fi +fi + test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} @@ -4251,69 +4399,6 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - depcc="$CC" am_compiler_list= @@ -4443,6 +4528,477 @@ else fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" +if test "x$ac_cv_header_minix_config_h" = xyes; then : + MINIX=yes +else + MINIX= +fi + + + if test "$MINIX" = yes; then + +$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h + + +$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h + + +$as_echo "#define _MINIX 1" >>confdefs.h + + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if ${ac_cv_safe_to_define___extensions__+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# define __EXTENSIONS__ 1 + $ac_includes_default +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_safe_to_define___extensions__=yes +else + ac_cv_safe_to_define___extensions__=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } + test $ac_cv_safe_to_define___extensions__ = yes && + $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h + + $as_echo "#define _ALL_SOURCE 1" >>confdefs.h + + $as_echo "#define _GNU_SOURCE 1" >>confdefs.h + + $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h + + + +tmp_cxxflags=${CXXFLAGS} +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +CXXFLAGS=${tmp_cxxflags} + + + ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -4453,7 +5009,7 @@ if test -z "$CXX"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ clang++ sunCC aCC xlC_r xlC cl.exe + for ac_prog in g++ clang++ sunCC aCC xlc++_r gxlc++ ixlc icpc owcc cl KCC cfront c++ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 @@ -4497,7 +5053,7 @@ fi fi if test -z "$CXX"; then ac_ct_CXX=$CXX - for ac_prog in g++ c++ clang++ sunCC aCC xlC_r xlC cl.exe + for ac_prog in g++ clang++ sunCC aCC xlc++_r gxlc++ ixlc icpc owcc cl KCC cfront c++ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -4694,11 +5250,11 @@ else CXXFLAGS= fi fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu depcc="$CXX" am_compiler_list= @@ -5177,296 +5733,97 @@ fi + + if test "x${GXX}" != "x"; then + CXXFLAGS=${CXXFLAGS:-"-O -pipe"} + + +$as_echo "#define HAVE_GNUC 1" >>confdefs.h + + + case "${CXX}" in + *clang++*) + +$as_echo "#define HAVE_CLANG 1" >>confdefs.h + + ;; + icpc) + +$as_echo "#define HAVE_INTEL_ICC 1" >>confdefs.h + + ;; + *) + $as_echo "#define HAVE_GCC 1" >>confdefs.h -else - -$as_echo "#define HAVE_GCC 0" >>confdefs.h - -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : + ;; + esac else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext + if test "x${CXX}" = "xclang++"; then - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext +$as_echo "#define HAVE_CLANG 1" >>confdefs.h -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count + CXXFLAGS=${CXXFLAGS:-"-O -pipe"} fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi + if test "x${CXX}" = "xgxlc++"; then -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" +$as_echo "#define HAVE_IBM_GXLC 1" >>confdefs.h -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count + export OBJECT_MODE=64 + CXXFLAGS=${CXXFLAGS:-"-O -maix64 -Wx,-qinfo=all"} + ARFLAGS=${ARFLAGS:-"-X 64"} fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP + if test "x${CXX}" = "xxlc++_r"; then + +$as_echo "#define HAVE_IBM_XLC 1" >>confdefs.h + + + export OBJECT_MODE=64 + CXXFLAGS=${CXXFLAGS:-"-O -q64 -qinfo=all -qsuppress=1540-5311:1540-5337:1540-5341"} + ARFLAGS=${ARFLAGS:-"-X 64"} + fi + + + if test "x${CXX}" = "xsunCC"; then + +$as_echo "#define HAVE_ORACLE_SUNCC 1" >>confdefs.h + + fi + + if test "x${CXX}" = "xaCC"; then + +$as_echo "#define HAVE_HP_ACC 1" >>confdefs.h + + fi + + if test "x${CXX}" = "xowcc"; then + +$as_echo "#define HAVE_OPENWATCOM 1" >>confdefs.h + + CXXFLAGS=${CXXFLAGS:-"-xs"} + fi + + fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wall" >&5 +$as_echo_n "checking whether C++ compiler accepts -Wall... " >&6; } +if ${ax_cv_check_cxxflags___Wall+:} false; then : $as_echo_n "(cached) " >&6 else + + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS -Wall" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include -#include int main () @@ -5476,255 +5833,30 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes +if ac_fn_cxx_try_compile "$LINENO"; then : + ax_cv_check_cxxflags___Wall=yes else - ac_cv_header_stdc=no + ax_cv_check_cxxflags___Wall=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - + CXXFLAGS=$ax_check_save_flags +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags___Wall" >&5 +$as_echo "$ax_cv_check_cxxflags___Wall" >&6; } +if test "x$ax_cv_check_cxxflags___Wall" = xyes; then : + CXXFLAGS="$CXXFLAGS -Wall" else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext fi -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in sys/param.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_param_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_PARAM_H 1 -_ACEOF - -fi - -done - -for ac_header in sys/mount.h -do : - ac_fn_c_check_header_compile "$LINENO" "sys/mount.h" "ac_cv_header_sys_mount_h" "#if defined(HAVE_SYS_PARAM_H) -#include -#endif - -" -if test "x$ac_cv_header_sys_mount_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_MOUNT_H 1 -_ACEOF - -fi - -done - -for ac_header in sys/ustat.h sys/sysmacros.h sys/syslog.h sys/socket.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -for ac_header in unistd.h sys/unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -for ac_header in syslog.h langinfo.h sys/statfs.h sys/select.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -for ac_header in signum.h bits/signum.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - break -fi - -done - -for ac_header in stdarg.h varargs.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - break -fi - -done - -for ac_header in sys/utsname.h memory.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -for ac_header in sys/fs/vx_ioctl.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/fs/vx_ioctl.h" "ac_cv_header_sys_fs_vx_ioctl_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_fs_vx_ioctl_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_FS_VX_IOCTL_H 1 -_ACEOF - -fi - -done - - -CPPFLAGS_SAVE="${CPPFLAGS}" -CPPFLAGS="${CPPFLAGS} -Werror" -for ac_header in malloc.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "malloc.h" "ac_cv_header_malloc_h" "$ac_includes_default" -if test "x$ac_cv_header_malloc_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_MALLOC_H 1 -_ACEOF - -fi - -done - -CPPFLAGS="${CPPFLAGS_SAVE}" - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if ${ac_cv_c_const+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wextra" >&5 +$as_echo_n "checking whether C++ compiler accepts -Wextra... " >&6; } +if ${ax_cv_check_cxxflags___Wextra+:} false; then : $as_echo_n "(cached) " >&6 else + + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS -Wextra" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5732,1020 +5864,124 @@ int main () { -#ifndef __cplusplus - /* Ultrix mips cc rejects this sort of thing. */ - typedef int charset[2]; - const charset cs = { 0, 0 }; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *pcpcc; - char **ppc; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - pcpcc = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++pcpcc; - ppc = (char**) pcpcc; - pcpcc = (char const *const *) ppc; - { /* SCO 3.2v4 cc rejects this sort of thing. */ - char tx; - char *t = &tx; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; - if (s) return 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; } bx; - struct s *b = &bx; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - if (!foo) return 0; - } - return !cs[0] && !zero.x; -#endif - ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_const=yes +if ac_fn_cxx_try_compile "$LINENO"; then : + ax_cv_check_cxxflags___Wextra=yes else - ac_cv_c_const=no + ax_cv_check_cxxflags___Wextra=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CXXFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } -if test $ac_cv_c_const = no; then - -$as_echo "#define const /**/" >>confdefs.h - -fi - -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags___Wextra" >&5 +$as_echo "$ax_cv_check_cxxflags___Wextra" >&6; } +if test "x$ax_cv_check_cxxflags___Wextra" = xyes; then : + CXXFLAGS="$CXXFLAGS -Wextra" else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF - + : fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 -$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if ${ac_cv_header_time+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wno-unused-parameter" >&5 +$as_echo_n "checking whether C++ compiler accepts -Wno-unused-parameter... " >&6; } +if ${ax_cv_check_cxxflags___Wno_unused_parameter+:} false; then : $as_echo_n "(cached) " >&6 else + + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS -Wno-unused-parameter" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include int main () { -if ((struct tm *) 0) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_time=yes -else - ac_cv_header_time=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 -$as_echo "$ac_cv_header_time" >&6; } -if test $ac_cv_header_time = yes; then - -$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 -$as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if ${ac_cv_c_bigendian+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_bigendian=unknown - # See if we're dealing with a universal compiler. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __APPLE_CC__ - not a universal capable compiler - #endif - typedef int dummy; - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - # Check for potential -arch flags. It is not universal unless - # there are at least two -arch flags with different values. - ac_arch= - ac_prev= - for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do - if test -n "$ac_prev"; then - case $ac_word in - i?86 | x86_64 | ppc | ppc64) - if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then - ac_arch=$ac_word - else - ac_cv_c_bigendian=universal - break - fi - ;; - esac - ac_prev= - elif test "x$ac_word" = "x-arch"; then - ac_prev=arch - fi - done -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $ac_cv_c_bigendian = unknown; then - # See if sys/param.h defines the BYTE_ORDER macro. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - -int -main () -{ -#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ - && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ - && LITTLE_ENDIAN) - bogus endian macros - #endif ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - -int -main () -{ -#if BYTE_ORDER != BIG_ENDIAN - not big endian - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes +if ac_fn_cxx_try_compile "$LINENO"; then : + ax_cv_check_cxxflags___Wno_unused_parameter=yes else - ac_cv_c_bigendian=no + ax_cv_check_cxxflags___Wno_unused_parameter=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CXXFLAGS=$ax_check_save_flags fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) - bogus endian macros - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to _BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -#ifndef _BIG_ENDIAN - not big endian - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags___Wno_unused_parameter" >&5 +$as_echo "$ax_cv_check_cxxflags___Wno_unused_parameter" >&6; } +if test "x$ax_cv_check_cxxflags___Wno_unused_parameter" = xyes; then : + CXXFLAGS="$CXXFLAGS -Wno-unused-parameter" else - ac_cv_c_bigendian=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # Compile a test program. - if test "$cross_compiling" = yes; then : - # Try to guess by grepping values from an object file. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -short int ascii_mm[] = - { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; - short int ascii_ii[] = - { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; - int use_ascii (int i) { - return ascii_mm[i] + ascii_ii[i]; - } - short int ebcdic_ii[] = - { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; - short int ebcdic_mm[] = - { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; - int use_ebcdic (int i) { - return ebcdic_mm[i] + ebcdic_ii[i]; - } - extern int foo; - -int -main () -{ -return use_ascii (foo) == use_ebcdic (foo); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then - ac_cv_c_bigendian=yes - fi - if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi - fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ - - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_c_bigendian=no -else - ac_cv_c_bigendian=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext + : fi - fi + + + +# Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 -$as_echo "$ac_cv_c_bigendian" >&6; } - case $ac_cv_c_bigendian in #( - yes) - $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h -;; #( - no) - ;; #( - universal) -$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h +if test "x$enable_static" = xyes +then LDFLAGS="${LDFLAGS} -static" +fi - ;; #( - *) - as_fn_error $? "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; - esac +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then : + enableval=$enable_debug; +fi -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 -$as_echo_n "checking size of int... " >&6; } -if ${ac_cv_sizeof_int+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : +if test "x$enable_debug" = xyes +then + CXXFLAGS="${CXXFLAGS} -g" + +$as_echo "#define DEBUG 1" >>confdefs.h else - if test "$ac_cv_type_int" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (int) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_int=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 -$as_echo "$ac_cv_sizeof_int" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_INT $ac_cv_sizeof_int -_ACEOF - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 -$as_echo_n "checking size of long... " >&6; } -if ${ac_cv_sizeof_long+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_long" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (long) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_long=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 -$as_echo "$ac_cv_sizeof_long" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_LONG $ac_cv_sizeof_long -_ACEOF - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 -$as_echo_n "checking size of long long... " >&6; } -if ${ac_cv_sizeof_long_long+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_long_long" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (long long) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_long_long=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 -$as_echo "$ac_cv_sizeof_long_long" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long -_ACEOF - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5 -$as_echo_n "checking size of time_t... " >&6; } -if ${ac_cv_sizeof_time_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_time_t" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (time_t) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_time_t=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_time_t" >&5 -$as_echo "$ac_cv_sizeof_time_t" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_TIME_T $ac_cv_sizeof_time_t -_ACEOF - - - - -$as_echo "#define USES_1S_COMPLEMENT 0" >>confdefs.h - - -$as_echo "#define USES_2S_COMPLEMENT 1" >>confdefs.h - - -$as_echo "#define USES_SIGNED_MAGNITUDE 0" >>confdefs.h - - -$as_echo "#define IS_BYTE_ALIGNED 1" >>confdefs.h - - -$as_echo "#define EXCEPTION_NAMESPACE std::" >>confdefs.h - - - -$as_echo "#define IS_UNIX 1" >>confdefs.h - - $as_echo "#define NDEBUG 1" >>confdefs.h - -ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_rdev" = xyes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_RDEV 1 -_ACEOF - - -fi -ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_BLOCKS 1 -_ACEOF - - fi - -for ac_func in strftime gethostname gethostid -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -for ac_func in mkstemp mktemp -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - break -fi -done - -for ac_func in swab -do : - ac_fn_c_check_func "$LINENO" "swab" "ac_cv_func_swab" -if test "x$ac_cv_func_swab" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SWAB 1 -_ACEOF - -fi -done - - -for ac_header in fcntl.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" -if test "x$ac_cv_header_fcntl_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_FCNTL_H 1 -_ACEOF - for ac_func in posix_fadvise -do : - ac_fn_c_check_func "$LINENO" "posix_fadvise" "ac_cv_func_posix_fadvise" -if test "x$ac_cv_func_posix_fadvise" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_POSIX_FADVISE 1 -_ACEOF - -fi -done - +# Check whether --enable-coverage was given. +if test "${enable_coverage+set}" = set; then : + enableval=$enable_coverage; fi -done - - -# Check whether --enable-commoncrypto was given. -if test "${enable_commoncrypto+set}" = set; then : - enableval=$enable_commoncrypto; -fi - - -if test "x${enable_commoncrypto}" != "xno" +if test "x$enable_coverage" = xyes then - for ac_header in CommonCrypto/CommonDigest.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "CommonCrypto/CommonDigest.h" "ac_cv_header_CommonCrypto_CommonDigest_h" "$ac_includes_default" -if test "x$ac_cv_header_CommonCrypto_CommonDigest_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_COMMONCRYPTO_COMMONDIGEST_H 1 -_ACEOF - + CXXFLAGS="${CXXFLAGS} --coverage" + LDFLAGS="${LDFLAGS} --coverage" fi -done - +# Check whether --enable-profiling was given. +if test "${enable_profiling+set}" = set; then : + enableval=$enable_profiling; fi -for ac_header in door.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "door.h" "ac_cv_header_door_h" "$ac_includes_default" -if test "x$ac_cv_header_door_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DOOR_H 1 -_ACEOF - for ac_func in door_create -do : - ac_fn_c_check_func "$LINENO" "door_create" "ac_cv_func_door_create" -if test "x$ac_cv_func_door_create" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DOOR_CREATE 1 -_ACEOF - -fi -done - -fi - -done - - -for ac_header in port.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "port.h" "ac_cv_header_port_h" "$ac_includes_default" -if test "x$ac_cv_header_port_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_PORT_H 1 -_ACEOF - for ac_func in port_create -do : - ac_fn_c_check_func "$LINENO" "port_create" "ac_cv_func_port_create" -if test "x$ac_cv_func_port_create" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_PORT_CREATE 1 -_ACEOF - -fi -done - -fi - -done - - - -UNAME=`uname` - - -if [ $UNAME != "AROS" ]; then - - if test -c "/dev/random"; then - -$as_echo "#define HAVE_DEV_RANDOM 1" >>confdefs.h - - fi - - if test -c "/dev/urandom"; then - -$as_echo "#define HAVE_DEV_URANDOM 1" >>confdefs.h - - fi - - if test -c "/dev/arandom"; then - -$as_echo "#define HAVE_DEV_ARANDOM 1" >>confdefs.h - - fi - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lc" >&5 -$as_echo_n "checking for socket in -lc... " >&6; } -if ${ac_cv_lib_c_socket+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lc $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char socket (); -int -main () -{ -return socket (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_c_socket=yes -else - ac_cv_lib_c_socket=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_socket" >&5 -$as_echo "$ac_cv_lib_c_socket" >&6; } -if test "x$ac_cv_lib_c_socket" = xyes; then : - : -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 -$as_echo_n "checking for socket in -lsocket... " >&6; } -if ${ac_cv_lib_socket_socket+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsocket $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char socket (); -int -main () -{ -return socket (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_socket_socket=yes -else - ac_cv_lib_socket_socket=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 -$as_echo "$ac_cv_lib_socket_socket" >&6; } -if test "x$ac_cv_lib_socket_socket" = xyes; then : - - LIBS="-lsocket $LIBS" - -else - : -fi - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lc" >&5 -$as_echo_n "checking for gethostbyname in -lc... " >&6; } -if ${ac_cv_lib_c_gethostbyname+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lc $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gethostbyname (); -int -main () -{ -return gethostbyname (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_c_gethostbyname=yes -else - ac_cv_lib_c_gethostbyname=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_gethostbyname" >&5 -$as_echo "$ac_cv_lib_c_gethostbyname" >&6; } -if test "x$ac_cv_lib_c_gethostbyname" = xyes; then : - : -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 -$as_echo_n "checking for gethostbyname in -lnsl... " >&6; } -if ${ac_cv_lib_nsl_gethostbyname+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnsl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gethostbyname (); -int -main () -{ -return gethostbyname (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_nsl_gethostbyname=yes -else - ac_cv_lib_nsl_gethostbyname=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 -$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } -if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : - - LIBS="-lnsl $LIBS" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnetwork" >&5 -$as_echo_n "checking for gethostbyname in -lnetwork... " >&6; } -if ${ac_cv_lib_network_gethostbyname+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnetwork $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gethostbyname (); -int -main () -{ -return gethostbyname (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_network_gethostbyname=yes -else - ac_cv_lib_network_gethostbyname=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_network_gethostbyname" >&5 -$as_echo "$ac_cv_lib_network_gethostbyname" >&6; } -if test "x$ac_cv_lib_network_gethostbyname" = xyes; then : - LIBS="-lnetwork $LIBS" : -fi - - -fi - -fi - - - -# Check whether --enable-iconv was given. -if test "${enable_iconv+set}" = set; then : - enableval=$enable_iconv; -fi - - -if test "x${enable_iconv}" = xyes +if test "x$enable_profiling" = xyes then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv in -lc" >&5 -$as_echo_n "checking for iconv in -lc... " >&6; } -if ${ac_cv_lib_c_iconv+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lc $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char iconv (); -int -main () -{ -return iconv (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_c_iconv=yes -else - ac_cv_lib_c_iconv=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_iconv" >&5 -$as_echo "$ac_cv_lib_c_iconv" >&6; } -if test "x$ac_cv_lib_c_iconv" = xyes; then : - - for ac_header in iconv.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default" -if test "x$ac_cv_header_iconv_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_ICONV_H 1 -_ACEOF - + CXXFLAGS="${CXXFLAGS} -pg" + LDFLAGS="${LDFLAGS} -pg" fi -done - - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv in -liconv" >&5 -$as_echo_n "checking for iconv in -liconv... " >&6; } -if ${ac_cv_lib_iconv_iconv+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-liconv $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char iconv (); -int -main () -{ -return iconv (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_iconv_iconv=yes -else - ac_cv_lib_iconv_iconv=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iconv_iconv" >&5 -$as_echo "$ac_cv_lib_iconv_iconv" >&6; } -if test "x$ac_cv_lib_iconv_iconv" = xyes; then : - - LIBS="-liconv $LIBS" - for ac_header in iconv.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default" -if test "x$ac_cv_header_iconv_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_ICONV_H 1 -_ACEOF - +# Check whether --enable-urandom was given. +if test "${enable_urandom+set}" = set; then : + enableval=$enable_urandom; fi -done +if test "x$enable_urandom" = xyes +then - -else - : -fi +$as_echo "#define ENABLE_DEV_URANDOM 1" >>confdefs.h fi -fi - - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - ac_ext=cpp @@ -6882,8 +6118,2605 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -ac_fn_cxx_check_header_mongrel "$LINENO" "locale" "ac_cv_header_locale" "$ac_includes_default" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_cxx_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do + as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 +$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } +if eval \${$as_ac_Header+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include <$ac_hdr> + +int +main () +{ +if ((DIR *) 0) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + eval "$as_ac_Header=yes" +else + eval "$as_ac_Header=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$as_ac_Header + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 +_ACEOF + +ac_header_dirent=$ac_hdr; break +fi + +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 +$as_echo_n "checking for library containing opendir... " >&6; } +if ${ac_cv_search_opendir+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char opendir (); +int +main () +{ +return opendir (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dir; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_search_opendir=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_opendir+:} false; then : + break +fi +done +if ${ac_cv_search_opendir+:} false; then : + +else + ac_cv_search_opendir=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 +$as_echo "$ac_cv_search_opendir" >&6; } +ac_res=$ac_cv_search_opendir +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 +$as_echo_n "checking for library containing opendir... " >&6; } +if ${ac_cv_search_opendir+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char opendir (); +int +main () +{ +return opendir (); + ; + return 0; +} +_ACEOF +for ac_lib in '' x; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_search_opendir=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_opendir+:} false; then : + break +fi +done +if ${ac_cv_search_opendir+:} false; then : + +else + ac_cv_search_opendir=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 +$as_echo "$ac_cv_search_opendir" >&6; } +ac_res=$ac_cv_search_opendir +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +fi + + +for ac_header in grp.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "grp.h" "ac_cv_header_grp_h" "$ac_includes_default" +if test "x$ac_cv_header_grp_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GRP_H 1 +_ACEOF + +fi + +done + +for ac_header in langinfo.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "langinfo.h" "ac_cv_header_langinfo_h" "$ac_includes_default" +if test "x$ac_cv_header_langinfo_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LANGINFO_H 1 +_ACEOF + +fi + +done + +for ac_header in memory.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "memory.h" "ac_cv_header_memory_h" "$ac_includes_default" +if test "x$ac_cv_header_memory_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_MEMORY_H 1 +_ACEOF + +fi + +done + +for ac_header in pthread.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PTHREAD_H 1 +_ACEOF + +fi + +done + +for ac_header in pwd.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "pwd.h" "ac_cv_header_pwd_h" "$ac_includes_default" +if test "x$ac_cv_header_pwd_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PWD_H 1 +_ACEOF + +fi + +done + +for ac_header in signum.h bits/signum.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + break +fi + +done + +for ac_header in stdarg.h varargs.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + break +fi + +done + +for ac_header in stdint.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" +if test "x$ac_cv_header_stdint_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STDINT_H 1 +_ACEOF + +fi + +done + +for ac_header in syslog.h sys/syslog.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + break +fi + +done + +for ac_header in termios.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "termios.h" "ac_cv_header_termios_h" "$ac_includes_default" +if test "x$ac_cv_header_termios_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_TERMIOS_H 1 +_ACEOF + +fi + +done + +for ac_header in unistd.h sys/unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + break +fi + +done + +for ac_header in features.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "features.h" "ac_cv_header_features_h" "$ac_includes_default" +if test "x$ac_cv_header_features_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_FEATURES_H 1 +_ACEOF + +fi + +done + +for ac_header in sys/file.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "sys/file.h" "ac_cv_header_sys_file_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_file_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_FILE_H 1 +_ACEOF + +fi + +done + +for ac_header in sys/param.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_param_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_PARAM_H 1 +_ACEOF + +fi + +done + +for ac_header in sys/mount.h +do : + ac_fn_cxx_check_header_compile "$LINENO" "sys/mount.h" "ac_cv_header_sys_mount_h" "#if defined(HAVE_SYS_PARAM_H) +#include +#endif + +" +if test "x$ac_cv_header_sys_mount_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_MOUNT_H 1 +_ACEOF + +fi + +done + + +for ac_header in sys/select.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "sys/select.h" "ac_cv_header_sys_select_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_select_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_SELECT_H 1 +_ACEOF + +fi + +done + +for ac_header in sys/socket.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_socket_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_SOCKET_H 1 +_ACEOF + +fi + +done + +for ac_header in sys/statfs.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "sys/statfs.h" "ac_cv_header_sys_statfs_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_statfs_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_STATFS_H 1 +_ACEOF + +fi + +done + +for ac_header in sys/sysmacros.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_sysmacros_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_SYSMACROS_H 1 +_ACEOF + +fi + +done + +for ac_header in sys/time.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_time_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_TIME_H 1 +_ACEOF + +fi + +done + +for ac_header in sys/ustat.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "sys/ustat.h" "ac_cv_header_sys_ustat_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_ustat_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_USTAT_H 1 +_ACEOF + +fi + +done + +for ac_header in sys/utsname.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "sys/utsname.h" "ac_cv_header_sys_utsname_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_utsname_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_UTSNAME_H 1 +_ACEOF + +fi + +done + +for ac_header in sys/wait.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "sys/wait.h" "ac_cv_header_sys_wait_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_wait_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_WAIT_H 1 +_ACEOF + +fi + +done + + +for ac_header in sys/fs/vx_ioctl.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "sys/fs/vx_ioctl.h" "ac_cv_header_sys_fs_vx_ioctl_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_fs_vx_ioctl_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_FS_VX_IOCTL_H 1 +_ACEOF + +fi + +done + +for ac_header in unixlib/local.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "unixlib/local.h" "ac_cv_header_unixlib_local_h" "$ac_includes_default" +if test "x$ac_cv_header_unixlib_local_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_UNIXLIB_LOCAL_H 1 +_ACEOF + +fi + +done + +for ac_header in proto/bsdsocket.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "proto/bsdsocket.h" "ac_cv_header_proto_bsdsocket_h" "$ac_includes_default" +if test "x$ac_cv_header_proto_bsdsocket_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PROTO_BSDSOCKET_H 1 +_ACEOF + +fi + +done + +for ac_header in proto/exec.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "proto/exec.h" "ac_cv_header_proto_exec_h" "$ac_includes_default" +if test "x$ac_cv_header_proto_exec_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PROTO_EXEC_H 1 +_ACEOF + +fi + +done + +for ac_header in bsdsocket/socketbasetags.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "bsdsocket/socketbasetags.h" "ac_cv_header_bsdsocket_socketbasetags_h" "$ac_includes_default" +if test "x$ac_cv_header_bsdsocket_socketbasetags_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_BSDSOCKET_SOCKETBASETAGS_H 1 +_ACEOF + +fi + +done + + +CPPFLAGS_SAVE="${CPPFLAGS}" +CPPFLAGS="${CPPFLAGS} -Werror" +for ac_header in malloc.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "malloc.h" "ac_cv_header_malloc_h" "$ac_includes_default" +if test "x$ac_cv_header_malloc_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_MALLOC_H 1 +_ACEOF + +fi + +done + +CPPFLAGS="${CPPFLAGS_SAVE}" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if ${ac_cv_c_const+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + +#ifndef __cplusplus + /* Ultrix mips cc rejects this sort of thing. */ + typedef int charset[2]; + const charset cs = { 0, 0 }; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this sort of thing. */ + char tx; + char *t = &tx; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; } bx; + struct s *b = &bx; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_c_const=yes +else + ac_cv_c_const=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then + +$as_echo "#define const /**/" >>confdefs.h + +fi + +ac_fn_cxx_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 +$as_echo_n "checking for uid_t in sys/types.h... " >&6; } +if ${ac_cv_type_uid_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "uid_t" >/dev/null 2>&1; then : + ac_cv_type_uid_t=yes +else + ac_cv_type_uid_t=no +fi +rm -f conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 +$as_echo "$ac_cv_type_uid_t" >&6; } +if test $ac_cv_type_uid_t = no; then + +$as_echo "#define uid_t int" >>confdefs.h + + +$as_echo "#define gid_t int" >>confdefs.h + +fi + + + ac_fn_cxx_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default" +if test "x$ac_cv_type_uintptr_t" = xyes; then : + +$as_echo "#define HAVE_UINTPTR_T 1" >>confdefs.h + +else + for ac_type in 'unsigned int' 'unsigned long int' \ + 'unsigned long long int'; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +cat >>confdefs.h <<_ACEOF +#define uintptr_t $ac_type +_ACEOF + + ac_type= +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test -z "$ac_type" && break + done +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 +$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } +if ${ac_cv_header_time+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include + +int +main () +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_header_time=yes +else + ac_cv_header_time=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 +$as_echo "$ac_cv_header_time" >&6; } +if test $ac_cv_header_time = yes; then + +$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +$as_echo_n "checking whether byte ordering is bigendian... " >&6; } +if ${ac_cv_c_bigendian+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_bigendian=unknown + # See if we're dealing with a universal compiler. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + + # Check for potential -arch flags. It is not universal unless + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main () +{ +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + # It does; now see whether it defined to BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef _BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # Compile a test program. + if test "$cross_compiling" = yes; then : + # Try to guess by grepping values from an object file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +short int ascii_mm[] = + { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; + short int ascii_ii[] = + { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; + int use_ascii (int i) { + return ascii_mm[i] + ascii_ii[i]; + } + short int ebcdic_ii[] = + { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; + short int ebcdic_mm[] = + { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; + int use_ebcdic (int i) { + return ebcdic_mm[i] + ebcdic_ii[i]; + } + extern int foo; + +int +main () +{ +return use_ascii (foo) == use_ebcdic (foo); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then + ac_cv_c_bigendian=yes + fi + if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_run "$LINENO"; then : + ac_cv_c_bigendian=no +else + ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 +$as_echo "$ac_cv_c_bigendian" >&6; } + case $ac_cv_c_bigendian in #( + yes) + $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h +;; #( + no) + ;; #( + universal) + +$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h + + ;; #( + *) + as_fn_error $? "unknown endianness + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5 +$as_echo_n "checking whether char is unsigned... " >&6; } +if ${ac_cv_c_char_unsigned+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((char) -1) < 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_c_char_unsigned=no +else + ac_cv_c_char_unsigned=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_char_unsigned" >&5 +$as_echo "$ac_cv_c_char_unsigned" >&6; } +if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then + $as_echo "#define __CHAR_UNSIGNED__ 1" >>confdefs.h + +fi + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 +$as_echo_n "checking size of int... " >&6; } +if ${ac_cv_sizeof_int+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_int" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (int) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_int=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 +$as_echo "$ac_cv_sizeof_int" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_INT $ac_cv_sizeof_int +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 +$as_echo_n "checking size of long... " >&6; } +if ${ac_cv_sizeof_long+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_long" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (long) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_long=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 +$as_echo "$ac_cv_sizeof_long" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG $ac_cv_sizeof_long +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 +$as_echo_n "checking size of long long... " >&6; } +if ${ac_cv_sizeof_long_long+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_long_long" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (long long) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_long_long=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 +$as_echo "$ac_cv_sizeof_long_long" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5 +$as_echo_n "checking size of time_t... " >&6; } +if ${ac_cv_sizeof_time_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_time_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (time_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_time_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_time_t" >&5 +$as_echo "$ac_cv_sizeof_time_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_TIME_T $ac_cv_sizeof_time_t +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of wchar_t" >&5 +$as_echo_n "checking size of wchar_t... " >&6; } +if ${ac_cv_sizeof_wchar_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (wchar_t))" "ac_cv_sizeof_wchar_t" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_wchar_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (wchar_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_wchar_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_wchar_t" >&5 +$as_echo "$ac_cv_sizeof_wchar_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_WCHAR_T $ac_cv_sizeof_wchar_t +_ACEOF + + + +# The cast to long int works around a bug in the HP C Compiler, +# see AC_CHECK_SIZEOF for more information. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking alignment of int" >&5 +$as_echo_n "checking alignment of int... " >&6; } +if ${ac_cv_alignof_int+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_cxx_compute_int "$LINENO" "(long int) offsetof (ac__type_alignof_, y)" "ac_cv_alignof_int" "$ac_includes_default +#ifndef offsetof +# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0) +#endif +typedef struct { char x; int y; } ac__type_alignof_;"; then : + +else + if test "$ac_cv_type_int" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute alignment of int +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_alignof_int=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_alignof_int" >&5 +$as_echo "$ac_cv_alignof_int" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define ALIGNOF_INT $ac_cv_alignof_int +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler, +# see AC_CHECK_SIZEOF for more information. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking alignment of long" >&5 +$as_echo_n "checking alignment of long... " >&6; } +if ${ac_cv_alignof_long+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_cxx_compute_int "$LINENO" "(long int) offsetof (ac__type_alignof_, y)" "ac_cv_alignof_long" "$ac_includes_default +#ifndef offsetof +# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0) +#endif +typedef struct { char x; long y; } ac__type_alignof_;"; then : + +else + if test "$ac_cv_type_long" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute alignment of long +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_alignof_long=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_alignof_long" >&5 +$as_echo "$ac_cv_alignof_long" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define ALIGNOF_LONG $ac_cv_alignof_long +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler, +# see AC_CHECK_SIZEOF for more information. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking alignment of long long" >&5 +$as_echo_n "checking alignment of long long... " >&6; } +if ${ac_cv_alignof_long_long+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_cxx_compute_int "$LINENO" "(long int) offsetof (ac__type_alignof_, y)" "ac_cv_alignof_long_long" "$ac_includes_default +#ifndef offsetof +# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0) +#endif +typedef struct { char x; long long y; } ac__type_alignof_;"; then : + +else + if test "$ac_cv_type_long_long" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute alignment of long long +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_alignof_long_long=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_alignof_long_long" >&5 +$as_echo "$ac_cv_alignof_long_long" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define ALIGNOF_LONG_LONG $ac_cv_alignof_long_long +_ACEOF + + + + +$as_echo "#define USES_1S_COMPLEMENT 0" >>confdefs.h + + +$as_echo "#define USES_2S_COMPLEMENT 1" >>confdefs.h + + +$as_echo "#define USES_SIGNED_MAGNITUDE 0" >>confdefs.h + + + +$as_echo "#define EXCEPTION_NAMESPACE std::" >>confdefs.h + + + +ac_fn_cxx_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default" +if test "x$ac_cv_member_struct_stat_st_rdev" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_RDEV 1 +_ACEOF + + +fi +ac_fn_cxx_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default" +if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 +_ACEOF + + +fi +ac_fn_cxx_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default" +if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_BLOCKS 1 +_ACEOF + + +fi +ac_fn_cxx_check_member "$LINENO" "struct stat" "st_flags" "ac_cv_member_struct_stat_st_flags" "$ac_includes_default" +if test "x$ac_cv_member_struct_stat_st_flags" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_FLAGS 1 +_ACEOF + + +fi +ac_fn_cxx_check_member "$LINENO" "struct stat" "st_gen" "ac_cv_member_struct_stat_st_gen" "$ac_includes_default" +if test "x$ac_cv_member_struct_stat_st_gen" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_GEN 1 +_ACEOF + + +fi +ac_fn_cxx_check_member "$LINENO" "struct stat" "st_flag" "ac_cv_member_struct_stat_st_flag" "$ac_includes_default" +if test "x$ac_cv_member_struct_stat_st_flag" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_FLAG 1 +_ACEOF + + +fi +ac_fn_cxx_check_member "$LINENO" "struct stat" "st_attrib" "ac_cv_member_struct_stat_st_attrib" "$ac_includes_default" +if test "x$ac_cv_member_struct_stat_st_attrib" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_ATTRIB 1 +_ACEOF + + +fi + + +# Check whether --enable-largefile was given. +if test "${enable_largefile+set}" = set; then : + enableval=$enable_largefile; +fi + +if test "$enable_largefile" != no; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +$as_echo_n "checking for special C compiler options needed for large files... " >&6; } +if ${ac_cv_sys_largefile_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF + if ac_fn_cxx_try_compile "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext + CC="$CC -n32" + if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_sys_largefile_CC=' -n32'; break +fi +rm -f core conftest.err conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +$as_echo "$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if ${ac_cv_sys_file_offset_bits+:} false; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=64; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +$as_echo "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits +_ACEOF +;; +esac +rm -rf conftest* + if test $ac_cv_sys_file_offset_bits = unknown; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } +if ${ac_cv_sys_large_files+:} false; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_sys_large_files=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_sys_large_files=1; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_large_files=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +$as_echo "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF +;; +esac +rm -rf conftest* + fi + + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking POSIX termios" >&5 +$as_echo_n "checking POSIX termios... " >&6; } +if ${ac_cv_sys_posix_termios+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include + +int +main () +{ +/* SunOS 4.0.3 has termios.h but not the library calls. */ + tcgetattr(0, 0); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_sys_posix_termios=yes +else + ac_cv_sys_posix_termios=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_posix_termios" >&5 +$as_echo "$ac_cv_sys_posix_termios" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 +$as_echo_n "checking for C/C++ restrict keyword... " >&6; } +if ${ac_cv_c_restrict+:} false; then : + $as_echo_n "(cached) " >&6 +else + 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +typedef int * int_ptr; + int foo (int_ptr $ac_kw ip) { + return ip[0]; + } +int +main () +{ +int s[1]; + int * $ac_kw t = s; + t[0] = 0; + return foo(t) + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_c_restrict=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_restrict" != no && break + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5 +$as_echo "$ac_cv_c_restrict" >&6; } + + case $ac_cv_c_restrict in + restrict) ;; + no) $as_echo "#define restrict /**/" >>confdefs.h + ;; + *) cat >>confdefs.h <<_ACEOF +#define restrict $ac_cv_c_restrict +_ACEOF + ;; + esac + + +for ac_func in broken_ac_check_func +do : + ac_fn_cxx_check_func "$LINENO" "broken_ac_check_func" "ac_cv_func_broken_ac_check_func" +if test "x$ac_cv_func_broken_ac_check_func" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_BROKEN_AC_CHECK_FUNC 1 +_ACEOF + +fi +done + + +for ac_func in strftime +do : + ac_fn_cxx_check_func "$LINENO" "strftime" "ac_cv_func_strftime" +if test "x$ac_cv_func_strftime" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STRFTIME 1 +_ACEOF + +fi +done + +for ac_func in getaddrinfo gethostname gethostbyname gethostid +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in getuid getgid +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in mkstemp mktemp tmpnam +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + break +fi +done + +for ac_func in mblen mbtowc +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in swab tzset _exit popen memcpy_s +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in openat open read close +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in fopen fread fclose +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in opendir readdir closedir +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in statx fstatat lstat stat +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in readlinkat readlink +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in chown chmod link symlink mknod mkfifo +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in unlink rename ftruncate +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in openlog syslog closelog +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in fork vfork execve posix_spawn +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in socket connect bind +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in setuid setgid getgrgid +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_header in fcntl.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" +if test "x$ac_cv_header_fcntl_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_FCNTL_H 1 +_ACEOF + for ac_func in posix_fadvise +do : + ac_fn_cxx_check_func "$LINENO" "posix_fadvise" "ac_cv_func_posix_fadvise" +if test "x$ac_cv_func_posix_fadvise" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_POSIX_FADVISE 1 +_ACEOF + +fi +done + +fi + +done + + +for ac_header in locale.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "locale.h" "ac_cv_header_locale_h" "$ac_includes_default" +if test "x$ac_cv_header_locale_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LOCALE_H 1 +_ACEOF + for ac_func in setlocale +do : + ac_fn_cxx_check_func "$LINENO" "setlocale" "ac_cv_func_setlocale" +if test "x$ac_cv_func_setlocale" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SETLOCALE 1 +_ACEOF + +fi +done + +fi + +done + +for ac_header in ctype.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "ctype.h" "ac_cv_header_ctype_h" "$ac_includes_default" +if test "x$ac_cv_header_ctype_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_CTYPE_H 1 +_ACEOF + for ac_func in isprint +do : + ac_fn_cxx_check_func "$LINENO" "isprint" "ac_cv_func_isprint" +if test "x$ac_cv_func_isprint" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_ISPRINT 1 +_ACEOF + +fi +done + +fi + +done + + +# Check whether --enable-commoncrypto was given. +if test "${enable_commoncrypto+set}" = set; then : + enableval=$enable_commoncrypto; +fi + + +if test "x${enable_commoncrypto}" != "xno" +then + for ac_header in CommonCrypto/CommonDigest.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "CommonCrypto/CommonDigest.h" "ac_cv_header_CommonCrypto_CommonDigest_h" "$ac_includes_default" +if test "x$ac_cv_header_CommonCrypto_CommonDigest_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_COMMONCRYPTO_COMMONDIGEST_H 1 +_ACEOF + +fi + +done + +fi + +for ac_header in door.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "door.h" "ac_cv_header_door_h" "$ac_includes_default" +if test "x$ac_cv_header_door_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DOOR_H 1 +_ACEOF + for ac_func in door_create +do : + ac_fn_cxx_check_func "$LINENO" "door_create" "ac_cv_func_door_create" +if test "x$ac_cv_func_door_create" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DOOR_CREATE 1 +_ACEOF + +fi +done + +fi + +done + +for ac_header in port.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "port.h" "ac_cv_header_port_h" "$ac_includes_default" +if test "x$ac_cv_header_port_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PORT_H 1 +_ACEOF + for ac_func in port_create +do : + ac_fn_cxx_check_func "$LINENO" "port_create" "ac_cv_func_port_create" +if test "x$ac_cv_func_port_create" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PORT_CREATE 1 +_ACEOF + +fi +done + +fi + +done + +for ac_func in directio +do : + ac_fn_cxx_check_func "$LINENO" "directio" "ac_cv_func_directio" +if test "x$ac_cv_func_directio" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DIRECTIO 1 +_ACEOF + +fi +done + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5 +$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; } +if ${ac_cv_sys_largefile_source+:} false; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include /* for off_t */ + #include +int +main () +{ +int (*fp) (FILE *, off_t, int) = fseeko; + return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_sys_largefile_source=no; break +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGEFILE_SOURCE 1 +#include /* for off_t */ + #include +int +main () +{ +int (*fp) (FILE *, off_t, int) = fseeko; + return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_sys_largefile_source=1; break +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_cv_sys_largefile_source=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5 +$as_echo "$ac_cv_sys_largefile_source" >&6; } +case $ac_cv_sys_largefile_source in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source +_ACEOF +;; +esac +rm -rf conftest* + +# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug +# in glibc 2.1.3, but that breaks too many other things. +# If you want fseeko and ftello with glibc, upgrade to a fixed glibc. +if test $ac_cv_sys_largefile_source != unknown; then + +$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h + +fi + + + + + + +case $host_os in + aros*) + ;; + *) + if test "$cross_compiling" != yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/random" >&5 +$as_echo_n "checking for /dev/random... " >&6; } +if ${ac_cv_file__dev_random+:} false; then : + $as_echo_n "(cached) " >&6 +else + test "$cross_compiling" = yes && + as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 +if test -r "/dev/random"; then + ac_cv_file__dev_random=yes +else + ac_cv_file__dev_random=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_random" >&5 +$as_echo "$ac_cv_file__dev_random" >&6; } +if test "x$ac_cv_file__dev_random" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE__DEV_RANDOM 1 +_ACEOF + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/urandom" >&5 +$as_echo_n "checking for /dev/urandom... " >&6; } +if ${ac_cv_file__dev_urandom+:} false; then : + $as_echo_n "(cached) " >&6 +else + test "$cross_compiling" = yes && + as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 +if test -r "/dev/urandom"; then + ac_cv_file__dev_urandom=yes +else + ac_cv_file__dev_urandom=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_urandom" >&5 +$as_echo "$ac_cv_file__dev_urandom" >&6; } +if test "x$ac_cv_file__dev_urandom" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE__DEV_URANDOM 1 +_ACEOF + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/arandom" >&5 +$as_echo_n "checking for /dev/arandom... " >&6; } +if ${ac_cv_file__dev_arandom+:} false; then : + $as_echo_n "(cached) " >&6 +else + test "$cross_compiling" = yes && + as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 +if test -r "/dev/arandom"; then + ac_cv_file__dev_arandom=yes +else + ac_cv_file__dev_arandom=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_arandom" >&5 +$as_echo "$ac_cv_file__dev_arandom" >&6; } +if test "x$ac_cv_file__dev_arandom" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE__DEV_ARANDOM 1 +_ACEOF + +fi + + fi + ;; +esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lc" >&5 +$as_echo_n "checking for socket in -lc... " >&6; } +if ${ac_cv_lib_c_socket+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char socket (); +int +main () +{ +return socket (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_c_socket=yes +else + ac_cv_lib_c_socket=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_socket" >&5 +$as_echo "$ac_cv_lib_c_socket" >&6; } +if test "x$ac_cv_lib_c_socket" = xyes; then : + : +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 +$as_echo_n "checking for socket in -lsocket... " >&6; } +if ${ac_cv_lib_socket_socket+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char socket (); +int +main () +{ +return socket (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_socket_socket=yes +else + ac_cv_lib_socket_socket=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 +$as_echo "$ac_cv_lib_socket_socket" >&6; } +if test "x$ac_cv_lib_socket_socket" = xyes; then : + + LIBS="-lsocket $LIBS" + +else + : +fi + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lc" >&5 +$as_echo_n "checking for gethostbyname in -lc... " >&6; } +if ${ac_cv_lib_c_gethostbyname+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname (); +int +main () +{ +return gethostbyname (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_c_gethostbyname=yes +else + ac_cv_lib_c_gethostbyname=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_gethostbyname" >&5 +$as_echo "$ac_cv_lib_c_gethostbyname" >&6; } +if test "x$ac_cv_lib_c_gethostbyname" = xyes; then : + : +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 +$as_echo_n "checking for gethostbyname in -lnsl... " >&6; } +if ${ac_cv_lib_nsl_gethostbyname+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname (); +int +main () +{ +return gethostbyname (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_nsl_gethostbyname=yes +else + ac_cv_lib_nsl_gethostbyname=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 +$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } +if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : + + LIBS="-lnsl $LIBS" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnetwork" >&5 +$as_echo_n "checking for gethostbyname in -lnetwork... " >&6; } +if ${ac_cv_lib_network_gethostbyname+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnetwork $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname (); +int +main () +{ +return gethostbyname (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_network_gethostbyname=yes +else + ac_cv_lib_network_gethostbyname=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_network_gethostbyname" >&5 +$as_echo "$ac_cv_lib_network_gethostbyname" >&6; } +if test "x$ac_cv_lib_network_gethostbyname" = xyes; then : + LIBS="-lnetwork $LIBS" : +fi + + +fi + +fi + + + +# Check whether --enable-iconv was given. +if test "${enable_iconv+set}" = set; then : + enableval=$enable_iconv; +fi + + +if test "x${enable_iconv}" = xyes +then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv in -lc" >&5 +$as_echo_n "checking for iconv in -lc... " >&6; } +if ${ac_cv_lib_c_iconv+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char iconv (); +int +main () +{ +return iconv (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_c_iconv=yes +else + ac_cv_lib_c_iconv=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_iconv" >&5 +$as_echo "$ac_cv_lib_c_iconv" >&6; } +if test "x$ac_cv_lib_c_iconv" = xyes; then : + + for ac_header in iconv.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default" +if test "x$ac_cv_header_iconv_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_ICONV_H 1 +_ACEOF + +fi + +done + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv in -liconv" >&5 +$as_echo_n "checking for iconv in -liconv... " >&6; } +if ${ac_cv_lib_iconv_iconv+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-liconv $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char iconv (); +int +main () +{ +return iconv (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_iconv_iconv=yes +else + ac_cv_lib_iconv_iconv=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iconv_iconv" >&5 +$as_echo "$ac_cv_lib_iconv_iconv" >&6; } +if test "x$ac_cv_lib_iconv_iconv" = xyes; then : + + LIBS="-liconv $LIBS" + for ac_header in iconv.h +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default" +if test "x$ac_cv_header_iconv_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_ICONV_H 1 +_ACEOF + +fi + +done + + +else + : +fi + +fi + +fi + + + +if test -z "${STLPORT}"; then + STLPORT="." +fi + +stlport_include="${STLPORT}/stlport" +stlport_lib="${STLPORT}/lib" + +for ac_header in limits limits.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in locale +do : + ac_fn_cxx_check_header_mongrel "$LINENO" "locale" "ac_cv_header_locale" "$ac_includes_default" if test "x$ac_cv_header_locale" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LOCALE 1 +_ACEOF else @@ -6893,11 +8726,12 @@ if ${ac_cv_stlportdir+:} false; then : $as_echo_n "(cached) " >&6 else + echo "Native header not found; checking if STLport is available" found_locale="" - for inclpath in /usr/local/include /usr/local/include/stlport + for inclpath in ${stlport_include} /usr/local/include /usr/local/include/stlport do CPPFLAGS_save=${CPPFLAGS} - CPPFLAGS="${CPPFLAGS} -I${inclpath}" + CPPFLAGS="${CPPFLAGS} -I${inclpath} -nostdinc++" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -6943,11 +8777,14 @@ $as_echo "$ac_cv_stlportdir" >&6; } fi +done + if test "x${ac_cv_stlportdir}" != "x" then - CPPFLAGS="${CPPFLAGS} -I${ac_cv_stlportdir}" + CPPFLAGS="${CPPFLAGS} -I ${ac_cv_stlportdir} -nostdinc++" fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -6971,6 +8808,7 @@ else LDFLAGS_TEMP="${LDFLAGS}" LDFLAGS="${LDFLAGS_TEMP} -pthread" + unset ac_cv_func_pthread_getspecific ac_fn_cxx_check_func "$LINENO" "pthread_getspecific" "ac_cv_func_pthread_getspecific" if test "x$ac_cv_func_pthread_getspecific" = xyes; then : @@ -6986,7 +8824,8 @@ if test "x$ac_cv_func_pthread_getspecific" = xyes; then : else LDFLAGS="${LDFLAGS_TEMP}" - as_fn_error $? "No posix threads detected, cannot continue." "$LINENO" 5 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No posix threads detected; OST may not link." >&5 +$as_echo "$as_me: WARNING: No posix threads detected; OST may not link." >&2;} fi @@ -7003,14 +8842,18 @@ if ${ac_cv_stlportlib+:} false; then : else found_lib="" - for inclpath in /usr/local/lib /usr/local/lib/stlport + for inclpath in ${stlport_lib} /usr/local/lib /usr/local/lib/stlport do for stllib in stlport stlport_gcc do LDFLAGS_save=${LDFLAGS} LIBS_save=${LIBS} + LD_LIBRARY_PATH_save=${LD_LIBRARY_PATH} + LDFLAGS="${LDFLAGS} -L${inclpath}" LIBS="${LIBS} -l${stllib}" + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+:LD_LIBRARY_PATH}${inclpath}" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7032,6 +8875,7 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=${LDFLAGS_save} LIBS=${LIBS_save} + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH_save}" if test "x${found_lib}" = "x1" then ac_cv_stlportlib=${inclpath} @@ -7062,23 +8906,26 @@ fi $as_echo "$ac_cv_stlportlib" >&6; } if test "x${ac_cv_stlportdir}" != "x" then - LDFLAGS="${LDFLAGS} -L${ac_cv_stlportlib}" + LDFLAGS="${LDFLAGS} -L ${ac_cv_stlportlib}" LIBS="${LIBS} -l${stllib}" + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+:LD_LIBRARY_PATH}${ac_cv_stlportlib}" + + +$as_echo "#define HAVE_LOCALE 1" >>confdefs.h + + +$as_echo "#define HAVE_STLPORT 1" >>confdefs.h + fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu for ac_header in wchar.h do : - ac_fn_c_check_header_mongrel "$LINENO" "wchar.h" "ac_cv_header_wchar_h" "$ac_includes_default" + ac_fn_cxx_check_header_mongrel "$LINENO" "wchar.h" "ac_cv_header_wchar_h" "$ac_includes_default" if test "x$ac_cv_header_wchar_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_WCHAR_H 1 @@ -7088,13 +8935,26 @@ fi done +for ac_header in sstream strstream +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + cat >>confdefs.h <<_ACEOF -#define TARGET_OS "${target}" +#define TARGET_OS "${host}" _ACEOF -case $target in +case $host in i386-*-freebsd*) ;; alpha-*-freebsd*) @@ -7115,14 +8975,14 @@ case $target in then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: -Sorry, tripwire will not properly link staticaly under Solaris. +Sorry, tripwire will not properly link statically under Solaris. This is due to tripwire's extensive use of gethostbyname(), which can only be linked dynamicaly. Please rerun configure without the --enable-static option. " >&5 $as_echo "$as_me: WARNING: -Sorry, tripwire will not properly link staticaly under Solaris. +Sorry, tripwire will not properly link statically under Solaris. This is due to tripwire's extensive use of gethostbyname(), which can only be linked dynamicaly. Please rerun configure without the --enable-static option. @@ -7134,7 +8994,7 @@ $as_echo "#define SOLARIS_NO_GETHOSTBYNAME 1" >>confdefs.h LIBS="-ldl $LIBS" for ac_header in strings.h do : - ac_fn_c_check_header_mongrel "$LINENO" "strings.h" "ac_cv_header_strings_h" "$ac_includes_default" + ac_fn_cxx_check_header_mongrel "$LINENO" "strings.h" "ac_cv_header_strings_h" "$ac_includes_default" if test "x$ac_cv_header_strings_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRINGS_H 1 @@ -7163,7 +9023,7 @@ return 0 return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: @@ -7188,6 +9048,7 @@ if test "${enable_openssl+set}" = set; then : fi + # Check whether --with-ssl-dir was given. if test "${with_ssl_dir+set}" = set; then : withval=$with_ssl_dir; @@ -7248,7 +9109,7 @@ else # Basic test to check for compatible library and # correct linking - if test "$cross_compiling" = yes; then + if test "x$cross_compiling" = "xyes"; then found_crypto=1 else if test "$cross_compiling" = yes; then : @@ -7271,7 +9132,7 @@ int main(void) } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_cxx_try_run "$LINENO"; then : found_crypto=1 break; @@ -7332,7 +9193,7 @@ if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "xnot found") for ac_header in openssl/md5.h openssl/sha.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 @@ -7889,7 +9750,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by tripwire $as_me 2.4.3.7, which was +This file was extended by tripwire $as_me 2.4.3.8, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7956,7 +9817,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -tripwire config.status 2.4.3.7 +tripwire config.status 2.4.3.8 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -8075,7 +9936,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" _ACEOF @@ -8708,29 +10569,35 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac shift - for mf + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf do # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line + am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -8748,53 +10615,48 @@ $as_echo X"$mf" | q } s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } - /^X\(\/\/\)[^/].*/{ + /^X\/\(\/\/\)$/{ s//\1/ q } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ + /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? done + if test $am_rc -ne 0; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. Try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk } ;; "mk_lib":C) test -d lib || mkdir lib ;; diff --git a/configure.ac b/configure.ac index a45aa4b..46eb921 100644 --- a/configure.ac +++ b/configure.ac @@ -2,75 +2,39 @@ dnl Process this file with autoconf to produce a configure script. dnl dnl -AC_INIT([tripwire], [2.4.3.7], [https://github.com/Tripwire/tripwire-open-source/issues], [tripwire], [https://github.com/Tripwire/tripwire-open-source]) +AC_INIT([tripwire], [2.4.3.8], [https://github.com/Tripwire/tripwire-open-source/issues], [tripwire], [https://github.com/Tripwire/tripwire-open-source]) AC_CONFIG_SRCDIR([src/tw/tw.cpp]) +AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AM_INIT_AUTOMAKE AM_CONFIG_HEADER(config.h) -AC_COPYRIGHT([The developer of the original code and/or files is Tripwire, Inc. Portions created by Tripwire, Inc. are copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights reserved.]) -AC_REVISION([$Revision: 2.4.3.7 $]) +AC_COPYRIGHT([The developer of the original code and/or files is Tripwire, Inc. Portions created by Tripwire, Inc. are copyright 2000-2019 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights reserved.]) +AC_REVISION([$Revision: 2.4.3.8 $]) -dnl ############### -dnl Setup defaults -dnl ############### -CFLAGS=${CFLAGS:-"-O -pipe -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"} -CXXFLAGS=${CXXFLAGS:-"-O -pipe -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"} +dnl ensure that things like _GNU_SOURCE are enabled, since we use a handful of extended +dnl things like O_NOATIME when they're available. autotools wants this to happen early +dnl before it tries to compile anything +AC_USE_SYSTEM_EXTENSIONS -dnl ##################### -dnl Configuration options -dnl ##################### +dnl AC_LANG_CPLUSPLUS wants to set CXXFLAGS to include '-g -O2', but we probably don't want to +dnl include debug symbols by default, so save off the previous value & restore it afterward +tmp_cxxflags=${CXXFLAGS} +AC_LANG_CPLUSPLUS +CXXFLAGS=${tmp_cxxflags} -# This is primarily to support old compilers that don’t understand -Wextra -AC_ARG_ENABLE(extrawarnings, [ —-disable-extrawarnings do not compile with -Wextra warnings enabled]) -if test "x$enable_extrawarnings" != "xno" -then - CFLAGS="${CFLAGS} -Wextra -Wno-unused-parameter" - CXXFLAGS="${CXXFLAGS} -Wextra -Wno-unused-parameter" -fi - -AC_ARG_ENABLE(static, [ --enable-static compile static binaries]) -if test "x$enable_static" = xyes -then LDFLAGS="${LDFLAGS} -static" -fi - -AC_ARG_ENABLE(debug, [ --enable-debug compile with debuging enabled]) -if test "x$enable_debug" = xyes -then - CFLAGS="${CFLAGS} -g" - CXXFLAGS="${CXXFLAGS} -g" - AC_DEFINE(DEBUG, 1, [Compile with debug code]) -else - AC_DEFINE(NDEBUG, 1, [Compile without debug code]) -fi - -AC_ARG_ENABLE(coverage, [ --enable-coverage enable code coverage]) -if test "x$enable_coverage" = xyes -then - CFLAGS="${CFLAGS} --coverage" - CXXFLAGS="${CXXFLAGS} --coverage" - LDFLAGS="${LDFLAGS} --coverage" -fi - -AC_ARG_ENABLE(profiling, [ --enable-profiling enable profiling]) -if test "x$enable_profiling" = xyes -then - CFLAGS="${CFLAGS} -pg" - CXXFLAGS="${CXXFLAGS} -pg" - LDFLAGS="${LDFLAGS} -pg" -fi - -AC_ARG_ENABLE(urandom, [ --enable-urandom use /dev/urandom]) -if test "x$enable_urandom" = xyes -then - AC_DEFINE(ENABLE_DEV_URANDOM, 1, [Enable use of /dev/urandom]) -fi +dnl ******************************************************* +dnl Append an include to config.h for a handcrafted header +dnl that sets things back to (hopefully) correct values +dnl for known cases where autoconf does the Wrong Thing +dnl ******************************************************* +AH_BOTTOM([#include "core/fixups.h"]) dnl ################### dnl Checks for programs dnl ################### -AC_PROG_CC([gcc clang suncc aCC xlC_r xlC cl.exe]) -AC_PROG_CXX([g++ c++ clang++ sunCC aCC xlC_r xlC cl.exe]) +dnl AC_PROG_CC([gcc clang suncc aCC xlc_r gxlc cl]) +AC_PROG_CXX([g++ clang++ sunCC aCC xlc++_r gxlc++ ixlc icpc owcc cl KCC cfront c++]) AC_PROG_RANLIB AC_PROG_YACC AC_PROG_LN_S @@ -82,31 +46,171 @@ AC_PROG_AR AC_PATH_PROG(path_to_vi, vi) AC_PATH_PROG(path_to_sendmail, sendmail, "", [$PATH:/usr/libexec]) + +dnl ######################################### +dnl Set up per-compiler constants & base args +dnl ######################################### + +dnl first look at compilers that define __GNUC__ +dnl since automake is good at that. +dnl if test "x${GXX}" != "x"; then - AC_DEFINE(HAVE_GCC, 1, [Uses the GNU gcc compiler]) + + CXXFLAGS=${CXXFLAGS:-"-O -pipe"} + + AC_DEFINE(HAVE_GNUC, 1, [Compiler supports GNU C++ dialect & args]) + + case "${CXX}" in + *clang++*) + AC_DEFINE(HAVE_CLANG, 1, [Uses the Clang++ compiler]) + ;; + icpc) + AC_DEFINE(HAVE_INTEL_ICC, 1, [Uses the Intel ICC compiler]) + ;; + *) + AC_DEFINE(HAVE_GCC, 1, [Uses the GNU g++ compiler]) + ;; + esac + else - AC_DEFINE(HAVE_GCC, 0, [Uses the GNU gcc compiler]) + dnl in case Clang stops defining __GNUC__ or user undefines it + if test "x${CXX}" = "xclang++"; then + AC_DEFINE(HAVE_CLANG, 1, [Uses the Clang compiler]) + CXXFLAGS=${CXXFLAGS:-"-O -pipe"} + fi + + if test "x${CXX}" = "xgxlc++"; then + AC_DEFINE(HAVE_IBM_GXLC, 1, [Uses the gxlc++ compiler]) + + dnl OBJECT_MODE needs to be set while compiling + export OBJECT_MODE=64 + CXXFLAGS=${CXXFLAGS:-"-O -maix64 -Wx,-qinfo=all"} + ARFLAGS=${ARFLAGS:-"-X 64"} + fi + + if test "x${CXX}" = "xxlc++_r"; then + AC_DEFINE(HAVE_IBM_XLC, 1, [Uses the IBM XL C++ compiler]) + + dnl OBJECT_MODE needs to be set while compiling + export OBJECT_MODE=64 + CXXFLAGS=${CXXFLAGS:-"-O -q64 -qinfo=all -qsuppress=1540-5311:1540-5337:1540-5341"} + ARFLAGS=${ARFLAGS:-"-X 64"} + fi + + dnl *** TODO these compilers need work on default args **** + + if test "x${CXX}" = "xsunCC"; then + AC_DEFINE(HAVE_ORACLE_SUNCC, 1, [Uses the sunCC compiler]) + fi + + if test "x${CXX}" = "xaCC"; then + AC_DEFINE(HAVE_HP_ACC, 1, [Uses the aCC compiler]) + fi + + if test "x${CXX}" = "xowcc"; then + AC_DEFINE(HAVE_OPENWATCOM, 1, [Uses the OpenWatcom compiler]) + CXXFLAGS=${CXXFLAGS:-"-xs"} + fi + + fi +dnl ###################### +dnl Enable various warnings +dnl ##################### + +AX_CHECK_COMPILE_FLAG([-Wall], [CXXFLAGS="$CXXFLAGS -Wall"]) +AX_CHECK_COMPILE_FLAG([-Wextra], [CXXFLAGS="$CXXFLAGS -Wextra"]) +dnl OpenWatcom compiler understands -Wextra but not -Wno-unused-parameter, so detect it separately +AX_CHECK_COMPILE_FLAG([-Wno-unused-parameter], [CXXFLAGS="$CXXFLAGS -Wno-unused-parameter"]) + +dnl AX_CHECK_COMPILE_FLAG([-Weverything], [CXXFLAGS="$CXXFLAGS -Weverything"]) + +dnl ##################### +dnl Configuration options +dnl ##################### +dnl +dnl These options generally expect a compiler+linker +dnl that understand gcc-like command line options. + +AC_ARG_ENABLE(static, [ --enable-static compile static binaries]) +if test "x$enable_static" = xyes +then LDFLAGS="${LDFLAGS} -static" +fi + +AC_ARG_ENABLE(debug, [ --enable-debug compile with debuging enabled]) +if test "x$enable_debug" = xyes +then + CXXFLAGS="${CXXFLAGS} -g" + AC_DEFINE(DEBUG, 1, [Compile with debug code]) +else + AC_DEFINE(NDEBUG, 1, [Compile without debug code]) +fi + +AC_ARG_ENABLE(coverage, [ --enable-coverage enable code coverage]) +if test "x$enable_coverage" = xyes +then + CXXFLAGS="${CXXFLAGS} --coverage" + LDFLAGS="${LDFLAGS} --coverage" +fi + +AC_ARG_ENABLE(profiling, [ --enable-profiling enable profiling]) +if test "x$enable_profiling" = xyes +then + CXXFLAGS="${CXXFLAGS} -pg" + LDFLAGS="${LDFLAGS} -pg" +fi + +AC_ARG_ENABLE(urandom, [ --enable-urandom use /dev/urandom]) +if test "x$enable_urandom" = xyes +then + AC_DEFINE(ENABLE_DEV_URANDOM, 1, [Enable use of /dev/urandom]) +fi + + + dnl ####################### dnl Checks for header files dnl ####################### AC_HEADER_STDC +AC_HEADER_DIRENT + +AC_CHECK_HEADERS(grp.h) +AC_CHECK_HEADERS(langinfo.h) +AC_CHECK_HEADERS(memory.h) +AC_CHECK_HEADERS(pthread.h) +AC_CHECK_HEADERS(pwd.h) +AC_CHECK_HEADERS(signum.h bits/signum.h, break) +AC_CHECK_HEADERS(stdarg.h varargs.h, break) +AC_CHECK_HEADERS(stdint.h) +AC_CHECK_HEADERS(syslog.h sys/syslog.h, break) +AC_CHECK_HEADERS(termios.h) +AC_CHECK_HEADERS(unistd.h sys/unistd.h, break) +AC_CHECK_HEADERS(features.h) +AC_CHECK_HEADERS(sys/file.h) AC_CHECK_HEADERS(sys/param.h) AC_CHECK_HEADERS(sys/mount.h,,, [[#if defined(HAVE_SYS_PARAM_H) #include #endif ]]) -AC_CHECK_HEADERS(sys/ustat.h sys/sysmacros.h sys/syslog.h sys/socket.h) -AC_CHECK_HEADERS(unistd.h sys/unistd.h) -AC_CHECK_HEADERS(syslog.h langinfo.h sys/statfs.h sys/select.h) -AC_CHECK_HEADERS(signum.h bits/signum.h, break ) -AC_CHECK_HEADERS(stdarg.h varargs.h, break ) -AC_CHECK_HEADERS(sys/utsname.h memory.h) -AC_CHECK_HEADERS(sys/fs/vx_ioctl.h) -dnl # Special case for malloc.h, because it's depreciated on most systems. +AC_CHECK_HEADERS(sys/select.h) +AC_CHECK_HEADERS(sys/socket.h) +AC_CHECK_HEADERS(sys/statfs.h) +AC_CHECK_HEADERS(sys/sysmacros.h) +AC_CHECK_HEADERS(sys/time.h) +AC_CHECK_HEADERS(sys/ustat.h) +AC_CHECK_HEADERS(sys/utsname.h) +AC_CHECK_HEADERS(sys/wait.h) + +AC_CHECK_HEADERS(sys/fs/vx_ioctl.h) +AC_CHECK_HEADERS(unixlib/local.h) +AC_CHECK_HEADERS(proto/bsdsocket.h) +AC_CHECK_HEADERS(proto/exec.h) +AC_CHECK_HEADERS(bsdsocket/socketbasetags.h) + +dnl # Special case for malloc.h, because it's deprecated on most systems. CPPFLAGS_SAVE="${CPPFLAGS}" CPPFLAGS="${CPPFLAGS} -Werror" AC_CHECK_HEADERS(malloc.h) @@ -117,61 +221,124 @@ dnl Checks for typedefs, structures, and compiler characteristics dnl ############################################################# AC_C_CONST AC_TYPE_SIZE_T +AC_TYPE_UID_T +AC_TYPE_UINTPTR_T AC_HEADER_TIME AC_C_BIGENDIAN +AC_C_CHAR_UNSIGNED + AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) AC_CHECK_SIZEOF(time_t) +AC_CHECK_SIZEOF(wchar_t) -dnl All platforms we support use 2's complement, are byte aligned, etc... +AC_CHECK_ALIGNOF(int) +AC_CHECK_ALIGNOF(long) +AC_CHECK_ALIGNOF(long long) + +dnl TODO: These could be replaced with actual detection logic, for the few +dnl remaining platforms that have non-2s complement signed ints AC_DEFINE(USES_1S_COMPLEMENT, 0, [Uses one's complement]) AC_DEFINE(USES_2S_COMPLEMENT, 1, [Uses two's complement]) AC_DEFINE(USES_SIGNED_MAGNITUDE, 0, [Uses signed magnitute]) -AC_DEFINE(IS_BYTE_ALIGNED, 1, [Is byte aligned]) + AC_DEFINE(EXCEPTION_NAMESPACE, std::, [this is the prefix for STL exception functions]) -dnl We used to check for UNIX or Unix-like target platforms, -dnl but that is a little extreme, so just assume that the -dnl target is unix. This can still be changed in config.h -AC_DEFINE(IS_UNIX, 1, [Is a unix type platform]) - dnl whether or not to generate debuging code? -AC_DEFINE(NDEBUG, 1, [don't generate debuging code]) +dnl this gets defined elsewhere based on config args AC_DEFINE(NDEBUG, 1, [don't generate debuging code]) -dnl look for struct stat members that aren't always there -AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_blocks]) +dnl look for struct stat members that aren't always there: +dnl st_rdev, st_blksize, & st_blocks are standard but a few platforms don't have them. +dnl st_flags & st_gen are BSD-isms & are mostly seen there, including macOS +dnl st_flag (singular) is AIX-only, while st_attrib holds DOS attribute bits on VxWorks +AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_blksize, struct stat.st_blocks, struct stat.st_flags, struct stat.st_gen, struct stat.st_flag, struct stat.st_attrib]) + +dnl detect large file support & use it where available +AC_SYS_LARGEFILE + +dnl detect whether Posix termios is available. +dnl we use termios to turn echo off when user is entering a passphrase +AC_SYS_POSIX_TERMIOS + +dnl detect whether C++ compiler supports any variant of 'restrict' keyword +dnl (the macro says 'C' but works for both C & C++) +AC_C_RESTRICT + +dnl ****************************************** +dnl Check whether AC_CHECK_FUNC(S) lies to us +dnl ****************************************** +AC_CHECK_FUNCS(broken_ac_check_func) dnl ############################# dnl Checks for standard functions dnl ############################# -AC_CHECK_FUNCS(strftime gethostname gethostid) -AC_CHECK_FUNCS(mkstemp mktemp, break) -AC_CHECK_FUNCS(swab) +AC_CHECK_FUNCS(strftime) +AC_CHECK_FUNCS(getaddrinfo gethostname gethostbyname gethostid) +AC_CHECK_FUNCS(getuid getgid) +dnl various ways of creating/naming temp files +AC_CHECK_FUNCS(mkstemp mktemp tmpnam, break) +dnl i18n string fns +AC_CHECK_FUNCS(mblen mbtowc) +dnl misc assorted +AC_CHECK_FUNCS(swab tzset _exit popen memcpy_s) + +dnl posix way to read files +AC_CHECK_FUNCS(openat open read close) +dnl standard libc way to read files +AC_CHECK_FUNCS(fopen fread fclose) +dnl only standard way to read dir contents +AC_CHECK_FUNCS(opendir readdir closedir) +dnl posix (and extended) ways to get file attributes +AC_CHECK_FUNCS(statx fstatat lstat stat) +dnl posix way to get symlink contents +AC_CHECK_FUNCS(readlinkat readlink) + +dnl posix fns that make filesystem changes +AC_CHECK_FUNCS(chown chmod link symlink mknod mkfifo) +dnl more posix fns that make fs changes +AC_CHECK_FUNCS(unlink rename ftruncate) +dnl posix syslog fns +AC_CHECK_FUNCS(openlog syslog closelog) +dnl posix process fns +AC_CHECK_FUNCS(fork vfork execve posix_spawn) +dnl bsd socket fns +AC_CHECK_FUNCS(socket connect bind) +dnl posix user & group stuff +AC_CHECK_FUNCS(setuid setgid getgrgid) dnl check for posix_fadvise AC_CHECK_HEADERS(fcntl.h, [AC_CHECK_FUNCS(posix_fadvise)]) +dnl check for setlocale +AC_CHECK_HEADERS(locale.h, [AC_CHECK_FUNCS(setlocale)]) +dnl check for a C isprint +AC_CHECK_HEADERS(ctype.h, [AC_CHECK_FUNCS(isprint)]) + dnl check for OSX builtin hash algorithms AC_ARG_ENABLE(commoncrypto, - [ --disable-commoncrypto Don't use CommonCrypto hash implementations (OSX only)]) + [ --disable-commoncrypto Don't use CommonCrypto hash implementations (OSX only)]) if test "x${enable_commoncrypto}" != "xno" then - AC_CHECK_HEADERS(CommonCrypto/CommonDigest.h) + AC_CHECK_HEADERS(CommonCrypto/CommonDigest.h) fi dnl check for door support (Solaris) AC_CHECK_HEADERS(door.h, [AC_CHECK_FUNCS(door_create)]) - dnl check for event port support (Solaris) AC_CHECK_HEADERS(port.h, [AC_CHECK_FUNCS(port_create)]) +dnl check for directio syscall (Solaris) +AC_CHECK_FUNCS(directio) + +dnl check for existence of fseeko() as well as ftello() +AC_FUNC_FSEEKO + dnl ############################################## dnl check for various RNG/PRNG devices dnl ############################################## -UNAME=`uname` dnl ############################################## dnl AROS pops up a "Please insert disk" dialog for /dev @@ -179,21 +346,15 @@ dnl if script looks for devices (which don't exist) dnl so don't even try looking. dnl ############################################## -if [[ $UNAME != "AROS" ]]; then - - if test -c "/dev/random"; then - AC_DEFINE(HAVE_DEV_RANDOM, [1], [Has /dev/random]) - fi - - if test -c "/dev/urandom"; then - AC_DEFINE(HAVE_DEV_URANDOM, [1], [Has /dev/urandom]) - fi - - if test -c "/dev/arandom"; then - AC_DEFINE(HAVE_DEV_ARANDOM, [1], [Has /dev/arandom]) - fi - -fi +case $host_os in + aros*) + ;; + *) + if test "$cross_compiling" != yes; then + AC_CHECK_FILES(/dev/random /dev/urandom /dev/arandom) + fi + ;; +esac dnl ############################################## dnl Checks for various platform specific libraries @@ -229,21 +390,32 @@ then ], [:]) ]) fi -dnl check for stl library -AC_LANG_SAVE -AC_LANG_CPLUSPLUS +dnl Check for STL support, either native or STLport dnl dnl Check for STL headers dnl -AC_CHECK_HEADER(locale,, [ + +if test -z "${STLPORT}"; then + STLPORT="." +fi + +stlport_include="${STLPORT}/stlport" +stlport_lib="${STLPORT}/lib" + +AC_CHECK_HEADERS(limits limits.h) + +dnl Use as a proxy for C++98-compliant-ish STL +dnl and look for STLport if file isn't found immediately +AC_CHECK_HEADERS(locale,,[ dnl Don't have native STL headers, look in other places AC_CACHE_CHECK([for STLport directory], ac_cv_stlportdir, [ + echo "Native header not found; checking if STLport is available" found_locale="" - for inclpath in /usr/local/include /usr/local/include/stlport + for inclpath in ${stlport_include} /usr/local/include /usr/local/include/stlport do CPPFLAGS_save=${CPPFLAGS} - CPPFLAGS="${CPPFLAGS} -I${inclpath}" + CPPFLAGS="${CPPFLAGS} -I${inclpath} -nostdinc++" AC_TRY_COMPILE([ #include ] @@ -265,10 +437,12 @@ AC_CHECK_HEADER(locale,, [ fi ]) ]) + if test "x${ac_cv_stlportdir}" != "x" then - CPPFLAGS="${CPPFLAGS} -I${ac_cv_stlportdir}" + CPPFLAGS="${CPPFLAGS} -I ${ac_cv_stlportdir} -nostdinc++" fi + AC_TRY_LINK([#include ],,,[ dnl Don't have native STL library, look in other places dnl First check for POSIX threads if we compile STLport, because it needs it @@ -276,6 +450,7 @@ AC_CHECK_HEADER(locale,, [ LDFLAGS_TEMP="${LDFLAGS}" LDFLAGS="${LDFLAGS_TEMP} -pthread" + unset ac_cv_func_pthread_getspecific AC_CHECK_FUNC(pthread_getspecific, [:], [ @@ -283,26 +458,31 @@ AC_CHECK_HEADER(locale,, [ unset ac_cv_func_pthread_getspecific AC_CHECK_FUNC(pthread_getspecific, [:], [ LDFLAGS="${LDFLAGS_TEMP}" - AC_MSG_ERROR([No posix threads detected, cannot continue.]) ]) + AC_MSG_WARN([No posix threads detected; OST may not link.]) ]) ]) ]) AC_CACHE_CHECK([for STLport library directory], ac_cv_stlportlib, [ found_lib="" - for inclpath in /usr/local/lib /usr/local/lib/stlport + for inclpath in ${stlport_lib} /usr/local/lib /usr/local/lib/stlport do for stllib in stlport stlport_gcc do LDFLAGS_save=${LDFLAGS} LIBS_save=${LIBS} + LD_LIBRARY_PATH_save=${LD_LIBRARY_PATH} + LDFLAGS="${LDFLAGS} -L${inclpath}" LIBS="${LIBS} -l${stllib}" + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+:LD_LIBRARY_PATH}${inclpath}" + AC_TRY_LINK([ #include ] , , [ found_lib="1" ], ) LDFLAGS=${LDFLAGS_save} LIBS=${LIBS_save} + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH_save}" if test "x${found_lib}" = "x1" then ac_cv_stlportlib=${inclpath} @@ -325,22 +505,27 @@ AC_CHECK_HEADER(locale,, [ ]) if test "x${ac_cv_stlportdir}" != "x" then - LDFLAGS="${LDFLAGS} -L${ac_cv_stlportlib}" + LDFLAGS="${LDFLAGS} -L ${ac_cv_stlportlib}" LIBS="${LIBS} -l${stllib}" + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+:LD_LIBRARY_PATH}${ac_cv_stlportlib}" + + AC_DEFINE(HAVE_LOCALE, 1, [Define to 1 if you have the header file.]) + AC_DEFINE(HAVE_STLPORT, 1, [Define if STLport library is used]) fi ]) -AC_LANG_RESTORE + dnl ##################### dnl STL specific headers dnl ##################### AC_CHECK_HEADERS(wchar.h) +AC_CHECK_HEADERS(sstream strstream) dnl ####################################################################### dnl Local checks/hacks. The goal is to make this part as short as possible dnl ####################################################################### -AC_DEFINE_UNQUOTED(TARGET_OS, "${target}", [Target OS]) -case $target in +AC_DEFINE_UNQUOTED(TARGET_OS, "${host}", [Target OS]) +case $host in i386-*-freebsd*) ;; alpha-*-freebsd*) @@ -361,7 +546,7 @@ case $target in then AC_MSG_WARN( [ -Sorry, tripwire will not properly link staticaly under Solaris. +Sorry, tripwire will not properly link statically under Solaris. This is due to tripwire's extensive use of gethostbyname(), which can only be linked dynamicaly. Please rerun configure without the --enable-static option. @@ -391,6 +576,7 @@ if you are trying to compile a static binary. dnl Check for OpenSSL, now that we have a working compiler AC_ARG_ENABLE(openssl, [ --disable-openssl Don't link against OpenSSL libraries]) + AC_ARG_WITH(ssl-dir, [ --with-ssl-dir=PATH Specify path to OpenSSL installation ], [ @@ -447,7 +633,7 @@ then # Basic test to check for compatible library and # correct linking - if test "$cross_compiling" = yes; then + if test "x$cross_compiling" = "xyes"; then found_crypto=1 else AC_TRY_RUN( diff --git a/man/Makefile.in b/man/Makefile.in index 2218a28..8ed6f8b 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -112,7 +112,7 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ @@ -135,7 +135,7 @@ am__recursive_targets = \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - distdir + distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is @@ -284,6 +284,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -318,8 +319,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -430,7 +431,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/man/man4/Makefile.in b/man/man4/Makefile.in index dbd0c2d..809a870 100644 --- a/man/man4/Makefile.in +++ b/man/man4/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -112,7 +112,7 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ @@ -256,6 +256,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -290,8 +291,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -352,7 +353,10 @@ ctags CTAGS: cscope cscopelist: -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/man/man4/twconfig.4 b/man/man4/twconfig.4 index df7c921..5395794 100644 --- a/man/man4/twconfig.4 +++ b/man/man4/twconfig.4 @@ -311,7 +311,7 @@ Permission is granted to copy and distribute modified versions of this man page .PP Permission is granted to copy and distribute translations of this man page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by Tripwire, Inc. .PP -Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved. +Copyright 2000-2019 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved. .SH SEE ALSO .BR twintro (8), .BR tripwire (8), diff --git a/man/man4/twpolicy.4 b/man/man4/twpolicy.4 index be7d214..c01e766 100644 --- a/man/man4/twpolicy.4 +++ b/man/man4/twpolicy.4 @@ -537,7 +537,7 @@ Permission is granted to copy and distribute modified versions of this man page .PP Permission is granted to copy and distribute translations of this man page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by Tripwire, Inc. .PP -Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved. +Copyright 2000-2019 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved. .SH SEE ALSO .BR twintro (8), .BR tripwire (8), diff --git a/man/man5/Makefile.in b/man/man5/Makefile.in index 2d8dd98..227b6b3 100644 --- a/man/man5/Makefile.in +++ b/man/man5/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -112,7 +112,7 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ @@ -256,6 +256,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -290,8 +291,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -352,7 +353,10 @@ ctags CTAGS: cscope cscopelist: -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/man/man5/twfiles.5 b/man/man5/twfiles.5 index ebffc8c..babc99a 100644 --- a/man/man5/twfiles.5 +++ b/man/man5/twfiles.5 @@ -112,7 +112,7 @@ Permission is granted to copy and distribute modified versions of this man page .PP Permission is granted to copy and distribute translations of this man page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by Tripwire, Inc. .PP -Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved. +Copyright 2000-2019 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved. .SH SEE ALSO .BR twintro (8), .BR tripwire (8), diff --git a/man/man8/Makefile.in b/man/man8/Makefile.in index d6e21b4..70e48af 100644 --- a/man/man8/Makefile.in +++ b/man/man8/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -112,7 +112,7 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ @@ -256,6 +256,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -290,8 +291,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -352,7 +353,10 @@ ctags CTAGS: cscope cscopelist: -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/man/man8/siggen.8 b/man/man8/siggen.8 index 8adc553..2dfcad0 100644 --- a/man/man8/siggen.8 +++ b/man/man8/siggen.8 @@ -69,7 +69,7 @@ Permission is granted to copy and distribute modified versions of this man page .PP Permission is granted to copy and distribute translations of this man page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by Tripwire, Inc. .PP -Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved. +Copyright 2000-2019 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved. .SH SEE ALSO .BR twintro (8), .BR tripwire (8), diff --git a/man/man8/tripwire.8 b/man/man8/tripwire.8 index d0dd347..2bc97f4 100644 --- a/man/man8/tripwire.8 +++ b/man/man8/tripwire.8 @@ -580,7 +580,7 @@ Permission is granted to copy and distribute modified versions of this man page .PP Permission is granted to copy and distribute translations of this man page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by Tripwire, Inc. .PP -Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved. +Copyright 2000-2019 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved. .SH SEE ALSO .BR twintro (8), .BR twadmin (8), diff --git a/man/man8/twadmin.8 b/man/man8/twadmin.8 index f56f6a7..2d8937f 100644 --- a/man/man8/twadmin.8 +++ b/man/man8/twadmin.8 @@ -553,7 +553,7 @@ Permission is granted to copy and distribute modified versions of this man page .PP Permission is granted to copy and distribute translations of this man page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by Tripwire, Inc. .PP -Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved. +Copyright 2000-2019 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved. .SH SEE ALSO .BR twintro (8), .BR tripwire (8), diff --git a/man/man8/twintro.8 b/man/man8/twintro.8 index dd598ca..bf8b9b6 100644 --- a/man/man8/twintro.8 +++ b/man/man8/twintro.8 @@ -99,7 +99,7 @@ Permission is granted to copy and distribute modified versions of this man page .PP Permission is granted to copy and distribute translations of this man page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by Tripwire, Inc. .PP -Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved. +Copyright 2000-2019 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved. .SH SEE ALSO .BR tripwire (8), .BR twadmin (8), diff --git a/man/man8/twprint.8 b/man/man8/twprint.8 index c7277d6..59591f8 100644 --- a/man/man8/twprint.8 +++ b/man/man8/twprint.8 @@ -162,7 +162,7 @@ Permission is granted to copy and distribute modified versions of this man page .PP Permission is granted to copy and distribute translations of this man page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by Tripwire, Inc. .PP -Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved. +Copyright 2000-2019 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved. .SH SEE ALSO .BR twintro (8), .BR tripwire (8), diff --git a/mini-setup.sh b/mini-setup.sh new file mode 100755 index 0000000..347f881 --- /dev/null +++ b/mini-setup.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +# Configures a minimal OST setup in the build directory, as a dev/test aid. +# This script isn't meant for use in production, and intentionally uses +# terrible hardcoded passphrases to try to discourage that. + +cp src/mini-setup/twcfg.txt bin/twcfg.txt +cp src/mini-setup/twpol.txt bin/twpol.txt +cd bin + +if [ ! -f "l" ] || [ ! -f "s" ]; then + echo "***** Generating Keys *****" + if ./twadmin --generate-keys --site-keyfile s --local-keyfile l --site-passphrase s --local-passphrase l --verbose + then + echo "***** Keys Generated *****" + else + echo "***** Key Generation Failed *****" + exit 1 + fi +else + echo "***** Keys already generated, skipping this step *****" +fi + +if [ ! -f "tw.cfg" ]; then + echo "***** Creating Config File *****" + if ./twadmin --create-cfgfile --site-keyfile s --site-passphrase s --verbose --cfgfile ./tw.cfg ./twcfg.txt + then + echo "***** Config File Created *****" + else + echo "***** Config File Creation Failed *****" + exit 1 + fi +else + echo "***** Config file already exists, skipping this step *****" +fi + +if [ ! -f "test.pol" ]; then + echo "***** Creating Policy File *****" + if ./twadmin --create-polfile --site-passphrase s --verbose --cfgfile ./tw.cfg ./twpol.txt + then + echo "***** Policy File Created *****" + else + echo "***** Policy File Creation Failed *****" + exit 1 + fi +else + echo "***** Policy file already exists, skipping this step *****" +fi + +if [ ! -d "/tmp/tw-test" ]; then + mkdir /tmp/tw-test +fi + +if [ ! -f "test.twd" ]; then + echo "***** Initializing Database *****" + if ./tripwire --init --local-passphrase l --verbose --cfgfile ./tw.cfg + then + echo "***** Database Initialized *****" + else + echo "***** Database Initialization Failed *****" + exit 1 + fi +else + echo "***** Database already initialized, skipping this step *****" +fi + +touch /tmp/tw-test/hello.txt + +echo "***** Running a Check *****" +./tripwire --check --verbose --cfgfile ./tw.cfg + +echo "***** Setup Completed *****" diff --git a/policy/policyguide.txt b/policy/policyguide.txt index f520b9d..e33f26e 100644 --- a/policy/policyguide.txt +++ b/policy/policyguide.txt @@ -191,7 +191,7 @@ $(DIR1) -> $(param1); # It is also possible to do a #============================================================================= # -# Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, +# Copyright 2000-2019 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, # Inc. All rights reserved. # # Linux is a registered trademark of Linus Torvalds. diff --git a/policy/twpol-DragonFly.txt b/policy/twpol-DragonFly.txt index a0c0a3e..7376467 100644 --- a/policy/twpol-DragonFly.txt +++ b/policy/twpol-DragonFly.txt @@ -638,7 +638,7 @@ SIG_HI = 100 ; # Critical files that are significant p #============================================================================= # -# Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, +# Copyright 2000-2019 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, # Inc. in the United States and other countries. All rights reserved. # # FreeBSD is a registered trademark of the FreeBSD Project Inc. diff --git a/policy/twpol-FreeBSD.txt b/policy/twpol-FreeBSD.txt index 68b3ad7..b8d6e1f 100644 --- a/policy/twpol-FreeBSD.txt +++ b/policy/twpol-FreeBSD.txt @@ -637,7 +637,7 @@ SIG_HI = 100 ; # Critical files that are significant p #============================================================================= # -# Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, +# Copyright 2000-2019 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, # Inc. in the United States and other countries. All rights reserved. # # FreeBSD is a registered trademark of the FreeBSD Project Inc. diff --git a/policy/twpol-GENERIC.txt b/policy/twpol-GENERIC.txt index cbf0cdb..b30d0cf 100644 --- a/policy/twpol-GENERIC.txt +++ b/policy/twpol-GENERIC.txt @@ -1037,7 +1037,7 @@ SIG_HI = 100 ; # Critical files that are significant p #============================================================================= # -# Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, +# Copyright 2000-2019 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, # Inc. in the United States and other countries. All rights reserved. # # Linux is a registered trademark of Linus Torvalds. diff --git a/policy/twpol-HP-UX.txt b/policy/twpol-HP-UX.txt index 5624e2b..fccf744 100644 --- a/policy/twpol-HP-UX.txt +++ b/policy/twpol-HP-UX.txt @@ -1077,7 +1077,7 @@ SIG_HI = 100 ; # Critical files that are significant point #============================================================================= # -# Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, +# Copyright 2000-2019 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, # Inc. in the United States and other countries. All rights reserved. # # Linux is a registered trademark of Linus Torvalds. diff --git a/policy/twpol-MidnightBSD.txt b/policy/twpol-MidnightBSD.txt index a9dcac9..73fff6a 100644 --- a/policy/twpol-MidnightBSD.txt +++ b/policy/twpol-MidnightBSD.txt @@ -638,7 +638,7 @@ SIG_HI = 100 ; # Critical files that are significant p #============================================================================= # -# Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, +# Copyright 2000-2019 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, # Inc. in the United States and other countries. All rights reserved. # # FreeBSD is a registered trademark of the FreeBSD Project Inc. diff --git a/policy/twpol-NetBSD.txt b/policy/twpol-NetBSD.txt index 9e9f070..d87adc9 100644 --- a/policy/twpol-NetBSD.txt +++ b/policy/twpol-NetBSD.txt @@ -638,7 +638,7 @@ SIG_HI = 100 ; # Critical files that are significant p #============================================================================= # -# Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, +# Copyright 2000-2019 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, # Inc. in the United States and other countries. All rights reserved. # # FreeBSD is a registered trademark of the FreeBSD Project Inc. diff --git a/src/Makefile.in b/src/Makefile.in index be0d740..7cf44f9 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -133,7 +133,7 @@ am__recursive_targets = \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - distdir + distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is @@ -282,6 +282,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -317,8 +318,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -429,7 +430,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 2b48224..05c706e 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -23,7 +23,7 @@ libcore_a_HEADERS = archive.h charutil.h cmdlineparser.h codeconvert.h \ core.h coreerrors.h corestrings.h crc32.h debug.h displayencoder.h \ displayutil.h epoch.h error.h errorbucket.h errorbucketimpl.h errorgeneral.h \ errortable.h errorutil.h file.h fileerror.h fileheader.h fixedfilebuf.h \ - fsservices.h growheap.h hashtable.h haval.h md5.h msystem.h ntdbs.h \ + fixups.h fsservices.h growheap.h hashtable.h haval.h md5.h msystem.h ntdbs.h \ ntmbs.h package.h platform.h refcountobj.h resources.h \ serializable.h serializer.h serializerimpl.h serializerutil.h serstring.h \ sha.h srefcountobj.h srefcounttbl.h stdcore.h stringutil.h tasktimer.h \ diff --git a/src/core/Makefile.in b/src/core/Makefile.in index 5ee6d53..f9a7480 100644 --- a/src/core/Makefile.in +++ b/src/core/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -141,7 +141,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) @@ -313,6 +313,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -348,7 +349,7 @@ libcore_a_HEADERS = archive.h charutil.h cmdlineparser.h codeconvert.h \ core.h coreerrors.h corestrings.h crc32.h debug.h displayencoder.h \ displayutil.h epoch.h error.h errorbucket.h errorbucketimpl.h errorgeneral.h \ errortable.h errorutil.h file.h fileerror.h fileheader.h fixedfilebuf.h \ - fsservices.h growheap.h hashtable.h haval.h md5.h msystem.h ntdbs.h \ + fixups.h fsservices.h growheap.h hashtable.h haval.h md5.h msystem.h ntdbs.h \ ntmbs.h package.h platform.h refcountobj.h resources.h \ serializable.h serializer.h serializerimpl.h serializerutil.h serstring.h \ sha.h srefcountobj.h srefcounttbl.h stdcore.h stringutil.h tasktimer.h \ @@ -380,8 +381,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -486,7 +487,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/src/core/archive.cpp b/src/core/archive.cpp index 83f88e7..a2064fd 100644 --- a/src/core/archive.cpp +++ b/src/core/archive.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -80,25 +80,25 @@ TSTRING eArchiveCrypto::GetMsg() const // running out of memory or disk space. // -void cArchive::ReadInt16(int16& ret) // throw(eArchive) +void cArchive::ReadInt16(int16_t& ret) // throw(eArchive) { - if (ReadBlob(&ret, sizeof(int16)) != sizeof(int16)) + if (ReadBlob(&ret, sizeof(int16_t)) != sizeof(int16_t)) throw eArchiveEOF(); ret = tw_ntohs(ret); } -void cArchive::ReadInt32(int32& ret) // throw(eArchive) +void cArchive::ReadInt32(int32_t& ret) // throw(eArchive) { - if (ReadBlob(&ret, sizeof(int32)) != sizeof(int32)) + if (ReadBlob(&ret, sizeof(int32_t)) != sizeof(int32_t)) throw eArchiveEOF(); ret = tw_ntohl(ret); } -void cArchive::ReadInt64(int64& ret) // throw(eArchive) +void cArchive::ReadInt64(int64_t& ret) // throw(eArchive) { - if (ReadBlob(&ret, sizeof(int64)) != sizeof(int64)) + if (ReadBlob(&ret, sizeof(int64_t)) != sizeof(int64_t)) throw eArchiveEOF(); ret = tw_ntohll(ret); @@ -112,7 +112,7 @@ void cArchive::ReadInt64(int64& ret) // throw(eArchive) void cArchive::ReadString(TSTRING& ret) // throw(eArchive) { // read in size of string - int16 size; + int16_t size; ReadInt16(size); // create buffer for WCHAR16 string @@ -122,7 +122,7 @@ void cArchive::ReadString(TSTRING& ret) // throw(eArchive) for (int n = 0; n < size; n++) { - int16 i16; + int16_t i16; ReadInt16(i16); *pwc++ = i16; } @@ -136,22 +136,22 @@ int cArchive::ReadBlob(void* pBlob, int count) return Read(pBlob, count); } -void cArchive::WriteInt16(int16 i) // throw(eArchive) +void cArchive::WriteInt16(int16_t i) // throw(eArchive) { i = tw_htons(i); - WriteBlob(&i, sizeof(int16)); + WriteBlob(&i, sizeof(int16_t)); } -void cArchive::WriteInt32(int32 i) // throw(eArchive) +void cArchive::WriteInt32(int32_t i) // throw(eArchive) { i = tw_htonl(i); - WriteBlob(&i, sizeof(int32)); + WriteBlob(&i, sizeof(int32_t)); } -void cArchive::WriteInt64(int64 i) // throw(eArchive) +void cArchive::WriteInt64(int64_t i) // throw(eArchive) { i = tw_htonll(i); - WriteBlob(&i, sizeof(int64)); + WriteBlob(&i, sizeof(int64_t)); } // NOTE:BAM 10/11/99 -- we store unsigned size, but it really only works with @@ -159,7 +159,7 @@ void cArchive::WriteInt64(int64 i) // throw(eArchive) // resize() in ReadString(). // format for written string: 16-bit unsigned size, then a list of 16-bit UCS2 (Unicode) characters // not including terminating NULL -void cArchive::WriteString(TSTRING s) // throw(eArchive) +void cArchive::WriteString(const TSTRING& s) // throw(eArchive) { // convert string to a UCS2 string wc16_string ws; @@ -170,7 +170,7 @@ void cArchive::WriteString(TSTRING s) // throw(eArchive) if (ws.length() > TSS_INT16_MAX) ThrowAndAssert(eArchiveStringTooLong()); - WriteInt16(static_cast(ws.length())); + WriteInt16(static_cast(ws.length())); // write out each 16 bit character // RAD:09/03/99 -- Optimized for performance with "const" @@ -186,9 +186,9 @@ void cArchive::WriteBlob(const void* pBlob, int count) // throw(eArchive) ThrowAndAssert(eArchiveWrite()); } -int32 cArchive::GetStorageSize(const TSTRING& str) +int32_t cArchive::GetStorageSize(const TSTRING& str) { - int32 size = sizeof(int32); // the length is always stored + int32_t size = sizeof(int32_t); // the length is always stored // // after the length, all of the characters in the string are written as 16-bit values, // except for the null character @@ -198,19 +198,19 @@ int32 cArchive::GetStorageSize(const TSTRING& str) return size; } -int64 cArchive::Copy(cArchive* pFrom, int64 amt) +int64_t cArchive::Copy(cArchive* pFrom, int64_t amt) { enum { BUF_SIZE = 2048 }; - int8 buf[BUF_SIZE]; - int64 amtLeft = amt; + int8_t buf[BUF_SIZE]; + int64_t amtLeft = amt; while (amtLeft > 0) { - int64 amtToRead = amtLeft > (int64)BUF_SIZE ? (int64)BUF_SIZE : amtLeft; - int64 amtRead = pFrom->ReadBlob(buf, static_cast(amtToRead)); + int64_t amtToRead = amtLeft > (int64_t)BUF_SIZE ? (int64_t)BUF_SIZE : amtLeft; + int64_t amtRead = pFrom->ReadBlob(buf, static_cast(amtToRead)); amtLeft -= amtRead; WriteBlob(buf, static_cast(amtRead)); if (amtRead < amtToRead) @@ -236,7 +236,7 @@ cMemMappedArchive::~cMemMappedArchive() { } -int64 cMemMappedArchive::GetMappedOffset() const // throw(eArchive) +int64_t cMemMappedArchive::GetMappedOffset() const // throw(eArchive) { if (mpMappedMem == 0) ThrowAndAssert(eArchiveMemmap()); @@ -244,7 +244,7 @@ int64 cMemMappedArchive::GetMappedOffset() const // throw(eArchive) return mMappedOffset; } -int64 cMemMappedArchive::GetMappedLength() const // throw(eArchive) +int64_t cMemMappedArchive::GetMappedLength() const // throw(eArchive) { if (mpMappedMem == 0) ThrowAndAssert(eArchiveMemmap()); @@ -268,7 +268,7 @@ void* cMemMappedArchive::GetMap() // throw(eArchive) return mpMappedMem; } -void cMemMappedArchive::SetNewMap(void* pMap, int64 offset, int64 length) const +void cMemMappedArchive::SetNewMap(void* pMap, int64_t offset, int64_t length) const { if (pMap == 0) { @@ -310,7 +310,7 @@ bool cMemoryArchive::EndOfFile() return mReadHead >= mLogicalSize; } -void cMemoryArchive::Seek(int64 offset, SeekFrom from) // throw(eArchive) +void cMemoryArchive::Seek(int64_t offset, SeekFrom from) // throw(eArchive) { switch (from) { @@ -334,12 +334,12 @@ void cMemoryArchive::Seek(int64 offset, SeekFrom from) // throw(eArchive) mReadHead = static_cast(offset); } -int64 cMemoryArchive::CurrentPos() const +int64_t cMemoryArchive::CurrentPos() const { return mReadHead; } -int64 cMemoryArchive::Length() const +int64_t cMemoryArchive::Length() const { return mLogicalSize; } @@ -352,7 +352,7 @@ void cMemoryArchive::Truncate() AllocateMemory(mLogicalSize); } -void cMemoryArchive::MapArchive(int64 offset, int64 len) // throw(eArchive) +void cMemoryArchive::MapArchive(int64_t offset, int64_t len) // throw(eArchive) { if (offset + (int)len > mLogicalSize) AllocateMemory(static_cast(offset + len)); @@ -360,7 +360,7 @@ void cMemoryArchive::MapArchive(int64 offset, int64 len) // throw(eArchive) SetNewMap(mpMemory + offset, offset, len); } -void cMemoryArchive::MapArchive(int64 offset, int64 len) const // throw(eArchive) +void cMemoryArchive::MapArchive(int64_t offset, int64_t len) const // throw(eArchive) { if (offset + (int)len > mLogicalSize) ThrowAndAssert(eArchiveMemmap()); @@ -414,7 +414,7 @@ void cMemoryArchive::AllocateMemory(int len) // throw(eArchive) while (mAllocatedLen < len) mAllocatedLen *= 2; - int8* pNewMem = new int8[mAllocatedLen]; + int8_t* pNewMem = new int8_t[mAllocatedLen]; if (mpMemory != 0) { memcpy(pNewMem, mpMemory, mLogicalSize); @@ -436,7 +436,7 @@ void cMemoryArchive::AllocateMemory(int len) // throw(eArchive) if (len < (mAllocatedLen >> 1) && mAllocatedLen > MIN_ALLOCATED_SIZE) { // shrink the buffer - int8* pNewMem = new int8[len]; + int8_t* pNewMem = new int8_t[len]; ASSERT(mpMemory); memcpy(pNewMem, mpMemory, len); delete [] mpMemory; @@ -459,9 +459,9 @@ class cFixedMemArchive : public cBidirArchive { public: - int8* mpMemory; - int32 mSize; - int32 mReadHead; + int8_t* mpMemory; + int32_t mSize; + int32_t mReadHead; }; */ @@ -472,7 +472,7 @@ cFixedMemArchive::cFixedMemArchive() : mpMemory(0), mSize(0), mReadHead(0) { } -cFixedMemArchive::cFixedMemArchive(int8* pMem, int32 size) : mpMemory(0), mSize(0), mReadHead(0) +cFixedMemArchive::cFixedMemArchive(int8_t* pMem, int32_t size) : mpMemory(0), mSize(0), mReadHead(0) { Attach(pMem, size); } @@ -481,14 +481,14 @@ cFixedMemArchive::~cFixedMemArchive() { } -void cFixedMemArchive::Attach(int8* pMem, int32 size) +void cFixedMemArchive::Attach(int8_t* pMem, int32_t size) { mpMemory = pMem; mSize = size; mReadHead = 0; } -void cFixedMemArchive::Seek(int64 offset, SeekFrom from) // throw(eArchive) +void cFixedMemArchive::Seek(int64_t offset, SeekFrom from) // throw(eArchive) { switch (from) { @@ -509,15 +509,15 @@ void cFixedMemArchive::Seek(int64 offset, SeekFrom from) // throw(eArchive) ThrowAndAssert(eArchiveSeek(TSS_GetString(cCore, core::STR_MEMARCHIVE_FILENAME), TSS_GetString(cCore, core::STR_MEMARCHIVE_ERRSTR))); - mReadHead = static_cast(offset); + mReadHead = static_cast(offset); } -int64 cFixedMemArchive::CurrentPos() const +int64_t cFixedMemArchive::CurrentPos() const { return mReadHead; } -int64 cFixedMemArchive::Length() const +int64_t cFixedMemArchive::Length() const { return mSize; } @@ -583,7 +583,7 @@ bool cFileArchive::EndOfFile() // Seek -- This is where the actual offset is performed. The default // for each archive will be 0. ///////////////////////////////////////////////////////////////////////// -void cFileArchive::Seek(int64 offset, SeekFrom from) // throw(eArchive) +void cFileArchive::Seek(int64_t offset, SeekFrom from) // throw(eArchive) { try { @@ -614,7 +614,7 @@ void cFileArchive::Seek(int64 offset, SeekFrom from) // throw(eArchive) } } -int64 cFileArchive::CurrentPos(void) const +int64_t cFileArchive::CurrentPos(void) const { return mReadHead; } @@ -622,7 +622,7 @@ int64 cFileArchive::CurrentPos(void) const ///////////////////////////////////////////////////////////////////////// // Length -- Returns the size of the current file archive. ///////////////////////////////////////////////////////////////////////// -int64 cFileArchive::Length(void) const +int64_t cFileArchive::Length(void) const { try { @@ -637,12 +637,12 @@ int64 cFileArchive::Length(void) const ///////////////////////////////////////////////////////////////////////// // OpenRead -- Opens the file to be read only. ///////////////////////////////////////////////////////////////////////// -void cFileArchive::OpenRead(const TCHAR* filename, uint32 openFlags) +void cFileArchive::OpenRead(const TCHAR* filename, uint32_t openFlags) { try { // set up open flags - uint32 flags = cFile::OPEN_READ; + uint32_t flags = cFile::OPEN_READ; flags |= ((openFlags & FA_OPEN_TRUNCATE) ? cFile::OPEN_TRUNCATE : 0); flags |= ((openFlags & FA_OPEN_TEXT) ? cFile::OPEN_TEXT : 0); flags |= ((openFlags & FA_SCANNING) ? cFile::OPEN_SCANNING : 0); @@ -665,12 +665,12 @@ void cFileArchive::OpenRead(const TCHAR* filename, uint32 openFlags) ///////////////////////////////////////////////////////////////////////// // OpenReadWrite -- Opens the file to be read or written to ///////////////////////////////////////////////////////////////////////// -void cFileArchive::OpenReadWrite(const TCHAR* filename, uint32 openFlags) +void cFileArchive::OpenReadWrite(const TCHAR* filename, uint32_t openFlags) { try { // set up open flags - uint32 flags = cFile::OPEN_WRITE; + uint32_t flags = cFile::OPEN_WRITE; flags |= ((openFlags & FA_OPEN_TRUNCATE) ? cFile::OPEN_TRUNCATE : 0); flags |= ((openFlags & FA_OPEN_TEXT) ? cFile::OPEN_TEXT : 0); flags |= ((openFlags & FA_SCANNING) ? cFile::OPEN_SCANNING : 0); @@ -743,10 +743,10 @@ int cFileArchive::Read(void* pDest, int count) else { int i; - int32 dummy; - for (i = count;; i -= sizeof(int32)) + int32_t dummy; + for (i = count;; i -= sizeof(int32_t)) { - if (i < (int)sizeof(int32)) + if (i < (int)sizeof(int32_t)) { if (i > 0) mCurrentFile.Read(&dummy, i); @@ -773,7 +773,7 @@ int cFileArchive::Write(const void* pDest, int count) // throw(eArchive) { try { - int64 actual_count = 0; + int64_t actual_count = 0; ASSERT(mCurrentFile.isWritable); actual_count = mCurrentFile.Write(pDest, count); @@ -790,7 +790,7 @@ int cFileArchive::Write(const void* pDest, int count) // throw(eArchive) // increase the size, if needed if (mReadHead > mFileSize) { -#if 0 // IS_SUNPRO \ +#if 0 // IS_SUNPRO // These two lines seem to be all there is between code that crashes and code that works for sunpro cDebug d("cFileArchive::Write()"); d.TraceDebug(_T("file(%s) adjusted mFileSize = %d mReadHead = %d\n"), mCurrentFilename.c_str(), (int)mFileSize, (int)mReadHead); @@ -834,7 +834,7 @@ void cFileArchive::Truncate() // throw(eArchive) // // since we'll never open an existing file, the truncateFile flag is unnecessary. ///////////////////////////////////////////////////////////////////////// -void cLockedTemporaryFileArchive::OpenReadWrite(const TCHAR* filename, uint32 openFlags) +void cLockedTemporaryFileArchive::OpenReadWrite(const TCHAR* filename, uint32_t openFlags) { TSTRING strTempFile; @@ -868,7 +868,7 @@ void cLockedTemporaryFileArchive::OpenReadWrite(const TCHAR* filename, uint32 op // create file // set up flags - uint32 flags = cFile::OPEN_WRITE | cFile::OPEN_LOCKED_TEMP | cFile::OPEN_CREATE | cFile::OPEN_EXCLUSIVE; + uint32_t flags = cFile::OPEN_WRITE | cFile::OPEN_LOCKED_TEMP | cFile::OPEN_CREATE | cFile::OPEN_EXCLUSIVE; if (openFlags & FA_OPEN_TRUNCATE) flags |= cFile::OPEN_TRUNCATE; if (openFlags & FA_OPEN_TEXT) diff --git a/src/core/archive.h b/src/core/archive.h index 69700ee..f3804c3 100644 --- a/src/core/archive.h +++ b/src/core/archive.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -103,24 +103,24 @@ public: // All write functions throw exceptions for unexpected events like // running out of memory or disk space. // - void ReadInt16(int16& ret); // throw(eArchive) - void ReadInt32(int32& ret); // throw(eArchive) - void ReadInt64(int64& ret); // throw(eArchive) + void ReadInt16(int16_t& ret); // throw(eArchive) + void ReadInt32(int32_t& ret); // throw(eArchive) + void ReadInt64(int64_t& ret); // throw(eArchive) void ReadString(TSTRING& ret); // throw(eArchive) int ReadBlob(void* pBlob, int count); - void WriteInt16(int16 i); // throw(eArchive) - void WriteInt32(int32 i); // throw(eArchive) - void WriteInt64(int64 i); // throw(eArchive) - void WriteString(TSTRING s); // throw(eArchive) + void WriteInt16(int16_t i); // throw(eArchive) + void WriteInt32(int32_t i); // throw(eArchive) + void WriteInt64(int64_t i); // throw(eArchive) + void WriteString(const TSTRING& s); // throw(eArchive) void WriteBlob(const void* pBlob, int count); // throw(eArchive) - static int32 GetStorageSize(const TSTRING& str); + static int32_t GetStorageSize(const TSTRING& str); // this method calculates how many bytes the given string will take up in the archive and returns // that value // NOTE -- if the implementation of ReadString() or WriteString() ever changes, this method will also // need to change. - int64 Copy(cArchive* pFrom, int64 amt); // throw(eArchive) + int64_t Copy(cArchive* pFrom, int64_t amt); // throw(eArchive) // this method copies amt bytes from pFrom to itself, throwing an eArchive if anything goes wrong. // only makes sense to call for reading archives @@ -146,9 +146,9 @@ public: END = -1 }; - virtual void Seek(int64 offset, SeekFrom from) = 0; // throw(eArchive); - virtual int64 CurrentPos() const = 0; - virtual int64 Length() const = 0; + virtual void Seek(int64_t offset, SeekFrom from) = 0; // throw(eArchive); + virtual int64_t CurrentPos() const = 0; + virtual int64_t Length() const = 0; }; /////////////////////////////////////////////////////////////////////////////// @@ -166,22 +166,22 @@ public: cMemMappedArchive(); virtual ~cMemMappedArchive(); - virtual void MapArchive(int64 offset, int64 len) = 0; // throw(eArchive); - virtual void MapArchive(int64 offset, int64 len) const = 0; // throw(eArchive); + virtual void MapArchive(int64_t offset, int64_t len) = 0; // throw(eArchive); + virtual void MapArchive(int64_t offset, int64_t len) const = 0; // throw(eArchive); // the const version of MapArchive() does not allow the archive to grow in size - int64 GetMappedOffset() const; // throw(eArchive) - int64 GetMappedLength() const; // throw(eArchive) + int64_t GetMappedOffset() const; // throw(eArchive) + int64_t GetMappedLength() const; // throw(eArchive) void* GetMap(); // throw(eArchive) const void* GetMap() const; protected: - mutable void* mpMappedMem; - mutable int64 mMappedOffset; - mutable int64 mMappedLength; + mutable void* mpMappedMem; + mutable int64_t mMappedOffset; + mutable int64_t mMappedLength; // call in derived class to set above vars - void SetNewMap(void* pMap, int64 offset, int64 length) const; + void SetNewMap(void* pMap, int64_t offset, int64_t length) const; }; /////////////////////////////////////////////////////////////////////////////// @@ -198,25 +198,25 @@ public: ~cMemoryArchive(); virtual bool EndOfFile(); - virtual void Seek(int64 offset, SeekFrom from); // throw(eArchive) - virtual int64 CurrentPos() const; - virtual int64 Length() const; - virtual void MapArchive(int64 offset, int64 len); // throw(eArchive) - virtual void MapArchive(int64 offset, int64 len) const; // throw(eArchive) + virtual void Seek(int64_t offset, SeekFrom from); // throw(eArchive) + virtual int64_t CurrentPos() const; + virtual int64_t Length() const; + virtual void MapArchive(int64_t offset, int64_t len); // throw(eArchive) + virtual void MapArchive(int64_t offset, int64_t len) const; // throw(eArchive) void Truncate(); // set the length to the current pos - int8* GetMemory() const + int8_t* GetMemory() const { return mpMemory; } protected: - int8* mpMemory; - int mAllocatedLen; - int mMaxAllocatedLen; - int mLogicalSize; - int mReadHead; + int8_t* mpMemory; + int mAllocatedLen; + int mMaxAllocatedLen; + int mLogicalSize; + int mReadHead; virtual int Read(void* pDest, int count); virtual int Write(const void* pDest, int count); // throw(eArchive) @@ -231,19 +231,19 @@ class cFixedMemArchive : public cBidirArchive { public: cFixedMemArchive(); - cFixedMemArchive(int8* pMem, int32 size); + cFixedMemArchive(int8_t* pMem, int32_t size); virtual ~cFixedMemArchive(); - void Attach(int8* pMem, int32 size); + void Attach(int8_t* pMem, int32_t size); // this method associates the archive with pMem and sets the size of the // archive. Unlike cMemoryArchive, this may never grow or shrink in size. //----------------------------------- // cBidirArchive interface //----------------------------------- - virtual void Seek(int64 offset, SeekFrom from); // throw(eArchive); - virtual int64 CurrentPos() const; - virtual int64 Length() const; + virtual void Seek(int64_t offset, SeekFrom from); // throw(eArchive); + virtual int64_t CurrentPos() const; + virtual int64_t Length() const; virtual bool EndOfFile(); protected: @@ -253,9 +253,9 @@ protected: virtual int Read(void* pDest, int count); // throw(eArchive) virtual int Write(const void* pDest, int count); // throw(eArchive) - int8* mpMemory; - int32 mSize; - int32 mReadHead; + int8_t* mpMemory; + int32_t mSize; + int32_t mReadHead; }; class cFileArchive : public cBidirArchive @@ -273,8 +273,8 @@ public: }; // TODO: Open should throw - virtual void OpenRead(const TCHAR* filename, uint32 openFlags = 0); - virtual void OpenReadWrite(const TCHAR* filename, uint32 openFlags = FA_OPEN_TRUNCATE); + virtual void OpenRead(const TCHAR* filename, uint32_t openFlags = 0); + virtual void OpenReadWrite(const TCHAR* filename, uint32_t openFlags = FA_OPEN_TRUNCATE); // opens a file for reading or writing; the file is always created if it doesn't exist, // and is truncated to zero length if truncateFile is set to true; TSTRING GetCurrentFilename(void) const; @@ -285,14 +285,14 @@ public: // cBidirArchive interface //----------------------------------- virtual bool EndOfFile(); - virtual void Seek(int64 offset, SeekFrom from); // throw(eArchive) - virtual int64 CurrentPos() const; - virtual int64 Length() const; + virtual void Seek(int64_t offset, SeekFrom from); // throw(eArchive) + virtual int64_t CurrentPos() const; + virtual int64_t Length() const; protected: - int64 mFileSize; //Size of FileArchive - int64 mReadHead; //Current position of read/write head + int64_t mFileSize; //Size of FileArchive + int64_t mReadHead; //Current position of read/write head //----------------------------------- // cArchive interface //----------------------------------- @@ -301,7 +301,7 @@ protected: bool isWritable; cFile mCurrentFile; TSTRING mCurrentFilename; //current file - uint32 mOpenFlags; + uint32_t mOpenFlags; }; /////////////////////////////////////////////////////////////// @@ -315,7 +315,7 @@ protected: class cLockedTemporaryFileArchive : public cFileArchive { public: - virtual void OpenReadWrite(const TCHAR* filename = NULL, uint32 openFlags = FA_OPEN_TRUNCATE); + virtual void OpenReadWrite(const TCHAR* filename = NULL, uint32_t openFlags = FA_OPEN_TRUNCATE); // creates the file. filename must not exist on the file system. // if filename is NULL, the class will create and use a temporary file. // truncateFile has no meaning @@ -328,7 +328,7 @@ public: private: // open for read only makes no sense if we're always creating the file, // so disallow read only file opens - virtual void OpenRead(const TCHAR*, uint32 openFlags = 0) + virtual void OpenRead(const TCHAR*, uint32_t openFlags = 0) { ASSERT(false); THROW_INTERNAL("archive.h"); diff --git a/src/core/charutil.cpp b/src/core/charutil.cpp index e9df686..db209bb 100644 --- a/src/core/charutil.cpp +++ b/src/core/charutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -41,7 +41,8 @@ #include "charutil.h" #include "ntmbs.h" -#if IS_ANDROID +#if !HAVE_MBLEN && HAVE_MBTOWC +// Musl libc & Android NDK implement mblen just like this int mblen(const char* s, size_t n) { return mbtowc(0, s, n); diff --git a/src/core/charutil.h b/src/core/charutil.h index 5029e57..cbaba1c 100644 --- a/src/core/charutil.h +++ b/src/core/charutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/cmdlineparser.cpp b/src/core/cmdlineparser.cpp index 517d5ec..8e3f6d4 100644 --- a/src/core/cmdlineparser.cpp +++ b/src/core/cmdlineparser.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/cmdlineparser.h b/src/core/cmdlineparser.h index 5eef8fd..a3079f2 100644 --- a/src/core/cmdlineparser.h +++ b/src/core/cmdlineparser.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/codeconvert.cpp b/src/core/codeconvert.cpp index fef271e..da5c25c 100644 --- a/src/core/codeconvert.cpp +++ b/src/core/codeconvert.cpp @@ -1,6 +1,6 @@ // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -80,17 +80,18 @@ iCodeConverter* iCodeConverter::m_pInst = NULL; // has a maximum of 512 chars of output std::string util_output_bytes(void* p, size_t n) { - std::ostringstream ss; - ss.imbue(std::locale::classic()); - ss.setf(std::ios_base::hex, std::ios_base::basefield); - + TOSTRINGSTREAM ss; + tss_classic_locale(ss); + ss.setf(std::ios::hex, std::ios::basefield); + for (size_t i = 0; i < n; i++) { ss.width(2); ss << toupper(tss::util::char_to_size(((char*)p)[i])) << " "; } - std::string s = ss.str(); + tss_mkstr(s, ss); + if (s.length() > 512) { s = "truncated output: " + s; @@ -1243,7 +1244,9 @@ int tss_wcstombs(ntmbs_t pbz, const_ntwcs_t pwz, size_t nCount) int tss_mbstowcs(ntwcs_t pwz, const_ntmbs_t pbz, size_t nBytes) { cDebug d("tss_mbstowcs"); - + if (!pbz) + return 0; + size_t N; size_t nConv; const_ntmbs_t end = &pbz[nBytes]; @@ -1433,7 +1436,7 @@ int cGoodEnoughConverterer::Convert(ntdbs_t pwz, size_t nCount, const_ntmbs_t pb } else { - *dat = (uint16)(unsigned char)*at; + *dat = (uint16_t)(unsigned char)*at; } dat++; diff --git a/src/core/codeconvert.h b/src/core/codeconvert.h index f11af84..20dea22 100644 --- a/src/core/codeconvert.h +++ b/src/core/codeconvert.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/core.cpp b/src/core/core.cpp index 7196bf2..544565a 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/core.h b/src/core/core.h index fd2cf92..4f70347 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/coreerrors.cpp b/src/core/coreerrors.cpp index b4490a7..74c0d05 100644 --- a/src/core/coreerrors.cpp +++ b/src/core/coreerrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/coreerrors.h b/src/core/coreerrors.h index be5fdcb..8efbb8d 100644 --- a/src/core/coreerrors.h +++ b/src/core/coreerrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/corestrings.cpp b/src/core/corestrings.cpp index a930b31..a517885 100644 --- a/src/core/corestrings.cpp +++ b/src/core/corestrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/corestrings.h b/src/core/corestrings.h index e6c78a1..daf39b1 100644 --- a/src/core/corestrings.h +++ b/src/core/corestrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/crc32.cpp b/src/core/crc32.cpp index 25a3261..441e408 100644 --- a/src/core/crc32.cpp +++ b/src/core/crc32.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -82,9 +82,9 @@ #include "archive.h" #endif -#define BUFSIZE 4096 +#define BUFFER_SIZE 4096 -static uint32 crctab[] = { +static uint32_t crctab[] = { 0x0, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, @@ -154,7 +154,7 @@ void crcInit( CRC_INFO& crcInfo ) crcInfo.crc = 0; } -void crcUpdate( CRC_INFO& crcInfo, const uint8* pbData, int cbDataLen ) +void crcUpdate( CRC_INFO& crcInfo, const uint8_t* pbData, int cbDataLen ) { for( int i = 0; i < cbDataLen; i++, pbData++ ) { @@ -168,7 +168,7 @@ void crcFinit( CRC_INFO& crcInfo ) { // include the length // - uint32 len = crcInfo.cbTotalLen; + uint32_t len = crcInfo.cbTotalLen; for(; len != 0; len >>= 8) COMPUTE( crcInfo.crc, len & 0xff ); diff --git a/src/core/crc32.h b/src/core/crc32.h index c2fbeb9..1e052a0 100644 --- a/src/core/crc32.h +++ b/src/core/crc32.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -37,14 +37,14 @@ class cArchive; typedef struct { - uint32 crc; - uint32 cbTotalLen; + uint32_t crc; + uint32_t cbTotalLen; } CRC_INFO; // must have 8-bit bytes void crcInit ( CRC_INFO& crcInfo ); -void crcUpdate( CRC_INFO& crcInfo, const uint8* pbData, int cbDataLen ); +void crcUpdate( CRC_INFO& crcInfo, const uint8_t* pbData, int cbDataLen ); void crcFinit ( CRC_INFO& crcInfo ); diff --git a/src/core/debug.cpp b/src/core/debug.cpp index 0082694..079523f 100644 --- a/src/core/debug.cpp +++ b/src/core/debug.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -45,7 +45,7 @@ #include int cDebug::mDebugLevel(10); -uint32 cDebug::mOutMask(cDebug::OUT_TRACE); +uint32_t cDebug::mOutMask(cDebug::OUT_TRACE); std::ofstream cDebug::logfile; //mDebugLevel default == 10, mOutMask default == OUT_TRACE. @@ -106,13 +106,13 @@ void cDebug::DoTrace(const char* format, va_list& args) ASSERT(guard1 == 0xBABABABA && guard2 == 0xBABABABA); // string was too long ASSERT(strlen(out) < 1024); - std::ostringstream ostr; + TOSTRINGSTREAM ostr; ostr.setf(std::ios::left); ostr.width(40); ostr << mLabel; ostr.width(0); ostr << out; - + tss_end(ostr); if ((mOutMask & OUT_STDOUT) != 0) { @@ -120,6 +120,8 @@ void cDebug::DoTrace(const char* format, va_list& args) std::cout.flush(); } + tss_free(ostr); + // //make it output to log file! // @@ -280,9 +282,9 @@ bool cDebug::SetOutputFile(const char* filename) // already open! // TODO -- make this work with wide chars if (!logfile) - logfile.open(filename, std::ios_base::out | std::ios_base::ate | std::ios_base::app); + logfile.open(filename, std::ios::out | std::ios::ate | std::ios::app); else - logfile.setf(std::ios_base::hex, std::ios_base::basefield); + logfile.setf(std::ios::hex, std::ios::basefield); //make sure info. will not be clobbered. //Should be open now- if not, abort. diff --git a/src/core/debug.h b/src/core/debug.h index 5ffdae0..7953459 100644 --- a/src/core/debug.h +++ b/src/core/debug.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -147,7 +147,7 @@ private: }; static int mDebugLevel; - static uint32 mOutMask; + static uint32_t mOutMask; static std::ofstream logfile; char mLabel[MAX_LABEL]; diff --git a/src/core/displayencoder.cpp b/src/core/displayencoder.cpp index eac1c16..c39575a 100644 --- a/src/core/displayencoder.cpp +++ b/src/core/displayencoder.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -479,7 +479,7 @@ TSTRING cCharEncoderUtil::CharStringToHexValue(const TSTRING& str) for (at = str.begin(); at < str.end(); at++) { - strOut += char_to_hex(*at); + strOut += char_to_hex(*at); } return strOut; @@ -501,25 +501,38 @@ TSTRING cCharEncoderUtil::HexValueToCharString(const TSTRING& str) TCHAR cCharEncoderUtil::hex_to_char(TSTRING::const_iterator first, TSTRING::const_iterator last) { - static const TCHAR max_char = std::numeric_limits::max(); - static const TCHAR min_char = std::numeric_limits::min(); - + static const TCHAR max_char = TSS_TCHAR_MAX; + static const TCHAR min_char = TSS_TCHAR_MIN; + if (first + TCHAR_AS_HEX__IN_TCHARS != last) - ThrowAndAssert(eBadHexConversion()); + { + ThrowAndAssert(eBadHexConversion(TSTRING(first,last))); + } - TISTRINGSTREAM ss(TSTRING(first, last)); - ss.imbue(std::locale::classic()); +#if ARCHAIC_STL + TSTRING in(first, last); + TISTRINGSTREAM ss(in.c_str()); +#else + TISTRINGSTREAM ss(TSTRING(first,last)); +#endif + + tss_classic_locale(ss); + ss.fill(_T('0')); - ss.setf(std::ios_base::hex, std::ios_base::basefield); - + ss.setf(std::ios::hex, std::ios::basefield); + unsigned long ch; ss >> ch; if (ss.bad() || ss.fail()) + { ThrowAndAssert(eBadHexConversion(TSTRING(first, last))); - if ((TCHAR)ch > max_char || (TCHAR)ch < min_char) + } + if ((TCHAR)ch > TSS_TCHAR_MAX || (TCHAR)ch < TSS_TCHAR_MIN) + { ThrowAndAssert(eBadHexConversion(TSTRING(first, last))); - + } + return (TCHAR)ch; } @@ -527,17 +540,21 @@ TCHAR cCharEncoderUtil::hex_to_char(TSTRING::const_iterator first, TSTRING::cons TSTRING cCharEncoderUtil::char_to_hex(TCHAR ch) { TOSTRINGSTREAM ss; - - ss.imbue(std::locale::classic()); + tss_classic_locale(ss); + ss.setf(std::ios::hex, std::ios::basefield); + ss.fill(_T('0')); ss.width(TCHAR_AS_HEX__IN_TCHARS); - ss.setf(std::ios_base::hex, std::ios_base::basefield); ss << tss::util::char_to_size(ch); - if (ss.bad() || ss.fail() || ss.str().length() != TCHAR_AS_HEX__IN_TCHARS) + tss_mkstr(out, ss); + + if (ss.bad() || ss.fail() || out.length() != TCHAR_AS_HEX__IN_TCHARS) + { ThrowAndAssert(eBadHexConversion(TSTRING(1, ch))); - return ss.str(); + } + return out; } TSTRING cCharEncoderUtil::DecodeHexToChar(TSTRING::const_iterator* pcur, const TSTRING::const_iterator end) @@ -551,8 +568,10 @@ TSTRING cCharEncoderUtil::DecodeHexToChar(TSTRING::const_iterator* pcur, const T } if (n != TCHAR_AS_HEX__IN_TCHARS) - ThrowAndAssert(eBadDecoderInput()); - + { + ThrowAndAssert(eBadDecoderInput()); + } + // convert hex numbers return HexValueToCharString(str); } @@ -734,10 +753,10 @@ void cEncoder::ValidateSchema() const bool cEncoder::OnlyOneCatagoryPerChar() const { // TODO:BAM - man, is there a better way to do this? - TCHAR ch = std::numeric_limits::min(); + TCHAR ch = TSS_TCHAR_MIN; TSTRING ach(1, ch); - if (ch != std::numeric_limits::max()) + if (ch != TSS_TCHAR_MAX) { do { @@ -755,7 +774,7 @@ bool cEncoder::OnlyOneCatagoryPerChar() const } } ch++; - } while (ch != std::numeric_limits::max()); + } while (ch != TSS_TCHAR_MAX); } return true; } diff --git a/src/core/displayencoder.h b/src/core/displayencoder.h index 8971fdc..f1e8dd5 100644 --- a/src/core/displayencoder.h +++ b/src/core/displayencoder.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/displayutil.cpp b/src/core/displayutil.cpp index a005446..a5dae8f 100644 --- a/src/core/displayutil.cpp +++ b/src/core/displayutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -94,5 +94,5 @@ TSTRING cDisplayUtil::FormatMultiLineString(const TSTRING& str, int nOffset, int // now add last string sstr << strT; - return (sstr.str()); + tss_return_stream(sstr, out); } diff --git a/src/core/displayutil.h b/src/core/displayutil.h index fc24804..025bce7 100644 --- a/src/core/displayutil.h +++ b/src/core/displayutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/epoch.cpp b/src/core/epoch.cpp index 53efb6f..6a3895b 100644 --- a/src/core/epoch.cpp +++ b/src/core/epoch.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -51,7 +51,7 @@ bool CheckEpoch() time_struct.tm_mday = 1; time_struct.tm_mon = 0; time_struct.tm_year = 138; - int64 endoftime = cTimeUtil::DateToTime(&time_struct); + int64_t endoftime = cTimeUtil::DateToTime(&time_struct); if (time(0) > endoftime) { diff --git a/src/core/epoch.h b/src/core/epoch.h index 196b5e4..a4d08d8 100644 --- a/src/core/epoch.h +++ b/src/core/epoch.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/error.cpp b/src/core/error.cpp index 0c3d5d1..f31ab39 100644 --- a/src/core/error.cpp +++ b/src/core/error.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -39,11 +39,11 @@ /////////////////////////////////////////////////////////////////////////////// // CalcHash /////////////////////////////////////////////////////////////////////////////// -uint32 eError::CalcHash(const char* name) +uint32_t eError::CalcHash(const char* name) { CRC_INFO crc; crcInit(crc); - crcUpdate(crc, (const uint8*)name, strlen(name)); + crcUpdate(crc, (const uint8_t*)name, strlen(name)); crcFinit(crc); return crc.crc; } diff --git a/src/core/error.h b/src/core/error.h index a6a3437..d0d575c 100644 --- a/src/core/error.h +++ b/src/core/error.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -45,7 +45,7 @@ public: //------------------------------------------------------------------------- // Construction and Assignment //------------------------------------------------------------------------- - eError(const TSTRING& msg, uint32 flags = 0); + eError(const TSTRING& msg, uint32_t flags = 0); explicit eError(const eError& rhs); explicit eError(); void operator=(const eError& rhs); @@ -58,7 +58,7 @@ public: //------------------------------------------------------------------------- // Data Access //------------------------------------------------------------------------- - virtual uint32 GetID() const = 0; + virtual uint32_t GetID() const = 0; // returns a system wide unique identifier for this exception. See the // macro below for the typical implementation of this method. // This is used to associate the error with a string description of the @@ -73,7 +73,7 @@ public: // be displayed as the "Second" part of an error message, or the derived // class should override GetMsg() and return a string appropriate for display. - uint32 GetFlags() const; + uint32_t GetFlags() const; // Flags are defined below. Currently, these only have an impact on how errors are // displayed. @@ -86,7 +86,7 @@ public: SUPRESS_THIRD_MSG = 0x00000002 // supresses the "continuing" or "exiting" message }; - void SetFlags(uint32 flags); + void SetFlags(uint32_t flags); //------------------------------------------------------------------------- // Flag Convenience Methods @@ -103,7 +103,7 @@ public: //------------------------------------------------------------------------- // Utility Methods //------------------------------------------------------------------------- - static uint32 CalcHash(const char* name); + static uint32_t CalcHash(const char* name); // calculates the CRC32 of the string passed in as name. This methods // asserts that name is non null. This is used to generate unique IDs // for errors. @@ -112,8 +112,8 @@ public: // Private Implementation //------------------------------------------------------------------------- protected: - TSTRING mMsg; - uint32 mFlags; + TSTRING mMsg; + uint32_t mFlags; }; //----------------------------------------------------------------------------- @@ -127,7 +127,9 @@ protected: // to be added to the exception class. /////////////////////////////////////////////////////////////////////////////// -#if HAVE_GCC +// TODO: make use of 'explicit' more portable here, and/or figure out why +// this doesn't work on so many compilers +#if 1 //HAVE_GCC || HAVE_CLANG || HAVE_IBM_XLC || HAVE_IBM_GXLC || HAVE_ORACLE_SUNCC # define TSS_BEGIN_EXCEPTION_EXPLICIT #else # define TSS_BEGIN_EXCEPTION_EXPLICIT explicit @@ -137,7 +139,7 @@ protected: class except : public base \ { \ public: \ - except(const TSTRING& msg, uint32 flags = 0) : base(msg, flags) \ + except(const TSTRING& msg, uint32_t flags = 0) : base(msg, flags) \ { \ } \ TSS_BEGIN_EXCEPTION_EXPLICIT except(const except& rhs) : base(rhs) \ @@ -147,7 +149,7 @@ protected: { \ } \ \ - virtual uint32 GetID() const \ + virtual uint32_t GetID() const \ { \ return CalcHash(#except); \ } @@ -169,7 +171,7 @@ protected: { \ } \ \ - virtual uint32 GetID() const \ + virtual uint32_t GetID() const \ { \ return CalcHash(#except); \ } @@ -195,7 +197,7 @@ protected: /////////////////////////////////////////////////////////////////////////////// // eError /////////////////////////////////////////////////////////////////////////////// -inline eError::eError(const TSTRING& msg, uint32 flags) : mMsg(msg), mFlags(flags) +inline eError::eError(const TSTRING& msg, uint32_t flags) : mMsg(msg), mFlags(flags) { } @@ -241,7 +243,7 @@ inline TSTRING eError::GetMsg() const /////////////////////////////////////////////////////////////////////////////// // GetFlags /////////////////////////////////////////////////////////////////////////////// -inline uint32 eError::GetFlags() const +inline uint32_t eError::GetFlags() const { return mFlags; } @@ -249,7 +251,7 @@ inline uint32 eError::GetFlags() const /////////////////////////////////////////////////////////////////////////////// // SetFlags /////////////////////////////////////////////////////////////////////////////// -inline void eError::SetFlags(uint32 flags) +inline void eError::SetFlags(uint32_t flags) { mFlags = flags; } @@ -260,9 +262,9 @@ inline void eError::SetFlags(uint32 flags) inline void eError::SetFatality(bool fatal) { if (fatal) - mFlags &= ~(uint32)NON_FATAL; + mFlags &= ~(uint32_t)NON_FATAL; else - mFlags |= (uint32)NON_FATAL; + mFlags |= (uint32_t)NON_FATAL; } /////////////////////////////////////////////////////////////////////////////// @@ -270,7 +272,7 @@ inline void eError::SetFatality(bool fatal) /////////////////////////////////////////////////////////////////////////////// inline bool eError::IsFatal() const { - return (mFlags & (uint32)NON_FATAL) == 0; + return (mFlags & (uint32_t)NON_FATAL) == 0; } /////////////////////////////////////////////////////////////////////////////// @@ -279,9 +281,9 @@ inline bool eError::IsFatal() const inline void eError::SetSupressThird(bool supressThird) { if (supressThird) - mFlags |= (uint32)SUPRESS_THIRD_MSG; + mFlags |= (uint32_t)SUPRESS_THIRD_MSG; else - mFlags &= ~(uint32)SUPRESS_THIRD_MSG; + mFlags &= ~(uint32_t)SUPRESS_THIRD_MSG; } /////////////////////////////////////////////////////////////////////////////// @@ -289,7 +291,7 @@ inline void eError::SetSupressThird(bool supressThird) /////////////////////////////////////////////////////////////////////////////// inline bool eError::SupressThird() const { - return (mFlags & (uint32)SUPRESS_THIRD_MSG) == 0; + return (mFlags & (uint32_t)SUPRESS_THIRD_MSG) == 0; } diff --git a/src/core/errorbucket.h b/src/core/errorbucket.h index 8f2385e..8a57054 100644 --- a/src/core/errorbucket.h +++ b/src/core/errorbucket.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/errorbucketimpl.cpp b/src/core/errorbucketimpl.cpp index 15298d3..7922b2b 100644 --- a/src/core/errorbucketimpl.cpp +++ b/src/core/errorbucketimpl.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -77,9 +77,9 @@ void cErrorReporter::PrintErrorMsg(const eError& error, const TSTRING& strExtra) if (errStr.empty()) { TOSTRINGSTREAM strm; - ASSERT(sizeof(uint32) == sizeof(unsigned int)); // for cast on next line + ASSERT(sizeof(uint32_t) == sizeof(unsigned int)); // for cast on next line strm << _T("Unknown Error ID ") << (unsigned int)error.GetID(); - errStr = strm.str(); + tss_stream_to_string(strm, errStr); } //int len = errStr.length(); // save for later @@ -103,7 +103,7 @@ void cErrorReporter::PrintErrorMsg(const eError& error, const TSTRING& strExtra) errStr.erase(firstLF); } - ASSERT(errStr.length() + len + 6 < 80); // line too big for terminal? + ASSERT(errStr.length() + 6 < 80); // line too big for terminal? // Add 6 to account for "### ' and ': ' TCERR << TSS_GetString(cCore, core::STR_ERROR_COLON) << _T(" ") << errStr; TCERR << std::endl; @@ -189,7 +189,7 @@ void cErrorQueue::Clear() mList.clear(); } -int cErrorQueue::GetNumErrors() const +cErrorQueue::ListType::size_type cErrorQueue::GetNumErrors() const { return mList.size(); } @@ -234,19 +234,19 @@ const ePoly& cErrorQueueIter::GetError() const /////////////////////////////////////////////////////////////////////////////// // Read /////////////////////////////////////////////////////////////////////////////// -void cErrorQueue::Read(iSerializer* pSerializer, int32 version) +void cErrorQueue::Read(iSerializer* pSerializer, int32_t version) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("ErrorQueue Read"))); - int32 size; + int32_t size; mList.clear(); pSerializer->ReadInt32(size); for (int i = 0; i < size; ++i) { - int32 errorNumber; + int32_t errorNumber; TSTRING errorString; - int32 flags; + int32_t flags; pSerializer->ReadInt32(errorNumber); pSerializer->ReadString(errorString); diff --git a/src/core/errorbucketimpl.h b/src/core/errorbucketimpl.h index 8a543df..a931c2d 100644 --- a/src/core/errorbucketimpl.h +++ b/src/core/errorbucketimpl.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -102,15 +102,17 @@ class cErrorQueue : public cErrorBucket, public iTypedSerializable friend class cErrorQueueIter; public: + typedef std::list ListType; + void Clear(); // remove all errors from the queue - int GetNumErrors() const; + ListType::size_type GetNumErrors() const; // returns how many errors are in the queue // // iSerializable interface // - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) // @@ -122,7 +124,6 @@ protected: virtual void HandleError(const eError& error); private: - typedef std::list ListType; ListType mList; DECLARE_TYPEDSERIALIZABLE() diff --git a/src/core/errorgeneral.h b/src/core/errorgeneral.h index e284705..abd2023 100644 --- a/src/core/errorgeneral.h +++ b/src/core/errorgeneral.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/errortable.cpp b/src/core/errortable.cpp index 0673ee3..2f04485 100644 --- a/src/core/errortable.cpp +++ b/src/core/errortable.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/errortable.h b/src/core/errortable.h index 687d27b..5f232bc 100644 --- a/src/core/errortable.h +++ b/src/core/errortable.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -51,10 +51,10 @@ class eError; //----------------------------------------------------------------------------- // cErrorTable //----------------------------------------------------------------------------- -class cErrorTable : public cMessages_ +class cErrorTable : public cMessages_ { public: - typedef cMessages_ inherited; + typedef cMessages_ inherited; // // Convenience Methods diff --git a/src/core/errorutil.cpp b/src/core/errorutil.cpp index 34160ac..07d4990 100644 --- a/src/core/errorutil.cpp +++ b/src/core/errorutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/errorutil.h b/src/core/errorutil.h index 6c0f39c..446f618 100644 --- a/src/core/errorutil.h +++ b/src/core/errorutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -58,7 +58,7 @@ public: //------------------------------------------------------------------------- // Construction and Assignment //------------------------------------------------------------------------- - ePoly(uint32 id, const TSTRING& msg, uint32 flags = 0); + ePoly(uint32_t id, const TSTRING& msg, uint32_t flags = 0); explicit ePoly(const eError& rhs); explicit ePoly(); void operator=(const eError& rhs); @@ -66,11 +66,11 @@ public: //------------------------------------------------------------------------- // ID manipulation //------------------------------------------------------------------------- - virtual uint32 GetID() const; - void SetID(uint32 id); + virtual uint32_t GetID() const; + void SetID(uint32_t id); private: - uint32 mID; + uint32_t mID; }; //----------------------------------------------------------------------------- @@ -122,7 +122,7 @@ public: /////////////////////////////////////////////////////////////////////////////// // ePoly /////////////////////////////////////////////////////////////////////////////// -inline ePoly::ePoly(uint32 id, const TSTRING& msg, uint32 flags) : eError(msg, flags), mID(id) +inline ePoly::ePoly(uint32_t id, const TSTRING& msg, uint32_t flags) : eError(msg, flags), mID(id) { } @@ -154,7 +154,7 @@ inline void ePoly::operator=(const eError& rhs) /////////////////////////////////////////////////////////////////////////////// // GetID /////////////////////////////////////////////////////////////////////////////// -inline uint32 ePoly::GetID() const +inline uint32_t ePoly::GetID() const { return mID; } @@ -162,7 +162,7 @@ inline uint32 ePoly::GetID() const /////////////////////////////////////////////////////////////////////////////// // SetID /////////////////////////////////////////////////////////////////////////////// -inline void ePoly::SetID(uint32 id) +inline void ePoly::SetID(uint32_t id) { mID = id; } diff --git a/src/core/file.h b/src/core/file.h index 154ccd3..36823be 100644 --- a/src/core/file.h +++ b/src/core/file.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -47,7 +47,7 @@ #include "fileerror.h" #endif -#if IS_MINT // for off_t +#if HAVE_SYS_TYPES_H #include #endif @@ -106,7 +106,7 @@ public: /************ User Interface **************************/ // Both Open methods ALWAYS open files in BINARY mode! - void Open(const TSTRING& sFileName, uint32 flags = OPEN_READ); //throw(eFile) + void Open(const TSTRING& sFileName, uint32_t flags = OPEN_READ); //throw(eFile) void Close(void); //throw(eFile) bool IsOpen(void) const; @@ -173,7 +173,7 @@ public: static bool IsAbsolutePath(const TSTRING& in); }; -# if IS_DOS_DJGPP +# if USES_DOS_DEVICE_PATH # define cDevicePath cDosPath # elif IS_AROS # define cDevicePath cArosPath diff --git a/src/core/file_unix.cpp b/src/core/file_unix.cpp index 286de9a..298f3e2 100644 --- a/src/core/file_unix.cpp +++ b/src/core/file_unix.cpp @@ -1,6 +1,6 @@ // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -31,27 +31,15 @@ // // file_unix.cpp : Specific implementation of file operations for Unix. - -/* On GNU/Hurd, need to define _GNU_SOURCE in order to use O_NOATIME - which technically is still a nonstandard extension to open() */ -#if IS_HURD -# define _GNU_SOURCE -#endif - #include "core/stdcore.h" - -#if !IS_UNIX -# error Need to be unix to use unixfsservices -#endif - #include "core/file.h" -#include +//#include #include -#include -#include +//#include +//#include #include -#include +//#include #if HAVE_SYS_FS_VX_IOCTL_H #include @@ -62,7 +50,7 @@ #include "core/fsservices.h" #include "core/errorutil.h" -#if IS_RISCOS +#if HAVE_UNIXLIB_LOCAL_H #include #endif @@ -78,7 +66,7 @@ struct cFile_i int m_fd; //underlying file descriptor FILE* mpCurrStream; //currently defined file stream TSTRING mFileName; //the name of the file we are currently referencing. - uint32 mFlags; //Flags used to open the file + uint32_t mFlags; //Flags used to open the file }; //Ctor @@ -132,10 +120,10 @@ cFile::~cFile() /////////////////////////////////////////////////////////////////////////////// #if !USES_DEVICE_PATH -void cFile::Open(const TSTRING& sFileName, uint32 flags) +void cFile::Open(const TSTRING& sFileName, uint32_t flags) { #else -void cFile::Open(const TSTRING& sFileNameC, uint32 flags) +void cFile::Open(const TSTRING& sFileNameC, uint32_t flags) { TSTRING sFileName = cDevicePath::AsNative(sFileNameC); #endif @@ -236,16 +224,21 @@ void cFile::Open(const TSTRING& sFileNameC, uint32 flags) fcntl(fh, F_NOCACHE, 1); #endif -#if IS_SOLARIS +#if HAVE_DIRECTIO // Solaris if ((flags & OPEN_DIRECT) && (flags & OPEN_SCANNING)) directio(fh, DIRECTIO_ON); #endif -#if HAVE_POSIX_FADVISE +#if SUPPORTS_POSIX_FADVISE if (flags & OPEN_SCANNING && !(flags & OPEN_DIRECT)) { +#ifdef POSIX_FADV_SEQUENTIAL posix_fadvise(fh, 0, 0, POSIX_FADV_SEQUENTIAL); +#endif + +#ifdef POSIX_FADV_NOREUSE posix_fadvise(fh, 0, 0, POSIX_FADV_NOREUSE); +#endif } #elif HAVE_SYS_FS_VX_IOCTL_H @@ -267,7 +260,7 @@ void cFile::Close() //throw(eFile) { if (mpData->mpCurrStream != NULL) { -#ifdef HAVE_POSIX_FADVISE +#if (SUPPORTS_POSIX_FADVISE && defined(POSIX_FADV_DONTNEED)) posix_fadvise(fileno(mpData->mpCurrStream), 0, 0, POSIX_FADV_DONTNEED); #endif @@ -275,8 +268,7 @@ void cFile::Close() //throw(eFile) mpData->mpCurrStream = NULL; } - - mpData->mFileName.empty(); + //mpData->mFileName.clear(); } bool cFile::IsOpen(void) const @@ -284,6 +276,15 @@ bool cFile::IsOpen(void) const return (mpData->mpCurrStream != NULL); } +// Autoconf docs say HAVE_FSEEKO applies to both fseeko & ftello +#if HAVE_FSEEKO + #define tss_fseek fseeko + #define tss_ftell ftello +#else + #define tss_fseek fseek + #define tss_ftell ftell +#endif + /////////////////////////////////////////////////////////////////////////// // Seek -- Positions the read/write offset in mpCurrStream. Returns the // current offset upon completion. Returns 0 if no stream is defined. @@ -323,7 +324,9 @@ cFile::File_t cFile::Seek(File_t offset, SeekFrom From) const //throw(eFile) fprintf(stderr, "%d\n", blowupCount); #endif - if (fseeko(mpData->mpCurrStream, offset, apiFrom) != 0) + + + if (tss_fseek(mpData->mpCurrStream, offset, apiFrom) != 0) { #ifdef DEBUG cDebug d("cFile::Seek"); @@ -332,7 +335,7 @@ cFile::File_t cFile::Seek(File_t offset, SeekFrom From) const //throw(eFile) throw eFileSeek(); } - return ftello(mpData->mpCurrStream); + return tss_ftell(mpData->mpCurrStream); } /////////////////////////////////////////////////////////////////////////// @@ -352,7 +355,11 @@ cFile::File_t cFile::Read(void* buffer, File_t nBytes) const //throw(eFile) if (mpData->mFlags & OPEN_DIRECT) { +#if READ_TAKES_CHAR_PTR + iBytesRead = read(mpData->m_fd, (char*)buffer, nBytes); +#else iBytesRead = read(mpData->m_fd, buffer, nBytes); +#endif if (iBytesRead < 0) { throw eFileRead(mpData->mFileName, iFSServices::GetInstance()->GetErrString()); @@ -360,7 +367,7 @@ cFile::File_t cFile::Read(void* buffer, File_t nBytes) const //throw(eFile) } else { - iBytesRead = fread(buffer, sizeof(byte), nBytes, mpData->mpCurrStream); + iBytesRead = fread(buffer, sizeof(uint8_t), nBytes, mpData->mpCurrStream); if (ferror(mpData->mpCurrStream) != 0) { throw eFileRead(mpData->mFileName, iFSServices::GetInstance()->GetErrString()); @@ -382,7 +389,7 @@ cFile::File_t cFile::Write(const void* buffer, File_t nBytes) //throw(eFile) ASSERT(mpData->mpCurrStream != NULL); ASSERT(isWritable); - if ((actual_count = fwrite(buffer, sizeof(byte), nBytes, mpData->mpCurrStream)) < nBytes) + if ((actual_count = fwrite(buffer, sizeof(uint8_t), nBytes, mpData->mpCurrStream)) < nBytes) throw eFileWrite(mpData->mFileName, iFSServices::GetInstance()->GetErrString()); else return actual_count; @@ -478,6 +485,9 @@ bool cDosPath::IsAbsolutePath(const TSTRING& in) // For paths of type C:\DOS TSTRING cDosPath::AsPosix(const TSTRING& in) { +#if (defined(__MINGW32__) || defined(__OS2__)) + return in; +#else if (in[0] == '/') { return in; @@ -488,6 +498,7 @@ TSTRING cDosPath::AsPosix(const TSTRING& in) out.erase(std::remove(out.begin(), out.end(), ':'), out.end()); return out; +#endif } TSTRING cDosPath::AsNative(const TSTRING& in) @@ -591,7 +602,7 @@ bool cRiscosPath::IsAbsolutePath(const TSTRING& in) // For paths of type SDFS::Volume.$.dir.file TSTRING cRiscosPath::AsPosix(const TSTRING& in) { -#if IS_RISCOS +#if HAVE_UNIXLIB_LOCAL_H if (in[0] == '/') { return in; @@ -614,7 +625,7 @@ TSTRING cRiscosPath::AsPosix(const TSTRING& in) TSTRING cRiscosPath::AsNative(const TSTRING& in) { -#if IS_RISCOS +#if HAVE_UNIXLIB_LOCAL_H if (in[0] != '/') { return in; diff --git a/src/core/fileerror.cpp b/src/core/fileerror.cpp index 244418d..f93a437 100644 --- a/src/core/fileerror.cpp +++ b/src/core/fileerror.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -37,7 +37,7 @@ #include "corestrings.h" // TODO: Make this use MakeFileError() for consistency -eFileError::eFileError(const TSTRING& filename, const TSTRING& description, uint32 flags) : eError(_T(""), flags) +eFileError::eFileError(const TSTRING& filename, const TSTRING& description, uint32_t flags) : eError(_T(""), flags) { mFilename = filename; mMsg = description; diff --git a/src/core/fileerror.h b/src/core/fileerror.h index c9f7c48..a0be331 100644 --- a/src/core/fileerror.h +++ b/src/core/fileerror.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -56,13 +56,13 @@ private: TSTRING mFilename; public: -eFileError(const TSTRING& filename, const TSTRING& description, uint32 flags = 0); +eFileError(const TSTRING& filename, const TSTRING& description, uint32_t flags = 0); explicit eFileError(const eFileError& rhs) : eError(rhs) { mFilename = rhs.mFilename; } -eFileError(const TSTRING& msg, uint32 flags = 0) : eError(msg, flags) +eFileError(const TSTRING& msg, uint32_t flags = 0) : eError(msg, flags) { } @@ -75,7 +75,7 @@ TSS_END_EXCEPTION() # define TSS_FILE_EXCEPTION(except, base) \ TSS_BEGIN_EXCEPTION(except, base) \ - except(const TSTRING& filename, const TSTRING& msg, uint32 flags = 0) : base(filename, msg, flags) \ + except(const TSTRING& filename, const TSTRING& msg, uint32_t flags = 0) : base(filename, msg, flags) \ { \ } \ TSS_END_EXCEPTION() diff --git a/src/core/fileheader.cpp b/src/core/fileheader.cpp index 21c3623..e786a86 100644 --- a/src/core/fileheader.cpp +++ b/src/core/fileheader.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -41,7 +41,7 @@ // I changed this magic number in 2.1 since we now support versioning in the file header. // (the old magic number was 0x00202039) // I generated the random number using the random.org web site. -const uint32 FILE_HEADER_MAGIC_NUMBER = 0x78f9beb3; +const uint32_t FILE_HEADER_MAGIC_NUMBER = 0x78f9beb3; /////////////////////////////////////////////////////////////////////////////// // class cFileHeaderID @@ -66,7 +66,7 @@ void cFileHeaderID::operator=(const TCHAR* pszId) if (!(N < cFileHeaderID::MAXBYTES)) throw eCharacter(TSS_GetString(cCore, core::STR_ERR_OVERFLOW)); - mIDLen = static_cast(N); // know len is less than MAXBYTES + mIDLen = static_cast(N); // know len is less than MAXBYTES ::memcpy(mID, pszId, N * sizeof(char)); } @@ -82,9 +82,9 @@ int cFileHeaderID::operator==(const cFileHeaderID& rhs) const return (mIDLen == rhs.mIDLen) && (::memcmp(mID, rhs.mID, mIDLen * sizeof(char)) == 0); } -void cFileHeaderID::Read(iSerializer* pSerializer, int32 /*version*/) // throw (eSerializer, eArchive) +void cFileHeaderID::Read(iSerializer* pSerializer, int32_t /*version*/) // throw (eSerializer, eArchive) { - int16 len; + int16_t len; pSerializer->ReadInt16(len); if ((len < 0) || (len >= cFileHeaderID::MAXBYTES)) { @@ -139,7 +139,7 @@ void cFileHeader::SetID(const cFileHeaderID& id) mID = id; } -void cFileHeader::SetVersion(uint32 v) +void cFileHeader::SetVersion(uint32_t v) { mVersion = v; } @@ -149,12 +149,12 @@ void cFileHeader::SetEncoding(Encoding e) mEncoding = e; } -void cFileHeader::Read(iSerializer* pSerializer, int32 /*version*/) // throw (eSerializer, eArchive) +void cFileHeader::Read(iSerializer* pSerializer, int32_t /*version*/) // throw (eSerializer, eArchive) { - int16 e; - int32 len; - int32 magicNumber; - int32 version; + int16_t e; + int32_t len; + int32_t magicNumber; + int32_t version; cDebug d("cFileHeader::Read"); @@ -224,9 +224,9 @@ void cFileHeader::Write(iSerializer* pSerializer) const // throw (eSerializer, e pSerializer->WriteInt32(mVersion); - pSerializer->WriteInt16(static_cast(mEncoding)); + pSerializer->WriteInt16(static_cast(mEncoding)); - int32 len = static_cast(mBaggage.Length()); + int32_t len = static_cast(mBaggage.Length()); ASSERT(len >= 0); ASSERT(len <= 0xFFFF); diff --git a/src/core/fileheader.h b/src/core/fileheader.h index 78b723d..a543b65 100644 --- a/src/core/fileheader.h +++ b/src/core/fileheader.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -59,7 +59,7 @@ public: int operator==(const cFileHeaderID& rhs) const; int operator!=(const cFileHeaderID& rhs) const; - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) private: @@ -68,7 +68,7 @@ private: // the way we implemented cFCONames. // Note: We store the string as narrow chars, since // the program is the only person who will see them. - int16 mIDLen; + int16_t mIDLen; enum { @@ -119,8 +119,8 @@ public: void SetID(const cFileHeaderID& id); const cFileHeaderID& GetID() const; - void SetVersion(uint32 v); - uint32 GetVersion() const; + void SetVersion(uint32_t v); + uint32_t GetVersion() const; void SetEncoding(Encoding e); Encoding GetEncoding() const; @@ -128,12 +128,12 @@ public: cMemoryArchive& GetBaggage(); const cMemoryArchive& GetBaggage() const; - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) - virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) + virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) protected: cFileHeaderID mID; - uint32 mVersion; + uint32_t mVersion; Encoding mEncoding; cMemoryArchive mBaggage; // items that have been serialized to this object }; @@ -143,7 +143,7 @@ inline const cFileHeaderID& cFileHeader::GetID() const return mID; } -inline uint32 cFileHeader::GetVersion() const +inline uint32_t cFileHeader::GetVersion() const { return mVersion; } diff --git a/src/core/fixedfilebuf.h b/src/core/fixedfilebuf.h index f646801..836f05d 100644 --- a/src/core/fixedfilebuf.h +++ b/src/core/fixedfilebuf.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/fixups.h b/src/core/fixups.h new file mode 100644 index 0000000..606c596 --- /dev/null +++ b/src/core/fixups.h @@ -0,0 +1,69 @@ +// +// The developer of the original code and/or files is Tripwire, Inc. +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, +// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights +// reserved. +// +// This program is free software. The contents of this file are subject +// to the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. You may redistribute it and/or modify it +// only in compliance with the GNU General Public License. +// +// This program is distributed in the hope that it will be useful. +// However, this program is distributed AS-IS WITHOUT ANY +// WARRANTY; INCLUDING THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS +// FOR A PARTICULAR PURPOSE. Please 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. +// +// Nothing in the GNU General Public License or any other license to use +// the code or files shall permit you to use Tripwire's trademarks, +// service marks, or other intellectual property without Tripwire's +// prior written consent. +// +// If you have any questions, please contact Tripwire, Inc. at either +// info@tripwire.org or www.tripwire.org. + + +// ==================================================================== +// fixups.h : +// This file is included at the end of the generated config.h, for repairing things +// the configure script got wrong. Because this does happen now and then. +// +// This header is intentionally not wrapped with the usual #ifndef/#define/#endif +// since config.h itself doesn't do that, and we need to be inclded right after +// it each time it's included. + + +// ===================================================================== +// Cross compiling to powerpc-wrs-vxworks from linux amd64, observed that +// AC_CHECK_FUNC defines HAVE_xxx for every checked function, including +// ones that don't and can't exist like fork() & symlink(), and others that +// could at least optionally exist, but don't in my cross compiler, like socket(). +// + +#if HAVE_BROKEN_AC_CHECK_FUNC + #if defined(__VXWORKS__) || defined(__vxworks) + #undef HAVE__EXIT + #undef HAVE_CHOWN + #undef HAVE_EXECVE + #undef HAVE_FORK + #undef HAVE_GETHOSTID + #undef HAVE_GETUID + #undef HAVE_LSTAT + #undef HAVE_MKSTEMP + #undef HAVE_MKTEMP + #undef HAVE_POPEN + #undef HAVE_SOCKET + #undef HAVE_SYMLINK + #undef HAVE_SYSLOG + #undef HAVE_READLINK + #undef HAVE_TZSET + #endif +#endif + diff --git a/src/core/fsservices.cpp b/src/core/fsservices.cpp index 3817582..ea55fc3 100644 --- a/src/core/fsservices.cpp +++ b/src/core/fsservices.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/fsservices.h b/src/core/fsservices.h index 43ce5e6..92dbe17 100644 --- a/src/core/fsservices.h +++ b/src/core/fsservices.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -98,8 +98,8 @@ // TYPEDEFS //========================================================================= -typedef int64 cFSTime; -typedef int64 cFSType; +typedef int64_t cFSTime; +typedef int64_t cFSType; //========================================================================= // GLOBALS @@ -117,7 +117,7 @@ typedef int64 cFSType; // it is the union of MAX(elem) for all the file systems that we support /*class cACLElem { // TODO this is just a place holder - // uint32 mUid; + // uint32_t mUid; };*/ // this class is used only to pass arguments to iFSServices @@ -136,27 +136,31 @@ struct cFSStatArgs TY_SOCK, TY_DOOR, TY_PORT, - TY_NAMED + TY_NAMED, + TY_NATIVE, + TY_MESSAGE_QUEUE, + TY_SEMAPHORE, + TY_SHARED_MEMORY }; // attr is fs dependent? - uint64 dev; // dep - int64 ino; // dep - int64 mode; // dep - int64 nlink; // indep - int64 uid; // dep - int64 gid; // dep - uint64 rdev; // dep - int64 size; // indep - cFSTime atime; // indep - cFSTime mtime; // indep - cFSTime ctime; // indep - int64 blksize; // indep - int64 blocks; // dep - int64 fstype; // dep - TSTRING usid; // dep - TSTRING gsid; // dep - // int64 mFileType; // Matt's addition... + uint64_t dev; // dep + int64_t ino; // dep + int64_t mode; // dep + int64_t nlink; // indep + int64_t uid; // dep + int64_t gid; // dep + uint64_t rdev; // dep + int64_t size; // indep + cFSTime atime; // indep + cFSTime mtime; // indep + cFSTime ctime; // indep + int64_t blksize; // indep + int64_t blocks; // dep + int64_t fstype; // dep + TSTRING usid; // dep + TSTRING gsid; // dep + // int64_t mFileType; // Matt's addition... FileType mFileType; // redundant with other information in this struct, but // broken out for convenience @@ -269,7 +273,7 @@ public: virtual bool GetCurrentUserName(TSTRING& tstrName) const = 0; - virtual bool GetIPAddress(uint32& uiIPAddress) = 0; + virtual bool GetIPAddress(uint32_t& uiIPAddress) = 0; //////////////////////////////////////// @@ -305,8 +309,8 @@ public: //////////////////////////////////////// // miscellaneous utility functions //////////////////////////////////////// - virtual void ConvertModeToString(uint64 perm, TSTRING& tstrPerm) const = 0; - // takes a int64 permission (from stat) and changes it to look like UNIX's 'ls -l' (e.g. drwxrwxrwx) + virtual void ConvertModeToString(uint64_t perm, TSTRING& tstrPerm) const = 0; + // takes a int64_t permission (from stat) and changes it to look like UNIX's 'ls -l' (e.g. drwxrwxrwx) virtual bool FullPath(TSTRING& fullPath, const TSTRING& relPath, const TSTRING& pathRelFrom = _T("")) const = 0; // converts relPath into a fully qualified path, storing it in FullPath. If this // fails, false is returned. if the path to which relPath is relative is not CWD, put it in pathRelFrom. diff --git a/src/core/growheap.cpp b/src/core/growheap.cpp index b6d384a..364be9b 100644 --- a/src/core/growheap.cpp +++ b/src/core/growheap.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -45,9 +45,9 @@ public: { public: size_t mSize; - int8* mpData; + int8_t* mpData; - cHeap(size_t size) : mSize(size), mpData(new int8[size]) + cHeap(size_t size) : mSize(size), mpData(new int8_t[size]) { ASSERT(mpData != 0); } @@ -118,7 +118,7 @@ void* cGrowHeap_i::Malloc(size_t size) // we have room to add this to the current heap. // ASSERT(mHeaps.back().mpData); - int8* ret = mHeaps.back().mpData + mCurOff; + int8_t* ret = mHeaps.back().mpData + mCurOff; mCurOff += size; return ret; diff --git a/src/core/growheap.h b/src/core/growheap.h index 11b0b11..a202b91 100644 --- a/src/core/growheap.h +++ b/src/core/growheap.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/hashtable.cpp b/src/core/hashtable.cpp index bdffb59..d64aee2 100644 --- a/src/core/hashtable.cpp +++ b/src/core/hashtable.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/hashtable.h b/src/core/hashtable.h index 9804994..28de18d 100644 --- a/src/core/hashtable.h +++ b/src/core/hashtable.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -32,11 +32,11 @@ // hashtable.h : a template class for mapping tuples using TCHAR*'s // // implements cHashTable, which maps a key of arbitrary type to a value -// of arbitrary type. The key data type MUST have the const byte*() +// of arbitrary type. The key data type MUST have the const uint8_t*() // operator overloaded in order for this to work. TSTRINGS will always // work as the key value because of the overloaded-template-function // -// Note: Any overloaded const byte*() operator must return an +// Note: Any overloaded const uint8_t*() operator must return an // length of key as well. see cDefaultConvert // // IMPORTANT -- cDefaultConvert only works for pointers to objects @@ -85,26 +85,26 @@ template<> inline bool cDefaultCompare::operator()(const TSTRING& lhs, /////////////////////////////////////////////////////////////////////////////// // Conversion function objects ... used by the hash table to locate the key in KEY_TYPE -// into a byte* and a key length (for hashing purposes). The default implementation +// into a uint8_t* and a key length (for hashing purposes). The default implementation // just does a cast. A specialization is also provided for TSTRINGs. /////////////////////////////////////////////////////////////////////////////// template class cDefaultConvert { public: - const byte* operator()(const T& obj, int* const pcbKeyLen) + const uint8_t* operator()(const T& obj, int* const pcbKeyLen) { // HACK! TODO: in the interest of time, I've left this as it is..... *pcbKeyLen = sizeof(TCHAR) * _tcslen(obj); - return (byte*)obj; + return (uint8_t*)obj; } }; ///////////////////////////////////////////////////////// // specialization for TSTRINGS ///////////////////////////////////////////////////////// -template<> inline const byte* cDefaultConvert::operator()(const TSTRING& obj, int* const pcbKeyLen) +template<> inline const uint8_t* cDefaultConvert::operator()(const TSTRING& obj, int* const pcbKeyLen) { *pcbKeyLen = sizeof(TCHAR) * obj.length(); - return (byte*)obj.c_str(); + return (uint8_t*)obj.c_str(); } /////////////////////////////////////////////////////////////////////////////// @@ -113,8 +113,8 @@ template<> inline const byte* cDefaultConvert::operator()(const TSTRING // VAL -- the value you want associated with that key // CMP -- a function object that takes (KEY, KEY) and returns true if they // are equal. -// CONVERTER -- function object that takes (KEY, int* pcbKeyLen) and returns a const byte* -// ( points to start of key ) and a byte length (in pcbKeyLen) that tells the hashtable +// CONVERTER -- function object that takes (KEY, int* pcbKeyLen) and returns a const uint8_t* +// ( points to start of key ) and a uint8_t length (in pcbKeyLen) that tells the hashtable // how long the key is /////////////////////////////////////////////////////////////////////////////// // these were moved outside of the class because it sucks to have to name the class with template parameters @@ -172,9 +172,9 @@ public: bool Clear(void); //Clears the entire table and sets all node pointers to NULL bool IsEmpty(void) const; - uint32 Hash(const KEY_TYPE& key) const; + uint32_t Hash(const KEY_TYPE& key) const; //The hashing function, taken from old Tripwire - int32 GetNumValues() const + int32_t GetNumValues() const { return mValuesInTable; }; @@ -189,9 +189,9 @@ private: cHashTable(const cHashTable& rhs); // not impl void operator=(const cHashTable& rhs); // not impl - node** mTable; - int mTableSize; - int32 mValuesInTable; + node** mTable; + int mTableSize; + int32_t mValuesInTable; }; /////////////////////////////////////////////////////////////////////////////// @@ -506,12 +506,12 @@ bool cHashTable::IsEmpty(void) const // Hash -- performs hashing on key, returns an integer index val. //////////////////////////////////////////////////////////////////////////////// template -uint32 cHashTable::Hash(const KEY_TYPE& key) const +uint32_t cHashTable::Hash(const KEY_TYPE& key) const { CONVERTER converter; int len; - const byte* pb = converter(key, &len); //locates key - uint32 hindex; + const uint8_t* pb = converter(key, &len); //locates key + uint32_t hindex; hindex = *pb; while (len-- > 0) diff --git a/src/core/haval.cpp b/src/core/haval.cpp index 207a4b4..8df28ed 100644 --- a/src/core/haval.cpp +++ b/src/core/haval.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -99,17 +99,17 @@ #define P_(s) () #endif -void haval_string P_((char *, uint8 *)); /* hash a string */ -int haval_file P_((char *, uint8 *)); /* hash a file */ +void haval_string P_((char *, uint8_t *)); /* hash a string */ +int haval_file P_((char *, uint8_t *)); /* hash a file */ void haval_stdin P_((void)); /* hash input from stdin */ void haval_start P_((haval_state *)); /* initialization */ void haval_hash P_((haval_state *, - uint8 *, int)); /* updating routine */ -void haval_end P_((haval_state *, uint8 *)); /* finalization */ + uint8_t *, int)); /* updating routine */ +void haval_end P_((haval_state *, uint8_t *)); /* finalization */ void haval_hash_block P_((haval_state *)); /* hash a 32-word block */ static void haval_tailor P_((haval_state *)); /* folding the last output */ -static uint8 padding[128] = { /* constants for padding */ +static uint8_t padding[128] = { /* constants for padding */ 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -222,27 +222,27 @@ static uint8 padding[128] = { /* constants for padding */ #define rotate_right(x, n) (((x) >> (n)) | ((x) << (32-(n)))) #define FF_1(x7, x6, x5, x4, x3, x2, x1, x0, w) { \ - register haval_word temp = Fphi_1(x6, x5, x4, x3, x2, x1, x0); \ + haval_word temp = Fphi_1(x6, x5, x4, x3, x2, x1, x0); \ (x7) = rotate_right(temp, 7) + rotate_right((x7), 11) + (w); \ } #define FF_2(x7, x6, x5, x4, x3, x2, x1, x0, w, c) { \ - register haval_word temp = Fphi_2(x6, x5, x4, x3, x2, x1, x0); \ + haval_word temp = Fphi_2(x6, x5, x4, x3, x2, x1, x0); \ (x7) = rotate_right(temp, 7) + rotate_right((x7), 11) + (w) + (c); \ } #define FF_3(x7, x6, x5, x4, x3, x2, x1, x0, w, c) { \ - register haval_word temp = Fphi_3(x6, x5, x4, x3, x2, x1, x0); \ + haval_word temp = Fphi_3(x6, x5, x4, x3, x2, x1, x0); \ (x7) = rotate_right(temp, 7) + rotate_right((x7), 11) + (w) + (c); \ } #define FF_4(x7, x6, x5, x4, x3, x2, x1, x0, w, c) { \ - register haval_word temp = Fphi_4(x6, x5, x4, x3, x2, x1, x0); \ + haval_word temp = Fphi_4(x6, x5, x4, x3, x2, x1, x0); \ (x7) = rotate_right(temp, 7) + rotate_right((x7), 11) + (w) + (c); \ } #define FF_5(x7, x6, x5, x4, x3, x2, x1, x0, w, c) { \ - register haval_word temp = Fphi_5(x6, x5, x4, x3, x2, x1, x0); \ + haval_word temp = Fphi_5(x6, x5, x4, x3, x2, x1, x0); \ (x7) = rotate_right(temp, 7) + rotate_right((x7), 11) + (w) + (c); \ } @@ -251,7 +251,7 @@ static uint8 padding[128] = { /* constants for padding */ * assume the number of characters is a multiple of four. */ #define ch2uint(string, word, slen) { \ - uint8 *sp = string; \ + uint8_t *sp = string; \ haval_word *wp = word; \ while (sp < (string) + (slen)) { \ *wp++ = (haval_word)*sp | \ @@ -265,12 +265,12 @@ static uint8 padding[128] = { /* constants for padding */ /* translate each word into four characters */ #define uint2ch(word, string, wlen) { \ haval_word *wp = word; \ - uint8 *sp = string; \ + uint8_t *sp = string; \ while (wp < (word) + (wlen)) { \ - *(sp++) = (uint8)( *wp & 0xFF); \ - *(sp++) = (uint8)((*wp >> 8) & 0xFF); \ - *(sp++) = (uint8)((*wp >> 16) & 0xFF); \ - *(sp++) = (uint8)((*wp >> 24) & 0xFF); \ + *(sp++) = (uint8_t)( *wp & 0xFF); \ + *(sp++) = (uint8_t)((*wp >> 8) & 0xFF); \ + *(sp++) = (uint8_t)((*wp >> 16) & 0xFF); \ + *(sp++) = (uint8_t)((*wp >> 24) & 0xFF); \ wp++; \ } \ } @@ -278,23 +278,23 @@ static uint8 padding[128] = { /* constants for padding */ #if 0 //unused in OST /* hash a string */ -void haval_string (char *string, uint8 fingerprint[FPTLEN >> 3]) +void haval_string (char *string, uint8_t fingerprint[FPTLEN >> 3]) { haval_state state; unsigned int len = strlen (string); haval_start (&state); - haval_hash (&state, (uint8 *)string, len); + haval_hash (&state, (uint8_t *)string, len); haval_end (&state, fingerprint); } /* hash a file */ -int haval_file (char* file_name, uint8 fingerprint[FPTLEN >> 3]) +int haval_file (char* file_name, uint8_t fingerprint[FPTLEN >> 3]) { FILE *file; haval_state state; int len; - uint8 buffer[1024]; + uint8_t buffer[1024]; if ((file = fopen (file_name, "rb")) == NULL) { @@ -318,7 +318,7 @@ void haval_stdin () { haval_state state; int i, len; - uint8 buffer[32], + uint8_t buffer[32], fingerprint[FPTLEN >> 3]; haval_start (&state); @@ -351,7 +351,7 @@ void haval_start (haval_state *state) * hash a string of specified length. * to be used in conjunction with haval_start and haval_end. */ -void haval_hash (haval_state* state, uint8* str, int str_len) +void haval_hash (haval_state* state, uint8_t* str, int str_len) { ASSERT(str_len >= 0); @@ -374,17 +374,17 @@ void haval_hash (haval_state* state, uint8* str, int str_len) /* hash as many blocks as possible */ if (rmd_len + str_len >= 128) { - memcpy (((uint8 *)state->block)+rmd_len, str, fill_len); + memcpy (((uint8_t *)state->block)+rmd_len, str, fill_len); haval_hash_block (state); for (i = fill_len; i + 127 < str_len; i += 128){ - memcpy ((uint8 *)state->block, str+i, 128); + memcpy ((uint8_t *)state->block, str+i, 128); haval_hash_block (state); } rmd_len = 0; } else { i = 0; } - memcpy (((uint8 *)state->block)+rmd_len, str+i, str_len-i); + memcpy (((uint8_t *)state->block)+rmd_len, str+i, str_len-i); #else @@ -409,19 +409,19 @@ void haval_hash (haval_state* state, uint8* str, int str_len) } /* finalization */ -void haval_end (haval_state* state, uint8 final_fpt[FPTLEN >> 3]) +void haval_end (haval_state* state, uint8_t final_fpt[FPTLEN >> 3]) { - uint8 tail[10]; + uint8_t tail[10]; unsigned int rmd_len, pad_len; /* * save the version number, the number of passes, the fingerprint * length and the number of bits in the unpadded message. */ - tail[0] = (uint8)(((FPTLEN & 0x3) << 6) | + tail[0] = (uint8_t)(((FPTLEN & 0x3) << 6) | ((PASS & 0x7) << 3) | (HAVAL_VERSION & 0x7)); - tail[1] = (uint8)((FPTLEN >> 2) & 0xFF); + tail[1] = (uint8_t)((FPTLEN >> 2) & 0xFF); uint2ch (state->count, &tail[2], 2); /* pad out to 118 mod 128 */ @@ -448,7 +448,7 @@ void haval_end (haval_state* state, uint8 final_fpt[FPTLEN >> 3]) /* hash a 32-word block */ void haval_hash_block (haval_state* state) { - register haval_word t0 = state->fingerprint[0], /* make use of */ + haval_word t0 = state->fingerprint[0], /* make use of */ t1 = state->fingerprint[1], /* internal registers */ t2 = state->fingerprint[2], t3 = state->fingerprint[3], diff --git a/src/core/haval.h b/src/core/haval.h index d89cdf2..3479bc0 100644 --- a/src/core/haval.h +++ b/src/core/haval.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -98,13 +98,13 @@ #include "core/tchar.h" #endif -typedef uint32 haval_word; /* a HAVAL word = 32 bits */ +typedef uint32_t haval_word; /* a HAVAL word = 32 bits */ typedef struct { haval_word count[2]; /* number of bits in a message */ haval_word fingerprint[8]; /* current state of fingerprint */ haval_word block[32]; /* buffer for a 32-word block */ - uint8 remainder[32*4]; /* unhashed chars (No.<128) */ + uint8_t remainder[32*4]; /* unhashed chars (No.<128) */ } haval_state; /* Do not remove this line. Protyping depends on it! @@ -118,14 +118,14 @@ typedef struct { #define P_(s) s //Old prototyping stuff... I will ignore it for now. #if 0 //unused in OST -void haval_string P_((char *, uint8 *)); /* hash a string */ -int haval_file P_((char *, uint8 *)); /* hash a file */ +void haval_string P_((char *, uint8_t *)); /* hash a string */ +int haval_file P_((char *, uint8_t *)); /* hash a file */ void haval_stdin P_((void)); /* filter -- hash input from stdin */ #endif void haval_start P_((haval_state *)); /* initialization */ -void haval_hash P_((haval_state* state, uint8* str, int str_len)); -void haval_end P_((haval_state *, uint8 *)); /* finalization */ +void haval_hash P_((haval_state* state, uint8_t* str, int str_len)); +void haval_end P_((haval_state *, uint8_t *)); /* finalization */ void haval_hash_block P_((haval_state *)); /* hash a 32-word block */ #endif //__HAVAL_H diff --git a/src/core/md5.cpp b/src/core/md5.cpp index d37e168..3f5b2e7 100644 --- a/src/core/md5.cpp +++ b/src/core/md5.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -56,9 +56,9 @@ #include "md5.h" /* forward declaration */ -static void Transform (uint32*, uint32*); +static void Transform (uint32_t*, uint32_t*); -static uint8 PADDING[64] = { +static uint8_t PADDING[64] = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -85,22 +85,22 @@ static uint8 PADDING[64] = { /* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4 */ /* Rotation is separate from addition to prevent recomputation */ #define FF(a, b, c, d, x, s, ac) \ - {(a) += F ((b), (c), (d)) + (x) + (uint32)(ac); \ + {(a) += F ((b), (c), (d)) + (x) + (uint32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define GG(a, b, c, d, x, s, ac) \ - {(a) += G ((b), (c), (d)) + (x) + (uint32)(ac); \ + {(a) += G ((b), (c), (d)) + (x) + (uint32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define HH(a, b, c, d, x, s, ac) \ - {(a) += H ((b), (c), (d)) + (x) + (uint32)(ac); \ + {(a) += H ((b), (c), (d)) + (x) + (uint32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define II(a, b, c, d, x, s, ac) \ - {(a) += I ((b), (c), (d)) + (x) + (uint32)(ac); \ + {(a) += I ((b), (c), (d)) + (x) + (uint32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } @@ -109,22 +109,22 @@ static uint8 PADDING[64] = { mdContext. All fields are set to zero. */ void MD5Init (MD5_CTX* mdContext) { - mdContext->i[0] = mdContext->i[1] = (uint32)0; + mdContext->i[0] = mdContext->i[1] = (uint32_t)0; /* Load magic initialization constants. */ - mdContext->buf[0] = (uint32)0x67452301; - mdContext->buf[1] = (uint32)0xefcdab89; - mdContext->buf[2] = (uint32)0x98badcfe; - mdContext->buf[3] = (uint32)0x10325476; + mdContext->buf[0] = (uint32_t)0x67452301; + mdContext->buf[1] = (uint32_t)0xefcdab89; + mdContext->buf[2] = (uint32_t)0x98badcfe; + mdContext->buf[3] = (uint32_t)0x10325476; } /* The routine MD5Update updates the message-digest context to account for the presence of each of the characters inBuf[0..inLen-1] in the message whose digest is being computed. */ -void MD5Update (MD5_CTX* mdContext, uint8* inBuf, unsigned int inLen) +void MD5Update (MD5_CTX* mdContext, uint8_t* inBuf, unsigned int inLen) { - uint32 in[16]; + uint32_t in[16]; int mdi; unsigned int i, ii; @@ -133,15 +133,15 @@ void MD5Update (MD5_CTX* mdContext, uint8* inBuf, unsigned int inLen) /* update number of bits */ #ifndef UNICOS - if ((mdContext->i[0] + ((uint32)inLen << 3)) < mdContext->i[0]) + if ((mdContext->i[0] + ((uint32_t)inLen << 3)) < mdContext->i[0]) #else - if (((mdContext->i[0]+((uint32)inLen << 3)) & 0xffffffff) < mdContext->i[0]) + if (((mdContext->i[0]+((uint32_t)inLen << 3)) & 0xffffffff) < mdContext->i[0]) #endif mdContext->i[1]++; - mdContext->i[0] += ((uint32)inLen << 3); - mdContext->i[1] += ((uint32)inLen >> 29); + mdContext->i[0] += ((uint32_t)inLen << 3); + mdContext->i[1] += ((uint32_t)inLen >> 29); while (inLen--) { /* add new character to buffer, increment mdi */ @@ -150,10 +150,10 @@ void MD5Update (MD5_CTX* mdContext, uint8* inBuf, unsigned int inLen) /* transform if necessary */ if (mdi == 0x40) { for (i = 0, ii = 0; i < 16; i++, ii += 4) - in[i] = (((uint32)mdContext->in[ii+3]) << 24) | - (((uint32)mdContext->in[ii+2]) << 16) | - (((uint32)mdContext->in[ii+1]) << 8) | - ((uint32)mdContext->in[ii]); + in[i] = (((uint32_t)mdContext->in[ii+3]) << 24) | + (((uint32_t)mdContext->in[ii+2]) << 16) | + (((uint32_t)mdContext->in[ii+1]) << 8) | + ((uint32_t)mdContext->in[ii]); Transform (mdContext->buf, in); mdi = 0; } @@ -164,7 +164,7 @@ void MD5Update (MD5_CTX* mdContext, uint8* inBuf, unsigned int inLen) ends with the desired message digest in mdContext->digest[0...15]. */ void MD5Final (MD5_CTX* mdContext) { - uint32 in[16]; + uint32_t in[16]; int mdi; unsigned int i, ii; unsigned int padLen; @@ -182,28 +182,28 @@ void MD5Final (MD5_CTX* mdContext) /* append length in bits and transform */ for (i = 0, ii = 0; i < 14; i++, ii += 4) - in[i] = (((uint32)mdContext->in[ii+3]) << 24) | - (((uint32)mdContext->in[ii+2]) << 16) | - (((uint32)mdContext->in[ii+1]) << 8) | - ((uint32)mdContext->in[ii]); + in[i] = (((uint32_t)mdContext->in[ii+3]) << 24) | + (((uint32_t)mdContext->in[ii+2]) << 16) | + (((uint32_t)mdContext->in[ii+1]) << 8) | + ((uint32_t)mdContext->in[ii]); Transform (mdContext->buf, in); /* store buffer in digest */ for (i = 0, ii = 0; i < 4; i++, ii += 4) { - mdContext->digest[ii] = (uint8)(mdContext->buf[i] & 0xFF); + mdContext->digest[ii] = (uint8_t)(mdContext->buf[i] & 0xFF); mdContext->digest[ii+1] = - (uint8)((mdContext->buf[i] >> 8) & 0xFF); + (uint8_t)((mdContext->buf[i] >> 8) & 0xFF); mdContext->digest[ii+2] = - (uint8)((mdContext->buf[i] >> 16) & 0xFF); + (uint8_t)((mdContext->buf[i] >> 16) & 0xFF); mdContext->digest[ii+3] = - (uint8)((mdContext->buf[i] >> 24) & 0xFF); + (uint8_t)((mdContext->buf[i] >> 24) & 0xFF); } } /* Basic MD5 step. Transforms buf based on in. */ -static void Transform (uint32* buf, uint32* in) +static void Transform (uint32_t* buf, uint32_t* in) { - uint32 a = buf[0], b = buf[1], c = buf[2], d = buf[3]; + uint32_t a = buf[0], b = buf[1], c = buf[2], d = buf[3]; /* Round 1 */ #define S11 7 diff --git a/src/core/md5.h b/src/core/md5.h index 34b907b..34fbb6b 100644 --- a/src/core/md5.h +++ b/src/core/md5.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -48,14 +48,14 @@ /* Data structure for MD5 (Message-Digest) computation */ typedef struct { - uint32 i[2]; /* number of _bits_ handled mod 2^64 */ - uint32 buf[4]; /* scratch buffer */ - uint8 in[64]; /* input buffer */ - uint8 digest[16]; /* actual digest after MD5Final call */ + uint32_t i[2]; /* number of _bits_ handled mod 2^64 */ + uint32_t buf[4]; /* scratch buffer */ + uint8_t in[64]; /* input buffer */ + uint8_t digest[16]; /* actual digest after MD5Final call */ } MD5_CTX; void MD5Init(MD5_CTX*); -void MD5Update(MD5_CTX*, uint8*, unsigned int); +void MD5Update(MD5_CTX*, uint8_t*, unsigned int); void MD5Final(MD5_CTX*); #endif //__MD5_H diff --git a/src/core/msystem.cpp b/src/core/msystem.cpp index 53d6ed9..bca3ffc 100644 --- a/src/core/msystem.cpp +++ b/src/core/msystem.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -72,35 +72,40 @@ #include "config.h" #include #include -#if !IS_SORTIX -# include + +#if !IS_SORTIX && HAVE_SYS_FILE_H +# include #endif + #include -#include -#include -#if HAVE_MALLOC_H && !IS_AROS -#include + +#if HAVE_SYS_WAIT_H +# include #endif + +#include + +#if HAVE_MALLOC_H && !IS_AROS +# include +#endif + #include //#include #include "tw_signal.h" + #ifdef __STDC__ -# include -# include +# include +# include #endif + #ifdef HAVE_SYS_PARAM_H -# include +# include #endif + #include #include "msystem.h" -#if IS_REDOX -#define setuid(x) sleep(0) -#define setgid(x) sleep(0) -#endif - - - +#if USES_MSYSTEM /* * signal type */ @@ -227,7 +232,7 @@ char *getenv(); /* get variable from environment */ char *str; # endif { - register char *p; /* temp pointer */ + char *p; /* temp pointer */ /* * allocate space for the string, and copy if successful @@ -253,7 +258,7 @@ char **old; int *sz_alloc; #endif { - register int i; /* counter in a for loop */ + int i; /* counter in a for loop */ union xyzzy x; /* used to cast malloc properly */ /* @@ -284,8 +289,8 @@ static int initenv(void) static int initenv() #endif { - register int i; - register int rval; + int i; + int rval; if (envp != NULL) le_clobber(); @@ -306,7 +311,7 @@ void le_clobber(void) void le_clobber() #endif { - register int i; /* counter in a for loop */ + int i; /* counter in a for loop */ union { char **ep; char *p; @@ -344,8 +349,8 @@ static int le_getenv(var) char *var; #endif { - register int i; /* counter in a for loop */ - register char *p, *q; /* used to compare two strings */ + int i; /* counter in a for loop */ + char *p, *q; /* used to compare two strings */ /* * check for no environment @@ -385,8 +390,8 @@ int le_set(env) char *env; #endif { - register char *p, *q; /* what is to be put into env */ - register int n; /* where a previous definition is */ + char *p, *q; /* what is to be put into env */ + int n; /* where a previous definition is */ /* * see if you need to create the environment list @@ -475,7 +480,7 @@ int le_unset(env) char *env; #endif { - register int i; /* counter in a for loop */ + int i; /* counter in a for loop */ /* * delete it from the environment @@ -595,8 +600,8 @@ static const char *shellenv(void) static const char *shellenv() #endif { - register int i; /* counter in a for loop */ - register const char *shptr; /* points to shell name */ + int i; /* counter in a for loop */ + const char *shptr; /* points to shell name */ /* * error check; should never happen @@ -620,6 +625,8 @@ static const char *shellenv() return(shptr); } + +#if USES_MSYSTEM /* * like system but A LOT safer */ @@ -631,9 +638,9 @@ char *cmd; #endif { const char *argv[5]; /* argument list */ - register const char *p; /* temoporary pointers */ - register const char* shptr; /* the program to be run */ - register int i; /* index number of child */ + const char *p; /* temoporary pointers */ + const char* shptr; /* the program to be run */ + int i; /* index number of child */ /* * if it's NULL, initialize it @@ -661,6 +668,7 @@ char *cmd; return(127); return(echild(i)); } +#endif // USES_MSYSTEM /* * this structure holds the information associating @@ -672,6 +680,7 @@ static struct popenfunc { /* association of pid, file pointer */ FILE *fp; /* the file pointer */ } pfunc[MAX_MPOPEN]; +#if USES_MPOPEN /* * like popen but A LOT safer */ @@ -684,10 +693,10 @@ char *mode; #endif { const char *argv[5]; /* argument list */ - register const char *p; /* temoporary pointers */ - register const char *shptr; /* the program to be run */ + const char *p; /* temoporary pointers */ + const char *shptr; /* the program to be run */ FILE *fpa[3]; /* process communication descriptors */ - register int indx; /* index number of child */ + int indx; /* index number of child */ /* * see if anything is available @@ -722,6 +731,7 @@ char *mode; return(NULL); return(pfunc[indx].fp = ((*mode == 'w') ? fpa[0] : fpa[1])); } +#endif /* * close the pipe @@ -733,8 +743,8 @@ int mpclose(fp) FILE *fp; #endif { - register int indx; /* used to look for corresponding pid */ - register int rstatus; /* return status of command */ + int indx; /* used to look for corresponding pid */ + int rstatus; /* return status of command */ /* * loop until you find the right process @@ -771,9 +781,9 @@ FILE *fpa[]; #endif { const char *argv[5]; /* argument list */ - register const char *p; /* temoporary pointers */ - register const char *shptr; /* the program to be run */ - register int indx; /* index number of child */ + const char *p; /* temoporary pointers */ + const char *shptr; /* the program to be run */ + int indx; /* index number of child */ /* * see if anything is available @@ -816,7 +826,7 @@ int indx; FILE *fp[]; #endif { - register int rstatus; /* return status of command */ + int rstatus; /* return status of command */ /* * loop until you find the right process @@ -850,7 +860,7 @@ char *argv[]; FILE *fpa[]; #endif { - register int indx; /* index number of child */ + int indx; /* index number of child */ /* * see if anything is available @@ -883,10 +893,13 @@ FILE *fp[]; return(mfpclose(indx, fp)); } -#if IS_AROS - #define fork() vfork() +#if HAVE_FORK +# define tss_fork() fork() +#elif HAVE_VFORK +# define tss_fork() vfork() #endif + /* * signal values */ @@ -910,9 +923,9 @@ int mask; #endif { int p[3][2]; /* pipes to/from child */ - register int i; /* counter in for loop */ - register int ch_pid; /* child PID */ - register int euid, egid; /* in case reset[gu]id is -1 */ + int i; /* counter in for loop */ + int ch_pid; /* child PID */ + int euid, egid; /* in case reset[gu]id is -1 */ /* * create 1 pipe for each of standard input, output, error */ @@ -932,14 +945,26 @@ int mask; /* * spawn the child and make the pipes the subprocess stdin, stdout */ - if ((ch_pid = fork()) == 0){ + if ((ch_pid = tss_fork()) == 0){ /* now reset the uid and gid if desired */ - if (mresetgid < -1) (void) setgid(getgid()); - else if (mresetgid == -1) (void) setgid(egid); - else if (mresetgid > -1) (void) setgid(mresetgid); - if (mresetuid < -1) (void) setuid(getuid()); - else if (mresetuid == -1) (void) setuid(euid); - else if (mresetuid > -1) (void) setuid(mresetuid); +#if HAVE_SETGID + if (mresetgid < -1) + (void) setgid(getgid()); + else if (mresetgid == -1) + (void) setgid(egid); + else if (mresetgid > -1) + (void) setgid(mresetgid); +#endif + +#if HAVE_SETUID + if (mresetuid < -1) + (void) setuid(getuid()); + else if (mresetuid == -1) + (void) setuid(euid); + else if (mresetuid > -1) + (void) setuid(mresetuid); +#endif + /* reset the umask */ (void) umask(mask); /* close the unused ends of the pipe */ @@ -1028,8 +1053,7 @@ int echild(pid) int pid; #endif { - - register int r; /* PID of process just exited */ + int r; /* PID of process just exited */ int status; /* status of wait call */ /* @@ -1050,3 +1074,5 @@ int pid; */ return(status); } + +#endif // SUPPORTS_POSIX_FORK_EXEC diff --git a/src/core/msystem.h b/src/core/msystem.h index b6caa43..db11b2b 100644 --- a/src/core/msystem.h +++ b/src/core/msystem.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -57,6 +57,8 @@ #include "platform.h" +#if SUPPORTS_POSIX_FORK_EXEC + #ifdef __STDC__ void le_clobber(void); int le_set(const char*); @@ -66,8 +68,15 @@ int le_openfd(int); int le_closefd(int); int le_euid(int); int le_egid(int); + +#if USES_MSYSTEM int msystem(const char*); +#endif + +#if USES_MPOPEN FILE *mpopen(const char*, const char*); +#endif + int mpclose(FILE *); int mfpopen(const char*, FILE *[]); int mfpclose(int, FILE *[]); @@ -136,3 +145,4 @@ int echild(); # define NOSHELL "/bin/sh" /* use this if no shell */ #endif +#endif // SUPPORTS_POSIX_FORK_EXEC diff --git a/src/core/ntdbs.h b/src/core/ntdbs.h index fc219b8..713e92b 100644 --- a/src/core/ntdbs.h +++ b/src/core/ntdbs.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -71,11 +71,19 @@ namespace tss typedef std::wstring dbstring; } +#elif (USE_U16STRING) +namespace tss +{ +typedef std::u16string dbstring; +} + #elif (WCHAR_IS_32_BITS) +#if HAVE_LOCALE namespace std { template<> struct char_traits; } +#endif namespace tss { typedef std::basic_string dbstring; @@ -87,9 +95,10 @@ typedef std::basic_string dbstring; #endif -#if WCHAR_IS_32_BITS // We already have a dbstring implicitly in wstring!!! +#if NEED_DBSTRING_IMPL // We already have a dbstring implicitly in wstring!!! -#include +#if HAVE_LOCALE +# include // specialize *std*::char_traits!!! @@ -192,11 +201,9 @@ template<> struct std::char_traits return lhs == rhs; } -# if IS_STDLIB_MODENA - +#if IS_STDLIB_MODENA // CAUTION:RAD -- Extra members required by Modena!! - -# ifdef MBSTATE_T_DEFINED // This is ANSI-C *not* ANSI-C++!! +#ifdef MBSTATE_T_DEFINED // This is ANSI-C *not* ANSI-C++!! static state_type get_state(pos_type pos) { return pos.state(); @@ -206,7 +213,7 @@ template<> struct std::char_traits { return pos_type(pos.offset(), state); } -# endif //MBSTATE_T_DEFINED +#endif //MBSTATE_T_DEFINED static char_type newline() { @@ -217,14 +224,14 @@ template<> struct std::char_traits { return 0; } - -# endif //IS_STDLIB_MODENA +#endif //IS_STDLIB_MODENA static int_type eof() { return (wint_t)(0xFFFF); } }; +#endif # endif //WCHAR_IS_16_BITS // We already have a dbstring implicitly in wstring!!! diff --git a/src/core/ntmbs.cpp b/src/core/ntmbs.cpp index e7ddd5b..97efa48 100644 --- a/src/core/ntmbs.cpp +++ b/src/core/ntmbs.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/ntmbs.h b/src/core/ntmbs.h index 5d45d82..fc49104 100644 --- a/src/core/ntmbs.h +++ b/src/core/ntmbs.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -86,9 +86,12 @@ typedef const wchar_t* const_ntwcs_t; # define NTDBS_T_DEFINED # if WCHAR_IS_16_BITS typedef wchar_t dbchar_t; // Same size but use NT's type +# elif USE_CHAR16_T +typedef char16_t dbchar_t; # else -typedef uint16 dbchar_t; +typedef uint16_t dbchar_t; # endif + typedef dbchar_t* ntdbs_t; typedef const dbchar_t* const_ntdbs_t; #endif //NTDBS_T_DEFINED @@ -101,7 +104,7 @@ typedef const dbchar_t* const_ntdbs_t; # if WCHAR_IS_32_BITS typedef wchar_t qbchar_t; // Same size but use NT's type # else -typedef uint32 qbchar_t; +typedef uint32_t qbchar_t; # endif typedef qbchar_t* ntqbs_t; typedef const qbchar_t* const_ntqbs_t; diff --git a/src/core/package.h b/src/core/package.h index 0639f82..30d7679 100644 --- a/src/core/package.h +++ b/src/core/package.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/platform.h b/src/core/platform.h index 78f7765..d049267 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -33,73 +33,48 @@ // platform.h // +#ifndef __PLATFORM_H +#define __PLATFORM_H + #ifdef HAVE_CONFIG_H #include #endif -#ifndef __PLATFORM_H -# define __PLATFORM_H +#if HAVE_STDINT_H +#include +#endif + +#if HAVE_FEATURES_H +#include +#endif //NOTE: Autoconf is strongly preferred as the Right Way to detect platform-specific features/behaviors. // These macros should really only be used when autoconf can't get the job done. -//============================================================================= -// Enumerations -// -// For each of these "enumerations" we create unique integers identifying each -// variation. We group similar items together, such as OS_REDHAT and OS_SLACKWARE +/////////////////////////////// -# define OS_UNKNOWN 0 +#define COMP_UNKNOWN 0 +#define COMP_GCC 0x0001 +#define COMP_CLANG 0x0002 -# define OS_WIN32 0x0101 -# define OS_CYGWIN 0x0102 -# define OS_DOS_DJGPP 0x0103 +#define COMP_MSVC 0x0101 -# define OS_LINUX 0x0201 -# define OS_ANDROID 0x0202 +// Definitions for the old KAI C++ compiler. +// KCC was EOL'd ages ago, but I'm leaving these definitions here for now +// on the off chance someone's still using it. +#define COMP_KAI 0x0200 +#define COMP_KAI_GCC 0x0201 +#define COMP_KAI_SUNPRO 0x0202 +#define COMP_KAI_GLIBC 0x0203 +#define COMP_KAI_VISUALAGE 0x0204 +#define COMP_KAI_HPANSIC 0x0205 +#define COMP_KAI_IRIX 0x0206 +#define COMP_KAI_OSF1ALPHA 0x0207 -# define OS_FREEBSD 0x0301 -# define OS_NETBSD 0x0302 -# define OS_OPENBSD 0x0303 -# define OS_DARWIN 0x0304 -# define OS_DRAGONFLYBSD 0x0305 -# define OS_MIDNIGHTBSD 0x0306 -# define OS_MIRBSD 0x0307 -# define OS_BITRIG 0x0308 -# define OS_LIBERTYBSD 0x0309 +#define COMP_SUNPRO 0x0301 +#define COMP_XL_C 0x0302 +#define COMP_ACC 0x0303 -# define OS_SOLARIS 0x0400 -# define OS_AIX 0x0401 -# define OS_HPUX 0x0402 -# define OS_IRIX 0x0403 -# define OS_OSF1 0x0404 - -# define OS_MINIX 0x0501 -# define OS_HURD 0x0502 -# define OS_HAIKU 0x0503 -# define OS_SYLLABLE 0x0504 -# define OS_SKYOS 0x0505 -# define OS_SORTIX 0x0506 -# define OS_MINT 0x0507 -# define OS_AROS 0x0508 -# define OS_RTEMS 0x0509 -# define OS_RISCOS 0x050A -# define OS_REDOX 0x050B -# define OS_QNX 0x050C - -# define COMP_UNKNOWN 0 -# define COMP_GCC 0x0001 -# define COMP_CLANG 0x0002 - -# define COMP_MSVC 0x0101 -# define COMP_KAI_GCC 0x0201 -# define COMP_KAI_SUNPRO 0x0202 -# define COMP_KAI_GLIBC 0x0203 -# define COMP_KAI_VISUALAGE 0x0204 -# define COMP_KAI_HPANSIC 0x0205 -# define COMP_KAI_IRIX 0x0206 -# define COMP_KAI_OSF1ALPHA 0x0207 -# define COMP_SUNPRO 0x0301 //============================================================================= // Platform detection @@ -111,159 +86,67 @@ // // OS The OS // COMP The compiler -// -// PLEASE NOTE: Do not set any preprocessor variable other than the above three in this -// section. Use the following sections for anything that does not fall into -// the above catagories. - -# if defined(_WIN32) -# define OS OS_WIN32 -# define IS_WIN32 1 - -# elif defined(__CYGWIN__) -# define OS OS_CYGWIN -# define IS_CYGWIN 1 - -# elif defined(__DJGPP__) -# define OS OS_DOS_DJGPP -# define IS_DOS_DJGPP 1 +// plus IS_xxx macros for the OS & compiler -# elif defined(__ANDROID__) -# define OS OS_ANDROID -# define IS_ANDROID 1 +////////////////////////////// +// Compiler detection -# elif defined(__linux__) -# define OS OS_LINUX -# define IS_LINUX 1 +#if defined(HAVE_GCC) +# define IS_GCC 1 +#elif defined(HAVE_CLANG) +# define IS_CLANG 1 -// A herd of BSDs. Have to detect MidnightBSD before FreeBSD, and MirOS & Bitrig before OpenBSD -// because they also define symbols for their ancestor BSDs. -# elif defined(__DragonFly__) -# define OS OS_DRAGONFLYBSD -# define IS_DRAGONFLYBSD 1 - -# elif defined(__MidnightBSD__) -# define OS OS_MIDNIGHTBSD -# define IS_MIDNIGHTBSD 1 - -# elif defined(__FreeBSD__) -# define OS OS_FREEBSD -# define IS_FREEBSD 1 - -# elif defined(__NetBSD__) -# define OS OS_NETBSD -# define IS_NETBSD 1 - -# elif defined(__MirBSD__) -# define OS OS_MIRBSD -# define IS_MIRBSD 1 - -# elif defined(__Bitrig__) -# define OS OS_BITRIG -# define IS_BITRIG 1 - -# elif defined(TW_LibertyBSD) -# define OS OS_LIBERTYBSD -# define IS_LIBERTYBSD 1 - -# elif defined(__OpenBSD__) -# define OS OS_OPENBSD -# define IS_OPENBSD 1 - -# elif defined(__APPLE__) -# define OS OS_DARWIN -# define IS_DARWIN 1 - - -# elif defined(__sun) -# define OS OS_SOLARIS -# define IS_SOLARIS 1 - -# elif defined(_AIX) -# define OS OS_AIX -# define IS_AIX 1 - -# elif defined(__hpux) -# define OS OS_HPUX -# define IS_HPUX 1 - -# elif defined(__sgi) -# define OS OS_IRIX -# define IS_IRIX 1 - -# elif defined(TRU64) || defined(__OSF1__) -# define OS OS_OSF1 -# define IS_OSF1 1 - - -# elif defined(__minix__) -# define OS OS_MINIX -# define IS_MINIX 1 - -# elif defined(__gnu_hurd__) -# define OS OS_HURD -# define IS_HURD 1 - -# elif defined(__HAIKU__) -# define OS OS_HAIKU -# define IS_HAIKU 1 - -# elif defined(__SYLLABLE__) -# define OS OS_SYLLABLE -# define IS_SYLLABLE 1 - -# elif defined(SKYOS) -# define OS OS_SKYOS -# define IS_SKYOS 1 - -# elif defined(_SORTIX_SOURCE) -# define OS OS_SORTIX -# define IS_SORTIX 1 - -# elif defined(__MINT__) -# define OS OS_MINT -# define IS_MINT 1 - -# elif defined(__AROS__) -# define OS OS_AROS -# define IS_AROS 1 - -# elif defined(__rtems__) -# define OS OS_RTEMS -# define IS_RTEMS 1 - -# elif defined(__riscos__) -# define OS OS_RISCOS -# define IS_RISCOS 1 - -# elif defined(__redox__) -# define OS OS_REDOX -# define IS_REDOX 1 - -# elif defined(__QNX__) -# define OS OS_QNX -# define IS_QNX 1 +#elif defined(HAVE_MSVC) +# define IS_MSVC 1 +#elif defined(HAVE_KAI_KCC) +# if !defined(COMP) +# define COMP COMP_KAI # endif +# define IS_KAI 1 + +#elif defined(HAVE_ORACLE_SUNCC) +# define IS_SUNPRO 1 + +#elif defined(HAVE_IBM_XL_C) || defined(HAVE_IBM_GXLC) +# define IS_XL_C 1 + +#elif defined(HAVE_HP_ACC) +# define IS_HP_ACC 1 +#endif - /* XXX: COMP may now not resolve, because autoconf may - * detect GCC. This is done in the hopes that all - * COMP detections, and indeed both OS & COMP detechtions - * will eventualy be done automatically. - * - * This means, the former "#if !defined(COMP)" will - * temporarily have to also check the HAVE_[compiler] - * #defines until all compilers are checked by autoconf, - * at which point this can be removed completely. - * - * PH - 20010311 - */ -# if !defined(COMP) && !defined(HAVE_GCC) -# error COMP definition did not resolve. Check "platform.h". -# endif +////////////////////////// +// OS detection + +#if defined(_WIN32) +# define IS_WIN32 1 + +#elif defined(__DJGPP__) +# define IS_DOS_DJGPP 1 + +#elif defined(__FreeBSD__) +# define IS_FREEBSD 1 + +#elif defined(SKYOS) +# define IS_SKYOS 1 + +#elif defined(_SORTIX_SOURCE) +# define IS_SORTIX 1 + +#elif defined(__AROS__) || defined(AMIGA) +# define IS_AROS 1 + +#elif defined(__riscos__) +# define IS_RISCOS 1 + +#elif defined(__redox__) +# define IS_REDOX 1 + +#endif + //============================================================================= // Platform Macros (a.k.a. "IS_" macros) @@ -271,6 +154,10 @@ // These macros are the "worker bees" of platform.h. Programmers should use // these macros rather than comparing PLATFORM to the unique IDs by hand. // +// NOTE: Wherever possible, let autotools figure this out & define it in config.h +// rather than hardcoding it here. If autotools misdefines something, use +// core/fixups.h, which is guaranteed to be (re)included right after config.h +// // NB: Programmers are STRONGLY ENCOURAGED not to use the OS detection macros // or compiler detection marcros directly. Instead they should create // macros specific to the task at hand. For example Win32 and Solaris support @@ -288,95 +175,212 @@ // int network_order = swap(machine_order); // #endif -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// complier detection -# define IS_KAI \ - (COMP == COMP_KAI_GCC || COMP == COMP_KAI_SUNPRO || COMP == COMP_KAI_GLIBC || COMP == COMP_KAI_VISUALAGE || \ - COMP == COMP_KAI_HPANSIC || COMP == COMP_KAI_IRIX || COMP == COMP_KAI_OSF1ALPHA) -# define IS_MSVC (COMP == COMP_MSVC) -# define IS_SUNPRO (COMP == COMP_SUNPRO) - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Unicode -# define SUPPORTS_UNICODE IS_WIN32 // The OS supports Unicode +#define CPLUSPLUS_1998_OR_GREATER (__cplusplus >= 199711L) +#define CPLUSPLUS_PRE_1998 !CPLUSPLUS_1998_OR_GREATER +#define CPLUSPLUS_2011_OR_GREATER (__cplusplus >= 201103L) +#define CPLUSPLUS_PRE_2011 !CPLUSPLUS_2011_OR_GREATER + +#define CPLUSPLUS_2017_OR_GREATER (__cplusplus >= 201703L) +#define CPLUSPLUS_PRE_2017 !CPLUSPLUS_2017_OR_GREATER + +#define CPLUSPLUS_2020_OR_GREATER (__cplusplus >= 202002L) +#define CPLUSPLUS_PRE_2020 !CPLUSPLUS_2020_OR_GREATER + // KAI 3.4 uses a much improved stl -# define IS_KAI_3_4 (IS_KAI && (COMP == COMP_KAI_IRIX || COMP == COMP_KAI_OSF1ALPHA || COMP == COMP_KAI_GLIBC)) +#define IS_KAI_3_4 (IS_KAI && (COMP == COMP_KAI_IRIX || COMP == COMP_KAI_OSF1ALPHA || COMP == COMP_KAI_GLIBC)) // Used in twlocale -# define USE_STD_CPP_LOCALE_WORKAROUND \ +#define USE_STD_CPP_LOCALE_WORKAROUND \ (IS_SUNPRO || (IS_KAI && !IS_KAI_3_4)) // TODO:BAM -- name this something more general. -# define USE_CLIB_LOCALE IS_KAI || HAVE_GCC -# define USES_CLIB_DATE_FUNCTION \ + +#define USE_CLIB_LOCALE (!HAVE_LOCALE || HAVE_GCC || IS_KAI) + +#define USES_CLIB_DATE_FUNCTION \ (USE_CLIB_LOCALE || IS_SUNPRO || \ IS_MSVC) // if we use clib, can't use C++ time_put, and SUNPRO and MSVC add characters -//#define USE_CLIB_LOCALE (IS_ALPHA || IS_IRIX || (IS_KAI && !IS_KAI_3_4)) + +#if defined(__GLIBC__) + #define USES_GLIBC 1 +#endif + +#define SUPPORTS_MEMBER_TEMPLATES (!IS_SUNPRO) +#define SUPPORTS_EXPLICIT_TEMPLATE_FUNC_INST (!IS_SUNPRO) // Threading API -// TODO:mdb -- this is not complete or rigorous on the unix side!!! -# define SUPPORTS_WIN32_THREADS IS_WIN32 -# define SUPPORTS_POSIX_THREADS (!SUPPORTS_WIN32_THREADS) +#define SUPPORTS_WIN32_THREADS IS_WIN32 +#define SUPPORTS_POSIX_THREADS (HAVE_PTHREAD_H) // Miscellaneous -# define WCHAR_IS_16_BITS IS_WIN32 -# define WCHAR_IS_32_BITS IS_UNIX -# define WCHAR_REP_IS_UCS2 IS_WIN32 +#define SUPPORTS_C_FILE_IO (HAVE_FOPEN && HAVE_FREAD && HAVE_FCLOSE) +#define SUPPORTS_POSIX_FILE_IO (HAVE_OPEN && HAVE_READ && HAVE_CLOSE) +#define SUPPORTS_SYMLINKS (HAVE_READLINK || HAVE_READLINKAT) + +#define ARCHAIC_STL (!HAVE_LOCALE && !HAVE_SSTREAM) + +#if (SIZEOF_WCHAR_T == 2) +# define WCHAR_IS_16_BITS 1 +# define WCHAR_REP_IS_UCS2 1 +#elif (SIZEOF_WCHAR_T == 4) +# define WCHAR_IS_32_BITS 1 +#endif + +#define USE_U16STRING ((!WCHAR_IS_16_BITS) && CPLUSPLUS_2011_OR_GREATER) +#define USE_CHAR16_T USE_U16STRING +#define NEED_DBSTRING_IMPL (!WCHAR_IS_16_BITS && !USE_U16STRING) + +#define USE_UNIQUE_PTR CPLUSPLUS_2011_OR_GREATER +#define USE_LAMBDAS CPLUSPLUS_2011_OR_GREATER +#define USE_UNICODE_ESCAPES CPLUSPLUS_2011_OR_GREATER +#define USE_UNEXPECTED CPLUSPLUS_PRE_2017 + +#define SUPPORTS_POSIX_FORK_EXEC ((HAVE_FORK || HAVE_VFORK) && HAVE_EXECVE) + +#define USE_DEV_URANDOM (HAVE_DEV_URANDOM && ENABLE_DEV_URANDOM) + + +// Per-platform special cases. At least some of these could be replaced +// with better autotools detection + // msystem+mpopen fail on Syllable, so use the libc equivalents until we figure out why. // TODO: Figure out why. -# define USES_MPOPEN (IS_UNIX && !IS_SYLLABLE) -# define USES_MSYSTEM (IS_UNIX && !IS_SYLLABLE) -# define SUPPORTS_WCHART IS_WIN32 // TODO: Remove after getting new ver of KAI -# define USES_GLIBC ((COMP == COMP_KAI_GLIBC) || HAVE_GCC) -# define SUPPORTS_MEMBER_TEMPLATES (!IS_SUNPRO) -# define SUPPORTS_EXPLICIT_TEMPLATE_FUNC_INST (!IS_SUNPRO) +#if !defined(__SYLLABLE__) +# define USES_MPOPEN (SUPPORTS_POSIX_FORK_EXEC) +# define USES_MSYSTEM (SUPPORTS_POSIX_FORK_EXEC) +#endif -# define SUPPORTS_POSIX_SIGNALS (!IS_DOS_DJGPP) -# define SUPPORTS_NETWORKING (!IS_SORTIX && !IS_DOS_DJGPP && !IS_REDOX) -# define SUPPORTS_SYSLOG (HAVE_SYSLOG_H && !IS_SKYOS && !IS_RISCOS) -# define NEEDS_SWAB_IMPL (IS_CYGWIN || IS_SYLLABLE || IS_ANDROID || IS_SORTIX) -# define USES_MBLEN (!IS_ANDROID && !IS_AROS) -# define USES_DEVICE_PATH (IS_AROS || IS_DOS_DJGPP || IS_RISCOS || IS_REDOX) -# define ICONV_CONST_SOURCE (IS_MINIX) -# define SUPPORTS_DIRECT_IO (IS_LINUX) -// Linux is the only platform where direct i/o hashing has been tested & works properly so far. +#if (!defined(__DJGPP__) && !defined(__MINGW32__)) +# define SUPPORTS_POSIX_SIGNALS 1 +#endif -# define SUPPORTS_TERMIOS (!IS_RTEMS && !IS_REDOX) -// RTEMS errors are probably just a buildsys issue & this will change or go away. -// Redox will probably implement this in the future. +#if (!defined(__DJGPP__) && !defined(SORTIX_SOURCE) && !defined(__redox__)) +# define SUPPORTS_NETWORKING (HAVE_SOCKET) +#endif -# define CAN_UNLINK_WHILE_OPEN (!IS_AROS && !IS_RISCOS && !IS_REDOX && !IS_DOS_DJGPP) +#if (!defined(SKYOS) && !defined(__riscos__)) +# define SUPPORTS_SYSLOG (HAVE_SYSLOG) +#endif + +#if (defined(__CYGWIN__) || defined(__SYLLABLE__) || defined(__ANDROID__) || defined(SORTIX_SOURCE)) +# define NEEDS_SWAB_IMPL 1 +#else +# define NEEDS_SWAB_IMPL (!HAVE_SWAB) +#endif + +#if defined(__MINGW32__) +# define SWAB_TAKES_CHAR_PTRS 1 +# define MKDIR_TAKES_SINGLE_ARG 1 +#endif + +#if (defined(__QNX__) || defined(__QNXNTO__)) && !defined(BBNDK_VERSION_CURRENT) +# define SWAB_TAKES_CHAR_PTRS 1 +#endif + +#if (!defined(__ANROID__) && !defined(__AROS__)) +# define USES_MBLEN (HAVE_MBLEN) +#endif + +#if (defined(__DJGPP__) || (defined(_WIN32) && !defined(__CYGWIN__)) || (defined(__OS2__) && !defined(__EMX__))) +# define USES_DOS_DEVICE_PATH 1 +#endif + +#if defined(__redox__) +# define USES_URI_PATH 1 +#endif + +#if (USES_DOS_DEVICE_PATH || USES_URI_PATH || defined(__riscos__) || defined(__AROS__)) +# define USES_DEVICE_PATH 1 +#endif + +#if defined(__minix__) +# define ICONV_CONST_SOURCE 1 +#endif + +#if defined(SKYOS) +# define READLINK_NULL_TERMINATES 1 +#endif + +// HP-UX does have posix_fadvise(), but sys/fcntl.h neglects to wrap it in extern "C" on +// at least some flavors of the OS. (see https://community.hpe.com/t5/Languages-and-Scripting/Bacula-try-to-compile-on-hpux11-31/m-p/6843389 ) +// The thread indicates this problem can be fixed by editing sys/fcntl.h, and then the special case below +// can be removed. This is left as an exercise for the reader. +#if !defined(__hpux) +# define SUPPORTS_POSIX_FADVISE (HAVE_POSIX_FADVISE) +#endif + +#if defined(__VXWORKS__) +# define READ_TAKES_CHAR_PTR 1 +#endif + +#if (!defined(__RTEMS__) && !defined(__redox__)) +# define SUPPORTS_TERMIOS (HAVE_TERMIOS_H) +#endif + +// Unlinking an open file (to make a temporary file nobody else can see) is a Posix-ism +// that other platforms generally don't support. +#if (!defined(__CYGWIN__) && !defined(__DJGPP__) && !defined(__riscos__) && !defined(__redox__) && !defined(_WIN32) && !defined(__OS2__) && !IS_AROS) +# define CAN_UNLINK_WHILE_OPEN 1 +#endif -# define SUPPORTS_DOUBLE_SLASH_PATH (IS_CYGWIN) // POSIX standard says paths beginning with 2 slashes are "implementation defined" // (see http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_11 ) -// The only platform OST works on (afaik) that actually defines a double-slash behavior is Cygwin -// which uses this syntax for UNC paths. So we'll allow leading double slashes there, but -// continue removing them on all other platforms +// The only platform OST is known to work on (afaik) that actually defines a double-slash behavior is Cygwin +// which uses this syntax for UNC paths. OST also might Just Work under Unix System Services on +// z/OS / MVS / OS/390, which uses a leading double slash for dataset paths, so I'll add that +// to the macro even though I don't have the hardware to actually test this. +// +// Other platform known to use this include IBM z/OS and the ancient Apollo Domain/OS. +#if (defined(__CYGWIN__) || defined(__MVS__)) +# define SUPPORTS_DOUBLE_SLASH_PATH 1 +#endif -# define USE_DEV_URANDOM (HAVE_DEV_URANDOM && ENABLE_DEV_URANDOM) +// Platforms where we might encounter AS/400 native objects, +// which are only sometimes readable via ordinary file API +#if defined(__OS400__) || defined(_AIX) +# define SUPPORTS_NATIVE_OBJECTS 1 +#endif + +// On most platforms, uname() returns 0 on success, like every other syscall out there. +// However the POSIX standard merely says uname() returns some nonnegative value on success, probably +// so certain vendors could be POSIX-compliant without changing anything. Solaris seems to return 1 +// on success, for example. If any other examples crop up, add them here, or figure out how to +// do this with autoconf instead. +// +#if defined(__sun) +# define UNAME_SUCCESS_POSIX 1 +#else +# define UNAME_SUCCESS_ZERO 1 +#endif + +// Whether to try unaligned access checks in one unit test of dubious value +#if !defined(__sun) && !defined(__hpux) +# define ENABLE_ALIGNMENT_TEST 1 +#endif //============================================================================= // Miscellaneous // // Put all items that are not an "IS_" macro here. -# if IS_BYTE_ALIGNED -# define BYTE_ALIGN 8 -# else -# error Unknown Byte alignment -# endif +// This should ordinarily always be 8, but we'll do it the autoconf way just in case. +#define BYTE_ALIGN ALIGNOF_LONG_LONG // A scalar that matches the sizeof a pointer -typedef unsigned long ptr_size_type; // true for all of our current platforms - // TODO: I would like to use a XXXX_t like name +typedef uintptr_t ptr_size_type; -// Check integer representation -# if !(USES_2S_COMPLEMENT) -# error "Tripwire will only work on a 2's complement CPU. Check \"platform.h\"." -# endif +// Check signed integer representation +// This check has been around for ages, and I'm not sure it's still accurate. +// It's not like there's a lot of contemporary non-2s-complement hardware out there +// to try this on. Anyway, the configure script always defines USES_2S_COMPLEMENT to 1 +// without actually checking anything, so this check wasn't performing a valuable service here. +// +//#if !(USES_2S_COMPLEMENT) +//# error "Tripwire will only work on a 2's complement CPU. Check \"platform.h\"." +//#endif #endif // __PLATFORM_H diff --git a/src/core/refcountobj.cpp b/src/core/refcountobj.cpp index cadd5ac..6c39b0c 100644 --- a/src/core/refcountobj.cpp +++ b/src/core/refcountobj.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/refcountobj.h b/src/core/refcountobj.h index a484747..79db58b 100644 --- a/src/core/refcountobj.h +++ b/src/core/refcountobj.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/resources.h b/src/core/resources.h index 2f3bf9f..b1862d7 100644 --- a/src/core/resources.h +++ b/src/core/resources.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/serializable.cpp b/src/core/serializable.cpp index 16e896b..7a8b400 100644 --- a/src/core/serializable.cpp +++ b/src/core/serializable.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/serializable.h b/src/core/serializable.h index 5e2defe..23e2f19 100644 --- a/src/core/serializable.h +++ b/src/core/serializable.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -78,7 +78,7 @@ class iSerializer; class iSerializable { public: - virtual void Read(iSerializer* pSerializer, int32 version = 0) = 0; // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0) = 0; // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const = 0; // throw (eSerializer, eArchive) // objects implement these methods to read and write themselves to a serializer. @@ -93,21 +93,21 @@ public: typedef iTypedSerializable* (*CreateFunc)(); // Pointer to a function that creates an empty version of each typed serializable object - virtual int32 Version() const = 0; + virtual int32_t Version() const = 0; // Return the current version of that this serializable object writes. // As a convention version number should be (major_version << 16) | minor_version. - static int32 MkVersion(int16 major, int16 minor) + static int32_t MkVersion(int16_t major, int16_t minor) { - return (int32)(((uint32)major << 16) | (uint32)minor); + return (int32_t)(((uint32_t)major << 16) | (uint32_t)minor); } - static int16 MajorVersion(int32 version) + static int16_t MajorVersion(int32_t version) { - return (int16)((uint32)version >> 16); + return (int16_t)((uint32_t)version >> 16); } - static int16 MinorVersion(int32 version) + static int16_t MinorVersion(int32_t version) { - return (int16)version; + return (int16_t)version; } virtual ~iTypedSerializable() @@ -121,7 +121,7 @@ public: DECLARE_TYPED() \ public: \ static iTypedSerializable* Create(); \ - virtual int32 Version() const; + virtual int32_t Version() const; # define IMPLEMENT_TYPEDSERIALIZABLE(CLASS, TYPEDSTRING, VERSION_MAJOR, VERSION_MINOR) \ IMPLEMENT_TYPED(CLASS, TYPEDSTRING) \ @@ -129,7 +129,7 @@ public: { \ return new CLASS; \ } \ - int32 CLASS::Version() const \ + int32_t CLASS::Version() const \ { \ return iTypedSerializable::MkVersion(VERSION_MAJOR, VERSION_MINOR); \ } diff --git a/src/core/serializer.cpp b/src/core/serializer.cpp index f32af5e..97b832a 100644 --- a/src/core/serializer.cpp +++ b/src/core/serializer.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/serializer.h b/src/core/serializer.h index 3e45ef2..8718129 100644 --- a/src/core/serializer.h +++ b/src/core/serializer.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -127,14 +127,14 @@ public: // writing interface // all of these can throw eArchive - virtual void ReadInt16(int16& ret) = 0; - virtual void ReadInt32(int32& ret) = 0; - virtual void ReadInt64(int64& ret) = 0; + virtual void ReadInt16(int16_t& ret) = 0; + virtual void ReadInt32(int32_t& ret) = 0; + virtual void ReadInt64(int64_t& ret) = 0; virtual void ReadString(TSTRING& ret) = 0; virtual int ReadBlob(void* pBlob, int count) = 0; - virtual void WriteInt16(int16 i) = 0; - virtual void WriteInt32(int32 i) = 0; - virtual void WriteInt64(int64 i) = 0; + virtual void WriteInt16(int16_t i) = 0; + virtual void WriteInt32(int32_t i) = 0; + virtual void WriteInt64(int64_t i) = 0; virtual void WriteString(const TSTRING& s) = 0; virtual void WriteBlob(const void* pBlob, int count) = 0; diff --git a/src/core/serializerimpl.cpp b/src/core/serializerimpl.cpp index 3fe8fe4..a97a8c3 100644 --- a/src/core/serializerimpl.cpp +++ b/src/core/serializerimpl.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -44,7 +44,7 @@ cSerializerImpl::SerRefCountMap cSerializerImpl::mSerRefCountCreateMap; /////////////////////////////////////////////////////////////////////////////// // util_GetCrc -- calculates the crc for the narrow version of the type's AsString() /////////////////////////////////////////////////////////////////////////////// -static uint32 util_GetCRC(const cType& type) +static uint32_t util_GetCRC(const cType& type) { // // convert this to narrow... @@ -59,10 +59,10 @@ static uint32 util_GetCRC(const cType& type) // We only need to count the characters // RAD: Yeesh! This is already done for us in cType::mString!!! - const uint8* pszType = (const uint8*)(type.AsString()); - int nBytes = ::strlen((const char*)pszType); + const uint8_t* pszType = (const uint8_t*)(type.AsString()); + int nBytes = ::strlen((const char*)pszType); - ASSERT(sizeof(uint8) == sizeof(byte)); + //ASSERT(sizeof(uint8_t) == sizeof(byte)); ASSERT(pszType && *pszType); // @@ -104,7 +104,7 @@ bool cSerializerImpl::IsWriting() const void cSerializerImpl::RegisterSerializable(const cType& type, iTypedSerializable::CreateFunc pFunc) { - uint32 crc = util_GetCRC(type); + uint32_t crc = util_GetCRC(type); if (cSerializerImpl::mSerCreateMap.find(crc) != cSerializerImpl::mSerCreateMap.end()) { @@ -113,14 +113,15 @@ void cSerializerImpl::RegisterSerializable(const cType& type, iTypedSerializable ASSERT(false); TOSTRINGSTREAM str; str << _T("Duplicate entry in type table: ") << type.AsString() << std::endl; - throw eInternal(str.str()); + tss_mkstr(errStr, str); + throw eInternal(errStr); } cSerializerImpl::mSerCreateMap[crc] = pFunc; } void cSerializerImpl::RegisterSerializableRefCt(const cType& type, iSerRefCountObj::CreateFunc pFunc) { - uint32 crc = util_GetCRC(type); + uint32_t crc = util_GetCRC(type); if (cSerializerImpl::mSerRefCountCreateMap.find(crc) != cSerializerImpl::mSerRefCountCreateMap.end()) { @@ -129,7 +130,8 @@ void cSerializerImpl::RegisterSerializableRefCt(const cType& type, iSerRefCountO ASSERT(false); TOSTRINGSTREAM str; str << _T("Duplicate entry in type table: ") << type.AsString() << std::ends; - throw eInternal(str.str()); + tss_mkstr(errStr, str); + throw eInternal(errStr); } cSerializerImpl::mSerRefCountCreateMap[crc] = pFunc; } @@ -171,17 +173,17 @@ void cSerializerImpl::WriteObjectDynCreate(const iTypedSerializable* pObj) //d.TraceDetail("Entering... Archive Offset = %d\n", mpArchive->CurrentPos()); d.TraceDetail(_T(" Object Type = %s\n"), pObj->GetType().AsString()); // first, we write out the header, which consists of the following: - // uint32 crc of the object's type - // int32 version of stored data - // int32 size of the chunk (counting from this point; not including the previous int32 - // int32 index into mRefCountObjTbl, or 0 if it isn't refrence counted. + // uint32_t crc of the object's type + // int32_t version of stored data + // int32_t size of the chunk (counting from this point; not including the previous int32 + // int32_t index into mRefCountObjTbl, or 0 if it isn't refrence counted. // if the index already exists, then no data follows; a refrence // should just be added to the existing object. ASSERT(mpArchive != 0); // get the ident for this class type // - uint32 crc = util_GetCRC(pObj->GetType()); + uint32_t crc = util_GetCRC(pObj->GetType()); // // make sure this type is registered, and figure out if it is refrence counted @@ -243,20 +245,20 @@ iTypedSerializable* cSerializerImpl::ReadObjectDynCreate() cDebug d("cSerializerImpl::ReadObjectDynCreate"); //d.TraceDetail("Entering... archive offset = %d\n", mpArchive->CurrentPos()); - int32 size, objIdx; - uint32 crc; + int32_t size, objIdx; + uint32_t crc; // first, get the type... - mpArchive->ReadInt32(reinterpret_cast(crc)); + mpArchive->ReadInt32(reinterpret_cast(crc)); // read in the version - int32 version; + int32_t version; mpArchive->ReadInt32(version); // read in the size and the index... mpArchive->ReadInt32(size); // Save the position so we can seek correctly later on - //int64 sizePos = mpArchive->CurrentPos(); + //int64_t sizePos = mpArchive->CurrentPos(); mpArchive->ReadInt32(objIdx); if (objIdx == 0) @@ -269,12 +271,15 @@ iTypedSerializable* cSerializerImpl::ReadObjectDynCreate() { // unable to find the creation function... d.TraceError("Unable to find creation function for non-ref counted object %d\n", crc); - TOSTRINGSTREAM str; + TSTRING errStr; + #ifdef DEBUG + TOSTRINGSTREAM str; // Let's only report the actual crc in debug mode - str << (int32)crc << std::ends; + str << (int32_t)crc << std::ends; + tss_mkstr(errStr, str); #endif - ThrowAndAssert(eSerializerUnknownType(str.str(), mFileName, eSerializer::TY_FILE)); + ThrowAndAssert(eSerializerUnknownType(errStr, mFileName, eSerializer::TY_FILE)); } iTypedSerializable* pObj = ((*si).second)(); d.TraceDetail("Created non-ref counted object %s(%p)\n", pObj->GetType().AsString(), pObj); @@ -287,7 +292,7 @@ iTypedSerializable* cSerializerImpl::ReadObjectDynCreate() } else { - // refrence counted... + // reference counted... iSerRefCountObj* pObj; pObj = mRefCtObjTbl.Lookup(objIdx); if (pObj == NULL) @@ -300,11 +305,12 @@ iTypedSerializable* cSerializerImpl::ReadObjectDynCreate() // unable to find the creation function... d.TraceError("Unable to find creation function for ref counted object %d\n", crc); TOSTRINGSTREAM str; - str << (int32)crc << std::ends; - ThrowAndAssert(eSerializerUnknownType(str.str(), mFileName, eSerializer::TY_FILE)); + str << (int32_t)crc;; + tss_mkstr(errStr, str); + ThrowAndAssert(eSerializerUnknownType(errStr, mFileName, eSerializer::TY_FILE)); } pObj = ((*rci).second)(); - d.TraceDetail("Creating Ref-Coutnted object [%d] %s(%p)\n", objIdx, pObj->GetType().AsString(), pObj); + d.TraceDetail("Creating Ref-Counted object [%d] %s(%p)\n", objIdx, pObj->GetType().AsString(), pObj); pObj->Read(this); mRefCtObjTbl.Add(pObj, objIdx); @@ -316,7 +322,7 @@ iTypedSerializable* cSerializerImpl::ReadObjectDynCreate() else { // already serialized; just return this object. - d.TraceDetail("Adding refrence to previously serialized object [%d] %s(%p)\n", + d.TraceDetail("Adding reference to previously serialized object [%d] %s(%p)\n", objIdx, pObj->GetType().AsString(), pObj); @@ -342,9 +348,9 @@ void cSerializerImpl::WriteObject(const iTypedSerializable* pObj) //d.TraceDetail("Entering... Archive Offset = %d\n", mpArchive->CurrentPos()); d.TraceDetail(" Object Type = %s\n", pObj->GetType().AsString()); // first, we write out the header, which consists of the following: - // int32 refrence into mTypeArray, indicating the object's type - // int32 version of stored data - // int32 size of the chunk (counting from this point; not including the previous int32 + // int32_t refrence into mTypeArray, indicating the object's type + // int32_t version of stored data + // int32_t size of the chunk (counting from this point; not including the previous int32 // data the object data ASSERT(mpArchive != 0); @@ -375,16 +381,16 @@ void cSerializerImpl::WriteObject(const iTypedSerializable* pObj) mpArchive->WriteInt32(0); // place holder for type array index mpArchive->WriteInt32(pObj->Version()); // write a placeholder for the size; we will come back and fill in the right value later... - //int64 sizePos = mpArchive->CurrentPos(); + //int64_t sizePos = mpArchive->CurrentPos(); mpArchive->WriteInt32(0xffffffff); // write out the object! pObj->Write(this); // finally, we need to go back and patch up the size... - //int64 returnPos = mpArchive->CurrentPos(); + //int64_t returnPos = mpArchive->CurrentPos(); //mpArchive->Seek(sizePos, cBidirArchive::BEGINNING); - //mpArchive->WriteInt32((int32)(returnPos - sizePos - sizeof(int32))); + //mpArchive->WriteInt32((int32_t)(returnPos - sizePos - sizeof(int32_t))); //mpArchive->Seek(returnPos, cBidirArchive::BEGINNING); } @@ -394,7 +400,7 @@ void cSerializerImpl::ReadObject(iTypedSerializable* pObj) //d.TraceDetail("Entering... archive offset = %d\n", mpArchive->CurrentPos()); // NOTE -- type index stuff is gone; see the comment in WriteObject() - int32 /*typeIdx,*/ size; + int32_t /*typeIdx,*/ size; // first, get the type... /* mpArchive->ReadInt32(typeIdx); @@ -408,7 +414,7 @@ void cSerializerImpl::ReadObject(iTypedSerializable* pObj) */ // read in the version - int32 dummy, version; + int32_t dummy, version; mpArchive->ReadInt32(dummy); // old type array index mpArchive->ReadInt32(version); @@ -424,7 +430,7 @@ void cSerializerImpl::ReadObject(iTypedSerializable* pObj) } // remember current position - //int64 sizePos = mpArchive->CurrentPos(); + //int64_t sizePos = mpArchive->CurrentPos(); // read in the object! pObj->Read(this, version); @@ -437,17 +443,17 @@ void cSerializerImpl::ReadObject(iTypedSerializable* pObj) /////////////////////////////////////////////////////////////////////////////// // archive wrapper /////////////////////////////////////////////////////////////////////////////// -void cSerializerImpl::ReadInt16(int16& ret) +void cSerializerImpl::ReadInt16(int16_t& ret) { mpArchive->ReadInt16(ret); } -void cSerializerImpl::ReadInt32(int32& ret) +void cSerializerImpl::ReadInt32(int32_t& ret) { mpArchive->ReadInt32(ret); } -void cSerializerImpl::ReadInt64(int64& ret) +void cSerializerImpl::ReadInt64(int64_t& ret) { mpArchive->ReadInt64(ret); } @@ -462,17 +468,17 @@ int cSerializerImpl::ReadBlob(void* pBlob, int count) return mpArchive->ReadBlob(pBlob, count); } -void cSerializerImpl::WriteInt16(int16 i) +void cSerializerImpl::WriteInt16(int16_t i) { mpArchive->WriteInt16(i); } -void cSerializerImpl::WriteInt32(int32 i) +void cSerializerImpl::WriteInt32(int32_t i) { mpArchive->WriteInt32(i); } -void cSerializerImpl::WriteInt64(int64 i) +void cSerializerImpl::WriteInt64(int64_t i) { mpArchive->WriteInt64(i); } diff --git a/src/core/serializerimpl.h b/src/core/serializerimpl.h index d622b3a..fe94b55 100644 --- a/src/core/serializerimpl.h +++ b/src/core/serializerimpl.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -100,14 +100,14 @@ public: // I think the best thing might be to have iSerializable only know about the archive // Standard data read/write // (All functions can throw eArchave exceptions). - virtual void ReadInt16(int16& ret); - virtual void ReadInt32(int32& ret); - virtual void ReadInt64(int64& ret); + virtual void ReadInt16(int16_t& ret); + virtual void ReadInt32(int32_t& ret); + virtual void ReadInt64(int64_t& ret); virtual void ReadString(TSTRING& ret); virtual int ReadBlob(void* pBlob, int count); - virtual void WriteInt16(int16 i); - virtual void WriteInt32(int32 i); - virtual void WriteInt64(int64 i); + virtual void WriteInt16(int16_t i); + virtual void WriteInt32(int32_t i); + virtual void WriteInt64(int64_t i); virtual void WriteString(const TSTRING& s); virtual void WriteBlob(const void* pBlob, int count); @@ -122,8 +122,8 @@ private: TSTRING mFileName; // creation function maps - typedef std::map SerMap; - typedef std::map SerRefCountMap; + typedef std::map SerMap; + typedef std::map SerRefCountMap; static SerMap mSerCreateMap; static SerRefCountMap mSerRefCountCreateMap; diff --git a/src/core/serializerutil.cpp b/src/core/serializerutil.cpp index d93e70b..8c18b0e 100644 --- a/src/core/serializerutil.cpp +++ b/src/core/serializerutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -37,18 +37,18 @@ namespace { -template int64 CopyImpl(TO* pTo, FROM* pFrom, int64 amt) +template int64_t CopyImpl(TO* pTo, FROM* pFrom, int64_t amt) { enum { BUF_SIZE = 8192 }; - int8 buf[BUF_SIZE]; - int64 amtLeft = amt; + int8_t buf[BUF_SIZE]; + int64_t amtLeft = amt; while (amtLeft > 0) { - // NOTE: We use int's here rather than int64 because iSerializer and cArchive + // NOTE: We use int's here rather than int64_t because iSerializer and cArchive // only take int's as their size parameter - dmb int amtToRead = amtLeft > BUF_SIZE ? BUF_SIZE : (int)amtLeft; int amtRead = pFrom->ReadBlob(buf, amtToRead); @@ -64,12 +64,12 @@ template int64 CopyImpl(TO* pTo, FROM* pFrom, int64 amt) } // namespace -int64 cSerializerUtil::Copy(iSerializer* pDest, cArchive* pSrc, int64 amt) +int64_t cSerializerUtil::Copy(iSerializer* pDest, cArchive* pSrc, int64_t amt) { return CopyImpl(pDest, pSrc, amt); } -int64 cSerializerUtil::Copy(cArchive* pDest, iSerializer* pSrc, int64 amt) +int64_t cSerializerUtil::Copy(cArchive* pDest, iSerializer* pSrc, int64_t amt) { return CopyImpl(pDest, pSrc, amt); } diff --git a/src/core/serializerutil.h b/src/core/serializerutil.h index dda1f3c..149aaee 100644 --- a/src/core/serializerutil.h +++ b/src/core/serializerutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -44,8 +44,8 @@ class iSerializer; class cSerializerUtil { public: - static int64 Copy(iSerializer* pDest, cArchive* pSrc, int64 amt); // throw( eArchvie, eSerilaizer ) - static int64 Copy(cArchive* pDest, iSerializer* pSrc, int64 amt); // throw( eArchvie, eSerilaizer ) + static int64_t Copy(iSerializer* pDest, cArchive* pSrc, int64_t amt); // throw( eArchvie, eSerilaizer ) + static int64_t Copy(cArchive* pDest, iSerializer* pSrc, int64_t amt); // throw( eArchvie, eSerilaizer ) // these two methods copy data from archives to serializers and vice-versa. They // throw exceptions on error; the return value is the amount that was copied. }; diff --git a/src/core/serstring.cpp b/src/core/serstring.cpp index c570880..b41970f 100644 --- a/src/core/serstring.cpp +++ b/src/core/serstring.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -37,9 +37,9 @@ IMPLEMENT_TYPEDSERIALIZABLE(cSerializableNString, _T("cSerializableNString"), 0, 1) -void cSerializableNString::Read(iSerializer* pSerializer, int32 version) +void cSerializableNString::Read(iSerializer* pSerializer, int32_t version) { - int32 len; + int32_t len; pSerializer->ReadInt32(len); mString.resize(len); pSerializer->ReadBlob((void*)mString.data(), len); // note len is the bytelen of the data @@ -47,7 +47,7 @@ void cSerializableNString::Read(iSerializer* pSerializer, int32 version) void cSerializableNString::Write(iSerializer* pSerializer) const { - int32 len = mString.length() * sizeof(char); + int32_t len = mString.length() * sizeof(char); pSerializer->WriteInt32(len); pSerializer->WriteBlob(mString.data(), len); } @@ -55,9 +55,9 @@ void cSerializableNString::Write(iSerializer* pSerializer) const IMPLEMENT_TYPEDSERIALIZABLE(cSerializableWString, _T("cSerializableWString"), 0, 1) -void cSerializableWString::Read(iSerializer* pSerializer, int32 version) +void cSerializableWString::Read(iSerializer* pSerializer, int32_t version) { - int32 len; + int32_t len; pSerializer->ReadInt32(len); mString.resize(len); pSerializer->ReadBlob((void*)mString.data(), len); // note len is the bytelen of the data @@ -65,7 +65,7 @@ void cSerializableWString::Read(iSerializer* pSerializer, int32 version) void cSerializableWString::Write(iSerializer* pSerializer) const { - int32 len = mString.length() * sizeof(wchar_t); + int32_t len = mString.length() * sizeof(wchar_t); pSerializer->WriteInt32(len); pSerializer->WriteBlob(mString.data(), len); } diff --git a/src/core/serstring.h b/src/core/serstring.h index 27e83f0..bf1dde1 100644 --- a/src/core/serstring.h +++ b/src/core/serstring.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -57,7 +57,7 @@ public: std::string mString; virtual ~cSerializableNString(){}; - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) DECLARE_TYPEDSERIALIZABLE() @@ -72,7 +72,7 @@ public: std::string mString; virtual ~cSerializableWString(){}; - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) DECLARE_TYPEDSERIALIZABLE() diff --git a/src/core/sha.cpp b/src/core/sha.cpp index 3b3c414..5cc4f5a 100644 --- a/src/core/sha.cpp +++ b/src/core/sha.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -149,8 +149,8 @@ /* The two buffers of 5 32-bit words */ -uint32 h0, h1, h2, h3, h4; -uint32 A, B, C, D, E; +uint32_t h0, h1, h2, h3, h4; +uint32_t A, B, C, D, E; /* Initialize the SHS values */ @@ -173,7 +173,7 @@ void shsInit(SHS_INFO* shsInfo) void shsTransform(SHS_INFO *shsInfo) { - uint32 W[ 80 ], temp; + uint32_t W[ 80 ], temp; int i; /* Step A. Copy the data buffer into the local work buffer */ @@ -240,12 +240,12 @@ void shsTransform(SHS_INFO *shsInfo) makes for very slow code, so we rely on the user to sort out endianness at compile time */ -static void byteReverse(uint32* buffer, int byteCount) +static void byteReverse(uint32_t* buffer, int byteCount) { - uint32 value; + uint32_t value; int count; - byteCount /= sizeof( uint32 ); + byteCount /= sizeof( uint32_t ); for( count = 0; count < byteCount; count++ ) { value = ( buffer[ count ] << 16 ) | ( buffer[ count ] >> 16 ); @@ -259,13 +259,13 @@ static void byteReverse(uint32* buffer, int byteCount) more efficient since it does away with the need to handle partial blocks between calls to shsUpdate() */ -void shsUpdate(SHS_INFO* shsInfo, uint8* buffer, int count) +void shsUpdate(SHS_INFO* shsInfo, uint8_t* buffer, int count) { /* Update bitcount */ - if( ( shsInfo->countLo + ( ( uint32 ) count << 3 ) ) < shsInfo->countLo ) + if( ( shsInfo->countLo + ( ( uint32_t ) count << 3 ) ) < shsInfo->countLo ) shsInfo->countHi++; /* Carry from low to high bitCount */ - shsInfo->countLo += ( ( uint32 ) count << 3 ); - shsInfo->countHi += ( ( uint32 ) count >> 29 ); + shsInfo->countLo += ( ( uint32_t ) count << 3 ); + shsInfo->countHi += ( ( uint32_t ) count >> 29 ); /* Process data in SHS_BLOCKSIZE chunks */ while( count >= SHS_BLOCKSIZE ) @@ -287,14 +287,14 @@ void shsUpdate(SHS_INFO* shsInfo, uint8* buffer, int count) void shsFinal(SHS_INFO *shsInfo) { int count; - uint32 lowBitcount = shsInfo->countLo, highBitcount = shsInfo->countHi; + uint32_t lowBitcount = shsInfo->countLo, highBitcount = shsInfo->countHi; /* Compute number of bytes mod 64 */ count = ( int ) ( ( shsInfo->countLo >> 3 ) & 0x3F ); /* Set the first char of padding to 0x80. This is safe since there is always at least one byte free */ - ( ( uint8 * ) shsInfo->data )[ count++ ] = 0x80; + ( ( uint8_t * ) shsInfo->data )[ count++ ] = 0x80; /* Pad out to 56 mod 64 */ if( count > 56 ) @@ -343,14 +343,14 @@ void main() { SHS_INFO shsInfo; time_t endTime, startTime; - uint8 data[ TEST_BLOCK_SIZE ]; + uint8_t data[ TEST_BLOCK_SIZE ]; long i; /* Test output data (this is the only test data given in the SHS document, but chances are if it works for this it'll work for anything) */ shsInit( &shsInfo ); - shsUpdate( &shsInfo, ( uint8 * ) "abc", 3 ); + shsUpdate( &shsInfo, ( uint8_t * ) "abc", 3 ); shsFinal( &shsInfo ); if( shsInfo.digest[ 0 ] != 0x0164B8A9L || shsInfo.digest[ 1 ] != 0x14CD2A5EL || diff --git a/src/core/sha.h b/src/core/sha.h index 502e170..9b2bd65 100644 --- a/src/core/sha.h +++ b/src/core/sha.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -46,16 +46,16 @@ /* The structure for storing SHS info */ typedef struct { - uint32 digest[ 5 ]; /* Message digest */ - uint32 countLo, countHi; /* 64-bit bit count */ - uint32 data[ 16 ]; /* SHS data buffer */ + uint32_t digest[ 5 ]; /* Message digest */ + uint32_t countLo, countHi; /* 64-bit bit count */ + uint32_t data[ 16 ]; /* SHS data buffer */ } SHS_INFO; /* Whether the machine is little-endian or not */ //int sig_sha_get(); void shsInit(SHS_INFO *shsInfo); -void shsUpdate(SHS_INFO* shsInfo, uint8* buffer, int count); +void shsUpdate(SHS_INFO* shsInfo, uint8_t* buffer, int count); void shsFinal(SHS_INFO* shsInfo); /* The next def turns on the change to the algorithm introduced by NIST at diff --git a/src/core/srefcountobj.cpp b/src/core/srefcountobj.cpp index 9ad77cc..0ad3ae5 100644 --- a/src/core/srefcountobj.cpp +++ b/src/core/srefcountobj.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/srefcountobj.h b/src/core/srefcountobj.h index d69087d..6da0863 100644 --- a/src/core/srefcountobj.h +++ b/src/core/srefcountobj.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -66,8 +66,8 @@ protected: # define DECLARE_SERREFCOUNT() \ DECLARE_TYPED() \ public: \ - static iSerRefCountObj* Create(); \ - virtual int32 Version() const; + static iSerRefCountObj* Create(); \ + virtual int32_t Version() const; # define IMPLEMENT_SERREFCOUNT(CLASS, TYPEDSTRING, VERSION_MAJOR, VERSION_MINOR) \ IMPLEMENT_TYPED(CLASS, TYPEDSTRING) \ @@ -75,7 +75,7 @@ protected: { \ return new CLASS; \ } \ - int32 CLASS::Version() const \ + int32_t CLASS::Version() const \ { \ return iTypedSerializable::MkVersion(VERSION_MAJOR, VERSION_MINOR); \ } diff --git a/src/core/srefcounttbl.cpp b/src/core/srefcounttbl.cpp index a3da794..7bcd93a 100644 --- a/src/core/srefcounttbl.cpp +++ b/src/core/srefcounttbl.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/srefcounttbl.h b/src/core/srefcounttbl.h index b133ae1..b65af0a 100644 --- a/src/core/srefcounttbl.h +++ b/src/core/srefcounttbl.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/stdcore.cpp b/src/core/stdcore.cpp index 9c32494..a3bc201 100644 --- a/src/core/stdcore.cpp +++ b/src/core/stdcore.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/stdcore.h b/src/core/stdcore.h index acdc2c1..ebea558 100644 --- a/src/core/stdcore.h +++ b/src/core/stdcore.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -45,50 +45,6 @@ #include "platform.h" -//--Disable some level 4 warnings - -#if IS_MSVC - -# define NOMINMAX //--Disable min/max macros - -#include // ARGH!! This resumes certain warnings! - -# pragma warning(disable : 4786) // Token Name > 255 -# pragma warning(disable : 4127) // constant expression (e.g. ASSERT) -# pragma warning(disable : 4291) // Incorrectly called when new(nothrow)!!! -# pragma warning(disable : 4097) // Type synonyms are good! -# pragma warning(disable : 4511) // Can't create copy ctor! (e.g.Private CTOR) -# pragma warning(disable : 4512) // Can't create assignment!(e.g.Private CTOR) -# pragma warning(disable : 4100) // Formal argument not used -# pragma warning(disable : 4710) // Compiler did not inline function - -# ifndef DEBUG // ASSERT's are disabled give a lot of these -# pragma warning(disable : 4702) // ---Unreachable Code -# endif - -/* NOTE:RAD:05/09/1999 -- Plaguers STDCPP implementation is SOOO bad - it creates all these errors when compiling at W4. By doing a push - before disabling them, we can still generate them for ourselves - without a lot of noise. The warnings before this push, we want to - always disable. */ - -# pragma warning(push) - -# pragma warning(disable : 4663) // Old template specialization syntax -# pragma warning(disable : 4018) // Signed unsigned mismatch -# pragma warning(disable : 4245) // Signed unsigned mismatch -# pragma warning(disable : 4663) // Use new template specialization syntax: template<> -# pragma warning(disable : 4701) // local variable 'X' may be used without having been initialized -# pragma warning(disable : 4510) // 'X' : default constructor could not be generated -# pragma warning(disable : 4610) // struct 'X' can never be instantiated - user defined constructor required -# pragma warning(disable : 4146) // unary minus operator applied to unsigned type, result still unsigned -# pragma warning(disable : 4244) // '=' : conversion from 'unsigned int' to 'char', possible loss of data -# pragma warning(disable : 4511) -# pragma warning(disable : 4503) - -#endif // #if IS_MSVC - - //--Include Standard CPP Declarations #include @@ -99,21 +55,27 @@ #include #include #include -#include -#include + +#if HAVE_SSTREAM +# include +#elif HAVE_STRSTREAM +# include +#endif + #include #include #include -#include -#include -#if IS_MSVC -# pragma warning(pop) // Resume W4 msgs for TSS code +#if HAVE_LOCALE +# include #endif +#if HAVE_LIMITS +# include +#endif + //--Include Platform Specific Declarations - //--Include Common Core Declarations #include "./tchar.h" @@ -121,5 +83,4 @@ #include "./error.h" #include "./debug.h" - #endif //__STDCORE_H diff --git a/src/core/stringutil.cpp b/src/core/stringutil.cpp index edee741..b55aac8 100644 --- a/src/core/stringutil.cpp +++ b/src/core/stringutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -84,10 +84,10 @@ class tss_hash_key_convert { public: - const byte* operator()(const wc16_string& s, int* const pcbKeyLen) + const uint8_t* operator()(const wc16_string& s, int* const pcbKeyLen) { *pcbKeyLen = sizeof(WCHAR16) * s.length(); - return (byte*)s.c_str(); + return (uint8_t*)s.c_str(); } }; diff --git a/src/core/stringutil.h b/src/core/stringutil.h index 240e958..5c01ab1 100644 --- a/src/core/stringutil.h +++ b/src/core/stringutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/tasktimer.h b/src/core/tasktimer.h index 60dfa50..351161d 100644 --- a/src/core/tasktimer.h +++ b/src/core/tasktimer.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -96,11 +96,11 @@ public: { mNumStarts = mStartTime = mTotalTime = 0; } - uint32 GetTotalTime() const + uint32_t GetTotalTime() const { return mTotalTime; } - uint32 GetNumTimesStarted() const + uint32_t GetNumTimesStarted() const { return mNumStarts; } @@ -110,10 +110,10 @@ public: } private: - TSTRING mName; - uint32 mTotalTime; - uint32 mStartTime; - uint32 mNumStarts; + TSTRING mName; + uint32_t mTotalTime; + uint32_t mStartTime; + uint32_t mNumStarts; }; diff --git a/src/core/tchar.h b/src/core/tchar.h index 3c35321..85103be 100644 --- a/src/core/tchar.h +++ b/src/core/tchar.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -60,19 +60,35 @@ // A little macro that's useful for finding the number of characters in a TCHAR ARRAY #define countof(x) (sizeof(x) / sizeof(x[0])) +#include "platform.h" #include #include -#include #include +#include + +#if HAVE_SSTREAM +# include +#elif HAVE_STRSTREAM +# include +#endif + #define TCHAR char #define _tmain main typedef std::string TSTRING; -typedef std::stringstream TSTRINGSTREAM; -typedef std::ostringstream TOSTRINGSTREAM; -typedef std::istringstream TISTRINGSTREAM; + +#if HAVE_SSTREAM + typedef std::stringstream TSTRINGSTREAM; + typedef std::ostringstream TOSTRINGSTREAM; + typedef std::istringstream TISTRINGSTREAM; +#elif HAVE_STRSTREAM + typedef strstream TSTRINGSTREAM; + typedef ostrstream TOSTRINGSTREAM; + typedef istrstream TISTRINGSTREAM; +#endif + typedef std::ostream TOSTREAM; typedef std::istream TISTREAM; typedef std::ofstream TOFSTREAM; @@ -125,4 +141,36 @@ typedef std::ifstream TIFSTREAM; # define __cdecl # endif +#if HAVE_LOCALE +# define tss_classic_locale(x) x.imbue(std::locale::classic()) +#else +# define tss_classic_locale(x) +#endif + +#if ARCHAIC_STL +# define tss_end(x) x << std::ends +# define tss_free(x) x.freeze(0) +# define tss_mkstr(y,x) \ + tss_end(x); \ + TSTRING y = x.str(); \ + tss_free(x); + +# define tss_stream_to_string(x,y) \ + tss_end(x); \ + y = x.str(); \ + tss_free(x); + +# define tss_return_stream(x,y) \ + tss_mkstr(y,x) \ + return y; + +#else +# define tss_end(x) +# define tss_free(x) +# define tss_mkstr(y,x) TSTRING y = x.str(); +# define tss_stream_to_string(x,y) y = x.str(); +# define tss_return_stream(x,y) return x.str(); +#endif + + #endif // __TCHAR_H diff --git a/src/core/timeconvert.cpp b/src/core/timeconvert.cpp index 48c1846..a75c558 100644 --- a/src/core/timeconvert.cpp +++ b/src/core/timeconvert.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -48,38 +48,42 @@ #include +#if IS_AROS +# undef HAVE_TZSET +#endif + //========================================================================= // METHOD CODE //========================================================================= #define TIME_MAX 2147483647L // largest signed 32 bit number -#if IS_AROS -# define tzset() -#endif - -struct tm* cTimeUtil::TimeToDateGMT(const int64& seconds) +struct tm* cTimeUtil::TimeToDateGMT(const int64_t& seconds) { ASSERT(seconds < TIME_MAX); // this assumes time_t size is 32 bit. Yikes! time_t t = static_cast(seconds); return gmtime(&t); } -struct tm* cTimeUtil::TimeToDateLocal(const int64& seconds) +struct tm* cTimeUtil::TimeToDateLocal(const int64_t& seconds) { ASSERT(seconds < TIME_MAX); // this assumes time_t size is 32 bit. Yikes! time_t t = static_cast(seconds); +#if HAVE_TZSET tzset(); +#endif return localtime(&t); } -int64 cTimeUtil::DateToTime(struct tm* ptm) +int64_t cTimeUtil::DateToTime(struct tm* ptm) { +#if HAVE_TZSET tzset(); +#endif return mktime(ptm); } -int64 cTimeUtil::GetTime() +int64_t cTimeUtil::GetTime() { return time(NULL); } diff --git a/src/core/timeconvert.h b/src/core/timeconvert.h index 2e56f47..0a843e9 100644 --- a/src/core/timeconvert.h +++ b/src/core/timeconvert.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -62,13 +62,13 @@ class cTimeUtil { public: - static int64 DateToTime(struct tm* ptm); + static int64_t DateToTime(struct tm* ptm); // simple conversion. ptm is considered to be in localtime. - static struct tm* TimeToDateGMT(const int64& seconds); + static struct tm* TimeToDateGMT(const int64_t& seconds); // simple conversion - static struct tm* TimeToDateLocal(const int64& seconds); + static struct tm* TimeToDateLocal(const int64_t& seconds); // conversion with timezone and daylight - static int64 GetTime(); + static int64_t GetTime(); // returns current time in UTC }; diff --git a/src/core/tw_signal.cpp b/src/core/tw_signal.cpp index a2fbf6b..916f3d9 100644 --- a/src/core/tw_signal.cpp +++ b/src/core/tw_signal.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -83,7 +83,7 @@ void util_SignalHandler(int sig) void tw_psignal(int sig, const TCHAR* str) { - const TCHAR* siglist[NSIG] = {_T("Unknown Signal"), + const TCHAR* siglist[] = { _T("Unknown Signal"), _T("Hangup"), _T("Interrupt"), _T("Quit"), diff --git a/src/core/tw_signal.h b/src/core/tw_signal.h index ee4625e..034be9c 100644 --- a/src/core/tw_signal.h +++ b/src/core/tw_signal.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/twlimits.cpp b/src/core/twlimits.cpp index 7de8772..0d19690 100644 --- a/src/core/twlimits.cpp +++ b/src/core/twlimits.cpp @@ -1,6 +1,5 @@ -// // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -44,12 +43,23 @@ // METHOD CODE //========================================================================= +bool tss_isdigit(const TCHAR in) +{ +#if ARCHAIC_STL + return isdigit(in); +#else + return std::isdigit(in, std::locale()); +#endif +} + + bool cInterpretInt::InterpretInt(const TSTRING& str, int* pi) { ASSERT(pi != 0); bool fFormatOK = true; +#if !ARCHAIC_STL // // make sure string is not longer than a string representation of LIMIT_MAX // @@ -57,7 +67,8 @@ bool cInterpretInt::InterpretInt(const TSTRING& str, int* pi) sstr << cInterpretInt::LIMIT_MAX; if (str.length() > sstr.str().length()) fFormatOK = false; - +#endif + // // make sure string is not too short // @@ -69,7 +80,7 @@ bool cInterpretInt::InterpretInt(const TSTRING& str, int* pi) // if (fFormatOK) { - if (!(_T('-') == str[0] || std::isdigit(str[0], std::locale()))) + if (!(_T('-') == str[0] || tss_isdigit(str[0]))) fFormatOK = false; } @@ -79,7 +90,7 @@ bool cInterpretInt::InterpretInt(const TSTRING& str, int* pi) // TODO:BAM -- check this... for (TSTRING::size_type j = 1; fFormatOK && j < str.length(); j++) { - if (!std::isdigit(str[j], std::locale())) + if (!tss_isdigit(str[j])) fFormatOK = false; } diff --git a/src/core/twlimits.h b/src/core/twlimits.h index 3f93b2d..28acd39 100644 --- a/src/core/twlimits.h +++ b/src/core/twlimits.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -137,7 +137,7 @@ private: enum Limits { LIMIT_MIN = -1, - LIMIT_MAX = 1000000 + LIMIT_MAX = INT_MAX }; virtual int GetMax() diff --git a/src/core/twlocale.cpp b/src/core/twlocale.cpp index b7d648d..0f59f26 100644 --- a/src/core/twlocale.cpp +++ b/src/core/twlocale.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -48,6 +48,9 @@ #include #endif //HAVE_GCC +#if IS_AROS +# undef HAVE_TZSET +#endif //========================================================================= // STANDARD LIBRARY INCLUDES @@ -68,10 +71,6 @@ static TSTRING& util_FormatTimeCPlusPlus(struct tm* ptm, TSTRING& strBuf); // PUBLIC METHOD CODE //========================================================================= -#if IS_AROS -# define tzset() -#endif - void cTWLocale::InitGlobalLocale() { cDebug d("cTWLocale::InitGlobalLocale"); @@ -104,19 +103,19 @@ void cTWLocale::InitGlobalLocale() } /* -TSTRING cTWLocale::FormatNumberAsHex( int32 i ) +TSTRING cTWLocale::FormatNumberAsHex( int32_t i ) { // // preconditions // - ASSERT( sizeof( long ) >= sizeof( int32 ) ); // must be able to cast to 'long' + ASSERT( sizeof( long ) >= sizeof( int32_t ) ); // must be able to cast to 'long' // // convert long to a string // TOSTRINGSTREAM sstr; - sstr.imbue( std::locale::classic() ); - sstr.setf( std::ios_base::hex, std::ios_base::basefield ); + tss_classic_locale(sstr); + sstr.setf( std::ios::hex, std::ios::basefield ); const std::num_put< TCHAR > *pnp = 0, &np = tss::GetFacet( sstr.getloc(), pnp ); np.put( sstr, sstr, sstr.fill(), (long)i ); @@ -142,21 +141,27 @@ public: // EFFECTS: Does all actual formatting for FormatNumber methods static numT Format(const std::basic_string& s, bool fCStyleFormatting) { + +#if !ARCHAIC_STL static const std::num_get* png; - std::basic_istringstream ss(s); - std::ios_base::iostate state; + std::ios::iostate state; numT n; + std::basic_istringstream ss(s); + if (fCStyleFormatting) - ss.imbue(std::locale::classic()); + tss_classic_locale(ss); tss::GetFacet(ss.getloc(), png).get(ss, std::istreambuf_iterator(), ss, state, n); - if ((state & std::ios_base::failbit) != 0) + if ((state & std::ios::failbit) != 0) throw eTWLocaleBadNumFormat(); return (n); +#else + return atoi(s.c_str()); +#endif } //============================================================================= @@ -167,55 +172,55 @@ public: // static std::basic_string& Format(numT n, std::basic_string& sBuf, bool fCStyleFormatting = false) { +#if !ARCHAIC_STL static const std::num_put* pnp; + std::basic_ostringstream ss; if (fCStyleFormatting) - ss.imbue(std::locale::classic()); + tss_classic_locale(ss); tss::GetFacet(ss.getloc(), pnp).put(ss, ss, ss.fill(), n); +#else + strstream ss; + ss << n; +#endif sBuf = ss.str(); - return (sBuf); + return (sBuf); } }; /* -TSTRING cTWLocale::FormatNumberClassic( int32 i ) +TSTRING cTWLocale::FormatNumberClassic( int32_t i ) { TSTRING s; return cFormatNumberUtil< long, TCHAR >::Format( i, s, true ); } -int32 cTWLocale::FormatNumberClassic( const TSTRING& s ) +int32_t cTWLocale::FormatNumberClassic( const TSTRING& s ) { return cFormatNumberUtil< long, TCHAR >::Format( s, true ); } */ -TSTRING& cTWLocale::FormatNumber(uint64 ui, TSTRING& strBuf) +TSTRING& cTWLocale::FormatNumber(uint64_t ui, TSTRING& strBuf) { - // try to use the int64 version - if (ui <= (uint64)TSS_INT64_MAX) - return (FormatNumber((int64)ui, strBuf)); + // try to use the int64_t version + if (ui <= (uint64_t)TSS_INT64_MAX) + return (FormatNumber((int64_t)ui, strBuf)); else { -#if IS_MSVC - // MSVC can't convert from uint64 to a double for some reason - strBuf = TSS_GetString(cCore, core::STR_NUMBER_TOO_BIG); - return (strBuf); -#else ASSERT(std::numeric_limits::max() >= TSS_UINT64_MAX); return (cFormatNumberUtil::Format((double)ui, strBuf)); -#endif } } -TSTRING& cTWLocale::FormatNumber(int64 i, TSTRING& strBuf) +TSTRING& cTWLocale::FormatNumber(int64_t i, TSTRING& strBuf) { - // try to use the int32 version - if (i <= (int64)TSS_INT32_MAX) - return (FormatNumber((int32)i, strBuf)); + // try to use the int32_t version + if (i <= (int64_t)TSS_INT32_MAX) + return (FormatNumber((int32_t)i, strBuf)); else { ASSERT(std::numeric_limits::max() >= TSS_INT64_MAX); @@ -223,23 +228,25 @@ TSTRING& cTWLocale::FormatNumber(int64 i, TSTRING& strBuf) } } -TSTRING& cTWLocale::FormatNumber(uint32 ui, TSTRING& strBuf) +TSTRING& cTWLocale::FormatNumber(uint32_t ui, TSTRING& strBuf) { - ASSERT(sizeof(unsigned long) >= sizeof(uint32)); // must be able to cast to 'ulong' + ASSERT(sizeof(unsigned long) >= sizeof(uint32_t)); // must be able to cast to 'ulong' return (cFormatNumberUtil::Format((unsigned long)ui, strBuf)); } -TSTRING& cTWLocale::FormatNumber(int32 i, TSTRING& strBuf) +TSTRING& cTWLocale::FormatNumber(int32_t i, TSTRING& strBuf) { - ASSERT(sizeof(long) >= sizeof(int32)); // must be able to cast to 'long' + ASSERT(sizeof(long) >= sizeof(int32_t)); // must be able to cast to 'long' return (cFormatNumberUtil::Format((long)i, strBuf)); } -TSTRING& cTWLocale::FormatTime(int64 t, TSTRING& strBuf) +TSTRING& cTWLocale::FormatTime(int64_t t, TSTRING& strBuf) { // clear return string strBuf.erase(); +#if HAVE_TZSET tzset(); +#endif time_t tmpTime = t; struct tm* ptm = localtime(&tmpTime); if (ptm) @@ -290,7 +297,7 @@ TSTRING& util_FormatTimeCPlusPlus(struct tm* ptm, TSTRING& strBuf) tss::GetFacet(sstr.getloc(), ptp).put(sstr, sstr, sstr.fill(), ptm, 'c'); # endif - strBuf = sstr.str(); + tss_stream_to_string(sstr, strBuf); return strBuf; } #endif diff --git a/src/core/twlocale.h b/src/core/twlocale.h index 0929998..ccf2d42 100644 --- a/src/core/twlocale.h +++ b/src/core/twlocale.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -73,22 +73,22 @@ public: // // basic functionality // - static TSTRING& FormatNumber(int32 i, TSTRING& strBuf); - static TSTRING& FormatNumber(int64 i, TSTRING& strBuf); - static TSTRING& FormatNumber(uint32 ui, TSTRING& strBuf); - static TSTRING& FormatNumber(uint64 ui, TSTRING& strBuf); + static TSTRING& FormatNumber(int32_t i, TSTRING& strBuf); + static TSTRING& FormatNumber(int64_t i, TSTRING& strBuf); + static TSTRING& FormatNumber(uint32_t ui, TSTRING& strBuf); + static TSTRING& FormatNumber(uint64_t ui, TSTRING& strBuf); static TSTRING& FormatNumber(double d, TSTRING& strBuf); // returns the locale-specific representation of the given cardinal number /* - static TSTRING FormatNumberClassic( int32 i ); - static int32 FormatNumberClassic( const TSTRING& s ); + static TSTRING FormatNumberClassic( int32_t i ); + static int32_t FormatNumberClassic( const TSTRING& s ); // returns the C-locale representation of the given cardinal number */ // disabled this since nobody's using it - // static TSTRING FormatNumberAsHex( int32 x ); + // static TSTRING FormatNumberAsHex( int32_t x ); // locale-independant - static TSTRING& FormatTime(int64 t, TSTRING& strBuf); + static TSTRING& FormatTime(int64_t t, TSTRING& strBuf); // returns the local time and date formatted according to the current locale. // t is the number of seconds elapsed since midnight (00:00:00), // January 1, 1970, coordinated universal time @@ -98,8 +98,10 @@ public: // INLINE FUNCTIONS //========================================================================= +#if !ARCHAIC_STL namespace tss { + //////////////////////////////////////////////// // GetFacet // @@ -116,5 +118,6 @@ template inline const FacetT& GetFacet(const std::locale& l, const #endif } } // namespace tss +#endif #endif //__TWLOCALE_H diff --git a/src/core/twstringslang.h b/src/core/twstringslang.h index daaefe1..e762047 100644 --- a/src/core/twstringslang.h +++ b/src/core/twstringslang.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/typed.h b/src/core/typed.h index bc42c23..6201e04 100644 --- a/src/core/typed.h +++ b/src/core/typed.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/types.h b/src/core/types.h index 4287bc2..4fc063c 100644 --- a/src/core/types.h +++ b/src/core/types.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -37,138 +37,158 @@ #include "platform.h" #if HAVE_STDINT_H -#include +# include #endif +#if HAVE_LIMITS_H +# include +#endif //----------------------------------------------------------------------------- // standard TSS types //----------------------------------------------------------------------------- -typedef unsigned char byte; // platform-independent +// Sensible defaults in case there's no stdint.h +#if !HAVE_STDINT_H +typedef unsigned char uint8_t; +typedef signed char int8_t; +typedef short int16_t; +typedef unsigned short uint16_t; -typedef signed char int8; -typedef short int16; -typedef float float32; -typedef double float64; -typedef unsigned char uint8; -typedef unsigned short uint16; +//typedef float float32_t; +//typedef double float64_t; -#if HAVE_STDINT_H -typedef int32_t int32; -typedef uint32_t uint32; - -#elif SIZEOF_INT == 4 -typedef int int32; -typedef unsigned int uint32; +#if SIZEOF_INT == 4 +typedef int int32_t; +typedef unsigned int uint32_t; #elif SIZEOF_LONG == 4 -typedef long int32; -typedef unsigned long uint32; +typedef long int32_t; +typedef unsigned long uint32_t; #else # error "I don't seem to have a 32-bit integer type on this system." #endif -#if HAVE_STDINT_H -typedef int64_t int64; -typedef uint64_t uint64; -#elif SIZEOF_LONG == 8 -typedef long int64; -typedef unsigned long uint64; +#if SIZEOF_LONG == 8 +typedef long int64_t; +typedef unsigned long uint64_t; #elif SIZEOF_LONG_LONG == 8 -typedef long long int64; -typedef unsigned long long uint64; +typedef long long int64_t; +typedef unsigned long long uint64_t; #else # error "I don't seem to have a 64-bit integer type on this system." #endif +#endif // !HAVE_STDINT_H -// other Win32 definitions -//typedef uint16 UINT; -//typedef uint32 DWORD; - -//----------------------------------------------------------------------------- -// Limits -- should be platform independent, right? ( assumes 2's complement numbers ) -//----------------------------------------------------------------------------- - - -#if (!(USES_2S_COMPLEMENT)) -# error limits.h depends on 2s complement integers. Check core/types.h +#ifdef CHAR_MIN +# define TSS_CHAR_MIN CHAR_MIN +#else +# define TSS_CHAR_MIN (-127 - 1) #endif -#include // defines limits for built-in types - -#define TSS_INT8_MIN (-127 - 1) -#define TSS_INT8_MAX 127 -#define TSS_UINT8_MAX 0xFFU -#define TSS_INT16_MIN (-32767 - 1) -#define TSS_INT16_MAX 32767 -#define TSS_UINT16_MAX 0xFFFFU -#define TSS_INT32_MIN (-2147483647 - 1) -#define TSS_INT32_MAX 2147483647 -#define TSS_UINT32_MAX 0xFFFFFFFFU -#define TSS_INT64_MIN (-9223372036854775807LL - 1) -#define TSS_INT64_MAX 9223372036854775807LL -#define TSS_UINT64_MAX 0xFFFFFFFFFFFFFFFFULL - -/* -//----------------------------------------------------------------------------- -// numeric_limits : TODO:BAM eventually I should get around to finishing these.... -//----------------------------------------------------------------------------- - -#pragma warning( push ) -pragma warning( disable: 4663 ) // Use new template specialization syntax: template<> -#define NOMINMAX // turn off min() and max() macros -#include -#pragma warning( pop ) - -// -// define numeric_limits for our types -// -// NOTE: assumes std::numeric_limits< int > does not depend on signedness of type -// TODO:BAM -- add members like digits and digits10 -// TODO:BAM -- define floating point numeric_limits -#define DECLARE_INTEGRAL_NUM_LIMITS( intT, minVal, maxVal, nDigits, ) \ - template<> class numeric_limits< intT > : public std::numeric_limits< int > \ - {\ - static intT (min)() throw() { return ( minVal ); } \ - static intT (max)() throw() { return ( maxVal ); } \ - enum { digits = 0 }; - enum { digits = 0 }; - }; - -// NOTE: assumes ( std::numeric_limits< int >::is_specialized == true ) -namespace std -{ -#if IS_UNIX - DECLARE_INTEGRAL_NUM_LIMITS( int8, SCHAR_MIN, SCHAR_MAX ); - DECLARE_INTEGRAL_NUM_LIMITS( int16, SHRT_MIN, SHRT_MAX ); - DECLARE_INTEGRAL_NUM_LIMITS( int32, LONG_MIN, LONG_MAX ); - +#ifdef CHAR_MAX +# define TSS_CHAR_MAX CHAR_MAX +#else +# define TSS_CHAR_MAX 127 #endif -} -*/ + +#define TSS_TCHAR_MIN TSS_CHAR_MIN +#define TSS_TCHAR_MAX TSS_CHAR_MAX + +#ifdef INT8_MIN +# define TSS_INT8_MIN INT8_MIN +#else +# define TSS_INT8_MIN (-127 - 1) +#endif + +#ifdef INT8_MAX +# define TSS_INT8_MAX INT8_MAX +#else +# define TSS_INT8_MAX 127 +#endif + +#ifdef UINT8_MAX +# define TSS_UINT8_MAX UINT8_MAX +#else +# define TSS_UINT8_MAX 0xFFU +#endif + +#ifdef INT16_MIN +# define TSS_INT16_MIN INT16_MIN +#else +# define TSS_INT16_MIN (-32767 - 1) +#endif + +#ifdef INT16_MAX +# define TSS_INT16_MAX INT16_MAX +#else +# define TSS_INT16_MAX 32767 +#endif + +#ifdef UINT16_MAX +# define TSS_UINT16_MAX UINT16_MAX +#else +# define TSS_UINT16_MAX 0xFFFFU +#endif + +#ifdef INT32_MIN +# define TSS_INT32_MIN INT32_MIN +#else +# define TSS_INT32_MIN (-2147483647 - 1) +#endif + +#ifdef INT32_MAX +# define TSS_INT32_MAX INT32_MAX +#else +# define TSS_INT32_MAX 2147483647 +#endif + +#ifdef UINT32_MAX +# define TSS_UINT32_MAX UINT32_MAX +#else +# define TSS_UINT32_MAX 0xFFFFFFFFU +#endif + +#ifdef INT64_MIN +# define TSS_INT64_MIN INT64_MIN +#else +# define TSS_INT64_MIN (-9223372036854775807LL - 1) +#endif + +#ifdef INT64_MAX +# define TSS_INT64_MAX INT64_MAX +#else +# define TSS_INT64_MAX 9223372036854775807LL +#endif + +#ifdef UINT64_MAX +# define TSS_UINT64_MAX UINT64_MAX +#else +# define TSS_UINT64_MAX 0xFFFFFFFFFFFFFFFFULL +#endif + //----------------------------------------------------------------------------- // Byte Swapping //----------------------------------------------------------------------------- -inline int16 SWAPBYTES16(int16 i) +inline int16_t SWAPBYTES16(int16_t i) { - return ((uint16)i >> 8) | ((uint16)i << 8); + return ((uint16_t)i >> 8) | ((uint16_t)i << 8); } -inline int32 SWAPBYTES32(int32 i) +inline int32_t SWAPBYTES32(int32_t i) { - return ((uint32)i >> 24) | (((uint32)i & 0x00ff0000) >> 8) | (((uint32)i & 0x0000ff00) << 8) | ((uint32)i << 24); + return ((uint32_t)i >> 24) | (((uint32_t)i & 0x00ff0000) >> 8) | (((uint32_t)i & 0x0000ff00) << 8) | ((uint32_t)i << 24); } -inline int64 SWAPBYTES64(int64 i) +inline int64_t SWAPBYTES64(int64_t i) { - return ((uint64)i >> 56) | (((uint64)i & 0x00ff000000000000ULL) >> 40) | - (((uint64)i & 0x0000ff0000000000ULL) >> 24) | (((uint64)i & 0x000000ff00000000ULL) >> 8) | - (((uint64)i & 0x00000000ff000000ULL) << 8) | (((uint64)i & 0x0000000000ff0000ULL) << 24) | - (((uint64)i & 0x000000000000ff00ULL) << 40) | ((uint64)i << 56); + return ((uint64_t)i >> 56) | (((uint64_t)i & 0x00ff000000000000ULL) >> 40) | + (((uint64_t)i & 0x0000ff0000000000ULL) >> 24) | (((uint64_t)i & 0x000000ff00000000ULL) >> 8) | + (((uint64_t)i & 0x00000000ff000000ULL) << 8) | (((uint64_t)i & 0x0000000000ff0000ULL) << 24) | + (((uint64_t)i & 0x000000000000ff00ULL) << 40) | ((uint64_t)i << 56); } @@ -178,7 +198,7 @@ inline int64 SWAPBYTES64(int64 i) # define tw_ntohl(x) (x) # define tw_htons(x) (x) # define tw_ntohs(x) (x) -# define tw_htonll(x) (x) // int64 versions +# define tw_htonll(x) (x) // int64_t versions # define tw_ntohll(x) (x) # else //!WORDS_BIGENDIAN @@ -187,14 +207,14 @@ inline int64 SWAPBYTES64(int64 i) # define tw_ntohl(x) SWAPBYTES32((x)) # define tw_htons(x) SWAPBYTES16((x)) # define tw_ntohs(x) SWAPBYTES16((x)) -# define tw_htonll(x) SWAPBYTES64((x)) // int64 versions +# define tw_htonll(x) SWAPBYTES64((x)) // int64_t versions # define tw_ntohll(x) SWAPBYTES64((x)) # endif //WORDS_BIGENDIAN //////////////////////////////////////////// -# if __cplusplus >= 201103L +# if USE_UNIQUE_PTR # define TW_UNIQUE_PTR std::unique_ptr # else # define TW_UNIQUE_PTR std::auto_ptr diff --git a/src/core/unixexcept.cpp b/src/core/unixexcept.cpp index 3bc9bee..5b9258a 100644 --- a/src/core/unixexcept.cpp +++ b/src/core/unixexcept.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/unixexcept.h b/src/core/unixexcept.h index 7d748e8..d86946a 100644 --- a/src/core/unixexcept.h +++ b/src/core/unixexcept.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/unixfsservices.cpp b/src/core/unixfsservices.cpp index 481bf1b..0748f0a 100644 --- a/src/core/unixfsservices.cpp +++ b/src/core/unixfsservices.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -39,56 +39,67 @@ #include "core/corestrings.h" #include "core/file.h" -#if !IS_UNIX //encase this all in an ifdef so it won't cause compile errors -# error Must be unix for unixfsservices -#endif - //========================================================================= // STANDARD LIBRARY INCLUDES //========================================================================= -#include -#include +//#include +//#include -#include -#include -#include -#include -#include -#ifdef HAVE_SYS_PARAM_H -#include +//#include +#if HAVE_UNISTD_H +# include #endif -#ifdef HAVE_SYS_MOUNT_H -#include + +#if HAVE_DIRENT_H +# include #endif -#ifdef HAVE_SYS_USTAT_H + +//#include + +//#if HAVE_SYS_TIME_H +//#include +//#endif + +//#if HAVE_SYS_PARAM_H +//#include +//#endif + +//#if HAVE_SYS_MOUNT_H +//#include +//#endif + +/*#if HAVE_SYS_USTAT_H #include -#endif -#ifdef HAVE_WCHAR_H -#include -#endif -#ifdef HAVE_SYS_SYSMACROS_H -#include -#endif +#endif*/ + +//#if HAVE_WCHAR_H +//#include +//#endif + +//#if HAVE_SYS_SYSMACROS_H +//#include +//#endif #if HAVE_SYS_UTSNAME_H -#include +# include #endif -#include - -#if IS_REDOX -# define restrict __restrict__ +#if HAVE_PWD_H +# include #endif #if HAVE_SYS_SOCKET_H -#include -#include -#include +# include +# include +# include #endif -#include -#include +#if HAVE_GRP_H +# include +#endif + +#//include #include //========================================================================= @@ -103,10 +114,10 @@ // -jeb 7/26/99 // reduced to sys/statfs.h. Linux is OK and doesn't deserve // special treatment. 20010317-PH -#ifdef HAVE_SYS_STATFS_H +/*#ifdef HAVE_SYS_STATFS_H #include #endif //HAVE_SYS_STATFS_H - +*/ //========================================================================= // DEFINES AND MACROS @@ -114,6 +125,16 @@ #define TW_SLASH _T('/') +#if (SUPPORTS_NATIVE_OBJECTS) + #ifndef _S_IFNATIVE + #define _S_IFNATIVE 02000000 /* OS/400 native object, of any object type that isn't treated as a directory */ + #endif + + #ifndef S_ISNATIVE + #define S_ISNATIVE(x) (((x) & 0370000) == _S_IFNATIVE) + #endif +#endif + //========================================================================= // OTHER DIRECTIVES //========================================================================= @@ -172,12 +193,15 @@ void cUnixFSServices::GetHostID(TSTRING& name) const { TOSTRINGSTREAM ret; - ret.setf(ios_base::hex, ios_base::basefield); -#ifdef HAVE_GETHOSTID + ret.setf(std::ios::hex, std::ios::basefield); + +#if HAVE_GETHOSTID ret << gethostid(); #else ret << 999999; #endif + + tss_stream_to_string(ret, name); } // returns "/" for unix and "\\" for win32 @@ -264,38 +288,41 @@ void cUnixFSServices::GetCurrentDir(TSTRING& strCurDir) const TSTRING& cUnixFSServices::MakeTempFilename(TSTRING& strName) const { - char* pchTempFileName; char szTemplate[iFSServices::TW_MAX_PATH]; - int fd; strncpy(szTemplate, strName.c_str(), iFSServices::TW_MAX_PATH); -#ifdef HAVE_MKSTEMP +#if HAVE_MKSTEMP // create temp filename and check to see if mkstemp failed - if ((fd = mkstemp(szTemplate)) == -1) - { + int fd = mkstemp(szTemplate); + if (fd < 0) throw eFSServicesGeneric(strName); - } - else - { - close(fd); - } - pchTempFileName = szTemplate; -#else - fd = 0; + + close(fd); + char* pchTempFileName = szTemplate; + +#elif HAVE_MKTEMP + // create temp filename - pchTempFileName = mktemp(szTemplate); + char* pchTempFileName = mktemp(szTemplate); //check to see if mktemp failed if (pchTempFileName == NULL || strlen(pchTempFileName) == 0) { throw eFSServicesGeneric(strName); } + +#elif HAVE_TMPNAM + char* pchTempFileName = tmpnam(szTemplate); +#else + // none of the standard temp fns exist? should this be an error? + #error "No standard tempfile naming functions are available" #endif // change name so that it has the XXXXXX part filled in strName = pchTempFileName; + // TODO: below is a very old comment, is it still accurate? // Linux creates the file!! Doh! // So I'll always attempt to delete it -bam FileDelete(strName.c_str()); @@ -310,16 +337,15 @@ void cUnixFSServices::GetTempDirName(TSTRING& strName) const void cUnixFSServices::SetTempDirName(TSTRING& tmpPath) { - mTempPath = tmpPath; } #if !USES_DEVICE_PATH -void cUnixFSServices::Stat(const TSTRING& strName, cFSStatArgs& stat) const +void cUnixFSServices::Stat(const TSTRING& strName, cFSStatArgs& statArgs) const { #else -void cUnixFSServices::Stat(const TSTRING& strNameC, cFSStatArgs& stat) const +void cUnixFSServices::Stat(const TSTRING& strNameC, cFSStatArgs& statArgs) const { TSTRING strName = cDevicePath::AsNative(strNameC); #endif @@ -327,7 +353,11 @@ void cUnixFSServices::Stat(const TSTRING& strNameC, cFSStatArgs& stat) const struct stat statbuf; int ret; +#if HAVE_LSTAT ret = lstat(strName.c_str(), &statbuf); +#elif HAVE_STAT + ret = stat(strName.c_str(), &statbuf); +#endif cDebug d("cUnixFSServices::Stat"); d.TraceDetail("Executing on file %s (result=%d)\n", strName.c_str(), ret); @@ -348,66 +378,93 @@ void cUnixFSServices::Stat(const TSTRING& strNameC, cFSStatArgs& stat) const #endif //copy information returned by lstat call into the structure passed in - stat.gid = statbuf.st_gid; - stat.atime = statbuf.st_atime; - stat.ctime = statbuf.st_ctime; - stat.mtime = statbuf.st_mtime; - stat.dev = statbuf.st_dev; + statArgs.gid = statbuf.st_gid; + statArgs.atime = statbuf.st_atime; + statArgs.ctime = statbuf.st_ctime; + statArgs.mtime = statbuf.st_mtime; + statArgs.dev = statbuf.st_dev; #if HAVE_STRUCT_STAT_ST_RDEV - stat.rdev = statbuf.st_rdev; + statArgs.rdev = statbuf.st_rdev; #else - stat.rdev = 0; + statArgs.rdev = 0; #endif - stat.ino = statbuf.st_ino; - stat.mode = statbuf.st_mode; - stat.nlink = statbuf.st_nlink; - stat.size = statbuf.st_size; - stat.uid = statbuf.st_uid; - stat.blksize = statbuf.st_blksize; + statArgs.ino = statbuf.st_ino; + statArgs.mode = statbuf.st_mode; + statArgs.nlink = statbuf.st_nlink; + statArgs.size = statbuf.st_size; + statArgs.uid = statbuf.st_uid; -#if HAVE_STRUCT_STAT_ST_BLOCKS - stat.blocks = statbuf.st_blocks; +#if HAVE_STRUCT_STAT_ST_BLKSIZE + statArgs.blksize = statbuf.st_blksize; #else - stat.blocks = 0; + statArgs.blksize = 0; +#endif + +#if HAVE_STRUCT_STAT_ST_BLOCKS + statArgs.blocks = statbuf.st_blocks; +#else + statArgs.blocks = 0; #endif // set the file type if (S_ISREG(statbuf.st_mode)) - stat.mFileType = cFSStatArgs::TY_FILE; + statArgs.mFileType = cFSStatArgs::TY_FILE; +#ifdef S_ISDIR else if (S_ISDIR(statbuf.st_mode)) - stat.mFileType = cFSStatArgs::TY_DIR; + statArgs.mFileType = cFSStatArgs::TY_DIR; +#endif +#ifdef S_ISLNK else if (S_ISLNK(statbuf.st_mode)) - stat.mFileType = cFSStatArgs::TY_SYMLINK; + statArgs.mFileType = cFSStatArgs::TY_SYMLINK; +#endif +#ifdef S_ISBLK else if (S_ISBLK(statbuf.st_mode)) - stat.mFileType = cFSStatArgs::TY_BLOCKDEV; + statArgs.mFileType = cFSStatArgs::TY_BLOCKDEV; +#endif +#ifdef S_ISCHR else if (S_ISCHR(statbuf.st_mode)) - stat.mFileType = cFSStatArgs::TY_CHARDEV; + statArgs.mFileType = cFSStatArgs::TY_CHARDEV; +#endif +#ifdef S_ISFIFO else if (S_ISFIFO(statbuf.st_mode)) - stat.mFileType = cFSStatArgs::TY_FIFO; + statArgs.mFileType = cFSStatArgs::TY_FIFO; +#endif #ifdef S_ISSOCK else if (S_ISSOCK(statbuf.st_mode)) - stat.mFileType = cFSStatArgs::TY_SOCK; + statArgs.mFileType = cFSStatArgs::TY_SOCK; #endif - -#if HAVE_DOOR_CREATE +#ifdef S_ISDOOR else if (S_ISDOOR(statbuf.st_mode)) - stat.mFileType = cFSStatArgs::TY_DOOR; + statArgs.mFileType = cFSStatArgs::TY_DOOR; #endif - -#if HAVE_PORT_CREATE +#ifdef S_ISPORT else if (S_ISPORT(statbuf.st_mode)) - stat.mFileType = cFSStatArgs::TY_PORT; + statArgs.mFileType = cFSStatArgs::TY_PORT; #endif - #ifdef S_ISNAM else if (S_ISNAM(statbuf.st_mode)) - stat.mFileType = cFSStatArgs::TY_NAMED; + statArgs.mFileType = cFSStatArgs::TY_NAMED; +#endif +#ifdef S_ISNATIVE + else if (S_ISNATIVE(statbuf.st_mode)) + statArgs.mFileType = cFSStatArgs::TY_NATIVE; +#endif +#ifdef S_TYPEISMQ + else if (S_TYPEISMQ(&statbuf)) + statArgs.mFileType = cFSStatArgs::TY_MESSAGE_QUEUE; +#endif +#ifdef S_TYPEISSEM + else if (S_TYPEISSEM(&statbuf)) + statArgs.mFileType = cFSStatArgs::TY_SEMAPHORE; +#endif +#ifdef S_TYPEISSHM + else if (S_TYPEISSHM(&statbuf)) + statArgs.mFileType = cFSStatArgs::TY_SHARED_MEMORY; #endif - else - stat.mFileType = cFSStatArgs::TY_INVALID; + statArgs.mFileType = cFSStatArgs::TY_INVALID; } void cUnixFSServices::GetMachineName(TSTRING& strName) const @@ -461,8 +518,8 @@ bool cUnixFSServices::FileDelete(const TSTRING& strName) const bool cUnixFSServices::GetCurrentUserName(TSTRING& strName) const { +#if HAVE_PWD_H bool fSuccess = false; - uid_t uid = getuid(); struct passwd* pp = getpwuid(uid); @@ -475,11 +532,15 @@ bool cUnixFSServices::GetCurrentUserName(TSTRING& strName) const strName = _T(""); return (fSuccess); +#else + strName = _T(""); + return true; +#endif } // returns IP address in network byte order -bool cUnixFSServices::GetIPAddress(uint32& uiIPAddress) +bool cUnixFSServices::GetIPAddress(uint32_t& uiIPAddress) { bool fGotAddress = false; cDebug d(_T("cUnixFSServices::GetIPAddress")); @@ -495,13 +556,13 @@ bool cUnixFSServices::GetIPAddress(uint32& uiIPAddress) if (phostent) { ASSERT(AF_INET == phostent->h_addrtype); - ASSERT(sizeof(int32) == phostent->h_length); + ASSERT(sizeof(int32_t) == phostent->h_length); if (phostent->h_length) { if (phostent->h_addr_list[0]) { - int32* pAddress = reinterpret_cast(phostent->h_addr_list[0]); + int32_t* pAddress = reinterpret_cast(phostent->h_addr_list[0]); uiIPAddress = *pAddress; fGotAddress = true; } @@ -537,6 +598,7 @@ bool cUnixFSServices::GetUserName(uid_t user_id, TSTRING& tstrUser) const { bool fSuccess = true; +#if HAVE_PWD_H if (mResolveNames) { struct passwd* pp = getpwuid(user_id); @@ -550,11 +612,14 @@ bool cUnixFSServices::GetUserName(uid_t user_id, TSTRING& tstrUser) const } else { - std::stringstream sstr; +#endif + TOSTRINGSTREAM sstr; sstr << user_id; - tstrUser = sstr.str(); + tss_stream_to_string(sstr, tstrUser); + +#if HAVE_PWD_H } - +#endif return (fSuccess); } @@ -563,7 +628,7 @@ bool cUnixFSServices::GetGroupName(gid_t group_id, TSTRING& tstrGroup) const { bool fSuccess = true; -#if !IS_REDOX +#if !IS_REDOX && HAVE_GRP_H if (mResolveNames) { struct group* pg = getgrgid(group_id); @@ -578,10 +643,11 @@ bool cUnixFSServices::GetGroupName(gid_t group_id, TSTRING& tstrGroup) const else { #endif - std::stringstream sstr; + TOSTRINGSTREAM sstr; sstr << group_id; - tstrGroup = sstr.str(); -#if !IS_REDOX + tss_stream_to_string(sstr, tstrGroup); + +#if !IS_REDOX && HAVE_GRP_H } #endif @@ -592,6 +658,12 @@ bool cUnixFSServices::GetGroupName(gid_t group_id, TSTRING& tstrGroup) const #ifndef S_ISVTX // DOS/DJGPP doesn't have this # define S_ISVTX 0 #endif +#ifndef S_ISUID +# define S_ISUID 0 +#endif +#ifndef S_ISGID +# define S_ISGID 0 +#endif //////////////////////////////////////////////////////////////////////// // Function name : cUnixFSServices::ConvertModeToString @@ -600,55 +672,67 @@ bool cUnixFSServices::GetGroupName(gid_t group_id, TSTRING& tstrGroup) const // // Returns : void -- no errors are reported // -// Argument : uint64 perm -- st_mode from "stat" +// Argument : uint64_t perm -- st_mode from "stat" // Argument : TSTRING& tstrPerm -- converted permissions, ls -l style // -void cUnixFSServices::ConvertModeToString(uint64 perm, TSTRING& tstrPerm) const +void cUnixFSServices::ConvertModeToString(uint64_t perm, TSTRING& tstrPerm) const { TCHAR szPerm[12]; //10 permission bits plus the NULL strncpy(szPerm, _T("----------"), 11); - ASSERT(sizeof(unsigned short) <= sizeof(uint32)); + ASSERT(sizeof(unsigned short) <= sizeof(uint32_t)); // We do this in case an "unsigned short" is ever larger than the // value we are switching on, since the size of the mode parameter // will be unsigned short (whatever that means, for the given platform...) // check file type - switch ((uint32)perm & S_IFMT) //some versions of Unix don't like to switch on + switch ((uint32_t)perm & S_IFMT) //some versions of Unix don't like to switch on //64 bit values. { +#ifdef S_IFDIR case S_IFDIR: szPerm[0] = _T('d'); break; +#endif +#ifdef S_IFCHR case S_IFCHR: szPerm[0] = _T('c'); break; +#endif +#ifdef S_IFBLK case S_IFBLK: szPerm[0] = _T('b'); break; +#endif +#ifdef S_IFIFO case S_IFIFO: szPerm[0] = _T('p'); break; +#endif +#ifdef S_IFLNK case S_IFLNK: szPerm[0] = _T('l'); break; - -#if HAVE_DOOR_CREATE // Solaris doors +#endif +#ifdef S_IFDOOR // Solaris doors case S_IFDOOR: szPerm[0] = _T('D'); break; #endif - -#if HAVE_PORT_CREATE // Solaris event ports +#ifdef S_IFPORT // Solaris event ports case S_IFPORT: szPerm[0] = _T('P'); break; #endif - #ifdef S_IFNAM case S_IFNAM: szPerm[0] = _T('n'); break; +#endif +#ifdef S_IFNATIVE + case S_IFNATIVE: + szPerm[0] = _T('?'); // TODO: check how this looks in qsh + break; #endif break; } diff --git a/src/core/unixfsservices.h b/src/core/unixfsservices.h index dae69bd..06644c3 100644 --- a/src/core/unixfsservices.h +++ b/src/core/unixfsservices.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -38,10 +38,6 @@ #ifndef __UNIXFSSERVICES_H #define __UNIXFSSERVICES_H -#if !IS_UNIX -#error unixfsservices.h should only be included for instantiating cUnixFSServices objects. If you just want to use iFSServices methods, include fsservices.h. -#endif - //========================================================================= // INCLUDES //========================================================================= @@ -109,7 +105,7 @@ public: virtual bool GetCurrentUserName(TSTRING& tstrName) const; - virtual bool GetIPAddress(uint32& uiIPAddress); + virtual bool GetIPAddress(uint32_t& uiIPAddress); //////////////////////////////////////// @@ -143,8 +139,8 @@ public: //////////////////////////////////////// // miscellaneous utility functions //////////////////////////////////////// - virtual void ConvertModeToString(uint64 perm, TSTRING& tstrPerm) const; - // takes a int64 permission (from stat) and changes it to look like UNIX's 'ls -l' (e.g. drwxrwxrwx) + virtual void ConvertModeToString(uint64_t perm, TSTRING& tstrPerm) const; + // takes a int64_t permission (from stat) and changes it to look like UNIX's 'ls -l' (e.g. drwxrwxrwx) virtual bool FullPath(TSTRING& fullPath, const TSTRING& relPath, const TSTRING& pathRelFrom = _T("")) const; // converts relPath into a fully qualified path, storing it in FullPath. If this // fails, false is returned. if the path to which relPath is relative is not CWD, put it in pathRelFrom. diff --git a/src/core/upperbound.h b/src/core/upperbound.h index 78d0fd9..8ad2dd2 100644 --- a/src/core/upperbound.h +++ b/src/core/upperbound.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/usernotify.cpp b/src/core/usernotify.cpp index 9508929..f2eb88b 100644 --- a/src/core/usernotify.cpp +++ b/src/core/usernotify.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/usernotify.h b/src/core/usernotify.h index ffdcb5b..8a9f173 100644 --- a/src/core/usernotify.h +++ b/src/core/usernotify.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/usernotifystdout.cpp b/src/core/usernotifystdout.cpp index 7418c76..160d272 100644 --- a/src/core/usernotifystdout.cpp +++ b/src/core/usernotifystdout.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/usernotifystdout.h b/src/core/usernotifystdout.h index eb8cde8..9e27bb4 100644 --- a/src/core/usernotifystdout.h +++ b/src/core/usernotifystdout.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/userstringmem.cpp b/src/core/userstringmem.cpp index bf94af9..f95ec66 100644 --- a/src/core/userstringmem.cpp +++ b/src/core/userstringmem.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/userstringmem.h b/src/core/userstringmem.h index 8c7a179..59925dc 100644 --- a/src/core/userstringmem.h +++ b/src/core/userstringmem.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/core/wchar16.cpp b/src/core/wchar16.cpp index efc9647..36545ae 100644 --- a/src/core/wchar16.cpp +++ b/src/core/wchar16.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -52,6 +52,7 @@ int wchar16len(const WCHAR16* s) return i; } +#if NEED_DBSTRING_IMPL //============================================================================= // class wc16_string // @@ -114,15 +115,19 @@ wc16_string::~wc16_string() mpData->Release(); } -void wc16_string::operator=(const wc16_string& rhs) +wc16_string& wc16_string::operator=(const wc16_string& rhs) { - if (mpData) - mpData->Release(); + if (this != &rhs) + { + if (mpData) + mpData->Release(); - mpData = rhs.mpData; + mpData = rhs.mpData; - if (mpData) - mpData->AddRef(); + if (mpData) + mpData->AddRef(); + } + return *this; } @@ -327,3 +332,22 @@ void wc16_string_impl::CopyString(const wc16_string_impl& rhs) memcpy(this->pString, rhs.pString, newlen * sizeof(WCHAR16)); } +#endif + +namespace tss +{ +void swapbytes(wc16_string& str) +{ +#if NEED_DBSTRING_IMPL + str.swapbytes(); +#else + size_t len = str.length(); + for (size_t x=0; x < len; x++) + { + WCHAR16 current = str[x]; + str[x] = ((current >> 8) | ((current & 0xFF) << 8)); + } +#endif +} +} + diff --git a/src/core/wchar16.h b/src/core/wchar16.h index 10bed6f..5d93d02 100644 --- a/src/core/wchar16.h +++ b/src/core/wchar16.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -38,16 +38,23 @@ #ifndef __WCHAR16_H #define __WCHAR16_H +#include "platform.h" + // TODO: Perhaps WCHAR16 should come out of types.h??? #ifndef __TYPES_H #include "types.h" #endif #if WCHAR_IS_16_BITS -typedef unsigned short WCHAR16; +typedef wchar_t WCHAR16; +typedef std::wstring wc16_string; + +#elif USE_U16STRING +typedef char16_t WCHAR16; +typedef std::u16string wc16_string; + #else -typedef uint16 WCHAR16; // unix has 4 byte wchar_t, but we want to standardize on 16 bit wide chars -#endif +typedef uint16_t WCHAR16; // unix has 4 byte wchar_t, but we want to standardize on 16 bit wide chars //============================================================================= // class wc16_string @@ -82,7 +89,7 @@ public: ~wc16_string(); - void operator=(const wc16_string& rhs); + wc16_string& operator=(const wc16_string& rhs); int compare(const wc16_string& rhs) const; size_type length() const; @@ -111,5 +118,17 @@ public: private: wc16_string_impl* mpData; }; - #endif + +namespace tss +{ + void swapbytes(wc16_string& str); +} + +#ifndef WORDS_BIGENDIAN +#define TSS_SwapBytes(x) tss::swapbytes(x) +#else +#define TSS_SwapBytes(x) +#endif + +#endif // __WCHAR16_H diff --git a/src/cryptlib/Makefile.in b/src/cryptlib/Makefile.in index 4f6d772..c92cb75 100644 --- a/src/cryptlib/Makefile.in +++ b/src/cryptlib/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -131,7 +131,7 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) @@ -303,6 +303,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -355,8 +356,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -461,7 +462,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/src/cryptlib/asn.cpp b/src/cryptlib/asn.cpp index d5265e6..320f850 100644 --- a/src/cryptlib/asn.cpp +++ b/src/cryptlib/asn.cpp @@ -6,19 +6,19 @@ #include #include -unsigned int DERLengthEncode(unsigned int length, byte *output) +unsigned int DERLengthEncode(unsigned int length, uint8_t *output) { unsigned int i=0; if (length <= 0x7f) { - output[i++] = byte(length); + output[i++] = uint8_t(length); } else { - output[i++] = byte(BytePrecision(length) | 0x80); + output[i++] = uint8_t(BytePrecision(length) | 0x80); for (int j=BytePrecision(length); j; --j) { - output[i++] = byte (length >> (j-1)*8); + output[i++] = uint8_t (length >> (j-1)*8); } } return i; @@ -26,7 +26,7 @@ unsigned int DERLengthEncode(unsigned int length, byte *output) unsigned int DERLengthEncode(unsigned int length, BufferedTransformation &bt) { - byte buf[10]; // should be more than enough + uint8_t buf[10]; // should be more than enough unsigned int i = DERLengthEncode(length, buf); assert(i <= 10); bt.Put(buf, i); @@ -35,7 +35,7 @@ unsigned int DERLengthEncode(unsigned int length, BufferedTransformation &bt) bool BERLengthDecode(BufferedTransformation &bt, unsigned int &length) { - byte b; + uint8_t b; if (!bt.Get(b)) BERDecodeError(); @@ -76,7 +76,7 @@ bool BERLengthDecode(BufferedTransformation &bt, unsigned int &length) BERSequenceDecoder::BERSequenceDecoder(BufferedTransformation &inQueue) : inQueue(inQueue) { - byte b; + uint8_t b; if (!inQueue.Get(b) || b != (SEQUENCE | CONSTRUCTED)) BERDecodeError(); diff --git a/src/cryptlib/asn.h b/src/cryptlib/asn.h index 13c18e1..f2378d8 100644 --- a/src/cryptlib/asn.h +++ b/src/cryptlib/asn.h @@ -8,7 +8,7 @@ enum ASNTag {INTEGER=0x02, BIT_STRING=0x03, SEQUENCE=0x10}; enum ASNIdFlag {CONSTRUCTED = 0x20}; -unsigned int DERLengthEncode(unsigned int length, byte *output); +unsigned int DERLengthEncode(unsigned int length, uint8_t *output); unsigned int DERLengthEncode(unsigned int length, BufferedTransformation &); #ifdef THROW_EXCEPTIONS @@ -27,16 +27,16 @@ public: BERSequenceDecoder(BufferedTransformation &inQueue); ~BERSequenceDecoder(); - void Put(byte) {} - void Put(const byte *, unsigned int) {} + void Put(uint8_t) {} + void Put(const uint8_t *, unsigned int) {} unsigned long MaxRetrieveable() {return inQueue.MaxRetrieveable();} - unsigned int Get(byte &outByte) + unsigned int Get(uint8_t &outByte) {return inQueue.Get(outByte);} - unsigned int Get(byte *outString, unsigned int getMax) + unsigned int Get(uint8_t *outString, unsigned int getMax) {return inQueue.Get(outString, getMax);} - unsigned int Peek(byte &outByte) const + unsigned int Peek(uint8_t &outByte) const {return inQueue.Peek(outByte);} private: diff --git a/src/cryptlib/config.h b/src/cryptlib/config.h index 77f06de..fa098e9 100644 --- a/src/cryptlib/config.h +++ b/src/cryptlib/config.h @@ -1,8 +1,12 @@ #ifndef CONFIG_H #define CONFIG_H -#ifdef HAVE_CONFIG_H -#include +#if HAVE_CONFIG_H +# include +#endif + +#if HAVE_STDINT_H +# include #endif // define this if you want the library to throw exceptions when things go wrong @@ -82,7 +86,13 @@ // Make sure these typedefs are correct for your computer -typedef unsigned char byte; +#if CPLUSPLUS_PRE_2011 +typedef unsigned char uint8_t; +#else +#include +#endif + +#if CPLUSPLUS_PRE_2011 typedef unsigned short word16; #if SIZEOF_INT == 4 typedef unsigned int word32; @@ -91,16 +101,20 @@ typedef unsigned short word16; #else #error "I don't seem to have a 32-bit integer type on this system." #endif +#else +typedef uint16_t word16; +typedef uint32_t word32; +#endif // word should have the same size as your CPU registers // dword should be twice as big as word #if defined(_MSC_VER) -typedef unsigned __int32 word; -typedef unsigned __int64 dword; +typedef unsigned __int32_t word; +typedef unsigned __int64_t dword; #define WORD64_AVAILABLE -typedef unsigned __int64 word64; +typedef unsigned __int64_t word64; #define W64LIT(x) x##i64 #elif defined(_KCC) @@ -141,16 +155,25 @@ typedef unsigned long long word64; #elif defined(__GNUC__) +#if CPLUSPLUS_PRE_2011 typedef word32 word; #if SIZEOF_LONG_LONG == 8 typedef unsigned long long dword; #define WORD64_AVAILABLE typedef unsigned long long word64; #define W64LIT(x) x##LL - #else +#else #error "I don't seem to have a 64-bit integer type on this system." #endif -#else +#else // CPLUSPLUS_PRE_2011 + +typedef uint32_t word; +typedef uint64_t dword; +typedef uint64_t word64; + +#endif + +#else // compiler type typedef unsigned int word; typedef unsigned long dword; @@ -158,7 +181,7 @@ typedef unsigned long dword; #endif // You may need to tweak this to fit your architecture -typedef unsigned long ptr_size_type; +typedef uintptr_t ptr_size_type; const unsigned int WORD_SIZE = sizeof(word); const unsigned int WORD_BITS = WORD_SIZE * 8; diff --git a/src/cryptlib/cryptest.dsp b/src/cryptlib/cryptest.dsp deleted file mode 100644 index 73e5eea..0000000 --- a/src/cryptlib/cryptest.dsp +++ /dev/null @@ -1,328 +0,0 @@ -# Microsoft Developer Studio Project File - Name="cryptest" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=cryptest - Win32 Unicode Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "cryptest.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "cryptest.mak" CFG="cryptest - Win32 Unicode Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "cryptest - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "cryptest - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "cryptest - Win32 Unicode Release" (based on "Win32 (x86) Console Application") -!MESSAGE "cryptest - Win32 Unicode Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/cryptlib/cryptest", FWAAAAAA" -# PROP Scc_LocalPath "." -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "cryptest - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "cryptes0" -# PROP BASE Intermediate_Dir "cryptes0" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "CTRelease" -# PROP Intermediate_Dir "CTRelease" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_LITTLE_ENDIAN" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib shell32.lib lib_r/cryptlib.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "cryptest - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "cryptes1" -# PROP BASE Intermediate_Dir "cryptes1" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "CTDebug" -# PROP Intermediate_Dir "CTDebug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_LITTLE_ENDIAN" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib advapi32.lib lib_d/cryptlib.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ELSEIF "$(CFG)" == "cryptest - Win32 Unicode Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "cryptest___Win32_Unicode_Release" -# PROP BASE Intermediate_Dir "cryptest___Win32_Unicode_Release" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "cryptest_Unicode_Release" -# PROP Intermediate_Dir "cryptest_Unicode_Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_LITTLE_ENDIAN" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_LITTLE_ENDIAN" /D "_UNICODE" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib shell32.lib lib_r/cryptlib.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib shell32.lib cryptlib_Unicode_Release/cryptlib.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "cryptest - Win32 Unicode Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "cryptest___Win32_Unicode_Debug" -# PROP BASE Intermediate_Dir "cryptest___Win32_Unicode_Debug" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "cryptest_Unicode_Debug" -# PROP Intermediate_Dir "cryptest_Unicode_Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_LITTLE_ENDIAN" /YX /FD /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_LITTLE_ENDIAN" /D "_UNICODE" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib lib_d/cryptlib.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib advapi32.lib cryptlib_Unicode_Debug/cryptlib.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "cryptest - Win32 Release" -# Name "cryptest - Win32 Debug" -# Name "cryptest - Win32 Unicode Release" -# Name "cryptest - Win32 Unicode Debug" -# Begin Group "Data Files" - -# PROP Default_Filter ".dat;.txt" -# Begin Source File - -SOURCE=.\3wayval.dat -# End Source File -# Begin Source File - -SOURCE=.\blum1024.dat -# End Source File -# Begin Source File - -SOURCE=.\blum2048.dat -# End Source File -# Begin Source File - -SOURCE=.\blum512.dat -# End Source File -# Begin Source File - -SOURCE=.\castval.dat -# End Source File -# Begin Source File - -SOURCE=.\descert.dat -# End Source File -# Begin Source File - -SOURCE=.\dhparams.dat -# End Source File -# Begin Source File - -SOURCE=.\diamond.dat -# End Source File -# Begin Source File - -SOURCE=.\dsa1024.dat -# End Source File -# Begin Source File - -SOURCE=.\dsa512.dat -# End Source File -# Begin Source File - -SOURCE=.\elgc1024.dat -# End Source File -# Begin Source File - -SOURCE=.\elgc2048.dat -# End Source File -# Begin Source File - -SOURCE=.\elgc512.dat -# End Source File -# Begin Source File - -SOURCE=.\elgs1024.dat -# End Source File -# Begin Source File - -SOURCE=.\elgs2048.dat -# End Source File -# Begin Source File - -SOURCE=.\elgs512.dat -# End Source File -# Begin Source File - -SOURCE=.\gostval.dat -# End Source File -# Begin Source File - -SOURCE=.\havalcer.dat -# End Source File -# Begin Source File - -SOURCE=.\ideaval.dat -# End Source File -# Begin Source File - -SOURCE=.\luc1024.dat -# End Source File -# Begin Source File - -SOURCE=.\luc2048.dat -# End Source File -# Begin Source File - -SOURCE=.\luc512.dat -# End Source File -# Begin Source File - -SOURCE=.\lucc1024.dat -# End Source File -# Begin Source File - -SOURCE=.\lucc512.dat -# End Source File -# Begin Source File - -SOURCE=.\lucdif.dat -# End Source File -# Begin Source File - -SOURCE=.\lucs1024.dat -# End Source File -# Begin Source File - -SOURCE=.\lucs512.dat -# End Source File -# Begin Source File - -SOURCE=.\rabi1024.dat -# End Source File -# Begin Source File - -SOURCE=.\rabi2048.dat -# End Source File -# Begin Source File - -SOURCE=.\rabi512.dat -# End Source File -# Begin Source File - -SOURCE=.\rc5val.dat -# End Source File -# Begin Source File - -SOURCE=.\rsa1024.dat -# End Source File -# Begin Source File - -SOURCE=.\rsa2048.dat -# End Source File -# Begin Source File - -SOURCE=.\rsa512.dat -# End Source File -# Begin Source File - -SOURCE=.\rsa512a.dat -# End Source File -# Begin Source File - -SOURCE=.\saferval.dat -# End Source File -# Begin Source File - -SOURCE=.\sharkval.dat -# End Source File -# Begin Source File - -SOURCE=.\squareva.dat -# End Source File -# Begin Source File - -SOURCE=.\usage.dat -# End Source File -# End Group -# Begin Source File - -SOURCE=.\bench.cpp -# End Source File -# Begin Source File - -SOURCE=.\bench.h -# End Source File -# Begin Source File - -SOURCE=.\test.cpp -# End Source File -# Begin Source File - -SOURCE=.\validat1.cpp -# End Source File -# Begin Source File - -SOURCE=.\validat2.cpp -# End Source File -# Begin Source File - -SOURCE=.\validat3.cpp -# End Source File -# Begin Source File - -SOURCE=.\validate.h -# End Source File -# End Target -# End Project diff --git a/src/cryptlib/cryptest.dsw b/src/cryptlib/cryptest.dsw deleted file mode 100644 index 7a55b03..0000000 --- a/src/cryptlib/cryptest.dsw +++ /dev/null @@ -1,52 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "cryptest"=".\cryptest.dsp" - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Code/crypto++", JAHAAAAA - . - end source code control -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name cryptlib - End Project Dependency -}}} - -############################################################################### - -Project: "cryptlib"=".\cryptlib.dsp" - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Code/crypto++", JAHAAAAA - . - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/cryptlib/cryptlib.cpp b/src/cryptlib/cryptlib.cpp index 06c091b..528b695 100644 --- a/src/cryptlib/cryptlib.cpp +++ b/src/cryptlib/cryptlib.cpp @@ -9,7 +9,7 @@ unsigned int RandomNumberGenerator::GetBit() return Parity(GetByte()); } -void RandomNumberGenerator::GetBlock(byte *output, unsigned int size) +void RandomNumberGenerator::GetBlock(uint8_t *output, unsigned int size) { while (size--) *output++ = GetByte(); @@ -35,19 +35,19 @@ word32 RandomNumberGenerator::GetLong(word32 min, word32 max) return value+min; } -void StreamCipher::ProcessString(byte *outString, const byte *inString, unsigned int length) +void StreamCipher::ProcessString(uint8_t *outString, const uint8_t *inString, unsigned int length) { while(length--) *outString++ = ProcessByte(*inString++); } -void StreamCipher::ProcessString(byte *inoutString, unsigned int length) +void StreamCipher::ProcessString(uint8_t *inoutString, unsigned int length) { for(;length--; inoutString++) *inoutString = ProcessByte(*inoutString); } -bool MessageAuthenticationCode::Verify(const byte *macIn) +bool MessageAuthenticationCode::Verify(const uint8_t *macIn) { SecByteBlock mac(DigestSize()); Final(mac); @@ -82,11 +82,11 @@ void BufferedTransformation::PutShort(word16 value, bool highFirst) if (highFirst) { Put(value>>8); - Put(byte(value)); + Put(uint8_t(value)); } else { - Put(byte(value)); + Put(uint8_t(value)); Put(value>>8); } } @@ -96,12 +96,12 @@ void BufferedTransformation::PutLong(word32 value, bool highFirst) if (highFirst) { for (int i=0; i<4; i++) - Put(byte(value>>((3-i)*8))); + Put(uint8_t(value>>((3-i)*8))); } else { for (int i=0; i<4; i++) - Put(byte(value>>(i*8))); + Put(uint8_t(value>>(i*8))); } } @@ -110,7 +110,7 @@ int BufferedTransformation::GetShort(word16 &value, bool highFirst) if (MaxRetrieveable()<2) return 0; - byte buf[2]; + uint8_t buf[2]; Get(buf, 2); if (highFirst) @@ -126,7 +126,7 @@ int BufferedTransformation::GetLong(word32 &value, bool highFirst) if (MaxRetrieveable()<4) return 0; - byte buf[4]; + uint8_t buf[4]; Get(buf, 4); if (highFirst) @@ -139,7 +139,7 @@ int BufferedTransformation::GetLong(word32 &value, bool highFirst) unsigned int BufferedTransformation::Skip(unsigned int skipMax) { - byte b; + uint8_t b; unsigned int skipActual=0; while (skipMax-- && Get(b)) @@ -163,7 +163,7 @@ unsigned int PK_FixedLengthCryptoSystem::CipherTextLength(unsigned int plainText return 0; } -unsigned int PK_FixedLengthDecryptor::Decrypt(const byte *cipherText, unsigned int cipherTextLength, byte *plainText) +unsigned int PK_FixedLengthDecryptor::Decrypt(const uint8_t *cipherText, unsigned int cipherTextLength, uint8_t *plainText) { if (cipherTextLength != CipherTextLength()) return 0; @@ -171,7 +171,7 @@ unsigned int PK_FixedLengthDecryptor::Decrypt(const byte *cipherText, unsigned i return Decrypt(cipherText, plainText); } -bool PK_VerifierWithRecovery::Verify(const byte *message, unsigned int messageLength, const byte *signature) +bool PK_VerifierWithRecovery::Verify(const uint8_t *message, unsigned int messageLength, const uint8_t *signature) { SecByteBlock recovered(MaxMessageLength()); unsigned int rLen = Recover(signature, recovered); diff --git a/src/cryptlib/cryptlib.dsp b/src/cryptlib/cryptlib.dsp deleted file mode 100644 index 60efd6c..0000000 --- a/src/cryptlib/cryptlib.dsp +++ /dev/null @@ -1,776 +0,0 @@ -# Microsoft Developer Studio Project File - Name="cryptlib" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=cryptlib - Win32 Unicode Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "cryptlib.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "cryptlib.mak" CFG="cryptlib - Win32 Unicode Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "cryptlib - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "cryptlib - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE "cryptlib - Win32 Unicode Release MinDependency" (based on "Win32 (x86) Static Library") -!MESSAGE "cryptlib - Win32 Unicode Release" (based on "Win32 (x86) Static Library") -!MESSAGE "cryptlib - Win32 Unicode Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/Code/Tripwire/2.0/ZZZ Consolidation Test/crypto", BAAAAAAA" -# PROP Scc_LocalPath "." -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "cryptlib - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "cryptlib" -# PROP BASE Intermediate_Dir "cryptlib" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "lib_r" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "_LITTLE_ENDIAN" /Yu"pch.h" /FD /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "cryptlib - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "cryptli0" -# PROP BASE Intermediate_Dir "cryptli0" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "lib_d" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "_LITTLE_ENDIAN" /Yu"pch.h" /FD /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "cryptlib - Win32 Unicode Release MinDependency" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "cryptlib" -# PROP BASE Intermediate_Dir "cryptlib" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "../lib_r" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /Yu"pch.h" /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "_LITTLE_ENDIAN" /Yu"pch.h" /FD /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "cryptlib - Win32 Unicode Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "cryptlib___Win32_Unicode_Release" -# PROP BASE Intermediate_Dir "cryptlib___Win32_Unicode_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "cryptlib_Unicode_Release" -# PROP Intermediate_Dir "cryptlib_Unicode_Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "_LITTLE_ENDIAN" /Yu"pch.h" /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "_LITTLE_ENDIAN" /D "_UNICODE" /Yu"pch.h" /FD /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "cryptlib - Win32 Unicode Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "cryptlib___Win32_Unicode_Debug" -# PROP BASE Intermediate_Dir "cryptlib___Win32_Unicode_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "cryptlib_Unicode_Debug" -# PROP Intermediate_Dir "cryptlib_Unicode_Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "_LITTLE_ENDIAN" /Yu"pch.h" /FD /c -# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "_LITTLE_ENDIAN" /D "_UNICODE" /Yu"pch.h" /FD /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "cryptlib - Win32 Release" -# Name "cryptlib - Win32 Debug" -# Name "cryptlib - Win32 Unicode Release MinDependency" -# Name "cryptlib - Win32 Unicode Release" -# Name "cryptlib - Win32 Unicode Debug" -# Begin Source File - -SOURCE=.\3way.cpp -# End Source File -# Begin Source File - -SOURCE=.\3way.h -# End Source File -# Begin Source File - -SOURCE=.\algebra.cpp -# End Source File -# Begin Source File - -SOURCE=.\algebra.h -# End Source File -# Begin Source File - -SOURCE=.\asn.cpp -# End Source File -# Begin Source File - -SOURCE=.\asn.h -# End Source File -# Begin Source File - -SOURCE=.\base64.cpp -# End Source File -# Begin Source File - -SOURCE=.\base64.h -# End Source File -# Begin Source File - -SOURCE=.\bfinit.cpp -# End Source File -# Begin Source File - -SOURCE=.\blowfish.cpp -# End Source File -# Begin Source File - -SOURCE=.\blowfish.h -# End Source File -# Begin Source File - -SOURCE=.\blumgold.cpp -# End Source File -# Begin Source File - -SOURCE=.\blumgold.h -# End Source File -# Begin Source File - -SOURCE=.\blumshub.cpp -# End Source File -# Begin Source File - -SOURCE=.\blumshub.h -# End Source File -# Begin Source File - -SOURCE=.\cast.cpp -# End Source File -# Begin Source File - -SOURCE=.\cast.h -# End Source File -# Begin Source File - -SOURCE=.\cast128s.cpp -# End Source File -# Begin Source File - -SOURCE=.\config.h -# End Source File -# Begin Source File - -SOURCE=.\crc.cpp -# End Source File -# Begin Source File - -SOURCE=.\crc.h -# End Source File -# Begin Source File - -SOURCE=.\cryptlib.cpp -# End Source File -# Begin Source File - -SOURCE=.\cryptlib.h -# End Source File -# Begin Source File - -SOURCE=.\default.cpp -# End Source File -# Begin Source File - -SOURCE=.\default.h -# End Source File -# Begin Source File - -SOURCE=.\des.cpp -# End Source File -# Begin Source File - -SOURCE=.\des.h -# End Source File -# Begin Source File - -SOURCE=.\dessp.cpp -# End Source File -# Begin Source File - -SOURCE=.\dh.cpp -# End Source File -# Begin Source File - -SOURCE=.\dh.h -# End Source File -# Begin Source File - -SOURCE=.\diamond.cpp -# End Source File -# Begin Source File - -SOURCE=.\diamond.h -# End Source File -# Begin Source File - -SOURCE=.\diamondt.cpp -# End Source File -# Begin Source File - -SOURCE=.\dsa.cpp -# End Source File -# Begin Source File - -SOURCE=.\dsa.h -# End Source File -# Begin Source File - -SOURCE=.\ec2n.cpp -# End Source File -# Begin Source File - -SOURCE=.\ec2n.h -# End Source File -# Begin Source File - -SOURCE=.\eccrypto.cpp -# End Source File -# Begin Source File - -SOURCE=.\eccrypto.h -# End Source File -# Begin Source File - -SOURCE=.\ecp.cpp -# End Source File -# Begin Source File - -SOURCE=.\ecp.h -# End Source File -# Begin Source File - -SOURCE=.\elgamal.cpp -# End Source File -# Begin Source File - -SOURCE=.\elgamal.h -# End Source File -# Begin Source File - -SOURCE=.\eprecomp.cpp -# End Source File -# Begin Source File - -SOURCE=.\eprecomp.h -# End Source File -# Begin Source File - -SOURCE=.\files.cpp -# End Source File -# Begin Source File - -SOURCE=.\files.h -# End Source File -# Begin Source File - -SOURCE=.\filters.cpp -# End Source File -# Begin Source File - -SOURCE=.\filters.h -# End Source File -# Begin Source File - -SOURCE=.\forkjoin.cpp -# End Source File -# Begin Source File - -SOURCE=.\forkjoin.h -# End Source File -# Begin Source File - -SOURCE=.\fstream -# End Source File -# Begin Source File - -SOURCE=.\gf256.cpp -# End Source File -# Begin Source File - -SOURCE=.\gf256.h -# End Source File -# Begin Source File - -SOURCE=.\gf2_32.cpp -# End Source File -# Begin Source File - -SOURCE=.\gf2_32.h -# End Source File -# Begin Source File - -SOURCE=.\gf2n.cpp -# End Source File -# Begin Source File - -SOURCE=.\gf2n.h -# End Source File -# Begin Source File - -SOURCE=.\gost.cpp -# End Source File -# Begin Source File - -SOURCE=.\gost.h -# End Source File -# Begin Source File - -SOURCE=.\gzip.cpp -# End Source File -# Begin Source File - -SOURCE=.\gzip.h -# End Source File -# Begin Source File - -SOURCE=.\haval.cpp -# End Source File -# Begin Source File - -SOURCE=.\haval.h -# End Source File -# Begin Source File - -SOURCE=.\hex.cpp -# End Source File -# Begin Source File - -SOURCE=.\hex.h -# End Source File -# Begin Source File - -SOURCE=.\hmac.h -# End Source File -# Begin Source File - -SOURCE=.\idea.cpp -# End Source File -# Begin Source File - -SOURCE=.\idea.h -# End Source File -# Begin Source File - -SOURCE=.\integer.cpp -# End Source File -# Begin Source File - -SOURCE=.\integer.h -# End Source File -# Begin Source File - -SOURCE=.\iomanip -# End Source File -# Begin Source File - -SOURCE=.\iosfwd -# End Source File -# Begin Source File - -SOURCE=.\iostream -# End Source File -# Begin Source File - -SOURCE=.\iterhash.cpp -# End Source File -# Begin Source File - -SOURCE=.\iterhash.h -# End Source File -# Begin Source File - -SOURCE=.\lubyrack.h -# End Source File -# Begin Source File - -SOURCE=.\luc.cpp -# End Source File -# Begin Source File - -SOURCE=.\luc.h -# End Source File -# Begin Source File - -SOURCE=.\md5.cpp -# End Source File -# Begin Source File - -SOURCE=.\md5.h -# End Source File -# Begin Source File - -SOURCE=.\md5mac.cpp -# End Source File -# Begin Source File - -SOURCE=.\md5mac.h -# End Source File -# Begin Source File - -SOURCE=.\mdc.h -# End Source File -# Begin Source File - -SOURCE=.\misc.cpp -# End Source File -# Begin Source File - -SOURCE=.\misc.h -# End Source File -# Begin Source File - -SOURCE=.\modarith.h -# End Source File -# Begin Source File - -SOURCE=.\modes.cpp -# End Source File -# Begin Source File - -SOURCE=.\modes.h -# End Source File -# Begin Source File - -SOURCE=.\nbtheory.cpp -# End Source File -# Begin Source File - -SOURCE=.\nbtheory.h -# End Source File -# Begin Source File - -SOURCE=.\oaep.cpp -# End Source File -# Begin Source File - -SOURCE=.\oaep.h -# End Source File -# Begin Source File - -SOURCE=.\pch.cpp -# ADD CPP /Yc"pch.h" -# End Source File -# Begin Source File - -SOURCE=.\pch.h -# End Source File -# Begin Source File - -SOURCE=.\pkcspad.cpp -# End Source File -# Begin Source File - -SOURCE=.\pkcspad.h -# End Source File -# Begin Source File - -SOURCE=.\polynomi.cpp -# End Source File -# Begin Source File - -SOURCE=.\polynomi.h -# End Source File -# Begin Source File - -SOURCE=.\pubkey.cpp -# End Source File -# Begin Source File - -SOURCE=.\pubkey.h -# End Source File -# Begin Source File - -SOURCE=.\queue.cpp -# End Source File -# Begin Source File - -SOURCE=.\queue.h -# End Source File -# Begin Source File - -SOURCE=.\rabin.cpp -# End Source File -# Begin Source File - -SOURCE=.\rabin.h -# End Source File -# Begin Source File - -SOURCE=.\randpool.cpp -# End Source File -# Begin Source File - -SOURCE=.\randpool.h -# End Source File -# Begin Source File - -SOURCE=.\rc5.cpp -# End Source File -# Begin Source File - -SOURCE=.\rc5.h -# End Source File -# Begin Source File - -SOURCE=.\ripemd.cpp -# End Source File -# Begin Source File - -SOURCE=.\ripemd.h -# End Source File -# Begin Source File - -SOURCE=.\rng.cpp -# End Source File -# Begin Source File - -SOURCE=.\rng.h -# End Source File -# Begin Source File - -SOURCE=.\rsa.cpp -# End Source File -# Begin Source File - -SOURCE=.\rsa.h -# End Source File -# Begin Source File - -SOURCE=.\rsarefcl.cpp -# End Source File -# Begin Source File - -SOURCE=.\rsarefcl.h -# End Source File -# Begin Source File - -SOURCE=.\safer.cpp -# End Source File -# Begin Source File - -SOURCE=.\safer.h -# End Source File -# Begin Source File - -SOURCE=.\sapphire.cpp -# End Source File -# Begin Source File - -SOURCE=.\sapphire.h -# End Source File -# Begin Source File - -SOURCE=.\seal.cpp -# End Source File -# Begin Source File - -SOURCE=.\seal.h -# End Source File -# Begin Source File - -SOURCE=.\secshare.cpp -# End Source File -# Begin Source File - -SOURCE=.\secshare.h -# End Source File -# Begin Source File - -SOURCE=.\secsplit.cpp -# End Source File -# Begin Source File - -SOURCE=.\secsplit.h -# End Source File -# Begin Source File - -SOURCE=.\sha.cpp -# End Source File -# Begin Source File - -SOURCE=.\sha.h -# End Source File -# Begin Source File - -SOURCE=.\shark.cpp -# End Source File -# Begin Source File - -SOURCE=.\shark.h -# End Source File -# Begin Source File - -SOURCE=.\sharkbox.cpp -# End Source File -# Begin Source File - -SOURCE=.\smartptr.h -# End Source File -# Begin Source File - -SOURCE=.\square.cpp -# End Source File -# Begin Source File - -SOURCE=.\square.h -# End Source File -# Begin Source File - -SOURCE=.\squaretb.cpp -# End Source File -# Begin Source File - -SOURCE=.\strstream -# End Source File -# Begin Source File - -SOURCE=.\tea.cpp -# End Source File -# Begin Source File - -SOURCE=.\tea.h -# End Source File -# Begin Source File - -SOURCE=.\tiger.cpp -# End Source File -# Begin Source File - -SOURCE=.\tiger.h -# End Source File -# Begin Source File - -SOURCE=.\tigertab.cpp -# End Source File -# Begin Source File - -SOURCE=.\wake.cpp -# End Source File -# Begin Source File - -SOURCE=.\wake.h -# End Source File -# Begin Source File - -SOURCE=.\words.h -# End Source File -# Begin Source File - -SOURCE=.\xormac.h -# End Source File -# Begin Source File - -SOURCE=.\zbits.cpp -# End Source File -# Begin Source File - -SOURCE=.\zbits.h -# End Source File -# Begin Source File - -SOURCE=.\zdeflate.cpp -# End Source File -# Begin Source File - -SOURCE=.\zdeflate.h -# End Source File -# Begin Source File - -SOURCE=.\zinflate.cpp -# End Source File -# Begin Source File - -SOURCE=.\zinflate.h -# End Source File -# Begin Source File - -SOURCE=.\ztrees.cpp -# End Source File -# Begin Source File - -SOURCE=.\ztrees.h -# End Source File -# End Target -# End Project diff --git a/src/cryptlib/cryptlib.h b/src/cryptlib/cryptlib.h index 145616f..6039c27 100644 --- a/src/cryptlib/cryptlib.h +++ b/src/cryptlib/cryptlib.h @@ -53,11 +53,11 @@ public: /// encrypt or decrypt one block in place //* Precondition: size of inoutBlock == BlockSize(). - virtual void ProcessBlock(byte *inoutBlock) =0; + virtual void ProcessBlock(uint8_t *inoutBlock) =0; /// encrypt or decrypt one block, may assume inBlock != outBlock //* Precondition: size of inBlock and outBlock == BlockSize(). - virtual void ProcessBlock(const byte *inBlock, byte *outBlock) =0; + virtual void ProcessBlock(const uint8_t *inBlock, uint8_t *outBlock) =0; /// block size of the cipher in bytes virtual unsigned int BlockSize() const =0; @@ -73,12 +73,12 @@ public: virtual ~StreamCipher() {} /// encrypt or decrypt one byte - virtual byte ProcessByte(byte input) =0; + virtual uint8_t ProcessByte(uint8_t input) =0; /// encrypt or decrypt an array of bytes of specified length in place - virtual void ProcessString(byte *inoutString, unsigned int length); + virtual void ProcessString(uint8_t *inoutString, unsigned int length); /// encrypt or decrypt an array of bytes of specified length, may assume inString != outString - virtual void ProcessString(byte *outString, const byte *inString, unsigned int length); + virtual void ProcessString(uint8_t *outString, const uint8_t *inString, unsigned int length); }; /// abstract base class for random access stream ciphers @@ -103,7 +103,7 @@ public: virtual ~RandomNumberGenerator() {} /// generate new random byte and return it - virtual byte GetByte() =0; + virtual uint8_t GetByte() =0; /// generate new random bit and return it /** Default implementation is to call GetByte() and return its parity. */ @@ -117,7 +117,7 @@ public: /// generate random array of bytes //* Default implementation is to call GetByte size times. - virtual void GetBlock(byte *output, unsigned int size); + virtual void GetBlock(uint8_t *output, unsigned int size); }; /// randomly shuffle the specified array, resulting permutation is uniformly distributed @@ -141,18 +141,18 @@ public: virtual ~HashModule() {} /// process more input - virtual void Update(const byte *input, unsigned int length) =0; + virtual void Update(const uint8_t *input, unsigned int length) =0; /*/ calculate hash for the current message (the concatenation of all inputs passed in via Update()), then reinitialize the object */ //* Precondition: size of digest == DigestSize(). - virtual void Final(byte *digest) =0; + virtual void Final(uint8_t *digest) =0; /// size of the hash returned by Final() virtual unsigned int DigestSize() const =0; /// use this if your input is short and you don't want to call Update() and Final() seperately - virtual void CalculateDigest(byte *digest, const byte *input, int length) + virtual void CalculateDigest(uint8_t *digest, const uint8_t *input, int length) {Update(input, length); Final(digest);} }; @@ -173,10 +173,10 @@ public: /// verify that mac is a valid MAC for the current message, then reinitialize the object /** Default implementation is to call Final() and do a bitwise comparison between its output and mac. */ - virtual bool Verify(const byte *mac); + virtual bool Verify(const uint8_t *mac); /// use this if your input is short and you don't want to call Update() and Verify() seperately - virtual bool VerifyMAC(const byte *mac, const byte *input, int length) + virtual bool VerifyMAC(const uint8_t *mac, const uint8_t *input, int length) {Update(input, length); return Verify(mac);} }; @@ -203,9 +203,9 @@ public: //@Man: INPUT //@{ /// input a byte for processing - virtual void Put(byte inByte) =0; + virtual void Put(uint8_t inByte) =0; /// input multiple bytes - virtual void Put(const byte *inString, unsigned int length) =0; + virtual void Put(const uint8_t *inString, unsigned int length) =0; /// signal that no more input is available virtual void InputFinished() {} @@ -224,9 +224,9 @@ public: virtual unsigned long MaxRetrieveable() =0; /// try to retrieve a single byte - virtual unsigned int Get(byte &outByte) =0; + virtual unsigned int Get(uint8_t &outByte) =0; /// try to retrieve multiple bytes - virtual unsigned int Get(byte *outString, unsigned int getMax) =0; + virtual unsigned int Get(uint8_t *outString, unsigned int getMax) =0; /// try to retrieve a 16-bit word, big-endian or little-endian depending on highFirst int GetShort(word16 &value, bool highFirst=true); @@ -239,7 +239,7 @@ public: virtual unsigned int TransferTo(BufferedTransformation &target, unsigned int transferMax); /// peek at the next byte without removing it from the output buffer - virtual unsigned int Peek(byte &outByte) const =0; + virtual unsigned int Peek(uint8_t &outByte) const =0; /// discard some bytes from the output buffer unsigned int Skip(unsigned int skipMax); @@ -299,7 +299,7 @@ public: \item size of cipherText == CipherTextLength(plainTextLength) \end{itemize} */ - virtual void Encrypt(RandomNumberGenerator &rng, const byte *plainText, unsigned int plainTextLength, byte *cipherText) =0; + virtual void Encrypt(RandomNumberGenerator &rng, const uint8_t *plainText, unsigned int plainTextLength, uint8_t *cipherText) =0; }; /// abstract base class for public-key decryptors @@ -317,7 +317,7 @@ public: The function returns the actual length of the plaintext, or 0 if decryption fails. */ - virtual unsigned int Decrypt(const byte *cipherText, unsigned int cipherTextLength, byte *plainText) =0; + virtual unsigned int Decrypt(const uint8_t *cipherText, unsigned int cipherTextLength, uint8_t *plainText) =0; }; /// abstract base class for encryptors and decryptors with fixed length ciphertext @@ -361,9 +361,9 @@ public: The function returns the actual length of the plaintext, or 0 if decryption fails. */ - virtual unsigned int Decrypt(const byte *cipherText, byte *plainText) =0; + virtual unsigned int Decrypt(const uint8_t *cipherText, uint8_t *plainText) =0; - unsigned int Decrypt(const byte *cipherText, unsigned int cipherTextLength, byte *plainText); + unsigned int Decrypt(const uint8_t *cipherText, unsigned int cipherTextLength, uint8_t *plainText); }; /// abstract base class for public-key signers and verifiers @@ -402,7 +402,7 @@ public: \item size of signature == SignatureLength() \end{itemize} */ - virtual void Sign(RandomNumberGenerator &rng, const byte *message, unsigned int messageLen, byte *signature) =0; + virtual void Sign(RandomNumberGenerator &rng, const uint8_t *message, unsigned int messageLen, uint8_t *signature) =0; }; /// abstract base class for public-key verifiers @@ -420,7 +420,7 @@ public: \item length of signature == SignatureLength() \end{itemize} */ - virtual bool Verify(const byte *message, unsigned int messageLen, const byte *sig) =0; + virtual bool Verify(const uint8_t *message, unsigned int messageLen, const uint8_t *sig) =0; }; /// abstract base class for public-key verifiers with recovery @@ -439,9 +439,9 @@ public: \item size of recoveredMessage == MaxMessageLength() \end{itemize} */ - virtual unsigned int Recover(const byte *signature, byte *recoveredMessage) =0; + virtual unsigned int Recover(const uint8_t *signature, uint8_t *recoveredMessage) =0; - bool Verify(const byte *message, unsigned int messageLen, const byte *signature); + bool Verify(const uint8_t *message, unsigned int messageLen, const uint8_t *signature); }; /// abstract base class for key agreement protocols @@ -471,7 +471,7 @@ public: /// produce public value //* Precondition: size of publicValue == PublicValueLength() - virtual void Setup(RandomNumberGenerator &rng, byte *publicValue) =0; + virtual void Setup(RandomNumberGenerator &rng, uint8_t *publicValue) =0; /// calculate agreed key given other party's public value /** Precondition: @@ -480,7 +480,7 @@ public: \item size of agreedKey == AgreedKeyLength() \end{itemize} */ - virtual void Agree(const byte *otherPublicValue, byte *agreedKey) const =0; + virtual void Agree(const uint8_t *otherPublicValue, uint8_t *agreedKey) const =0; }; /// abstract base class for all objects that support precomputation diff --git a/src/cryptlib/des.cpp b/src/cryptlib/des.cpp index eea35b4..05611f6 100644 --- a/src/cryptlib/des.cpp +++ b/src/cryptlib/des.cpp @@ -28,7 +28,7 @@ */ #ifdef notdef /* initial permutation IP */ -static byte ip[] = { +static uint8_t ip[] = { 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6, @@ -40,7 +40,7 @@ static byte ip[] = { }; /* final permutation IP^-1 */ -static byte fp[] = { +static uint8_t fp[] = { 40, 8, 48, 16, 56, 24, 64, 32, 39, 7, 47, 15, 55, 23, 63, 31, 38, 6, 46, 14, 54, 22, 62, 30, @@ -51,7 +51,7 @@ static byte fp[] = { 33, 1, 41, 9, 49, 17, 57, 25 }; /* expansion operation matrix */ -static byte ei[] = { +static uint8_t ei[] = { 32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, 8, 9, 10, 11, 12, 13, @@ -62,7 +62,7 @@ static byte ei[] = { 28, 29, 30, 31, 32, 1 }; /* The (in)famous S-boxes */ -static byte sbox[8][64] = { +static uint8_t sbox[8][64] = { /* S1 */ 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7, 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8, @@ -113,7 +113,7 @@ static byte sbox[8][64] = { }; /* 32-bit permutation function P used on the output of the S-boxes */ -static byte p32i[] = { +static uint8_t p32i[] = { 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, @@ -126,7 +126,7 @@ static byte p32i[] = { #endif /* permuted choice table (key) */ -static const byte pc1[] = { +static const uint8_t pc1[] = { 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, @@ -139,12 +139,12 @@ static const byte pc1[] = { }; /* number left rotations of pc1 */ -static const byte totrot[] = { +static const uint8_t totrot[] = { 1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28 }; /* permuted choice key (table) */ -static const byte pc2[] = { +static const uint8_t pc2[] = { 14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, @@ -163,14 +163,14 @@ static const int bytebit[] = { }; /* Set key (initialize key schedule array) */ -DES::DES(const byte *key, CipherDir dir) +DES::DES(const uint8_t *key, CipherDir dir) : k(32) { SecByteBlock buffer(56+56+8); - byte *const pc1m=buffer; /* place to modify pc1 into */ - byte *const pcr=pc1m+56; /* place to rotate pc1 into */ - byte *const ks=pcr+56; - register unsigned int i,j,l; + uint8_t *const pc1m=buffer; /* place to modify pc1 into */ + uint8_t *const pcr=pc1m+56; /* place to rotate pc1 into */ + uint8_t *const ks=pcr+56; + unsigned int i,j,l; int m; for (j=0; j<56; j++) { /* convert pc1 to bits of key */ @@ -311,7 +311,7 @@ inline void FPERM(word32 &left, word32 &right) } // Encrypt or decrypt a block of data in ECB mode -void DES::ProcessBlock(const byte *inBlock, byte * outBlock) +void DES::ProcessBlock(const uint8_t *inBlock, uint8_t * outBlock) { word32 l,r,work; @@ -363,56 +363,56 @@ void DES::ProcessBlock(const byte *inBlock, byte * outBlock) #endif } -void DES_EDE_Encryption::ProcessBlock(byte *inoutBlock) +void DES_EDE_Encryption::ProcessBlock(uint8_t *inoutBlock) { e.ProcessBlock(inoutBlock); d.ProcessBlock(inoutBlock); e.ProcessBlock(inoutBlock); } -void DES_EDE_Encryption::ProcessBlock(const byte *inBlock, byte *outBlock) +void DES_EDE_Encryption::ProcessBlock(const uint8_t *inBlock, uint8_t *outBlock) { e.ProcessBlock(inBlock, outBlock); d.ProcessBlock(outBlock); e.ProcessBlock(outBlock); } -void DES_EDE_Decryption::ProcessBlock(byte *inoutBlock) +void DES_EDE_Decryption::ProcessBlock(uint8_t *inoutBlock) { d.ProcessBlock(inoutBlock); e.ProcessBlock(inoutBlock); d.ProcessBlock(inoutBlock); } -void DES_EDE_Decryption::ProcessBlock(const byte *inBlock, byte *outBlock) +void DES_EDE_Decryption::ProcessBlock(const uint8_t *inBlock, uint8_t *outBlock) { d.ProcessBlock(inBlock, outBlock); e.ProcessBlock(outBlock); d.ProcessBlock(outBlock); } -void TripleDES_Encryption::ProcessBlock(byte *inoutBlock) +void TripleDES_Encryption::ProcessBlock(uint8_t *inoutBlock) { e1.ProcessBlock(inoutBlock); d.ProcessBlock(inoutBlock); e2.ProcessBlock(inoutBlock); } -void TripleDES_Encryption::ProcessBlock(const byte *inBlock, byte *outBlock) +void TripleDES_Encryption::ProcessBlock(const uint8_t *inBlock, uint8_t *outBlock) { e1.ProcessBlock(inBlock, outBlock); d.ProcessBlock(outBlock); e2.ProcessBlock(outBlock); } -void TripleDES_Decryption::ProcessBlock(byte *inoutBlock) +void TripleDES_Decryption::ProcessBlock(uint8_t *inoutBlock) { d1.ProcessBlock(inoutBlock); e.ProcessBlock(inoutBlock); d2.ProcessBlock(inoutBlock); } -void TripleDES_Decryption::ProcessBlock(const byte *inBlock, byte *outBlock) +void TripleDES_Decryption::ProcessBlock(const uint8_t *inBlock, uint8_t *outBlock) { d1.ProcessBlock(inBlock, outBlock); e.ProcessBlock(outBlock); diff --git a/src/cryptlib/des.h b/src/cryptlib/des.h index 47688e5..99a357d 100644 --- a/src/cryptlib/des.h +++ b/src/cryptlib/des.h @@ -7,10 +7,10 @@ class DES : public BlockTransformation { public: - DES(const byte *userKey, CipherDir); + DES(const uint8_t *userKey, CipherDir); - void ProcessBlock(const byte *inBlock, byte * outBlock); - void ProcessBlock(byte * inoutBlock) + void ProcessBlock(const uint8_t *inBlock, uint8_t * outBlock); + void ProcessBlock(uint8_t * inoutBlock) {DES::ProcessBlock(inoutBlock, inoutBlock);} enum {KEYLENGTH=8, BLOCKSIZE=8}; @@ -25,25 +25,25 @@ protected: class DESEncryption : public DES { public: - DESEncryption(const byte * userKey) + DESEncryption(const uint8_t * userKey) : DES (userKey, ENCRYPTION) {} }; class DESDecryption : public DES { public: - DESDecryption(const byte * userKey) + DESDecryption(const uint8_t * userKey) : DES (userKey, DECRYPTION) {} }; class DES_EDE_Encryption : public BlockTransformation { public: - DES_EDE_Encryption(const byte * userKey) + DES_EDE_Encryption(const uint8_t * userKey) : e(userKey, ENCRYPTION), d(userKey + DES::KEYLENGTH, DECRYPTION) {} - void ProcessBlock(const byte *inBlock, byte * outBlock); - void ProcessBlock(byte * inoutBlock); + void ProcessBlock(const uint8_t *inBlock, uint8_t * outBlock); + void ProcessBlock(uint8_t * inoutBlock); enum {KEYLENGTH=16, BLOCKSIZE=8}; unsigned int BlockSize() const {return BLOCKSIZE;} @@ -55,11 +55,11 @@ private: class DES_EDE_Decryption : public BlockTransformation { public: - DES_EDE_Decryption(const byte * userKey) + DES_EDE_Decryption(const uint8_t * userKey) : d(userKey, DECRYPTION), e(userKey + DES::KEYLENGTH, ENCRYPTION) {} - void ProcessBlock(const byte *inBlock, byte * outBlock); - void ProcessBlock(byte * inoutBlock); + void ProcessBlock(const uint8_t *inBlock, uint8_t * outBlock); + void ProcessBlock(uint8_t * inoutBlock); enum {KEYLENGTH=16, BLOCKSIZE=8}; unsigned int BlockSize() const {return BLOCKSIZE;} @@ -71,12 +71,12 @@ private: class TripleDES_Encryption : public BlockTransformation { public: - TripleDES_Encryption(const byte * userKey) + TripleDES_Encryption(const uint8_t * userKey) : e1(userKey, ENCRYPTION), d(userKey + DES::KEYLENGTH, DECRYPTION), e2(userKey + 2*DES::KEYLENGTH, ENCRYPTION) {} - void ProcessBlock(const byte *inBlock, byte * outBlock); - void ProcessBlock(byte * inoutBlock); + void ProcessBlock(const uint8_t *inBlock, uint8_t * outBlock); + void ProcessBlock(uint8_t * inoutBlock); enum {KEYLENGTH=24, BLOCKSIZE=8}; unsigned int BlockSize() const {return BLOCKSIZE;} @@ -88,12 +88,12 @@ private: class TripleDES_Decryption : public BlockTransformation { public: - TripleDES_Decryption(const byte * userKey) + TripleDES_Decryption(const uint8_t * userKey) : d1(userKey + 2*DES::KEYLENGTH, DECRYPTION), e(userKey + DES::KEYLENGTH, ENCRYPTION), d2(userKey, DECRYPTION) {} - void ProcessBlock(const byte *inBlock, byte * outBlock); - void ProcessBlock(byte * inoutBlock); + void ProcessBlock(const uint8_t *inBlock, uint8_t * outBlock); + void ProcessBlock(uint8_t * inoutBlock); enum {KEYLENGTH=24, BLOCKSIZE=8}; unsigned int BlockSize() const {return BLOCKSIZE;} diff --git a/src/cryptlib/elgamal.cpp b/src/cryptlib/elgamal.cpp index 501e512..6cd1a4d 100644 --- a/src/cryptlib/elgamal.cpp +++ b/src/cryptlib/elgamal.cpp @@ -53,7 +53,7 @@ void ElGamalCryptoPublicKey::SavePrecomputation(BufferedTransformation &bt) cons ypc.Save(bt); } -void ElGamalCryptoPublicKey::Encrypt(RandomNumberGenerator &rng, const byte *plainText, unsigned int plainTextLength, byte *cipherText) +void ElGamalCryptoPublicKey::Encrypt(RandomNumberGenerator &rng, const uint8_t *plainText, unsigned int plainTextLength, uint8_t *cipherText) { assert(plainTextLength <= MaxPlainTextLength()); @@ -140,7 +140,7 @@ void ElGamalCryptoPrivateKey::DEREncode(BufferedTransformation &bt) const x.DEREncode(seq); } -unsigned int ElGamalCryptoPrivateKey::Decrypt(const byte *cipherText, byte *plainText) +unsigned int ElGamalCryptoPrivateKey::Decrypt(const uint8_t *cipherText, uint8_t *plainText) { Integer a(cipherText, modulusLen); Integer b(cipherText+modulusLen, modulusLen); @@ -211,7 +211,7 @@ void ElGamalSigPublicKey::SavePrecomputation(BufferedTransformation &bt) const ypc.Save(bt); } -bool ElGamalSigPublicKey::Verify(const byte *message, unsigned int messageLen, const byte *signature) +bool ElGamalSigPublicKey::Verify(const uint8_t *message, unsigned int messageLen, const uint8_t *signature) { assert(messageLen <= MaxMessageLength()); @@ -287,7 +287,7 @@ void ElGamalSigPrivateKey::DEREncode(BufferedTransformation &bt) const x.DEREncode(seq); } -void ElGamalSigPrivateKey::Sign(RandomNumberGenerator &rng, const byte *message, unsigned int messageLen, byte *signature) +void ElGamalSigPrivateKey::Sign(RandomNumberGenerator &rng, const uint8_t *message, unsigned int messageLen, uint8_t *signature) { assert(messageLen <= MaxMessageLength()); diff --git a/src/cryptlib/elgamal.h b/src/cryptlib/elgamal.h index 14e4605..14afd59 100644 --- a/src/cryptlib/elgamal.h +++ b/src/cryptlib/elgamal.h @@ -17,7 +17,7 @@ public: void LoadPrecomputation(BufferedTransformation &storedPrecomputation); void SavePrecomputation(BufferedTransformation &storedPrecomputation) const; - void Encrypt(RandomNumberGenerator &rng, const byte *plainText, unsigned int plainTextLength, byte *cipherText); + void Encrypt(RandomNumberGenerator &rng, const uint8_t *plainText, unsigned int plainTextLength, uint8_t *cipherText); unsigned int MaxPlainTextLength() const {return STDMIN(255U, modulusLen-3);} unsigned int CipherTextLength() const {return 2*modulusLen;} @@ -45,7 +45,7 @@ public: ElGamalCryptoPrivateKey(BufferedTransformation &bt); void DEREncode(BufferedTransformation &bt) const; - unsigned int Decrypt(const byte *cipherText, byte *plainText); + unsigned int Decrypt(const uint8_t *cipherText, uint8_t *plainText); protected: void RawDecrypt(const Integer &a, const Integer &b, Integer &m) const; @@ -65,7 +65,7 @@ public: void LoadPrecomputation(BufferedTransformation &storedPrecomputation); void SavePrecomputation(BufferedTransformation &storedPrecomputation) const; - bool Verify(const byte *message, unsigned int messageLen, const byte *signature); + bool Verify(const uint8_t *message, unsigned int messageLen, const uint8_t *signature); // message length for signature is unlimited, but only message digests should be signed unsigned int MaxMessageLength() const {return 0xffff;} @@ -97,7 +97,7 @@ public: ElGamalSigPrivateKey(BufferedTransformation &bt); void DEREncode(BufferedTransformation &bt) const; - void Sign(RandomNumberGenerator &rng, const byte *message, unsigned int messageLen, byte *signature); + void Sign(RandomNumberGenerator &rng, const uint8_t *message, unsigned int messageLen, uint8_t *signature); const Integer& GetParameterX() { return x; } diff --git a/src/cryptlib/filters.cpp b/src/cryptlib/filters.cpp index ef47f2a..bf4bbb3 100644 --- a/src/cryptlib/filters.cpp +++ b/src/cryptlib/filters.cpp @@ -51,7 +51,7 @@ void BlockFilterBase::ProcessBuf() inBufSize=0; } -void BlockFilterBase::Put(const byte *inString, unsigned int length) +void BlockFilterBase::Put(const uint8_t *inString, unsigned int length) { while (length--) BlockFilterBase::Put(*inString++); @@ -75,7 +75,7 @@ void BlockDecryptionFilter::InputFinished() inBufSize=0; } -void StreamCipherFilter::Put(const byte *inString, unsigned int length) +void StreamCipherFilter::Put(const uint8_t *inString, unsigned int length) { SecByteBlock temp(length); cipher.ProcessString(temp, inString, length); @@ -89,13 +89,13 @@ void HashFilter::InputFinished() outQueue->Put(buf, hash.DigestSize()); } -BufferedTransformation *Insert(const byte *in, unsigned int length, BufferedTransformation *outQueue) +BufferedTransformation *Insert(const uint8_t *in, unsigned int length, BufferedTransformation *outQueue) { outQueue->Put(in, length); return outQueue; } -unsigned int Extract(Source *source, byte *out, unsigned int length) +unsigned int Extract(Source *source, uint8_t *out, unsigned int length) { while (source->MaxRetrieveable() < length && source->Pump(1)); return source->Get(out, length); diff --git a/src/cryptlib/filters.h b/src/cryptlib/filters.h index 20862e3..16c5761 100644 --- a/src/cryptlib/filters.h +++ b/src/cryptlib/filters.h @@ -20,12 +20,12 @@ public: unsigned long MaxRetrieveable() {return outQueue->MaxRetrieveable();} - unsigned int Get(byte &outByte) + unsigned int Get(uint8_t &outByte) {return outQueue->Get(outByte);} - unsigned int Get(byte *outString, unsigned int getMax) + unsigned int Get(uint8_t *outString, unsigned int getMax) {return outQueue->Get(outString, getMax);} - unsigned int Peek(byte &outByte) const + unsigned int Peek(uint8_t &outByte) const {return outQueue->Peek(outByte);} BufferedTransformation *OutQueue() {return outQueue.get();} @@ -44,14 +44,14 @@ public: BufferedTransformation *outQueue); virtual ~BlockFilterBase() {} - void Put(byte inByte) + void Put(uint8_t inByte) { if (inBufSize == S) ProcessBuf(); inBuf[inBufSize++]=inByte; } - void Put(const byte *inString, unsigned int length); + void Put(const uint8_t *inString, unsigned int length); protected: void ProcessBuf(); @@ -89,10 +89,10 @@ public: BufferedTransformation *outQueue = NULL) : Filter(outQueue), cipher(c) {} - void Put(byte inByte) + void Put(uint8_t inByte) {outQueue->Put(cipher.ProcessByte(inByte));} - void Put(const byte *inString, unsigned int length); + void Put(const uint8_t *inString, unsigned int length); private: StreamCipher &cipher; @@ -106,10 +106,10 @@ public: void InputFinished(); - void Put(byte inByte) + void Put(uint8_t inByte) {hash.Update(&inByte, 1);} - void Put(const byte *inString, unsigned int length) + void Put(const uint8_t *inString, unsigned int length) {hash.Update(inString, length);} private: @@ -122,9 +122,9 @@ public: Source(BufferedTransformation *outQ = NULL) : Filter(outQ) {} - void Put(byte) + void Put(uint8_t) {Pump(1);} - void Put(const byte *, unsigned int length) + void Put(const uint8_t *, unsigned int length) {Pump(length);} void InputFinished() {PumpAll();} @@ -138,22 +138,22 @@ class Sink : public BufferedTransformation public: unsigned long MaxRetrieveable() {return 0;} - unsigned int Get(byte &) + unsigned int Get(uint8_t &) {return 0;} - unsigned int Get(byte *, unsigned int) + unsigned int Get(uint8_t *, unsigned int) {return 0;} - unsigned int Peek(byte &) const + unsigned int Peek(uint8_t &) const {return 0;} }; class BitBucket : public Sink { public: - void Put(byte) {} - void Put(const byte *, unsigned int) {} + void Put(uint8_t) {} + void Put(const uint8_t *, unsigned int) {} }; -BufferedTransformation *Insert(const byte *in, unsigned int length, BufferedTransformation *outQueue); -unsigned int Extract(Source *source, byte *out, unsigned int length); +BufferedTransformation *Insert(const uint8_t *in, unsigned int length, BufferedTransformation *outQueue); +unsigned int Extract(Source *source, uint8_t *out, unsigned int length); #endif diff --git a/src/cryptlib/forkjoin.cpp b/src/cryptlib/forkjoin.cpp index 899ec85..3df1808 100644 --- a/src/cryptlib/forkjoin.cpp +++ b/src/cryptlib/forkjoin.cpp @@ -49,13 +49,13 @@ void Fork::Close() outPorts[i]->Close(); } -void Fork::Put(byte inByte) +void Fork::Put(uint8_t inByte) { for (unsigned int i=0; iPut(inByte); } -void Fork::Put(const byte *inString, unsigned int length) +void Fork::Put(const uint8_t *inString, unsigned int length) { for (unsigned int i=0; iPut(inString, length); @@ -95,13 +95,13 @@ void Join::NotifyClose(unsigned int /* id */) // ******************************************************** -void Interface::Put(byte inByte) +void Interface::Put(uint8_t inByte) { bq.Put(inByte); parent.NotifyInput(id, 1); } -void Interface::Put(const byte *inString, unsigned int length) +void Interface::Put(const uint8_t *inString, unsigned int length) { bq.Put(inString, length); parent.NotifyInput(id, length); @@ -127,17 +127,17 @@ void Interface::Attach(BufferedTransformation *bt) parent.Attach(bt); } -unsigned int Interface::Get(byte &outByte) +unsigned int Interface::Get(uint8_t &outByte) { return parent.Get(outByte); } -unsigned int Interface::Get(byte *outString, unsigned int getMax) +unsigned int Interface::Get(uint8_t *outString, unsigned int getMax) { return parent.Get(outString, getMax); } -unsigned int Interface::Peek(byte &outByte) const +unsigned int Interface::Peek(uint8_t &outByte) const { return parent.Peek(outByte); } diff --git a/src/cryptlib/forkjoin.h b/src/cryptlib/forkjoin.h index 65c139e..afd3c36 100644 --- a/src/cryptlib/forkjoin.h +++ b/src/cryptlib/forkjoin.h @@ -22,15 +22,15 @@ public: // virtual void InputFinished() // {outPorts[currentPort]->InputFinished();} - unsigned int Get(byte &outByte) + unsigned int Get(uint8_t &outByte) {return outPorts[currentPort]->Get(outByte);} - unsigned int Get(byte *outString, unsigned int getMax) + unsigned int Get(uint8_t *outString, unsigned int getMax) {return outPorts[currentPort]->Get(outString, getMax);} - unsigned int Peek(byte &outByte) const + unsigned int Peek(uint8_t &outByte) const {return outPorts[currentPort]->Peek(outByte);} - virtual void Put(byte inByte); - virtual void Put(const byte *inString, unsigned int length); + virtual void Put(uint8_t inByte); + virtual void Put(const uint8_t *inString, unsigned int length); protected: unsigned int NumberOfPorts() const {return numberOfPorts;} @@ -57,11 +57,11 @@ public: void Detach(BufferedTransformation *bt); void Attach(BufferedTransformation *bt); - void Put(byte inByte); - void Put(const byte *inString, unsigned int length); - unsigned int Get(byte &outByte); - unsigned int Get(byte *outString, unsigned int getMax); - unsigned int Peek(byte &outByte) const; + void Put(uint8_t inByte); + void Put(const uint8_t *inString, unsigned int length); + unsigned int Get(uint8_t &outByte); + unsigned int Get(uint8_t *outString, unsigned int getMax); + unsigned int Peek(uint8_t &outByte) const; private: Join &parent; @@ -83,8 +83,8 @@ public: virtual void NotifyInput(unsigned int interfaceId, unsigned int length); virtual void NotifyClose(unsigned int interfaceId); - void Put(byte inByte) {outQueue->Put(inByte);} - void Put(const byte *inString, unsigned int length) + void Put(uint8_t inByte) {outQueue->Put(inByte);} + void Put(const uint8_t *inString, unsigned int length) {outQueue->Put(inString, length);} protected: diff --git a/src/cryptlib/integer.cpp b/src/cryptlib/integer.cpp index 2a4ec6a..3279b8e 100644 --- a/src/cryptlib/integer.cpp +++ b/src/cryptlib/integer.cpp @@ -20,7 +20,7 @@ union dword_union { dword dw; - struct { + struct _w { #ifdef WORDS_BIGENDIAN word high; word low; @@ -28,7 +28,7 @@ union dword_union word low; word high; #endif - }; + } w; }; #if defined(_MSC_VER) && defined(_M_IX86) && (_M_IX86<=500) @@ -145,10 +145,10 @@ static word Add(word *C, const word *A, const word *B, unsigned int N) { dword_union u; u.dw = (dword) carry + A[i] + B[i]; - C[i] = u.low; - u.dw = (dword) u.high + A[i+1] + B[i+1]; - C[i+1] = u.low; - carry = u.high; + C[i] = u.w.low; + u.dw = (dword) u.w.high + A[i+1] + B[i+1]; + C[i+1] = u.w.low; + carry = u.w.high; } return carry; } @@ -162,10 +162,10 @@ static word Subtract(word *C, const word *A, const word *B, unsigned int N) { dword_union u; u.dw = (dword) A[i] - B[i] - borrow; - C[i] = u.low; - u.dw = (dword) A[i+1] - B[i+1] - (word)(0-u.high); - C[i+1] = u.low; - borrow = 0-u.high; + C[i] = u.w.low; + u.dw = (dword) A[i+1] - B[i+1] - (word)(0-u.w.high); + C[i+1] = u.w.low; + borrow = 0-u.w.high; } return borrow; } @@ -223,8 +223,8 @@ static word LinearMultiply(word *C, const word *A, word B, unsigned int N) { dword_union p; p.dw = (dword)A[i] * B + carry; - C[i] = p.low; - carry = p.high; + C[i] = p.w.low; + carry = p.w.high; } return carry; } @@ -259,17 +259,17 @@ static void AtomicMultiply(word *C, word A0, word A1, word B0, word B1) dword_union A0B0; A0B0.dw = (dword)A0*B0; - C[0] = A0B0.low; + C[0] = A0B0.w.low; dword_union A1B1; A1B1.dw = (dword)A1*B1; dword_union t; - t.dw = (dword)A0B0.high + A0B0.low + d.low + A1B1.low; - C[1] = t.low; + t.dw = (dword)A0B0.w.high + A0B0.w.low + d.w.low + A1B1.w.low; + C[1] = t.w.low; - t.dw = A1B1.dw + t.high + A0B0.high + d.high + A1B1.high - s; - C[2] = t.low; - C[3] = t.high; + t.dw = A1B1.dw + t.w.high + A0B0.w.high + d.w.high + A1B1.w.high - s; + C[2] = t.w.low; + C[3] = t.w.high; } static word AtomicMultiplyAdd(word *C, word A0, word A1, word B0, word B1) @@ -304,19 +304,19 @@ static word AtomicMultiplyAdd(word *C, word A0, word A1, word B0, word B1) A0B0.dw = (dword)A0*B0; dword_union t; t.dw = A0B0.dw + C[0]; - C[0] = t.low; + C[0] = t.w.low; dword_union A1B1; A1B1.dw = (dword)A1*B1; - t.dw = (dword) t.high + A0B0.low + d.low + A1B1.low + C[1]; - C[1] = t.low; + t.dw = (dword) t.w.high + A0B0.w.low + d.w.low + A1B1.w.low + C[1]; + C[1] = t.w.low; - t.dw = (dword) t.high + A1B1.low + A0B0.high + d.high + A1B1.high - s + C[2]; - C[2] = t.low; + t.dw = (dword) t.w.high + A1B1.w.low + A0B0.w.high + d.w.high + A1B1.w.high - s + C[2]; + C[2] = t.w.low; - t.dw = (dword) t.high + A1B1.high + C[3]; - C[3] = t.low; - return t.high; + t.dw = (dword) t.w.high + A1B1.w.high + C[3]; + C[3] = t.w.low; + return t.w.high; } static inline void AtomicSquare(word *C, word A, word B) @@ -327,16 +327,16 @@ static inline void AtomicSquare(word *C, word A, word B) #else dword_union t1; t1.dw = (dword) A*A; - C[0] = t1.low; + C[0] = t1.w.low; dword_union t2; t2.dw = (dword) A*B; - t1.dw = (dword) t1.high + t2.low + t2.low; - C[1] = t1.low; + t1.dw = (dword) t1.w.high + t2.w.low + t2.w.low; + C[1] = t1.w.low; - t1.dw = (dword) B*B + t1.high + t2.high + t2.high; - C[2] = t1.low; - C[3] = t1.high; + t1.dw = (dword) B*B + t1.w.high + t2.w.high + t2.w.high; + C[2] = t1.w.low; + C[3] = t1.w.high; #endif } @@ -344,16 +344,16 @@ static inline void AtomicMultiplyBottom(word *C, word A0, word A1, word B0, word { dword_union t; t.dw = (dword)A0*B0; - C[0] = t.low; - C[1] = t.high + A0*B1 + A1*B0; + C[0] = t.w.low; + C[1] = t.w.high + A0*B1 + A1*B0; } static inline void AtomicMultiplyBottomAdd(word *C, word A0, word A1, word B0, word B1) { dword_union t; t.dw = (dword)A0*B0 + C[0]; - C[0] = t.low; - C[1] += t.high + A0*B1 + A1*B0; + C[0] = t.w.low; + C[1] += t.w.high + A0*B1 + A1*B0; } static void CombaMultiply(word *R, const word *A, const word *B) @@ -363,22 +363,22 @@ static void CombaMultiply(word *R, const word *A, const word *B) #define MulAcc(x, y) \ p.dw = (dword)A[x] * B[y] + c; \ - c = p.low; \ - p.dw = (dword)d + p.high; \ - d = p.low; \ - e += p.high; + c = p.w.low; \ + p.dw = (dword)d + p.w.high; \ + d = p.w.low; \ + e += p.w.high; #define SaveMulAcc(s, x, y) \ R[s] = c; \ p.dw = (dword)A[x] * B[y] + d; \ - c = p.low; \ - p.dw = (dword)e + p.high; \ - d = p.low; \ - e = p.high; + c = p.w.low; \ + p.dw = (dword)e + p.w.high; \ + d = p.w.low; \ + e = p.w.high; p.dw = (dword)A[0] * B[0]; - R[0] = p.low; - c = p.high; + R[0] = p.w.low; + c = p.w.high; d = e = 0; MulAcc(0, 1); @@ -402,8 +402,8 @@ static void CombaMultiply(word *R, const word *A, const word *B) R[5] = c; p.dw = (dword)A[3] * B[3] + d; - R[6] = p.low; - R[7] = e + p.high; + R[6] = p.w.low; + R[7] = e + p.w.high; #undef MulAcc #undef SaveMulAcc @@ -422,8 +422,8 @@ static void AtomicInverseModPower2(word *C, word A0, word A1) assert(R.dw*A==1); - C[0] = R.low; - C[1] = R.high; + C[0] = R.w.low; + C[1] = R.w.high; } // ******************************************************** @@ -834,20 +834,20 @@ static word SubatomicDivide(word *A, word B0, word B1) // now subtract Q*B from A p.dw = (dword) B0*Q; - u.dw = (dword) A[0] - p.low; - A[0] = u.low; - u.dw = (dword) A[1] - p.high - (word)(0-u.high) - (dword)B1*Q; - A[1] = u.low; - A[2] += u.high; + u.dw = (dword) A[0] - p.w.low; + A[0] = u.w.low; + u.dw = (dword) A[1] - p.w.high - (word)(0-u.w.high) - (dword)B1*Q; + A[1] = u.w.low; + A[2] += u.w.high; // Q <= actual quotient, so fix it while (A[2] || A[1] > B1 || (A[1]==B1 && A[0]>=B0)) { u.dw = (dword) A[0] - B0; - A[0] = u.low; - u.dw = (dword) A[1] - B1 - (word)(0-u.high); - A[1] = u.low; - A[2] += u.high; + A[0] = u.w.low; + u.dw = (dword) A[1] - B1 - (word)(0-u.w.high); + A[1] = u.w.low; + A[2] += u.w.high; Q++; assert(Q); // shouldn't overflow } @@ -1153,18 +1153,18 @@ long Integer::ConvertToLong() const { unsigned long value = reg[(unsigned int)0]; #ifndef __GNUC__ - value += sizeof(value)>WORD_SIZE ? ((unsigned long)reg[1]< WORD_SIZE) ? (((unsigned long)(reg[(unsigned int)1])) << WORD_BITS) : 0; #endif value = Crop(value, 8*sizeof(value)-1); return sign==POSITIVE ? value : -long(value); } -Integer::Integer(const byte *encodedInteger, unsigned int byteCount, Signedness s) +Integer::Integer(const uint8_t *encodedInteger, unsigned int byteCount, Signedness s) { Decode(encodedInteger, byteCount, s); } -Integer::Integer(const byte *BEREncodedInteger) +Integer::Integer(const uint8_t *BEREncodedInteger) { BERDecode(BEREncodedInteger); } @@ -1241,15 +1241,15 @@ void Integer::SetBit(unsigned int n, bool value) } } -byte Integer::GetByte(unsigned int n) const +uint8_t Integer::GetByte(unsigned int n) const { if (n/WORD_SIZE >= reg.size) return 0; else - return byte(reg[n/WORD_SIZE] >> ((n%WORD_SIZE)*8)); + return uint8_t(reg[n/WORD_SIZE] >> ((n%WORD_SIZE)*8)); } -void Integer::SetByte(unsigned int n, byte value) +void Integer::SetByte(unsigned int n, uint8_t value) { reg.CleanGrow(RoundupSize(bytesToWords(n+1))); reg[n/WORD_SIZE] &= ~(word(0xff) << 8*(n%WORD_SIZE)); @@ -1360,7 +1360,7 @@ unsigned int Integer::BitCount() const return 0; } -void Integer::Decode(const byte *input, unsigned int inputLen, Signedness s) +void Integer::Decode(const uint8_t *input, unsigned int inputLen, Signedness s) { sign = ((s==SIGNED) && (input[0] & 0x80)) ? NEGATIVE : POSITIVE; @@ -1395,7 +1395,7 @@ unsigned int Integer::MinEncodedSize(Signedness signedness) const return outputLen; } -unsigned int Integer::Encode(byte *output, unsigned int outputLen, Signedness signedness) const +unsigned int Integer::Encode(uint8_t *output, unsigned int outputLen, Signedness signedness) const { if (signedness == UNSIGNED || NotNegative()) { @@ -1412,7 +1412,7 @@ unsigned int Integer::Encode(byte *output, unsigned int outputLen, Signedness si return outputLen; } -unsigned int Integer::DEREncode(byte *output) const +unsigned int Integer::DEREncode(uint8_t *output) const { unsigned int i=0; output[i++] = INTEGER; @@ -1435,7 +1435,7 @@ unsigned int Integer::DEREncode(BufferedTransformation &bt) const return 1+lengthBytes+bc; } -void Integer::BERDecode(const byte *input) +void Integer::BERDecode(const uint8_t *input) { if (*input++ != INTEGER) BERDecodeError(); @@ -1456,7 +1456,7 @@ void Integer::BERDecode(const byte *input) void Integer::BERDecode(BufferedTransformation &bt) { - byte b; + uint8_t b; if (!bt.Get(b) || b != INTEGER) BERDecodeError(); @@ -1475,7 +1475,7 @@ void Integer::Randomize(RandomNumberGenerator &rng, unsigned int nbits) const unsigned int nbytes = nbits/8 + 1; SecByteBlock buf(nbytes); rng.GetBlock(buf, nbytes); - buf[(unsigned int)0] = (byte)Crop(buf[(unsigned int)0], nbits % 8); + buf[(unsigned int)0] = (uint8_t)Crop(buf[(unsigned int)0], nbits % 8); Decode(buf, nbytes, UNSIGNED); } diff --git a/src/cryptlib/integer.h b/src/cryptlib/integer.h index 82f3349..81efa22 100644 --- a/src/cryptlib/integer.h +++ b/src/cryptlib/integer.h @@ -62,10 +62,10 @@ public: Integer(const char *str); /// convert from big-endian byte array - Integer(const byte *encodedInteger, unsigned int byteCount, Signedness s=UNSIGNED); + Integer(const uint8_t *encodedInteger, unsigned int byteCount, Signedness s=UNSIGNED); /// convert from Basic Encoding Rules encoded byte array - Integer(const byte *BEREncodedInteger); + Integer(const uint8_t *BEREncodedInteger); /// convert from BER encoded byte array stored in a BufferedTransformation object Integer(BufferedTransformation &bt); @@ -104,10 +104,10 @@ public: if outputLen < MinEncodedSize, the most significant bytes will be dropped if outputLen > MinEncodedSize, the most significant bytes will be padded */ - unsigned int Encode(byte *output, unsigned int outputLen, Signedness=UNSIGNED) const; + unsigned int Encode(uint8_t *output, unsigned int outputLen, Signedness=UNSIGNED) const; /// encode integer using Distinguished Encoding Rules, returns size of output - unsigned int DEREncode(byte *output) const; + unsigned int DEREncode(uint8_t *output) const; /// encode using DER, put result into a BufferedTransformation object unsigned int DEREncode(BufferedTransformation &bt) const; @@ -121,7 +121,7 @@ public: /// return the n-th bit, n=0 being the least significant bit bool GetBit(unsigned int n) const; /// return the n-th byte - byte GetByte(unsigned int n) const; + uint8_t GetByte(unsigned int n) const; /// bool IsNegative() const {return sign == NEGATIVE;} @@ -161,10 +161,10 @@ public: Integer& operator>>=(unsigned int); /// - void Decode(const byte *input, unsigned int inputLen, Signedness=UNSIGNED); + void Decode(const uint8_t *input, unsigned int inputLen, Signedness=UNSIGNED); /// - void BERDecode(const byte *input); + void BERDecode(const uint8_t *input); /// void BERDecode(BufferedTransformation &bt); @@ -178,7 +178,7 @@ public: /// set the n-th bit to value void SetBit(unsigned int n, bool value=1); /// set the n-th byte to value - void SetByte(unsigned int n, byte value); + void SetByte(unsigned int n, uint8_t value); /// void Negate(); diff --git a/src/cryptlib/iterhash.h b/src/cryptlib/iterhash.h index d66cea7..5a9a921 100644 --- a/src/cryptlib/iterhash.h +++ b/src/cryptlib/iterhash.h @@ -15,12 +15,12 @@ template class IteratedHash : public virtual HashModule public: IteratedHash(unsigned int blockSize, unsigned int digestSize); ~IteratedHash(); - void Update(const byte *input, unsigned int length); + void Update(const uint8_t *input, unsigned int length); typedef T HashWordType; protected: - void PadLastBlock(unsigned int lastBlockSize, byte padFirst=0x80); + void PadLastBlock(unsigned int lastBlockSize, uint8_t padFirst=0x80); virtual void Init() =0; virtual void HashBlock(const T *input) =0; @@ -39,7 +39,7 @@ template IteratedHash::~IteratedHash() { } -template void IteratedHash::Update(const byte *input, unsigned int len) +template void IteratedHash::Update(const uint8_t *input, unsigned int len) { word32 tmp = countLo; if ((countLo = tmp + ((word32)len << 3)) < tmp) @@ -53,7 +53,7 @@ template void IteratedHash::Update(const byte *input, unsigned int { if ((num+len) >= blockSize) { - memcpy((byte *)data.ptr+num, input, blockSize-num); + memcpy((uint8_t *)data.ptr+num, input, blockSize-num); HashBlock(data); input += (blockSize-num); len-=(blockSize - num); @@ -62,7 +62,7 @@ template void IteratedHash::Update(const byte *input, unsigned int } else { - memcpy((byte *)data.ptr+num, input, len); + memcpy((uint8_t *)data.ptr+num, input, len); return; } } @@ -91,16 +91,16 @@ template void IteratedHash::Update(const byte *input, unsigned int memcpy(data, input, len); } -template void IteratedHash::PadLastBlock(unsigned int lastBlockSize, byte padFirst) +template void IteratedHash::PadLastBlock(unsigned int lastBlockSize, uint8_t padFirst) { unsigned int num = (unsigned int)(countLo >> 3) & (blockSize-1); assert(num < blockSize); - ((byte *)data.ptr)[num++]=padFirst; + ((uint8_t *)data.ptr)[num++]=padFirst; if (num <= lastBlockSize) - memset((byte *)data.ptr+num, 0, lastBlockSize-num); + memset((uint8_t *)data.ptr+num, 0, lastBlockSize-num); else { - memset((byte *)data.ptr+num, 0, blockSize-num); + memset((uint8_t *)data.ptr+num, 0, blockSize-num); HashBlock(data); memset(data, 0, lastBlockSize); } diff --git a/src/cryptlib/misc.cpp b/src/cryptlib/misc.cpp index 6ad4683..c1a0bf7 100644 --- a/src/cryptlib/misc.cpp +++ b/src/cryptlib/misc.cpp @@ -4,7 +4,7 @@ #include "misc.h" #include "words.h" -void xorbuf(byte *buf, const byte *mask, unsigned int count) +void xorbuf(uint8_t *buf, const uint8_t *mask, unsigned int count) { if (((ptr_size_type)buf | (ptr_size_type)mask | count) % WORD_SIZE == 0) XorWords((word *)buf, (const word *)mask, count/WORD_SIZE); @@ -15,7 +15,7 @@ void xorbuf(byte *buf, const byte *mask, unsigned int count) } } -void xorbuf(byte *output, const byte *input, const byte *mask, unsigned int count) +void xorbuf(uint8_t *output, const uint8_t *input, const uint8_t *mask, unsigned int count) { if (((ptr_size_type)output | (ptr_size_type)input | (ptr_size_type)mask | count) % WORD_SIZE == 0) XorWords((word *)output, (const word *)input, (const word *)mask, count/WORD_SIZE); diff --git a/src/cryptlib/misc.h b/src/cryptlib/misc.h index d390fa2..a4a32e9 100644 --- a/src/cryptlib/misc.h +++ b/src/cryptlib/misc.h @@ -31,8 +31,8 @@ inline unsigned int bitsToWords(unsigned int bitCount) return ((bitCount+WORD_BITS-1)/(WORD_BITS)); } -void xorbuf(byte *buf, const byte *mask, unsigned int count); -void xorbuf(byte *output, const byte *input, const byte *mask, unsigned int count); +void xorbuf(uint8_t *buf, const uint8_t *mask, unsigned int count); +void xorbuf(uint8_t *output, const uint8_t *input, const uint8_t *mask, unsigned int count); template inline T rotl(T x, unsigned int y) { @@ -262,7 +262,7 @@ template void SecBlock::swap(SecBlock &b) std::swap(ptr, b.ptr); } -typedef SecBlock SecByteBlock; +typedef SecBlock SecByteBlock; typedef SecBlock SecWordBlock; #endif // MISC_H diff --git a/src/cryptlib/queue.cpp b/src/cryptlib/queue.cpp index 7a23a43..bd7992e 100644 --- a/src/cryptlib/queue.cpp +++ b/src/cryptlib/queue.cpp @@ -15,20 +15,20 @@ public: unsigned int UsedUp() const {return (head==MaxSize());} - unsigned int Put(byte inByte); - unsigned int Put(const byte *inString, unsigned int length); + unsigned int Put(uint8_t inByte); + unsigned int Put(const uint8_t *inString, unsigned int length); - unsigned int Get(byte &outByte); - unsigned int Get(byte *outString, unsigned int getMax); + unsigned int Get(uint8_t &outByte); + unsigned int Get(uint8_t *outString, unsigned int getMax); - unsigned int Peek(byte &outByte) const; + unsigned int Peek(uint8_t &outByte) const; void CopyTo(BufferedTransformation &target) const {target.Put(buf+head, tail-head);} - void CopyTo(byte *target) const + void CopyTo(uint8_t *target) const {memcpy(target, buf+head, tail-head);} - byte operator[](unsigned int i) const + uint8_t operator[](unsigned int i) const {return buf[i-head];} ByteQueueNode *next; @@ -48,7 +48,7 @@ ByteQueueNode::ByteQueueNode(unsigned int maxSize) next = 0; } -unsigned int ByteQueueNode::Put(byte inByte) +unsigned int ByteQueueNode::Put(uint8_t inByte) { if (MaxSize()==tail) return 0; @@ -57,7 +57,7 @@ unsigned int ByteQueueNode::Put(byte inByte) return 1; } -unsigned int ByteQueueNode::Put(const byte *inString, unsigned int length) +unsigned int ByteQueueNode::Put(const uint8_t *inString, unsigned int length) { unsigned int l = STDMIN(length, MaxSize()-tail); memcpy(buf+tail, inString, l); @@ -65,7 +65,7 @@ unsigned int ByteQueueNode::Put(const byte *inString, unsigned int length) return l; } -unsigned int ByteQueueNode::Get(byte &outByte) +unsigned int ByteQueueNode::Get(uint8_t &outByte) { if (tail==head) return 0; @@ -74,7 +74,7 @@ unsigned int ByteQueueNode::Get(byte &outByte) return 1; } -unsigned int ByteQueueNode::Get(byte *outString, unsigned int getMax) +unsigned int ByteQueueNode::Get(uint8_t *outString, unsigned int getMax) { unsigned int l = STDMIN(getMax, tail-head); memcpy(outString, buf+head, l); @@ -82,7 +82,7 @@ unsigned int ByteQueueNode::Get(byte *outString, unsigned int getMax) return l; } -unsigned int ByteQueueNode::Peek(byte &outByte) const +unsigned int ByteQueueNode::Peek(uint8_t &outByte) const { if (tail==head) return 0; @@ -140,7 +140,7 @@ void ByteQueue::CopyTo(BufferedTransformation &target) const current->CopyTo(target); } -void ByteQueue::CopyTo(byte *target) const +void ByteQueue::CopyTo(uint8_t *target) const { for (ByteQueueNode *current=head; current; current=current->next) { @@ -159,7 +159,7 @@ unsigned long ByteQueue::CurrentSize() const return size; } -void ByteQueue::Put(byte inByte) +void ByteQueue::Put(uint8_t inByte) { if (!tail->Put(inByte)) { @@ -169,7 +169,7 @@ void ByteQueue::Put(byte inByte) } } -void ByteQueue::Put(const byte *inString, unsigned int length) +void ByteQueue::Put(const uint8_t *inString, unsigned int length) { unsigned int l; @@ -182,7 +182,7 @@ void ByteQueue::Put(const byte *inString, unsigned int length) } } -unsigned int ByteQueue::Get(byte &outByte) +unsigned int ByteQueue::Get(uint8_t &outByte) { int l = head->Get(outByte); if (head->UsedUp()) @@ -196,7 +196,7 @@ unsigned int ByteQueue::Get(byte &outByte) return l; } -unsigned int ByteQueue::Get(byte *outString, unsigned int getMax) +unsigned int ByteQueue::Get(uint8_t *outString, unsigned int getMax) { unsigned int getMaxSave=getMax; ByteQueueNode *current=head; @@ -224,7 +224,7 @@ unsigned int ByteQueue::Get(byte *outString, unsigned int getMax) return (getMaxSave-getMax); } -unsigned int ByteQueue::Peek(byte &outByte) const +unsigned int ByteQueue::Peek(uint8_t &outByte) const { return head->Peek(outByte); } @@ -250,7 +250,7 @@ bool ByteQueue::operator==(const ByteQueue &rhs) const return true; } -byte ByteQueue::operator[](unsigned long i) const +uint8_t ByteQueue::operator[](unsigned long i) const { for (ByteQueueNode *current=head; current; current=current->next) { diff --git a/src/cryptlib/queue.h b/src/cryptlib/queue.h index c340652..cb5b418 100644 --- a/src/cryptlib/queue.h +++ b/src/cryptlib/queue.h @@ -21,21 +21,21 @@ public: unsigned long MaxRetrieveable() {return CurrentSize();} - void Put(byte inByte); - void Put(const byte *inString, unsigned int length); + void Put(uint8_t inByte); + void Put(const uint8_t *inString, unsigned int length); // both functions returns the number of bytes actually retrived - unsigned int Get(byte &outByte); - unsigned int Get(byte *outString, unsigned int getMax); + unsigned int Get(uint8_t &outByte); + unsigned int Get(uint8_t *outString, unsigned int getMax); - unsigned int Peek(byte &outByte) const; + unsigned int Peek(uint8_t &outByte) const; void CopyTo(BufferedTransformation &target) const; - void CopyTo(byte *target) const; + void CopyTo(uint8_t *target) const; ByteQueue & operator=(const ByteQueue &rhs); bool operator==(const ByteQueue &rhs) const; - byte operator[](unsigned long i) const; + uint8_t operator[](unsigned long i) const; private: void CopyFrom(const ByteQueue ©); diff --git a/src/cryptlib/rng.cpp b/src/cryptlib/rng.cpp index 0f62a87..c2ea602 100644 --- a/src/cryptlib/rng.cpp +++ b/src/cryptlib/rng.cpp @@ -32,7 +32,7 @@ const word16 LC_RNG::a=16807; const word16 LC_RNG::r=2836; #endif -byte LC_RNG::GetByte() +uint8_t LC_RNG::GetByte() { word32 hi = seed/q; word32 lo = seed%q; @@ -49,7 +49,7 @@ byte LC_RNG::GetByte() // ******************************************************** -X917RNG::X917RNG(BlockTransformation *c, const byte *seed) +X917RNG::X917RNG(BlockTransformation *c, const uint8_t *seed) : cipher(c), S(cipher->BlockSize()), dtbuf(S), @@ -58,20 +58,20 @@ X917RNG::X917RNG(BlockTransformation *c, const byte *seed) randbuf_counter(0) { time_t tstamp1 = time(0); - xorbuf(dtbuf, (byte *)&tstamp1, STDMIN((int)sizeof(tstamp1), S)); + xorbuf(dtbuf, (uint8_t *)&tstamp1, STDMIN((int)sizeof(tstamp1), S)); cipher->ProcessBlock(dtbuf); clock_t tstamp2 = clock(); - xorbuf(dtbuf, (byte *)&tstamp2, STDMIN((int)sizeof(tstamp2), S)); + xorbuf(dtbuf, (uint8_t *)&tstamp2, STDMIN((int)sizeof(tstamp2), S)); cipher->ProcessBlock(dtbuf); } -byte X917RNG::GetByte() +uint8_t X917RNG::GetByte() { if (randbuf_counter==0) { // calculate new enciphered timestamp clock_t tstamp = clock(); - xorbuf(dtbuf, (byte *)&tstamp, STDMIN((int)sizeof(tstamp), S)); + xorbuf(dtbuf, (uint8_t *)&tstamp, STDMIN((int)sizeof(tstamp), S)); cipher->ProcessBlock(dtbuf); // combine enciphered timestamp with seed @@ -97,7 +97,7 @@ MaurerRandomnessTest::MaurerRandomnessTest() tab[i] = 0; } -inline void MaurerRandomnessTest::Put(byte inByte) +inline void MaurerRandomnessTest::Put(uint8_t inByte) { if (n >= Q) sum += log(double(n - tab[inByte])); @@ -105,7 +105,7 @@ inline void MaurerRandomnessTest::Put(byte inByte) n++; } -void MaurerRandomnessTest::Put(const byte *inString, unsigned int length) +void MaurerRandomnessTest::Put(const uint8_t *inString, unsigned int length) { while (length--) Put(*inString++); diff --git a/src/cryptlib/rng.h b/src/cryptlib/rng.h index c39b828..147b237 100644 --- a/src/cryptlib/rng.h +++ b/src/cryptlib/rng.h @@ -13,15 +13,15 @@ class LC_RNG : public RandomNumberGenerator { public: LC_RNG(word32 init_seed) - : seedBytes((byte *)&seed) {seed=init_seed;} + : seedBytes((uint8_t *)&seed) {seed=init_seed;} - byte GetByte(); + uint8_t GetByte(); word32 GetSeed() {return seed;} private: word32 seed; - byte *const seedBytes; + uint8_t *const seedBytes; static const word32 m; static const word32 q; @@ -35,9 +35,9 @@ class X917RNG : public RandomNumberGenerator { public: // cipher will be deleted by destructor - X917RNG(BlockTransformation *cipher, const byte *seed); + X917RNG(BlockTransformation *cipher, const uint8_t *seed); - byte GetByte(); + uint8_t GetByte(); private: member_ptr cipher; @@ -56,8 +56,8 @@ class MaurerRandomnessTest : public Sink public: MaurerRandomnessTest(); - void Put(byte inByte); - void Put(const byte *inString, unsigned int length); + void Put(uint8_t inByte); + void Put(const uint8_t *inString, unsigned int length); // BytesNeeded() returns how many more bytes of input is needed by the test // GetTestValue() should not be called before BytesNeeded()==0 diff --git a/src/cryptlib/sha.cpp b/src/cryptlib/sha.cpp index cb1fc49..d575354 100644 --- a/src/cryptlib/sha.cpp +++ b/src/cryptlib/sha.cpp @@ -31,7 +31,7 @@ void SHA::HashBlock(const word32 *input) #endif } -void SHA::Final(byte *hash) +void SHA::Final(uint8_t *hash) { PadLastBlock(56); CorrectEndianess(data, data, 56); @@ -115,7 +115,7 @@ void SHA::Transform( word32 *digest, const word32 *data ) word32 eData[16]; memcpy( eData, data, DATASIZE ); - register word32 A, B, C, D, E; + word32 A, B, C, D, E; A = digest[0]; B = digest[1]; C = digest[2]; diff --git a/src/cryptlib/sha.h b/src/cryptlib/sha.h index 99e9ad7..921358b 100644 --- a/src/cryptlib/sha.h +++ b/src/cryptlib/sha.h @@ -7,7 +7,7 @@ class SHA : public IteratedHash { public: SHA(); - void Final(byte *hash); + void Final(uint8_t *hash); unsigned int DigestSize() const {return DIGESTSIZE;}; static void CorrectEndianess(word32 *out, const word32 *in, unsigned int byteCount) diff --git a/src/cryptlib/zbits.cpp b/src/cryptlib/zbits.cpp index 8be571f..e192702 100644 --- a/src/cryptlib/zbits.cpp +++ b/src/cryptlib/zbits.cpp @@ -63,13 +63,13 @@ void BitOutput::bi_windup() void BitOutput::bi_putsh(word16 x) { - outQ.Put((byte)x); - outQ.Put(byte(x>>8)); + outQ.Put((uint8_t)x); + outQ.Put(uint8_t(x>>8)); } /* Copy a stored block to the zip file, storing first the length and its one's complement if requested. */ -void BitOutput::copy_block(byte *buf, unsigned int len, int header) +void BitOutput::copy_block(uint8_t *buf, unsigned int len, int header) { /* align on byte boundary */ bi_windup(); diff --git a/src/cryptlib/zbits.h b/src/cryptlib/zbits.h index 8f5dcb5..ddbaee3 100644 --- a/src/cryptlib/zbits.h +++ b/src/cryptlib/zbits.h @@ -11,7 +11,7 @@ public: void send_bits (unsigned value, int length); void bi_windup (void); void bi_putsh (unsigned short); - void copy_block (byte *buf, unsigned len, int header); + void copy_block (uint8_t *buf, unsigned len, int header); private: BufferedTransformation &outQ; diff --git a/src/cryptlib/zdeflate.cpp b/src/cryptlib/zdeflate.cpp index 60d74e3..460f73e 100644 --- a/src/cryptlib/zdeflate.cpp +++ b/src/cryptlib/zdeflate.cpp @@ -142,7 +142,7 @@ const Deflator::config Deflator::configuration_table[10] = { void Deflator::init_hash() { - register unsigned j; + unsigned j; for (ins_h=0, j=0; j (IPos)MAX_DIST ? strstart - (IPos)MAX_DIST : NIL; /* Stop when cur_match becomes <= limit. To simplify the code, @@ -223,13 +223,13 @@ int Deflator::longest_match(IPos cur_match) #ifdef UNALIGNED_OK /* Compare two bytes at a time. Note: this is not always beneficial. Try with and without -DUNALIGNED_OK to check. */ - register byte *strend = window + strstart + MAX_MATCH - 1; - register word16 scan_start = *(word16*)scan; - register word16 scan_end = *(word16*)(scan+best_len-1); + uint8_t *strend = window + strstart + MAX_MATCH - 1; + word16 scan_start = *(word16*)scan; + word16 scan_end = *(word16*)(scan+best_len-1); #else - register byte *strend = window + strstart + MAX_MATCH; - register byte scan_end1 = scan[best_len-1]; - register byte scan_end = scan[best_len]; + uint8_t *strend = window + strstart + MAX_MATCH; + uint8_t scan_end1 = scan[best_len-1]; + uint8_t scan_end = scan[best_len]; #endif /* Do not waste too much time if we already have a good match: */ @@ -350,9 +350,9 @@ int length; * IN assertion: lookahead < MIN_LOOKAHEAD. * Note: call with either lookahead == 0 or length == 0 is valid */ -unsigned Deflator::fill_window(const byte *buffer, unsigned int length) +unsigned Deflator::fill_window(const uint8_t *buffer, unsigned int length) { - register unsigned n, m; + unsigned n, m; unsigned more = length; /* Amount of free space at the end of the window. */ @@ -382,7 +382,7 @@ unsigned Deflator::fill_window(const byte *buffer, unsigned int length) if ((more += WSIZE) > length) more = length; } if (more) { - memcpy((byte*)window+strstart+lookahead, buffer, more); + memcpy((uint8_t*)window+strstart+lookahead, buffer, more); lookahead += more; } return more; @@ -392,13 +392,13 @@ unsigned Deflator::fill_window(const byte *buffer, unsigned int length) IN assertion: strstart is set to the end of the current match. */ #define FLUSH_BLOCK(eof) flush_block(block_start >= 0L ?\ window+block_start : \ - (byte *)0, (long)strstart - block_start, (eof)) + (uint8_t *)0, (long)strstart - block_start, (eof)) /* Processes a new input block. * This function does not perform lazy evaluationof matches and inserts * new strings in the dictionary only for unmatched strings or for short * matches. It is used only for the fast compression options. */ -int Deflator::fast_deflate(const byte *buffer, unsigned int length) +int Deflator::fast_deflate(const uint8_t *buffer, unsigned int length) { IPos hash_head; /* head of the hash chain */ int flush; /* set if current block must be flushed */ @@ -486,12 +486,12 @@ int Deflator::fast_deflate(const byte *buffer, unsigned int length) /* Same as above, but achieves better compression. We use a lazy * evaluation for matches: a match is finally adopted only if there is * no better match at the next window position. */ -int Deflator::lazy_deflate(const byte *buffer, unsigned int length) +int Deflator::lazy_deflate(const uint8_t *buffer, unsigned int length) { IPos hash_head; /* head of hash chain */ IPos prev_match; /* previous match */ int flush; /* set if current block must be flushed */ - register unsigned ml = match_length; /* length of best match */ + unsigned ml = match_length; /* length of best match */ #ifdef DEBUG extern word32 isize; /* byte length of input file, for debug only */ #endif diff --git a/src/cryptlib/zdeflate.h b/src/cryptlib/zdeflate.h index 23b26df..2005034 100644 --- a/src/cryptlib/zdeflate.h +++ b/src/cryptlib/zdeflate.h @@ -13,9 +13,9 @@ public: // default for the gzip program is 6 Deflator(int deflate_level, BufferedTransformation *outQ = NULL); - void Put(byte inByte) + void Put(uint8_t inByte) {Deflator::Put(&inByte, 1);} - void Put(const byte *inString, unsigned int length); + void Put(const uint8_t *inString, unsigned int length); void InputFinished(); @@ -52,13 +52,13 @@ private: SecByteBlock window; SecBlock prev, head; - unsigned fill_window (const byte*, unsigned); + unsigned fill_window (const uint8_t*, unsigned); void init_hash (); int longest_match (IPos cur_match); - int fast_deflate(const byte *buffer, unsigned int length); - int lazy_deflate(const byte *buffer, unsigned int length); + int fast_deflate(const uint8_t *buffer, unsigned int length); + int lazy_deflate(const uint8_t *buffer, unsigned int length); unsigned ins_h; /* hash index of string to be inserted */ char uptodate; /* hash preparation flag */ diff --git a/src/cryptlib/zinflate.cpp b/src/cryptlib/zinflate.cpp index b6b8b87..8161f60 100644 --- a/src/cryptlib/zinflate.cpp +++ b/src/cryptlib/zinflate.cpp @@ -74,7 +74,7 @@ Inflator::Inflator(BufferedTransformation *output, BufferedTransformation *bypas afterEnd = false; } -void Inflator::Put(const byte *inString, unsigned int length) +void Inflator::Put(const uint8_t *inString, unsigned int length) { if (afterEnd) AccessPort(1).Put(inString, length); @@ -89,7 +89,7 @@ void Inflator::Put(const byte *inString, unsigned int length) { flush_output(wp); if (bk>=8) // undo too much lookahead - AccessPort(1).Put(byte(bb>>(bk-=8))); + AccessPort(1).Put(uint8_t(bb>>(bk-=8))); inQueue.TransferTo(AccessPort(1)); } @@ -104,7 +104,7 @@ void Inflator::InputFinished() flush_output(wp); if (bk>=8) // undo too much lookahead - AccessPort(1).Put(byte(bb>>(bk-=8))); + AccessPort(1).Put(uint8_t(bb>>(bk-=8))); inQueue.TransferTo(AccessPort(1)); } @@ -183,9 +183,9 @@ const word16 Inflator::mask_bits[] = { 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff }; -byte Inflator::NEXTBYTE() +uint8_t Inflator::NEXTBYTE() { - byte b; + uint8_t b; if (!inQueue.Get(b)) #ifdef THROW_EXCEPTIONS throw UnexpectedEndErr(); @@ -252,16 +252,16 @@ int Inflator::huft_build(unsigned *b, unsigned n, unsigned s, const word16 *d, c unsigned f; /* i repeats in table every f entries */ int g; /* maximum code length */ int h; /* table level */ - register unsigned i; /* counter, current code */ - register unsigned j; /* counter */ - register int k; /* number of bits in current code */ + unsigned i; /* counter, current code */ + unsigned j; /* counter */ + int k; /* number of bits in current code */ int l; /* bits per table (returned in m) */ - register unsigned *p; /* pointer into c[], b[], or v[] */ - register huft *q; /* points to current table */ + unsigned *p; /* pointer into c[], b[], or v[] */ + huft *q; /* points to current table */ huft r; /* table entry for structure assignment */ huft *u[BMAX]; /* table stack */ unsigned v[N_MAX]; /* values in order of bit length */ - register int w; /* bits before this table == (l * h) */ + int w; /* bits before this table == (l * h) */ unsigned x[BMAX+1]; /* bit offsets, then code stack */ unsigned *xp; /* pointer into x */ int y; /* number of dummy codes added */ @@ -380,8 +380,8 @@ int Inflator::huft_build(unsigned *b, unsigned n, unsigned s, const word16 *d, c if (h) { x[h] = i; /* save pattern for backing up */ - r.b = (byte)l; /* bits to dump before this table */ - r.e = (byte)(16 + j); /* bits in this table */ + r.b = (uint8_t)l; /* bits to dump before this table */ + r.e = (uint8_t)(16 + j); /* bits in this table */ r.v.t = q; /* pointer to this table */ j = i >> (w - l); /* (get around Turbo C bug) */ u[h-1][j] = r; /* connect to last table */ @@ -389,18 +389,18 @@ int Inflator::huft_build(unsigned *b, unsigned n, unsigned s, const word16 *d, c } /* set up table entry in r */ - r.b = (byte)(k - w); + r.b = (uint8_t)(k - w); if (p >= v + n) r.e = 99; /* out of values--invalid code */ else if (*p < s) { - r.e = (byte)(*p < 256 ? 16 : 15); /* 256 is end-of-block code */ + r.e = (uint8_t)(*p < 256 ? 16 : 15); /* 256 is end-of-block code */ r.v.n = (word16)(*p); /* simple code is just the value */ p++; /* one compiler does not like *p++ */ } else { - r.e = (byte)e[*p - s]; /* non-simple--look up in lists */ + r.e = (uint8_t)e[*p - s]; /* non-simple--look up in lists */ r.v.n = d[*p++ - s]; } @@ -435,7 +435,7 @@ int Inflator::huft_free(huft *t) list of the tables it made, with the links in a dummy first entry of each table. */ { - register huft *p, *q; + huft *p, *q; /* Go through linked list, freeing from the malloced (t[-1]) address. */ @@ -454,13 +454,13 @@ int Inflator::inflate_codes(huft *tl, huft *td, int bl, int bd) /* inflate (decompress) the codes in a deflated (compressed) block. Return an error code or zero if it all goes ok. */ { - register unsigned e; /* table entry flag/number of extra bits */ + unsigned e; /* table entry flag/number of extra bits */ unsigned n, d; /* length and index for copy */ unsigned w; /* current window position */ huft *t; /* pointer to table entry */ unsigned ml, md; /* masks for bl and bd bits */ - register word32 b; /* bit buffer */ - register unsigned k; /* number of bits in bit buffer */ + word32 b; /* bit buffer */ + unsigned k; /* number of bits in bit buffer */ /* make local copies of globals */ @@ -485,7 +485,7 @@ int Inflator::inflate_codes(huft *tl, huft *td, int bl, int bd) DUMPBITS(t->b) if (e == 16) /* then it's a literal */ { - slide[w++] = (byte)t->v.n; + slide[w++] = (uint8_t)t->v.n; Tracevv((stderr, "%c", slide[w-1])); if (w == WSIZE) { @@ -562,8 +562,8 @@ int Inflator::inflate_stored() { unsigned n; /* number of bytes in block */ unsigned w; /* current window position */ - register word32 b; /* bit buffer */ - register unsigned k; /* number of bits in bit buffer */ + word32 b; /* bit buffer */ + unsigned k; /* number of bits in bit buffer */ /* make local copies of globals */ @@ -591,7 +591,7 @@ int Inflator::inflate_stored() while (n--) { NEEDBITS(8) - slide[w++] = (byte)b; + slide[w++] = (uint8_t)b; if (w == WSIZE) { flush_output(w); @@ -681,8 +681,8 @@ int Inflator::inflate_dynamic() #else unsigned ll[286+30]; /* literal/length and distance code lengths */ #endif - register word32 b; /* bit buffer */ - register unsigned k; /* number of bits in bit buffer */ + word32 b; /* bit buffer */ + unsigned k; /* number of bits in bit buffer */ /* make local bit buffer */ @@ -829,8 +829,8 @@ int Inflator::inflate_block(bool &e) /* decompress an inflated block */ { unsigned t; /* block type */ - register word32 b; /* bit buffer */ - register unsigned k; /* number of bits in bit buffer */ + word32 b; /* bit buffer */ + unsigned k; /* number of bits in bit buffer */ /* make local bit buffer */ diff --git a/src/cryptlib/zinflate.h b/src/cryptlib/zinflate.h index 5e9c931..4ca00bd 100644 --- a/src/cryptlib/zinflate.h +++ b/src/cryptlib/zinflate.h @@ -14,16 +14,16 @@ public: Inflator(BufferedTransformation *output = NULL, BufferedTransformation *bypassed = NULL); - void Put(byte b) + void Put(uint8_t b) {Inflator::Put(&b, 1);} - void Put(const byte *inString, unsigned int length); + void Put(const uint8_t *inString, unsigned int length); void InputFinished(); private: struct huft { - byte e; /* number of extra bits or operation */ - byte b; /* number of bits in this code or subcode */ + uint8_t e; /* number of extra bits or operation */ + uint8_t b; /* number of bits in this code or subcode */ union { word16 n; /* literal, length base, or distance base */ struct huft *t; /* pointer to next level of table */ @@ -49,7 +49,7 @@ private: static const word16 mask_bits[18]; ByteQueue inQueue; - byte NEXTBYTE(); + uint8_t NEXTBYTE(); SecByteBlock slide; unsigned int wp; diff --git a/src/cryptlib/ztrees.cpp b/src/cryptlib/ztrees.cpp index e600583..cf51282 100644 --- a/src/cryptlib/ztrees.cpp +++ b/src/cryptlib/ztrees.cpp @@ -75,7 +75,7 @@ const int CodeTree::extra_dbits[] /* extra bits for each distance code */ const int CodeTree::extra_blbits[]/* extra bits for each bit length code */ = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; -const byte CodeTree::bl_order[] +const uint8_t CodeTree::bl_order[] = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; /* The lengths of the bit length codes are sent in order of decreasing * probability, to avoid transmitting the lengths for unused bit length codes. @@ -97,7 +97,7 @@ const byte CodeTree::bl_order[] static unsigned reverse(unsigned int code, int len) /* Reverse the first len bits of a code. */ { - register unsigned res = 0; + unsigned res = 0; do res = (res << 1) | (code & 1), code>>=1; while (--len); return res; } @@ -126,7 +126,7 @@ CodeTree::CodeTree(int deflate_level, BufferedTransformation &outQ) unsigned int n; /* iterates over tree elements */ unsigned int bits; /* bit counter */ unsigned int length; /* length value */ - register unsigned int code; /* code value */ + unsigned int code; /* code value */ unsigned int dist; /* distance index */ compressed_len = input_len = 0L; @@ -136,21 +136,21 @@ CodeTree::CodeTree(int deflate_level, BufferedTransformation &outQ) for (code=0; code < LENGTH_CODES-1; code++) { base_length[code] = length; for (n=0; n < (1U< dist code (0..29) */ dist = 0; for (code=0 ; code < 16; code++) { base_dist[code] = dist; for (n=0; n < (1U< inline cBlock::cBlock() : mbDirty(false), mBlockNum(cBl // init guard blocks to dummy value for (int i = 0; i < NUM_GUARD_BLOCKS; i++) { - mGuardMin[i] = (uint8)GUARD_BLOCK_VAL; - mGuardMax[i] = (uint8)GUARD_BLOCK_VAL; + mGuardMin[i] = (uint8_t)GUARD_BLOCK_VAL; + mGuardMax[i] = (uint8_t)GUARD_BLOCK_VAL; } // zero out memory @@ -123,7 +123,7 @@ template inline bool cBlock::AssertValid() const // determine if guard bites have been accidentally overwritten for (int i = 0; i < NUM_GUARD_BLOCKS; i++) { - if ((mGuardMin[i] != (uint8)GUARD_BLOCK_VAL) || (mGuardMax[i] != (uint8)GUARD_BLOCK_VAL)) + if ((mGuardMin[i] != (uint8_t)GUARD_BLOCK_VAL) || (mGuardMax[i] != (uint8_t)GUARD_BLOCK_VAL)) { ASSERT(false); return false; @@ -133,7 +133,7 @@ template inline bool cBlock::AssertValid() const return true; } -template inline bool cBlock::IsValidAddr(int8* pAddr) const +template inline bool cBlock::IsValidAddr(int8_t* pAddr) const { return ((pAddr >= &mpData[0]) && (pAddr <= &mpData[SIZE - 1])); } @@ -156,11 +156,11 @@ public: { cBlock::mBlockNum = blockNum; } - void SetTimestamp(uint32 timestamp) + void SetTimestamp(uint32_t timestamp) { mTimestamp = timestamp; } - uint32 GetTimestamp() const + uint32_t GetTimestamp() const { return mTimestamp; } @@ -169,7 +169,7 @@ public: void Read(cBidirArchive& arch, int blockNum = INVALID_NUM); //throw( eArchive ) // if blockNum is INVALID_NUM, then it reads in the current block number protected: - uint32 mTimestamp; + uint32_t mTimestamp; }; /////////////////////////////////////////////////////////////////////////////// @@ -184,8 +184,8 @@ template inline cBlockImpl::cBlockImpl() : cBlock(), mTime /////////////////////////////////////////////////////////////////////////////// template inline void cBlockImpl::Write(cBidirArchive& arch) //throw( eArchive ) { - ASSERT(mbDirty); - ASSERT((mBlockNum >= 0) && (((mBlockNum + 1) * SIZE) <= arch.Length())); + ASSERT(cBlock::mbDirty); + ASSERT((cBlock::mBlockNum >= 0) && (((cBlock::mBlockNum + 1) * SIZE) <= arch.Length())); arch.Seek((cBlock::mBlockNum * SIZE), cBidirArchive::BEGINNING); arch.WriteBlob(cBlock::mpData, SIZE); @@ -201,7 +201,7 @@ template inline void cBlockImpl::Read(cBidirArchive& arch, int b if (blockNum != INVALID_NUM) cBlock::mBlockNum = blockNum; - ASSERT((mBlockNum >= 0) && (((mBlockNum + 1) * SIZE) <= arch.Length())); + ASSERT((cBlock::mBlockNum >= 0) && (((cBlock::mBlockNum + 1) * SIZE) <= arch.Length())); // std::cout << "cBlockImpl::Read() mBlockNum = " << mBlockNum << " arch.Length() = " << arch.Length() << std::endl; diff --git a/src/db/blockfile.cpp b/src/db/blockfile.cpp index 1fb588c..e60faef 100644 --- a/src/db/blockfile.cpp +++ b/src/db/blockfile.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -194,7 +194,7 @@ cBlockFile::Block* cBlockFile::GetBlock(int blockNum) //throw (eArchive) #endif d.TraceNever("\tBlock %d was not in memory; paging it in\n", blockNum); - uint32 earliestTime = mvPagedBlocks[0].GetTimestamp(); + uint32_t earliestTime = mvPagedBlocks[0].GetTimestamp(); BlockVector::iterator it = mvPagedBlocks.begin(); BlockVector::iterator earliestIter = it; ++it; // since we don't want to check the first one diff --git a/src/db/blockfile.h b/src/db/blockfile.h index 187f962..c2579c0 100644 --- a/src/db/blockfile.h +++ b/src/db/blockfile.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -113,7 +113,7 @@ private: int mNumPages; int mNumBlocks; // the total number of blocks in the archive. - uint32 mTimer; // keeps track of the current "time" + uint32_t mTimer; // keeps track of the current "time" cBidirArchive* mpArchive; // note: I always own the deletion of the archive BlockVector mvPagedBlocks; diff --git a/src/db/blockrecordarray.cpp b/src/db/blockrecordarray.cpp index 247012d..b44a9cc 100644 --- a/src/db/blockrecordarray.cpp +++ b/src/db/blockrecordarray.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -52,9 +52,9 @@ inline cBlockRecordArray::tIndexArray& util_GetIndexArray(cBlockFile::Block* pBl // is stored in tRecordIndex) return a pointer to memory inside the block // that corresponds to the given offset /////////////////////////////////////////////////////////////////////////////// -inline int8* util_OffsetToAddr(cBlockFile::Block* pBlock, int offset) +inline int8_t* util_OffsetToAddr(cBlockFile::Block* pBlock, int offset) { - return (pBlock->GetData() + (cBlockFile::BLOCK_SIZE - offset)); + return reinterpret_cast((pBlock->GetData() + (cBlockFile::BLOCK_SIZE - offset))); } @@ -228,7 +228,7 @@ bool cBlockRecordArray::IsItemValid(int index) const //throw (eArchive) /////////////////////////////////////////////////////////////////////////////// // AddItem /////////////////////////////////////////////////////////////////////////////// -int cBlockRecordArray::AddItem(int8* pData, int dataSize, int mainIndex) //throw (eArchive) +int cBlockRecordArray::AddItem(int8_t* pData, int dataSize, int mainIndex) //throw (eArchive) { // make ourselves initialized, if we are not right now... // @@ -290,7 +290,7 @@ int cBlockRecordArray::AddItem(int8* pData, int dataSize, int mainIndex) //throw // we are going to have to shift up the data that is above us... // int topOffset = indexArray.maRecordIndex[GetNumItems() - 1].GetOffset(); - int8* pTop = util_OffsetToAddr(pBlock, topOffset); + int8_t* pTop = util_OffsetToAddr(pBlock, topOffset); int amtToMove = topOffset - prevOffset; ASSERT(amtToMove >= 0); @@ -385,7 +385,7 @@ void cBlockRecordArray::DeleteItem(int index) //throw (eArchive) { distToShift -= indexArray.maRecordIndex[index - 1].GetOffset(); } - int8* pSrc = util_OffsetToAddr(pBlock, indexArray.maRecordIndex[GetNumItems() - 1].GetOffset()); + int8_t* pSrc = util_OffsetToAddr(pBlock, indexArray.maRecordIndex[GetNumItems() - 1].GetOffset()); // // copy the data.. // @@ -424,7 +424,7 @@ void cBlockRecordArray::DeleteItem(int index) //throw (eArchive) /////////////////////////////////////////////////////////////////////////////// // GetDataForReading /////////////////////////////////////////////////////////////////////////////// -int8* cBlockRecordArray::GetDataForReading(int index, int32& dataSize) //throw (eArchive) +int8_t* cBlockRecordArray::GetDataForReading(int index, int32_t& dataSize) //throw (eArchive) { // make ourselves initialized, if we are not right now... // @@ -457,7 +457,7 @@ int8* cBlockRecordArray::GetDataForReading(int index, int32& dataSize) //throw ( /////////////////////////////////////////////////////////////////////////////// // GetDataForWriting /////////////////////////////////////////////////////////////////////////////// -int8* cBlockRecordArray::GetDataForWriting(int index, int32& dataSize) //throw (eArchive) +int8_t* cBlockRecordArray::GetDataForWriting(int index, int32_t& dataSize) //throw (eArchive) { // make ourselves initialized, if we are not right now... // @@ -545,7 +545,7 @@ bool cBlockRecordArray::IsClassValid() const // // make sure the final offset is less than the highest record index offset. // - BRA_ASSERT((int8*)&array.maRecordIndex[i] < util_OffsetToAddr(pBlock, prevOff)); + BRA_ASSERT((int8_t*)&array.maRecordIndex[i] < util_OffsetToAddr(pBlock, prevOff)); // // TODO -- is there anything else that is worth checking? } diff --git a/src/db/blockrecordarray.h b/src/db/blockrecordarray.h index df77b93..7cd219e 100644 --- a/src/db/blockrecordarray.h +++ b/src/db/blockrecordarray.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -80,18 +80,18 @@ public: //------------------------------------------------------------------------------------- // Data Manipulation //------------------------------------------------------------------------------------- - int AddItem(int8* pData, int dataSize, int mainIndex); //throw (eArchive) + int AddItem(int8_t* pData, int dataSize, int mainIndex); //throw (eArchive) // inserts the given item into the array; returns the index that it was inserted into. // this asserts that there is room for the new element, and updates the avail. space and // max index as necessary. void DeleteItem(int index); //throw (eArchive) // deletes the specified item; this asserts that the index is valid, and updates the avail. // space and max index as necessary. - int8* GetDataForReading(int index, int32& dataSize); //throw (eArchive) + int8_t* GetDataForReading(int index, int32_t& dataSize); //throw (eArchive) // returns a pointer to the named data. This method will assert that the address is // valid. The data pointer returned is guarenteed to be valid only until the next // method call into this class. - int8* GetDataForWriting(int index, int32& dataSize); //throw (eArchive) + int8_t* GetDataForWriting(int index, int32_t& dataSize); //throw (eArchive) // this is the same as the previous function, except the dirty bit for the page is also set bool IsItemValid(int index) const; //throw (eArchive) // returns true if the given index has a valid value. @@ -125,24 +125,24 @@ public: struct tRecordIndex { private: - int32 mOffset; // offset from the end of the block that my data is at; offset 1 is the last byte in the block - int32 mMainIndex; // my main array index + int32_t mOffset; // offset from the end of the block that my data is at; offset 1 is the last byte in the block + int32_t mMainIndex; // my main array index public: // byte order safe access methods... // - void SetOffset(int32 off) + void SetOffset(int32_t off) { mOffset = tw_htonl(off); } - int32 GetOffset() + int32_t GetOffset() { return tw_ntohl(mOffset); } - void SetMainIndex(int32 idx) + void SetMainIndex(int32_t idx) { mMainIndex = tw_htonl(idx); } - int32 GetMainIndex() + int32_t GetMainIndex() { return tw_ntohl(mMainIndex); } @@ -153,25 +153,25 @@ public: struct tHeader { private: - int32 mSpaceAvailable; - int32 mNumItems; + int32_t mSpaceAvailable; + int32_t mNumItems; public: // byte order safe access methods... // - void SetSpaceAvail(int32 sa) + void SetSpaceAvail(int32_t sa) { mSpaceAvailable = tw_htonl(sa); } - int32 GetSpaceAvail() + int32_t GetSpaceAvail() { return tw_ntohl(mSpaceAvailable); } - void SetNumItems(int32 ni) + void SetNumItems(int32_t ni) { mNumItems = tw_htonl(ni); } - int32 GetNumItems() + int32_t GetNumItems() { return tw_ntohl(mNumItems); } @@ -179,7 +179,7 @@ public: enum { - MAX_RECORDS = cBlockFile::BLOCK_SIZE / (sizeof(tRecordIndex) + sizeof(uint32)), + MAX_RECORDS = cBlockFile::BLOCK_SIZE / (sizeof(tRecordIndex) + sizeof(uint32_t)), // MAX_RECORDS signifies the maximum number of records that can be stored in a single block. // It is rationalized like this: each used record needs a tRecordIndex plus an extra uint32 // as a minimum storage requirement (even though it is ok to have a record that is filled in diff --git a/src/db/blockrecordfile.cpp b/src/db/blockrecordfile.cpp index 9cc9961..a94f714 100644 --- a/src/db/blockrecordfile.cpp +++ b/src/db/blockrecordfile.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -150,7 +150,7 @@ void cBlockRecordFile::Flush() //throw (eArchive) /////////////////////////////////////////////////////////////////////////////// // AddItem /////////////////////////////////////////////////////////////////////////////// -cBlockRecordFile::tAddr cBlockRecordFile::AddItem(int8* pData, int dataSize) //throw (eArchive) +cBlockRecordFile::tAddr cBlockRecordFile::AddItem(int8_t* pData, int dataSize) //throw (eArchive) { ASSERT(mbOpen); #ifdef _BLOCKFILE_DEBUG @@ -224,7 +224,7 @@ bool cBlockRecordFile::IsValidAddr(cBlockRecordFile::tAddr addr) //throw (eArchi /////////////////////////////////////////////////////////////////////////////// // GetDataForReading /////////////////////////////////////////////////////////////////////////////// -int8* cBlockRecordFile::GetDataForReading(cBlockRecordFile::tAddr dataAddr, int32& dataSize) //throw (eArchive) +int8_t* cBlockRecordFile::GetDataForReading(cBlockRecordFile::tAddr dataAddr, int32_t& dataSize) //throw (eArchive) { ASSERT(mbOpen); ASSERT(IsValidAddr(dataAddr)); @@ -238,7 +238,7 @@ int8* cBlockRecordFile::GetDataForReading(cBlockRecordFile::tAddr dataAddr, int3 /////////////////////////////////////////////////////////////////////////////// // GetDataForWriting /////////////////////////////////////////////////////////////////////////////// -int8* cBlockRecordFile::GetDataForWriting(cBlockRecordFile::tAddr dataAddr, int32& dataSize) //throw (eArchive) +int8_t* cBlockRecordFile::GetDataForWriting(cBlockRecordFile::tAddr dataAddr, int32_t& dataSize) //throw (eArchive) { ASSERT(mbOpen); ASSERT(IsValidAddr(dataAddr)); @@ -252,7 +252,7 @@ int8* cBlockRecordFile::GetDataForWriting(cBlockRecordFile::tAddr dataAddr, int3 /////////////////////////////////////////////////////////////////////////////// // FindRoomForData /////////////////////////////////////////////////////////////////////////////// -int cBlockRecordFile::FindRoomForData(int32 dataSize) //throw (eArchive) +int cBlockRecordFile::FindRoomForData(int32_t dataSize) //throw (eArchive) { ASSERT((dataSize > 0) && (dataSize <= cBlockRecordArray::MAX_DATA_SIZE)); ASSERT(mbOpen); diff --git a/src/db/blockrecordfile.h b/src/db/blockrecordfile.h index c12897b..533c2cf 100644 --- a/src/db/blockrecordfile.h +++ b/src/db/blockrecordfile.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -74,10 +74,10 @@ public: //------------------------------------------------------------------------- struct tAddr { - int32 mBlockNum; - int32 mIndex; + int32_t mBlockNum; + int32_t mIndex; - tAddr(int32 block = -1, int32 addr = -1) : mBlockNum(block), mIndex(addr) + tAddr(int32_t block = -1, int32_t addr = -1) : mBlockNum(block), mIndex(addr) { } }; @@ -85,7 +85,7 @@ public: //------------------------------------------------------------------------- // Adding and Removing Data //------------------------------------------------------------------------- - tAddr AddItem(int8* pData, int dataSize); //throw (eArchive) + tAddr AddItem(int8_t* pData, int dataSize); //throw (eArchive) // adds the given data to the file, growing it as necessary. Return value // can be used in the future to retrieve the data void RemoveItem(tAddr dataAddr); //throw (eArchive) @@ -99,11 +99,11 @@ public: //------------------------------------------------------------------------- bool IsValidAddr(tAddr addr); //throw (eArchive) // returns true if the given address points to valid data - int8* GetDataForReading(tAddr dataAddr, int32& dataSize); //throw (eArchive) + int8_t* GetDataForReading(tAddr dataAddr, int32_t& dataSize); //throw (eArchive) // returns a pointer to the named data. This method will assert that the address is // valid. The data pointer returned is guarenteed to be valid only until the next // method call into this class. - int8* GetDataForWriting(tAddr dataAddr, int32& dataSize); //throw (eArchive) + int8_t* GetDataForWriting(tAddr dataAddr, int32_t& dataSize); //throw (eArchive) // this is the same as the previous function, except the dirty bit for the page is also set cBidirArchive* GetArchive() @@ -130,7 +130,7 @@ protected: } private: - int32 mLastAddedTo; // optimization that keeps track of last block added to + int32_t mLastAddedTo; // optimization that keeps track of last block added to bool mbOpen; // are we currently associated with a file? cBlockFile mBlockFile; BlockArray mvBlocks; @@ -138,7 +138,7 @@ private: cBlockRecordFile(const cBlockRecordFile& rhs); //not impl void operator=(const cBlockRecordFile& rhs); //not impl - int FindRoomForData(int32 dataSize); //throw (eArchive) + int FindRoomForData(int32_t dataSize); //throw (eArchive) // searches through all the blocks, starting with mLastAddedTo, looking // for one with dataSize free space. This asserts that the size is valid // for storage in a block diff --git a/src/db/db.cpp b/src/db/db.cpp index 2a3d4b9..c4fddf3 100644 --- a/src/db/db.cpp +++ b/src/db/db.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/db.h b/src/db/db.h index b688ace..7faee5f 100644 --- a/src/db/db.h +++ b/src/db/db.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/dberrors.cpp b/src/db/dberrors.cpp index 5257937..3764a9d 100644 --- a/src/db/dberrors.cpp +++ b/src/db/dberrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/dberrors.h b/src/db/dberrors.h index d9a7fbe..b165c83 100644 --- a/src/db/dberrors.h +++ b/src/db/dberrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/hierdatabase.cpp b/src/db/hierdatabase.cpp index 227439b..4a7e63f 100644 --- a/src/db/hierdatabase.cpp +++ b/src/db/hierdatabase.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -64,8 +64,8 @@ static inline void util_ThrowIfNull(const cHierAddr& addr, const TSTRING& contex /////////////////////////////////////////////////////////////////////////////// static void util_ReadObject(cHierDatabase* pDb, cHierNode* pNode, const cHierAddr& addr) { - int32 dataSize; - int8* pData = pDb->GetDataForReading(cBlockRecordFile::tAddr(addr.mBlockNum, addr.mIndex), dataSize); + int32_t dataSize; + int8_t* pData = pDb->GetDataForReading(cBlockRecordFile::tAddr(addr.mBlockNum, addr.mIndex), dataSize); // // make sure we aren't trying to read a null object // @@ -96,8 +96,8 @@ static cHierAddr util_WriteObject(cHierDatabase* pDb, cHierNode* pNode) /////////////////////////////////////////////////////////////////////////////// static void util_RewriteObject(cHierDatabase* pDb, cHierNode* pNode, const cHierAddr& addr) { - int32 dataSize; - int8* pData = pDb->GetDataForWriting(cBlockRecordFile::tAddr(addr.mBlockNum, addr.mIndex), dataSize); + int32_t dataSize; + int8_t* pData = pDb->GetDataForWriting(cBlockRecordFile::tAddr(addr.mBlockNum, addr.mIndex), dataSize); util_ThrowIfNull(addr, _T("util_RewriteObject")); @@ -557,7 +557,7 @@ void cHierDatabaseIter::CreateEntry(const TSTRING& name) //throw (eArchive, eHie /////////////////////////////////////////////////////////////////////////////// // GetData /////////////////////////////////////////////////////////////////////////////// -int8* cHierDatabaseIter::GetData(int32& length) const //throw (eArchive, eHierDatabase) +int8_t* cHierDatabaseIter::GetData(int32_t& length) const //throw (eArchive, eHierDatabase) { ASSERT(HasData()); if (!HasData()) @@ -587,7 +587,7 @@ bool cHierDatabaseIter::HasData() const /////////////////////////////////////////////////////////////////////////////// // SetData /////////////////////////////////////////////////////////////////////////////// -void cHierDatabaseIter::SetData(int8* pData, int32 length) //throw (eArchive, eHierDatabase) +void cHierDatabaseIter::SetData(int8_t* pData, int32_t length) //throw (eArchive, eHierDatabase) { ASSERT(!Done()); ASSERT(!HasData()); diff --git a/src/db/hierdatabase.h b/src/db/hierdatabase.h index 52d1649..c02590b 100644 --- a/src/db/hierdatabase.h +++ b/src/db/hierdatabase.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -184,12 +184,12 @@ public: // // getting and setting the data associated with a given entry // - int8* GetData(int32& length) const; //throw (eArchive, eHierDatabase) + int8_t* GetData(int32_t& length) const; //throw (eArchive, eHierDatabase) // returns the data associated with the current entry; this asserts that the iterator is // not done and the current entry has data associated with it bool HasData() const; // returns true if the current entry has data - void SetData(int8* pData, int32 length); //throw (eArchive, eHierDatabase) + void SetData(int8_t* pData, int32_t length); //throw (eArchive, eHierDatabase) void RemoveData(); //throw (eArchive, eHierDatabase) // removes the data associated with the current entry; this asserts that the current // entry actually _has_ data diff --git a/src/db/hierdbnode.h b/src/db/hierdbnode.h index a92bd89..92acbcd 100644 --- a/src/db/hierdbnode.h +++ b/src/db/hierdbnode.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -75,12 +75,12 @@ public: { } - int32 mType; + int32_t mType; ///////////////////////////////////////// // methods to override ///////////////////////////////////////// - virtual int32 CalcArchiveSize() const + virtual int32_t CalcArchiveSize() const { return (sizeof(mType)); } @@ -113,10 +113,10 @@ public: class cHierAddr { public: - int32 mBlockNum; - int32 mIndex; + int32_t mBlockNum; + int32_t mIndex; - cHierAddr(int32 block = -1, int32 index = -1) : mBlockNum(block), mIndex(index) + cHierAddr(int32_t block = -1, int32_t index = -1) : mBlockNum(block), mIndex(index) { } @@ -134,7 +134,7 @@ public: ///////////////////////////////////////////////// // serialization methods ///////////////////////////////////////////////// - int32 CalcArchiveSize() const + int32_t CalcArchiveSize() const { return (sizeof(mBlockNum) + sizeof(mIndex)); } @@ -169,7 +169,7 @@ public: ///////////////////////////////////////////////// // serialization methods ///////////////////////////////////////////////// - virtual int32 CalcArchiveSize() const + virtual int32_t CalcArchiveSize() const { return (cHierNode::CalcArchiveSize() + mChild.CalcArchiveSize()); } @@ -193,7 +193,7 @@ public: throw eArchiveFormat(_T("Invalid type encountered; expected ROOT node")); } mChild.Read(arch); - int32 cs; + int32_t cs; arch.ReadInt32(cs); mbCaseSensitive = cs ? true : false; TSTRING dc; @@ -226,7 +226,7 @@ public: ///////////////////////////////////////////////// // serialization methods ///////////////////////////////////////////////// - virtual int32 CalcArchiveSize() const + virtual int32_t CalcArchiveSize() const { return (cHierNode::CalcArchiveSize() + mChild.CalcArchiveSize() + mData.CalcArchiveSize() + cArchive::GetStorageSize(mName) + mNext.CalcArchiveSize()); @@ -274,7 +274,7 @@ public: ///////////////////////////////////////////////// // serialization methods ///////////////////////////////////////////////// - virtual int32 CalcArchiveSize() const + virtual int32_t CalcArchiveSize() const { return (cHierNode::CalcArchiveSize() + mParent.CalcArchiveSize() + mArray.CalcArchiveSize()); } diff --git a/src/db/hierdbpath.cpp b/src/db/hierdbpath.cpp index bb165d8..80052ae 100644 --- a/src/db/hierdbpath.cpp +++ b/src/db/hierdbpath.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/hierdbpath.h b/src/db/hierdbpath.h index e9fcb54..1191960 100644 --- a/src/db/hierdbpath.h +++ b/src/db/hierdbpath.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/stddb.cpp b/src/db/stddb.cpp index 7309934..6e93746 100644 --- a/src/db/stddb.cpp +++ b/src/db/stddb.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/db/stddb.h b/src/db/stddb.h index 41ab74c..44c1964 100644 --- a/src/db/stddb.h +++ b/src/db/stddb.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/Makefile.in b/src/fco/Makefile.in index 0300072..ef9e0cb 100644 --- a/src/fco/Makefile.in +++ b/src/fco/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -136,7 +136,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) @@ -308,6 +308,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -367,8 +368,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -473,7 +474,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/src/fco/fco.cpp b/src/fco/fco.cpp index 15a3b23..1523b64 100644 --- a/src/fco/fco.cpp +++ b/src/fco/fco.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fco.h b/src/fco/fco.h index 7cc96cb..9d1852f 100644 --- a/src/fco/fco.h +++ b/src/fco/fco.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -113,7 +113,7 @@ public: // by the FCO and is only guarenteed to be valid through the life of the // fco. - virtual uint32 GetCaps() const = 0; + virtual uint32_t GetCaps() const = 0; // returns a bitmask that indicates properties that this object has. // see the enum below for what the caps can contain @@ -200,8 +200,8 @@ public: virtual void Clear() = 0; // clears out all the elements from the set - virtual bool IsEmpty() const = 0; - virtual int Size() const = 0; + virtual bool IsEmpty() const = 0; + virtual int Size() const = 0; virtual void TraceContents(int debugLevel = -1) const { diff --git a/src/fco/fcocompare.cpp b/src/fco/fcocompare.cpp index b0d873b..06a51ff 100644 --- a/src/fco/fcocompare.cpp +++ b/src/fco/fcocompare.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -57,7 +57,7 @@ cFCOCompare::~cFCOCompare() /////////////////////////////////////////////////////////////////////////////// // Compare /////////////////////////////////////////////////////////////////////////////// -uint32 cFCOCompare::Compare(const iFCO* pFco1, const iFCO* pFco2) +uint32_t cFCOCompare::Compare(const iFCO* pFco1, const iFCO* pFco2) { ASSERT(pFco1 != 0); ASSERT(pFco2 != 0); @@ -74,7 +74,7 @@ uint32 cFCOCompare::Compare(const iFCO* pFco1, const iFCO* pFco2) const cFCOPropVector& v1 = pFco1->GetPropSet()->GetValidVector(); const cFCOPropVector& v2 = pFco2->GetPropSet()->GetValidVector(); - uint32 result = 0; + uint32_t result = 0; mInvalidProps.SetSize(v1.GetSize()); mUnequalProps.SetSize(v1.GetSize()); diff --git a/src/fco/fcocompare.h b/src/fco/fcocompare.h index 85e6116..8e3be6c 100644 --- a/src/fco/fcocompare.h +++ b/src/fco/fcocompare.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -61,7 +61,7 @@ public: // gets and sets the property vector that indicates what properties the // object will consider in the comparisons. - uint32 Compare(const iFCO* pFco1, const iFCO* pFco2); + uint32_t Compare(const iFCO* pFco1, const iFCO* pFco2); // compares fco1 and fco2, only considering the properties specified set with // SetPropsToCmp(). The result of the comparison is a bitmask that is currently either // EQUAL or a combination of PROPS_NOT_ALL_VALID and PROPS_UNEQUAL. You can discover which diff --git a/src/fco/fcodatasource.h b/src/fco/fcodatasource.h index a69e31c..4118b8b 100644 --- a/src/fco/fcodatasource.h +++ b/src/fco/fcodatasource.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcodatasourceiter.cpp b/src/fco/fcodatasourceiter.cpp index b2cf161..26b0f59 100644 --- a/src/fco/fcodatasourceiter.cpp +++ b/src/fco/fcodatasourceiter.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcodatasourceiter.h b/src/fco/fcodatasourceiter.h index 8f025e3..17c45cd 100644 --- a/src/fco/fcodatasourceiter.h +++ b/src/fco/fcodatasourceiter.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcodatasourceiterimpl.cpp b/src/fco/fcodatasourceiterimpl.cpp index fce3972..697d654 100644 --- a/src/fco/fcodatasourceiterimpl.cpp +++ b/src/fco/fcodatasourceiterimpl.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcodatasourceiterimpl.h b/src/fco/fcodatasourceiterimpl.h index 7a619a9..248610b 100644 --- a/src/fco/fcodatasourceiterimpl.h +++ b/src/fco/fcodatasourceiterimpl.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -109,7 +109,7 @@ protected: cFCOName mParentName; FCOList mPeers; FCOList::const_iterator mCurPos; - uint32 mFlags; + uint32_t mFlags; //------------------------------------------------------------------------- // helper methods diff --git a/src/fco/fcoerrors.cpp b/src/fco/fcoerrors.cpp index 4838c19..e72a1eb 100644 --- a/src/fco/fcoerrors.cpp +++ b/src/fco/fcoerrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcoerrors.h b/src/fco/fcoerrors.h index 4feea79..558bd30 100644 --- a/src/fco/fcoerrors.h +++ b/src/fco/fcoerrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcogenre.h b/src/fco/fcogenre.h index bf3efc9..59eca84 100644 --- a/src/fco/fcogenre.h +++ b/src/fco/fcogenre.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -54,7 +54,7 @@ class cGenre { public: - typedef uint32 Genre; + typedef uint32_t Genre; //----------------------------------------- diff --git a/src/fco/fconame.cpp b/src/fco/fconame.cpp index 8621651..c9aaab3 100644 --- a/src/fco/fconame.cpp +++ b/src/fco/fconame.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -382,7 +382,7 @@ cFCOName::Relationship cFCOName::GetRelationship(const cFCOName& rhs) const // TODO -- serialize the hash table and nodes instead of reading and writing // as a string /////////////////////////////////////////////////////////////////////////////// -void cFCOName::Read(iSerializer* pSerializer, int32 version) +void cFCOName::Read(iSerializer* pSerializer, int32_t version) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("FCO Name Read"))); @@ -390,7 +390,7 @@ void cFCOName::Read(iSerializer* pSerializer, int32 version) TSTRING str; pSerializer->ReadString(str); - int16 dummy = 0; + int16_t dummy = 0; // serialize the delimiter pSerializer->ReadInt16(dummy); // delimiter, but it's always '/' anyway in OST. @@ -421,7 +421,7 @@ void cFCOName::Write(iSerializer* pSerializer) const // serialize the delimiter unsigned short wc = (unsigned short)'/'; pSerializer->WriteInt16(wc); - pSerializer->WriteInt16(mbCaseSensitive ? (int16)1 : (int16)0); + pSerializer->WriteInt16(mbCaseSensitive ? (int16_t)1 : (int16_t)0); } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/fco/fconame.h b/src/fco/fconame.h index a5e607e..56fe76a 100644 --- a/src/fco/fconame.h +++ b/src/fco/fconame.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -123,7 +123,7 @@ public: // returns the relationship of _this_ name to the one passed in (ie -- if REL_BELOW is returned, // this fco name is below the one passed in) - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) ////////////////////////////////// diff --git a/src/fco/fconameinfo.h b/src/fco/fconameinfo.h index 4a6e439..3f25f26 100644 --- a/src/fco/fconameinfo.h +++ b/src/fco/fconameinfo.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fconametbl.cpp b/src/fco/fconametbl.cpp index 19f628a..a51aab8 100644 --- a/src/fco/fconametbl.cpp +++ b/src/fco/fconametbl.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fconametbl.h b/src/fco/fconametbl.h index 1be76e0..d79ff97 100644 --- a/src/fco/fconametbl.h +++ b/src/fco/fconametbl.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fconametranslator.h b/src/fco/fconametranslator.h index 9c89cb0..3b91013 100644 --- a/src/fco/fconametranslator.h +++ b/src/fco/fconametranslator.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcoprop.h b/src/fco/fcoprop.h index d3519d8..ed14efd 100644 --- a/src/fco/fcoprop.h +++ b/src/fco/fcoprop.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcopropcalc.h b/src/fco/fcopropcalc.h index c820c93..74c8d7c 100644 --- a/src/fco/fcopropcalc.h +++ b/src/fco/fcopropcalc.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcopropdisplayer.h b/src/fco/fcopropdisplayer.h index e3d33c5..cb36dca 100644 --- a/src/fco/fcopropdisplayer.h +++ b/src/fco/fcopropdisplayer.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcopropimpl.cpp b/src/fco/fcopropimpl.cpp index 42022ef..bcf6fb2 100644 --- a/src/fco/fcopropimpl.cpp +++ b/src/fco/fcopropimpl.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -125,9 +125,11 @@ TSTRING cFCOPropInt32::AsString() const //TODO:mdb -- implement this through twlocale! // TOSTRINGSTREAM ostr; - ostr.imbue(std::locale::classic()); + tss_classic_locale(ostr); ostr << mValue; - return TSTRING(ostr.str()); + tss_mkstr(out, ostr); + + return out; } iFCOProp::CmpResult cFCOPropInt32::Compare(const iFCOProp* rhs, iFCOProp::Op op) const @@ -135,10 +137,10 @@ iFCOProp::CmpResult cFCOPropInt32::Compare(const iFCOProp* rhs, iFCOProp::Op op) return DefaultCompare(this, rhs, op); } -void cFCOPropInt32::Read(iSerializer* pSerializer, int32 version) +void cFCOPropInt32::Read(iSerializer* pSerializer, int32_t version) { if (version > 0) - ThrowAndAssert(eSerializerVersionMismatch(_T("Int32 Property Read"))); + ThrowAndAssert(eSerializerVersionMismatch(_T("int32_t Property Read"))); pSerializer->ReadInt32(mValue); } @@ -165,9 +167,10 @@ TSTRING cFCOPropInt64::AsString() const //TODO:mdb -- implement this through twlocale! // TOSTRINGSTREAM ostr; - ostr.imbue(std::locale::classic()); - ostr << (int32)mValue; - return TSTRING(ostr.str()); + tss_classic_locale(ostr); + ostr << (int32_t)mValue; // TODO: remove this cast where possible + tss_mkstr(out, ostr); + return out; } iFCOProp::CmpResult cFCOPropInt64::Compare(const iFCOProp* rhs, iFCOProp::Op op) const @@ -175,10 +178,10 @@ iFCOProp::CmpResult cFCOPropInt64::Compare(const iFCOProp* rhs, iFCOProp::Op op) return DefaultCompare(this, rhs, op); } -void cFCOPropInt64::Read(iSerializer* pSerializer, int32 version) +void cFCOPropInt64::Read(iSerializer* pSerializer, int32_t version) { if (version > 0) - ThrowAndAssert(eSerializerVersionMismatch(_T("Int64 Property Read"))); + ThrowAndAssert(eSerializerVersionMismatch(_T("int64_t Property Read"))); pSerializer->ReadInt64(mValue); } @@ -205,9 +208,9 @@ TSTRING cFCOPropUint64::AsString() const //TODO:mdb -- implement this through twlocale! // TOSTRINGSTREAM ostr; - ostr.imbue(std::locale::classic()); - ostr << (int32)mValue; - return TSTRING(ostr.str()); + tss_classic_locale(ostr); + ostr << (int32_t)mValue; // TODO: remove this cast where possible + tss_return_stream(ostr, out); } iFCOProp::CmpResult cFCOPropUint64::Compare(const iFCOProp* rhs, iFCOProp::Op op) const @@ -215,12 +218,12 @@ iFCOProp::CmpResult cFCOPropUint64::Compare(const iFCOProp* rhs, iFCOProp::Op op return DefaultCompare(this, rhs, op); } -void cFCOPropUint64::Read(iSerializer* pSerializer, int32 version) +void cFCOPropUint64::Read(iSerializer* pSerializer, int32_t version) { if (version > 0) - ThrowAndAssert(eSerializerVersionMismatch(_T("uint64 Property Read"))); + ThrowAndAssert(eSerializerVersionMismatch(_T("uint64_t Property Read"))); - pSerializer->ReadInt64((int64&)mValue); + pSerializer->ReadInt64((int64_t&)mValue); } void cFCOPropUint64::Write(iSerializer* pSerializer) const @@ -250,7 +253,7 @@ iFCOProp::CmpResult cFCOPropTSTRING::Compare(const iFCOProp* rhs, iFCOProp::Op o return DefaultCompare(this, rhs, op); } -void cFCOPropTSTRING::Read(iSerializer* pSerializer, int32 version) +void cFCOPropTSTRING::Read(iSerializer* pSerializer, int32_t version) { if (version > 0) ThrowAndAssert(eSerializerVersionMismatch(_T("String Property Read"))); diff --git a/src/fco/fcopropimpl.h b/src/fco/fcopropimpl.h index 6044663..134d770 100644 --- a/src/fco/fcopropimpl.h +++ b/src/fco/fcopropimpl.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -65,7 +65,7 @@ public: \ class cFCOPropInt32 : public iFCOProp { public: - PROP_DATA(int32) // see macro above + PROP_DATA(int32_t) // see macro above DECLARE_TYPEDSERIALIZABLE() // type information cFCOPropInt32() : mValue(0) @@ -81,14 +81,14 @@ public: virtual void Copy(const iFCOProp* rhs); // iSerializable interface - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) }; class cFCOPropInt64 : public iFCOProp { public: - PROP_DATA(int64) // see macro above + PROP_DATA(int64_t) // see macro above DECLARE_TYPEDSERIALIZABLE() // type information cFCOPropInt64() : mValue(0) @@ -104,14 +104,14 @@ public: virtual void Copy(const iFCOProp* rhs); // iSerializable interface - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) }; class cFCOPropUint64 : public iFCOProp { public: - PROP_DATA(uint64) // see macro above + PROP_DATA(uint64_t) // see macro above DECLARE_TYPEDSERIALIZABLE() // type information cFCOPropUint64() : mValue(0) @@ -127,7 +127,7 @@ public: virtual void Copy(const iFCOProp* rhs); // iSerializable interface - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) }; @@ -151,7 +151,7 @@ public: virtual void Copy(const iFCOProp* rhs); // iSerializable interface - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) }; diff --git a/src/fco/fcopropset.h b/src/fco/fcopropset.h index cdfce69..2a58267 100644 --- a/src/fco/fcopropset.h +++ b/src/fco/fcopropset.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcopropvector.cpp b/src/fco/fcopropvector.cpp index 6a8d7cb..bab9ed3 100644 --- a/src/fco/fcopropvector.cpp +++ b/src/fco/fcopropvector.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -39,7 +39,7 @@ #include "core/debug.h" #include "core/errorutil.h" -int cFCOPropVector::msBitlength(sizeof(uint32) * 8); +int cFCOPropVector::msBitlength(sizeof(uint32_t) * 8); //msBitlength is common to all objects of class. /////////////////////////////////////////////////////////////////////////////// @@ -71,7 +71,7 @@ cFCOPropVector::cFCOPropVector(const cFCOPropVector& rhs) : iSerializable() mMask = rhs.mMask; if (rhs.mpBuf != NULL) { - mpBuf = new std::vector; + mpBuf = new std::vector; *mpBuf = *(rhs.mpBuf); } else @@ -122,7 +122,7 @@ cFCOPropVector& cFCOPropVector::operator=(const cFCOPropVector& rhs) *mpBuf = *(rhs.mpBuf); else if ((rhs.mpBuf != NULL) && (mpBuf == NULL)) { - mpBuf = new std::vector; + mpBuf = new std::vector; *mpBuf = *(rhs.mpBuf); } else if ((rhs.mpBuf == NULL) && (mpBuf != NULL)) @@ -254,7 +254,7 @@ int cFCOPropVector::SetSize(int max) } else if ((mpBuf == NULL) && (max > msBitlength)) { - mpBuf = new std::vector; + mpBuf = new std::vector; (*mpBuf).resize(((max / msBitlength) + 1), 0); (*mpBuf)[0] = mMask; return mSize = ((*mpBuf).capacity() * msBitlength); @@ -367,8 +367,8 @@ bool cFCOPropVector::isExtended(void) const return false; else { - uint32 sum = 0; - for (uint32 i = (*mpBuf).size() - 1; i >= 2; i--) + uint32_t sum = 0; + for (uint32_t i = (*mpBuf).size() - 1; i >= 2; i--) sum += ((*mpBuf)[i]); return (sum != 0); } @@ -391,12 +391,12 @@ void cFCOPropVector::check(cDebug& d) const } //end check -void cFCOPropVector::Read(iSerializer* pSerializer, int32 version) +void cFCOPropVector::Read(iSerializer* pSerializer, int32_t version) { if (version > 0) ThrowAndAssert(eSerializerVersionMismatch(_T("Property Vector Read"))); - int32 newSize; + int32_t newSize; pSerializer->ReadInt32(newSize); ASSERT(newSize > 0); @@ -404,7 +404,7 @@ void cFCOPropVector::Read(iSerializer* pSerializer, int32 version) if (mpBuf == NULL) { - int32 mask; + int32_t mask; pSerializer->ReadInt32(mask); mMask = mask; } @@ -412,7 +412,7 @@ void cFCOPropVector::Read(iSerializer* pSerializer, int32 version) { for (int i = 0; i <= mSize / msBitlength; ++i) { - int32 mask; + int32_t mask; pSerializer->ReadInt32(mask); (*mpBuf)[i] = mask; } @@ -450,6 +450,7 @@ void cFCOPropVector::TraceContents(int dl) const if (ContainsItem(i)) ostr << i << _T(", "); } - ostr << std::ends; - d.Trace(dl, _T("Size = %d Contents = %s\n"), GetSize(), ostr.str().c_str()); + + tss_mkstr(contents, ostr); + d.Trace(dl, _T("Size = %d Contents = %s\n"), GetSize(), contents.c_str()); } diff --git a/src/fco/fcopropvector.h b/src/fco/fcopropvector.h index 3867b61..85eb578 100644 --- a/src/fco/fcopropvector.h +++ b/src/fco/fcopropvector.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -86,7 +86,7 @@ public: void check(cDebug& d) const; // Temp function for testing purposes. Outputs vector info. TO DO: // Get rid of this when it's no longer useful! DA - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) // iSerializable interface void TraceContents(int dl = -1) const; @@ -96,10 +96,10 @@ private: bool isExtended(void) const; // Helper function that discerns if an object is using mpBuf beyond [0] - int mSize; - static int msBitlength; - uint32 mMask; - std::vector* mpBuf; + int mSize; + static int msBitlength; + uint32_t mMask; + std::vector* mpBuf; }; #endif //__FCOPROPVECTOR_H diff --git a/src/fco/fcosetimpl.cpp b/src/fco/fcosetimpl.cpp index 9012c70..b5e5e5e 100644 --- a/src/fco/fcosetimpl.cpp +++ b/src/fco/fcosetimpl.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -178,7 +178,7 @@ void cFCOSetImpl::Insert(iFCO* pFCO) /////////////////////////////////////////////////////////////////////////////// // AcceptSerializer /////////////////////////////////////////////////////////////////////////////// -void cFCOSetImpl::Read(iSerializer* pSerializer, int32 version) +void cFCOSetImpl::Read(iSerializer* pSerializer, int32_t version) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("FCO Set Read"))); @@ -186,7 +186,7 @@ void cFCOSetImpl::Read(iSerializer* pSerializer, int32 version) Clear(); int i; - int32 size; + int32_t size; pSerializer->ReadInt32(size); // TODO -- don't assert; throw an exception or noop -- mdb diff --git a/src/fco/fcosetimpl.h b/src/fco/fcosetimpl.h index 69b7b3f..50fc6f4 100644 --- a/src/fco/fcosetimpl.h +++ b/src/fco/fcosetimpl.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -72,7 +72,7 @@ public: virtual void TraceContents(int dl = -1) const; // iSerializable interface - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) private: void ReturnIter(const cFCOIterImpl* pIter) const; diff --git a/src/fco/fcosetws.h b/src/fco/fcosetws.h index dd91bc1..ed591fb 100644 --- a/src/fco/fcosetws.h +++ b/src/fco/fcosetws.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcospec.cpp b/src/fco/fcospec.cpp index 60a4718..558232c 100644 --- a/src/fco/fcospec.cpp +++ b/src/fco/fcospec.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcospec.h b/src/fco/fcospec.h index d0df17f..3e00d5f 100644 --- a/src/fco/fcospec.h +++ b/src/fco/fcospec.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcospecattr.cpp b/src/fco/fcospecattr.cpp index 527b1e2..fa3b1e2 100644 --- a/src/fco/fcospecattr.cpp +++ b/src/fco/fcospecattr.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -42,12 +42,12 @@ IMPLEMENT_SERREFCOUNT(cFCOSpecAttr, _T("cFCOSpecAttr"), 0, 1) /////////////////////////////////////////////////////////////////////////////// // Read /////////////////////////////////////////////////////////////////////////////// -void cFCOSpecAttr::Read(iSerializer* pSerializer, int32 version) +void cFCOSpecAttr::Read(iSerializer* pSerializer, int32_t version) { pSerializer->ReadString(mName); pSerializer->ReadInt32(mSeverity); - int32 size; + int32_t size; TSTRING str; pSerializer->ReadInt32(size); mEmailAddrs.clear(); diff --git a/src/fco/fcospecattr.h b/src/fco/fcospecattr.h index 3618601..9be0759 100644 --- a/src/fco/fcospecattr.h +++ b/src/fco/fcospecattr.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -63,15 +63,15 @@ public: const TSTRING& GetName() const; void SetName(const TSTRING& name); - int32 GetSeverity() const; - void SetSeverity(int32 s); + int32_t GetSeverity() const; + void SetSeverity(int32_t s); int GetNumEmail() const; void AddEmail(const TSTRING& str); // adds an email address for report notification. This class makes no attempt // to catch and prune identical entries in the email list. - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) void TraceContents(int dl = -1) const; @@ -85,7 +85,7 @@ private: std::list mEmailAddrs; // the email addresses of people to be notified TSTRING mName; // the name of the spec - int32 mSeverity; // the severity level + int32_t mSeverity; // the severity level friend class cFCOSpecAttrEmailIter; }; @@ -128,11 +128,11 @@ inline void cFCOSpecAttr::SetName(const TSTRING& name) { mName = name; } -inline int32 cFCOSpecAttr::GetSeverity() const +inline int32_t cFCOSpecAttr::GetSeverity() const { return mSeverity; } -inline void cFCOSpecAttr::SetSeverity(int32 s) +inline void cFCOSpecAttr::SetSeverity(int32_t s) { mSeverity = s; } diff --git a/src/fco/fcospechelper.cpp b/src/fco/fcospechelper.cpp index 745243c..d45ec28 100644 --- a/src/fco/fcospechelper.cpp +++ b/src/fco/fcospechelper.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -46,7 +46,7 @@ /////////////////////////////////////////////////////////////////////////////// // Read /////////////////////////////////////////////////////////////////////////////// -void iFCOSpecHelper::Read(iSerializer* pSerializer, int32 version) +void iFCOSpecHelper::Read(iSerializer* pSerializer, int32_t version) { // read the start point pSerializer->ReadObject(&mStartPoint); @@ -113,10 +113,11 @@ void cFCOSpecStopPointSet::SetStartPoint(const cFCOName& startPoint) TOSTRINGSTREAM str; str << "Bad start point [" << iTWFactory::GetInstance()->GetNameTranslator()->ToStringDisplay(startPoint) << "] added to spec with stop point " - << iTWFactory::GetInstance()->GetNameTranslator()->ToStringDisplay(*i) << std::ends; - - d.TraceError("%s\n", str.str().c_str()); - throw eSerializerInputStreamFmt(str.str().c_str()); + << iTWFactory::GetInstance()->GetNameTranslator()->ToStringDisplay(*i); + tss_mkstr(errText, str); + + d.TraceError("%s\n", errText.c_str()); + throw eSerializerInputStreamFmt(errText); } } @@ -178,10 +179,12 @@ void cFCOSpecStopPointSet::Add(const cFCOName& name) TOSTRINGSTREAM str; str << "Attempt to add stop point that is not below start point!" << " start point = " << iTWFactory::GetInstance()->GetNameTranslator()->ToStringDisplay(mStartPoint) - << " stop point = " << iTWFactory::GetInstance()->GetNameTranslator()->ToStringDisplay(name) << std::ends; + << " stop point = " << iTWFactory::GetInstance()->GetNameTranslator()->ToStringDisplay(name); - d.TraceError(_T("%s\n"), str.str().c_str()); - throw eSerializerInputStreamFmt(str.str().c_str()); + tss_mkstr(errText, str); + + d.TraceError(_T("%s\n"), errText.c_str()); + throw eSerializerInputStreamFmt(errText); } std::set::iterator i; @@ -247,14 +250,14 @@ iFCOSpecHelper* cFCOSpecStopPointSet::Clone() const /////////////////////////////////////////////////////////////////////////////// // Read /////////////////////////////////////////////////////////////////////////////// -void cFCOSpecStopPointSet::Read(iSerializer* pSerializer, int32 version) +void cFCOSpecStopPointSet::Read(iSerializer* pSerializer, int32_t version) { // read the start point //pSerializer->ReadObject(&mStartPoint); inherited::Read(pSerializer, version); // read all the stop points - int32 size; + int32_t size; pSerializer->ReadInt32(size); ASSERT(size >= 0); for (int i = 0; i < size; ++i) @@ -346,7 +349,7 @@ bool cFCOSpecNoChildren::ShouldStopDescent(const cFCOName& name) const /////////////////////////////////////////////////////////////////////////////// // Read /////////////////////////////////////////////////////////////////////////////// -void cFCOSpecNoChildren::Read(iSerializer* pSerializer, int32 version) +void cFCOSpecNoChildren::Read(iSerializer* pSerializer, int32_t version) { inherited::Read(pSerializer, version); } diff --git a/src/fco/fcospechelper.h b/src/fco/fcospechelper.h index 353446e..6a9297d 100644 --- a/src/fco/fcospechelper.h +++ b/src/fco/fcospechelper.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -75,7 +75,7 @@ public: // encountered. Really, ContainsFCO() could be used to reach the same ends, but // this might/should be faster. - virtual void Read(iSerializer* pSerializer, int32 version = 0); + virtual void Read(iSerializer* pSerializer, int32_t version = 0); virtual void Write(iSerializer* pSerializer) const; // these just serialize the start point. @@ -154,7 +154,7 @@ public: // iSerializable interface - virtual void Read(iSerializer* pSerializer, int32 version = 0); + virtual void Read(iSerializer* pSerializer, int32_t version = 0); virtual void Write(iSerializer* pSerializer) const; virtual CompareResult Compare(const iFCOSpecHelper* pRhs) const; @@ -209,7 +209,7 @@ public: virtual bool ContainsFCO(const cFCOName& name) const; virtual iFCOSpecHelper* Clone() const; virtual bool ShouldStopDescent(const cFCOName& name) const; - virtual void Read(iSerializer* pSerializer, int32 version = 0); + virtual void Read(iSerializer* pSerializer, int32_t version = 0); virtual void Write(iSerializer* pSerializer) const; virtual CompareResult Compare(const iFCOSpecHelper* pRhs) const; virtual void TraceContents(int dl = -1) const; diff --git a/src/fco/fcospecimpl.cpp b/src/fco/fcospecimpl.cpp index b529314..dd8d163 100644 --- a/src/fco/fcospecimpl.cpp +++ b/src/fco/fcospecimpl.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -178,7 +178,7 @@ const iFCOSpecMask* cFCOSpecImpl::GetSpecMask(const iFCO* pFCO) const } -void cFCOSpecImpl::Read(iSerializer* pSerializer, int32 version) +void cFCOSpecImpl::Read(iSerializer* pSerializer, int32_t version) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("FS Spec Read"))); diff --git a/src/fco/fcospecimpl.h b/src/fco/fcospecimpl.h index c3f4eea..2d38a09 100644 --- a/src/fco/fcospecimpl.h +++ b/src/fco/fcospecimpl.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -91,7 +91,7 @@ public: // but it will not delete the current helper when SetHelper() is called. // iSerializable interface - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) diff --git a/src/fco/fcospeclist.cpp b/src/fco/fcospeclist.cpp index 583294b..048ebfe 100644 --- a/src/fco/fcospeclist.cpp +++ b/src/fco/fcospeclist.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -103,6 +103,7 @@ void cFCOSpecList::Add(iFCOSpec* pSpec, cFCOSpecAttr* pAttr) pAttr = new cFCOSpecAttr; else pAttr->AddRef(); + for (itr = mCanonicalList.begin();; ++itr) { if (itr == mCanonicalList.end() || iFCOSpecUtil::FCOSpecLessThan(*pSpec, *itr->first)) @@ -118,34 +119,37 @@ iFCOSpec* cFCOSpecList::Lookup(iFCOSpec* pSpec) const { std::list::iterator itr; for (itr = mCanonicalList.begin(); itr != mCanonicalList.end(); ++itr) + { if (itr->first == pSpec) { pSpec->AddRef(); return itr->first; } + } for (itr = mCanonicalList.begin(); itr != mCanonicalList.end(); ++itr) + { if (iFCOSpecUtil::FCOSpecEqual(*pSpec, *itr->first)) { itr->first->AddRef(); return itr->first; } + } return NULL; } -void cFCOSpecList::Read(iSerializer* pSerializer, int32 version) +void cFCOSpecList::Read(iSerializer* pSerializer, int32_t version) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("FCO Spec List"))); Clear(); - int i; - int32 size; + int32_t size; pSerializer->ReadInt32(size); - for (i = 0; i < size; ++i) + for (int i = 0; i < size; ++i) { iFCOSpec* pReadInSpec = static_cast(pSerializer->ReadObjectDynCreate()); cFCOSpecAttr* pSpecAttr = static_cast(pSerializer->ReadObjectDynCreate()); diff --git a/src/fco/fcospeclist.h b/src/fco/fcospeclist.h index dee5fa4..d7ddb31 100644 --- a/src/fco/fcospeclist.h +++ b/src/fco/fcospeclist.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -91,7 +91,7 @@ public: // object was AddRef()ed // iSerializable interface - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) protected: diff --git a/src/fco/fcospecutil.cpp b/src/fco/fcospecutil.cpp index b63059b..81f34db 100644 --- a/src/fco/fcospecutil.cpp +++ b/src/fco/fcospecutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcospecutil.h b/src/fco/fcospecutil.h index d18acad..b8c164b 100644 --- a/src/fco/fcospecutil.h +++ b/src/fco/fcospecutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcostrings.cpp b/src/fco/fcostrings.cpp index 97aff32..a9e8889 100644 --- a/src/fco/fcostrings.cpp +++ b/src/fco/fcostrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcostrings.h b/src/fco/fcostrings.h index add5987..fe84620 100644 --- a/src/fco/fcostrings.h +++ b/src/fco/fcostrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/fcoundefprop.cpp b/src/fco/fcoundefprop.cpp index bba0c8c..2823fde 100644 --- a/src/fco/fcoundefprop.cpp +++ b/src/fco/fcoundefprop.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -113,7 +113,7 @@ iFCOProp::CmpResult cFCOUndefinedProp::Compare(const iFCOProp* rhs, iFCOProp::Op } } -void cFCOUndefinedProp::Read(iSerializer* pSerializer, int32 version) +void cFCOUndefinedProp::Read(iSerializer* pSerializer, int32_t version) { ThrowAndAssert(INTERNAL_ERROR("fcoundefprop.cpp")); } diff --git a/src/fco/fcoundefprop.h b/src/fco/fcoundefprop.h index 1a3dbe6..9f2c53c 100644 --- a/src/fco/fcoundefprop.h +++ b/src/fco/fcoundefprop.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -67,7 +67,7 @@ private: // don't new or construct these on the stack // iSerializable interface - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eInternal) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eInternal) virtual void Write(iSerializer* pSerializer) const; // throw (eInternal) // These functions should never be called, and they will throw and eInternal if they are. }; diff --git a/src/fco/fcovisitor.h b/src/fco/fcovisitor.h index 8c38410..c7f9304 100644 --- a/src/fco/fcovisitor.h +++ b/src/fco/fcovisitor.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/genreinfo.cpp b/src/fco/genreinfo.cpp index da525e2..7bc0db6 100644 --- a/src/fco/genreinfo.cpp +++ b/src/fco/genreinfo.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/genreinfo.h b/src/fco/genreinfo.h index c38d689..c2741d7 100644 --- a/src/fco/genreinfo.h +++ b/src/fco/genreinfo.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/genrespeclist.cpp b/src/fco/genrespeclist.cpp index 2e78054..b2b7ba4 100644 --- a/src/fco/genrespeclist.cpp +++ b/src/fco/genrespeclist.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/genrespeclist.h b/src/fco/genrespeclist.h index 38d8ca1..3a62e58 100644 --- a/src/fco/genrespeclist.h +++ b/src/fco/genrespeclist.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/genreswitcher.cpp b/src/fco/genreswitcher.cpp index f621e41..2edb89f 100644 --- a/src/fco/genreswitcher.cpp +++ b/src/fco/genreswitcher.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -142,7 +142,7 @@ bool cGenreSwitcher::IsGenreRegistered(cGenre::Genre g) bool cGenreSwitcher::IsGenreAppropriate(cGenre::Genre g) { - const uint32 platformMask = cGenre::PLATFORM_MASK_UNIX; + const uint32_t platformMask = cGenre::PLATFORM_MASK_UNIX; return ((platformMask & g) != 0); } diff --git a/src/fco/genreswitcher.h b/src/fco/genreswitcher.h index 086eda9..132ae6e 100644 --- a/src/fco/genreswitcher.h +++ b/src/fco/genreswitcher.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/iterproxy.h b/src/fco/iterproxy.h index 09a7c3b..b492355 100644 --- a/src/fco/iterproxy.h +++ b/src/fco/iterproxy.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/parsergenreutil.h b/src/fco/parsergenreutil.h index c594d9b..12aea3e 100644 --- a/src/fco/parsergenreutil.h +++ b/src/fco/parsergenreutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/propset.h b/src/fco/propset.h index fe094ee..158ad3e 100644 --- a/src/fco/propset.h +++ b/src/fco/propset.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/signature.cpp b/src/fco/signature.cpp index f937586..e96295d 100644 --- a/src/fco/signature.cpp +++ b/src/fco/signature.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -107,15 +107,15 @@ void cArchiveSigGen::AddSig(iSignature* pSig) void cArchiveSigGen::CalculateSignatures(cArchive& a) { - byte abBuf[iSignature::SUGGESTED_BLOCK_SIZE * 2]; + uint8_t abBuf[iSignature::SUGGESTED_BLOCK_SIZE * 2]; int cbRead; container_type::size_type i; - byte* pBuf = abBuf; + uint8_t* pBuf = abBuf; if (s_direct) { - unsigned long mod = (unsigned long)abBuf % iSignature::SUGGESTED_BLOCK_SIZE; - unsigned long offset = (iSignature::SUGGESTED_BLOCK_SIZE - mod); + uintptr_t mod = (uintptr_t)abBuf % iSignature::SUGGESTED_BLOCK_SIZE; + uintptr_t offset = (iSignature::SUGGESTED_BLOCK_SIZE - mod); pBuf = abBuf + offset; } @@ -154,13 +154,13 @@ void cArchiveSigGen::SetHex(bool hex) // number of bits in the array // ptr-to-str for return string val /////////////////////////////////////////////////////////////////////////////// -char* btob64(const register byte* pcbitvec, register char* pcout, int numbits) +char* btob64(const uint8_t* pcbitvec, char* pcout, int numbits) { - register unsigned int val; - register int offset; - uint8* pcorig = (uint8*)pcout; + unsigned int val; + int offset; + uint8_t* pcorig = (uint8_t*)pcout; - ASSERT(sizeof(uint8) == sizeof(byte)); /* everything breaks otherwise */ + ASSERT(sizeof(uint8_t) == sizeof(uint8_t)); /* everything breaks otherwise */ assert(numbits > 0); val = *pcbitvec; @@ -198,15 +198,15 @@ char* btob64(const register byte* pcbitvec, register char* pcout, int numbits) /////////////////////////////////////////////////////////////////////////////// #define NUMTMPLONGS 1000 -char* pltob64(uint32* pl, char* pcout, int numlongs) +char* pltob64(uint32_t* pl, char* pcout, int numlongs) { - register int i; - register uint32* plto; - uint32 larray[NUMTMPLONGS]; + int i; + uint32_t* plto; + uint32_t larray[NUMTMPLONGS]; assert(numlongs < NUMTMPLONGS); /* we use our own ntohl() routines, but we have to do it in-place */ - memcpy((char*)larray, (char*)pl, numlongs * sizeof(uint32)); + memcpy((char*)larray, (char*)pl, numlongs * sizeof(uint32_t)); for (i = 0, plto = larray; i < numlongs; i++) { @@ -214,7 +214,7 @@ char* pltob64(uint32* pl, char* pcout, int numlongs) ++plto; } - return btob64((byte*)larray, (char*)pcout, numlongs * sizeof(uint32) * 8); + return btob64((uint8_t*)larray, (char*)pcout, numlongs * sizeof(uint32_t) * 8); } /////////////////////////////////////////////////////////////////////////////// @@ -235,7 +235,7 @@ void cNullSignature::Init() { } -void cNullSignature::Update(const byte* const pbData, int cbDataLen) +void cNullSignature::Update(const uint8_t* const pbData, int cbDataLen) { } @@ -261,13 +261,13 @@ bool cNullSignature::IsEqual(const iSignature& rhs) const return true; } -void cNullSignature::Read(iSerializer* pSerializer, int32 version) +void cNullSignature::Read(iSerializer* pSerializer, int32_t version) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("Null Signature Read"))); #ifdef DEBUG - int16 ret; + int16_t ret; pSerializer->ReadInt16(ret); ASSERT(ret == 123); #endif @@ -310,9 +310,9 @@ void cChecksumSignature::Init() { } -void cChecksumSignature::Update(const byte* const pbDataC, int cbDataLen) +void cChecksumSignature::Update(const uint8_t* const pbDataC, int cbDataLen) { - byte* pbData = (byte*)pbDataC; + uint8_t* pbData = (uint8_t*)pbDataC; for (int i = 0; i < cbDataLen; i++, pbData++) mChecksum += *pbData; } @@ -325,11 +325,11 @@ void cChecksumSignature::Finit() TSTRING cChecksumSignature::AsString() const { TSTRING ret; - char* ps_signature; - char buf[100]; - uint32 local[2]; - local[0] = (uint32)(mChecksum >> 32); // note we put the MSB first - local[1] = (uint32)(mChecksum); + char* ps_signature; + char buf[100]; + uint32_t local[2]; + local[0] = (uint32_t)(mChecksum >> 32); // note we put the MSB first + local[1] = (uint32_t)(mChecksum); ps_signature = pltob64(local, buf, 2); //ps_signature holds base64 representation of mCRC @@ -342,14 +342,14 @@ TSTRING cChecksumSignature::AsString() const TSTRING cChecksumSignature::AsStringHex() const { TOSTRINGSTREAM ss; - - ss.imbue(std::locale::classic()); - ss.setf(ios::hex, ios::basefield); - + tss_classic_locale(ss); + ss.setf(std::ios::hex, std::ios::basefield); + ASSERT(false); - ss << (size_t)(uint32)mChecksum; // TODO:BAM -- this is truncating a 64-bit value to 32 bits! + ss << (size_t)(uint32_t)mChecksum; // TODO:BAM -- this is truncating a 64-bit value to 32 bits! - return ss.str(); + tss_mkstr(out, ss); + return out; } bool cChecksumSignature::IsEqual(const iSignature& rhs) const @@ -357,17 +357,17 @@ bool cChecksumSignature::IsEqual(const iSignature& rhs) const return mChecksum == ((cChecksumSignature&)rhs).mChecksum; } -void cChecksumSignature::Read(iSerializer* pSerializer, int32 version) +void cChecksumSignature::Read(iSerializer* pSerializer, int32_t version) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("Checksum Signature Read"))); - pSerializer->ReadInt64((int64&)mChecksum); + pSerializer->ReadInt64((int64_t&)mChecksum); } void cChecksumSignature::Write(iSerializer* pSerializer) const { - pSerializer->WriteInt64((int64)mChecksum); + pSerializer->WriteInt64((int64_t)mChecksum); } /////////////////////////////////////////////////////////////////////////////// @@ -398,10 +398,10 @@ void cCRC32Signature::Init() crcInit(mCRCInfo); } -void cCRC32Signature::Update(const byte* const pbData, int cbDataLen) +void cCRC32Signature::Update(const uint8_t* const pbData, int cbDataLen) { - ASSERT(sizeof(byte) == sizeof(uint8)); - crcUpdate(mCRCInfo, (uint8*)pbData, cbDataLen); + ASSERT(sizeof(uint8_t) == sizeof(uint8_t)); + crcUpdate(mCRCInfo, (uint8_t*)pbData, cbDataLen); } void cCRC32Signature::Finit() @@ -418,9 +418,9 @@ TSTRING cCRC32Signature::AsString() const return AsStringHex(); TSTRING ret; - char* ps_signature; - char buf[100]; - uint32 local = mCRCInfo.crc; + char* ps_signature; + char buf[100]; + uint32_t local = mCRCInfo.crc; ps_signature = pltob64(&local, buf, 1); //ps_signature holds base64 representation of mCRCInfo.crc @@ -431,13 +431,13 @@ TSTRING cCRC32Signature::AsString() const TSTRING cCRC32Signature::AsStringHex() const { TOSTRINGSTREAM ss; - - ss.imbue(std::locale::classic()); - ss.setf(ios::hex, ios::basefield); - + tss_classic_locale(ss); + ss.setf(std::ios::hex, std::ios::basefield); + ss << (size_t)mCRCInfo.crc; - - return ss.str(); + tss_mkstr(out, ss); + + return out; } bool cCRC32Signature::IsEqual(const iSignature& rhs) const @@ -448,17 +448,17 @@ bool cCRC32Signature::IsEqual(const iSignature& rhs) const return (mCRCInfo.crc == ((cCRC32Signature&)rhs).mCRCInfo.crc); } -void cCRC32Signature::Read(iSerializer* pSerializer, int32 version) +void cCRC32Signature::Read(iSerializer* pSerializer, int32_t version) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("CRC32 Read"))); - pSerializer->ReadInt32((int32&)mCRCInfo.crc); + pSerializer->ReadInt32((int32_t&)mCRCInfo.crc); } void cCRC32Signature::Write(iSerializer* pSerializer) const { - pSerializer->WriteInt32((int32)mCRCInfo.crc); + pSerializer->WriteInt32((int32_t)mCRCInfo.crc); } /////////////////////////////////////////////////////////////////////////////// @@ -483,6 +483,7 @@ cMD5Signature::cMD5Signature() #else memset(mMD5Info.digest, 0, sizeof(mMD5Info.digest)); #endif + memset(md5_digest, 0, MD5_DIGEST_LENGTH); } @@ -501,14 +502,14 @@ void cMD5Signature::Init() #endif } -void cMD5Signature::Update(const byte* const pbData, int cbDataLen) +void cMD5Signature::Update(const uint8_t* const pbData, int cbDataLen) { #ifdef HAVE_COMMONCRYPTO_COMMONDIGEST_H - CC_MD5_Update(&mMD5Info, (uint8*)pbData, cbDataLen); + CC_MD5_Update(&mMD5Info, (uint8_t*)pbData, cbDataLen); #elif HAVE_OPENSSL_MD5_H - MD5_Update(&mMD5Info, (uint8*)pbData, cbDataLen); + MD5_Update(&mMD5Info, (uint8_t*)pbData, cbDataLen); #else - MD5Update(&mMD5Info, (uint8*)pbData, cbDataLen); + MD5Update(&mMD5Info, (uint8_t*)pbData, cbDataLen); #endif } @@ -520,7 +521,13 @@ void cMD5Signature::Finit() MD5_Final(md5_digest, &mMD5Info); #else MD5Final(&mMD5Info); - bcopy(mMD5Info.digest, md5_digest, MD5_DIGEST_LENGTH); + +#if HAVE_MEMCPY_S + memcpy_s(md5_digest, MD5_DIGEST_LENGTH, mMD5Info.digest, sizeof(mMD5Info.digest)); +#else + memcpy(md5_digest, mMD5Info.digest, MD5_DIGEST_LENGTH); +#endif + #endif } @@ -534,8 +541,8 @@ TSTRING cMD5Signature::AsString() const TSTRING ret; char buf[24]; - ASSERT(sizeof(uint8) == sizeof(byte)); /* everything breaks otherwise */ - btob64((byte*)md5_digest, buf, SIG_BYTE_SIZE * 8); + ASSERT(sizeof(uint8_t) == sizeof(uint8_t)); /* everything breaks otherwise */ + btob64((uint8_t*)md5_digest, buf, SIG_BYTE_SIZE * 8); //converting to base64 representation. ret.append(buf); @@ -550,7 +557,7 @@ TSTRING cMD5Signature::AsStringHex() const TCHAR stringBuffer[128]; TCHAR sigStringOut[129]; sigStringOut[0] = '\0'; - uint8* dbuf = (uint8*)md5_digest; + uint8_t* dbuf = (uint8_t*)md5_digest; for (int i = 0; i < SIG_BYTE_SIZE; ++i) { @@ -572,7 +579,7 @@ bool cMD5Signature::IsEqual(const iSignature& rhs) const } } -void cMD5Signature::Read(iSerializer* pSerializer, int32 version) +void cMD5Signature::Read(iSerializer* pSerializer, int32_t version) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("MD5 Read"))); @@ -626,15 +633,15 @@ void cSHASignature::Init() #endif } -void cSHASignature::Update(const byte* const pbData, int cbDataLen) +void cSHASignature::Update(const uint8_t* const pbData, int cbDataLen) { - ASSERT(sizeof(byte) == sizeof(uint8)); + ASSERT(sizeof(uint8_t) == sizeof(uint8_t)); #ifdef HAVE_COMMONCRYPTO_COMMONDIGEST_H - CC_SHA1_Update(&mSHAInfo, (uint8*)pbData, cbDataLen); + CC_SHA1_Update(&mSHAInfo, (uint8_t*)pbData, cbDataLen); #elif HAVE_OPENSSL_SHA_H - SHA1_Update(&mSHAInfo, (uint8*)pbData, cbDataLen); + SHA1_Update(&mSHAInfo, (uint8_t*)pbData, cbDataLen); #else - shsUpdate(&mSHAInfo, (uint8*)pbData, cbDataLen); + shsUpdate(&mSHAInfo, (uint8_t*)pbData, cbDataLen); #endif } @@ -661,7 +668,7 @@ TSTRING cSHASignature::AsString(void) const char* ps_signature; char buf[100]; - ps_signature = btob64((uint8*)sha_digest, buf, SIG_UINT32_SIZE * sizeof(uint32) * 8); + ps_signature = btob64((uint8_t*)sha_digest, buf, SIG_UINT32_SIZE * sizeof(uint32_t) * 8); //converting to base64 representation. ret.append(ps_signature); @@ -675,9 +682,9 @@ TSTRING cSHASignature::AsStringHex() const TCHAR stringBuffer[128]; TCHAR sigStringOut[129]; sigStringOut[0] = '\0'; - uint8* dbuf = (uint8*)sha_digest; + uint8_t* dbuf = (uint8_t*)sha_digest; - for (int i = 0; i < SIG_UINT32_SIZE * (int)sizeof(uint32); ++i) + for (int i = 0; i < SIG_UINT32_SIZE * (int)sizeof(uint32_t); ++i) { snprintf(stringBuffer, 128, _T("%02x"), dbuf[i]); strncat(sigStringOut, stringBuffer, 128); @@ -698,13 +705,13 @@ void cSHASignature::Copy(const iFCOProp* rhs) /////////////////////////////////////////////////////////////////////////////// // Serializer Implementation: Read and Write -void cSHASignature::Read(iSerializer* pSerializer, int32 version) +void cSHASignature::Read(iSerializer* pSerializer, int32_t version) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("SHA Read"))); for (int i = 0; i < SIG_UINT32_SIZE; ++i) - pSerializer->ReadInt32((int32&)sha_digest[i]); + pSerializer->ReadInt32((int32_t&)sha_digest[i]); } void cSHASignature::Write(iSerializer* pSerializer) const @@ -721,7 +728,7 @@ bool cSHASignature::IsEqual(const iSignature& rhs) const return true; else { - return (memcmp(sha_digest, ((cSHASignature&)rhs).sha_digest, SIG_UINT32_SIZE * sizeof(uint32)) == 0); + return (memcmp(sha_digest, ((cSHASignature&)rhs).sha_digest, SIG_UINT32_SIZE * sizeof(uint32_t)) == 0); } } @@ -737,7 +744,7 @@ TSTRING cSHASignature::AsString(void) const char buf[100]; buf[99] = 0; - ps_signature = pltob64((uint32*)mSHAInfo.digest, buf, SIG_UINT32_SIZE); + ps_signature = pltob64((uint32_t*)mSHAInfo.digest, buf, SIG_UINT32_SIZE); //converting to base64 representation. ret.append(ps_signature); @@ -774,13 +781,13 @@ void cSHASignature::Copy(const iFCOProp* rhs) /////////////////////////////////////////////////////////////////////////////// // Serializer Implementation: Read and Write -void cSHASignature::Read(iSerializer* pSerializer, int32 version) +void cSHASignature::Read(iSerializer* pSerializer, int32_t version) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("SHA Read"))); for (int i = 0; i < SIG_UINT32_SIZE; ++i) - pSerializer->ReadInt32((int32&)mSHAInfo.digest[i]); + pSerializer->ReadInt32((int32_t&)mSHAInfo.digest[i]); } void cSHASignature::Write(iSerializer* pSerializer) const @@ -797,7 +804,7 @@ bool cSHASignature::IsEqual(const iSignature& rhs) const return true; else { - return (memcmp(mSHAInfo.digest, ((cSHASignature&)rhs).mSHAInfo.digest, SIG_UINT32_SIZE * sizeof(uint32)) == 0); + return (memcmp(mSHAInfo.digest, ((cSHASignature&)rhs).mSHAInfo.digest, SIG_UINT32_SIZE * sizeof(uint32_t)) == 0); } } #endif @@ -822,9 +829,9 @@ void cHAVALSignature::Init() haval_start(&mHavalState); } -void cHAVALSignature::Update(const byte* const pbData, int cbDataLen) +void cHAVALSignature::Update(const uint8_t* const pbData, int cbDataLen) { - haval_hash(&mHavalState, (uint8*)pbData, cbDataLen); + haval_hash(&mHavalState, (uint8_t*)pbData, cbDataLen); } void cHAVALSignature::Finit() @@ -842,7 +849,7 @@ TSTRING cHAVALSignature::AsString() const TSTRING ret; char buf[24]; - btob64((byte*)mSignature, buf, 128); + btob64((uint8_t*)mSignature, buf, 128); //converting to base64 representation. ret.append(buf); @@ -877,7 +884,7 @@ void cHAVALSignature::Copy(const iFCOProp* rhs) /////////////////////////////////////////////////////////////////////////////// // Serializer Implementation: Read and Write -void cHAVALSignature::Read(iSerializer* pSerializer, int32 version) +void cHAVALSignature::Read(iSerializer* pSerializer, int32_t version) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("HAVAL Read"))); diff --git a/src/fco/signature.h b/src/fco/signature.h index b502f3f..a0b475e 100644 --- a/src/fco/signature.h +++ b/src/fco/signature.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -108,7 +108,7 @@ public: // virtual void Init() = 0; // call before beginning hashing - virtual void Update(const byte* const pbData, int cbDataLen) = 0; + virtual void Update(const uint8_t* const pbData, int cbDataLen) = 0; // may be called multiple times -- best to call with blocks of size SUGGESTED_BLOCK_SIZE, // but can handle any size data. virtual void Finit() = 0; @@ -192,13 +192,13 @@ public: virtual ~cNullSignature(); virtual void Init(); - virtual void Update(const byte* const pbData, int cbDataLen); + virtual void Update(const uint8_t* const pbData, int cbDataLen); virtual void Finit(); virtual TSTRING AsString() const; virtual TSTRING AsStringHex() const; virtual void Copy(const iFCOProp* rhs); - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) protected: @@ -219,19 +219,19 @@ public: virtual ~cChecksumSignature(); virtual void Init(); - virtual void Update(const byte* const pbData, int cbDataLen); + virtual void Update(const uint8_t* const pbData, int cbDataLen); virtual void Finit(); virtual TSTRING AsString() const; virtual TSTRING AsStringHex() const; virtual void Copy(const iFCOProp* rhs); - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) protected: virtual bool IsEqual(const iSignature& rhs) const; - uint64 mChecksum; + uint64_t mChecksum; }; /////////////////////////////////////////////////////////////////////////////// @@ -247,14 +247,14 @@ public: virtual ~cCRC32Signature(); virtual void Init(); - virtual void Update(const byte* const pbData, int cbDataLen); + virtual void Update(const uint8_t* const pbData, int cbDataLen); virtual void Finit(); virtual TSTRING AsString() const; virtual TSTRING AsStringHex() const; virtual void Copy(const iFCOProp* rhs); - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) protected: @@ -276,13 +276,13 @@ public: virtual ~cMD5Signature(); virtual void Init(); - virtual void Update(const byte* const pbData, int cbDataLen); + virtual void Update(const uint8_t* const pbData, int cbDataLen); virtual void Finit(); virtual TSTRING AsString() const; virtual TSTRING AsStringHex() const; virtual void Copy(const iFCOProp* rhs); - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) protected: @@ -294,10 +294,10 @@ protected: virtual bool IsEqual(const iSignature& rhs) const; #ifdef HAVE_COMMONCRYPTO_COMMONDIGEST_H CC_MD5_CTX mMD5Info; - uint8 md5_digest[CC_MD5_DIGEST_LENGTH]; + uint8_t md5_digest[CC_MD5_DIGEST_LENGTH]; #else MD5_CTX mMD5Info; - uint8 md5_digest[MD5_DIGEST_LENGTH]; + uint8_t md5_digest[MD5_DIGEST_LENGTH]; #endif }; @@ -313,13 +313,13 @@ public: virtual ~cSHASignature(); virtual void Init(); - virtual void Update(const byte* const pbData, int cbDataLen); + virtual void Update(const uint8_t* const pbData, int cbDataLen); virtual void Finit(); virtual TSTRING AsString() const; virtual TSTRING AsStringHex() const; virtual void Copy(const iFCOProp* rhs); - virtual void Read(iSerializer* pSerializer, int32 version = 0); + virtual void Read(iSerializer* pSerializer, int32_t version = 0); virtual void Write(iSerializer* pSerializer) const; protected: @@ -328,11 +328,11 @@ protected: #ifdef HAVE_COMMONCRYPTO_COMMONDIGEST_H enum {SIG_UINT32_SIZE = CC_SHA1_DIGEST_LENGTH / 4}; CC_SHA1_CTX mSHAInfo; - uint32 sha_digest[SIG_UINT32_SIZE]; + uint32_t sha_digest[SIG_UINT32_SIZE]; #elif HAVE_OPENSSL_SHA_H enum {SIG_UINT32_SIZE = SHA_DIGEST_LENGTH / 4}; - SHA_CTX mSHAInfo; - uint32 sha_digest[SIG_UINT32_SIZE]; + SHA_CTX mSHAInfo; + uint32_t sha_digest[SIG_UINT32_SIZE]; #else enum { @@ -355,13 +355,13 @@ public: virtual ~cHAVALSignature(); virtual void Init(); - virtual void Update(const byte* const pbData, int cbDataLen); + virtual void Update(const uint8_t* const pbData, int cbDataLen); virtual void Finit(); virtual TSTRING AsString() const; virtual TSTRING AsStringHex() const; virtual void Copy(const iFCOProp* rhs); - virtual void Read(iSerializer* pSerializer, int32 version = 0); + virtual void Read(iSerializer* pSerializer, int32_t version = 0); virtual void Write(iSerializer* pSerializer) const; protected: @@ -373,7 +373,7 @@ protected: virtual bool IsEqual(const iSignature& rhs) const; haval_state mHavalState; - uint8 mSignature[SIG_BYTE_SIZE]; + uint8_t mSignature[SIG_BYTE_SIZE]; }; #endif // __SIGNATURE_H diff --git a/src/fco/stdfco.cpp b/src/fco/stdfco.cpp index db17a46..b300819 100644 --- a/src/fco/stdfco.cpp +++ b/src/fco/stdfco.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/stdfco.h b/src/fco/stdfco.h index 8000dfe..6162ddf 100644 --- a/src/fco/stdfco.h +++ b/src/fco/stdfco.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/twfactory.cpp b/src/fco/twfactory.cpp index 1a076e5..8b3f9c9 100644 --- a/src/fco/twfactory.cpp +++ b/src/fco/twfactory.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fco/twfactory.h b/src/fco/twfactory.h index fc663de..75a792c 100644 --- a/src/fco/twfactory.h +++ b/src/fco/twfactory.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/Makefile.in b/src/fs/Makefile.in index 21c6d25..678f68a 100644 --- a/src/fs/Makefile.in +++ b/src/fs/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -131,7 +131,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) @@ -303,6 +303,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -353,8 +354,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -459,7 +460,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/src/fs/fs.cpp b/src/fs/fs.cpp index 30287a0..6020210 100644 --- a/src/fs/fs.cpp +++ b/src/fs/fs.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fs.h b/src/fs/fs.h index 8662ed7..1129655 100644 --- a/src/fs/fs.h +++ b/src/fs/fs.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsdatasourceiter.cpp b/src/fs/fsdatasourceiter.cpp index 26acf15..5404007 100644 --- a/src/fs/fsdatasourceiter.cpp +++ b/src/fs/fsdatasourceiter.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -274,6 +274,18 @@ bool cFSDataSourceIter::InitializeTypeInfo(iFCO* pFCO) case cFSStatArgs::TY_NAMED: propSet.SetFileType(cFSPropSet::FT_NAMED); break; + case cFSStatArgs::TY_NATIVE: + propSet.SetFileType(cFSPropSet::FT_NATIVE); + break; + case cFSStatArgs::TY_MESSAGE_QUEUE: + propSet.SetFileType(cFSPropSet::FT_MESSAGE_QUEUE); + break; + case cFSStatArgs::TY_SEMAPHORE: + propSet.SetFileType(cFSPropSet::FT_SEMAPHORE); + break; + case cFSStatArgs::TY_SHARED_MEMORY: + propSet.SetFileType(cFSPropSet::FT_SHARED_MEMORY); + break; default: // set it to invalid propSet.SetFileType(cFSPropSet::FT_INVALID); diff --git a/src/fs/fsdatasourceiter.h b/src/fs/fsdatasourceiter.h index 4d5b4d8..0d60958 100644 --- a/src/fs/fsdatasourceiter.h +++ b/src/fs/fsdatasourceiter.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -74,7 +74,7 @@ public: //void TraceContents(int dl = -1) const; private: - uint64 mDev; // the device number of the last node reached through SeekTo() + uint64_t mDev; // the device number of the last node reached through SeekTo() // if this is zero, then it is assumed to be uninitialized //------------------------------------------------------------------------- diff --git a/src/fs/fserrors.cpp b/src/fs/fserrors.cpp index aba7836..13e05ae 100644 --- a/src/fs/fserrors.cpp +++ b/src/fs/fserrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fserrors.h b/src/fs/fserrors.h index fe18810..6213825 100644 --- a/src/fs/fserrors.h +++ b/src/fs/fserrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsfactory.cpp b/src/fs/fsfactory.cpp index fd4b11a..04be4ca 100644 --- a/src/fs/fsfactory.cpp +++ b/src/fs/fsfactory.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsfactory.h b/src/fs/fsfactory.h index 6d185e0..104edb2 100644 --- a/src/fs/fsfactory.h +++ b/src/fs/fsfactory.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsnametranslator.cpp b/src/fs/fsnametranslator.cpp index 3510746..e496fbd 100644 --- a/src/fs/fsnametranslator.cpp +++ b/src/fs/fsnametranslator.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsnametranslator.h b/src/fs/fsnametranslator.h index 59443e2..15368a6 100644 --- a/src/fs/fsnametranslator.h +++ b/src/fs/fsnametranslator.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsobject.cpp b/src/fs/fsobject.cpp index f0c9a91..7fdf67d 100644 --- a/src/fs/fsobject.cpp +++ b/src/fs/fsobject.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -107,9 +107,9 @@ void cFSObject::SetName(const cFCOName& name) /////////////////////////////////////////////////////////////////////////////// // GetCaps /////////////////////////////////////////////////////////////////////////////// -uint32 cFSObject::GetCaps() const +uint32_t cFSObject::GetCaps() const { - uint32 cap = mName.GetSize() > 1 ? CAP_CAN_HAVE_PARENT : 0; + uint32_t cap = mName.GetSize() > 1 ? CAP_CAN_HAVE_PARENT : 0; ASSERT(GetFSPropSet().GetValidVector().ContainsItem(cFSPropSet::PROP_FILETYPE)); if (GetFSPropSet().GetFileType() == cFSPropSet::FT_DIR) @@ -173,7 +173,7 @@ void cFSObject::AcceptVisitor(iFCOVisitor* pVisitor) } -void cFSObject::Read(iSerializer* pSerializer, int32 version) +void cFSObject::Read(iSerializer* pSerializer, int32_t version) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("File System Object"))); diff --git a/src/fs/fsobject.h b/src/fs/fsobject.h index 8c2c3e9..d3105ed 100644 --- a/src/fs/fsobject.h +++ b/src/fs/fsobject.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -67,7 +67,7 @@ public: virtual const iFCOPropSet* GetPropSet() const; virtual iFCOPropSet* GetPropSet(); - virtual uint32 GetCaps() const; + virtual uint32_t GetCaps() const; virtual iFCO* Clone() const; virtual void AcceptVisitor(iFCOVisitor* pVisitor); @@ -77,7 +77,7 @@ public: // returns a reference to the FS property set // iSerializable interface - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) virtual void TraceContents(int dl = -1) const; diff --git a/src/fs/fsparserutil.cpp b/src/fs/fsparserutil.cpp index b0753ed..2b09e2a 100644 --- a/src/fs/fsparserutil.cpp +++ b/src/fs/fsparserutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -177,7 +177,13 @@ void cFSParserUtil::AddSubTypeProps(cFCOPropVector& v) const static inline void trim_leading_whitespace(std::string& str) { +// C++17 removes std::ptr_fun and deprecates std::not1, +// so just use a lambda where available +#if !USE_LAMBDAS str.erase(str.begin(), std::find_if(str.begin(), str.end(), std::not1(std::ptr_fun(std::isspace)))); +#else + str.erase(str.begin(), std::find_if(str.begin(), str.end(), [](int c) {return !std::isspace(c);} )); +#endif } void cFSParserUtil::InterpretFCOName(const std::list& l, cFCOName& nameOut) const diff --git a/src/fs/fsparserutil.h b/src/fs/fsparserutil.h index f65ae99..ca2a197 100644 --- a/src/fs/fsparserutil.h +++ b/src/fs/fsparserutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fspropcalc.cpp b/src/fs/fspropcalc.cpp index 29bd98f..5b1eaad 100644 --- a/src/fs/fspropcalc.cpp +++ b/src/fs/fspropcalc.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -78,6 +78,7 @@ static bool NeedsStat(const cFCOPropVector& v) bool cFSPropCalc::GetSymLinkStr(const TSTRING& strName, cArchive& arch, size_t size) { +#if SUPPORTS_SYMLINKS std::vector data(size + 1); char* buf = &data[0]; @@ -102,7 +103,7 @@ bool cFSPropCalc::GetSymLinkStr(const TSTRING& strName, cArchive& arch, size_t s //Sadly if buf isn't big enough readlink 'succeeds' by truncating the string, so the only // clue your buffer might be too small is if you maxed it out. So we try again, within reason. -#if IS_SKYOS +#if READLINK_NULL_TERMINATES if ((size_t)rtn >= size - 1) //SkyOS wants space to null terminate the string it hands back, which is nice, I guess. #else if ((size_t)rtn == size) @@ -118,6 +119,9 @@ bool cFSPropCalc::GetSymLinkStr(const TSTRING& strName, cArchive& arch, size_t s arch.WriteBlob(buf, rtn); return true; +#else + return false; +#endif } void cFSPropCalc::AddPropCalcError(const eError& e) @@ -298,6 +302,18 @@ void cFSPropCalc::HandleStatProperties(const cFCOPropVector& propsToCheck, const case cFSStatArgs::TY_NAMED: propSet.SetFileType(cFSPropSet::FT_NAMED); break; + case cFSStatArgs::TY_NATIVE: + propSet.SetFileType(cFSPropSet::FT_NATIVE); + break; + case cFSStatArgs::TY_MESSAGE_QUEUE: + propSet.SetFileType(cFSPropSet::FT_MESSAGE_QUEUE); + break; + case cFSStatArgs::TY_SEMAPHORE: + propSet.SetFileType(cFSPropSet::FT_SEMAPHORE); + break; + case cFSStatArgs::TY_SHARED_MEMORY: + propSet.SetFileType(cFSPropSet::FT_SHARED_MEMORY); + break; default: // set it to invalid propSet.SetFileType(cFSPropSet::FT_INVALID); @@ -312,11 +328,17 @@ void cFSPropCalc::HandleHashes(const cFCOPropVector& propsToCheck, const TSTRING // if the file type is not a regular file, we will // not try to open the file for signature generation ASSERT(propSet.GetValidVector().ContainsItem(cFSPropSet::PROP_FILETYPE)); - if (propSet.GetFileType() == cFSPropSet::FT_FILE || propSet.GetFileType() == cFSPropSet::FT_SYMLINK) + + if ( propSet.GetFileType() == cFSPropSet::FT_FILE + || propSet.GetFileType() == cFSPropSet::FT_SYMLINK +#if (SUPPORTS_NATIVE_OBJECTS) + || propSet.GetFileType() == cFSPropSet::FT_NATIVE +#endif + ) { if ( // if we need to open the file propsToCheck.ContainsItem(cFSPropSet::PROP_CRC32) || propsToCheck.ContainsItem(cFSPropSet::PROP_MD5) || - propsToCheck.ContainsItem(cFSPropSet::PROP_SHA) || propsToCheck.ContainsItem(cFSPropSet::PROP_HAVAL)) + propsToCheck.ContainsItem(cFSPropSet::PROP_SHA) || propsToCheck.ContainsItem(cFSPropSet::PROP_HAVAL)) { cFileArchive arch; cMemoryArchive memArch; diff --git a/src/fs/fspropcalc.h b/src/fs/fspropcalc.h index e951f9a..ca7e7d3 100644 --- a/src/fs/fspropcalc.h +++ b/src/fs/fspropcalc.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fspropdisplayer.cpp b/src/fs/fspropdisplayer.cpp index 4ed6215..e9cee45 100644 --- a/src/fs/fspropdisplayer.cpp +++ b/src/fs/fspropdisplayer.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -141,7 +141,7 @@ void cFSPropDisplayer::Merge(const iFCOPropDisplayer* const ppd) if (ppd->GetType() != this->GetType()) ASSERT(false); - const cFSPropDisplayer* const pfspd = static_cast(ppd); + const cFSPropDisplayer* const pfspd = static_cast(ppd); // merge propvectors mpvPropsWeDisplay |= pfspd->GetPropsConverted(); @@ -171,7 +171,10 @@ TSTRING& cFSPropDisplayer::GetDetailsHeader(TSTRING& strBuf, int iMargin) const static cFSPropSet set; TOSTRINGSTREAM sstr; +#if !ARCHAIC_STL sstr << std::left; +#endif + sstr << _T(" ") << std::setw(PROP_MODE_WIDTH) << set.GetPropName(cFSPropSet::PROP_MODE); sstr << _T(" ") << std::setw(PROP_OWNER_WIDTH) << set.GetPropName(cFSPropSet::PROP_UID); sstr << _T(" ") << std::setw(PROP_SIZE_WIDTH) << set.GetPropName(cFSPropSet::PROP_SIZE); @@ -184,7 +187,7 @@ TSTRING& cFSPropDisplayer::GetDetailsHeader(TSTRING& strBuf, int iMargin) const sstr << _T(" ") << std::setw(PROP_SIZE_WIDTH) << _T("----------"); sstr << _T(" ") << std::setw(PROP_MTIME_WIDTH) << _T("----------"); - strBuf = sstr.str(); + tss_stream_to_string(sstr, strBuf); return strBuf; } @@ -204,8 +207,10 @@ TSTRING& cFSPropDisplayer::GetDetails(const iFCO* const pfco, TSTRING& strBuf) c TOSTRINGSTREAM sstr; const cFCOPropVector pv = pfco->GetPropSet()->GetValidVector(); +#if !ARCHAIC_STL sstr << std::left; - +#endif + sstr << _T(" ") << std::setw(PROP_MODE_WIDTH); if (pv.ContainsItem(cFSPropSet::PROP_MODE)) sstr << PropAsString(pfco, cFSPropSet::PROP_MODE).c_str(); @@ -230,7 +235,7 @@ TSTRING& cFSPropDisplayer::GetDetails(const iFCO* const pfco, TSTRING& strBuf) c else sstr << _T("XXXXXXXXXXXXXXXXX"); - strBuf = sstr.str(); + tss_stream_to_string(sstr, strBuf); return strBuf; } @@ -259,8 +264,8 @@ void cFSPropDisplayer::InitForProp(const iFCO* const pFCO, const int propIdx) { case cFSPropSet::PROP_UID: { - const int64& i64UID = - static_cast(pFCO->GetPropSet()->GetPropAt(cFSPropSet::PROP_UID))->GetValue(); + const int64_t& i64UID = + static_cast(pFCO->GetPropSet()->GetPropAt(cFSPropSet::PROP_UID))->GetValue(); // check if prop is in table. if it is, then don't hit the FS TSTRING tstrDummy; @@ -278,8 +283,8 @@ void cFSPropDisplayer::InitForProp(const iFCO* const pFCO, const int propIdx) break; case cFSPropSet::PROP_GID: { - const int64& i64GID = - static_cast(pFCO->GetPropSet()->GetPropAt(cFSPropSet::PROP_GID))->GetValue(); + const int64_t& i64GID = + static_cast(pFCO->GetPropSet()->GetPropAt(cFSPropSet::PROP_GID))->GetValue(); // check if prop is in table. if it is, then don't hit the FS TSTRING tstrDummy; @@ -330,7 +335,9 @@ TSTRING cFSPropDisplayer::PropAsString(const iFCO* const pFCO, const int propIdx case cFSPropSet::PROP_SIZE: case cFSPropSet::PROP_NLINK: { - const cFCOPropInt64* const pTypedProp = static_cast(pProp); + // Note that supplying both consts within the static cast makes gcc emit a + // "type qualifiers ignored on cast result type" (-Wignored-qualifiers) warning. + const cFCOPropInt64* const pTypedProp = static_cast(pProp); cTWLocale::FormatNumber(pTypedProp->GetValue(), strProp); } break; @@ -338,14 +345,14 @@ TSTRING cFSPropDisplayer::PropAsString(const iFCO* const pFCO, const int propIdx case cFSPropSet::PROP_MTIME: case cFSPropSet::PROP_CTIME: { - const cFCOPropInt64* const pTypedProp = static_cast(pProp); - int64 i64 = pTypedProp->GetValue(); + const cFCOPropInt64* const pTypedProp = static_cast(pProp); + int64_t i64 = pTypedProp->GetValue(); cTWLocale::FormatTime(i64, strProp); } break; case cFSPropSet::PROP_MODE: { - const cFCOPropUint64* const pTypedProp = static_cast(pProp); + const cFCOPropUint64* const pTypedProp = static_cast(pProp); ASSERT(pTypedProp != 0); iFSServices::GetInstance()->ConvertModeToString(pTypedProp->GetValue(), strProp); @@ -353,13 +360,14 @@ TSTRING cFSPropDisplayer::PropAsString(const iFCO* const pFCO, const int propIdx break; case cFSPropSet::PROP_UID: { - const cFCOPropInt64* const pTypedProp = static_cast(pProp); + const cFCOPropInt64* const pTypedProp = static_cast(pProp); ASSERT(pTypedProp != 0); if (GetUsername(pTypedProp->GetValue(), strProp)) { - TSTRINGSTREAM ostr; - ostr << strProp << _T(" (") << (int32)pTypedProp->GetValue() << _T(")"); - strProp = ostr.str(); + TOSTRINGSTREAM ostr; + //TODO: can we get rid of this cast now? + ostr << strProp << _T(" (") << (int32_t)pTypedProp->GetValue() << _T(")"); + tss_stream_to_string(ostr, strProp); } else strProp = pProp->AsString(); @@ -367,13 +375,14 @@ TSTRING cFSPropDisplayer::PropAsString(const iFCO* const pFCO, const int propIdx break; case cFSPropSet::PROP_GID: { - const cFCOPropInt64* const pTypedProp = static_cast(pProp); + const cFCOPropInt64* const pTypedProp = static_cast(pProp); ASSERT(pTypedProp != 0); if (GetGroupname(pTypedProp->GetValue(), strProp)) { - TSTRINGSTREAM ostr; - ostr << strProp << _T(" (") << (int32)pTypedProp->GetValue() << _T(")"); - strProp = ostr.str(); + TOSTRINGSTREAM ostr; + //TODO: can we get rid of this cast now? + ostr << strProp << _T(" (") << (int32_t)pTypedProp->GetValue() << _T(")"); + tss_stream_to_string(ostr, strProp); } else strProp = pProp->AsString(); @@ -420,21 +429,21 @@ void cFSPropDisplayer::Write(iSerializer* pSerializer) const } } -void cFSPropDisplayer::Read(iSerializer* pSerializer, int32 version) +void cFSPropDisplayer::Read(iSerializer* pSerializer, int32_t version) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("Property Displayer Read"))); mpvPropsWeDisplay.Read(pSerializer); - int32 iDummy; + int32_t iDummy; pSerializer->ReadInt32(iDummy); mbLazy = iDummy == 0 ? false : true; // stuff { - int32 nValues; - int64 key; + int32_t nValues; + int64_t key; TSTRING val; int i; @@ -463,7 +472,7 @@ void cFSPropDisplayer::Read(iSerializer* pSerializer, int32 version) // Lookup functions ////////////////////////////////////////////// -bool cFSPropDisplayer::GetUsername(const int64& i64uid, TSTRING& tstrUsername) const +bool cFSPropDisplayer::GetUsername(const int64_t& i64uid, TSTRING& tstrUsername) const { bool fFound = false; @@ -478,7 +487,7 @@ bool cFSPropDisplayer::GetUsername(const int64& i64uid, TSTRING& tstrUsername) c return (fFound && !tstrUsername.empty()); } -bool cFSPropDisplayer::GetGroupname(const int64& i64gid, TSTRING& tstrGroupname) const +bool cFSPropDisplayer::GetGroupname(const int64_t& i64gid, TSTRING& tstrGroupname) const { bool fFound = false; @@ -497,14 +506,14 @@ bool cFSPropDisplayer::GetGroupname(const int64& i64gid, TSTRING& tstrGroupname) // Addition functions ////////////////////////////////////////////// -bool cFSPropDisplayer::AddUsernameMapping(const int64& i64uid, const TSTRING& tstrUsername) +bool cFSPropDisplayer::AddUsernameMapping(const int64_t& i64uid, const TSTRING& tstrUsername) { std::pair ret = uidToUsername.insert(INT64_TO_STRING_MAP::value_type(i64uid, tstrUsername)); return (ret.second = false); // returns true if key didn't exist before } -bool cFSPropDisplayer::AddGroupnameMapping(const int64& i64gid, const TSTRING& tstrGroupname) +bool cFSPropDisplayer::AddGroupnameMapping(const int64_t& i64gid, const TSTRING& tstrGroupname) { std::pair ret = gidToGroupname.insert(INT64_TO_STRING_MAP::value_type(i64gid, tstrGroupname)); diff --git a/src/fs/fspropdisplayer.h b/src/fs/fspropdisplayer.h index 3da823c..21b032c 100644 --- a/src/fs/fspropdisplayer.h +++ b/src/fs/fspropdisplayer.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -112,7 +112,7 @@ public: virtual void InitForFCO(const iFCO* const ifco); virtual void SetLazy(const bool bLazy = true); virtual bool GetLazy() const; - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) bool operator==(const cFSPropDisplayer& rhs) const; // for testing @@ -126,12 +126,12 @@ private: // can do a PropAsString that's different from iFCOProp::AsString() bool mbLazy; - typedef std::map INT64_TO_STRING_MAP; + typedef std::map INT64_TO_STRING_MAP; - bool GetUsername(const int64& i64uid, TSTRING& tstrUsername) const; - bool GetGroupname(const int64& i64uid, TSTRING& tstrGroupname) const; - bool AddUsernameMapping(const int64& i64ID, const TSTRING& tstrUsername); - bool AddGroupnameMapping(const int64& i64ID, const TSTRING& tstrGroupname); + bool GetUsername(const int64_t& i64uid, TSTRING& tstrUsername) const; + bool GetGroupname(const int64_t& i64uid, TSTRING& tstrGroupname) const; + bool AddUsernameMapping(const int64_t& i64ID, const TSTRING& tstrUsername); + bool AddGroupnameMapping(const int64_t& i64ID, const TSTRING& tstrGroupname); // storage for conversion stuff INT64_TO_STRING_MAP uidToUsername; diff --git a/src/fs/fspropset.cpp b/src/fs/fspropset.cpp index 4750c8d..972ffcf 100644 --- a/src/fs/fspropset.cpp +++ b/src/fs/fspropset.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -59,9 +59,13 @@ TSTRING cFCOPropFileType::AsString() const fs::STR_FT_SOCK, fs::STR_FT_DOOR, fs::STR_FT_PORT, - fs::STR_FT_NAMED}; + fs::STR_FT_NAMED, + fs::STR_FT_NATIVE, + fs::STR_FT_MESSAGE_QUEUE, + fs::STR_FT_SEMAPHORE, + fs::STR_FT_SHARED_MEMORY}; - int32 fileType = GetValue(); + int32_t fileType = GetValue(); if ((fileType > cFSPropSet::FT_INVALID) && (fileType < cFSPropSet::FT_NUMITEMS)) return TSS_GetString(cFS, fileTypes[fileType]); else @@ -106,7 +110,9 @@ void cFSPropSet::TraceContents(int dl) const << _T(", "); } } - d.Trace(dl, _T("%s\n"), ostr.str().c_str()); + + tss_mkstr(out, ostr); + d.Trace(dl, _T("%s\n"), out.c_str()); } /////////////////////////////////////////////////////////////////////////////// @@ -358,7 +364,7 @@ iFCOProp* cFSPropSet::GetPropAt(int index) return NULL; } -void cFSPropSet::Read(iSerializer* pSerializer, int32 version) +void cFSPropSet::Read(iSerializer* pSerializer, int32_t version) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("FS Property Set Read"))); diff --git a/src/fs/fspropset.h b/src/fs/fspropset.h index ac3eae8..c52f1e3 100644 --- a/src/fs/fspropset.h +++ b/src/fs/fspropset.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -55,7 +55,7 @@ /////////////////////////////////////////////////////////////////////////////// // cFCOPropFileType -- a property that represents a file type. Is is really just -// an int32 that overrides the AsString() method to display the file type +// an int32_t that overrides the AsString() method to display the file type /////////////////////////////////////////////////////////////////////////////// class cFCOPropFileType : public cFCOPropInt32 { @@ -112,6 +112,10 @@ public: FT_DOOR, FT_PORT, FT_NAMED, + FT_NATIVE, + FT_MESSAGE_QUEUE, + FT_SEMAPHORE, + FT_SHARED_MEMORY, FT_NUMITEMS }; @@ -166,7 +170,7 @@ public: //PROPERTY_OBJ(cUnixACL, ACL, PROP_ACL) // will eventually be implememented // iSerializable interface - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) // debugging method diff --git a/src/fs/fsstrings.cpp b/src/fs/fsstrings.cpp index ee115a1..7a9d927 100644 --- a/src/fs/fsstrings.cpp +++ b/src/fs/fsstrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -41,14 +41,22 @@ TSS_BeginStringtable(cFS) - TSS_StringEntry(fs::STR_FT_INVALID, _T("Invalid")), - TSS_StringEntry(fs::STR_FT_FILE, _T("Regular File")), TSS_StringEntry(fs::STR_FT_DIR, _T("Directory")), - TSS_StringEntry(fs::STR_FT_BLOCKDEV, _T("Block Device")), - TSS_StringEntry(fs::STR_FT_CHARDEV, _T("Character Device")), - TSS_StringEntry(fs::STR_FT_SYMLINK, _T("Symbolic Link")), TSS_StringEntry(fs::STR_FT_FIFO, _T("FIFO")), - TSS_StringEntry(fs::STR_FT_SOCK, _T("Socket")), TSS_StringEntry(fs::STR_FT_DOOR, _T("Door")), - TSS_StringEntry(fs::STR_FT_PORT, _T("Event Port")), TSS_StringEntry(fs::STR_FT_NAMED, _T("Named Special File")), - + TSS_StringEntry(fs::STR_FT_INVALID, _T("Invalid")), + TSS_StringEntry(fs::STR_FT_FILE, _T("Regular File")), + TSS_StringEntry(fs::STR_FT_DIR, _T("Directory")), + TSS_StringEntry(fs::STR_FT_BLOCKDEV, _T("Block Device")), + TSS_StringEntry(fs::STR_FT_CHARDEV, _T("Character Device")), + TSS_StringEntry(fs::STR_FT_SYMLINK, _T("Symbolic Link")), + TSS_StringEntry(fs::STR_FT_FIFO, _T("FIFO")), + TSS_StringEntry(fs::STR_FT_SOCK, _T("Socket")), + TSS_StringEntry(fs::STR_FT_DOOR, _T("Door")), + TSS_StringEntry(fs::STR_FT_PORT, _T("Event Port")), + TSS_StringEntry(fs::STR_FT_NAMED, _T("Named Special File")), + TSS_StringEntry(fs::STR_FT_NATIVE, _T("Native Object")), + TSS_StringEntry(fs::STR_FT_MESSAGE_QUEUE, _T("Message Queue")), + TSS_StringEntry(fs::STR_FT_SEMAPHORE, _T("Semaphore")), + TSS_StringEntry(fs::STR_FT_SHARED_MEMORY, _T("Shared Memory")), + // property names TSS_StringEntry(fs::STR_PROP_DEV, _T("Device Number")), TSS_StringEntry(fs::STR_PROP_RDEV, _T("File Device Number")), diff --git a/src/fs/fsstrings.h b/src/fs/fsstrings.h index 22850ae..55b3118 100644 --- a/src/fs/fsstrings.h +++ b/src/fs/fsstrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -46,9 +46,8 @@ TSS_BeginStringIds(fs) // file types STR_FT_INVALID, - STR_FT_FILE, STR_FT_DIR, STR_FT_BLOCKDEV, STR_FT_CHARDEV, STR_FT_SYMLINK, STR_FT_FIFO, STR_FT_SOCK, STR_FT_DOOR, - STR_FT_PORT, STR_FT_NAMED, - + STR_FT_FILE, STR_FT_DIR, STR_FT_BLOCKDEV, STR_FT_CHARDEV, STR_FT_SYMLINK, STR_FT_FIFO, STR_FT_SOCK, STR_FT_DOOR, STR_FT_PORT, STR_FT_NAMED, STR_FT_NATIVE, + STR_FT_MESSAGE_QUEUE, STR_FT_SEMAPHORE, STR_FT_SHARED_MEMORY, // property names STR_PROP_DEV, STR_PROP_RDEV, STR_PROP_INODE, STR_PROP_MODE, STR_PROP_NLINK, STR_PROP_UID, STR_PROP_GID, STR_PROP_SIZE, STR_PROP_ATIME, STR_PROP_MTIME, STR_PROP_CTIME, STR_PROP_BLOCK_SIZE, STR_PROP_BLOCKS, STR_PROP_CRC32, diff --git a/src/fs/fsvisitor.cpp b/src/fs/fsvisitor.cpp index 1508b8b..edb1402 100644 --- a/src/fs/fsvisitor.cpp +++ b/src/fs/fsvisitor.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/fsvisitor.h b/src/fs/fsvisitor.h index 838a567..d845685 100644 --- a/src/fs/fsvisitor.h +++ b/src/fs/fsvisitor.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/stdfs.cpp b/src/fs/stdfs.cpp index 24a6365..89cf8d4 100644 --- a/src/fs/stdfs.cpp +++ b/src/fs/stdfs.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/fs/stdfs.h b/src/fs/stdfs.h index cf1f244..5ccea9f 100644 --- a/src/fs/stdfs.h +++ b/src/fs/stdfs.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/mini-setup/twcfg.txt b/src/mini-setup/twcfg.txt new file mode 100644 index 0000000..1b70e64 --- /dev/null +++ b/src/mini-setup/twcfg.txt @@ -0,0 +1,6 @@ +SITEKEYFILE=s +LOCALKEYFILE=l +POLFILE=test.pol +DBFILE=test.twd +REPORTFILE=test.twr + diff --git a/src/mini-setup/twpol.txt b/src/mini-setup/twpol.txt new file mode 100644 index 0000000..e449520 --- /dev/null +++ b/src/mini-setup/twpol.txt @@ -0,0 +1,2 @@ +/tmp/tw-test -> $(IgnoreNone); + diff --git a/src/parser/lexyacc_header.h b/src/parser/lexyacc_header.h index c211efa..b4c930b 100644 --- a/src/parser/lexyacc_header.h +++ b/src/parser/lexyacc_header.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/parser/policy.y b/src/parser/policy.y index f2d255c..6d2c9d8 100644 --- a/src/parser/policy.y +++ b/src/parser/policy.y @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/parser/tokens.l b/src/parser/tokens.l index 708b214..a054686 100644 --- a/src/parser/tokens.l +++ b/src/parser/tokens.l @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/siggen/Makefile.in b/src/siggen/Makefile.in index 8db2435..f4eed2c 100644 --- a/src/siggen/Makefile.in +++ b/src/siggen/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -124,7 +124,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) @@ -295,6 +295,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -340,8 +341,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -484,7 +485,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/src/siggen/siggen.cpp b/src/siggen/siggen.cpp index a1ad86d..a3fcfaf 100644 --- a/src/siggen/siggen.cpp +++ b/src/siggen/siggen.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/siggen/siggen.h b/src/siggen/siggen.h index 1844053..53e6763 100644 --- a/src/siggen/siggen.h +++ b/src/siggen/siggen.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/siggen/siggencmdline.cpp b/src/siggen/siggencmdline.cpp index f0ab1ca..04f132d 100644 --- a/src/siggen/siggencmdline.cpp +++ b/src/siggen/siggencmdline.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/siggen/siggencmdline.h b/src/siggen/siggencmdline.h index a449e4c..c704061 100644 --- a/src/siggen/siggencmdline.h +++ b/src/siggen/siggencmdline.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/siggen/siggenmain.cpp b/src/siggen/siggenmain.cpp index 9c3c9fa..a9df80f 100644 --- a/src/siggen/siggenmain.cpp +++ b/src/siggen/siggenmain.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -64,14 +64,24 @@ void tw_terminate_handler() { fputs("### Internal Error.\n### Terminate Handler called.\n### Exiting...\n", stderr); +#if HAVE__EXIT _exit(1); +#else + exit(1); +#endif } +#if USE_UNEXPECTED void tw_unexpected_handler() { fputs("### Internal Error.\n### Unexpected Exception Handler called.\n### Exiting...\n", stderr); +#if HAVE__EXIT _exit(1); +#else + exit(1); +#endif } +#endif static void SiggenInit() { @@ -112,8 +122,9 @@ int __cdecl _tmain(int argc, const TCHAR** argv) // Note: we do this before Init() in case it attempts to call these handlers // TODO: move this into the Init() routine EXCEPTION_NAMESPACE set_terminate(tw_terminate_handler); +#if USE_UNEXPECTED EXCEPTION_NAMESPACE set_unexpected(tw_unexpected_handler); - +#endif //cTWInit twInit( argv[0] ); SiggenInit(); diff --git a/src/siggen/siggenstrings.cpp b/src/siggen/siggenstrings.cpp index a89f6a7..405d4e9 100644 --- a/src/siggen/siggenstrings.cpp +++ b/src/siggen/siggenstrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/siggen/siggenstrings.h b/src/siggen/siggenstrings.h index 8f349ac..f5e65b8 100644 --- a/src/siggen/siggenstrings.h +++ b/src/siggen/siggenstrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/siggen/stdsiggen.cpp b/src/siggen/stdsiggen.cpp index 504ca4e..f75a50e 100644 --- a/src/siggen/stdsiggen.cpp +++ b/src/siggen/stdsiggen.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/siggen/stdsiggen.h b/src/siggen/stdsiggen.h index c8a6418..c8e68bf 100644 --- a/src/siggen/stdsiggen.h +++ b/src/siggen/stdsiggen.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/test-harness/tests/integritycheck.pm b/src/test-harness/tests/integritycheck.pm index c95d98d..cee4c28 100644 --- a/src/test-harness/tests/integritycheck.pm +++ b/src/test-harness/tests/integritycheck.pm @@ -33,12 +33,12 @@ sub PolicyFileString return < \$(ReadOnly) +S -ab; #read only plus SHA-1 minus atime & blocks } - (rulename="RuleB", severity=200, emailto="elvis@mars") + (rulename="RuleB", severity=200, emailto="elvis\@mars") { $root2 -> \$(ReadOnly) +S -ab; #read only plus SHA-1 minus atime & blocks } diff --git a/src/test-harness/tests/md5sum.pm b/src/test-harness/tests/md5sum.pm index 09e612f..fc4324f 100644 --- a/src/test-harness/tests/md5sum.pm +++ b/src/test-harness/tests/md5sum.pm @@ -37,7 +37,7 @@ sub run() { # lets see if the system 'md5sum' agree's with siggen's md5 hash # my ($md5sum, undef) = split(/ /, `md5sum $twtools::twrootdir/test`); - if ($mf5sum eq "") { + if ($md5sum eq "") { twtools::logStatus("md5sum not found, trying openssl instead\n"); (undef, $md5sum) = split(/=/, `openssl md5 $twtools::twrootdir/test`); } diff --git a/src/test-harness/twtest.pl b/src/test-harness/twtest.pl index 1611811..503b66b 100755 --- a/src/test-harness/twtest.pl +++ b/src/test-harness/twtest.pl @@ -119,7 +119,7 @@ sub runTests { } else { - print "no test '$module' found...\n"; + print "Could not find or load test module '$module', error = $@ \n"; } } } diff --git a/src/test-harness/twtools.pm b/src/test-harness/twtools.pm index 505f0d1..ba8dcc7 100644 --- a/src/test-harness/twtools.pm +++ b/src/test-harness/twtools.pm @@ -50,8 +50,8 @@ BEGIN { LATEPROMPTING => 'false', LOOSEDIRECTORYCHECKING => 'false', MAILNOVIOLATIONS => 'true', - EMAILREPORTLEVEL => '3', - REPORTLEVEL => '3', + EMAILREPORTLEVEL => '4', + REPORTLEVEL => '4', MAILMETHOD => 'SENDMAIL', SYSLOGREPORTING => 'true', MAILPROGRAM => 'cat', @@ -751,6 +751,12 @@ sub RunIntegrityTests(\%) { my @twresults = RunReport( { dir => "this"} ); my ($actualViolations, $actualAdded, $actualRemoved, $actualChanged) = AnalyzeReport(@twresults); + logStatus("Total expected: $violations | Total observed: $actualViolations\n"); + logStatus("Expected added: $added | Observed added: $actualAdded\n"); + logStatus("Expected removed: $removed | Observed removed: $actualRemoved\n"); + logStatus("Expected changed: $changed | Observed changed: $actualChanged\n"); + + # Actual and expected violations should match if everything went as # planned. # diff --git a/src/tripwire/Makefile.in b/src/tripwire/Makefile.in index df8e69c..8cd2f1f 100644 --- a/src/tripwire/Makefile.in +++ b/src/tripwire/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -128,7 +128,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) @@ -299,6 +299,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -348,8 +349,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -492,7 +493,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/src/tripwire/generatedb.cpp b/src/tripwire/generatedb.cpp index 5923d69..3b1af89 100644 --- a/src/tripwire/generatedb.cpp +++ b/src/tripwire/generatedb.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -119,7 +119,7 @@ static void util_ProcessDir( // Execute /////////////////////////////////////////////////////////////////////////////// void cGenerateDb::Execute( - const cFCOSpecList& specList, cHierDatabase& db, iFCOPropDisplayer* pPD, cErrorBucket* pBucket, uint32 flags) + const cFCOSpecList& specList, cHierDatabase& db, iFCOPropDisplayer* pPD, cErrorBucket* pBucket, uint32_t flags) { // TODO -- assert the db is empty or clear it out myself! diff --git a/src/tripwire/generatedb.h b/src/tripwire/generatedb.h index 54383e9..868ac1d 100644 --- a/src/tripwire/generatedb.h +++ b/src/tripwire/generatedb.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -53,7 +53,7 @@ public: cHierDatabase& db, iFCOPropDisplayer* pPD, cErrorBucket* pBucket, - uint32 flags = 0); + uint32_t flags = 0); // generates a tripwire database; this asserts that the database is open enum Flags diff --git a/src/tripwire/generatedb_t.cpp b/src/tripwire/generatedb_t.cpp index b847cdb..72c0bcd 100644 --- a/src/tripwire/generatedb_t.cpp +++ b/src/tripwire/generatedb_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/integritycheck.cpp b/src/tripwire/integritycheck.cpp index 6796cc2..73b3069 100644 --- a/src/tripwire/integritycheck.cpp +++ b/src/tripwire/integritycheck.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -271,7 +271,7 @@ void cIntegrityCheck::CompareFCOs(iFCO* pOldFCO, iFCO* pNewFCO) // construct the compare object and actually do the compare // cFCOCompare compareObj(propsToCheck); - uint32 result = compareObj.Compare(pOldFCO, pNewFCO); + uint32_t result = compareObj.Compare(pOldFCO, pNewFCO); if ((result & cFCOCompare::PROPS_UNEQUAL) || (result & cFCOCompare::PROPS_NOT_ALL_VALID)) { @@ -329,7 +329,7 @@ void cIntegrityCheck::ProcessDir(cDbDataSourceIter dbIter, iFCODataSourceIter* p #ifdef DEBUG if (dbIter.Done()) { - d.TraceDebug("Processing directory %s\n", pIter->GetParentName().AsString().c_str()); + d.TraceDebug("Processing directory %s\n", (pIter ? pIter->GetParentName().AsString().c_str() : _T("[none]"))); } else { @@ -451,7 +451,7 @@ cIntegrityCheck::~cIntegrityCheck() /////////////////////////////////////////////////////////////////////////////// // Execute /////////////////////////////////////////////////////////////////////////////// -void cIntegrityCheck::Execute(uint32 flags) +void cIntegrityCheck::Execute(uint32_t flags) { mFlags = flags; // create the data source iterator @@ -557,7 +557,7 @@ void cIntegrityCheck::Execute(uint32 flags) /////////////////////////////////////////////////////////////////////////////// // ExecuteOnObjectList /////////////////////////////////////////////////////////////////////////////// -void cIntegrityCheck::ExecuteOnObjectList(const std::list& fcoNames, uint32 flags) +void cIntegrityCheck::ExecuteOnObjectList(const std::list& fcoNames, uint32_t flags) { iFCONameTranslator* pTrans = iTWFactory::GetInstance()->GetNameTranslator(); // diff --git a/src/tripwire/integritycheck.h b/src/tripwire/integritycheck.h index a06eef2..17439ea 100644 --- a/src/tripwire/integritycheck.h +++ b/src/tripwire/integritycheck.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -87,10 +87,10 @@ public: ~cIntegrityCheck(); - void Execute(uint32 flags = 0); + void Execute(uint32_t flags = 0); // flags should be 0, or some combination of the below enumeration // TODO -- specify what kinds of exception can come up from here.... - void ExecuteOnObjectList(const std::list& fcoNames, uint32 flags = 0); + void ExecuteOnObjectList(const std::list& fcoNames, uint32_t flags = 0); // executes an integrity check on the objects named in the list. The specList passed in // as the first parameter to the ctor is interprited as the db's spec list. int ObjectsScanned() @@ -133,7 +133,7 @@ private: iFCOSpec* mpCurSpec; // the spec we are currently operating on cFCOReportSpecIter mReportIter; // the current iterator into the report cFCOPropVector mLooseDirProps; // properties that should be ignored in loose directories - uint32 mFlags; // flags passed in to execute() + uint32_t mFlags; // flags passed in to execute() int mnObjectsScanned; // number of objects scanned in system ( scanning includes // discovering that an FCO does not exist ) diff --git a/src/tripwire/integritycheck_t.cpp b/src/tripwire/integritycheck_t.cpp index d211462..b72d07e 100644 --- a/src/tripwire/integritycheck_t.cpp +++ b/src/tripwire/integritycheck_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/mailmessage.cpp b/src/tripwire/mailmessage.cpp index 72a5168..452256d 100644 --- a/src/tripwire/mailmessage.cpp +++ b/src/tripwire/mailmessage.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -176,7 +176,12 @@ bool cMailMessage::GetAttachmentsAsString(std::string& s) std::string cMailMessage::Create822Header() { +#if !ARCHAIC_STL std::ostringstream ss; +#else + strstream ss; +#endif + std::string strToList; for (std::vector::size_type i = 0; i < mvstrRecipients.size(); i++) { @@ -242,7 +247,7 @@ bool cMailMessageUtil::ReadDate(TSTRING& strDateBuf) #else - int64 now = cSystemInfo::GetExeStartTime(); + int64_t now = cSystemInfo::GetExeStartTime(); strDateBuf = cTimeUtil::GetRFC822Date(cTimeUtil::TimeToDateGMT(now)); fGotDate = true; @@ -280,19 +285,23 @@ static bool NeedsEncoding(char ch) static std::string EncodeChar(char ch) { - std::ostringstream ss; - - ss.imbue(std::locale::classic()); + TOSTRINGSTREAM ss; + tss_classic_locale(ss); + ss.setf(std::ios::hex, std::ios::basefield); + ss.fill('0'); - ss.setf(std::ios_base::hex, std::ios_base::basefield); + ss.width(2); ss << (unsigned int)(unsigned char)ch; - + tss_end(ss); + ASSERT(ss.str().length() == 2); // Make sure the hex is uppercase std::string s = ss.str(); + tss_free(ss); + std::transform(s.begin(), s.end(), s.begin(), toupper); return s; @@ -526,7 +535,7 @@ std::string& cMailMessageUtil::LFToCRLF(std::string& sIn) /* static std::string -util_Base64Encode( const byte b[3], int size ) +util_Base64Encode( const uint8_t b[3], int size ) { // TODO:BAM -- what about endianness? ASSERT( size > 0 && size <= 3 ); @@ -542,18 +551,18 @@ util_Base64Encode( const byte b[3], int size ) if( size >= 2 ) { // encode B,C - s += v64[ ( ( b[0] & (byte)0x3 ) << 4 ) | ( b[1] >> 4 ) ]; + s += v64[ ( ( b[0] & (uint8_t)0x3 ) << 4 ) | ( b[1] >> 4 ) ]; if( size == 3 ) - s += v64[ ( ( b[1] & (byte)0xF ) << 2 ) | ( b[2] >> 6 ) ]; + s += v64[ ( ( b[1] & (uint8_t)0xF ) << 2 ) | ( b[2] >> 6 ) ]; else - s += v64[ ( ( b[1] & (byte)0xF ) << 2 ) ]; + s += v64[ ( ( b[1] & (uint8_t)0xF ) << 2 ) ]; } if( size >= 3 ) { // encode D - s += v64[ b[2] & (byte)0x3F ]; + s += v64[ b[2] & (uint8_t)0x3F ]; } // padding @@ -580,7 +589,7 @@ const T& MS_SUCKS_min( const T& a, const T& b ) const std::string::value_type* cMailMessageUtil::ConvertBase64( std::string& sEncode, - const byte* pchSrc, + const uint8_t* pchSrc, size_t nchSrc ) { sEncode.assign( ToBase64( pchSrc, nchSrc ) ); @@ -589,9 +598,9 @@ cMailMessageUtil::ConvertBase64( std::string -cMailMessageUtil::ToBase64( const byte* p, size_t size ) +cMailMessageUtil::ToBase64( const uint8_t* p, size_t size ) { - ASSERT( sizeof( uint8 ) == sizeof( byte ) ); // everything breaks otherwise + ASSERT( sizeof( uint8_t ) == sizeof( uint8_t ) ); // everything breaks otherwise std::string s; const int MAX_WORKING_BYTES = 3; @@ -599,8 +608,8 @@ cMailMessageUtil::ToBase64( const byte* p, size_t size ) const int MAX_CHARS_PER_BYTE = 2; // should be ASSERT( MAX_CHARS_PER_BYTE > CHARS_PER_WORKING_BYTES/MAX_WORKING_BYTES ); const int NERVOUS_LINE_BUFFER = 10; - const byte* at = p; - byte buf[ MAX_WORKING_BYTES ]; + const uint8_t* at = p; + uint8_t buf[ MAX_WORKING_BYTES ]; int nbLeft; int nbWorking; int nchCurLine; @@ -653,19 +662,18 @@ cMailMessageUtil::ToBase64( const byte* p, size_t size ) namespace /*Unique*/ { -typedef byte byte_t; # ifdef TSS_MAKE_EOL_CRLF -const byte _aszEoL[] = "\r\n"; +const uint8_t _aszEoL[] = "\r\n"; size_t _EOL_LEN = 2; # else -const byte _aszEoL[] = "\n"; +const uint8_t _aszEoL[] = "\n"; size_t _EOL_LEN = 1; # endif -const byte_t _abBase64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +const uint8_t _abBase64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/"; @@ -697,7 +705,7 @@ inline size_t tss_encode_base64_size(size_t nchSource) return nchOut + nchEol + 2; } -void tss_encode_digit_base64(const byte_t*& pchSrc, size_t& nchSrcLeft, byte_t*& pchBuf, size_t& nchBufLeft) +void tss_encode_digit_base64(const uint8_t*& pchSrc, size_t& nchSrcLeft, uint8_t*& pchBuf, size_t& nchBufLeft) { // NOTE:RAD -- Redundant and ugly but very fast!! @@ -756,7 +764,7 @@ void tss_encode_digit_base64(const byte_t*& pchSrc, size_t& nchSrcLeft, byte_t*& }; -size_t tss_encode_base64(const byte_t* pchSource, size_t nchSource, byte_t* pchBuffer, size_t nchBuffer) +size_t tss_encode_base64(const uint8_t* pchSource, size_t nchSource, uint8_t* pchBuffer, size_t nchBuffer) { const size_t _ERROR = std::string::npos; // -1; @@ -780,8 +788,8 @@ size_t tss_encode_base64(const byte_t* pchSource, size_t nchSource, byte_t* pchB //--Get three characters at a time and encode them (watching linelen) - byte_t* pchBuf = (pchBuffer + 0); - const byte_t* pchSrc = (pchSource + 0); + uint8_t* pchBuf = (pchBuffer + 0); + const uint8_t* pchSrc = (pchSource + 0); const size_t _max_linelen = (_MAX_RFC822_LINE_LEN - _EOL_LEN); @@ -798,7 +806,7 @@ size_t tss_encode_base64(const byte_t* pchSource, size_t nchSource, byte_t* pchB { nLineLen = 0; // RESET: - const byte_t* pchEol = &_aszEoL[0]; + const uint8_t* pchEol = &_aszEoL[0]; while (*pchEol) *pchBuf++ = *pchEol++; } @@ -812,7 +820,7 @@ size_t tss_encode_base64(const byte_t* pchSource, size_t nchSource, byte_t* pchB const std::string::value_type* -cMailMessageUtil::ConvertBase64(std::string& sEncode, const byte_t* pchSrc, size_t nchSrc) +cMailMessageUtil::ConvertBase64(std::string& sEncode, const uint8_t* pchSrc, size_t nchSrc) { size_t nch = tss_encode_base64(pchSrc, nchSrc, 0, 0); // Like mbstowcs @@ -822,7 +830,7 @@ cMailMessageUtil::ConvertBase64(std::string& sEncode, const byte_t* pchSrc, size const char* pch = sEncode.c_str(); // Get Pointer (won't change) size_t nLength = // Action - tss_encode_base64(pchSrc, nchSrc, (byte_t*)pch, nch); + tss_encode_base64(pchSrc, nchSrc, (uint8_t*)pch, nch); if (nLength == std::string::npos) throw std::bad_alloc(); @@ -833,7 +841,7 @@ cMailMessageUtil::ConvertBase64(std::string& sEncode, const byte_t* pchSrc, size } -std::string cMailMessageUtil::ToBase64(const byte_t* pchSrc, size_t nchSrc) +std::string cMailMessageUtil::ToBase64(const uint8_t* pchSrc, size_t nchSrc) { // NOTE: It sucks to use std::string this way! Should be // passed in by reference. diff --git a/src/tripwire/mailmessage.h b/src/tripwire/mailmessage.h index 871dcd0..19e500f 100644 --- a/src/tripwire/mailmessage.h +++ b/src/tripwire/mailmessage.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -36,15 +36,13 @@ #include "core/error.h" #endif -#if IS_REDOX -# define restrict __restrict__ -#endif - #if SUPPORTS_NETWORKING && HAVE_SYS_SOCKET_H #include #endif -#define SOCKET int +#ifndef SOCKET +#define SOCKET int +#endif /////////////////////////////////////////////////////////////////////////////// // @@ -128,7 +126,7 @@ public: _EOL_LEN = 2 }; - static const std::string::value_type* ConvertBase64(std::string&, const byte*, size_t); + static const std::string::value_type* ConvertBase64(std::string&, const uint8_t*, size_t); static bool HasNonAsciiChars(const std::string& s); static std::string CreateEncodedText(const std::string& text); diff --git a/src/tripwire/pipedmailmessage.cpp b/src/tripwire/pipedmailmessage.cpp index eddc1ce..7793e1a 100644 --- a/src/tripwire/pipedmailmessage.cpp +++ b/src/tripwire/pipedmailmessage.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -153,11 +153,13 @@ void cPipedMailMessage::SendInit() // throw( eMailMessageError ) TSTRING strHeader; strHeader += cStringUtil::StrToTstr(cMailMessage::Create822Header()); -#if !USES_MPOPEN +#if USES_MPOPEN + // call mpopen, our safe version popen + mpFile = mpopen((char*)mstrSendMailExePath.c_str(), _T("w")); +#elif HAVE_POPEN mpFile = popen(mstrSendMailExePath.c_str(), _T("w")); #else - // call mpopen, our safe version popen - mpFile = mpopen((char*)mstrSendMailExePath.c_str(), _T("w")); + // No pipes for you, sorry. #endif if (!mpFile) { diff --git a/src/tripwire/policyupdate.cpp b/src/tripwire/policyupdate.cpp index d4c9d69..4b43cc0 100644 --- a/src/tripwire/policyupdate.cpp +++ b/src/tripwire/policyupdate.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -142,7 +142,7 @@ cPolicyUpdate::cPolicyUpdate(cGenre::Genre genreNum, /////////////////////////////////////////////////////////////////////////////// // Execute /////////////////////////////////////////////////////////////////////////////// -bool cPolicyUpdate::Execute(uint32 flags) // throw (eError) +bool cPolicyUpdate::Execute(uint32_t flags) // throw (eError) { // here is my current idea for the algorithm: first, do an integrity check with the new policy on the database and // a special flag passed to Execute() to modify what properties are checked. Then, take the resulting @@ -166,7 +166,7 @@ bool cPolicyUpdate::Execute(uint32 flags) // throw (eError) // // set up flags for the property calculator and iterators // - uint32 icFlags = cIntegrityCheck::FLAG_COMPARE_VALID_PROPS_ONLY | cIntegrityCheck::FLAG_INVALIDATE_EXTRA_DB_PROPS | + uint32_t icFlags = cIntegrityCheck::FLAG_COMPARE_VALID_PROPS_ONLY | cIntegrityCheck::FLAG_INVALIDATE_EXTRA_DB_PROPS | cIntegrityCheck::FLAG_SET_NEW_PROPS; if (flags & FLAG_ERASE_FOOTPRINTS_PU) @@ -279,7 +279,7 @@ bool cPolicyUpdate::Execute(uint32 flags) // throw (eError) // cUpdateDb update(mDb, report, mpBucket); - uint32 updateDBFlags = cUpdateDb::FLAG_REPLACE_PROPS; + uint32_t updateDBFlags = cUpdateDb::FLAG_REPLACE_PROPS; if (flags & FLAG_ERASE_FOOTPRINTS_PU) { updateDBFlags |= cUpdateDb::FLAG_ERASE_FOOTPRINTS_UD; diff --git a/src/tripwire/policyupdate.h b/src/tripwire/policyupdate.h index 1c6b2e1..c023bad 100644 --- a/src/tripwire/policyupdate.h +++ b/src/tripwire/policyupdate.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -65,7 +65,7 @@ public: cHierDatabase& db, cErrorBucket* pBucket); - bool Execute(uint32 flags = 0); // throw (eError) + bool Execute(uint32_t flags = 0); // throw (eError) // if false is returned, then there was at least one conflict that came up during the policy // update, and if tripwire was run in secure mode then the policy update should fail. diff --git a/src/tripwire/resource.h b/src/tripwire/resource.h index f68b707..bcc855b 100644 --- a/src/tripwire/resource.h +++ b/src/tripwire/resource.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/smtpmailmessage.cpp b/src/tripwire/smtpmailmessage.cpp index d51ae7e..081e8fc 100644 --- a/src/tripwire/smtpmailmessage.cpp +++ b/src/tripwire/smtpmailmessage.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -36,7 +36,11 @@ #include "tw/twutil.h" #include "tripwirestrings.h" #include "core/stringutil.h" +#if HAVE_SSTREAM #include +#elif HAVE_STRSTREAM +#include +#endif #include "core/file.h" #include @@ -45,47 +49,55 @@ //All the spleck that it takes to run sockets in Unix... #include -# if HAVE_SYS_SOCKET_H -# include -# include -# include -# include -# endif + +#if HAVE_SYS_SOCKET_H +# include +# include +# include +# include +#endif + #include -#include -# if HAVE_SYS_UTSNAME_H -# include -# endif +#if HAVE_SYS_TIME_H +# include +#endif -# if HAVE_SYS_SELECT_H -# include -# endif +#if HAVE_SYS_UTSNAME_H +# include +#endif + +#if HAVE_SYS_SELECT_H +# include +#endif /* Some systems like Solaris and AIX don't define * INADDR_NONE, but it's pretty standard. If not, * then the OS _should_ define it for us. */ -# ifndef INADDR_NONE -# define INADDR_NONE 0xffffffff -# endif +#ifndef INADDR_NONE +# define INADDR_NONE 0xffffffff +#endif #include -# define INVALID_SOCKET -1 +#ifndef INVALID_SOCKET +# define INVALID_SOCKET -1 +#endif -# if IS_AROS -# ifndef HAVE_GETHOSTNAME -# define HAVE_GETHOSTNAME 1 -# endif -# endif +#if IS_AROS +# ifndef HAVE_GETHOSTNAME +# define HAVE_GETHOSTNAME 1 +# endif +#endif -# ifndef HAVE_GETHOSTNAME + +#ifndef HAVE_GETHOSTNAME static int gethostname(char* name, int namelen) { name[0] = '\0'; -# if HAVE_SYS_UTSNAME_H +#if HAVE_SYS_UTSNAME_H struct utsname myname; uname(&myname); @@ -100,28 +112,11 @@ static int gethostname(char* name, int namelen) return -1; // equivalent of SOCKET_ERROR } -# else +#else strncpy(name, "localhost", namelen); -# endif +#endif } -# endif //HAVE_GETHOSTNAME - -// Unix does not require us to go though any silly DLL hoops, so we'll -// just #define the pointers to functions needed by Windows to be the -// berkely functions. -# define mPfnSocket socket -# define mPfnInetAddr inet_addr -# define mPfnGethostname gethostname -# define mPfnGethostbyname gethostbyname -# define mPfnConnect connect -# define mPfnCloseSocket close -# define mPfnSend send -# define mPfnRecv recv -# define mPfnSelect select -# define mPfnNtohl ntohl -# define mPfnHtonl htonl -# define mPfnNtohs ntohs -# define mPfnHtons htons +#endif //HAVE_GETHOSTNAME // // TODO - maybe convert this SMTP code to non-blocking socket calls, or use @@ -174,44 +169,32 @@ long cSMTPMailMessage::GetServerAddress() if (bIsNumeric) { -# ifndef HAVE_SYS_SOCKET_H - return 0; -# else // convert the numberic address to a long - return mPfnInetAddr(sNarrowString.c_str()); -# endif + return inet_addr(sNarrowString.c_str()); } else { -# if IS_SORTIX || !defined(HAVE_SYS_SOCKET_H) - return INADDR_NONE; -# else // do a DNS lookup of the hostname and get the long - hostent* ent = mPfnGethostbyname(sNarrowString.c_str()); + hostent* ent = gethostbyname(sNarrowString.c_str()); if (!ent) return INADDR_NONE; else return *(long*)ent->h_addr_list[0]; -# endif } } - /////////////////////////////////////////////////////////////////////////////// // // Create and open the socket connection // bool cSMTPMailMessage::OpenConnection() { -# ifndef HAVE_SYS_SOCKET_H - return false; -# else // Initialize the socket structure sockaddr_in sockAddrIn; memset(&sockAddrIn, 0, sizeof(sockaddr)); sockAddrIn.sin_family = AF_INET; - sockAddrIn.sin_port = mPfnHtons(mPortNumber); - uint32 iServerAddress = GetServerAddress(); + sockAddrIn.sin_port = htons(mPortNumber); + uint32_t iServerAddress = GetServerAddress(); sockAddrIn.sin_addr.s_addr = iServerAddress; @@ -222,12 +205,14 @@ bool cSMTPMailMessage::OpenConnection() TOSTRINGSTREAM estr; estr << TSS_GetString(cTripwire, tripwire::STR_ERR2_MAIL_MESSAGE_SERVER) << mstrServerName; - throw eMailSMTPIPUnresolvable(estr.str()); - return false; + tss_mkstr(errStr, estr); + + throw eMailSMTPIPUnresolvable(errStr); + return false; } // Create the socket - mSocket = mPfnSocket(AF_INET, SOCK_STREAM, 0); + mSocket = socket(AF_INET, SOCK_STREAM, 0); if (mSocket == INVALID_SOCKET) { DecodeError(); @@ -236,7 +221,7 @@ bool cSMTPMailMessage::OpenConnection() } // Make the connection - int connectVal = mPfnConnect(mSocket, (struct sockaddr*)&sockAddrIn, sizeof(sockAddrIn)); + int connectVal = connect(mSocket, (struct sockaddr*)&sockAddrIn, sizeof(sockAddrIn)); if (connectVal < 0) { DecodeError(); @@ -244,12 +229,13 @@ bool cSMTPMailMessage::OpenConnection() TOSTRINGSTREAM estr; estr << TSS_GetString(cTripwire, tripwire::STR_ERR2_MAIL_MESSAGE_SERVER) << mstrServerName; - throw eMailSMTPOpenConnection(estr.str()); + tss_mkstr(errStr, estr); + + throw eMailSMTPOpenConnection(errStr); return false; } return true; -# endif } @@ -262,7 +248,7 @@ bool cSMTPMailMessage::CloseConnection() if (INVALID_SOCKET != mSocket) { // close the connection - int closeVal = mPfnCloseSocket(mSocket); + int closeVal = close(mSocket); if (closeVal != 0) { DecodeError(); @@ -325,7 +311,12 @@ bool cSMTPMailMessage::MailMessage() // mpfnGethostname (see below). It won't be used // after that. +#if !ARCHAIC_STL std::ostringstream strmSend; +#else + strstream strmSend; +#endif + // This should be a stream object, so we don't have // to use nasty calls to sprintf that might overflow // the buffer. Before, we used a fixed buffer of 512 @@ -336,7 +327,7 @@ bool cSMTPMailMessage::MailMessage() ASSERT(strmSend.str().length() == 0); // This bad boy better be empty. // get our hostname for the HELO message - if (mPfnGethostname(sLocalHost, 256) < 0) + if (gethostname(sLocalHost, 256) < 0) { DecodeError(); return false; @@ -347,21 +338,33 @@ bool cSMTPMailMessage::MailMessage() //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Say hello - strmSend.str(""); //Clear the stream buffer. +#if !ARCHAIC_STL + strmSend.str(""); //Clear the stream buffer. +#else + // TODO +#endif strmSend << "HELO " << sLocalHost << "\r\n"; //Fill the stream buffer. SendString(strmSend.str()); if (!GetAcknowledgement()) return false; - +#if !ARCHAIC_STL strmSend.str(""); //Clear the stream buffer. +#else + // TODO +#endif strmSend << "MAIL FROM:<" << cStringUtil::TstrToStr(mstrFrom) << ">\r\n"; SendString(strmSend.str()); if (!GetAcknowledgement()) return false; // Say who all we're sending to +#if !ARCHAIC_STL strmSend.str(""); //Clear the stream buffer. +#else + // TODO +#endif + for (std::vector::size_type i = 0; i < mvstrRecipients.size(); i++) { sNarrowString = cStringUtil::TstrToStr(mvstrRecipients[i]); @@ -386,8 +389,14 @@ bool cSMTPMailMessage::MailMessage() // Send Header //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // set up header +#if !ARCHAIC_STL strmSend.str(""); +#else + // TODO +#endif + strmSend << cMailMessage::Create822Header(); SendString(strmSend.str()); @@ -469,9 +478,6 @@ bool cSMTPMailMessage::MailMessage() // bool cSMTPMailMessage::GetAcknowledgement() { -# ifndef HAVE_SYS_SOCKET_H - return false; -# else cDebug d("cSMTPMailMessage::GetAcknowledgement"); const int bufsize = 512; @@ -493,10 +499,10 @@ bool cSMTPMailMessage::GetAcknowledgement() tv.tv_usec = 0; // Wait up to sixty seconds fot data to show up on the socket to be read - if (mPfnSelect(mSocket + 1, &socketSet, NULL, NULL, &tv) == 1) + if (select(mSocket + 1, &socketSet, NULL, NULL, &tv) == 1) { // Get the reply message - bytes = mPfnRecv(mSocket, sTempString, 512, 0); + bytes = recv(mSocket, sTempString, 512, 0); // TODO:BAM -- this should be changed to use 'cStringUtil' for (int j = 0; j < bytes && i < bufsize; j++, i++) @@ -524,22 +530,22 @@ bool cSMTPMailMessage::GetAcknowledgement() TOSTRINGSTREAM estr; estr << TSS_GetString(cTripwire, tripwire::STR_ERR2_MAIL_MESSAGE_SERVER_RETURNED_ERROR) << sRecvString; - throw eMailSMTPServer(estr.str()); + tss_mkstr(errStr, estr); + + throw eMailSMTPServer(errStr); return false; } -# endif } void cSMTPMailMessage::SendString(const std::string& str) { cDebug d("util_SendString()"); -# if HAVE_SYS_SOCKET_H + if (str.length() < 800) d.TraceDebug("Sending \"%s\"\n", str.c_str()); else d.TraceDebug("Sending (truncated in this debug output)\"%s\"\n", std::string(str.c_str(), 800).c_str()); - mPfnSend(mSocket, str.c_str(), str.length(), 0); -# endif + send(mSocket, str.c_str(), str.length(), 0); } diff --git a/src/tripwire/stdtripwire.cpp b/src/tripwire/stdtripwire.cpp index bd81c10..3ea7f01 100644 --- a/src/tripwire/stdtripwire.cpp +++ b/src/tripwire/stdtripwire.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/stdtripwire.h b/src/tripwire/stdtripwire.h index 606ad50..9df6aae 100644 --- a/src/tripwire/stdtripwire.h +++ b/src/tripwire/stdtripwire.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/syslog_trip.cpp b/src/tripwire/syslog_trip.cpp index 95d44a3..3ab4246 100644 --- a/src/tripwire/syslog_trip.cpp +++ b/src/tripwire/syslog_trip.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -37,11 +37,11 @@ #include "syslog_trip.h" #if HAVE_SYSLOG_H -#include +# include #endif #if HAVE_SYS_SYSLOG_H -#include +# include #endif // next three includes are for error reporting @@ -49,10 +49,8 @@ #include "tw/twerrors.h" #include "tw/twstrings.h" -#if IS_AROS -#include -# define openlog(a, b, c) -# define closelog() +#if HAVE_PROTO_BSDSOCKET_H +# include #endif /////////////////////////////////////////////////////////////////////////////// @@ -69,8 +67,14 @@ void cSyslog::Log(const TCHAR* programName, cSyslog::LogType logType, const TCHA const char* ident = programName; const char* msg = message; +#if HAVE_OPENLOG openlog(ident, LOG_PID, LOG_USER); +#endif + syslog(LOG_NOTICE, "%s", msg); +#if HAVE_CLOSELOG closelog(); #endif + +#endif } diff --git a/src/tripwire/syslog_trip.h b/src/tripwire/syslog_trip.h index 899db41..3a217fb 100644 --- a/src/tripwire/syslog_trip.h +++ b/src/tripwire/syslog_trip.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/tripwire.cpp b/src/tripwire/tripwire.cpp index b74080a..88802df 100644 --- a/src/tripwire/tripwire.cpp +++ b/src/tripwire/tripwire.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/tripwire.h b/src/tripwire/tripwire.h index f13f9b2..e55e4a4 100644 --- a/src/tripwire/tripwire.h +++ b/src/tripwire/tripwire.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/tripwireerrors.cpp b/src/tripwire/tripwireerrors.cpp index a78a827..d8b28e6 100644 --- a/src/tripwire/tripwireerrors.cpp +++ b/src/tripwire/tripwireerrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/tripwireerrors.h b/src/tripwire/tripwireerrors.h index 734b027..b8edba6 100644 --- a/src/tripwire/tripwireerrors.h +++ b/src/tripwire/tripwireerrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/tripwiremain.cpp b/src/tripwire/tripwiremain.cpp index 4c251ec..9613778 100644 --- a/src/tripwire/tripwiremain.cpp +++ b/src/tripwire/tripwiremain.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -68,7 +68,7 @@ static TSTRING util_GetWholeCmdLine(int argc, const TCHAR* argv[]); #if defined(HAVE_MALLOC_H) #include #endif -static int32 gCurAlloc=0, +static int32_t gCurAlloc=0, gMaxAlloc=0; void* operator new(size_t size) { @@ -92,14 +92,25 @@ void operator delete(void* addr) void tw_terminate_handler() { fputs("### Internal Error.\n### Terminate Handler called.\n### Exiting...\n", stderr); +#if HAVE__EXIT _exit(8); +#else + exit(8); +#endif } +#if USE_UNEXPECTED void tw_unexpected_handler() { fputs("### Internal Error.\n### Unexpected Exception Handler called.\n### Exiting...\n", stderr); + +#if HAVE__EXIT _exit(8); +#else + exit(8); +#endif } +#endif /////////////////////////////////////////////////////////////////////////////// // main @@ -121,8 +132,9 @@ int __cdecl _tmain(int argc, const TCHAR* argv[], const TCHAR* envp[]) // Note: we do this before Init() in case it attempts to call these handlers // TODO: move this into the Init() routine EXCEPTION_NAMESPACE set_terminate(tw_terminate_handler); +#if USE_UNEXPECTED EXCEPTION_NAMESPACE set_unexpected(tw_unexpected_handler); - +#endif // Initialization // twInit.Init(argv[0]); diff --git a/src/tripwire/tripwiremsg.h b/src/tripwire/tripwiremsg.h index 4438b51..83d84aa 100644 --- a/src/tripwire/tripwiremsg.h +++ b/src/tripwire/tripwiremsg.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/tripwirestrings.cpp b/src/tripwire/tripwirestrings.cpp index eabe99a..44977bd 100644 --- a/src/tripwire/tripwirestrings.cpp +++ b/src/tripwire/tripwirestrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/tripwirestrings.h b/src/tripwire/tripwirestrings.h index 53ce03a..7f825d6 100644 --- a/src/tripwire/tripwirestrings.h +++ b/src/tripwire/tripwirestrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/tripwireutil.cpp b/src/tripwire/tripwireutil.cpp index a2864ee..5298b69 100644 --- a/src/tripwire/tripwireutil.cpp +++ b/src/tripwire/tripwireutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/tripwireutil.h b/src/tripwire/tripwireutil.h index 5a952a6..4e69820 100644 --- a/src/tripwire/tripwireutil.h +++ b/src/tripwire/tripwireutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/twcmdline.cpp b/src/tripwire/twcmdline.cpp index cd17bfc..d9b5165 100644 --- a/src/tripwire/twcmdline.cpp +++ b/src/tripwire/twcmdline.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -277,7 +277,11 @@ static void util_InitTempDirectory(const cConfigFile& cf) // if (*temp_directory.rbegin() != '/') { +#if !ARCHAIC_STL temp_directory.push_back('/'); +#else + temp_directory.append("/"); +#endif } #endif @@ -512,15 +516,11 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf) if (cf.Lookup(TSTRING(_T("HASH_DIRECT_IO")), str)) { -#if SUPPORTS_DIRECT_IO if (_tcsicmp(str.c_str(), _T("true")) == 0) { pModeInfo->mbDirectIO = true; cArchiveSigGen::SetUseDirectIO(true); } -#else - throw eTWDirectIONotSupported(); -#endif } if (cf.Lookup(TSTRING(_T("RESOLVE_IDS_TO_NAMES")), str)) @@ -759,7 +759,7 @@ int cTWModeDbInit::Execute(cErrorQueue* pQueue) iUserNotify::GetInstance()->Notify(1, TSS_GetString(cTripwire, tripwire::STR_GENERATING_DB).c_str()); - uint32 gdbFlags = 0; + uint32_t gdbFlags = 0; gdbFlags |= (mpData->mbResetAccessTime ? cGenerateDb::FLAG_ERASE_FOOTPRINTS_GD : 0); gdbFlags |= (mpData->mbDirectIO ? cGenerateDb::FLAG_DIRECT_IO : 0); @@ -1144,8 +1144,10 @@ int cTWModeIC::Execute(cErrorQueue* pQueue) // TODO -- move these strings to the string table TOSTRINGSTREAM str; str << TSS_GetString(cTripwire, tripwire::STR_ERR2_DIFFERENT_USERS1) << dbFile.GetHeader().GetCreator() - << TSS_GetString(cTripwire, tripwire::STR_ERR2_DIFFERENT_USERS2) << userName << std::ends; - cTWUtil::PrintErrorMsg(eICDifferentUsers(str.str(), eError::NON_FATAL)); + << TSS_GetString(cTripwire, tripwire::STR_ERR2_DIFFERENT_USERS2) << userName; + tss_mkstr(errStr, str); + + cTWUtil::PrintErrorMsg(eICDifferentUsers(errStr, eError::NON_FATAL)); } } @@ -1255,7 +1257,7 @@ int cTWModeIC::Execute(cErrorQueue* pQueue) //If any sort of exception escapes the IC, make sure it goes in the report. try { - uint32 icFlags = 0; + uint32_t icFlags = 0; icFlags |= (mpData->mfLooseDirs ? cIntegrityCheck::FLAG_LOOSE_DIR : 0); icFlags |= (mpData->mbResetAccessTime ? cIntegrityCheck::FLAG_ERASE_FOOTPRINTS_IC : 0); icFlags |= (mpData->mbDirectIO ? cIntegrityCheck::FLAG_DIRECT_IO : 0); @@ -1408,7 +1410,7 @@ int cTWModeIC::Execute(cErrorQueue* pQueue) //If any sort of exception escapes the IC, make sure it goes in the report. try { - uint32 icFlags = 0; + uint32_t icFlags = 0; icFlags |= (mpData->mfLooseDirs ? cIntegrityCheck::FLAG_LOOSE_DIR : 0); icFlags |= (mpData->mbResetAccessTime ? cIntegrityCheck::FLAG_ERASE_FOOTPRINTS_IC : 0); icFlags |= (mpData->mbDirectIO ? cIntegrityCheck::FLAG_DIRECT_IO : 0); @@ -1886,7 +1888,7 @@ int cTWModeDbUpdate::Execute(cErrorQueue* pQueue) // // actually do the integrity check... // - uint32 udFlags = 0; + uint32_t udFlags = 0; udFlags |= (mpData->mbResetAccessTime ? cUpdateDb::FLAG_ERASE_FOOTPRINTS_UD : 0); cUpdateDb update(dbIter.GetDb(), *mpData->mpReport, pQueue); @@ -2146,8 +2148,10 @@ int cTWModePolUpdate::Execute(cErrorQueue* pQueue) // TODO -- move these strings to the string table TOSTRINGSTREAM str; str << TSS_GetString(cTripwire, tripwire::STR_ERR2_DIFFERENT_USERS1) << dbFile.GetHeader().GetCreator() - << TSS_GetString(cTripwire, tripwire::STR_ERR2_DIFFERENT_USERS2) << userName << std::ends; - cTWUtil::PrintErrorMsg(eICDifferentUsers(str.str(), eError::NON_FATAL)); + << TSS_GetString(cTripwire, tripwire::STR_ERR2_DIFFERENT_USERS2) << userName; + tss_mkstr(errStr, str); + + cTWUtil::PrintErrorMsg(eICDifferentUsers(errStr, eError::NON_FATAL)); } } @@ -2213,7 +2217,7 @@ int cTWModePolUpdate::Execute(cErrorQueue* pQueue) // cPolicyUpdate pu( genreIter->GetGenre(), dbIter.GetSpecList(), genreIter->GetSpecList(), dbIter.GetDb(), pQueue); - uint32 puFlags = 0; + uint32_t puFlags = 0; puFlags |= mpData->mbSecureMode ? cPolicyUpdate::FLAG_SECURE_MODE : 0; puFlags |= (mpData->mbResetAccessTime ? cPolicyUpdate::FLAG_ERASE_FOOTPRINTS_PU : 0); puFlags |= (mpData->mbDirectIO ? cPolicyUpdate::FLAG_DIRECT_IO : 0); @@ -2245,7 +2249,7 @@ int cTWModePolUpdate::Execute(cErrorQueue* pQueue) // generate the database... // TODO -- turn pQueue into an error bucket - uint32 gdbFlags = 0; + uint32_t gdbFlags = 0; gdbFlags |= (mpData->mbResetAccessTime ? cGenerateDb::FLAG_ERASE_FOOTPRINTS_GD : 0); gdbFlags |= (mpData->mbDirectIO ? cGenerateDb::FLAG_DIRECT_IO : 0); diff --git a/src/tripwire/twcmdline.h b/src/tripwire/twcmdline.h index fb62866..50bb70f 100644 --- a/src/tripwire/twcmdline.h +++ b/src/tripwire/twcmdline.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/twcmdlineutil.cpp b/src/tripwire/twcmdlineutil.cpp index 4005041..e5fbc03 100644 --- a/src/tripwire/twcmdlineutil.cpp +++ b/src/tripwire/twcmdlineutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -104,7 +104,13 @@ void cTWCmdLineUtil::ParsePolicyFile(cGenreSpecListVector& genreSpecList, cDisplayEncoder::EncodeInline(fileName).c_str()); // set up parser and parser policy file +#if !ARCHAIC_STL std::istringstream in(strPolicyText); +#else + strstream in; + in << strPolicyText; +#endif + cPolicyParser parser(in); parser.Execute(genreSpecList, pQueue); } @@ -549,6 +555,7 @@ static bool EmailReportTo(const TSTRING& toAddress, const cTWModeCommon* modeCommon, const bool bForceFullReport) { +#if !ARCHAIC_STL TW_UNIQUE_PTR reportMail; // allocate the right kind of emailer object based on what came out of the config file. @@ -556,12 +563,13 @@ static bool EmailReportTo(const TSTRING& toAddress, { #if SUPPORTS_NETWORKING case cMailMessage::MAIL_BY_SMTP: - reportMail = TW_UNIQUE_PTR(new cSMTPMailMessage(modeCommon->mSmtpHost, modeCommon->mSmtpPort)); + reportMail = TW_UNIQUE_PTR(new cSMTPMailMessage(modeCommon->mSmtpHost, modeCommon->mSmtpPort)); break; -#endif +#endif case cMailMessage::MAIL_BY_PIPE: reportMail = TW_UNIQUE_PTR(new cPipedMailMessage(modeCommon->mMailProgram)); break; + default: return false; } @@ -629,6 +637,9 @@ static bool EmailReportTo(const TSTRING& toAddress, } return true; +#else +return false; +#endif } @@ -707,6 +718,7 @@ bool cTWCmdLineUtil::EmailReport(const cFCOReportHeader& header, bool cTWCmdLineUtil::SendEmailTestMessage(const TSTRING& mAddress, const cTWModeCommon* modeCommon) { +#if !ARCHAIC_STL TW_UNIQUE_PTR reportMail; // allocate the right kind of emailer object based on what came out of the config file. @@ -760,4 +772,7 @@ bool cTWCmdLineUtil::SendEmailTestMessage(const TSTRING& mAddress, const cTWMode } return true; +#else + return false; +#endif } diff --git a/src/tripwire/twcmdlineutil.h b/src/tripwire/twcmdlineutil.h index e306c7a..d6047d1 100644 --- a/src/tripwire/twcmdlineutil.h +++ b/src/tripwire/twcmdlineutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tripwire/updatedb.cpp b/src/tripwire/updatedb.cpp index e6af76e..cff081f 100644 --- a/src/tripwire/updatedb.cpp +++ b/src/tripwire/updatedb.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -60,7 +60,7 @@ cUpdateDb::cUpdateDb(cHierDatabase& db, cFCOReport& report, cErrorBucket* pBucke /////////////////////////////////////////////////////////////////////////////// // Execute /////////////////////////////////////////////////////////////////////////////// -bool cUpdateDb::Execute(uint32 flags) +bool cUpdateDb::Execute(uint32_t flags) { cDebug d("cUpdateDb::Execute"); bool bResult = true; diff --git a/src/tripwire/updatedb.h b/src/tripwire/updatedb.h index ccd0925..3b54423 100644 --- a/src/tripwire/updatedb.h +++ b/src/tripwire/updatedb.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -56,7 +56,7 @@ class cUpdateDb public: cUpdateDb(cHierDatabase& db, cFCOReport& report, cErrorBucket* pBucket); - bool Execute(uint32 flags = 0); + bool Execute(uint32_t flags = 0); // returns false if there were any conflicts in updating // the database // TODO -- what kind of exceptions can come up from here? diff --git a/src/tw/Makefile.in b/src/tw/Makefile.in index 8749f14..6330a65 100644 --- a/src/tw/Makefile.in +++ b/src/tw/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -134,7 +134,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) @@ -306,6 +306,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -359,8 +360,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -465,7 +466,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/src/tw/configfile.cpp b/src/tw/configfile.cpp index a144400..734dc18 100644 --- a/src/tw/configfile.cpp +++ b/src/tw/configfile.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -193,9 +193,7 @@ void cConfigFile::WriteString(TSTRING& configText) // throw( eFSServices ) out << sKey << _T("=") << sVal << _T("\n"); } - configText = out.str(); - - return; + tss_stream_to_string(out, configText); } void cConfigFile::ReadString(const TSTRING configText) // throw( eConfigFile ); @@ -660,15 +658,16 @@ TSTRING cConfigFile::MakeErrorString(const TSTRING& strMsg, bool fShowLineNum) c strErr << TSS_GetString(cTW, tw::STR_CUR_LINE) << mnLine; } - return strErr.str(); + tss_mkstr(out, strErr); + return out; } TSTRING& util_MakeTripwireDateString(TSTRING& strBuf) { struct tm* ptmLocal = cTimeUtil::TimeToDateLocal(cSystemInfo::GetExeStartTime()); TOSTRINGSTREAM ostr; - ostr.imbue(std::locale::classic()); - + tss_classic_locale(ostr); + // format is YYYYMMDD-HHMMSS ostr.fill(_T('0')); ostr << std::setw(4) << ptmLocal->tm_year + 1900; @@ -679,7 +678,6 @@ TSTRING& util_MakeTripwireDateString(TSTRING& strBuf) ostr << std::setw(2) << ptmLocal->tm_min; ostr << std::setw(2) << ptmLocal->tm_sec; - strBuf = ostr.str(); - + tss_stream_to_string(ostr, strBuf); return strBuf; } diff --git a/src/tw/configfile.h b/src/tw/configfile.h index de04373..a2b5571 100644 --- a/src/tw/configfile.h +++ b/src/tw/configfile.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/dbdatasource.cpp b/src/tw/dbdatasource.cpp index c9524a0..36f15d3 100644 --- a/src/tw/dbdatasource.cpp +++ b/src/tw/dbdatasource.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -143,8 +143,8 @@ iFCO* cDbDataSourceIter::CreateFCO() //throw (eError) try { ASSERT(mDbIter.HasData()); - int32 length; - int8* pData = mDbIter.GetData(length); + int32_t length; + int8_t* pData = mDbIter.GetData(length); // // associate a serializer with this memory and read in the property set... // diff --git a/src/tw/dbdatasource.h b/src/tw/dbdatasource.h index 3018392..85e0883 100644 --- a/src/tw/dbdatasource.h +++ b/src/tw/dbdatasource.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -132,7 +132,7 @@ private: cHierDatabase::iterator mDbIter; iSerRefCountObj::CreateFunc mFCOCreateFunc; // points to the function that creates the fcos we return - uint32 mFlags; // flags used for iteration + uint32_t mFlags; // flags used for iteration cErrorBucket* mpErrorBucket; }; diff --git a/src/tw/dbdebug.cpp b/src/tw/dbdebug.cpp index fe49cee..fdb2d2d 100644 --- a/src/tw/dbdebug.cpp +++ b/src/tw/dbdebug.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/dbdebug.h b/src/tw/dbdebug.h index d9355c3..fa7cea9 100644 --- a/src/tw/dbdebug.h +++ b/src/tw/dbdebug.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/dbexplore.cpp b/src/tw/dbexplore.cpp index e474827..0a11f28 100644 --- a/src/tw/dbexplore.cpp +++ b/src/tw/dbexplore.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/dbexplore.h b/src/tw/dbexplore.h index ae6a112..693491b 100644 --- a/src/tw/dbexplore.h +++ b/src/tw/dbexplore.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/fcodatabasefile.cpp b/src/tw/fcodatabasefile.cpp index d3de1d5..97ab13e 100644 --- a/src/tw/fcodatabasefile.cpp +++ b/src/tw/fcodatabasefile.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -81,7 +81,7 @@ cFCODatabaseFile::~cFCODatabaseFile() /////////////////////////////////////////////////////////////////////////////// // Read /////////////////////////////////////////////////////////////////////////////// -void cFCODatabaseFile::Read(iSerializer* pSerializer, int32 version) +void cFCODatabaseFile::Read(iSerializer* pSerializer, int32_t version) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("Database Read"))); @@ -91,13 +91,13 @@ void cFCODatabaseFile::Read(iSerializer* pSerializer, int32 version) // pSerializer->ReadObject(&mHeader); - int32 numGenre; + int32_t numGenre; pSerializer->ReadInt32(numGenre); for (int i = 0; i < numGenre; i++) { // read the genre number and throw if it is incorrect // - int32 iGenre; + int32_t iGenre; pSerializer->ReadInt32(iGenre); cGenre::Genre genre = (cGenre::Genre)iGenre; @@ -121,7 +121,7 @@ void cFCODatabaseFile::Read(iSerializer* pSerializer, int32 version) // // get the database data // - int32 fileSize; + int32_t fileSize; pSerializer->ReadInt32(fileSize); // // write the hier database into a temp file... @@ -170,7 +170,7 @@ void cFCODatabaseFile::Write(iSerializer* pSerializer) const //throw( eFCODbFile if (pDbArch->Length() > TSS_INT32_MAX) throw eFCODbFileTooBig(); - pSerializer->WriteInt32(static_cast(pDbArch->Length())); + pSerializer->WriteInt32(static_cast(pDbArch->Length())); cSerializerUtil::Copy(pSerializer, pDbArch, pDbArch->Length()); } } diff --git a/src/tw/fcodatabasefile.h b/src/tw/fcodatabasefile.h index ddf7e18..248297f 100644 --- a/src/tw/fcodatabasefile.h +++ b/src/tw/fcodatabasefile.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -100,7 +100,7 @@ public: /////////////////////////////// // serialization interface /////////////////////////////// - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) diff --git a/src/tw/fcodatabaseutil.cpp b/src/tw/fcodatabaseutil.cpp index 9aee185..3a564ae 100644 --- a/src/tw/fcodatabaseutil.cpp +++ b/src/tw/fcodatabaseutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -58,8 +58,8 @@ void cFCODatabaseUtil::CalculateHeader(cFCODbHeader& dbHeader, const TSTRING& configFilename, const TSTRING& dbFilename, const TSTRING& commandLineParams, - int64 createTime, - int64 lastDBUpdateTime) + int64_t createTime, + int64_t lastDBUpdateTime) { cDebug d("cFCODatabaseUtil::CalculateHeaderInfo"); diff --git a/src/tw/fcodatabaseutil.h b/src/tw/fcodatabaseutil.h index 95f8419..10b2b7f 100644 --- a/src/tw/fcodatabaseutil.h +++ b/src/tw/fcodatabaseutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -59,8 +59,8 @@ public: const TSTRING& configFilename, const TSTRING& dbFilename, const TSTRING& commandLineParams, - int64 createTime, - int64 lastDBUpdateTime); + int64_t createTime, + int64_t lastDBUpdateTime); //Calculates and gathers header data, stores results in header. private: }; diff --git a/src/tw/fcoreport.cpp b/src/tw/fcoreport.cpp index a5f5ca8..e32b177 100644 --- a/src/tw/fcoreport.cpp +++ b/src/tw/fcoreport.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -85,7 +85,7 @@ public: cFCOSetWS mRemoved; std::list mChanged; cErrorQueue mErrorQueue; - int32 mnObjectsScanned; + int32_t mnObjectsScanned; cNode(); cNode(const cNode& rhs); @@ -753,7 +753,7 @@ void cFCOReport::AddChangedFCO(const cFCOReportSpecIter& iter, /////////////////////////////////////////////////////////////////////////////// // iSerializable interface /////////////////////////////////////////////////////////////////////////////// -void cFCOReport::Read(iSerializer* pSerializer, int32 version) +void cFCOReport::Read(iSerializer* pSerializer, int32_t version) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("Report Read"))); @@ -764,14 +764,14 @@ void cFCOReport::Read(iSerializer* pSerializer, int32 version) pSerializer->ReadObject(&mpData->mErrorQueue); // read in the genres - int32 genreIter, genreCount; - int32 specIter, specCount; + int32_t genreIter, genreCount; + int32_t specIter, specCount; pSerializer->ReadInt32(genreCount); for (genreIter = 0; genreIter < genreCount; genreIter++) { cFCOReport_i::cGenreNode newGenre; - int32 genre; + int32_t genre; // TODO:BAM -- this used to be int16, so take care of backwards compatability pSerializer->ReadInt32(genre); @@ -791,12 +791,12 @@ void cFCOReport::Read(iSerializer* pSerializer, int32 version) pSerializer->ReadObject(&node.mErrorQueue); pSerializer->ReadObject(&node.mAdded); pSerializer->ReadObject(&node.mRemoved); - pSerializer->ReadInt32(node.mnObjectsScanned); + pSerializer->ReadInt32((int32_t&)node.mnObjectsScanned); node.mAdded.SetSpec(node.mpSpec); node.mRemoved.SetSpec(node.mpSpec); - int32 changeSize; + int32_t changeSize; pSerializer->ReadInt32(changeSize); for (int j = 0; j < changeSize; j++) { diff --git a/src/tw/fcoreport.h b/src/tw/fcoreport.h index f7db82f..acc1fc7 100644 --- a/src/tw/fcoreport.h +++ b/src/tw/fcoreport.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -128,7 +128,7 @@ public: void TraceContents(int dl = -1) const; // iSerializable interface - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) static const cFileHeaderID& GetFileHeaderID(); diff --git a/src/tw/fcoreportutil.cpp b/src/tw/fcoreportutil.cpp index aed4765..0bf93ca 100644 --- a/src/tw/fcoreportutil.cpp +++ b/src/tw/fcoreportutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -63,8 +63,8 @@ void cFCOReportUtil::CalculateHeaderInfo(cFCOReportHeader& reportHeader, const TSTRING& configFilename, const TSTRING& dbFilename, const TSTRING& commandLineParams, - int64 createTime, - int64 lastDBUpdateTime) + int64_t createTime, + int64_t lastDBUpdateTime) { reportHeader.SetPolicyFilename(policyFilename); reportHeader.SetConfigFilename(configFilename); diff --git a/src/tw/fcoreportutil.h b/src/tw/fcoreportutil.h index a20797b..8cf7c52 100644 --- a/src/tw/fcoreportutil.h +++ b/src/tw/fcoreportutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -58,8 +58,8 @@ public: const TSTRING& configFilename, const TSTRING& dbFilename, const TSTRING& commandLineParams, - int64 createTime, - int64 lastDBUpdateTime); + int64_t createTime, + int64_t lastDBUpdateTime); static void FinalizeReport(cFCOReport& rr); // call this when you're done adding to the report. diff --git a/src/tw/filemanipulator.cpp b/src/tw/filemanipulator.cpp index 5c501f2..4a34522 100644 --- a/src/tw/filemanipulator.cpp +++ b/src/tw/filemanipulator.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -115,7 +115,7 @@ const cFileHeaderID* cFileManipulator::GetHeaderID() return &mFileHeader.GetID(); } -uint32 cFileManipulator::GetFileVersion() +uint32_t cFileManipulator::GetFileVersion() { ASSERT(mbInit); if (!mbInit) diff --git a/src/tw/filemanipulator.h b/src/tw/filemanipulator.h index b668684..b207909 100644 --- a/src/tw/filemanipulator.h +++ b/src/tw/filemanipulator.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -100,7 +100,7 @@ public: // information for this file TSTRING GetFileName() const; const cFileHeaderID* GetHeaderID(); // returns NULL if error code is non-zero - uint32 GetFileVersion(); // throws eFileManipulator if error code is non-zero + uint32_t GetFileVersion(); // throws eFileManipulator if error code is non-zero cFileHeader::Encoding GetEncoding(); // throws eFileManipulator if error code is non-zero // things you can do to this file diff --git a/src/tw/headerinfo.cpp b/src/tw/headerinfo.cpp index 3e6b298..0add0c4 100644 --- a/src/tw/headerinfo.cpp +++ b/src/tw/headerinfo.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -76,7 +76,7 @@ void cHeaderInfo::Clear() } -void cHeaderInfo::Read(iSerializer* pSerializer, int32 version) // throw (eSerializer, eArchive) +void cHeaderInfo::Read(iSerializer* pSerializer, int32_t version) // throw (eSerializer, eArchive) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("cHeaderInfo Read"))); @@ -138,7 +138,7 @@ void cGenreHeaderInfo::Clear() i32_ObjectsScanned = 0; } -void cGenreHeaderInfo::Read(iSerializer* pSerializer, int32 version) // throw (eSerializer, eArchive) +void cGenreHeaderInfo::Read(iSerializer* pSerializer, int32_t version) // throw (eSerializer, eArchive) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("cHeaderInfo Read"))); @@ -146,7 +146,7 @@ void cGenreHeaderInfo::Read(iSerializer* pSerializer, int32 version) // throw (e // read the prop displayer ASSERT(mpPropDisplayer == 0); - int32 fMakePD; + int32_t fMakePD; pSerializer->ReadInt32(fMakePD); if (fMakePD == 1) diff --git a/src/tw/headerinfo.h b/src/tw/headerinfo.h index e9d5735..275bf3e 100644 --- a/src/tw/headerinfo.h +++ b/src/tw/headerinfo.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -67,8 +67,8 @@ public: const TSTRING& GetIPAddress() const; const TSTRING& GetCreator() const; const TSTRING& GetHostID() const; - int64 GetCreationTime() const; - int64 GetLastDBUpdateTime() const; + int64_t GetCreationTime() const; + int64_t GetLastDBUpdateTime() const; //Set: void SetPolicyFilename(const TSTRING&); void SetConfigFilename(const TSTRING&); @@ -78,27 +78,27 @@ public: void SetIPAddress(const TSTRING&); void SetCreator(const TSTRING&); void SetHostID(const TSTRING&); - void SetCreationTime(int64); - void SetLastDBUpdateTime(int64); + void SetCreationTime(int64_t); + void SetLastDBUpdateTime(int64_t); // iSerializable interface - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) private: cHeaderInfo& operator=(cHeaderInfo&); //Header Data: - TSTRING tstr_PolicyFilename; - TSTRING tstr_ConfigFilename; - TSTRING tstr_DBFilename; - TSTRING tstr_SystemName; - TSTRING tstr_CommandLineParams; - TSTRING tstr_IPAddress; - TSTRING tstr_CreatedBy; - TSTRING tstr_HostID; - int64 i64_CreationTime; - mutable int64 i64_LastDBUpdateTime; + TSTRING tstr_PolicyFilename; + TSTRING tstr_ConfigFilename; + TSTRING tstr_DBFilename; + TSTRING tstr_SystemName; + TSTRING tstr_CommandLineParams; + TSTRING tstr_IPAddress; + TSTRING tstr_CreatedBy; + TSTRING tstr_HostID; + int64_t i64_CreationTime; + mutable int64_t i64_LastDBUpdateTime; }; /////////////////////////////////////////////////////////////////////////////// @@ -120,17 +120,17 @@ public: iFCOPropDisplayer* GetPropDisplayer(); const iFCOPropDisplayer* GetPropDisplayer() const; - void SetObjectsScanned(int32); - int32 GetObjectsScanned() const; + void SetObjectsScanned(int32_t); + int32_t GetObjectsScanned() const; // iSerializable interface - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) private: cGenreHeaderInfo& operator=(cGenreHeaderInfo&); iFCOPropDisplayer* mpPropDisplayer; - int32 i32_ObjectsScanned; + int32_t i32_ObjectsScanned; }; /////////////////////////////////////////////////////////////////////////////// @@ -226,11 +226,11 @@ inline const TSTRING& cHeaderInfo::GetHostID() const { return tstr_HostID; }; -inline int64 cHeaderInfo::GetCreationTime() const +inline int64_t cHeaderInfo::GetCreationTime() const { return i64_CreationTime; }; -inline int64 cHeaderInfo::GetLastDBUpdateTime() const +inline int64_t cHeaderInfo::GetLastDBUpdateTime() const { return i64_LastDBUpdateTime; }; @@ -267,11 +267,11 @@ inline void cHeaderInfo::SetIPAddress(const TSTRING& tstr) { tstr_IPAddress = tstr; }; -inline void cHeaderInfo::SetCreationTime(int64 i) +inline void cHeaderInfo::SetCreationTime(int64_t i) { i64_CreationTime = i; }; -inline void cHeaderInfo::SetLastDBUpdateTime(int64 i) +inline void cHeaderInfo::SetLastDBUpdateTime(int64_t i) { i64_LastDBUpdateTime = i; }; @@ -288,11 +288,11 @@ inline const iFCOPropDisplayer* cGenreHeaderInfo::GetPropDisplayer() const { return mpPropDisplayer; } -inline void cGenreHeaderInfo::SetObjectsScanned(int32 i) +inline void cGenreHeaderInfo::SetObjectsScanned(int32_t i) { i32_ObjectsScanned = i; }; -inline int32 cGenreHeaderInfo::GetObjectsScanned() const +inline int32_t cGenreHeaderInfo::GetObjectsScanned() const { return i32_ObjectsScanned; }; diff --git a/src/tw/policyfile.cpp b/src/tw/policyfile.cpp index 0009dc9..dd2ac7f 100644 --- a/src/tw/policyfile.cpp +++ b/src/tw/policyfile.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/policyfile.h b/src/tw/policyfile.h index b036c01..64f9764 100644 --- a/src/tw/policyfile.h +++ b/src/tw/policyfile.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/stdtw.cpp b/src/tw/stdtw.cpp index b24d0f8..7439348 100644 --- a/src/tw/stdtw.cpp +++ b/src/tw/stdtw.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/stdtw.h b/src/tw/stdtw.h index 162b421..2c47ced 100644 --- a/src/tw/stdtw.h +++ b/src/tw/stdtw.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/systeminfo.cpp b/src/tw/systeminfo.cpp index 48c1700..5157b74 100644 --- a/src/tw/systeminfo.cpp +++ b/src/tw/systeminfo.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -36,8 +36,8 @@ #include "stdtw.h" #include "systeminfo.h" -TSTRING cSystemInfo::mExePath(_T("")); -bool cSystemInfo::mbExePathSet(false); -TSTRING cSystemInfo::mExeDir(_T("")); -bool cSystemInfo::mbExeDirSet(false); -int64 cSystemInfo::mExecuteStartTime(0); +TSTRING cSystemInfo::mExePath(_T("")); +bool cSystemInfo::mbExePathSet(false); +TSTRING cSystemInfo::mExeDir(_T("")); +bool cSystemInfo::mbExeDirSet(false); +int64_t cSystemInfo::mExecuteStartTime(0); diff --git a/src/tw/systeminfo.h b/src/tw/systeminfo.h index 3903c5e..74a074e 100644 --- a/src/tw/systeminfo.h +++ b/src/tw/systeminfo.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -50,17 +50,17 @@ public: cSystemInfo(); ~cSystemInfo(); - static TSTRING GetExePath(); - static void SetExePath(const TSTRING& path); + static TSTRING GetExePath(); + static void SetExePath(const TSTRING& path); // Get the full path to this executable - static TSTRING GetExeDir(); - static void SetExeDir(const TSTRING& dir); + static TSTRING GetExeDir(); + static void SetExeDir(const TSTRING& dir); // these methods get and set the executable's working directory ... it is asserted // that SetExeDir() has been called when GetExeDir() is called. - static int64 GetExeStartTime(); - static void SetExeStartTime(const int64& time); + static int64_t GetExeStartTime(); + static void SetExeStartTime(const int64_t& time); // Get and set the approximate time (time_t format) which the excecutable was started. // This will be used for all times having to do with this run of the executable. @@ -69,7 +69,7 @@ private: static bool mbExePathSet; static TSTRING mExeDir; static bool mbExeDirSet; - static int64 mExecuteStartTime; + static int64_t mExecuteStartTime; }; //----------------------------------------------------------------------------- @@ -111,13 +111,13 @@ inline void cSystemInfo::SetExeDir(const TSTRING& dir) mExeDir = dir; } -inline int64 cSystemInfo::GetExeStartTime() +inline int64_t cSystemInfo::GetExeStartTime() { ASSERT(mExecuteStartTime != 0); return mExecuteStartTime; } -inline void cSystemInfo::SetExeStartTime(const int64& time) +inline void cSystemInfo::SetExeStartTime(const int64_t& time) { mExecuteStartTime = time; } diff --git a/src/tw/textdbviewer.cpp b/src/tw/textdbviewer.cpp index e009125..02338a5 100644 --- a/src/tw/textdbviewer.cpp +++ b/src/tw/textdbviewer.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -293,7 +293,7 @@ static void OutputDatabaseHeader(const cFCODbHeader& dbHeader, TOSTREAM* pOut) (*pOut) << TSS_GetString(cTW, tw::STR_DB_GENERATED_BY) << util_Encode(dbHeader.GetCreator()) << endl; TSTRING tstrDummy; - int64 i64CreateTime = dbHeader.GetCreationTime(); + int64_t i64CreateTime = dbHeader.GetCreationTime(); (*pOut).width(headerColumnWidth); (*pOut) << TSS_GetString(cTW, tw::STR_DB_CREATED_ON) << cTWLocale::FormatTime(i64CreateTime, tstrDummy).c_str() << endl; @@ -301,7 +301,7 @@ static void OutputDatabaseHeader(const cFCODbHeader& dbHeader, TOSTREAM* pOut) (*pOut).width(headerColumnWidth); (*pOut) << TSS_GetString(cTW, tw::STR_DB_LAST_UPDATE); - int64 i64LastDBUTime = dbHeader.GetLastDBUpdateTime(); + int64_t i64LastDBUTime = dbHeader.GetLastDBUpdateTime(); if (i64LastDBUTime == 0) { (*pOut) << TSS_GetString(cTW, tw::STR_NEVER) << endl << endl; diff --git a/src/tw/textdbviewer.h b/src/tw/textdbviewer.h index 2e8fba6..88f8fce 100644 --- a/src/tw/textdbviewer.h +++ b/src/tw/textdbviewer.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/textreportviewer.cpp b/src/tw/textreportviewer.cpp index 2d24b5b..66a918e 100644 --- a/src/tw/textreportviewer.cpp +++ b/src/tw/textreportviewer.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -112,7 +112,12 @@ static const TCHAR* g_sz79Equals = // UTIL FUNCTION PROTOTYES //========================================================================= +#if !ARCHAIC_STL static void OpenOutputFile(fixed_basic_ofstream& out, const TSTRING& strFile); // throw( eTextReportViewer ) +#else +static void OpenOutputFile(ofstream& out, const TSTRING& strFile); // throw( eTextReportViewer ) +#endif + static void OpenInputFile(std::ifstream& out, const TSTRING& strFile); // throw( eTextReportViewer ) static bool PrintableProp(const iFCO* pfcoOld, const iFCO* pfcoNew, int j); @@ -277,7 +282,11 @@ void cTextReportViewer::PrintTextReport(const TSTRING& strFilename, ReportingLev } else { +#if !ARCHAIC_STL fixed_basic_ofstream out; +#else + ofstream out; +#endif OpenOutputFile(out, strFilename); mpOut = &out; OutputTextReport(); @@ -738,8 +747,10 @@ void cTextReportViewer::ReportError(const cErrorQueueIter& eqIter) // output error number TOSTRINGSTREAM ostr; ostr << mErrorNum << _T("."); + tss_mkstr(numStr, ostr); + (*mpOut).width(nWidth); - (*mpOut) << ostr.str(); + (*mpOut) << numStr; // output general error (*mpOut) << cErrorTable::GetInstance()->Get(eqIter.GetError().GetID()) << endl; @@ -923,7 +934,11 @@ TSTRING cTextReportViewer::GetGenre() bool cTextReportViewer::PeekIsEOF() { +#if !ARCHAIC_STL return (mpIn->peek() == char_traits::eof()); +#else + return (mpIn->peek() == EOF); +#endif } // if the next character in the stream is ('X' or 'x'), it eats the x, else it returns false @@ -1133,7 +1148,7 @@ void cTextReportViewer::OutputReportHeader() // TODO: ( start / end / elapsed ) time TSTRING tstrDummy; - int64 i64CreateTime = mpHeader->GetCreationTime(); + int64_t i64CreateTime = mpHeader->GetCreationTime(); (*mpOut).width(headerColumnWidth); (*mpOut) << TSS_GetString(cTW, tw::STR_R_CREATED_ON) << cTWLocale::FormatTime(i64CreateTime, tstrDummy).c_str() << endl; @@ -1141,7 +1156,7 @@ void cTextReportViewer::OutputReportHeader() (*mpOut).width(headerColumnWidth); (*mpOut) << TSS_GetString(cTW, tw::STR_DB_LAST_UPDATE); - int64 i64LastDBUTime = mpHeader->GetLastDBUpdateTime(); + int64_t i64LastDBUTime = mpHeader->GetLastDBUpdateTime(); if (i64LastDBUTime == 0) { (*mpOut) << TSS_GetString(cTW, tw::STR_NEVER) << endl << endl; @@ -1327,7 +1342,7 @@ void cTextReportViewer::CollateRulesSummary(const cFCOReportGenreIter& genreIter break; } - if (si->mSpecName.compare(newLine.mSpecName) == 0 && si->mSeverity == newLine.mSeverity) + if (si->mSpecName == newLine.mSpecName && si->mSeverity == newLine.mSeverity) { si->mAddedObjects += newLine.mAddedObjects; si->mRemovedObjects += newLine.mRemovedObjects; @@ -1335,16 +1350,36 @@ void cTextReportViewer::CollateRulesSummary(const cFCOReportGenreIter& genreIter // if one of the start points is a subset of the other, then we take the shorter one. // otherwise we set the startpoint to empty. + // TODO this logic is not aware of strings as paths and may do the wrong thing in some cases. + // if (newLine.mStartPoint.length() <= si->mStartPoint.length()) + { +#if !ARCHAIC_STL if (newLine.mStartPoint.compare(0, newLine.mStartPoint.length(), si->mStartPoint) == 0) - si->mStartPoint = newLine.mStartPoint; - else +#else + if (_tcsncmp(newLine.mStartPoint.c_str(), si->mStartPoint.c_str(), newLine.mStartPoint.length()) == 0) +#endif + { + si->mStartPoint = newLine.mStartPoint; + } + else + { si->mStartPoint.erase(); + } + } +#if !ARCHAIC_STL else if (si->mStartPoint.compare(0, si->mStartPoint.length(), newLine.mStartPoint) == 0) +#else + else if (_tcsncmp(si->mStartPoint.c_str(), newLine.mStartPoint.c_str(), si->mStartPoint.length()) == 0) +#endif + { ; + } else + { si->mStartPoint.erase(); - + } + break; } } @@ -1725,7 +1760,11 @@ void OpenInputFile(std::ifstream& in, const TSTRING& strFile) // throw( eTextRep } } +#if !ARCHAIC_STL void OpenOutputFile(fixed_basic_ofstream& out, const TSTRING& strFile) // throw( eTextReportViewer ) +#else +void OpenOutputFile(ofstream& out, const TSTRING& strFile) // throw( eTextReportViewer ) +#endif { std::string narrowFilename = cStringUtil::TstrToStr(strFile); @@ -1924,7 +1963,7 @@ TSTRING cTextReportViewer::SingleLineReport() sstrReport << _T(" ") << TSS_GetString(cTW, tw::STR_REMOVED_SHORT) << _T(":") << nRemovedTotal; sstrReport << _T(" ") << TSS_GetString(cTW, tw::STR_CHANGED_SHORT) << _T(":") << nChangedTotal; - return sstrReport.str(); + tss_return_stream(sstrReport, out); } @@ -1978,7 +2017,11 @@ void cTextReportViewer::OutputParseableReport() char cTextReportViewer::PeekChar() { +#if !ARCHAIC_STL return char_traits::to_char_type(mpIn->peek()); +#else + return (char)mpIn->peek(); +#endif } @@ -1993,11 +2036,13 @@ void cTextReportViewer::GetChar() // initialize mCurrentChar mCurrentCharSize = 0; - for (uint32 i = 0; i < sizeof(mCurrentChar); i++) + for (uint32_t i = 0; i < sizeof(mCurrentChar); i++) mCurrentChar[i] = 0; +#if !ARCHAIC_STL static const std::istream::char_type eof = std::char_traits::to_char_type(std::char_traits::eof()); - +#endif + std::streampos pos = mpIn->tellg(); for (size_t nch = 0; nch < (size_t)MB_CUR_MAX; nch++) @@ -2016,7 +2061,11 @@ void cTextReportViewer::GetChar() d.TraceDebug(_T("Found EOF\n")); +#if !ARCHAIC_STL mCurrentChar[0] = eof; +#else + mCurrentChar[0] = EOF; +#endif mCurrentCharSize = 1; return; @@ -2030,8 +2079,11 @@ void cTextReportViewer::GetChar() } // get character from input stream +#if !ARCHAIC_STL std::istream::char_type ch = std::char_traits::to_char_type(mpIn->get()); - +#else + char ch = mpIn->get(); +#endif // add character to mb buffer mCurrentChar[nch] = ch; mCurrentCharSize++; @@ -2050,7 +2102,13 @@ void cTextReportViewer::GetChar() } mpIn->seekg(pos); + +#if !ARCHAIC_STL std::istream::char_type c = std::char_traits::to_char_type(mpIn->get()); +#else + char c = mpIn->get(); +#endif + if ((unsigned char)c > 0x7f) { mCurrentChar[0] = c; diff --git a/src/tw/textreportviewer.h b/src/tw/textreportviewer.h index 5c94614..0a29849 100644 --- a/src/tw/textreportviewer.h +++ b/src/tw/textreportviewer.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/tw.cpp b/src/tw/tw.cpp index e03031e..9f86caf 100644 --- a/src/tw/tw.cpp +++ b/src/tw/tw.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/tw.h b/src/tw/tw.h index fbdfd27..bade276 100644 --- a/src/tw/tw.h +++ b/src/tw/tw.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/twerrors.cpp b/src/tw/twerrors.cpp index dd538c6..1391ff4 100644 --- a/src/tw/twerrors.cpp +++ b/src/tw/twerrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/twerrors.h b/src/tw/twerrors.h index da1a900..c7a3a3d 100644 --- a/src/tw/twerrors.h +++ b/src/tw/twerrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/twinit.cpp b/src/tw/twinit.cpp index d733808..23a8ffa 100644 --- a/src/tw/twinit.cpp +++ b/src/tw/twinit.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -79,9 +79,18 @@ #if IS_AROS #include + +#if HAVE_PROTO_EXEC_H #include +#endif + +#if HAVE_PROTO_BSDSOCKET_H #include +#endif + +#if HAVE_BSDSOCKET_SOCKETBASETAGS_H #include +#endif static bool aros_socketbase_init(); #endif @@ -211,7 +220,7 @@ void cTWInit::Init(const TSTRING& strArgv0) // should call this function (cTWInit::Init) on startup // we require 8-bit bytes for some functionality - ASSERT(sizeof(byte) == sizeof(uint8)); + //ASSERT(sizeof(byte) == sizeof(uint8_t)); // // set debug level diff --git a/src/tw/twinit.h b/src/tw/twinit.h index 128b799..c002c90 100644 --- a/src/tw/twinit.h +++ b/src/tw/twinit.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/twstrings.cpp b/src/tw/twstrings.cpp index f112e8e..4f24dde 100644 --- a/src/tw/twstrings.cpp +++ b/src/tw/twstrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -51,7 +51,7 @@ #define TSS_PRODUCT_NAME _T("Open Source Tripwire(R) " PACKAGE_VERSION ".") #define TSS_COPYRIGHT_NOTICE \ - _T("Open Source Tripwire 2.4 Portions copyright 2000-2018 Tripwire, Inc. Tripwire is a registered\n\ + _T("Open Source Tripwire 2.4 Portions copyright 2000-2019 Tripwire, Inc. Tripwire is a registered\n\ trademark of Tripwire, Inc. This software comes with ABSOLUTELY NO WARRANTY;\n\ for details use --version. This is free software which may be redistributed\n\ or modified only under certain conditions; see COPYING for details.\n\ @@ -60,7 +60,7 @@ All rights reserved.") #define TSS_COPYRIGHT_NOTICE_LONG \ _T("The developer of the original code and/or files is Tripwire, Inc. Portions \n\ -created by Tripwire, Inc. are copyright 2000-2018 Tripwire, Inc. Tripwire is a \n\ +created by Tripwire, Inc. are copyright 2000-2019 Tripwire, Inc. Tripwire is a \n\ registered trademark of Tripwire, Inc. All rights reserved.\n\ \n\ This program is free software. The contents of this file are subject to the \n\ diff --git a/src/tw/twstrings.h b/src/tw/twstrings.h index edeeeed..ea33306 100644 --- a/src/tw/twstrings.h +++ b/src/tw/twstrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/tw/twutil.cpp b/src/tw/twutil.cpp index 4bee800..265a300 100644 --- a/src/tw/twutil.cpp +++ b/src/tw/twutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -80,9 +80,9 @@ int _getch(void); // constants -static const char* POLICY_FILE_MAGIC_8BYTE = "#POLTXT\n"; -static const char* CONFIG_FILE_MAGIC_8BYTE = "#CFGTXT\n"; -static const uint32 CURRENT_FIXED_VERSION = 0x02020000; +static const char* POLICY_FILE_MAGIC_8BYTE = "#POLTXT\n"; +static const char* CONFIG_FILE_MAGIC_8BYTE = "#CFGTXT\n"; +static const uint32_t CURRENT_FIXED_VERSION = 0x02020000; /////////////////////////////////////////////////////////////////////////////// @@ -661,7 +661,11 @@ void cTWUtil::ReadConfigText(const TCHAR* filename, TSTRING& configText, cArchiv throw eSerializerInputStreamFmt(_T(""), filename, eSerializer::TY_FILE); // check 8 byte header - if (nstring.mString.compare(0, 8 * sizeof(byte), CONFIG_FILE_MAGIC_8BYTE) != 0) +#if !ARCHAIC_STL + if (nstring.mString.compare(0, 8 * sizeof(uint8_t), CONFIG_FILE_MAGIC_8BYTE) != 0) +#else + if (_tcsncmp(nstring.mString.c_str(), CONFIG_FILE_MAGIC_8BYTE, 8 * sizeof(uint8_t)) != 0) +#endif ThrowAndAssert(eSerializerInputStreamFmt(_T(""), filename, eSerializer::TY_FILE)); // remove 8 byte header @@ -716,7 +720,11 @@ void cTWUtil::ReadPolicyText(const TCHAR* filename, std::string& polText, const ReadObject(filename, NULL, nstring, cPolicyFile::GetFileHeaderID(), pPublicKey, bEncrypted); // check 8 byte header - if (nstring.mString.compare(0, 8 * sizeof(byte), POLICY_FILE_MAGIC_8BYTE) != 0) +#if !ARCHAIC_STL + if (nstring.mString.compare(0, 8 * sizeof(uint8_t), POLICY_FILE_MAGIC_8BYTE) != 0) +#else + if (_tcsncmp(nstring.mString.c_str(), POLICY_FILE_MAGIC_8BYTE, 8 * sizeof(uint8_t)) != 0) +#endif ThrowAndAssert(eSerializerInputStreamFmt(_T(""), filename, eSerializer::TY_FILE)); // remove 8 byte header @@ -762,11 +770,9 @@ cTWUtil::CreatePrivateKey(cKeyFile& keyFile, const WCHAR16* usePassphrase, KeyTy passphrase = usePassphrase; -#ifndef WORDS_BIGENDIAN - passphrase.swapbytes(); -#endif + TSS_SwapBytes(passphrase); - pPrivateKey = keyFile.GetPrivateKey((int8*)passphrase.data(), passphrase.length() * sizeof(WCHAR16)); + pPrivateKey = keyFile.GetPrivateKey((int8_t*)passphrase.data(), passphrase.length() * sizeof(WCHAR16)); if (pPrivateKey) return pPrivateKey; @@ -804,11 +810,9 @@ cTWUtil::CreatePrivateKey(cKeyFile& keyFile, const WCHAR16* usePassphrase, KeyTy // sleep to hinder brute force (dictionary, etc.) attacks iFSServices::GetInstance()->Sleep(nSecs); -#ifndef WORDS_BIGENDIAN - passphrase.swapbytes(); -#endif + TSS_SwapBytes(passphrase); - pPrivateKey = keyFile.GetPrivateKey((int8*)passphrase.data(), passphrase.length() * sizeof(WCHAR16)); + pPrivateKey = keyFile.GetPrivateKey((int8_t*)passphrase.data(), passphrase.length() * sizeof(WCHAR16)); if (pPrivateKey) break; @@ -840,11 +844,9 @@ void cTWUtil::CreatePrivateKey( passphrase = usePassphrase; -#ifndef WORDS_BIGENDIAN - passphrase.swapbytes(); -#endif + TSS_SwapBytes(passphrase); - if (proxy.AquireKey(keyFile, (int8*)passphrase.data(), passphrase.length() * sizeof(WCHAR16))) + if (proxy.AquireKey(keyFile, (int8_t*)passphrase.data(), passphrase.length() * sizeof(WCHAR16))) return; // if we got here, then a passphrase was provided on the command line that @@ -880,11 +882,9 @@ void cTWUtil::CreatePrivateKey( // sleep to hinder brute force (dictionary, etc.) attacks iFSServices::GetInstance()->Sleep(nSecs); -#ifndef WORDS_BIGENDIAN - passphrase.swapbytes(); -#endif + TSS_SwapBytes(passphrase); - if (proxy.AquireKey(keyFile, (int8*)passphrase.data(), passphrase.length() * sizeof(WCHAR16))) + if (proxy.AquireKey(keyFile, (int8_t*)passphrase.data(), passphrase.length() * sizeof(WCHAR16))) return; // tell the user that they entered the wrong passphrase @@ -1150,7 +1150,7 @@ TSTRING cTWUtil::GetSystemName() TSTRING cTWUtil::GetIPAddress() { - uint32 ipaddress; + uint32_t ipaddress; if (iFSServices::GetInstance()->GetIPAddress(ipaddress) == false) return TSS_GetString(cTW, tw::STR_IP_UNKNOWN); @@ -1221,7 +1221,11 @@ bool cTWUtil::ConfirmYN(const TCHAR* prompt) for (x = 0; s[x] && iswctype(s[x], wctype("space")); x++) ; #else +#if !ARCHAIC_STL for (x = 0; s[x] && std::isspace(s[x], std::locale()); x++) +#else + for (x = 0; s[x] && isspace(s[x]); x++) +#endif ; #endif diff --git a/src/tw/twutil.h b/src/tw/twutil.h index 1212311..aae6171 100644 --- a/src/tw/twutil.h +++ b/src/tw/twutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/Makefile.in b/src/twadmin/Makefile.in index b3a8e68..f9352d7 100644 --- a/src/twadmin/Makefile.in +++ b/src/twadmin/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -124,7 +124,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) @@ -295,6 +295,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -341,8 +342,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -485,7 +486,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/src/twadmin/keygeneration.cpp b/src/twadmin/keygeneration.cpp index a14118a..9d26a0a 100644 --- a/src/twadmin/keygeneration.cpp +++ b/src/twadmin/keygeneration.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -46,13 +46,13 @@ struct tGK { bool doneFlag; int retValue; - int8* passphrase; - int passphraseLen; + int8_t* passphrase; + int32_t passphraseLen; const TCHAR* keyPath; enum ReturnValue { - OK = 0, + OKAY = 0, INVALIDPARAM = 1, GENERATION_ERROR = 2, FILE_WRITE_ERROR = 3, @@ -123,16 +123,14 @@ static void GeneratePublicPrivateKeys(void* pParams, const cElGamalSig::KeySize return; } - pGK->retValue = tGK::OK; + pGK->retValue = tGK::OKAY; pGK->doneFlag = true; return; } bool GenerateKey(const TCHAR* keyPath, wc16_string passphrase, const cElGamalSig::KeySize key_size) { -#ifndef WORDS_BIGENDIAN - passphrase.swapbytes(); -#endif + TSS_SwapBytes(passphrase); #ifdef DEBUG // test reading in the keys @@ -146,13 +144,13 @@ bool GenerateKey(const TCHAR* keyPath, wc16_string passphrase, const cElGamalSig fflush(stdout); tGK gk; - gk.passphrase = (int8*)passphrase.data(); + gk.passphrase = (int8_t*)passphrase.data(); gk.passphraseLen = passphrase.length() * sizeof(WCHAR16); gk.keyPath = keyPath; GeneratePublicPrivateKeys(&gk, key_size); - if (gk.retValue != tGK::OK) + if (gk.retValue != tGK::OKAY) { switch (gk.retValue) { @@ -177,13 +175,13 @@ bool GenerateKey(const TCHAR* keyPath, wc16_string passphrase, const cElGamalSig keyfile.ReadFile(keyPath); - ASSERT(keyfile.GetPrivateKey((int8*)passphrase_copy.data(), passphrase_copy.length() * sizeof(WCHAR16)) != 0); + ASSERT(keyfile.GetPrivateKey((int8_t*)passphrase_copy.data(), passphrase_copy.length() * sizeof(WCHAR16)) != 0); keyfile.ReleasePrivateKey(); //keyfile.WriteFile(_T("tripwire2.key")); // test memory writing - int8 mem[4000]; + int8_t mem[4000]; ASSERT(4000 > keyfile.GetWriteLen()); keyfile.WriteMem(mem); @@ -191,7 +189,7 @@ bool GenerateKey(const TCHAR* keyPath, wc16_string passphrase, const cElGamalSig cKeyFile k2; k2.ReadMem(mem); - k2.GetPrivateKey((int8*)passphrase_copy2.data(), passphrase_copy2.length() * sizeof(WCHAR16)); + k2.GetPrivateKey((int8_t*)passphrase_copy2.data(), passphrase_copy2.length() * sizeof(WCHAR16)); k2.ReleasePrivateKey(); #endif diff --git a/src/twadmin/keygeneration.h b/src/twadmin/keygeneration.h index ca8f10c..36df7ac 100644 --- a/src/twadmin/keygeneration.h +++ b/src/twadmin/keygeneration.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/resource.h b/src/twadmin/resource.h index d9d6a03..3cc2d22 100644 --- a/src/twadmin/resource.h +++ b/src/twadmin/resource.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/stdtwadmin.cpp b/src/twadmin/stdtwadmin.cpp index 99bf872..44df8ee 100644 --- a/src/twadmin/stdtwadmin.cpp +++ b/src/twadmin/stdtwadmin.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/stdtwadmin.h b/src/twadmin/stdtwadmin.h index e9ace88..22ecfd5 100644 --- a/src/twadmin/stdtwadmin.h +++ b/src/twadmin/stdtwadmin.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/twadmin.cpp b/src/twadmin/twadmin.cpp index f402070..c5db9ab 100644 --- a/src/twadmin/twadmin.cpp +++ b/src/twadmin/twadmin.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/twadmin.h b/src/twadmin/twadmin.h index 13897a0..3d86f17 100644 --- a/src/twadmin/twadmin.h +++ b/src/twadmin/twadmin.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/twadmincl.cpp b/src/twadmin/twadmincl.cpp index 18f0e40..fd24388 100644 --- a/src/twadmin/twadmincl.cpp +++ b/src/twadmin/twadmincl.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -61,6 +61,12 @@ #include "twcrypto/crypto.h" #include "core/displayencoder.h" +#if HAVE_SWAB && (__cplusplus <= 1) + #ifndef __USE_XOPEN + #define _USE_XOPEN 1 + #endif +#endif + #include //Provide a swab() impl. from glibc, for platforms that don't have one @@ -81,7 +87,7 @@ void swab(const void* bfrom, void* bto, ssize_t n) #endif // forwards -static bool NotifyFileType(const cFileHeaderID& id, uint32 version, iUserNotify::VerboseLevel vl); +static bool NotifyFileType(const cFileHeaderID& id, uint32_t version, iUserNotify::VerboseLevel vl); // Calls UserNotify(V_VERBOSE, ...) to print out type of file specified in cFileHeaderID. // Returns false if cFileHeaderID not recognized. // Used in changing and removing encryption algorithms @@ -93,14 +99,14 @@ static bool NotifyEncryptionType(cFileHeader::Encoding encoding, iUserNotify::Ve // error implementations -eTWACreateCfgMissingSitekey::eTWACreateCfgMissingSitekey(const TSTRING& msg, uint32 flags) : eTWA(TSTRING(), flags) +eTWACreateCfgMissingSitekey::eTWACreateCfgMissingSitekey(const TSTRING& msg, uint32_t flags) : eTWA(TSTRING(), flags) { mMsg = TSS_GetString(cTWAdmin, twadmin::STR_ERR2_CREATE_CFG_MISSING_KEYFILE) + msg; } eTWACreateCfgSitekeyMismatch::eTWACreateCfgSitekeyMismatch(const TSTRING& specifiedKeyfile, const TSTRING& configKeyfile, - uint32 flags) + uint32_t flags) : eTWA(TSTRING(), flags) { mMsg = TSS_GetString(cTWAdmin, twadmin::STR_ERR2_CREATE_CFG_SITEKEY_MISMATCH1); @@ -640,7 +646,13 @@ int cTWAModeCreatePol::Execute(cErrorQueue* pQueue) // // make sure the policy file parses correctly before we update the old one // +#if !ARCHAIC_STL std::istringstream in(plaintext); +#else + strstream in; + in << plaintext; +#endif + cPolicyParser parser(in); try { @@ -2062,16 +2074,23 @@ static bool ChangePassphrase(const TCHAR* keyPath, wc16_string passphraseOld, wc // we must allocate a BIGENDIAN copy // and delete it before we return. // auto_ptr does not help (won't work with arrays). - size_t passphraseLenOld = passphraseOld.length() * sizeof(WCHAR16); - size_t passphraseLen = passphrase.length() * sizeof(WCHAR16); - int8* passphraseCopyOld = new int8[passphraseLenOld]; - int8* passphraseCopy = new int8[passphraseLen]; + size_t passphraseLenOld = passphraseOld.length() * sizeof(WCHAR16); + size_t passphraseLen = passphrase.length() * sizeof(WCHAR16); + int8_t* passphraseCopyOld = new int8_t[passphraseLenOld]; + int8_t* passphraseCopy = new int8_t[passphraseLen]; #ifdef WORDS_BIGENDIAN memcpy(passphraseCopyOld, passphraseOld.data(), passphraseLenOld); memcpy(passphraseCopy, passphrase.data(), passphraseLen); #else + + #if SWAB_TAKES_CHAR_PTRS + swab((char*)passphraseOld.data(), (char*)passphraseCopyOld, passphraseLenOld); + swab((char*)passphrase.data(), (char*)passphraseCopy, passphraseLen); +#else swab(passphraseOld.data(), passphraseCopyOld, passphraseLenOld); swab(passphrase.data(), passphraseCopy, passphraseLen); +#endif + #endif bool result; @@ -2878,7 +2897,7 @@ iTWAMode* cTWAdminCmdLine::GetMode(int argc, const TCHAR* const* argv) // Calls UserNotify(V_VERBOSE, ...) to print out type of file specified in cFileHeaderID. // Returns false if cFileHeaderID not recognized. // Used in changing and removing encryption algorithms -static bool NotifyFileType(const cFileHeaderID& id, uint32 version, iUserNotify::VerboseLevel vl) +static bool NotifyFileType(const cFileHeaderID& id, uint32_t version, iUserNotify::VerboseLevel vl) { if (id == cFCODatabaseFile::GetFileHeaderID()) { diff --git a/src/twadmin/twadmincl.h b/src/twadmin/twadmincl.h index 1544212..5ee33df 100644 --- a/src/twadmin/twadmincl.h +++ b/src/twadmin/twadmincl.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -52,18 +52,18 @@ TSS_EXCEPTION(eTWADecrypt, eTWA) TSS_EXCEPTION(eTWADecryptCorrupt, eTWA) TSS_BEGIN_EXCEPTION_NO_CTOR(eTWAEncryptionChange, eTWA) -eTWAEncryptionChange(const TSTRING& strMsg1, const TSTRING& strMsg2 = _T(""), uint32 flags = 0) +eTWAEncryptionChange(const TSTRING& strMsg1, const TSTRING& strMsg2 = _T(""), uint32_t flags = 0) : eTWA(strMsg1 + strMsg2, flags) { } TSS_END_EXCEPTION(); TSS_BEGIN_EXCEPTION_NO_CTOR(eTWACreateCfgMissingSitekey, eTWA) -eTWACreateCfgMissingSitekey(const TSTRING& msg, uint32 flags = 0); +eTWACreateCfgMissingSitekey(const TSTRING& msg, uint32_t flags = 0); TSS_END_EXCEPTION(); TSS_BEGIN_EXCEPTION_NO_CTOR(eTWACreateCfgSitekeyMismatch, eTWA) -eTWACreateCfgSitekeyMismatch(const TSTRING& specifiedKeyfile, const TSTRING& configKeyfile, uint32 flags = 0); +eTWACreateCfgSitekeyMismatch(const TSTRING& specifiedKeyfile, const TSTRING& configKeyfile, uint32_t flags = 0); TSS_END_EXCEPTION(); diff --git a/src/twadmin/twadminerrors.cpp b/src/twadmin/twadminerrors.cpp index c192281..84117e0 100644 --- a/src/twadmin/twadminerrors.cpp +++ b/src/twadmin/twadminerrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/twadminerrors.h b/src/twadmin/twadminerrors.h index fc2eec0..dbb1cd5 100644 --- a/src/twadmin/twadminerrors.h +++ b/src/twadmin/twadminerrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/twadminmain.cpp b/src/twadmin/twadminmain.cpp index 4dab534..3e0750c 100644 --- a/src/twadmin/twadminmain.cpp +++ b/src/twadmin/twadminmain.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -51,6 +51,7 @@ #include #include + /////////////////////////////////////////////////////////////////////////////// // terminate and unexpected handlers // TODO: move these to a common library @@ -58,14 +59,24 @@ void tw_terminate_handler() { fputs("### Internal Error.\n### Terminate Handler called.\n### Exiting...\n", stderr); +#if HAVE__EXIT _exit(1); +#else + exit(1); +#endif } +#if USE_UNEXPECTED void tw_unexpected_handler() { fputs("### Internal Error.\n### Unexpected Exception Handler called.\n### Exiting...\n", stderr); +#if HAVE__EXIT _exit(1); +#else + exit(1); +#endif } +#endif int __cdecl _tmain(int argc, const TCHAR* argv[], const TCHAR* envp[]) { @@ -84,8 +95,9 @@ int __cdecl _tmain(int argc, const TCHAR* argv[], const TCHAR* envp[]) // Note: we do this before Init() in case it attempts to call these handlers // TODO: move this into the Init() routine EXCEPTION_NAMESPACE set_terminate(tw_terminate_handler); +#if USE_UNEXPECTED EXCEPTION_NAMESPACE set_unexpected(tw_unexpected_handler); - +#endif twInit.Init(argv[0]); TSS_Dependency(cTWAdmin); diff --git a/src/twadmin/twadminstrings.cpp b/src/twadmin/twadminstrings.cpp index 8b6df8e..af18bcf 100644 --- a/src/twadmin/twadminstrings.cpp +++ b/src/twadmin/twadminstrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twadmin/twadminstrings.h b/src/twadmin/twadminstrings.h index f3cfc81..9f911fa 100644 --- a/src/twadmin/twadminstrings.h +++ b/src/twadmin/twadminstrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/Makefile.in b/src/twcrypto/Makefile.in index 9afae2e..ce5caab 100644 --- a/src/twcrypto/Makefile.in +++ b/src/twcrypto/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -129,7 +129,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) @@ -301,6 +301,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -347,8 +348,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -453,7 +454,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/src/twcrypto/bytequeue.cpp b/src/twcrypto/bytequeue.cpp index 5896e8f..8c53e53 100644 --- a/src/twcrypto/bytequeue.cpp +++ b/src/twcrypto/bytequeue.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -57,24 +57,24 @@ public: return (head == MaxSize()); } - unsigned int Put(byte inByte); - unsigned int Put(const byte* inString, unsigned int length); + unsigned int Put(uint8_t inByte); + unsigned int Put(const uint8_t* inString, unsigned int length); - unsigned int Get(byte& outByte); - unsigned int Get(byte* outString, unsigned int getMax); + unsigned int Get(uint8_t& outByte); + unsigned int Get(uint8_t* outString, unsigned int getMax); - unsigned int Peek(byte& outByte) const; + unsigned int Peek(uint8_t& outByte) const; void CopyTo(BufferedTransformation& target) const { target.Put(buf + head, tail - head); } - void CopyTo(byte* target) const + void CopyTo(uint8_t* target) const { memcpy(target, buf + head, tail - head); } - byte operator[](unsigned int i) const + uint8_t operator[](unsigned int i) const { return buf[i - head]; } @@ -98,7 +98,7 @@ cByteQueueNode::cByteQueueNode(unsigned int maxSize) : buf(maxSize) next = 0; } -unsigned int cByteQueueNode::Put(byte inByte) +unsigned int cByteQueueNode::Put(uint8_t inByte) { if (MaxSize() == tail) return 0; @@ -107,7 +107,7 @@ unsigned int cByteQueueNode::Put(byte inByte) return 1; } -unsigned int cByteQueueNode::Put(const byte* inString, unsigned int length) +unsigned int cByteQueueNode::Put(const uint8_t* inString, unsigned int length) { unsigned int l = STDMIN(length, MaxSize() - tail); memcpy(buf + tail, inString, l); @@ -115,7 +115,7 @@ unsigned int cByteQueueNode::Put(const byte* inString, unsigned int length) return l; } -unsigned int cByteQueueNode::Get(byte& outByte) +unsigned int cByteQueueNode::Get(uint8_t& outByte) { if (tail == head) return 0; @@ -124,7 +124,7 @@ unsigned int cByteQueueNode::Get(byte& outByte) return 1; } -unsigned int cByteQueueNode::Get(byte* outString, unsigned int getMax) +unsigned int cByteQueueNode::Get(uint8_t* outString, unsigned int getMax) { unsigned int l = STDMIN(getMax, tail - head); memcpy(outString, buf + head, l); @@ -132,7 +132,7 @@ unsigned int cByteQueueNode::Get(byte* outString, unsigned int getMax) return l; } -unsigned int cByteQueueNode::Peek(byte& outByte) const +unsigned int cByteQueueNode::Peek(uint8_t& outByte) const { if (tail == head) return 0; @@ -198,7 +198,7 @@ void cByteQueue::CopyTo(BufferedTransformation& target) const current->CopyTo(target); } -void cByteQueue::CopyTo(byte* target) const +void cByteQueue::CopyTo(uint8_t* target) const { for (cByteQueueNode* current = head; current; current = current->next) { @@ -220,7 +220,7 @@ unsigned long cByteQueue::CurrentSize() const */ } -void cByteQueue::Put(byte inByte) +void cByteQueue::Put(uint8_t inByte) { if (!tail->Put(inByte)) { @@ -232,7 +232,7 @@ void cByteQueue::Put(byte inByte) mCurrentSize++; } -void cByteQueue::Put(const byte* inString, unsigned int length) +void cByteQueue::Put(const uint8_t* inString, unsigned int length) { unsigned int l; @@ -248,7 +248,7 @@ void cByteQueue::Put(const byte* inString, unsigned int length) } } -unsigned int cByteQueue::Get(byte& outByte) +unsigned int cByteQueue::Get(uint8_t& outByte) { int l = head->Get(outByte); if (head->UsedUp()) @@ -265,7 +265,7 @@ unsigned int cByteQueue::Get(byte& outByte) return l; } -unsigned int cByteQueue::Get(byte* outString, unsigned int getMax) +unsigned int cByteQueue::Get(uint8_t* outString, unsigned int getMax) { unsigned int getMaxSave = getMax; cByteQueueNode* current = head; @@ -300,15 +300,18 @@ unsigned int cByteQueue::Get(byte* outString, unsigned int getMax) return (rtn); } -unsigned int cByteQueue::Peek(byte& outByte) const +unsigned int cByteQueue::Peek(uint8_t& outByte) const { return head->Peek(outByte); } cByteQueue& cByteQueue::operator=(const cByteQueue& rhs) { - Destroy(); - CopyFrom(rhs); + if (this != &rhs) + { + Destroy(); + CopyFrom(rhs); + } return *this; } @@ -326,7 +329,7 @@ bool cByteQueue::operator==(const cByteQueue& rhs) const return true; } -byte cByteQueue::operator[](unsigned long i) const +uint8_t cByteQueue::operator[](unsigned long i) const { for (cByteQueueNode* current = head; current; current = current->next) { diff --git a/src/twcrypto/bytequeue.h b/src/twcrypto/bytequeue.h index f5aada0..0e9520a 100644 --- a/src/twcrypto/bytequeue.h +++ b/src/twcrypto/bytequeue.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -56,21 +56,21 @@ public: return CurrentSize(); } - void Put(byte inByte); - void Put(const byte* inString, unsigned int length); + void Put(uint8_t inByte); + void Put(const uint8_t* inString, unsigned int length); // both functions returns the number of bytes actually retrived - unsigned int Get(byte& outByte); - unsigned int Get(byte* outString, unsigned int getMax); + unsigned int Get(uint8_t& outByte); + unsigned int Get(uint8_t* outString, unsigned int getMax); - unsigned int Peek(byte& outByte) const; + unsigned int Peek(uint8_t& outByte) const; void CopyTo(BufferedTransformation& target) const; - void CopyTo(byte* target) const; + void CopyTo(uint8_t* target) const; cByteQueue& operator=(const cByteQueue& rhs); bool operator==(const cByteQueue& rhs) const; - byte operator[](unsigned long i) const; + uint8_t operator[](unsigned long i) const; private: void CopyFrom(const cByteQueue& copy); diff --git a/src/twcrypto/crypto.cpp b/src/twcrypto/crypto.cpp index 6c1c80a..dd1322b 100644 --- a/src/twcrypto/crypto.cpp +++ b/src/twcrypto/crypto.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -57,8 +57,8 @@ #include #include -const uint32 EL_GAMAL_SIG_PUBLIC_MAGIC_NUM = 0x7ae2c945; -const uint32 EL_GAMAL_SIG_PRIVATE_MAGIC_NUM = 0x0d0ffa12; +const uint32_t EL_GAMAL_SIG_PUBLIC_MAGIC_NUM = 0x7ae2c945; +const uint32_t EL_GAMAL_SIG_PRIVATE_MAGIC_NUM = 0x0d0ffa12; /////////////////////////////////////////////////////////////////////////////// // macros for reading and writing integers @@ -68,7 +68,7 @@ const uint32 EL_GAMAL_SIG_PRIVATE_MAGIC_NUM = 0x0d0ffa12; ASSERT(len >= 0 && len < 9000); \ i32 = tw_htonl(len); \ memcpy(pOut, &i32, sizeof(i32)); \ - pOut += sizeof(int32); \ + pOut += sizeof(int32_t); \ I.Encode(pOut, len, Integer::UNSIGNED); \ pOut += len; @@ -76,7 +76,7 @@ const uint32 EL_GAMAL_SIG_PRIVATE_MAGIC_NUM = 0x0d0ffa12; memcpy(&i32, pIn, sizeof(i32)); \ len = tw_ntohl(i32); \ ASSERT(len >= 0 && len < 9000); \ - pIn += sizeof(int32); \ + pIn += sizeof(int32_t); \ I.Decode(pIn, len, Integer::UNSIGNED); \ pIn += len; @@ -135,7 +135,7 @@ void cIDEA::SetKey(iCipher::EncryptionDir dir, const cHashedKey128& key) ASSERT(mpData); delete mpData->mpIDEA; - mpData->mpIDEA = new IDEA((byte*)key.GetKey(), dir == iCipher::ENCRYPT ? ENCRYPTION : DECRYPTION); + mpData->mpIDEA = new IDEA((uint8_t*)key.GetKey(), dir == iCipher::ENCRYPT ? ENCRYPTION : DECRYPTION); } // return the size of data block this crypter works on @@ -159,7 +159,7 @@ void cIDEA::ProcessBlock(const void* indata, void* outdata) ThrowAndAssert(eInternal(_T("Key not set in symmetric encryption."))); } - mpData->mpIDEA->ProcessBlock((byte*)indata, (byte*)outdata); + mpData->mpIDEA->ProcessBlock((uint8_t*)indata, (uint8_t*)outdata); } #endif // _IDEA_ENCRYPTION @@ -203,14 +203,14 @@ void cTripleDES::SetKey(iCipher::EncryptionDir dir, const cHashedKey192& key) delete mpData->mpEncryptor; delete mpData->mpDecryptor; mpData->mpDecryptor = 0; - mpData->mpEncryptor = new TripleDES_Encryption((byte*)key.GetKey()); + mpData->mpEncryptor = new TripleDES_Encryption((uint8_t*)key.GetKey()); } else { delete mpData->mpEncryptor; delete mpData->mpDecryptor; mpData->mpEncryptor = 0; - mpData->mpDecryptor = new TripleDES_Decryption((byte*)key.GetKey()); + mpData->mpDecryptor = new TripleDES_Decryption((uint8_t*)key.GetKey()); } } @@ -240,9 +240,9 @@ void cTripleDES::ProcessBlock(const void* indata, void* outdata) } if (mpData->mpEncryptor) - mpData->mpEncryptor->ProcessBlock((byte*)indata, (byte*)outdata); + mpData->mpEncryptor->ProcessBlock((uint8_t*)indata, (uint8_t*)outdata); else - mpData->mpDecryptor->ProcessBlock((byte*)indata, (byte*)outdata); + mpData->mpDecryptor->ProcessBlock((uint8_t*)indata, (uint8_t*)outdata); } /////////////////////////////////////////////////////////////////////////////// @@ -255,7 +255,7 @@ void cTripleDES::ProcessBlock(const void* indata, void* outdata) class cRSAPrivateKey_i { public: - int16 mKeyLength; + int16_t mKeyLength; RSAPrivateKey* mpKey; }; @@ -270,15 +270,15 @@ cRSAPrivateKey::cRSAPrivateKey(void* pDataStream) { mpData = new cRSAPrivateKey_i; - int32 len; - int32 i32; - int16 i16; + int32_t len; + int32_t i32; + int16_t i16; - byte* pIn = (byte*)pDataStream; + uint8_t* pIn = (uint8_t*)pDataStream; memcpy(&i16, pIn, sizeof(i16)); mpData->mKeyLength = tw_ntohs(i16); - pIn += sizeof(int16); + pIn += sizeof(int16_t); Integer n, e, d, p, q, dp, dq, u; @@ -316,16 +316,16 @@ int cRSAPrivateKey::GetWriteLen() const ASSERT(mpData->mpKey->GetTrapdoorFunction().GetParameterDQ().IsPositive()); ASSERT(mpData->mpKey->GetTrapdoorFunction().GetParameterU().IsPositive()); - int len = sizeof(int16) + mpData->mpKey->GetTrapdoorFunction().GetModulus().MinEncodedSize(Integer::UNSIGNED) + - sizeof(int32) + mpData->mpKey->GetTrapdoorFunction().GetExponent().MinEncodedSize(Integer::UNSIGNED) + - sizeof(int32) + mpData->mpKey->GetTrapdoorFunction().GetPrime1().MinEncodedSize(Integer::UNSIGNED) + - sizeof(int32) + mpData->mpKey->GetTrapdoorFunction().GetPrime2().MinEncodedSize(Integer::UNSIGNED) + - sizeof(int32) + + int len = sizeof(int16_t) + mpData->mpKey->GetTrapdoorFunction().GetModulus().MinEncodedSize(Integer::UNSIGNED) + + sizeof(int32_t) + mpData->mpKey->GetTrapdoorFunction().GetExponent().MinEncodedSize(Integer::UNSIGNED) + + sizeof(int32_t) + mpData->mpKey->GetTrapdoorFunction().GetPrime1().MinEncodedSize(Integer::UNSIGNED) + + sizeof(int32_t) + mpData->mpKey->GetTrapdoorFunction().GetPrime2().MinEncodedSize(Integer::UNSIGNED) + + sizeof(int32_t) + mpData->mpKey->GetTrapdoorFunction().GetDecryptionExponent().MinEncodedSize(Integer::UNSIGNED) + - sizeof(int32) + mpData->mpKey->GetTrapdoorFunction().GetParameterDP().MinEncodedSize(Integer::UNSIGNED) + - sizeof(int32) + mpData->mpKey->GetTrapdoorFunction().GetParameterDQ().MinEncodedSize(Integer::UNSIGNED) + - sizeof(int32) + mpData->mpKey->GetTrapdoorFunction().GetParameterU().MinEncodedSize(Integer::UNSIGNED) + - sizeof(int32); + sizeof(int32_t) + mpData->mpKey->GetTrapdoorFunction().GetParameterDP().MinEncodedSize(Integer::UNSIGNED) + + sizeof(int32_t) + mpData->mpKey->GetTrapdoorFunction().GetParameterDQ().MinEncodedSize(Integer::UNSIGNED) + + sizeof(int32_t) + mpData->mpKey->GetTrapdoorFunction().GetParameterU().MinEncodedSize(Integer::UNSIGNED) + + sizeof(int32_t); return len; } @@ -343,13 +343,13 @@ void cRSAPrivateKey::Write(void* pDataStream) const ASSERT(mpData->mpKey->GetTrapdoorFunction().GetParameterDQ().IsPositive()); ASSERT(mpData->mpKey->GetTrapdoorFunction().GetParameterU().IsPositive()); - byte* pOut = (byte*)pDataStream; - int16 i16; - int32 i32; + uint8_t* pOut = (uint8_t*)pDataStream; + int16_t i16; + int32_t i32; i16 = tw_htons(mpData->mKeyLength); memcpy(pOut, &i16, sizeof(i16)); - pOut += sizeof(int16); + pOut += sizeof(int16_t); Integer n, e, d, p, q, dp, dq, u; @@ -362,13 +362,13 @@ void cRSAPrivateKey::Write(void* pDataStream) const dq = mpData->mpKey->GetTrapdoorFunction().GetParameterDQ(); u = mpData->mpKey->GetTrapdoorFunction().GetParameterU(); - int32 len; + int32_t len; # define WRITE_INTEGER(I) \ len = I.MinEncodedSize(Integer::UNSIGNED); \ i32 = tw_htonl(len); \ memcpy(pOut, &i32, sizeof(i32)); \ - pOut += sizeof(int32); \ + pOut += sizeof(int32_t); \ I.Encode(pOut, len, Integer::UNSIGNED); \ pOut += len; @@ -387,7 +387,7 @@ void cRSAPrivateKey::Write(void* pDataStream) const class cRSAPublicKey_i { public: - int16 mKeyLength; + int16_t mKeyLength; RSAPublicKey* mpKey; }; @@ -403,15 +403,15 @@ cRSAPublicKey::cRSAPublicKey(void* pDataStream) mpData = new cRSAPublicKey_i; Integer n, e; - int32 len; - int16 i16; - int32 i32; + int32_t len; + int16_t i16; + int32_t i32; - byte* pIn = (byte*)pDataStream; + uint8_t* pIn = (uint8_t*)pDataStream; memcpy(&i16, pIn, sizeof(i16)); mpData->mKeyLength = tw_ntohs(i16); - pIn += sizeof(int16); + pIn += sizeof(int16_t); READ_INTEGER(n); READ_INTEGER(e); @@ -449,9 +449,9 @@ int cRSAPublicKey::GetWriteLen() const ASSERT(mpData->mpKey->GetTrapdoorFunction().GetModulus().IsPositive()); ASSERT(mpData->mpKey->GetTrapdoorFunction().GetExponent().IsPositive()); - int len = sizeof(int16) + mpData->mpKey->GetTrapdoorFunction().GetModulus().MinEncodedSize(Integer::UNSIGNED) + - sizeof(int32) + mpData->mpKey->GetTrapdoorFunction().GetExponent().MinEncodedSize(Integer::UNSIGNED) + - sizeof(int32); + int len = sizeof(int16_t) + mpData->mpKey->GetTrapdoorFunction().GetModulus().MinEncodedSize(Integer::UNSIGNED) + + sizeof(int32_t) + mpData->mpKey->GetTrapdoorFunction().GetExponent().MinEncodedSize(Integer::UNSIGNED) + + sizeof(int32_t); return len; } @@ -463,20 +463,20 @@ void cRSAPublicKey::Write(void* pDataStream) const ASSERT(mpData->mpKey->GetTrapdoorFunction().GetModulus().IsPositive()); ASSERT(mpData->mpKey->GetTrapdoorFunction().GetExponent().IsPositive()); - int16 i16; - int32 i32; - byte* pOut = (byte*)pDataStream; + int16_t i16; + int32_t i32; + uint8_t* pOut = (uint8_t*)pDataStream; i16 = tw_htons(mpData->mKeyLength); memcpy(pOut, &i16, sizeof(i16)); - pOut += sizeof(int16); + pOut += sizeof(int16_t); Integer n, e; n = mpData->mpKey->GetTrapdoorFunction().GetModulus(); e = mpData->mpKey->GetTrapdoorFunction().GetExponent(); - int32 len; + int32_t len; WRITE_INTEGER(n); WRITE_INTEGER(e); @@ -488,14 +488,16 @@ void cRSAPublicKey::TraceContents() cDebug d("cRSAPublicKey::TraceContents"); { - std::ostringstream os; + TOSTRINGSTREAM os; os << mpData->mpKey->GetTrapdoorFunction().GetModulus(); - d.TraceDebug("Modulus = %s\n", os.str().c_str()); + tss_mkstr(msg, os); + d.TraceDebug("Modulus = %s\n", msg.c_str()); } { - std::ostringstream os; + TOSTRINGSTREAM os; os << mpData->mpKey->GetTrapdoorFunction().GetExponent(); - d.TraceDebug("Exponent = %s\n", os.str().c_str()); + tss_mkstr(msg, os); + d.TraceDebug("Exponent = %s\n", msg.c_str()); } } # endif @@ -551,10 +553,10 @@ void cRSA::Init(KeySize keysize) (keysize == KEY512) ? 512 : (keysize == KEY1024) ? 1024 : (keysize == KEY2048) ? 2048 : 256; // Create a random seed and a key - byte seed[MD5::DATASIZE]; - byte deskey[TripleDES_Encryption::KEYLENGTH]; - RandomizeBytes((int8*)seed, MD5::DATASIZE); - RandomizeBytes((int8*)deskey, TripleDES_Encryption::KEYLENGTH); + uint8_t seed[MD5::DATASIZE]; + uint8_t deskey[TripleDES_Encryption::KEYLENGTH]; + RandomizeBytes((int8_t*)seed, MD5::DATASIZE); + RandomizeBytes((int8_t*)deskey, TripleDES_Encryption::KEYLENGTH); mpData->mpRNG = new X917RNG(new TripleDES_Encryption(deskey), seed); } @@ -648,14 +650,14 @@ void cRSA::ProcessBlock(const void* indata, void* outdata) ASSERT(mpData->mpPublicKey->mpData->mpKey->MaxPlainTextLength() == GetBlockSizePlain()); ASSERT(mpData->mpPublicKey->mpData->mpKey->CipherTextLength() == GetBlockSizeCipher()); mpData->mpPublicKey->mpData->mpKey->Encrypt( - *mpData->mpRNG, (const byte*)indata, GetBlockSizePlain(), (byte*)outdata); + *mpData->mpRNG, (const uint8_t*)indata, GetBlockSizePlain(), (uint8_t*)outdata); break; } case cRSA_i::DECRYPT: { ASSERT(mpData->mpPrivateKey); ASSERT(mpData->mpPrivateKey->mpData->mpKey->CipherTextLength() == GetBlockSizeCipher()); - l = mpData->mpPrivateKey->mpData->mpKey->Decrypt((const byte*)indata, (byte*)outdata); + l = mpData->mpPrivateKey->mpData->mpKey->Decrypt((const uint8_t*)indata, (uint8_t*)outdata); if (l != GetBlockSizePlain()) throw eArchiveCrypto(); break; @@ -666,14 +668,14 @@ void cRSA::ProcessBlock(const void* indata, void* outdata) ASSERT(mpData->mpPrivateKey->mpData->mpKey->MaxMessageLength() == GetBlockSizePlain()); ASSERT(mpData->mpPrivateKey->mpData->mpKey->SignatureLength() == GetBlockSizeCipher()); mpData->mpPrivateKey->mpData->mpKey->Sign( - *mpData->mpRNG, (const byte*)indata, GetBlockSizePlain(), (byte*)outdata); + *mpData->mpRNG, (const uint8_t*)indata, GetBlockSizePlain(), (uint8_t*)outdata); break; } case cRSA_i::VERIFY: { ASSERT(mpData->mpPublicKey); ASSERT(mpData->mpPublicKey->mpData->mpKey->SignatureLength() == GetBlockSizeCipher()); - l = mpData->mpPublicKey->mpData->mpKey->Recover((const byte*)indata, (byte*)outdata); + l = mpData->mpPublicKey->mpData->mpKey->Recover((const uint8_t*)indata, (uint8_t*)outdata); if (l != GetBlockSizePlain()) throw eArchiveCrypto(); break; @@ -720,7 +722,7 @@ void cRSA::GenerateKeys(cRSAPrivateKey*& retPrivate, cRSAPublicKey*& retPublic) class cElGamalSigPrivateKey_i { public: - int16 mKeyLength; + int16_t mKeyLength; ElGamalSigPrivateKey* mpKey; }; @@ -735,20 +737,20 @@ cElGamalSigPrivateKey::cElGamalSigPrivateKey(void* pDataStream) { mpData = new cElGamalSigPrivateKey_i; - int32 len; - int32 i32; - int16 i16; - uint32 magicNum; + int32_t len; + int32_t i32; + int16_t i16; + uint32_t magicNum; - byte* pIn = (byte*)pDataStream; + uint8_t* pIn = (uint8_t*)pDataStream; memcpy(&i16, pIn, sizeof(i16)); mpData->mKeyLength = tw_ntohs(i16); - pIn += sizeof(int16); + pIn += sizeof(int16_t); memcpy(&i32, pIn, sizeof(i32)); magicNum = tw_ntohl(i32); - pIn += sizeof(int32); + pIn += sizeof(int32_t); if (magicNum != EL_GAMAL_SIG_PRIVATE_MAGIC_NUM) ThrowAndAssert(eArchiveOpen()); @@ -783,11 +785,11 @@ int cElGamalSigPrivateKey::GetWriteLen() const ASSERT(mpData->mpKey->GetParameterY().IsPositive()); ASSERT(mpData->mpKey->GetParameterX().IsPositive()); - int len = sizeof(int16) + sizeof(int32) + mpData->mpKey->GetPrime().MinEncodedSize(Integer::UNSIGNED) + - sizeof(int32) + mpData->mpKey->GetParameterQ().MinEncodedSize(Integer::UNSIGNED) + sizeof(int32) + - mpData->mpKey->GetParameterG().MinEncodedSize(Integer::UNSIGNED) + sizeof(int32) + - mpData->mpKey->GetParameterY().MinEncodedSize(Integer::UNSIGNED) + sizeof(int32) + - mpData->mpKey->GetParameterX().MinEncodedSize(Integer::UNSIGNED) + sizeof(int32); + int len = sizeof(int16_t) + sizeof(int32_t) + mpData->mpKey->GetPrime().MinEncodedSize(Integer::UNSIGNED) + + sizeof(int32_t) + mpData->mpKey->GetParameterQ().MinEncodedSize(Integer::UNSIGNED) + sizeof(int32_t) + + mpData->mpKey->GetParameterG().MinEncodedSize(Integer::UNSIGNED) + sizeof(int32_t) + + mpData->mpKey->GetParameterY().MinEncodedSize(Integer::UNSIGNED) + sizeof(int32_t) + + mpData->mpKey->GetParameterX().MinEncodedSize(Integer::UNSIGNED) + sizeof(int32_t); return len; } @@ -802,17 +804,17 @@ void cElGamalSigPrivateKey::Write(void* pDataStream) const ASSERT(mpData->mpKey->GetParameterY().IsPositive()); ASSERT(mpData->mpKey->GetParameterX().IsPositive()); - byte* pOut = (byte*)pDataStream; - int16 i16; - int32 i32; + uint8_t* pOut = (uint8_t*)pDataStream; + int16_t i16; + int32_t i32; i16 = tw_htons(mpData->mKeyLength); memcpy(pOut, &i16, sizeof(i16)); - pOut += sizeof(int16); + pOut += sizeof(int16_t); i32 = tw_htonl(EL_GAMAL_SIG_PRIVATE_MAGIC_NUM); memcpy(pOut, &i32, sizeof(i32)); - pOut += sizeof(int32); + pOut += sizeof(int32_t); Integer p, q, g, y, x; @@ -822,7 +824,7 @@ void cElGamalSigPrivateKey::Write(void* pDataStream) const y = mpData->mpKey->GetParameterY(); x = mpData->mpKey->GetParameterX(); - int32 len; + int32_t len; WRITE_INTEGER(p); WRITE_INTEGER(q); @@ -836,7 +838,7 @@ void cElGamalSigPrivateKey::Write(void* pDataStream) const class cElGamalSigPublicKey_i { public: - int16 mKeyLength; + int16_t mKeyLength; ElGamalSigPublicKey* mpKey; }; @@ -851,21 +853,21 @@ cElGamalSigPublicKey::cElGamalSigPublicKey(void* pDataStream) { mpData = new cElGamalSigPublicKey_i; - Integer p, q, g, y; - int32 len; - int16 i16; - int32 i32; - uint32 magicNum; + Integer p, q, g, y; + int32_t len; + int16_t i16; + int32_t i32; + uint32_t magicNum; - byte* pIn = (byte*)pDataStream; + uint8_t* pIn = (uint8_t*)pDataStream; memcpy(&i16, pIn, sizeof(i16)); mpData->mKeyLength = tw_ntohs(i16); - pIn += sizeof(int16); + pIn += sizeof(int16_t); memcpy(&i32, pIn, sizeof(i32)); magicNum = tw_ntohl(i32); - pIn += sizeof(int32); + pIn += sizeof(int32_t); if (magicNum != EL_GAMAL_SIG_PUBLIC_MAGIC_NUM) ThrowAndAssert(eArchiveOpen()); @@ -910,10 +912,10 @@ int cElGamalSigPublicKey::GetWriteLen() const ASSERT(mpData->mpKey->GetParameterG().IsPositive()); ASSERT(mpData->mpKey->GetParameterY().IsPositive()); - int len = sizeof(int16) + sizeof(int32) + mpData->mpKey->GetPrime().MinEncodedSize(Integer::UNSIGNED) + - sizeof(int32) + mpData->mpKey->GetParameterQ().MinEncodedSize(Integer::UNSIGNED) + sizeof(int32) + - mpData->mpKey->GetParameterG().MinEncodedSize(Integer::UNSIGNED) + sizeof(int32) + - mpData->mpKey->GetParameterY().MinEncodedSize(Integer::UNSIGNED) + sizeof(int32); + int len = sizeof(int16_t) + sizeof(int32_t) + mpData->mpKey->GetPrime().MinEncodedSize(Integer::UNSIGNED) + + sizeof(int32_t) + mpData->mpKey->GetParameterQ().MinEncodedSize(Integer::UNSIGNED) + sizeof(int32_t) + + mpData->mpKey->GetParameterG().MinEncodedSize(Integer::UNSIGNED) + sizeof(int32_t) + + mpData->mpKey->GetParameterY().MinEncodedSize(Integer::UNSIGNED) + sizeof(int32_t); return len; } @@ -927,17 +929,17 @@ void cElGamalSigPublicKey::Write(void* pDataStream) const ASSERT(mpData->mpKey->GetParameterG().IsPositive()); ASSERT(mpData->mpKey->GetParameterY().IsPositive()); - byte* pOut = (byte*)pDataStream; - int16 i16; - int32 i32; + uint8_t* pOut = (uint8_t*)pDataStream; + int16_t i16; + int32_t i32; i16 = tw_htons(mpData->mKeyLength); memcpy(pOut, &i16, sizeof(i16)); - pOut += sizeof(int16); + pOut += sizeof(int16_t); i32 = tw_htonl(EL_GAMAL_SIG_PUBLIC_MAGIC_NUM); memcpy(pOut, &i32, sizeof(i32)); - pOut += sizeof(int32); + pOut += sizeof(int32_t); Integer p, q, g, y; @@ -946,7 +948,7 @@ void cElGamalSigPublicKey::Write(void* pDataStream) const g = mpData->mpKey->GetParameterG(); y = mpData->mpKey->GetParameterY(); - int32 len; + int32_t len; WRITE_INTEGER(p); WRITE_INTEGER(q); @@ -968,24 +970,28 @@ void cElGamalSigPublicKey::TraceContents() cDebug d("cElGamalSigPublicKey::TraceContents"); { - std::ostringstream os; + TOSTRINGSTREAM os; os << mpData->mpKey->GetPrime(); - d.TraceDebug("Prime = %s\n", os.str().c_str()); + tss_mkstr(msg, os); + d.TraceDebug("Prime = %s\n", msg.c_str()); } { - std::ostringstream os; + TOSTRINGSTREAM os; os << mpData->mpKey->GetParameterQ(); - d.TraceDebug("Q = %s\n", os.str().c_str()); + tss_mkstr(msg, os); + d.TraceDebug("Q = %s\n", msg.c_str()); } { - std::ostringstream os; + TOSTRINGSTREAM os; os << mpData->mpKey->GetParameterG(); - d.TraceDebug("G = %s\n", os.str().c_str()); + tss_mkstr(msg, os); + d.TraceDebug("G = %s\n", msg.c_str()); } { - std::ostringstream os; + TOSTRINGSTREAM os; os << mpData->mpKey->GetParameterY(); - d.TraceDebug("Y = %s\n", os.str().c_str()); + tss_mkstr(msg, os); + d.TraceDebug("Y = %s\n", msg.c_str()); } } #endif @@ -1038,10 +1044,10 @@ void cElGamalSig::Init(KeySize keysize) (keysize == KEY512) ? 512 : (keysize == KEY1024) ? 1024 : (keysize == KEY2048) ? 2048 : 256; // Create a random seed and a key - byte seed[SHA::DATASIZE]; - byte deskey[TripleDES_Encryption::KEYLENGTH]; - RandomizeBytes((int8*)seed, SHA::DATASIZE); - RandomizeBytes((int8*)deskey, TripleDES_Encryption::KEYLENGTH); + uint8_t seed[SHA::DATASIZE]; + uint8_t deskey[TripleDES_Encryption::KEYLENGTH]; + RandomizeBytes((int8_t*)seed, SHA::DATASIZE); + RandomizeBytes((int8_t*)deskey, TripleDES_Encryption::KEYLENGTH); mpData->mpRNG = new X917RNG(new TripleDES_Encryption(deskey), seed); } @@ -1095,7 +1101,7 @@ void cElGamalSig::ProcessBlock(const void* indata, void* outdata) ASSERT(mpData != 0); ASSERT(mpData->mpPrivateKey != 0 || mpData->mpPublicKey != 0); - int8 shaSig[SHA::DIGESTSIZE]; + int8_t shaSig[SHA::DIGESTSIZE]; if (mpData->mpPrivateKey == 0 && mpData->mpPublicKey == 0) ThrowAndAssert(eInternal(_T("Signature Key length mismatch."))); @@ -1109,19 +1115,19 @@ void cElGamalSig::ProcessBlock(const void* indata, void* outdata) memmove(outdata, indata, PLAIN_BLOCK_SIZE); - mpData->mSHA.CalculateDigest((byte*)shaSig, (byte*)outdata, PLAIN_BLOCK_SIZE); + mpData->mSHA.CalculateDigest((uint8_t*)shaSig, (uint8_t*)outdata, PLAIN_BLOCK_SIZE); - RandomizeBytes((int8*)outdata + PLAIN_BLOCK_SIZE, GetBlockSizeCipher() - PLAIN_BLOCK_SIZE); + RandomizeBytes((int8_t*)outdata + PLAIN_BLOCK_SIZE, GetBlockSizeCipher() - PLAIN_BLOCK_SIZE); mpData->mpPrivateKey->mpData->mpKey->Sign( - *mpData->mpRNG, (const byte*)shaSig, SHA::DIGESTSIZE, (byte*)outdata + PLAIN_BLOCK_SIZE); + *mpData->mpRNG, (const uint8_t*)shaSig, SHA::DIGESTSIZE, (uint8_t*)outdata + PLAIN_BLOCK_SIZE); /* - Integer m((const byte*)indata, PLAIN_BLOCK_SIZE); + Integer m((const uint8_t*)indata, PLAIN_BLOCK_SIZE); std::cout << "Signing:\n"; std::cout << "M = " << m << std::endl; - const byte* signature = (const byte *)outdata + PLAIN_BLOCK_SIZE; + const uint8_t* signature = (const uint8_t *)outdata + PLAIN_BLOCK_SIZE; int qLen = mpData->mpPrivateKey->mpData->mpKey->q.ByteCount(); Integer rs(signature, qLen); Integer ss(signature+qLen, qLen); @@ -1136,12 +1142,12 @@ void cElGamalSig::ProcessBlock(const void* indata, void* outdata) ASSERT(mpData->mpPublicKey != 0); ASSERT((int)mpData->mpPublicKey->mpData->mpKey->SignatureLength() + PLAIN_BLOCK_SIZE <= GetBlockSizeCipher()); - mpData->mSHA.CalculateDigest((byte*)shaSig, (byte*)indata, PLAIN_BLOCK_SIZE); + mpData->mSHA.CalculateDigest((uint8_t*)shaSig, (uint8_t*)indata, PLAIN_BLOCK_SIZE); /* - const byte* signature = (const byte *)indata + PLAIN_BLOCK_SIZE; + const uint8_t* signature = (const uint8_t *)indata + PLAIN_BLOCK_SIZE; int qLen = mpData->mpPublicKey->mpData->mpKey->q.ByteCount(); - Integer m((const byte*)indata, PLAIN_BLOCK_SIZE); + Integer m((const uint8_t*)indata, PLAIN_BLOCK_SIZE); Integer r(signature, qLen); Integer s(signature+qLen, qLen); std::cout << "Verifying:\n"; @@ -1151,7 +1157,7 @@ void cElGamalSig::ProcessBlock(const void* indata, void* outdata) */ if (mpData->mpPublicKey->mpData->mpKey->Verify( - (const byte*)shaSig, SHA::DIGESTSIZE, (const byte*)indata + PLAIN_BLOCK_SIZE) == false) + (const uint8_t*)shaSig, SHA::DIGESTSIZE, (const uint8_t*)indata + PLAIN_BLOCK_SIZE) == false) throw eArchiveCrypto(); memmove(outdata, indata, PLAIN_BLOCK_SIZE); break; @@ -1171,11 +1177,11 @@ void cElGamalSig::GenerateKeys(cElGamalSigPrivateKey*& retPrivate, cElGamalSigPu retPrivate = new cElGamalSigPrivateKey(); retPrivate->mpData->mpKey = pNewPrivateKey; - retPrivate->mpData->mKeyLength = (int16)mpData->mKeyBits; + retPrivate->mpData->mKeyLength = (int16_t)mpData->mKeyBits; retPublic = new cElGamalSigPublicKey(); retPublic->mpData->mpKey = pNewPublicKey; - retPublic->mpData->mKeyLength = (int16)mpData->mKeyBits; + retPublic->mpData->mKeyLength = (int16_t)mpData->mKeyBits; #ifdef DEBUG int l; @@ -1194,16 +1200,16 @@ cHashedKey128::cHashedKey128(const TSTRING& data) SHA sha; ASSERT(SHA::DIGESTSIZE >= KEYLEN); - sha.CalculateDigest((byte*)mKey, (byte*)data.data(), data.length() * sizeof(TCHAR)); + sha.CalculateDigest((uint8_t*)mKey, (uint8_t*)data.data(), data.length() * sizeof(TCHAR)); } -cHashedKey128::cHashedKey128(void* pData, int dataLen) +cHashedKey128::cHashedKey128(void* pData, int32_t dataLen) { SHA sha; ASSERT(SHA::DIGESTSIZE >= KEYLEN); - ASSERT(SHA::DIGESTSIZE <= BUFSIZE); - sha.CalculateDigest((byte*)mKey, (byte*)pData, dataLen); + ASSERT(SHA::DIGESTSIZE <= BUFFER_SIZE); + sha.CalculateDigest((uint8_t*)mKey, (uint8_t*)pData, dataLen); } cHashedKey128::~cHashedKey128() @@ -1221,21 +1227,21 @@ cHashedKey192::cHashedKey192(const TSTRING& data) ASSERT(SHA::DIGESTSIZE == 20); ASSERT(40 >= KEYLEN); - byte localKey[40]; - sha.CalculateDigest(localKey, (byte*)data.data(), data.length() * sizeof(TCHAR)); + uint8_t localKey[40]; + sha.CalculateDigest(localKey, (uint8_t*)data.data(), data.length() * sizeof(TCHAR)); sha.CalculateDigest(localKey + 20, localKey, 20); memcpy(mKey, localKey, KEYLEN); } -cHashedKey192::cHashedKey192(void* pData, int dataLen) +cHashedKey192::cHashedKey192(void* pData, int32_t dataLen) { SHA sha; ASSERT(SHA::DIGESTSIZE == 20); ASSERT(40 >= KEYLEN); - byte localKey[40]; - sha.CalculateDigest(localKey, (byte*)pData, dataLen); + uint8_t localKey[40]; + sha.CalculateDigest(localKey, (uint8_t*)pData, dataLen); sha.CalculateDigest(localKey + 20, localKey, 20); memcpy(mKey, localKey, KEYLEN); } @@ -1248,7 +1254,7 @@ cHashedKey192::~cHashedKey192() ///////////////////////////////////////////////////////// #if USE_DEV_URANDOM -static bool randomize_by_device(const char* device_name, int8* destbuf, int len) +static bool randomize_by_device(const char* device_name, int8_t* destbuf, int len) { static int rng_device = -1; @@ -1271,7 +1277,7 @@ static bool gRandomizeBytesSeeded = false; /////////////////////////////////////////////////////////////////////////////// // void RandomizeBytes(byte* destbuf, int len) -- Fill a buffer with random bytes -void RandomizeBytes(int8* destbuf, int len) +void RandomizeBytes(int8_t* destbuf, int len) { #if USE_DEV_URANDOM if (randomize_by_device("/dev/urandom", destbuf, len)) @@ -1301,8 +1307,8 @@ void RandomizeBytes(int8* destbuf, int len) gRandomizeBytesSeeded = true; } - int i; - for (i = 0; i < len; ++i) - destbuf[i] = (byte)((rand() * 256 / RAND_MAX) ^ 0xdc); // 0xdc came from random.org + for (int i = 0; i < len; ++i) { + destbuf[i] = (int8_t)((rand() * 256 / RAND_MAX) ^ 0xdc); // 0xdc came from random.org + } #endif } diff --git a/src/twcrypto/crypto.h b/src/twcrypto/crypto.h index 4e8d639..cd1b4f5 100644 --- a/src/twcrypto/crypto.h +++ b/src/twcrypto/crypto.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -350,25 +350,25 @@ class cHashedKey128 { public: explicit cHashedKey128(const TSTRING& data); - cHashedKey128(void* pData, int dataLen); + cHashedKey128(void* pData, int32_t dataLen); ~cHashedKey128(); - const int8* GetKey() const; + const int8_t* GetKey() const; static int GetWriteLen(); - void Write(void* pDataStream); + void Write(void* pDataStream); protected: enum { KEYLEN = 16, - BUFSIZE = 20 + BUFFER_SIZE = 20 }; - int8 mKey[BUFSIZE]; + int8_t mKey[BUFFER_SIZE]; }; -inline const int8* cHashedKey128::GetKey() const +inline const int8_t* cHashedKey128::GetKey() const { return mKey; } @@ -390,13 +390,13 @@ class cHashedKey192 { public: explicit cHashedKey192(const TSTRING& data); - cHashedKey192(void* pData, int dataLen); + cHashedKey192(void* pData, int32_t dataLen); ~cHashedKey192(); - const int8* GetKey() const; + const int8_t* GetKey() const; static int GetWriteLen(); - void Write(void* pDataStream); + void Write(void* pDataStream); protected: enum @@ -404,10 +404,10 @@ protected: KEYLEN = 24 }; - int8 mKey[KEYLEN]; + int8_t mKey[KEYLEN]; }; -inline const int8* cHashedKey192::GetKey() const +inline const int8_t* cHashedKey192::GetKey() const { return mKey; } @@ -425,6 +425,6 @@ inline void cHashedKey192::Write(void* pDataStream) /////////////////////////////////////////////////////////////////////////////// // void RandomizeBytes(byte* destbuf, int len) -- Fill a buffer with random bytes -void RandomizeBytes(int8* destbuf, int len); +void RandomizeBytes(int8_t* destbuf, int len); #endif // __CRYPTO_H diff --git a/src/twcrypto/cryptoarchive.cpp b/src/twcrypto/cryptoarchive.cpp index 18a18f9..04d1df1 100644 --- a/src/twcrypto/cryptoarchive.cpp +++ b/src/twcrypto/cryptoarchive.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -66,10 +66,10 @@ public: cCryptoSink(cArchive* pDestArchive, iCipher* pCipher); ~cCryptoSink(); - virtual void Put(const byte* inString, unsigned int length); + virtual void Put(const uint8_t* inString, unsigned int length); virtual void InputFinished(); - virtual void Put(byte inByte) + virtual void Put(uint8_t inByte) { Put(&inByte, 1); } @@ -79,7 +79,7 @@ private: iCipher* mpCipher; // buffer to cache bytes in - int8* mpBuffer; + int8_t* mpBuffer; int mBufferLen; int mBufferUsed; }; @@ -98,7 +98,7 @@ private: iCipher* mpCipher; // buffer to cache bytes in - int8* mpBuffer; + int8_t* mpBuffer; int mBufferLen; int mBufferUsed; }; @@ -171,7 +171,7 @@ int cCryptoArchive::Write(const void* pSrc, int count) throw eArchiveInvalidOp(); } - mpDeflator->Put((byte*)pSrc, count); + mpDeflator->Put((uint8_t*)pSrc, count); return count; } @@ -210,13 +210,13 @@ int cCryptoArchive::Read(void* pDest, int count) if ((int)mpInflatedBytes->CurrentSize() < count) // RAD: Cast to int { len = mpInflatedBytes->CurrentSize(); - mpInflatedBytes->Get((byte*)pDest, len); + mpInflatedBytes->Get((uint8_t*)pDest, len); return len; } } } - len = mpInflatedBytes->Get((byte*)pDest, count); + len = mpInflatedBytes->Get((uint8_t*)pDest, count); ASSERT(len == count); return len; @@ -278,13 +278,13 @@ cCryptoSink::~cCryptoSink() delete [] mpBuffer; } -void cCryptoSink::Put(const byte* inString, unsigned int length) +void cCryptoSink::Put(const uint8_t* inString, unsigned int length) { if (mpBuffer == 0) { // this is the first write mBufferLen = mpCipher->GetBlockSizePlain(); - mpBuffer = new int8[mBufferLen]; + mpBuffer = new int8_t[mBufferLen]; mBufferUsed = 0; } @@ -299,14 +299,14 @@ void cCryptoSink::Put(const byte* inString, unsigned int length) if (bytesToCopy > nLength - i) bytesToCopy = nLength - i; - memcpy(mpBuffer + mBufferUsed, (int8*)inString + i, bytesToCopy); + memcpy(mpBuffer + mBufferUsed, (int8_t*)inString + i, bytesToCopy); mBufferUsed += bytesToCopy; if (mBufferUsed >= mBufferLen) { ASSERT(mBufferUsed == mBufferLen); // should be if our math is right - int8* pTmp = new int8[mpCipher->GetBlockSizeCipher()]; + int8_t* pTmp = new int8_t[mpCipher->GetBlockSizeCipher()]; mpCipher->ProcessBlock(mpBuffer, pTmp); mpDestArchive->WriteBlob(pTmp, mpCipher->GetBlockSizeCipher()); @@ -328,7 +328,7 @@ void cCryptoSink::InputFinished() ASSERT(mBufferLen - mBufferUsed > 0); // should be, or the buffer should have already been written RandomizeBytes(mpBuffer + mBufferUsed, mBufferLen - mBufferUsed); - int8* pTmp = new int8[mpCipher->GetBlockSizeCipher()]; + int8_t* pTmp = new int8_t[mpCipher->GetBlockSizeCipher()]; mpCipher->ProcessBlock(mpBuffer, pTmp); mpDestArchive->WriteBlob(pTmp, mpCipher->GetBlockSizeCipher()); @@ -366,7 +366,7 @@ unsigned int cCryptoSource::Pump(unsigned int size) { // first time this has been called mBufferLen = mpCipher->GetBlockSizePlain(); - mpBuffer = new int8[mBufferLen]; + mpBuffer = new int8_t[mBufferLen]; mBufferUsed = mBufferLen; } @@ -381,7 +381,7 @@ unsigned int cCryptoSource::Pump(unsigned int size) { ASSERT(mBufferUsed == mBufferLen); // should be if our math is right - int8* pTmp = new int8[mpCipher->GetBlockSizeCipher()]; + int8_t* pTmp = new int8_t[mpCipher->GetBlockSizeCipher()]; int l = mpSrcArchive->ReadBlob(pTmp, mpCipher->GetBlockSizeCipher()); if (l != mpCipher->GetBlockSizeCipher()) @@ -400,7 +400,7 @@ unsigned int cCryptoSource::Pump(unsigned int size) if (bytesToCopy > nSize - i) bytesToCopy = nSize - i; - outQueue->Put((byte*)(mpBuffer + mBufferUsed), bytesToCopy); + outQueue->Put((uint8_t*)(mpBuffer + mBufferUsed), bytesToCopy); mBufferUsed += bytesToCopy; i += bytesToCopy; @@ -503,8 +503,8 @@ void cRSAArchive::SetWrite(cArchive* pDestArchive, const cRSAPublicKey* pPublicK // Create a random number and encode using public key cRSA rsa(*mpPublicKey); - int8* key = new int8[rsa.GetBlockSizePlain()]; - int8* encryptedKey = new int8[rsa.GetBlockSizeCipher()]; + int8_t* key = new int8_t[rsa.GetBlockSizePlain()]; + int8_t* encryptedKey = new int8_t[rsa.GetBlockSizeCipher()]; RandomizeBytes(key, rsa.GetBlockSizePlain()); rsa.SetEncrypting(mpPublicKey); @@ -535,8 +535,8 @@ void cRSAArchive::SetWrite(cArchive* pDestArchive, const cRSAPrivateKey* pPrivat // Create a random number and encode using public key cRSA rsa(*mpPrivateKey); - int8* key = new int8[rsa.GetBlockSizePlain()]; - int8* encryptedKey = new int8[rsa.GetBlockSizeCipher()]; + int8_t* key = new int8_t[rsa.GetBlockSizePlain()]; + int8_t* encryptedKey = new int8_t[rsa.GetBlockSizeCipher()]; RandomizeBytes(key, rsa.GetBlockSizePlain()); rsa.SetSigning(mpPrivateKey); @@ -578,8 +578,8 @@ void cRSAArchive::SetRead(cArchive* pSrcArchive, const cRSAPublicKey* pPublicKey mpPrivateKey = 0; cRSA rsa(*mpPublicKey); - int8* key = new int8[rsa.GetBlockSizePlain()]; - int8* encryptedKey = new int8[rsa.GetBlockSizeCipher()]; + int8_t* key = new int8_t[rsa.GetBlockSizePlain()]; + int8_t* encryptedKey = new int8_t[rsa.GetBlockSizeCipher()]; mpArchive->ReadBlob(encryptedKey, rsa.GetBlockSizeCipher()); rsa.SetVerifying(mpPublicKey); @@ -608,8 +608,8 @@ void cRSAArchive::SetRead(cArchive* pSrcArchive, const cRSAPrivateKey* pPrivateK mpPublicKey = 0; cRSA rsa(*mpPrivateKey); - int8* key = new int8[rsa.GetBlockSizePlain()]; - int8* encryptedKey = new int8[rsa.GetBlockSizeCipher()]; + int8_t* key = new int8_t[rsa.GetBlockSizePlain()]; + int8_t* encryptedKey = new int8_t[rsa.GetBlockSizeCipher()]; mpArchive->ReadBlob(encryptedKey, rsa.GetBlockSizeCipher()); rsa.SetDecrypting(mpPrivateKey); diff --git a/src/twcrypto/cryptoarchive.h b/src/twcrypto/cryptoarchive.h index 3260cfd..b697394 100644 --- a/src/twcrypto/cryptoarchive.h +++ b/src/twcrypto/cryptoarchive.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/keyfile.cpp b/src/twcrypto/keyfile.cpp index 923a6ef..2ea5f84 100644 --- a/src/twcrypto/keyfile.cpp +++ b/src/twcrypto/keyfile.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -44,9 +44,9 @@ // A magic number to identify key files // I just picked this at random (I took the current time (14:34) squared it, // converted it to hex and xor'ed with 0xffffffff, just in case you are wondering) - dmb -const uint32 KEY_MAGIC_NUMBER = 0xffe09f5b; -static const uint32 CURRENT_FIXED_VERSION = 0x02020000; -static const uint32 TW_21_VERSION = 0x02010000; +const uint32_t KEY_MAGIC_NUMBER = 0xffe09f5b; +static const uint32_t CURRENT_FIXED_VERSION = 0x02020000; +static const uint32_t TW_21_VERSION = 0x02010000; /////////////////////////////////////////////////////////////////////////////// // class cKeyFile @@ -121,7 +121,7 @@ void cKeyFile::ReadFile(const TCHAR* filename) // throw eKeyFile() { ReleaseMem(); - int16 len; + int16_t len; try { @@ -135,7 +135,7 @@ void cKeyFile::ReadFile(const TCHAR* filename) // throw eKeyFile() cSerializerImpl fhSer(inFile, cSerializerImpl::S_READ, filename); fileHeader.Read(&fhSer); } - catch (eError&) + catch (const eError&) { throw eKeyFileInvalidFmt(); } @@ -165,7 +165,7 @@ void cKeyFile::ReadFile(const TCHAR* filename) // throw eKeyFile() throw eKeyFileInvalidFmt(); } - int8* publicMem = new int8[len]; + int8_t* publicMem = new int8_t[len]; if (inFile.ReadBlob(publicMem, len) != len) { ASSERT(false); @@ -177,7 +177,7 @@ void cKeyFile::ReadFile(const TCHAR* filename) // throw eKeyFile() delete [] publicMem; // read private key; - inFile.ReadInt16(len); + inFile.ReadInt16((int16_t&)len); if (len <= 0 || len > 9000) { ASSERT(false); @@ -187,7 +187,7 @@ void cKeyFile::ReadFile(const TCHAR* filename) // throw eKeyFile() } mPrivateKeyMemLen = len; - mpPrivateKeyMem = new int8[len]; + mpPrivateKeyMem = new int8_t[len]; if (inFile.ReadBlob(mpPrivateKeyMem, mPrivateKeyMemLen) < mPrivateKeyMemLen) { ASSERT(false); @@ -199,7 +199,7 @@ void cKeyFile::ReadFile(const TCHAR* filename) // throw eKeyFile() throw eKeyFileInvalidFmt(); } } - catch (eArchive&) + catch (const eArchive&) { delete mpPublicKey; delete [] mpPrivateKeyMem; @@ -208,7 +208,7 @@ void cKeyFile::ReadFile(const TCHAR* filename) // throw eKeyFile() mPrivateKeyMemLen = 0; throw eKeyFileArchive(filename); } - catch (eKeyFile&) + catch (const eKeyFile&) { throw; } @@ -240,8 +240,8 @@ void cKeyFile::WriteFile(const TCHAR* filename) const // throw eKeyFile() } // save public key - int16 len = mpPublicKey->GetWriteLen(); - int8* publicMem = new int8[len]; + int16_t len = mpPublicKey->GetWriteLen(); + int8_t* publicMem = new int8_t[len]; mpPublicKey->Write(publicMem); outFile.WriteInt16(len); @@ -254,7 +254,7 @@ void cKeyFile::WriteFile(const TCHAR* filename) const // throw eKeyFile() outFile.WriteInt16(len); outFile.WriteBlob(mpPrivateKeyMem, mPrivateKeyMemLen); } - catch (eArchive&) + catch (const eArchive&) { throw eKeyFileArchive(filename); } @@ -263,33 +263,33 @@ void cKeyFile::WriteFile(const TCHAR* filename) const // throw eKeyFile() // Functions to read and write the key to memory. GetWriteLen() will throw an // exception if keys are not currently loaded. -void cKeyFile::ReadMem(const int8* pMem) // throw eKeyFile() +void cKeyFile::ReadMem(const int8_t* pMem) // throw eKeyFile() { - int16 i16; - int32 i32; + int16_t i16; + int32_t i32; ReleaseMem(); memcpy(&i32, pMem, sizeof(i32)); if ((unsigned int)tw_ntohl(i32) != KEY_MAGIC_NUMBER) throw eKeyFileInvalidFmt(); - pMem += sizeof(int32); + pMem += sizeof(int32_t); memcpy(&i32, pMem, sizeof(i32)); if (tw_ntohl(i32) != 1) // version check throw eKeyFileInvalidFmt(); - pMem += sizeof(int32); + pMem += sizeof(int32_t); memcpy(&i16, pMem, sizeof(i16)); - int16 len = tw_ntohs(i16); + int16_t len = tw_ntohs(i16); if (len <= 0 || len > 9000) { ASSERT(false); throw eKeyFileInvalidFmt(); } - mpPublicKey = new cElGamalSigPublicKey((void*)(pMem + sizeof(int16))); - pMem += sizeof(int16) + len; + mpPublicKey = new cElGamalSigPublicKey((void*)(pMem + sizeof(int16_t))); + pMem += sizeof(int16_t) + len; memcpy(&i16, pMem, sizeof(i16)); mPrivateKeyMemLen = tw_ntohs(i16); @@ -301,14 +301,14 @@ void cKeyFile::ReadMem(const int8* pMem) // throw eKeyFile() throw eKeyFileInvalidFmt(); } - mpPrivateKeyMem = new int8[mPrivateKeyMemLen]; - memcpy(mpPrivateKeyMem, pMem + sizeof(int16), mPrivateKeyMemLen); + mpPrivateKeyMem = new int8_t[mPrivateKeyMemLen]; + memcpy(mpPrivateKeyMem, pMem + sizeof(int16_t), mPrivateKeyMemLen); } -void cKeyFile::WriteMem(int8* pMem) const // throw eKeyFile() +void cKeyFile::WriteMem(int8_t* pMem) const // throw eKeyFile() { - int16 i16; - int32 i32; + int16_t i16; + int32_t i32; if (!KeysLoaded()) { @@ -319,17 +319,17 @@ void cKeyFile::WriteMem(int8* pMem) const // throw eKeyFile() // magic number and version i32 = tw_htonl(KEY_MAGIC_NUMBER); memcpy(pMem, &i32, sizeof(i32)); - pMem += sizeof(int32); + pMem += sizeof(int32_t); i32 = tw_htonl(1); memcpy(pMem, &i32, sizeof(i32)); - pMem += sizeof(int32); + pMem += sizeof(int32_t); // save public key - int16 len = mpPublicKey->GetWriteLen(); + int16_t len = mpPublicKey->GetWriteLen(); i16 = tw_htons(len); memcpy(pMem, &i16, sizeof(i16)); - pMem += sizeof(int16); + pMem += sizeof(int16_t); mpPublicKey->Write(pMem); pMem += len; @@ -338,7 +338,7 @@ void cKeyFile::WriteMem(int8* pMem) const // throw eKeyFile() len = mPrivateKeyMemLen; i16 = tw_htons(len); memcpy(pMem, &i16, sizeof(i16)); - pMem += sizeof(int16); + pMem += sizeof(int16_t); memcpy(pMem, mpPrivateKeyMem, mPrivateKeyMemLen); } @@ -351,22 +351,22 @@ int cKeyFile::GetWriteLen() // throw eKeyFile() throw eKeyFileUninitialized(_T("cKeyFile not initialized")); } - return sizeof(int32) + // the magic number - sizeof(int32) + // version - sizeof(int16) + // sizeof public key + return sizeof(int32_t) + // the magic number + sizeof(int32_t) + // version + sizeof(int16_t) + // sizeof public key mpPublicKey->GetWriteLen() + // the public key - sizeof(int16) + // sizeof private key + sizeof(int16_t) + // sizeof private key mPrivateKeyMemLen; // the private key } -void cKeyFile::ProtectKeys(int8* passphrase, int passphraseLen) // throw eKeyFile() +void cKeyFile::ProtectKeys(int8_t* passphrase, int passphraseLen) // throw eKeyFile() { - int i; - int16 i16; + int i; + int16_t i16; // generate the hash value of the private key - int len = mpPrivateKey->GetWriteLen(); - int8* privateKeyBits = new int8[len]; + int len = mpPrivateKey->GetWriteLen(); + int8_t* privateKeyBits = new int8_t[len]; mpPrivateKey->Write(privateKeyBits); cHashedKey128 privateHash(privateKeyBits, len); RandomizeBytes(privateKeyBits, len); @@ -380,17 +380,17 @@ void cKeyFile::ProtectKeys(int8* passphrase, int passphraseLen) // throw eKeyFil ASSERT(des.GetBlockSizeCipher() == des.GetBlockSizePlain()); // calculate size of the memory image of the private key - mPrivateKeyMemLen = cHashedKey128::GetWriteLen() + sizeof(int16) + mpPrivateKey->GetWriteLen(); + mPrivateKeyMemLen = cHashedKey128::GetWriteLen() + sizeof(int16_t) + mpPrivateKey->GetWriteLen(); mPrivateKeyMemLen = (mPrivateKeyMemLen / des.GetBlockSizePlain() + 1) * des.GetBlockSizePlain(); - int sluff = mPrivateKeyMemLen - cHashedKey128::GetWriteLen() - sizeof(int16) - mpPrivateKey->GetWriteLen(); + int sluff = mPrivateKeyMemLen - cHashedKey128::GetWriteLen() - sizeof(int16_t) - mpPrivateKey->GetWriteLen(); // write the hash of the private key, the size of the private key, and the private key, // all as plaintext. - mpPrivateKeyMem = new int8[mPrivateKeyMemLen]; + mpPrivateKeyMem = new int8_t[mPrivateKeyMemLen]; privateHash.Write(mpPrivateKeyMem); i16 = tw_htons(mpPrivateKey->GetWriteLen()); memcpy(mpPrivateKeyMem + cHashedKey128::GetWriteLen(), &i16, sizeof(i16)); - mpPrivateKey->Write(mpPrivateKeyMem + cHashedKey128::GetWriteLen() + sizeof(int16)); + mpPrivateKey->Write(mpPrivateKeyMem + cHashedKey128::GetWriteLen() + sizeof(int16_t)); RandomizeBytes(mpPrivateKeyMem + mPrivateKeyMemLen - sluff, sluff); @@ -419,7 +419,7 @@ void cKeyFile::ProtectKeys(int8* passphrase, int passphraseLen) // throw eKeyFil // Generate new keys -void cKeyFile::GenerateKeys(int keySize, int8* passphrase, int passphraseLen) // throw eKeyFile() +void cKeyFile::GenerateKeys(int keySize, int8_t* passphrase, int passphraseLen) // throw eKeyFile() { ReleaseMem(); @@ -431,10 +431,10 @@ void cKeyFile::GenerateKeys(int keySize, int8* passphrase, int passphraseLen) // ProtectKeys(passphrase, passphraseLen); } -void cKeyFile::ChangePassphrase(int8* passphraseOld, - int passphraseOldLen, - int8* passphrase, - int passphraseLen) // throw eKeyFile() +void cKeyFile::ChangePassphrase(int8_t* passphraseOld, + int passphraseOldLen, + int8_t* passphrase, + int passphraseLen) // throw eKeyFile() { if (GetPrivateKey(passphraseOld, passphraseOldLen) == 0) { @@ -448,9 +448,9 @@ void cKeyFile::ChangePassphrase(int8* passphraseOld, // ReleasePrivateKey() to destory the plaintext version of the key as soon as you // are done using the key. -const cElGamalSigPrivateKey* cKeyFile::GetPrivateKey(int8* passphrase, int passphraseLen) +const cElGamalSigPrivateKey* cKeyFile::GetPrivateKey(int8_t* passphrase, int passphraseLen) { - int16 i16; + int16_t i16; if (!KeysLoaded()) { @@ -470,13 +470,12 @@ const cElGamalSigPrivateKey* cKeyFile::GetPrivateKey(int8* passphrase, int passp ASSERT(des.GetBlockSizeCipher() == des.GetBlockSizePlain()); // get a copy of the ciphertext and decrypt it - int8* plainPrivateKeyMem = new int8[mPrivateKeyMemLen]; + int8_t* plainPrivateKeyMem = new int8_t[mPrivateKeyMemLen]; memcpy(plainPrivateKeyMem, mpPrivateKeyMem, mPrivateKeyMemLen); ASSERT(mPrivateKeyMemLen % des.GetBlockSizePlain() == 0); - int i; - for (i = 0; i < mPrivateKeyMemLen; i += des.GetBlockSizePlain()) + for (int i = 0; i < mPrivateKeyMemLen; i += des.GetBlockSizePlain()) { des.ProcessBlock(plainPrivateKeyMem + i, plainPrivateKeyMem + i); } @@ -485,7 +484,7 @@ const cElGamalSigPrivateKey* cKeyFile::GetPrivateKey(int8* passphrase, int passp memcpy(&i16, plainPrivateKeyMem + cHashedKey128::GetWriteLen(), sizeof(i16)); int len = tw_ntohs(i16); - if (len + cHashedKey128::GetWriteLen() + sizeof(int16) > (unsigned int)mPrivateKeyMemLen) + if (len + cHashedKey128::GetWriteLen() + sizeof(int16_t) > (unsigned int)mPrivateKeyMemLen) { RandomizeBytes(plainPrivateKeyMem, mPrivateKeyMemLen); delete [] plainPrivateKeyMem; @@ -493,7 +492,7 @@ const cElGamalSigPrivateKey* cKeyFile::GetPrivateKey(int8* passphrase, int passp return 0; } - cHashedKey128 privateHash(plainPrivateKeyMem + cHashedKey128::GetWriteLen() + sizeof(int16), len); + cHashedKey128 privateHash(plainPrivateKeyMem + cHashedKey128::GetWriteLen() + sizeof(int16_t), len); // compare to the stored value if (memcmp(plainPrivateKeyMem, privateHash.GetKey(), cHashedKey128::GetWriteLen()) != 0) @@ -505,7 +504,7 @@ const cElGamalSigPrivateKey* cKeyFile::GetPrivateKey(int8* passphrase, int passp return 0; } - mpPrivateKey = new cElGamalSigPrivateKey(plainPrivateKeyMem + cHashedKey128::GetWriteLen() + sizeof(int16)); + mpPrivateKey = new cElGamalSigPrivateKey(plainPrivateKeyMem + cHashedKey128::GetWriteLen() + sizeof(int16_t)); RandomizeBytes(plainPrivateKeyMem, mPrivateKeyMemLen); delete [] plainPrivateKeyMem; @@ -552,7 +551,7 @@ const cElGamalSigPublicKey* cKeyFile::GetPublicKey() const // throw eKeyFile() /////////////////////////////////////////////////////////////////////////////// // class cPrivateKeyProxy -bool cPrivateKeyProxy::AquireKey(cKeyFile& keyFile, int8* passphrase, int passphraseLen) +bool cPrivateKeyProxy::AquireKey(cKeyFile& keyFile, int8_t* passphrase, int passphraseLen) { if (mpKey != 0) { diff --git a/src/twcrypto/keyfile.h b/src/twcrypto/keyfile.h index aa887ad..7d91019 100644 --- a/src/twcrypto/keyfile.h +++ b/src/twcrypto/keyfile.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -72,26 +72,26 @@ public: void WriteFile(const TCHAR* filename) const; // throw eKeyFile() // Read and write keys to a keyfile - void ReadMem(const int8* pMem); // throw eKeyFile() - void WriteMem(int8* pMem) const; // throw eKeyFile() + void ReadMem(const int8_t* pMem); // throw eKeyFile() + void WriteMem(int8_t* pMem) const; // throw eKeyFile() int GetWriteLen(); // throw eKeyFile() // Functions to read and write the key to memory. GetWriteLen() will throw an // exception if keys are not currently loaded. bool KeysLoaded() const; - void GenerateKeys(int keySize, int8* passphrase, int passphraseLen); // throw eKeyFile() + void GenerateKeys(int keySize, int8_t* passphrase, int passphraseLen); // throw eKeyFile() // Generate new keys // Note: Bytes in passphrase will be cleared after keys are generated for safety - void ChangePassphrase(int8* passphraseOld, - int passphraseOldLen, - int8* passphrase, - int passphraseLen); // throw eKeyFile() + void ChangePassphrase(int8_t* passphraseOld, + int passphraseOldLen, + int8_t* passphrase, + int passphraseLen); // throw eKeyFile() // Change passphrase // Note: Bytes in passphrases will be cleared after change for safety - const cElGamalSigPrivateKey* GetPrivateKey(int8* passphrase, int passphraseLen); + const cElGamalSigPrivateKey* GetPrivateKey(int8_t* passphrase, int passphraseLen); void ReleasePrivateKey(); // Access to the private key. Key is normally stored encrypted for safety. Call // ReleasePrivateKey() to destory the plaintext version of the key as soon as you @@ -103,8 +103,8 @@ public: static const cFileHeaderID& GetFileHeaderID(); protected: - int8* mpPrivateKeyMem; // encrypted version of private key - int mPrivateKeyMemLen; + int8_t* mpPrivateKeyMem; // encrypted version of private key + int mPrivateKeyMemLen; cElGamalSigPrivateKey* mpPrivateKey; // only valid between calls to GetPrivateKey() and ReleasePrivateKey() cElGamalSigPublicKey* mpPublicKey; @@ -112,7 +112,7 @@ protected: int mPrivateKeyUseCount; private: - void ProtectKeys(int8* passphrase, int passphraseLen); // throw eKeyFile() + void ProtectKeys(int8_t* passphrase, int passphraseLen); // throw eKeyFile() void ReleaseMem(); }; @@ -129,7 +129,7 @@ public: cPrivateKeyProxy(); ~cPrivateKeyProxy(); - bool AquireKey(cKeyFile& keyFile, int8* passphrase, int passphraseLen); + bool AquireKey(cKeyFile& keyFile, int8_t* passphrase, int passphraseLen); // note: be sure to check return value for failure!!! bool Valid() const diff --git a/src/twcrypto/stdtwcrypto.cpp b/src/twcrypto/stdtwcrypto.cpp index cd2ba2a..fb57db0 100644 --- a/src/twcrypto/stdtwcrypto.cpp +++ b/src/twcrypto/stdtwcrypto.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/stdtwcrypto.h b/src/twcrypto/stdtwcrypto.h index cdfb248..0a2b129 100644 --- a/src/twcrypto/stdtwcrypto.h +++ b/src/twcrypto/stdtwcrypto.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/twcrypto.cpp b/src/twcrypto/twcrypto.cpp index 6207c10..5305270 100644 --- a/src/twcrypto/twcrypto.cpp +++ b/src/twcrypto/twcrypto.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/twcrypto.h b/src/twcrypto/twcrypto.h index a9cb5fd..58ad3f0 100644 --- a/src/twcrypto/twcrypto.h +++ b/src/twcrypto/twcrypto.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/twcryptoerrors.cpp b/src/twcrypto/twcryptoerrors.cpp index 10b2969..6bea963 100644 --- a/src/twcrypto/twcryptoerrors.cpp +++ b/src/twcrypto/twcryptoerrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twcrypto/twcryptoerrors.h b/src/twcrypto/twcryptoerrors.h index 1f35268..3557677 100644 --- a/src/twcrypto/twcryptoerrors.h +++ b/src/twcrypto/twcryptoerrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/Makefile.in b/src/twparser/Makefile.in index 102f0d9..488462f 100644 --- a/src/twparser/Makefile.in +++ b/src/twparser/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -130,7 +130,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) @@ -302,6 +302,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -350,8 +351,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -456,7 +457,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/src/twparser/genreparseinfo.cpp b/src/twparser/genreparseinfo.cpp index 8cf38a2..1d63f00 100644 --- a/src/twparser/genreparseinfo.cpp +++ b/src/twparser/genreparseinfo.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/genreparseinfo.h b/src/twparser/genreparseinfo.h index 6de348d..982b7fa 100644 --- a/src/twparser/genreparseinfo.h +++ b/src/twparser/genreparseinfo.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/parserhelper.cpp b/src/twparser/parserhelper.cpp index 6ba2d07..8a510a4 100644 --- a/src/twparser/parserhelper.cpp +++ b/src/twparser/parserhelper.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -113,7 +113,9 @@ eParserHelper::eParserHelper(const TSTRING& strMsg, int nLine /*= CURRENT_LINE * strErr << nLine; } + tss_end(strErr); mMsg = strErr.str(); + tss_free(strErr); } @@ -455,9 +457,13 @@ void cParserUtil::InterpretEscapedString(const std::string& strEscapedString, TS pchCur++; // go to char past '\' if (*pchCur == 'x' && +#if !ARCHAIC_STL std::isxdigit( *(pchCur + 1), std::locale())) // deal with \xXXXX where 'x' is the character 'x', and 'X' is a hex number +#else + isxdigit(*(pchCur + 1))) +#endif { pchCur++; // go to char past 'x' char cEscapedChar = static_cast(util_ConvertHex(pchCur, &nCharsRead)); @@ -679,8 +685,15 @@ void cParserUtil::CreatePropVector(const TSTRING& strPropListC, class cFCOPropVe // clear out all spaces in the string TSTRING strPropList = strPropListC; - strPropList.erase(std::remove_if(strPropList.begin(), strPropList.end(), std::ptr_fun(std::isspace)), - strPropList.end()); + +// C++17 removes std::ptr_fun, so use a lambda where available +#if !USE_LAMBDAS + strPropList.erase(std::remove_if(strPropList.begin(), strPropList.end(), + std::ptr_fun(std::isspace)), strPropList.end()); +#else + strPropList.erase(std::remove_if(strPropList.begin(), strPropList.end(), + [](int c) {return std::isspace(c);}), strPropList.end()); +#endif // zero it out v.Clear(); @@ -876,23 +889,42 @@ int util_ConvertHex(const char* const cpsz, int* const pnCharsRead) ASSERT(util_AsciiCharsActLikeTheyShould()); ASSERT(cpsz && pnCharsRead); +#if !ARCHAIC_STL if (*cpsz == 0 || !std::isxdigit(*cpsz, std::locale())) +#else + if (*cpsz == 0 || !isxdigit(*cpsz)) +#endif + throw eParserBadHex(cStringUtil::StrToTstr(cpsz)); int iValue; const char* psz = cpsz; + +#if !ARCHAIC_STL for (*pnCharsRead = 0, iValue = 0; *psz && std::isxdigit(*psz, std::locale()) && (*pnCharsRead < 2); psz++, (*pnCharsRead)++) +#else + for (*pnCharsRead = 0, iValue = 0; *psz && isxdigit(*psz) && (*pnCharsRead < 2); + psz++, (*pnCharsRead)++) +#endif { iValue *= 0x10; +#if !ARCHAIC_STL if (std::isdigit(*psz, std::locale())) +#else + if (isdigit(*psz)) +#endif { iValue += (*psz - '0'); } else { +#if !ARCHAIC_STL if (std::islower(*psz, std::locale())) +#else + if (islower(*psz)) +#endif iValue += (*psz - 'a' + 10); // so that A=10, B=11, ..., F=15 else // is uppercase iValue += (*psz - 'A' + 10); // so that a=10, a=11, ..., f=15 @@ -907,26 +939,43 @@ int util_ConvertUnicode(const char* const cpsz, int* const pnCharsRead) ASSERT(util_AsciiCharsActLikeTheyShould()); ASSERT(cpsz && pnCharsRead); +#if !ARCHAIC_STL if (*cpsz == 0 || !std::isxdigit(*cpsz, std::locale())) +#else + if (*cpsz == 0 || !isxdigit(*cpsz)) +#endif throw eParserBadHex(cStringUtil::StrToTstr(cpsz)); int iValue; const char* psz = cpsz; for (*pnCharsRead = 0, iValue = 0; *pnCharsRead < 4; psz++, (*pnCharsRead)++) { + // we require 4 chars for unicode escapes +#if !ARCHAIC_STL if (*psz == 0 || !std::isxdigit(*psz, std::locale())) +#else + if (*psz == 0 || !isxdigit(*psz)) +#endif throw eParserBadHex(cStringUtil::StrToTstr(cpsz)); iValue *= 0x10; +#if !ARCHAIC_STL if (std::isdigit(*psz, std::locale())) +#else + if (isdigit(*psz)) +#endif { iValue += (*psz - '0'); } else { +#if !ARCHAIC_STL if (std::islower(*psz, std::locale())) +#else + if (islower(*psz)) +#endif iValue += (*psz - 'a' + 10); // so that A=10, B=11, ..., F=15 else // is uppercase iValue += (*psz - 'A' + 10); // so that a=10, a=11, ..., f=15 diff --git a/src/twparser/parserhelper.h b/src/twparser/parserhelper.h index c723271..d016245 100644 --- a/src/twparser/parserhelper.h +++ b/src/twparser/parserhelper.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/parserobjects.cpp b/src/twparser/parserobjects.cpp index 8581d40..13d0f03 100644 --- a/src/twparser/parserobjects.cpp +++ b/src/twparser/parserobjects.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/parserobjects.h b/src/twparser/parserobjects.h index 7cd3e5a..3b75924 100644 --- a/src/twparser/parserobjects.h +++ b/src/twparser/parserobjects.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/policyparser.cpp b/src/twparser/policyparser.cpp index 8586a0d..d12ac11 100644 --- a/src/twparser/policyparser.cpp +++ b/src/twparser/policyparser.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -85,7 +85,9 @@ void tw_yy_scan::output(int c) sz[1] = 0; sstr << sz; - throw eParseFailed(sstr.str()); + tss_mkstr(errStr, sstr); + + throw eParseFailed(errStr); } @@ -99,8 +101,14 @@ void cPolicyParser::Check(cErrorBucket* pError) //throw(eError); cParserHelper::Init(pError); cParserHelper::SetParseOnly(true); - std::basic_stringstream in(ConvertMultibyte(mIn)); - tw_yy_scan lexer(in); +#if !ARCHAIC_STL + TISTRINGSTREAM in(ConvertMultibyte(mIn)); +#else + TSTRINGSTREAM in; + in << ConvertMultibyte(mIn); +#endif + + tw_yy_scan lexer(in); // start the parsing if (mParser.yyparse(&lexer) != 0) @@ -119,8 +127,14 @@ void cPolicyParser::Execute(cGenreSpecListVector& policy, cErrorBucket* pError) { cParserHelper::Init(pError); - std::basic_stringstream in(ConvertMultibyte(mIn)); - tw_yy_scan lexer(in); +#if !ARCHAIC_STL + TISTRINGSTREAM in(ConvertMultibyte(mIn)); +#else + TSTRINGSTREAM in; + in << ConvertMultibyte(mIn); +#endif + + tw_yy_scan lexer(in); // start the parsing if (mParser.yyparse(&lexer) != 0) @@ -136,17 +150,21 @@ void cPolicyParser::Execute(cGenreSpecListVector& policy, cErrorBucket* pError) // Parser will ALWAYS call the narrow-char version, so special case Unicode compile void tw_yy_scan::yyerror(const char* pszErr, ...) //throw( eParserHelper ) { +#if 0 TOSTRINGSTREAM ssError; // final error string ssError << pszErr; - - throw eParseFailed(ssError.str()); + throw eParseFailed(ssError.str()); +#endif + + TSTRING errText = pszErr ? pszErr : ""; + throw eParseFailed(errText); } // Throw this in the display encoder? std::string cPolicyParser::ConvertMultibyte(std::istream& in) { // get this file as a stringstream - std::stringstream ss; + TOSTRINGSTREAM ss; while (true) { @@ -168,6 +186,8 @@ std::string cPolicyParser::ConvertMultibyte(std::istream& in) throw eParserBadCharacter(); } + tss_end(ss); + #ifdef DEBUG TCERR << _T("*** begin policy text ***") << std::endl; std::cerr << ss.str() << std::endl; @@ -176,7 +196,8 @@ std::string cPolicyParser::ConvertMultibyte(std::istream& in) // convert it to single byte escaped std::string str = util_ConvertMB(ss.str()); - + tss_free(ss); + #ifdef DEBUG TCERR << _T("*** begin policy converted to ***") << std::endl; std::cerr << str << std::endl; @@ -188,20 +209,24 @@ std::string cPolicyParser::ConvertMultibyte(std::istream& in) std::string convert_to_encoded_hex(char ch) { - std::basic_stringstream sstr; + TOSTRINGSTREAM sstr; // set up stringstream - sstr.imbue(std::locale::classic()); - sstr.setf(std::ios_base::hex, std::ios_base::basefield); + tss_classic_locale(sstr); + sstr.setf(std::ios::hex, std::ios::basefield); +#if !ARCHAIC_STL // get the num_put facet const std::num_put*pnp = 0, &np = tss::GetFacet(sstr.getloc(), pnp); - // output the char sstr << "\\x"; + np.put(sstr, sstr, sstr.fill(), (long)(unsigned char)ch); +#else + sstr << "\\x" << ch; +#endif - return sstr.str(); + tss_return_stream(sstr, out); } diff --git a/src/twparser/policyparser.h b/src/twparser/policyparser.h index 636b7af..7a4ab64 100644 --- a/src/twparser/policyparser.h +++ b/src/twparser/policyparser.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/stdtwparser.cpp b/src/twparser/stdtwparser.cpp index 1d47e59..d84dd3a 100644 --- a/src/twparser/stdtwparser.cpp +++ b/src/twparser/stdtwparser.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/stdtwparser.h b/src/twparser/stdtwparser.h index e1a582e..eaa3487 100644 --- a/src/twparser/stdtwparser.h +++ b/src/twparser/stdtwparser.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/twparser.cpp b/src/twparser/twparser.cpp index eeb8f93..cd8ad43 100644 --- a/src/twparser/twparser.cpp +++ b/src/twparser/twparser.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/twparser.h b/src/twparser/twparser.h index f52db10..2fa4874 100644 --- a/src/twparser/twparser.h +++ b/src/twparser/twparser.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/twparsererrors.cpp b/src/twparser/twparsererrors.cpp index bdf7a92..077d51f 100644 --- a/src/twparser/twparsererrors.cpp +++ b/src/twparser/twparsererrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/twparsererrors.h b/src/twparser/twparsererrors.h index 2ae9810..48eab61 100644 --- a/src/twparser/twparsererrors.h +++ b/src/twparser/twparsererrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/twparserstrings.cpp b/src/twparser/twparserstrings.cpp index 21f71f4..d3929ca 100644 --- a/src/twparser/twparserstrings.cpp +++ b/src/twparser/twparserstrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/twparserstrings.h b/src/twparser/twparserstrings.h index d693135..623ec66 100644 --- a/src/twparser/twparserstrings.h +++ b/src/twparser/twparserstrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/yylex.cpp b/src/twparser/yylex.cpp index 225b869..4abdb48 100644 --- a/src/twparser/yylex.cpp +++ b/src/twparser/yylex.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -552,12 +552,12 @@ std::string FormatSyntaxError( char ch, const char* pszAdditionalMsg = NULL ) // we do it here as well, I suppose that's OK. This should be eventually // corrected. - std::ostringstream ssErr; + TOSTRINGSTREAM ssErr; ssErr << "Syntax error: \'" << ch << "\'"; if( pszAdditionalMsg ) ssErr << ", " << pszAdditionalMsg; - return ssErr.str(); + tss_return_stream(ssErr, out); } // saves typing @@ -831,8 +831,8 @@ yy_scan::yylex() yyst = yy_next[yybase]; yy_jammed: ; state[++i] = (yy_state_t) yyst; - } while (!(yyst == (unsigned int)yy_endst || YY_INTERACTIVE && - yy_base[yyst] > yy_nxtmax && yy_default[yyst] == yy_endst)); + } while (!(yyst == (unsigned int)yy_endst || (YY_INTERACTIVE && + (yy_base[yyst] > yy_nxtmax) && (yy_default[yyst] == yy_endst)))); YY_DEBUG("\n", yyst, i); if (yyst != (unsigned int)yy_endst) diff --git a/src/twparser/yylex.h b/src/twparser/yylex.h index 8ede93c..75886d0 100644 --- a/src/twparser/yylex.h +++ b/src/twparser/yylex.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/yyparse.cpp b/src/twparser/yyparse.cpp index 8d3862b..a6a8206 100644 --- a/src/twparser/yyparse.cpp +++ b/src/twparser/yyparse.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twparser/yyparse.h b/src/twparser/yyparse.h index 348ad6d..87e941d 100644 --- a/src/twparser/yyparse.h +++ b/src/twparser/yyparse.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/Makefile.in b/src/twprint/Makefile.in index afaa7af..c84e9ca 100644 --- a/src/twprint/Makefile.in +++ b/src/twprint/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -124,7 +124,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) @@ -295,6 +295,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -341,8 +342,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -485,7 +486,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/src/twprint/resource.h b/src/twprint/resource.h index 81aac68..e9e20c6 100644 --- a/src/twprint/resource.h +++ b/src/twprint/resource.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/stdtwprint.cpp b/src/twprint/stdtwprint.cpp index 5a7e3a9..8a2a2c6 100644 --- a/src/twprint/stdtwprint.cpp +++ b/src/twprint/stdtwprint.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/stdtwprint.h b/src/twprint/stdtwprint.h index 0ffcee4..67b70f2 100644 --- a/src/twprint/stdtwprint.h +++ b/src/twprint/stdtwprint.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/twprint.cpp b/src/twprint/twprint.cpp index add7d4d..ba2d765 100644 --- a/src/twprint/twprint.cpp +++ b/src/twprint/twprint.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/twprint.h b/src/twprint/twprint.h index 4ebf829..b355c75 100644 --- a/src/twprint/twprint.h +++ b/src/twprint/twprint.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/twprintcmdline.cpp b/src/twprint/twprintcmdline.cpp index 50762fc..500f253 100644 --- a/src/twprint/twprintcmdline.cpp +++ b/src/twprint/twprintcmdline.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/twprintcmdline.h b/src/twprint/twprintcmdline.h index e9de366..6a83339 100644 --- a/src/twprint/twprintcmdline.h +++ b/src/twprint/twprintcmdline.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/twprinterrors.cpp b/src/twprint/twprinterrors.cpp index 3d9d64e..a3b717a 100644 --- a/src/twprint/twprinterrors.cpp +++ b/src/twprint/twprinterrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/twprinterrors.h b/src/twprint/twprinterrors.h index 58675a5..2c851f8 100644 --- a/src/twprint/twprinterrors.h +++ b/src/twprint/twprinterrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/twprintmain.cpp b/src/twprint/twprintmain.cpp index 079ace4..61f4744 100644 --- a/src/twprint/twprintmain.cpp +++ b/src/twprint/twprintmain.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -67,14 +67,26 @@ void tw_terminate_handler() { fputs("### Internal Error.\n### Terminate Handler called.\n### Exiting...\n", stderr); +#if HAVE__EXIT _exit(1); +#else + exit(1); +#endif } +// Exception specifications removed as a misfeature in C++17 +#if USE_UNEXPECTED void tw_unexpected_handler() { fputs("### Internal Error.\n### Unexpected Exception Handler called.\n### Exiting...\n", stderr); + +#if HAVE__EXIT _exit(1); +#else + exit(1); +#endif } +#endif int __cdecl _tmain(int argc, const TCHAR* argv[]) { @@ -93,17 +105,16 @@ int __cdecl _tmain(int argc, const TCHAR* argv[]) // TODO: move this into the Init() routine EXCEPTION_NAMESPACE set_terminate(tw_terminate_handler); +#if USE_UNEXPECTED EXCEPTION_NAMESPACE set_unexpected(tw_unexpected_handler); +#endif twInit.Init(argv[0]); TSS_Dependency(cTWPrint); - // init twprint strings - // cDebug::SetDebugLevel(cDebug::D_DEBUG); - // **** let's try a new way of doing things! // first, process the command line if (argc < 2) diff --git a/src/twprint/twprintstrings.cpp b/src/twprint/twprintstrings.cpp index 05d0a73..49b3e15 100644 --- a/src/twprint/twprintstrings.cpp +++ b/src/twprint/twprintstrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twprint/twprintstrings.h b/src/twprint/twprintstrings.h index ed8caba..cfa1122 100644 --- a/src/twprint/twprintstrings.h +++ b/src/twprint/twprintstrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/Makefile.in b/src/twtest/Makefile.in index 409d2bd..94c7b02 100644 --- a/src/twtest/Makefile.in +++ b/src/twtest/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -152,7 +152,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) @@ -335,6 +335,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -441,8 +442,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -585,7 +586,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/src/twtest/archive_t.cpp b/src/twtest/archive_t.cpp index 7dd9565..b491935 100644 --- a/src/twtest/archive_t.cpp +++ b/src/twtest/archive_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -62,8 +62,8 @@ void TestMemoryArchive() memarch.Seek(0, cBidirArchive::BEGINNING); - int32 i; - int64 l; + int32_t i; + int64_t l; memarch.ReadInt32(i); TEST(i == 1); memarch.ReadInt32(i); @@ -80,7 +80,7 @@ void TestMemoryArchive() memarch.ReadInt64(l); TEST(l == 1234567L); - TEST(memarch.ReadBlob(NULL, sizeof(int16)) == sizeof(int16)); + TEST(memarch.ReadBlob(NULL, sizeof(int16_t)) == sizeof(int16_t)); TEST(memarch.ReadBlob(NULL, 1024) == 0); try @@ -99,10 +99,10 @@ void TestMemoryArchive() (void)e; } - memarch.MapArchive(4 * sizeof(int32) + sizeof(int32) + 6, sizeof(int64)); - TEST(memarch.GetMappedOffset() == 4 * sizeof(int32) + sizeof(int32) + 6); - TEST(memarch.GetMappedLength() == sizeof(int64)); - // TEST(tw_ntohll(*(int64*)memarch.GetMap()) == 1234567L); + memarch.MapArchive(4 * sizeof(int32_t) + sizeof(int32_t) + 6, sizeof(int64_t)); + TEST(memarch.GetMappedOffset() == 4 * sizeof(int32_t) + sizeof(int32_t) + 6); + TEST(memarch.GetMappedLength() == sizeof(int64_t)); + // TEST(tw_ntohll(*(int64_t*)memarch.GetMap()) == 1234567L); } void TestLockedTemporaryArchive() @@ -186,8 +186,8 @@ void TestFileArchive() filearch.WriteInt16(42); filearch.Close(); - int32 j; - int64 k; + int32_t j; + int64_t k; filearch.OpenRead(fileName.c_str()); filearch.Seek(0, cBidirArchive::BEGINNING); filearch.ReadInt32(j); @@ -205,7 +205,7 @@ void TestFileArchive() filearch.ReadInt64(k); TEST(k == 1234567L); - TEST(filearch.ReadBlob(NULL, sizeof(int16)) == sizeof(int16)); + TEST(filearch.ReadBlob(NULL, sizeof(int16_t)) == sizeof(int16_t)); TEST(filearch.ReadBlob(NULL, 1024) == 0); // should be EOF try diff --git a/src/twtest/blockfile_t.cpp b/src/twtest/blockfile_t.cpp index 1f9cf7b..891b5e5 100644 --- a/src/twtest/blockfile_t.cpp +++ b/src/twtest/blockfile_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/blockrecordarray_t.cpp b/src/twtest/blockrecordarray_t.cpp index c035e43..acfb028 100644 --- a/src/twtest/blockrecordarray_t.cpp +++ b/src/twtest/blockrecordarray_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -73,13 +73,13 @@ void TestBlockRecordArray() static const char data2[] = "And here we have data 2"; static const char data3[] = "Here is d a t a 3!"; static const char data4[] = "Three cheers for data 4!"; - ra1.AddItem((int8*)data1, sizeof(data1), 1); + ra1.AddItem((int8_t*)data1, sizeof(data1), 1); // TEST(ra1.IsItemValid(1)); - ra1.AddItem((int8*)data2, sizeof(data2), 2); + ra1.AddItem((int8_t*)data2, sizeof(data2), 2); // TEST(ra1.IsItemValid(2)); - ra1.AddItem((int8*)data3, sizeof(data3), 3); + ra1.AddItem((int8_t*)data3, sizeof(data3), 3); // TEST(ra1.IsItemValid(3)); - ra1.AddItem((int8*)data4, sizeof(data4), 4); + ra1.AddItem((int8_t*)data4, sizeof(data4), 4); // TEST(ra1.IsItemValid(4)); #ifdef _BLOCKFILE_DEBUG ra1.TraceContents(); @@ -97,7 +97,7 @@ void TestBlockRecordArray() // add a new item... static const char data5[] = "fffiiivvveee!"; - ra1.AddItem((int8*)data5, sizeof(data5), 5); + ra1.AddItem((int8_t*)data5, sizeof(data5), 5); // TEST(ra1.IsItemValid(5)); #ifdef _BLOCKFILE_DEBUG ra1.TraceContents(); @@ -125,8 +125,8 @@ void TestBlockRecordArray() // add a couple more just for kicks :-) static const char data6[] = "We're looking for six"; static const char data7[] = "All 7s go to heaven"; - ra1.AddItem((int8*)data6, sizeof(data6), 6); - ra1.AddItem((int8*)data7, sizeof(data7), 7); + ra1.AddItem((int8_t*)data6, sizeof(data6), 6); + ra1.AddItem((int8_t*)data7, sizeof(data7), 7); #ifdef _BLOCKFILE_DEBUG ra1.TraceContents(); #endif diff --git a/src/twtest/charutil_t.cpp b/src/twtest/charutil_t.cpp index 625460f..a779c5c 100644 --- a/src/twtest/charutil_t.cpp +++ b/src/twtest/charutil_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -43,6 +43,7 @@ #include "twtest/test.h" #include +#include bool localeIsUtf8() { @@ -82,10 +83,13 @@ void TestCharUtilBasic() CheckChars("foo"); CheckChars("fo\x23 54"); + // Test case requires support for Unicode escape sequences +#if USE_UNICODE_ESCAPES if (localeIsUtf8()) CheckChars("\U0001F408", 4); //Cat emoji, if UTF-8 else CheckChars("\U0001F408", 1); // just a bag of bytes otherwise +#endif } void RegisterSuite_CharUtil() diff --git a/src/twtest/cmdlineparser_t.cpp b/src/twtest/cmdlineparser_t.cpp index 139568e..c287369 100644 --- a/src/twtest/cmdlineparser_t.cpp +++ b/src/twtest/cmdlineparser_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/codeconvert_t.cpp b/src/twtest/codeconvert_t.cpp index d9c938a..8e8c32b 100644 --- a/src/twtest/codeconvert_t.cpp +++ b/src/twtest/codeconvert_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/configfile_t.cpp b/src/twtest/configfile_t.cpp index 25635bc..387bac5 100644 --- a/src/twtest/configfile_t.cpp +++ b/src/twtest/configfile_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/crypto_t.cpp b/src/twtest/crypto_t.cpp index c8c5ed5..44c5fe5 100644 --- a/src/twtest/crypto_t.cpp +++ b/src/twtest/crypto_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -42,10 +42,10 @@ void TestCrypto() { const int COUNT = 4000; - const int BUFSIZE = 9000; + const int BUFFER_SIZE = 9000; - std::vector source_buf(BUFSIZE); - std::vector crypt_buf(COUNT + BUFSIZE); // needs to be able to hold even number of blocks + std::vector source_buf(BUFFER_SIZE); + std::vector crypt_buf(COUNT + BUFFER_SIZE); // needs to be able to hold even number of blocks std::vector dest_buf(COUNT); char* source = &source_buf[0]; @@ -119,9 +119,9 @@ void TestCrypto() // we use buf for when the end of the source doesn't fall on a // blocksize boundry. - TEST(crypter.GetBlockSizePlain() < BUFSIZE); - TEST(crypter.GetBlockSizeCipher() < BUFSIZE); - char buf[BUFSIZE]; + TEST(crypter.GetBlockSizePlain() < BUFFER_SIZE); + TEST(crypter.GetBlockSizeCipher() < BUFFER_SIZE); + char buf[BUFFER_SIZE]; cRSAPublicKey* pPublic; cRSAPrivateKey* pPrivate; @@ -132,16 +132,16 @@ void TestCrypto() cRSAPublicKey* pPublic2; cRSAPrivateKey* pPrivate2; - TEST(pPublic->GetWriteLen() < BUFSIZE); + TEST(pPublic->GetWriteLen() < BUFFER_SIZE); pPublic->Write(buf); pPublic2 = new cRSAPublicKey(buf); - TEST(pPrivate->GetWriteLen() < BUFSIZE); + TEST(pPrivate->GetWriteLen() < BUFFER_SIZE); pPrivate->Write(buf); pPrivate2 = new cRSAPrivateKey(buf); // we will try encrypting to a second pair of buffers and see if all goes well - char crypt2[COUNT + BUFSIZE]; + char crypt2[COUNT + BUFFER_SIZE]; char dest2[COUNT]; // encrypt the phrase @@ -289,9 +289,9 @@ void TestCrypto() // we use buf for when the end of the source doesn't fall on a // blocksize boundry. - TEST(crypter.GetBlockSizePlain() < BUFSIZE); - TEST(crypter.GetBlockSizeCipher() < BUFSIZE); - char buf[BUFSIZE]; + TEST(crypter.GetBlockSizePlain() < BUFFER_SIZE); + TEST(crypter.GetBlockSizeCipher() < BUFFER_SIZE); + char buf[BUFFER_SIZE]; cElGamalSigPublicKey* pPublic; cElGamalSigPrivateKey* pPrivate; @@ -302,16 +302,16 @@ void TestCrypto() cElGamalSigPublicKey* pPublic2; cElGamalSigPrivateKey* pPrivate2; - TEST(pPublic->GetWriteLen() < BUFSIZE); + TEST(pPublic->GetWriteLen() < BUFFER_SIZE); pPublic->Write(buf); pPublic2 = new cElGamalSigPublicKey(buf); - TEST(pPrivate->GetWriteLen() < BUFSIZE); + TEST(pPrivate->GetWriteLen() < BUFFER_SIZE); pPrivate->Write(buf); pPrivate2 = new cElGamalSigPrivateKey(buf); // we will try encrypting to a second pair of buffers and see if all goes well - //char crypt2[COUNT + BUFSIZE]; + //char crypt2[COUNT + BUFFER_SIZE]; //char dest2[COUNT]; // zero out things and try signing and verifying diff --git a/src/twtest/cryptoarchive_t.cpp b/src/twtest/cryptoarchive_t.cpp index c2664a0..28d435b 100644 --- a/src/twtest/cryptoarchive_t.cpp +++ b/src/twtest/cryptoarchive_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -49,7 +49,7 @@ void TestCryptoArchive() d.TraceDetail("Building test memory image of size %dK bytes\n", SIZEOF_CHUNK * NUM_CHUNKS / 1024); - int8 chunk[7]; + int8_t chunk[7]; memcpy(chunk, "1234567", 7); int i; @@ -78,7 +78,7 @@ void TestCryptoArchive() for (memory.Seek(0, cBidirArchive::BEGINNING); !memory.EndOfFile();) { - int8 buf[SIZEOF_CHUNK]; + int8_t buf[SIZEOF_CHUNK]; memory.ReadBlob(buf, SIZEOF_CHUNK); outCrypt.WriteBlob(buf, SIZEOF_CHUNK); } @@ -99,7 +99,7 @@ void TestCryptoArchive() int index; for (index = 0; index < NUM_CHUNKS * SIZEOF_CHUNK; index += TEST_CHUNKSIZE) { - int8 buf[TEST_CHUNKSIZE]; + int8_t buf[TEST_CHUNKSIZE]; int s = (index + TEST_CHUNKSIZE <= NUM_CHUNKS * SIZEOF_CHUNK) ? TEST_CHUNKSIZE : NUM_CHUNKS * SIZEOF_CHUNK - index; @@ -135,7 +135,7 @@ void TestCryptoArchive() for (memory.Seek(0, cBidirArchive::BEGINNING); !memory.EndOfFile();) { - int8 buf[SIZEOF_CHUNK]; + int8_t buf[SIZEOF_CHUNK]; memory.ReadBlob(buf, SIZEOF_CHUNK); outCrypt.WriteBlob(buf, SIZEOF_CHUNK); } @@ -156,7 +156,7 @@ void TestCryptoArchive() int index; for (index = 0; index < NUM_CHUNKS * SIZEOF_CHUNK; index += TEST_CHUNKSIZE) { - int8 buf[TEST_CHUNKSIZE]; + int8_t buf[TEST_CHUNKSIZE]; int s = (index + TEST_CHUNKSIZE <= NUM_CHUNKS * SIZEOF_CHUNK) ? TEST_CHUNKSIZE : NUM_CHUNKS * SIZEOF_CHUNK - index; @@ -187,7 +187,7 @@ void TestCryptoArchive() d.TraceDetail("Building test memory image of size %dK bytes\n", SIZEOF_CHUNK * NUM_CHUNKS / 1024); - int8 chunk[7]; + int8_t chunk[7]; memcpy(chunk, "1234567", 7); int i; @@ -211,7 +211,7 @@ void TestCryptoArchive() for (memory.Seek(0, cBidirArchive::BEGINNING); !memory.EndOfFile();) { - int8 buf[SIZEOF_CHUNK]; + int8_t buf[SIZEOF_CHUNK]; memory.ReadBlob(buf, SIZEOF_CHUNK); outCrypt.WriteBlob(buf, SIZEOF_CHUNK); } @@ -232,7 +232,7 @@ void TestCryptoArchive() int index; for (index = 0; index < NUM_CHUNKS * SIZEOF_CHUNK; index += TEST_CHUNKSIZE) { - int8 buf[TEST_CHUNKSIZE]; + int8_t buf[TEST_CHUNKSIZE]; int s = (index + TEST_CHUNKSIZE <= NUM_CHUNKS * SIZEOF_CHUNK) ? TEST_CHUNKSIZE : NUM_CHUNKS * SIZEOF_CHUNK - index; @@ -256,7 +256,7 @@ void TestCryptoArchive() for (memory.Seek(0, cBidirArchive::BEGINNING); !memory.EndOfFile();) { - int8 buf[SIZEOF_CHUNK]; + int8_t buf[SIZEOF_CHUNK]; memory.ReadBlob(buf, SIZEOF_CHUNK); outCrypt.WriteBlob(buf, SIZEOF_CHUNK); } @@ -277,7 +277,7 @@ void TestCryptoArchive() int index; for (index = 0; index < NUM_CHUNKS * SIZEOF_CHUNK; index += TEST_CHUNKSIZE) { - int8 buf[TEST_CHUNKSIZE]; + int8_t buf[TEST_CHUNKSIZE]; int s = (index + TEST_CHUNKSIZE <= NUM_CHUNKS * SIZEOF_CHUNK) ? TEST_CHUNKSIZE : NUM_CHUNKS * SIZEOF_CHUNK - index; diff --git a/src/twtest/dbdatasource_t.cpp b/src/twtest/dbdatasource_t.cpp index 97bbc01..07b8af1 100644 --- a/src/twtest/dbdatasource_t.cpp +++ b/src/twtest/dbdatasource_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/debug_t.cpp b/src/twtest/debug_t.cpp index 633792c..f179b2e 100644 --- a/src/twtest/debug_t.cpp +++ b/src/twtest/debug_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/displayencoder_t.cpp b/src/twtest/displayencoder_t.cpp index ad8e372..781ec5a 100644 --- a/src/twtest/displayencoder_t.cpp +++ b/src/twtest/displayencoder_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/error_t.cpp b/src/twtest/error_t.cpp index 03f68a2..f6e04fe 100644 --- a/src/twtest/error_t.cpp +++ b/src/twtest/error_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/errorbucketimpl_t.cpp b/src/twtest/errorbucketimpl_t.cpp index b1d3870..bdf8729 100644 --- a/src/twtest/errorbucketimpl_t.cpp +++ b/src/twtest/errorbucketimpl_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -39,6 +39,8 @@ #include "core/errorgeneral.h" #include "core/errortable.h" +TSS_EXCEPTION(eTestErrorBucketImpl, eError); + // test option 7 void TestErrorBucketImpl() { @@ -82,7 +84,7 @@ void TestErrorBucketImpl() // TODO -- test the error table // TODO -- test the error filter // set some errors... - TSS_EXCEPTION(eTestErrorBucketImpl, eError); + eTestErrorBucketImpl error1(_T("Error A")), error2(_T("Error B")), error3(_T("Error C")); er.AddError(error1); diff --git a/src/twtest/fcocompare_t.cpp b/src/twtest/fcocompare_t.cpp index 9f71511..4a7a31f 100644 --- a/src/twtest/fcocompare_t.cpp +++ b/src/twtest/fcocompare_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fcodatabasefile_t.cpp b/src/twtest/fcodatabasefile_t.cpp index ea1d78c..d8ef8b5 100644 --- a/src/twtest/fcodatabasefile_t.cpp +++ b/src/twtest/fcodatabasefile_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fconame_t.cpp b/src/twtest/fconame_t.cpp index 6bbe174..ccd7d61 100644 --- a/src/twtest/fconame_t.cpp +++ b/src/twtest/fconame_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fconametbl_t.cpp b/src/twtest/fconametbl_t.cpp index 14fd162..93f1695 100644 --- a/src/twtest/fconametbl_t.cpp +++ b/src/twtest/fconametbl_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fconametranslator_t.cpp b/src/twtest/fconametranslator_t.cpp index ccdf4c8..b7cb5fe 100644 --- a/src/twtest/fconametranslator_t.cpp +++ b/src/twtest/fconametranslator_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fcopropimpl_t.cpp b/src/twtest/fcopropimpl_t.cpp index 55ea288..dd33763 100644 --- a/src/twtest/fcopropimpl_t.cpp +++ b/src/twtest/fcopropimpl_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -54,7 +54,7 @@ void TestNumeric() pi64.SetValue(-456); pui64.SetValue(456); pui64b.SetValue(333); - d.TraceDebug(_T("property int64 = (should be -456) %s\n"), pi64.AsString().c_str()); + d.TraceDebug(_T("property int64_t = (should be -456) %s\n"), pi64.AsString().c_str()); TEST(pi64.AsString() == "-456"); // test a few operators diff --git a/src/twtest/fcopropvector_t.cpp b/src/twtest/fcopropvector_t.cpp index 088d9ad..bfc90b2 100644 --- a/src/twtest/fcopropvector_t.cpp +++ b/src/twtest/fcopropvector_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fcoreport_t.cpp b/src/twtest/fcoreport_t.cpp index d3f5a17..c9518ea 100644 --- a/src/twtest/fcoreport_t.cpp +++ b/src/twtest/fcoreport_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -103,10 +103,12 @@ void TestFCOReport() cFSObject* newChangedFCO = new cFSObject(cFCOName(_T("/etc/changed_file"))); cFCOPropVector changedPropVector; + /* //Calculate the time taken to generate the test report: time_t* dummy_arg = NULL; time_t time_finish; - //time_t time_begin = time(dummy_arg); + time_t time_begin = time(dummy_arg); + */ { cFCOReport report; @@ -122,10 +124,12 @@ void TestFCOReport() it.GetRemovedSet()->Insert(removedFCO); report.AddChangedFCO(it, oldChangedFCO, newChangedFCO, changedPropVector); + /* //Store the time taken to generate the test report: time_finish = time(dummy_arg); - //report.SetCreationTime( (int64)difftime(time_finish, time_begin)); - //d.TraceDebug("Report calculation time = %I64i seconds.\n", report.GetCreationTime()); + report.SetCreationTime( (int64_t)difftime(time_finish, time_begin)); + d.TraceDebug("Report calculation time = %I64i seconds.\n", report.GetCreationTime()); + */ d.TraceDebug("Before serializing report:\n"); TraceReport(report, d); diff --git a/src/twtest/fcosetimpl_t.cpp b/src/twtest/fcosetimpl_t.cpp index cdf8932..acc3e14 100644 --- a/src/twtest/fcosetimpl_t.cpp +++ b/src/twtest/fcosetimpl_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fcospec_t.cpp b/src/twtest/fcospec_t.cpp index 0a37377..adc1b00 100644 --- a/src/twtest/fcospec_t.cpp +++ b/src/twtest/fcospec_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fcospecattr_t.cpp b/src/twtest/fcospecattr_t.cpp index 0f560ab..d2c8e99 100644 --- a/src/twtest/fcospecattr_t.cpp +++ b/src/twtest/fcospecattr_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fcospechelper_t.cpp b/src/twtest/fcospechelper_t.cpp index 7cc03bd..9debf22 100644 --- a/src/twtest/fcospechelper_t.cpp +++ b/src/twtest/fcospechelper_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fcospeclist_t.cpp b/src/twtest/fcospeclist_t.cpp index 8a88be9..88dffe3 100644 --- a/src/twtest/fcospeclist_t.cpp +++ b/src/twtest/fcospeclist_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fcospecutil_t.cpp b/src/twtest/fcospecutil_t.cpp index a5b59fa..c2d4153 100644 --- a/src/twtest/fcospecutil_t.cpp +++ b/src/twtest/fcospecutil_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/file_t.cpp b/src/twtest/file_t.cpp index 8c1decc..c00f6fa 100644 --- a/src/twtest/file_t.cpp +++ b/src/twtest/file_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fileheader_t.cpp b/src/twtest/fileheader_t.cpp index 6a3e4fb..09ae276 100644 --- a/src/twtest/fileheader_t.cpp +++ b/src/twtest/fileheader_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fileutil_t.cpp b/src/twtest/fileutil_t.cpp index 267e1ef..652f58d 100644 --- a/src/twtest/fileutil_t.cpp +++ b/src/twtest/fileutil_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fsdatasourceiter_t.cpp b/src/twtest/fsdatasourceiter_t.cpp index 290ac15..9e77001 100644 --- a/src/twtest/fsdatasourceiter_t.cpp +++ b/src/twtest/fsdatasourceiter_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fsobject_t.cpp b/src/twtest/fsobject_t.cpp index 7df10b9..8acfde5 100644 --- a/src/twtest/fsobject_t.cpp +++ b/src/twtest/fsobject_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fspropcalc_t.cpp b/src/twtest/fspropcalc_t.cpp index 65787b1..2e2a936 100644 --- a/src/twtest/fspropcalc_t.cpp +++ b/src/twtest/fspropcalc_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -46,6 +46,7 @@ #include #include + /////////////////////////////////////////////////////////////////////////////// // PrintProps -- prints out all the valid property names and values as pairs... /////////////////////////////////////////////////////////////////////////////// @@ -140,6 +141,7 @@ void TestFSPropCalc() return; } +#if HAVE_SYMLINK void TestGetSymLinkStr() { std::string file = TwTestPath("12345678901234567890123456789012345678901234567890123456789012345678901234567890"); @@ -154,11 +156,14 @@ void TestGetSymLinkStr() cMemoryArchive arch(1024 * 1024); TEST(cFSPropCalc::GetSymLinkStr(link, arch, 8)); - TEST(arch.Length() == (int64)file.size()); + TEST(arch.Length() == (int64_t)file.size()); } +#endif void RegisterSuite_FSPropCalc() { RegisterTest("FSPropCalc", "Basic", TestFSPropCalc); +#if HAVE_SYMLINK RegisterTest("FSPropCalc", "GetSymLinkStr", TestGetSymLinkStr); +#endif } diff --git a/src/twtest/fspropdisplayer_t.cpp b/src/twtest/fspropdisplayer_t.cpp index 9ce9193..e1851d5 100644 --- a/src/twtest/fspropdisplayer_t.cpp +++ b/src/twtest/fspropdisplayer_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/fspropset_t.cpp b/src/twtest/fspropset_t.cpp index d2d66bf..0c59448 100644 --- a/src/twtest/fspropset_t.cpp +++ b/src/twtest/fspropset_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -48,8 +48,10 @@ static void PrintPropVector(const cFCOPropVector& v, cDebug& d) stream << i << "," << " "; } - stream << std::ends; - d.TraceDebug("%s\n", stream.str().c_str()); + + tss_mkstr(out, stream); + + d.TraceDebug("%s\n", out.c_str()); } void TestFSPropSet() diff --git a/src/twtest/fsspec_t.cpp b/src/twtest/fsspec_t.cpp index 8b1ea11..326a827 100644 --- a/src/twtest/fsspec_t.cpp +++ b/src/twtest/fsspec_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/genre_t.cpp b/src/twtest/genre_t.cpp index 25baa8f..8d93b2d 100644 --- a/src/twtest/genre_t.cpp +++ b/src/twtest/genre_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/genrespeclist_t.cpp b/src/twtest/genrespeclist_t.cpp index 551087a..9d55050 100644 --- a/src/twtest/genrespeclist_t.cpp +++ b/src/twtest/genrespeclist_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -76,17 +76,17 @@ void TestGenreSpecList() gslVector.push_back(gslPair2); gslVector.push_back(gslPair3); - TEST(gslVector.at(0).GetGenre() == gslPair.GetGenre()); - TEST(gslVector.at(0).GetSpecList().Lookup(fsSpec) != 0); - TEST(gslVector.at(0).GetSpecList().Lookup(fsSpec)->GetName() == gslPair.GetSpecList().Lookup(fsSpec)->GetName()); + TEST(gslVector[0].GetGenre() == gslPair.GetGenre()); + TEST(gslVector[0].GetSpecList().Lookup(fsSpec) != 0); + TEST(gslVector[0].GetSpecList().Lookup(fsSpec)->GetName() == gslPair.GetSpecList().Lookup(fsSpec)->GetName()); - TEST(gslVector.at(1).GetGenre() == gslPair2.GetGenre()); - TEST(gslVector.at(1).GetSpecList().Lookup(fsSpec) != 0); - TEST(gslVector.at(1).GetSpecList().Lookup(fsSpec)->GetName() == gslPair2.GetSpecList().Lookup(fsSpec)->GetName()); + TEST(gslVector[1].GetGenre() == gslPair2.GetGenre()); + TEST(gslVector[1].GetSpecList().Lookup(fsSpec) != 0); + TEST(gslVector[1].GetSpecList().Lookup(fsSpec)->GetName() == gslPair2.GetSpecList().Lookup(fsSpec)->GetName()); - TEST(gslVector.at(2).GetGenre() == gslPair3.GetGenre()); - TEST(gslVector.at(2).GetSpecList().Lookup(fsSpec) != 0); - TEST(gslVector.at(2).GetSpecList().Lookup(fsSpec)->GetName() == gslPair3.GetSpecList().Lookup(fsSpec)->GetName()); + TEST(gslVector[2].GetGenre() == gslPair3.GetGenre()); + TEST(gslVector[2].GetSpecList().Lookup(fsSpec) != 0); + TEST(gslVector[2].GetSpecList().Lookup(fsSpec)->GetName() == gslPair3.GetSpecList().Lookup(fsSpec)->GetName()); d.TraceDebug("All tests passed.\n"); } diff --git a/src/twtest/genreswitcher_t.cpp b/src/twtest/genreswitcher_t.cpp index ae43142..c3ea858 100644 --- a/src/twtest/genreswitcher_t.cpp +++ b/src/twtest/genreswitcher_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -57,7 +57,12 @@ void TestGenreSwitcher() genreSwitcher->SelectGenre(cFS::GenreID()); TEST(genreSwitcher->CurrentGenre() == cFS::GenreID()); + +#ifndef HAVE_IBM_GXLC + // this fails on IBM XLC; the type_info::name() for the factory instance arg + // returns a blank string. TEST(typeid(*iTWFactory::GetInstance()) == typeid(cFSFactory)); +#endif d.TraceDebug("All tests passed.\n"); } diff --git a/src/twtest/growheap_t.cpp b/src/twtest/growheap_t.cpp index 343c3f0..83660f6 100644 --- a/src/twtest/growheap_t.cpp +++ b/src/twtest/growheap_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/hashtable_t.cpp b/src/twtest/hashtable_t.cpp index 5b77ea7..cd1ed57 100644 --- a/src/twtest/hashtable_t.cpp +++ b/src/twtest/hashtable_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -51,10 +51,7 @@ void HashTest1() cDebug d("TestHashTable()::Test1"); d.TraceDetail("Entering ...\n"); - //return val for all function calls. - bool ret = true; - - //test data + //test data TSTRING string = _T("test string"); TSTRING string2 = _T("another test string"); TSTRING string3 = _T("yet another test string"); @@ -73,18 +70,16 @@ void HashTest1() //Test insert and lookup. htable.Insert(string, data_ptr); - ret &= htable.Lookup(string, test_lookup); - TEST(ret); + TEST(htable.Lookup(string, test_lookup)); //Make sure value is being stored and returned correctly d.TraceDetail("Value returned from table is %i, and should be %i.\n", *((int*)test_lookup), var); TEST(*((int*)test_lookup) == var); //Check remove and lookup (lookup should fail) - ret &= htable.Remove(string); - TEST(ret); - ret &= !htable.Lookup(string, test_lookup); - TEST(ret); + TEST(htable.Remove(string)); + TEST(!htable.Lookup(string, test_lookup)); + //Has test_lookup's value changed? It shouldn't have... TEST(*((int*)test_lookup) == var); @@ -106,14 +101,17 @@ void HashTest1() #endif //Test IsEmpty() - ret &= !htable.IsEmpty(); TEST(!htable.IsEmpty()); //Test Clear(), IsEmpty() - ret &= htable.Clear(); TEST(htable.Clear()); - ret &= htable.IsEmpty(); TEST(htable.IsEmpty()); +} + + +// TODO: Turn this into a working, useful test, or remove it. +void HashTest3() +{ /* //Test the Hash table with arbitrary key @@ -158,6 +156,7 @@ void HashTest1() return; } + void HashTest2() { cDebug d("TestHashTable()::Test2"); diff --git a/src/twtest/hierdatabase_t.cpp b/src/twtest/hierdatabase_t.cpp index e352158..db8cb5a 100644 --- a/src/twtest/hierdatabase_t.cpp +++ b/src/twtest/hierdatabase_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -48,7 +48,7 @@ static void AddFile(cHierDatabase::iterator& iter, const TSTRING& filename, bool if (with_data) { - iter.SetData((int8*)g_block_data.c_str(), g_block_data.length() + 1); + iter.SetData((int8_t*)g_block_data.c_str(), g_block_data.length() + 1); } TEST(iter.HasData() == with_data); @@ -139,7 +139,7 @@ static void AssertData(cHierDatabase::iterator& iter, const TSTRING& filename, b if (has_data) { - int32 dummyLength; + int32_t dummyLength; TSTRING read_str((TCHAR*)iter.GetData(dummyLength)); TEST(read_str == g_block_data); } diff --git a/src/twtest/keyfile_t.cpp b/src/twtest/keyfile_t.cpp index 23fc7a2..9a03957 100644 --- a/src/twtest/keyfile_t.cpp +++ b/src/twtest/keyfile_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -59,7 +59,7 @@ void TestKeyFile() d.TraceDebug("Generating keys...\n"); std::string s = "haybaby"; - keyfile.GenerateKeys(cElGamalSig::KEY1024, (int8*)s.data(), 7); + keyfile.GenerateKeys(cElGamalSig::KEY1024, (int8_t*)s.data(), 7); char plaintext[9000]; char ciphertext[9000]; @@ -74,7 +74,7 @@ void TestKeyFile() TEST(elGamal.GetBlockSizeCipher() < 9000); std::string s = "haybaby"; cPrivateKeyProxy key; - TEST(key.AquireKey(keyfile, (int8*)s.data(), 7)); + TEST(key.AquireKey(keyfile, (int8_t*)s.data(), 7)); elGamal.SetSigning(key.GetKey()); elGamal.ProcessBlock(plaintext, ciphertext); } @@ -94,7 +94,7 @@ void TestKeyFile() // save to and read from memory d.TraceDebug("Read/Write to memory...\n"); { - int8* pMem = new int8[keyfile.GetWriteLen()]; + int8_t* pMem = new int8_t[keyfile.GetWriteLen()]; keyfile.WriteMem(pMem); cKeyFile keyfile2; diff --git a/src/twtest/platform_t.cpp b/src/twtest/platform_t.cpp index f3dfbef..b00a0c7 100644 --- a/src/twtest/platform_t.cpp +++ b/src/twtest/platform_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -62,20 +62,20 @@ template bool CanBeRepresentedAs(E e, T t); // Constructing this class will write to a memory location // offset by ALIGN_SIZE. If it chokes, you'll get a bus error -template class AlignMe +template class AlignMe { public: AlignMe(); private: - byte a[sizeof(int64) + ALIGN_SIZE]; // we want to be able to access a int64 at address [ALIGN_SIZE] + uint8_t a[sizeof(T) + ALIGN_SIZE + 1]; // we want to be able to access a T at address [ALIGN_SIZE] }; ///////////////////////////////////////////////////////// // TEMPLATIZED UTIL CLASSES IMPLEMENTATIONS ///////////////////////////////////////////////////////// -template AlignMe::AlignMe() +template AlignMe::AlignMe() { // HP-UX does not play your silly alignment games, at least unless you // first invoke something called "allow_unaligned_data_access()", which @@ -83,45 +83,42 @@ template AlignMe::AlignMe() // to have any need for that behavior, which begs the question of why // this test exists in the first place. // -bcox -#if (!IS_HPUX && !IS_SOLARIS) //Turns out Solaris SPARC is unhappy with this test too, btw +//Turns out Solaris SPARC is unhappy with this test too, btw +#if ENABLE_ALIGNMENT_TEST //TCOUT << _T("Testing alignment of size ") << ALIGN_SIZE << std::endl; - // access a double in the byte array to see if it is aligned. if it isn't and the CPU + // access a value in the byte array to see if it is aligned. if it isn't and the CPU // can't handle it, you'll get a bus error // this should choke if the CPU can't // handle misaligned memory access - int32* pi = (int32*)&a[ALIGN_SIZE]; - //TCOUT << _T("Testing alignment of an int32...") << std::endl; - //TCOUT << _T("Reading...") << std::endl; - int32 i = *pi; // access memory for read - //TCOUT << _T("Read succeeded.") << std::endl; - //TCOUT << _T("Writing...") << std::endl; - *pi = i; // access memory for write - TCOUT << _T("Write succeeded.") << std::endl; - - - // this should choke if the CPU can't - // handle misaligned memory access - int64* pb = (int64*)&a[ALIGN_SIZE]; - //TCOUT << _T("Testing alignment of an int64...") << std::endl; - //TCOUT << _T("Reading...") << std::endl; - int64 I = *pb; // access memory for read - //TCOUT << _T("Read succeeded") << std::endl; - //TCOUT << _T("Writing...") << std::endl; - *pb = I; // access memory for write - //TCOUT << _T("Write succeeded.") << std::endl; - - - /*TCOUT << _T("Alignment of ") << ALIGN_SIZE << _T(" ") << ( ALIGN_SIZE == 1 ? _T("byte") : _T("bytes") ) << _T(" is OK") << std::endl - << _T("=========================================\n"); */ - - TEST("Aligned"); // The actual test is not bus erroring up above; this just tells the framework we tested something. - + memset(a, 0, sizeof(T) + ALIGN_SIZE + 1); + + T* valuePtr = (T*)&a[ALIGN_SIZE]; + TEST(*valuePtr == 0); + + T value = *valuePtr; // access memory for read + TEST(value == 0); + + *valuePtr = value; // access memory for write + TEST(*valuePtr == 0); #endif } +template +void testAlignmentForType() +{ + AlignMe a128; + AlignMe a64; + AlignMe a32; + AlignMe a16; + AlignMe a8; + AlignMe a4; + AlignMe a2; + AlignMe a1; +} + ///////////////////////////////////////////////////////// // UTIL FUNCTIONS ///////////////////////////////////////////////////////// @@ -135,16 +132,18 @@ void TestAlignment() // TCOUT << _T("Testing for byte alignment\n") // << _T("=========================================\n"); + testAlignmentForType(); + testAlignmentForType(); + testAlignmentForType(); - AlignMe<128> a128; - AlignMe<64> a64; - AlignMe<32> a32; - AlignMe<16> a16; - AlignMe<8> a8; - AlignMe<4> a4; - AlignMe<2> a2; - AlignMe<1> a1; + testAlignmentForType(); + testAlignmentForType(); + testAlignmentForType(); +} + +void TestAlignment2() +{ // - - - - - - - - - - - - - - - - - - - - - - // test a misaligned memory access -- if this // chokes, your CPU can't handle such accesses @@ -152,7 +151,7 @@ void TestAlignment() // such accesses: it may have handled the // hardware interrupt that might have occured. // - - - - - - - - - - - - - - - - - - - - - - - byte a[sizeof(int32) + sizeof(byte)]; + uint8_t a[sizeof(int32_t) + sizeof(uint8_t)]; // this should be fine a[0] = 0xAB; @@ -165,7 +164,7 @@ void TestAlignment() // this should choke if the CPU can't // handle misaligned memory access - int32* pi = (int32*)&a[1]; + int32_t* pi = (int32_t*)&a[1]; *pi = *pi; // misaligned access (read and write) TCOUT << _T("Misaligned access OK.") << std::endl; @@ -177,7 +176,7 @@ void TestAlignment() // if it works, then our BYTE_ALIGN value is large enough // - - - - - - - - - - - - - - - - - - - - - - - byte b[2 * sizeof(BYTE_ALIGN)]; + uint8_t b[2 * sizeof(BYTE_ALIGN)]; // this should be fine b[0] = 0xAB; @@ -190,7 +189,7 @@ void TestAlignment() */ // this should choke if the CPU can't // handle misaligned memory access - pi = (int32*)&b[BYTE_ALIGN]; + pi = (int32_t*)&b[BYTE_ALIGN]; *pi = *pi; // aligned (hopefully) access (read and write) /* TCOUT << _T("Aligned access OK. BYTE_ALIGN value of ") << BYTE_ALIGN << _T(" is good.") << std::endl; @@ -198,22 +197,23 @@ void TestAlignment() TEST("BYTE_ALIGN ok"); // yet again, the test is not falling over a couple of lines up. */ } +#if !ARCHAIC_STL // Not sure this is a super valuable test, since it just verifies that builtin integer types // work the way we think they do. void TestSizes() { - TEST(CanBeRepresentedAs(int8(), int8())); - TEST(!CanBeRepresentedAs(int8(), uint8())); - TEST(!CanBeRepresentedAs(uint8(), int8())); - TEST(CanBeRepresentedAs(uint8(), uint8())); + TEST(CanBeRepresentedAs(int8_t(), int8_t())); + TEST(!CanBeRepresentedAs(int8_t(), uint8_t())); + TEST(!CanBeRepresentedAs(uint8_t(), int8_t())); + TEST(CanBeRepresentedAs(uint8_t(), uint8_t())); - TEST(CanBeRepresentedAs(int8(), int16())); - TEST(CanBeRepresentedAs(int16(), int32())); - TEST(CanBeRepresentedAs(int32(), int64())); + TEST(CanBeRepresentedAs(int8_t(), int16_t())); + TEST(CanBeRepresentedAs(int16_t(), int32_t())); + TEST(CanBeRepresentedAs(int32_t(), int64_t())); - TEST(CanBeRepresentedAs(uint8(), uint16())); - TEST(CanBeRepresentedAs(uint16(), uint32())); - TEST(CanBeRepresentedAs(uint32(), uint64())); + TEST(CanBeRepresentedAs(uint8_t(), uint16_t())); + TEST(CanBeRepresentedAs(uint16_t(), uint32_t())); + TEST(CanBeRepresentedAs(uint32_t(), uint64_t())); } ///////////////////////////////////////////////////////// @@ -232,92 +232,14 @@ template bool CanBeRepresentedAs(E e, T t) return fReturn; } - +#endif //////////////////////////// - -#if IS_LINUX -const TSTRING expected_os("Linux"); -#elif IS_DARWIN -const TSTRING expected_os("Darwin"); -#elif IS_CYGWIN -const TSTRING expected_os("Cygwin"); -#elif IS_DOS_DJGPP -const TSTRING expected_os("FreeDOS"); // This will likely fail for other DOS flavors -#elif IS_ANDROID -const TSTRING expected_os("Android"); -#elif IS_DRAGONFLYBSD -const TSTRING expected_os("DragonFly"); -#elif IS_MIDNIGHTBSD -const TSTRING expected_os("MidnightBSD"); -#elif IS_FREEBSD -const TSTRING expected_os("FreeBSD"); -#elif IS_NETBSD -const TSTRING expected_os("NetBSD"); -#elif IS_MIRBSD -const TSTRING expected_os("MirBSD"); -#elif IS_BITRIG -const TSTRING expected_os("Bitrig"); -#elif IS_LIBERTYBSD -const TSTRING expected_os("LibertyBSD"); -#elif IS_OPENBSD -const TSTRING expected_os("OpenBSD"); -#elif IS_SOLARIS -const TSTRING expected_os("SunOS"); -#elif IS_AIX -const TSTRING expected_os("AIX"); -#elif IS_HPUX -const TSTRING expected_os("HP-UX"); -#elif IS_IRIX -const TSTRING expected_os("IRIX"); -#elif IS_OSF1 -const TSTRING expected_os("Tru64"); -#elif IS_MINIX -const TSTRING expected_os("Minix"); -#elif IS_HURD -const TSTRING expected_os("GNU"); -#elif IS_HAIKU -const TSTRING expected_os("Haiku"); -#elif IS_SYLLABLE -const TSTRING expected_os("Syllable"); -#elif IS_SKYOS -const TSTRING expected_os("SkyOS"); -#elif IS_SORTIX -const TSTRING expected_os("Sortix"); -#elif IS_MINT -const TSTRING expected_os("MiNT"); -#elif IS_AROS -const TSTRING expected_os("AROS"); -#elif IS_RTEMS -const TSTRING expected_os("RTEMS"); -#elif IS_RISCOS -const TSTRING expected_os("RISC OS"); -#elif IS_RISCOS -const TSTRING expected_os("Redox"); -#elif IS_QNX -const TSTRING expected_os("QNX"); -#else -const TSTRING expected_os("?!?!?"); -#endif - -void TestPlatformDetection() -{ -#if HAVE_SYS_UTSNAME_H - struct utsname os_info; - TEST(uname(&os_info) == 0); - - TSTRING observed_os(os_info.sysname); - - if (observed_os != expected_os) - TCERR << "Expected OS: " << expected_os << " | Observed OS: " << observed_os << std::endl; - - TEST(observed_os == expected_os); -#endif -} - void RegisterSuite_Platform() { - RegisterTest("Platform", "Alignment", TestAlignment); - RegisterTest("Platform", "Sizes", TestSizes); - RegisterTest("Platform", "PlatformDetection", TestPlatformDetection); + RegisterTest("Platform", "Alignment", TestAlignment); + RegisterTest("Platform", "Alignment2", TestAlignment2); +#if !ARCHAIC_STL + RegisterTest("Platform", "Sizes", TestSizes); +#endif } diff --git a/src/twtest/policyparser_t.cpp b/src/twtest/policyparser_t.cpp index a72eab7..d24fe51 100644 --- a/src/twtest/policyparser_t.cpp +++ b/src/twtest/policyparser_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/refcountobj_t.cpp b/src/twtest/refcountobj_t.cpp index 66a8b3e..5006486 100644 --- a/src/twtest/refcountobj_t.cpp +++ b/src/twtest/refcountobj_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -48,7 +48,7 @@ private: virtual ~cRefCountTestObj(); std::list mChildren; - int8* mpSomeMem; + int8_t* mpSomeMem; }; cRefCountTestObj::cRefCountTestObj() @@ -56,7 +56,7 @@ cRefCountTestObj::cRefCountTestObj() // allocate some mem that should be caught // by the memory manager if this object does not // get destructed. - mpSomeMem = new int8[10]; + mpSomeMem = new int8_t[10]; } cRefCountTestObj::~cRefCountTestObj() diff --git a/src/twtest/resources_t.cpp b/src/twtest/resources_t.cpp index 7b31e96..eb6c1a9 100644 --- a/src/twtest/resources_t.cpp +++ b/src/twtest/resources_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/serializer_t.cpp b/src/twtest/serializer_t.cpp index 3a14184..159a7f6 100644 --- a/src/twtest/serializer_t.cpp +++ b/src/twtest/serializer_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -54,7 +54,7 @@ public: cSerTestObject(); // iSerializable interface - virtual void Read(iSerializer* pSerializer, int32 version = 0) + virtual void Read(iSerializer* pSerializer, int32_t version = 0) { } virtual void Write(iSerializer* pSerializer) const diff --git a/src/twtest/serializerimpl_t.cpp b/src/twtest/serializerimpl_t.cpp index f6deb84..609fac8 100644 --- a/src/twtest/serializerimpl_t.cpp +++ b/src/twtest/serializerimpl_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -47,14 +47,14 @@ public: cSerializerTestObject(); // iSerializable interface - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) bool CheckValid(); private: int mNumber; - byte mData[20]; + uint8_t mData[20]; TSTRING mString; }; @@ -83,7 +83,7 @@ bool cSerializerTestObject::CheckValid() return true; } -void cSerializerTestObject::Read(iSerializer* pSerializer, int32 version) +void cSerializerTestObject::Read(iSerializer* pSerializer, int32_t version) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("cSerializerTestObject::Read()"))); @@ -92,7 +92,7 @@ void cSerializerTestObject::Read(iSerializer* pSerializer, int32 version) mNumber = 0; memset(mData, 0, 20); mString.erase(); - int32 number; + int32_t number; pSerializer->ReadInt32(number); pSerializer->ReadBlob(mData, 20); pSerializer->ReadString(mString); diff --git a/src/twtest/signature_t.cpp b/src/twtest/signature_t.cpp index f047cbf..f1efd9c 100644 --- a/src/twtest/signature_t.cpp +++ b/src/twtest/signature_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -76,10 +76,10 @@ void TestSignatureBasic() cCRC32Signature crcSig; cDebug d("TestSignature1"); - byte abData[64]; + uint8_t abData[64]; int i; for (i = 0; i < 64; i++) - abData[i] = static_cast(rand()); + abData[i] = static_cast(rand()); crcSig.Init(); crcSig.Update(&abData[0], 32); @@ -103,275 +103,95 @@ void TestSignatureBasic() // TEST(nullSig.Compare(&checksumSig, iFCOProp::OP_EQ) == iFCOProp::CMP_WRONG_PROP_TYPE); -void TestChecksum() +template +void testSignature(const TSTRING& sigFileName, const TSTRING& expectedBase64, const TSTRING& expectedHex) { - TSTRING sigFileName = getTestFile(); cFileArchive fileArc; - cDebug d("TestChecksum"); - // test begins here + cDebug d("testSignature"); // general signature & archive variables - byte abBuf[iSignature::SUGGESTED_BLOCK_SIZE]; + uint8_t abBuf[iSignature::SUGGESTED_BLOCK_SIZE] = {0}; const int cbToRead = iSignature::SUGGESTED_BLOCK_SIZE; - int cbRead; - + int cbRead =0; // test checksum - cChecksumSignature check1, check2; - d.TraceDetail("Testing checksum.\n"); + T sig1, sig2; + d.TraceDetail("Testing signature...\n"); - // check1 + // sig1 fileArc.OpenRead(sigFileName.c_str()); - check1.Init(); + sig1.Init(); do { cbRead = fileArc.ReadBlob(abBuf, cbToRead); - check1.Update(abBuf, cbRead); + sig1.Update(abBuf, cbRead); } while (cbRead == cbToRead); - check1.Finit(); + sig1.Finit(); fileArc.Close(); - // check2 + // sig2 fileArc.OpenRead(sigFileName.c_str()); - check2.Init(); + sig2.Init(); do { cbRead = fileArc.ReadBlob(abBuf, cbToRead); - check2.Update(abBuf, cbRead); + sig2.Update(abBuf, cbRead); } while (cbRead == cbToRead); - check2.Finit(); + sig2.Finit(); fileArc.Close(); // compare to each other and the known values - TEST(check1.Compare(&check2, iFCOProp::OP_EQ) == iFCOProp::CMP_TRUE); - TEST(check1.AsString().compare(_T("AAAAAAAAAAt")) == 0); + TEST(sig1.Compare(&sig2, iFCOProp::OP_EQ) == iFCOProp::CMP_TRUE); + if (!expectedBase64.empty()) + { + TEST(sig1.AsString().compare(expectedBase64) == 0); + } + if (!expectedHex.empty()) + { + TEST(sig1.AsStringHex().compare(expectedHex) == 0); + } // test write capabilities { cMemoryArchive sigArchive; cSerializerImpl writeSer(sigArchive, cSerializerImpl::S_WRITE); - check1.Write(&writeSer); + sig1.Write(&writeSer); sigArchive.Seek(0, cBidirArchive::BEGINNING); cSerializerImpl readSer(sigArchive, cSerializerImpl::S_READ); - check2.Read(&readSer); - TEST(check1.Compare(&check2, iFCOProp::OP_EQ) == iFCOProp::CMP_TRUE); + sig2.Read(&readSer); + TEST(sig1.Compare(&sig2, iFCOProp::OP_EQ) == iFCOProp::CMP_TRUE); } } +void TestChecksum() +{ + testSignature(getTestFile(), _T("AAAAAAAAAAt"), _T("")); +} + void TestCRC32() { - TSTRING sigFileName = getTestFile(); - cFileArchive fileArc; - cDebug d("TestCRC32"); - - // general signature & archive variables - byte abBuf[iSignature::SUGGESTED_BLOCK_SIZE]; - const int cbToRead = iSignature::SUGGESTED_BLOCK_SIZE; - int cbRead; - - // test CRC32 - cCRC32Signature crc1, crc2; - d.TraceDetail("Testing CRC32.\n"); - - // crc1 - fileArc.OpenRead(sigFileName.c_str()); - crc1.Init(); - do - { - cbRead = fileArc.ReadBlob(abBuf, cbToRead); - crc1.Update(abBuf, cbRead); - } while (cbRead == cbToRead); - crc1.Finit(); - fileArc.Close(); - - // crc2 - fileArc.OpenRead(sigFileName.c_str()); - crc2.Init(); - do - { - cbRead = fileArc.ReadBlob(abBuf, cbToRead); - crc2.Update(abBuf, cbRead); - } while (cbRead == cbToRead); - crc2.Finit(); - fileArc.Close(); - - // compare to each other and the known values - TEST(crc1.Compare(&crc2, iFCOProp::OP_EQ) == iFCOProp::CMP_TRUE); - TEST(crc1.AsString().compare(_T("B1kP9v")) == 0); - TEST(crc1.AsStringHex().compare(_T("7590ff6f")) == 0); - - // test write capabilities - { - cMemoryArchive sigArchive; - cSerializerImpl writeSer(sigArchive, cSerializerImpl::S_WRITE); - crc1.Write(&writeSer); - sigArchive.Seek(0, cBidirArchive::BEGINNING); - cSerializerImpl readSer(sigArchive, cSerializerImpl::S_READ); - crc2.Read(&readSer); - TEST(crc1.Compare(&crc2, iFCOProp::OP_EQ) == iFCOProp::CMP_TRUE); - } + testSignature(getTestFile(), _T("B1kP9v"), _T("7590ff6f")); } void TestMD5() { - TSTRING sigFileName = getTestFile(); - cFileArchive fileArc; - cDebug d("TestMD5"); - - // general signature & archive variables - byte abBuf[iSignature::SUGGESTED_BLOCK_SIZE]; - const int cbToRead = iSignature::SUGGESTED_BLOCK_SIZE; - int cbRead; - - // test MD5 - cMD5Signature md51, md52; - d.TraceDetail("Testing MD5.\n"); - - // md51 - fileArc.OpenRead(sigFileName.c_str()); - md51.Init(); - do - { - cbRead = fileArc.ReadBlob(abBuf, cbToRead); - md51.Update(abBuf, cbRead); - } while (cbRead == cbToRead); - md51.Finit(); - fileArc.Close(); - - // md52 - fileArc.OpenRead(sigFileName.c_str()); - md52.Init(); - do - { - cbRead = fileArc.ReadBlob(abBuf, cbToRead); - md52.Update(abBuf, cbRead); - } while (cbRead == cbToRead); - md52.Finit(); - fileArc.Close(); - - // compare to each other and the known values - TEST(md51.Compare(&md52, iFCOProp::OP_EQ) == iFCOProp::CMP_TRUE); - TEST(md51.AsString().compare(_T("B/Y8ttBnlyw/NPCUu353ao")) == 0); - TEST(md51.AsStringHex().compare(_T("7f63cb6d067972c3f34f094bb7e776a8")) == 0); - - // test write capabilities - { - cMemoryArchive sigArchive; - cSerializerImpl writeSer(sigArchive, cSerializerImpl::S_WRITE); - md51.Write(&writeSer); - sigArchive.Seek(0, cBidirArchive::BEGINNING); - cSerializerImpl readSer(sigArchive, cSerializerImpl::S_READ); - md52.Read(&readSer); - TEST(md51.Compare(&md52, iFCOProp::OP_EQ) == iFCOProp::CMP_TRUE); - } + testSignature(getTestFile(), + _T("B/Y8ttBnlyw/NPCUu353ao"), + _T("7f63cb6d067972c3f34f094bb7e776a8")); } void TestSHA1() { - TSTRING sigFileName = getTestFile(); - cFileArchive fileArc; - cDebug d("TestSHA1"); - - // general signature & archive variables - byte abBuf[iSignature::SUGGESTED_BLOCK_SIZE]; - const int cbToRead = iSignature::SUGGESTED_BLOCK_SIZE; - int cbRead; - - // test SHA - cSHASignature sha1, sha2; - d.TraceDetail("Testing SHA.\n"); - - // sha1 - fileArc.OpenRead(sigFileName.c_str()); - sha1.Init(); - do - { - cbRead = fileArc.ReadBlob(abBuf, cbToRead); - sha1.Update(abBuf, cbRead); - } while (cbRead == cbToRead); - sha1.Finit(); - fileArc.Close(); - - // sha2 - fileArc.OpenRead(sigFileName.c_str()); - sha2.Init(); - do - { - cbRead = fileArc.ReadBlob(abBuf, cbToRead); - sha2.Update(abBuf, cbRead); - } while (cbRead == cbToRead); - sha2.Finit(); - fileArc.Close(); - - // compare to each other and the known values - TEST(sha1.Compare(&sha2, iFCOProp::OP_EQ) == iFCOProp::CMP_TRUE); - TEST(sha1.AsString().compare(_T("Oia1aljHD793tfj7M55tND+3OG/")) == 0); - TEST(sha1.AsStringHex().compare(_T("e89ad5a9631c3efdded7e3ecce79b4d0fedce1bf")) == 0); - - // test write capabilities - { - cMemoryArchive sigArchive; - cSerializerImpl writeSer(sigArchive, cSerializerImpl::S_WRITE); - sha1.Write(&writeSer); - sigArchive.Seek(0, cBidirArchive::BEGINNING); - cSerializerImpl readSer(sigArchive, cSerializerImpl::S_READ); - sha2.Read(&readSer); - TEST(sha1.Compare(&sha2, iFCOProp::OP_EQ) == iFCOProp::CMP_TRUE); - } + testSignature(getTestFile(), + _T("Oia1aljHD793tfj7M55tND+3OG/"), + _T("e89ad5a9631c3efdded7e3ecce79b4d0fedce1bf")); } void TestHAVAL() { - TSTRING sigFileName = getTestFile(); - cFileArchive fileArc; - cDebug d("TestHAVAL"); - - // general signature & archive variables - byte abBuf[iSignature::SUGGESTED_BLOCK_SIZE]; - const int cbToRead = iSignature::SUGGESTED_BLOCK_SIZE; - int cbRead; - - // test HAVAL - cHAVALSignature haval1, haval2; - d.TraceDetail("Testing HAVAL.\n"); - - // haval1 - fileArc.OpenRead(sigFileName.c_str()); - haval1.Init(); - do - { - cbRead = fileArc.ReadBlob(abBuf, cbToRead); - haval1.Update(abBuf, cbRead); - } while (cbRead == cbToRead); - haval1.Finit(); - fileArc.Close(); - - // haval2 - fileArc.OpenRead(sigFileName.c_str()); - haval2.Init(); - do - { - cbRead = fileArc.ReadBlob(abBuf, cbToRead); - haval2.Update(abBuf, cbRead); - } while (cbRead == cbToRead); - haval2.Finit(); - fileArc.Close(); - - // compare to each other and the known values - TEST(haval1.Compare(&haval2, iFCOProp::OP_EQ) == iFCOProp::CMP_TRUE); - TEST(haval1.AsString().compare(_T("BL6bFSo0EP5zf8lGSueeed")) == 0); - TEST(haval1.AsStringHex().compare(_T("4be9b152a3410fe737fc9464ae79e79d")) == 0); - - // test write capabilities - { - cMemoryArchive sigArchive; - cSerializerImpl writeSer(sigArchive, cSerializerImpl::S_WRITE); - haval1.Write(&writeSer); - sigArchive.Seek(0, cBidirArchive::BEGINNING); - cSerializerImpl readSer(sigArchive, cSerializerImpl::S_READ); - haval2.Read(&readSer); - TEST(haval1.Compare(&haval2, iFCOProp::OP_EQ) == iFCOProp::CMP_TRUE); - } + testSignature(getTestFile(), + _T("BL6bFSo0EP5zf8lGSueeed"), + _T("4be9b152a3410fe737fc9464ae79e79d")); } void TestArchiveSigGen() @@ -412,28 +232,27 @@ void TestArchiveSigGen() fileArc.Close(); } -void assertMD5(const std::string& source, const std::string& expectedHex) +template +void assertSignature(const std::string& source, const std::string& expectedHex) { // Signature usage example (?) - cMD5Signature md5Sig; + T signature; - md5Sig.Init(); - md5Sig.Update((const byte*)source.c_str(), source.length()); - md5Sig.Finit(); + signature.Init(); + signature.Update((const uint8_t*)source.c_str(), source.length()); + signature.Finit(); - TEST(md5Sig.AsStringHex() == expectedHex); + TEST(signature.AsStringHex() == expectedHex); +} + +void assertMD5(const std::string& source, const std::string& expectedHex) +{ + assertSignature(source, expectedHex); } void assertSHA1(const std::string& source, const std::string& expectedHex) { - // Signature usage example (?) - cSHASignature shaSig; - - shaSig.Init(); - shaSig.Update((const byte*)source.c_str(), source.length()); - shaSig.Finit(); - - TEST(shaSig.AsStringHex() == expectedHex); + assertSignature(source, expectedHex); } diff --git a/src/twtest/srefcountobj_t.cpp b/src/twtest/srefcountobj_t.cpp index 624f293..9195bfe 100644 --- a/src/twtest/srefcountobj_t.cpp +++ b/src/twtest/srefcountobj_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -53,7 +53,7 @@ protected: ~cSerRefCountObjTest(); // iSerializable interface - virtual void Read(iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) + virtual void Read(iSerializer* pSerializer, int32_t version = 0); // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) private: @@ -73,12 +73,12 @@ cSerRefCountObjTest::~cSerRefCountObjTest() } -void cSerRefCountObjTest::Read(iSerializer* pSerializer, int32 version) +void cSerRefCountObjTest::Read(iSerializer* pSerializer, int32_t version) { if (version > Version()) ThrowAndAssert(eSerializerVersionMismatch(_T("cSerRefCountObjTest::Read()"))); - int32 dummy; + int32_t dummy; pSerializer->ReadInt32(dummy); mDummyData = dummy; } diff --git a/src/twtest/stdtest.cpp b/src/twtest/stdtest.cpp index 8559247..624e1d7 100644 --- a/src/twtest/stdtest.cpp +++ b/src/twtest/stdtest.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/stdtest.h b/src/twtest/stdtest.h index 7339e7a..55fb080 100644 --- a/src/twtest/stdtest.h +++ b/src/twtest/stdtest.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/stringencoder_t.cpp b/src/twtest/stringencoder_t.cpp index b289751..f0b8ed9 100644 --- a/src/twtest/stringencoder_t.cpp +++ b/src/twtest/stringencoder_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/stringutil_t.h b/src/twtest/stringutil_t.h index 1751978..d2ecedf 100644 --- a/src/twtest/stringutil_t.h +++ b/src/twtest/stringutil_t.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -41,6 +41,9 @@ #ifndef __STRINGUTIL_T_H # define __STRINGUTIL_T_H +#include "core/platform.h" +#include "core/tchar.h" + #include "core/ntmbs.h" #include "core/ntdbs.h" @@ -81,7 +84,9 @@ inline void TestStringUtil() TEST(b.size() == 0); a.resize(3); +#if !ARCHAIC_STL TEST(a.c_str() != b.c_str()); +#endif TEST(std::equal(a.begin(), a.end(), NTDBS1)); TEST(std::equal(b.begin(), b.end(), NTDBS1)); diff --git a/src/twtest/tasktimer_t.cpp b/src/twtest/tasktimer_t.cpp index 1cac9d3..a3c4f1a 100644 --- a/src/twtest/tasktimer_t.cpp +++ b/src/twtest/tasktimer_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/tchar_t.cpp b/src/twtest/tchar_t.cpp index bfffa4a..8ee0310 100644 --- a/src/twtest/tchar_t.cpp +++ b/src/twtest/tchar_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -74,9 +74,19 @@ void TestTCHAR() TSTRING test1 = _T("word"); d.TraceDetail("Testing TOSTRINGSTREAM with TSTRING:\n"); + +#if !ARCHAIC_STL TOSTRINGSTREAM ost(_T("test up")); +#else + TOSTRINGSTREAM ost; + ost << _T("test up"); +#endif ost << test1; - d.TraceDetail("%s \n", ost.str().c_str()); + + tss_mkstr(out, ost); + + d.TraceDetail("%s \n", out.c_str()); + //if this gives output, then I'm really baffled... //test gets overwritten, yielding "word up" @@ -89,7 +99,10 @@ void TestTCHAR() TSTRING send = _T("These should appear on separate lines"); test_wist(send, d); //Did they? +} +void TestFstreams() +{ //Testing file streams //explict constructors of 'TIFSTREAM' and "TOFSTREAM' take char* @@ -98,16 +111,16 @@ void TestTCHAR() //Set up the input file. TOFSTREAM out; - out.open(inputfile.c_str(), std::ios_base::out); + out.open(inputfile.c_str(), std::ios::out); out << "Unicode is fun\n"; out.close(); TIFSTREAM from; - from.open(inputfile.c_str(), std::ios_base::in); + from.open(inputfile.c_str(), std::ios::in); TEST(from); - TOFSTREAM to(outputfile.c_str(), std::ios_base::trunc); + TOFSTREAM to(outputfile.c_str(), std::ios::trunc); TEST(to); //Copy contents of input file to output file. @@ -120,9 +133,15 @@ void TestTCHAR() return; } + TSTRING test_wost(int n, const TSTRING& inject) { +#if !ARCHAIC_STL TOSTRINGSTREAM wost(_T("Weird how this doesn't show up! ")); +#else + TOSTRINGSTREAM wost; + wost << _T("Weird how this doesn't show up! "); +#endif //It's getting overwritten, why? wost << _T("One out of every ") << n << _T(" children loves ") << inject << _T("!\n"); return wost.str(); @@ -130,7 +149,12 @@ TSTRING test_wost(int n, const TSTRING& inject) void test_wist(const TSTRING& input, cDebug& d) { +#if !ARCHAIC_STL TISTRINGSTREAM wist(input); +#else + TSTRINGSTREAM wist; + wist << input; +#endif TSTRING parse; while (wist >> parse) d.TraceDetail("%s \n", parse.c_str()); @@ -139,4 +163,7 @@ void test_wist(const TSTRING& input, cDebug& d) void RegisterSuite_TCHAR() { RegisterTest("TCHAR", "Basic", TestTCHAR); +#if !ARCHAIC_STL + RegisterTest("TCHAR", "FStreams", TestFstreams); +#endif } diff --git a/src/twtest/test.cpp b/src/twtest/test.cpp index 7bfb9b7..61da351 100644 --- a/src/twtest/test.cpp +++ b/src/twtest/test.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -216,7 +216,7 @@ static void RunTest(const std::string& suiteName, const std::string& testName, T { TCERR << "SKIPPED: " << e.what() << std::endl; - std::stringstream sstr; + TSTRINGSTREAM sstr; sstr << "Test " << suiteName << "/" << testName << ": " << e.what(); skipped_strings.push_back(sstr.str()); @@ -227,7 +227,7 @@ static void RunTest(const std::string& suiteName, const std::string& testName, T TCERR << "FAILED: "; cTWUtil::PrintErrorMsg(error); - std::stringstream sstr; + TSTRINGSTREAM sstr; sstr << "Test " << suiteName << "/" << testName << ": " << error.GetMsg(); error_strings.push_back(sstr.str()); @@ -237,7 +237,7 @@ static void RunTest(const std::string& suiteName, const std::string& testName, T { TCERR << "FAILED: " << e.what() << std::endl; - std::stringstream sstr; + TSTRINGSTREAM sstr; sstr << "Test " << suiteName << "/" << testName << ": " << e.what(); error_strings.push_back(sstr.str()); @@ -247,9 +247,11 @@ static void RunTest(const std::string& suiteName, const std::string& testName, T { TCERR << "FAILED: " << std::endl; - std::stringstream sstr; + TSTRINGSTREAM sstr; sstr << "Test " << suiteName << "/" << testName << ": "; error_strings.push_back(sstr.str()); + + failed_count++; } } @@ -385,7 +387,7 @@ std::string TwTestDir() iFSServices::GetInstance()->GetCurrentDir(dir); dir.append("/TWTestData"); TCERR << "Using test directory: " << dir << std::endl; - mkdir(dir.c_str(), 0777); + tw_mkdir(dir.c_str(), 0777); } return dir; @@ -393,12 +395,13 @@ std::string TwTestDir() std::string TwTestPath(const std::string& child) { - std::stringstream sstr; + TOSTRINGSTREAM sstr; sstr << TwTestDir(); if (child[0] != '/') sstr << '/'; sstr << child; - return sstr.str(); + + tss_return_stream(sstr, out); } /////////////////////////////////////////////////////////////////////////////// @@ -431,11 +434,13 @@ void tw_terminate_handler() exit(1); } +#if USE_UNEXPECTED void tw_unexpected_handler() { fputs("### Internal Error.\n### Unexpected Exception Handler called.\n### Exiting...\n", stderr); exit(1); } +#endif int _tmain(int argc, TCHAR** argv) { @@ -449,8 +454,9 @@ int _tmain(int argc, TCHAR** argv) try { EXCEPTION_NAMESPACE set_terminate(tw_terminate_handler); +#if USE_UNEXPECTED EXCEPTION_NAMESPACE set_unexpected(tw_unexpected_handler); - +#endif if (argc < 2) { Usage(); @@ -469,7 +475,6 @@ int _tmain(int argc, TCHAR** argv) RegisterSuites(); std::string arg1 = argv[1]; - if (arg1 == "all" || arg1 == "--all") { RunAllTests(); @@ -498,22 +503,19 @@ int _tmain(int argc, TCHAR** argv) catch (eError& error) { cTWUtil::PrintErrorMsg(error); - ASSERT(false); - return 1; + failed_count++; } catch (std::exception& error) { TCERR << "Caught std::exception: " << error.what() << std::endl; - ASSERT(false); - return 1; + failed_count++; } catch (...) { TCERR << _T("Unhandled exception caught!"); - ASSERT(false); - return 1; + failed_count++; } - + // make sure all the reference counted objects have been destroyed // this test always fails because of the static cFCONameTbl //TEST(cRefCountObj::AllRefCountObjDestoryed() == true); diff --git a/src/twtest/test.h b/src/twtest/test.h index 0c43423..b4a14dc 100644 --- a/src/twtest/test.h +++ b/src/twtest/test.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -92,5 +92,16 @@ void RegisterTest(const std::string& suite, const std::string testName, TestPtr void skip(const std::string& reason); void fail(const std::string& reason); +//////////////////////////////////////////////////////////////////////////// + +// Misc platform utility stuff available for all tests + +// Could use AX_FUNC_MKDIR autoconf macro if we need to handle +// any additional cases besides these +#if MKDIR_TAKES_SINGLE_ARG +# define tw_mkdir(a,b) mkdir(a) +#else +# define tw_mkdir(a,b) mkdir(a,b) +#endif #endif // __TEST_H diff --git a/src/twtest/textreportviewer_t.cpp b/src/twtest/textreportviewer_t.cpp index 8642dac..58a5605 100644 --- a/src/twtest/textreportviewer_t.cpp +++ b/src/twtest/textreportviewer_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -62,6 +62,7 @@ void MakeFile(TSTRING& fcoNameMakeMe); void MakeDir(const TCHAR* const lpszDirName); +#if 0 // Not used untill this test is fixed // we use this instead of TraceContents() so we can test the report iterators. static void TraceReport(const cFCOReport& r, cDebug& d) { @@ -105,6 +106,7 @@ static void TraceReport(const cFCOReport& r, cDebug& d) } } } +#endif /* // @@ -149,14 +151,14 @@ void TestTextReportViewer() fcoNameSpec1 = fcoNameTempDir += _T("SPEC1/"); fcoNameSpec2 = fcoNameTempDir += _T("SPEC2/"); - mkdir( fcoNameTempDir.c_str(), 0777 ); - mkdir( fcoNameSpec1.AsString().c_str(), 0777 ); - mkdir( fcoNameSpec2.AsString().c_str(), 0777 ); + tw_mkdir( fcoNameTempDir.c_str(), 0777 ); + tw_mkdir( fcoNameSpec1.AsString().c_str(), 0777 ); + tw_mkdir( fcoNameSpec2.AsString().c_str(), 0777 ); fcoNameTempFile = fcoNameTempDir += _T("twtempXXXXXX"); pFSServices->MakeTempFilename( fcoNameTempFile ); } - catch(eFSServices& /* e */) + catch(const eFSServices& /* e */) { // TODO: properly handle error TEST( false ); @@ -459,7 +461,7 @@ void MakeFile(TSTRING& strNameMakeMe) TEST(file); file.close(); } - catch (eFSServices e) + catch (const eFSServices& e) { TEST(false); } @@ -471,7 +473,7 @@ void MakeFile(TSTRING& strNameMakeMe) void MakeDir(const TCHAR* const lpszDirName) { - TEST(0 == mkdir(lpszDirName, 0777)) + TEST(0 == tw_mkdir(lpszDirName, 0777)) } //#endif //FIXED_TRV_TEST_SUITE diff --git a/src/twtest/twlocale_t.cpp b/src/twtest/twlocale_t.cpp index dc629e7..97ab7bf 100644 --- a/src/twtest/twlocale_t.cpp +++ b/src/twtest/twlocale_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -70,7 +70,7 @@ void TestItoa() // // setup // - int32 n = 123456; + int32_t n = 123456; TSTRING str; // @@ -80,6 +80,7 @@ void TestItoa() cTWLocale::FormatNumber(n, str); TEST(str == "123456"); +#if !ARCHAIC_STL // // Try formatting with "" locale // @@ -93,6 +94,7 @@ void TestItoa() std::locale::global(std::locale("")); cTWLocale::FormatNumber(n, str); TEST(str == "123,456"); +#endif } catch (const std::runtime_error& e) { diff --git a/src/twtest/twutil_t.cpp b/src/twtest/twutil_t.cpp index 18a2002..3834367 100644 --- a/src/twtest/twutil_t.cpp +++ b/src/twtest/twutil_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -62,7 +62,7 @@ void TestTWUtil() TSTRING tmpFN = TwTestPath("fileexiststest.tmp"); // make a subdir in the TEMP_DIR - mkdir(tmpDir.c_str(), 0700); + tw_mkdir(tmpDir.c_str(), 0700); chmod(tmpDir.c_str(), 0700); // make sure file is not there @@ -75,12 +75,17 @@ void TestTWUtil() TEST(cFileUtil::FileWritable(tmpFN) == true) TEST(cFileUtil::FileExists(tmpFN) == false); +#if !HAVE_GETUID + bool is_root = true; +#else + #if IS_AROS bool is_root = (65534 == getuid()); //AROS doesn't really have users, & posixy fns use this pseudo value. #else bool is_root = (0 == getuid()); #endif - + +#endif // make the dir read only and make sure write tests false // windows fails this test, perhaps because I am an administrator? // chmod(tmpDir.c_str(), 0500); diff --git a/src/twtest/types_t.cpp b/src/twtest/types_t.cpp index d1a564b..1870457 100644 --- a/src/twtest/types_t.cpp +++ b/src/twtest/types_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -39,16 +39,14 @@ // TestTypes() -- this will simply make sure that all the types are defined properly for the current build void TestTypes() { - TEST(sizeof(int8) == 1); - TEST(sizeof(uint8) == 1); - TEST(sizeof(int16) == 2); - TEST(sizeof(uint16) == 2); - TEST(sizeof(int32) == 4); - TEST(sizeof(uint32) == 4); - TEST(sizeof(int64) == 8); - TEST(sizeof(uint64) == 8); - TEST(sizeof(float32) == 4); - TEST(sizeof(float64) == 8); + TEST(sizeof(int8_t) == 1); + TEST(sizeof(uint8_t) == 1); + TEST(sizeof(int16_t) == 2); + TEST(sizeof(uint16_t) == 2); + TEST(sizeof(int32_t) == 4); + TEST(sizeof(uint32_t) == 4); + TEST(sizeof(int64_t) == 8); + TEST(sizeof(uint64_t) == 8); } void RegisterSuite_Types() diff --git a/src/twtest/unixfsservices_t.cpp b/src/twtest/unixfsservices_t.cpp index a572c12..d4239a0 100644 --- a/src/twtest/unixfsservices_t.cpp +++ b/src/twtest/unixfsservices_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -170,7 +170,7 @@ void TestGetCurrentUserName() void TestGetIPAddress() { - uint32 ipaddr; + uint32_t ipaddr; bool success = iFSServices::GetInstance()->GetIPAddress(ipaddr); if (!success) skip("GetIPAddress test skipped, usually caused by hostname/IP configuration problems"); @@ -206,6 +206,24 @@ void TestFileDelete() TEST(iFSServices::GetInstance()->FileDelete(to_rm)); } +// This looks silly, but we've run into situations where basic exception handling fails due to +// fun linker issues, so here's a test to verify that we were built correctly. +void TestCatch() +{ + bool threw = false; + try + { + throw eFSServices("a thing happened"); + } + catch (const eFSServices& e) + { + threw = true; + } + + TEST(threw); +} + + void RegisterSuite_UnixFSServices() { RegisterTest("UnixFSServices", "ReadDir", TestReadDir); @@ -219,4 +237,5 @@ void RegisterSuite_UnixFSServices() RegisterTest("UnixFSServices", "GetExecutableFilename", TestGetExecutableFilename); RegisterTest("UnixFSServices", "Rename", TestRename); RegisterTest("UnixFSServices", "FileDelete", TestFileDelete); + RegisterTest("UnixFSServices", "TestCatch", TestCatch); } diff --git a/src/twtest/usernotifystdout_t.cpp b/src/twtest/usernotifystdout_t.cpp index ddb6b75..66fa0e3 100644 --- a/src/twtest/usernotifystdout_t.cpp +++ b/src/twtest/usernotifystdout_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/twtest/wchar16_t.cpp b/src/twtest/wchar16_t.cpp index 5361600..d367cd0 100644 --- a/src/twtest/wchar16_t.cpp +++ b/src/twtest/wchar16_t.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2021 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -116,9 +116,9 @@ void TestWchar16() } #endif - b.swapbytes(); + tss::swapbytes(b); TEST(memcmp(a.data(), STRING1, 4) == 0); - b.swapbytes(); + tss::swapbytes(b); TEST(memcmp(b.data(), STRING1, 4) == 0); //#endif // IS_UNIX @@ -129,3 +129,4 @@ void RegisterSuite_Wchar16() { RegisterTest("Wchar16", "Basic", TestWchar16); } + diff --git a/src/util/Makefile.in b/src/util/Makefile.in index 96f23e3..e4a1c22 100644 --- a/src/util/Makefile.in +++ b/src/util/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -128,7 +128,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = -am__depfiles_maybe = +am__maybe_remake_depfiles = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) @@ -300,6 +300,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -345,8 +346,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -451,7 +452,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/src/util/fileutil.cpp b/src/util/fileutil.cpp index 3b9a5fa..4950ecf 100644 --- a/src/util/fileutil.cpp +++ b/src/util/fileutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // @@ -52,7 +52,6 @@ #include #include - /////////////////////////////////////////////////////////////////////////////// // TestFileExists /////////////////////////////////////////////////////////////////////////////// @@ -111,7 +110,7 @@ bool cFileUtil::IsDir(const TSTRING& fileName) { iFSServices::GetInstance()->Stat(fileName, s); } - catch (eFSServices) + catch (const eFSServices&) { return false; } @@ -126,7 +125,7 @@ bool cFileUtil::IsRegularFile(const TSTRING& fileName) { iFSServices::GetInstance()->Stat(fileName, s); } - catch (eFSServices) + catch (const eFSServices&) { return false; } @@ -207,7 +206,7 @@ bool cFileUtil::BackupFile(const TSTRING& filename, bool printWarningOnFailure) throw eFileWrite(filename, iFSServices::GetInstance()->GetErrString()); } -#if IS_DOS_DJGPP +#if USES_DOS_DEVICE_PATH TSTRING backup_filename = cDosPath::BackupName(cDosPath::AsNative(filename)); #else TSTRING backup_filename = filename; @@ -243,7 +242,7 @@ bool cFileUtil::Copy(const TSTRING& src_path, const TSTRING& dest_path) { BUF_SIZE = 4096 }; - int8 buf[BUF_SIZE]; + int8_t buf[BUF_SIZE]; int nBytesRead; cFile srcFile, destFile; @@ -264,8 +263,13 @@ bool cFileUtil::Copy(const TSTRING& src_path, const TSTRING& dest_path) // restore permissions and ownership // don't worry if it fails. it's not mission-critical. +#if HAVE_CHMOD chmod(dest_path.c_str(), srcStat.st_mode); +#endif + +#if HAVE_CHOWN chown(dest_path.c_str(), srcStat.st_uid, srcStat.st_gid); +#endif srcFile.Close(); destFile.Close(); diff --git a/src/util/fileutil.h b/src/util/fileutil.h index 3272c84..aa6b0ca 100644 --- a/src/util/fileutil.h +++ b/src/util/fileutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/miscutil.h b/src/util/miscutil.h index dab4bda..49e2935 100644 --- a/src/util/miscutil.h +++ b/src/util/miscutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/stdutil.cpp b/src/util/stdutil.cpp index e0b3aba..52eb083 100644 --- a/src/util/stdutil.cpp +++ b/src/util/stdutil.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/stdutil.h b/src/util/stdutil.h index cd1fb73..9799347 100644 --- a/src/util/stdutil.h +++ b/src/util/stdutil.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/stringencoder.cpp b/src/util/stringencoder.cpp index 6b97ab0..2f270f6 100644 --- a/src/util/stringencoder.cpp +++ b/src/util/stringencoder.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/stringencoder.h b/src/util/stringencoder.h index 931378f..2cd4b15 100644 --- a/src/util/stringencoder.h +++ b/src/util/stringencoder.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/util.cpp b/src/util/util.cpp index 8b9d573..2d9f550 100644 --- a/src/util/util.cpp +++ b/src/util/util.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/util.h b/src/util/util.h index be787d0..18cb5dd 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/utilerrors.cpp b/src/util/utilerrors.cpp index 1cceebc..86d9859 100644 --- a/src/util/utilerrors.cpp +++ b/src/util/utilerrors.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/utilerrors.h b/src/util/utilerrors.h index 501e71a..c5abc85 100644 --- a/src/util/utilerrors.h +++ b/src/util/utilerrors.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/utilstrings.cpp b/src/util/utilstrings.cpp index 5baac79..4686d11 100644 --- a/src/util/utilstrings.cpp +++ b/src/util/utilstrings.cpp @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. // diff --git a/src/util/utilstrings.h b/src/util/utilstrings.h index 46c2b9d..4c85a7c 100644 --- a/src/util/utilstrings.h +++ b/src/util/utilstrings.h @@ -1,6 +1,6 @@ // // The developer of the original code and/or files is Tripwire, Inc. -// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire, +// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire, // Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights // reserved. //