diff -Nru libsmdev-20171112/aclocal.m4 libsmdev-20181227/aclocal.m4 --- libsmdev-20171112/aclocal.m4 2017-11-12 14:33:37.000000000 +0000 +++ libsmdev-20181227/aclocal.m4 2018-12-27 19:19:33.000000000 +0000 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.15 -*- Autoconf -*- +# generated automatically by aclocal 1.16.1 -*- Autoconf -*- -# Copyright (C) 1996-2014 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, @@ -364,7 +364,7 @@ [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) ])dnl PKG_HAVE_DEFINE_WITH_MODULES -# Copyright (C) 2002-2014 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, @@ -376,10 +376,10 @@ # 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], [], +m4_if([$1], [1.16.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -395,14 +395,14 @@ # 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])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-2014 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, @@ -454,7 +454,7 @@ # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2014 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, @@ -485,7 +485,7 @@ Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2014 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, @@ -676,13 +676,12 @@ # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2014 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], @@ -690,49 +689,41 @@ # 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 @@ -741,18 +732,17 @@ # ----------------------------- # 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-2014 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, @@ -839,8 +829,8 @@ 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. @@ -907,7 +897,7 @@ 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 @@ -949,7 +939,7 @@ done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2014 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, @@ -970,7 +960,7 @@ fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2014 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, @@ -991,7 +981,7 @@ # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2014 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, @@ -999,49 +989,42 @@ # 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-2014 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, @@ -1078,7 +1061,7 @@ fi ]) -# Copyright (C) 2003-2014 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, @@ -1112,7 +1095,7 @@ # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2014 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, @@ -1141,7 +1124,7 @@ AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2014 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, @@ -1188,7 +1171,7 @@ # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2014 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, @@ -1207,7 +1190,7 @@ # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2014 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, @@ -1288,7 +1271,7 @@ rm -f conftest.file ]) -# Copyright (C) 2009-2014 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, @@ -1348,7 +1331,7 @@ _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2014 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, @@ -1376,7 +1359,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2014 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, @@ -1395,7 +1378,7 @@ # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2014 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 -Nru libsmdev-20171112/AUTHORS libsmdev-20181227/AUTHORS --- libsmdev-20171112/AUTHORS 2017-11-12 14:19:27.000000000 +0000 +++ libsmdev-20181227/AUTHORS 2018-12-27 14:12:56.000000000 +0000 @@ -1,4 +1,4 @@ Acknowledgements: libsmdev -Copyright (C) 2010-2017, Joachim Metz +Copyright (C) 2010-2018, Joachim Metz diff -Nru libsmdev-20171112/common/byte_stream.h libsmdev-20181227/common/byte_stream.h --- libsmdev-20171112/common/byte_stream.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/common/byte_stream.h 2018-12-27 14:12:56.000000000 +0000 @@ -1,7 +1,7 @@ /* * Byte stream functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/common/common.h libsmdev-20181227/common/common.h --- libsmdev-20171112/common/common.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/common/common.h 2018-12-27 14:12:56.000000000 +0000 @@ -1,7 +1,7 @@ /* * Common include file * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/common/config_borlandc.h libsmdev-20181227/common/config_borlandc.h --- libsmdev-20171112/common/config_borlandc.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/common/config_borlandc.h 2018-12-27 14:12:56.000000000 +0000 @@ -1,7 +1,7 @@ /* * Configuration for the Borland/CodeGear C++ Builder compiler * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/common/config.h libsmdev-20181227/common/config.h --- libsmdev-20171112/common/config.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/common/config.h 2018-12-27 18:29:13.000000000 +0000 @@ -235,6 +235,9 @@ /* Define to 1 if you have the `memset' function. */ #define HAVE_MEMSET 1 +/* Define to 1 if you have the `mkstemp' function. */ +#define HAVE_MKSTEMP 1 + /* Define to 1 if multi thread support should be used. */ #define HAVE_MULTI_THREAD_SUPPORT 1 @@ -259,15 +262,6 @@ /* Define to 1 if you have the header file. */ #define HAVE_PTHREAD_H 1 -/* Define to 1 if you have Python */ -/* #undef HAVE_PYTHON */ - -/* Define to 1 if you have Python 2 */ -/* #undef HAVE_PYTHON2 */ - -/* Define to 1 if you have Python 3 */ -/* #undef HAVE_PYTHON3 */ - /* Define to 1 if you have the header file. */ /* #undef HAVE_PYTHON_H */ @@ -470,7 +464,7 @@ #define PACKAGE_NAME "libsmdev" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "libsmdev 20171112" +#define PACKAGE_STRING "libsmdev 20181227" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "libsmdev" @@ -479,11 +473,14 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "20171112" +#define PACKAGE_VERSION "20181227" /* The size of `int', as computed by sizeof. */ #define SIZEOF_INT 4 +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 8 + /* The size of `off_t', as computed by sizeof. */ #define SIZEOF_OFF_T 8 @@ -500,7 +497,7 @@ /* #undef STRERROR_R_CHAR_P */ /* Version number of package */ -#define VERSION "20171112" +#define VERSION "20181227" /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE diff -Nru libsmdev-20171112/common/config.h.in libsmdev-20181227/common/config.h.in --- libsmdev-20171112/common/config.h.in 2017-11-12 14:33:39.000000000 +0000 +++ libsmdev-20181227/common/config.h.in 2018-12-27 19:19:36.000000000 +0000 @@ -234,6 +234,9 @@ /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET +/* Define to 1 if you have the `mkstemp' function. */ +#undef HAVE_MKSTEMP + /* Define to 1 if multi thread support should be used. */ #undef HAVE_MULTI_THREAD_SUPPORT @@ -258,15 +261,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_PTHREAD_H -/* Define to 1 if you have Python */ -#undef HAVE_PYTHON - -/* Define to 1 if you have Python 2 */ -#undef HAVE_PYTHON2 - -/* Define to 1 if you have Python 3 */ -#undef HAVE_PYTHON3 - /* Define to 1 if you have the header file. */ #undef HAVE_PYTHON_H @@ -483,6 +477,9 @@ /* The size of `int', as computed by sizeof. */ #undef SIZEOF_INT +/* The size of `long', as computed by sizeof. */ +#undef SIZEOF_LONG + /* The size of `off_t', as computed by sizeof. */ #undef SIZEOF_OFF_T diff -Nru libsmdev-20171112/common/config_msc.h libsmdev-20181227/common/config_msc.h --- libsmdev-20171112/common/config_msc.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/common/config_msc.h 2018-12-27 14:12:56.000000000 +0000 @@ -1,7 +1,7 @@ /* * Configuration for the Microsoft Visual Studio C++ compiler * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/common/config_winapi.h libsmdev-20181227/common/config_winapi.h --- libsmdev-20171112/common/config_winapi.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/common/config_winapi.h 2018-12-27 14:12:56.000000000 +0000 @@ -1,7 +1,7 @@ /* * Configuration file for WINAPI * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/common/file_stream.h libsmdev-20181227/common/file_stream.h --- libsmdev-20171112/common/file_stream.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/common/file_stream.h 2018-12-27 14:12:56.000000000 +0000 @@ -1,7 +1,7 @@ /* * FILE stream functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/common/Makefile.in libsmdev-20181227/common/Makefile.in --- libsmdev-20171112/common/Makefile.in 2017-11-12 14:33:39.000000000 +0000 +++ libsmdev-20181227/common/Makefile.in 2018-12-27 19:19:38.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 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, @@ -236,6 +236,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSMDEV_DLL_EXPORT = @LIBSMDEV_DLL_EXPORT@ LIBSMDEV_DLL_IMPORT = @LIBSMDEV_DLL_IMPORT@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -385,7 +386,6 @@ libcthreads_LIBS = @libcthreads_LIBS@ libdir = @libdir@ libexecdir = @libexecdir@ -libsmdev_spec_build_requires = @libsmdev_spec_build_requires@ libsmdev_spec_requires = @libsmdev_spec_requires@ libuna_CFLAGS = @libuna_CFLAGS@ libuna_LIBS = @libuna_LIBS@ @@ -452,8 +452,8 @@ *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) @@ -540,7 +540,10 @@ 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 -Nru libsmdev-20171112/common/memory.h libsmdev-20181227/common/memory.h --- libsmdev-20171112/common/memory.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/common/memory.h 2018-12-27 14:12:56.000000000 +0000 @@ -1,7 +1,7 @@ /* * Memory functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -88,7 +88,7 @@ #elif defined( WINAPI ) #define memory_free( buffer ) \ - HeapFree( GetProcessHeap(), 0, (LPVOID) buffer ) + ( buffer == NULL ) ? TRUE : HeapFree( GetProcessHeap(), 0, (LPVOID) buffer ) #elif defined( HAVE_FREE ) #define memory_free( buffer ) \ diff -Nru libsmdev-20171112/common/narrow_string.h libsmdev-20181227/common/narrow_string.h --- libsmdev-20171112/common/narrow_string.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/common/narrow_string.h 2018-12-27 14:12:56.000000000 +0000 @@ -1,7 +1,7 @@ /* * Narrow character string functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/common/system_string.h libsmdev-20181227/common/system_string.h --- libsmdev-20171112/common/system_string.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/common/system_string.h 2018-12-27 14:12:56.000000000 +0000 @@ -1,7 +1,7 @@ /* * System character string functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/common/types.h libsmdev-20181227/common/types.h --- libsmdev-20171112/common/types.h 2017-11-12 14:33:50.000000000 +0000 +++ libsmdev-20181227/common/types.h 2018-12-27 19:20:30.000000000 +0000 @@ -1,7 +1,7 @@ /* * Type and type-support defintions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -59,7 +59,7 @@ #endif /* defined( WINAPI ) && ( defined( _UNICODE ) || defined( UNICODE ) ) */ -/* Fix for systems without PRI definitions +/* Fallback for systems without PRI definitions */ #if !defined( PRId8 ) #define PRId8 "d" @@ -77,7 +77,7 @@ #define PRId32 "d" #endif -#endif +#endif /* !defined( PRId32 ) */ #if !defined( PRId64 ) #if defined( WINAPI ) @@ -90,7 +90,7 @@ #define PRId64 "lld" #endif -#endif +#endif /* !defined( PRId64 ) */ #if !defined( PRIi8 ) #define PRIi8 "i" @@ -108,7 +108,7 @@ #define PRIi32 "i" #endif -#endif +#endif /* !defined( PRIi32 ) */ #if !defined( PRIi64 ) #if defined( WINAPI ) @@ -121,7 +121,7 @@ #define PRIi64 "lli" #endif -#endif +#endif /* !defined( PRIi64 ) */ #if !defined( PRIu8 ) #define PRIu8 "u" @@ -139,7 +139,7 @@ #define PRIu32 "u" #endif -#endif +#endif /* !defined( PRIu32 ) */ #if !defined( PRIu64 ) #if defined( WINAPI ) @@ -152,7 +152,38 @@ #define PRIu64 "llu" #endif +#endif /* !defined( PRIu64 ) */ + +#if !defined( PRIo8 ) +#define PRIo8 "o" +#endif + +#if !defined( PRIo16 ) +#define PRIo16 "o" +#endif + +#if !defined( PRIo32 ) +#if defined( WINAPI ) +#define PRIo32 "I32o" + +#else +#define PRIo32 "o" + +#endif +#endif /* !defined( PRIo32 ) */ + +#if !defined( PRIo64 ) +#if defined( WINAPI ) +#define PRIo64 "I64o" + +#elif __WORDSIZE == 64 +#define PRIo64 "lo" + +#else +#define PRIo64 "llo" + #endif +#endif /* !defined( PRIo64 ) */ #if !defined( PRIx8 ) #define PRIx8 "x" @@ -170,7 +201,7 @@ #define PRIx32 "x" #endif -#endif +#endif /* !defined( PRIx32 ) */ #if !defined( PRIx64 ) #if defined( WINAPI ) @@ -183,9 +214,9 @@ #define PRIx64 "llx" #endif -#endif +#endif /*!defined( PRIx64 ) */ -/* Fix for systems without printf %jd definition +/* Fallback for systems without printf %jd definition */ #if defined( HAVE_PRINTF_JD ) #define PRIjd "jd" @@ -205,9 +236,9 @@ #define PRIju PRIu32 #define PRIjx PRIx32 -#endif +#endif /* defined( HAVE_PRINTF_JD ) */ -/* Fix for systems without printf %zd definition +/* Fallback for systems without printf %zd definition */ #if defined( HAVE_PRINTF_ZD ) #define PRIzd "zd" @@ -215,7 +246,7 @@ #define PRIzu "zu" #define PRIzx "zx" -#elif defined( WINAPI ) +#elif defined( _MSC_VER ) #define PRIzd "Id" #define PRIzi "Ii" #define PRIzu "Iu" @@ -233,9 +264,9 @@ #define PRIzu PRIu32 #define PRIzx PRIx32 -#endif +#endif /* defined( HAVE_PRINTF_ZD ) */ -/* Fix for systems without (U)INTx_MAX definitions +/* Fallback for systems without (U)INTx_MAX definitions */ /* The maximum signed 8-bit integer is 127 (0x7f) @@ -250,7 +281,7 @@ #define UINT8_MAX (0xff) #endif -/* The maximum signed 16-bit integer is 32767 (0xr7ffff) +/* The maximum signed 16-bit integer is 32767 (0x7ffff) */ #if !defined( INT16_MAX ) #define INT16_MAX (0x7fff) @@ -282,7 +313,7 @@ #else #define INT64_MAX (0x7fffffffffffffffULL) #endif -#endif +#endif /* !defined( INT64_MAX ) */ /* The maximum unsigned 64-bit integer is 18446744073709551615 (0xffffffffffffffff) */ @@ -292,7 +323,7 @@ #else #define UINT64_MAX (0xffffffffffffffffULL) #endif -#endif +#endif /* !defined( UINT64_MAX ) */ /* The maximum signed integer */ @@ -306,6 +337,18 @@ #define UINT_MAX UINT32_MAX #endif +/* The maximum signed long integer + */ +#if !defined( LONG_MAX ) +#define LONG_MAX INT32_MAX +#endif + +/* The maximum unsigned long integer + */ +#if !defined( ULONG_MAX ) +#define ULONG_MAX UINT32_MAX +#endif + /* The maximum signed size type is platform dependent */ #if !defined( SSIZE_MAX ) @@ -316,7 +359,7 @@ #define SSIZE_MAX INT64_MAX #else #define SSIZE_MAX INT32_MAX -#endif /* _WIN64 */ +#endif #else @@ -324,7 +367,7 @@ #define SSIZE_MAX INT64_MAX #else #define SSIZE_MAX INT32_MAX -#endif /* __WORDSIZE == 64 */ +#endif #endif /* WINAPI */ diff -Nru libsmdev-20171112/common/types.h.in libsmdev-20181227/common/types.h.in --- libsmdev-20171112/common/types.h.in 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/common/types.h.in 2018-12-27 14:12:56.000000000 +0000 @@ -1,7 +1,7 @@ /* * Type and type-support defintions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -59,7 +59,7 @@ #endif /* defined( WINAPI ) && ( defined( _UNICODE ) || defined( UNICODE ) ) */ -/* Fix for systems without PRI definitions +/* Fallback for systems without PRI definitions */ #if !defined( PRId8 ) #define PRId8 "d" @@ -77,7 +77,7 @@ #define PRId32 "d" #endif -#endif +#endif /* !defined( PRId32 ) */ #if !defined( PRId64 ) #if defined( WINAPI ) @@ -90,7 +90,7 @@ #define PRId64 "lld" #endif -#endif +#endif /* !defined( PRId64 ) */ #if !defined( PRIi8 ) #define PRIi8 "i" @@ -108,7 +108,7 @@ #define PRIi32 "i" #endif -#endif +#endif /* !defined( PRIi32 ) */ #if !defined( PRIi64 ) #if defined( WINAPI ) @@ -121,7 +121,7 @@ #define PRIi64 "lli" #endif -#endif +#endif /* !defined( PRIi64 ) */ #if !defined( PRIu8 ) #define PRIu8 "u" @@ -139,7 +139,7 @@ #define PRIu32 "u" #endif -#endif +#endif /* !defined( PRIu32 ) */ #if !defined( PRIu64 ) #if defined( WINAPI ) @@ -152,7 +152,38 @@ #define PRIu64 "llu" #endif +#endif /* !defined( PRIu64 ) */ + +#if !defined( PRIo8 ) +#define PRIo8 "o" +#endif + +#if !defined( PRIo16 ) +#define PRIo16 "o" +#endif + +#if !defined( PRIo32 ) +#if defined( WINAPI ) +#define PRIo32 "I32o" + +#else +#define PRIo32 "o" + +#endif +#endif /* !defined( PRIo32 ) */ + +#if !defined( PRIo64 ) +#if defined( WINAPI ) +#define PRIo64 "I64o" + +#elif __WORDSIZE == 64 +#define PRIo64 "lo" + +#else +#define PRIo64 "llo" + #endif +#endif /* !defined( PRIo64 ) */ #if !defined( PRIx8 ) #define PRIx8 "x" @@ -170,7 +201,7 @@ #define PRIx32 "x" #endif -#endif +#endif /* !defined( PRIx32 ) */ #if !defined( PRIx64 ) #if defined( WINAPI ) @@ -183,9 +214,9 @@ #define PRIx64 "llx" #endif -#endif +#endif /*!defined( PRIx64 ) */ -/* Fix for systems without printf %jd definition +/* Fallback for systems without printf %jd definition */ #if defined( HAVE_PRINTF_JD ) #define PRIjd "jd" @@ -205,9 +236,9 @@ #define PRIju PRIu32 #define PRIjx PRIx32 -#endif +#endif /* defined( HAVE_PRINTF_JD ) */ -/* Fix for systems without printf %zd definition +/* Fallback for systems without printf %zd definition */ #if defined( HAVE_PRINTF_ZD ) #define PRIzd "zd" @@ -215,7 +246,7 @@ #define PRIzu "zu" #define PRIzx "zx" -#elif defined( WINAPI ) +#elif defined( _MSC_VER ) #define PRIzd "Id" #define PRIzi "Ii" #define PRIzu "Iu" @@ -233,9 +264,9 @@ #define PRIzu PRIu32 #define PRIzx PRIx32 -#endif +#endif /* defined( HAVE_PRINTF_ZD ) */ -/* Fix for systems without (U)INTx_MAX definitions +/* Fallback for systems without (U)INTx_MAX definitions */ /* The maximum signed 8-bit integer is 127 (0x7f) @@ -250,7 +281,7 @@ #define UINT8_MAX (0xff) #endif -/* The maximum signed 16-bit integer is 32767 (0xr7ffff) +/* The maximum signed 16-bit integer is 32767 (0x7ffff) */ #if !defined( INT16_MAX ) #define INT16_MAX (0x7fff) @@ -282,7 +313,7 @@ #else #define INT64_MAX (0x7fffffffffffffffULL) #endif -#endif +#endif /* !defined( INT64_MAX ) */ /* The maximum unsigned 64-bit integer is 18446744073709551615 (0xffffffffffffffff) */ @@ -292,7 +323,7 @@ #else #define UINT64_MAX (0xffffffffffffffffULL) #endif -#endif +#endif /* !defined( UINT64_MAX ) */ /* The maximum signed integer */ @@ -306,6 +337,18 @@ #define UINT_MAX UINT32_MAX #endif +/* The maximum signed long integer + */ +#if !defined( LONG_MAX ) +#define LONG_MAX INT32_MAX +#endif + +/* The maximum unsigned long integer + */ +#if !defined( ULONG_MAX ) +#define ULONG_MAX UINT32_MAX +#endif + /* The maximum signed size type is platform dependent */ #if !defined( SSIZE_MAX ) @@ -316,7 +359,7 @@ #define SSIZE_MAX INT64_MAX #else #define SSIZE_MAX INT32_MAX -#endif /* _WIN64 */ +#endif #else @@ -324,7 +367,7 @@ #define SSIZE_MAX INT64_MAX #else #define SSIZE_MAX INT32_MAX -#endif /* __WORDSIZE == 64 */ +#endif #endif /* WINAPI */ diff -Nru libsmdev-20171112/common/wide_string.h libsmdev-20181227/common/wide_string.h --- libsmdev-20171112/common/wide_string.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/common/wide_string.h 2018-12-27 14:12:56.000000000 +0000 @@ -1,7 +1,7 @@ /* * Wide character string functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/compile libsmdev-20181227/compile --- libsmdev-20171112/compile 2017-11-12 14:33:39.000000000 +0000 +++ libsmdev-20181227/compile 2018-12-27 19:19:37.000000000 +0000 @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. -scriptversion=2012-10-14.11; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -255,7 +255,8 @@ echo "compile $scriptversion" exit $? ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac @@ -339,9 +340,9 @@ # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff -Nru libsmdev-20171112/config.guess libsmdev-20181227/config.guess --- libsmdev-20171112/config.guess 2017-11-12 14:33:39.000000000 +0000 +++ libsmdev-20181227/config.guess 2018-12-27 19:19:37.000000000 +0000 @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2016 Free Software Foundation, Inc. +# Copyright 1992-2018 Free Software Foundation, Inc. -timestamp='2016-10-02' +timestamp='2018-03-08' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -27,7 +27,7 @@ # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . @@ -39,7 +39,7 @@ Output the configuration name of the system \`$me' is run on. -Operation modes: +Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit @@ -50,7 +50,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2016 Free Software Foundation, Inc. +Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -107,9 +107,9 @@ dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; + ,,) echo "int x;" > "$dummy.c" ; for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; @@ -132,14 +132,14 @@ UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_SYSTEM}" in +case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu - eval $set_cc_for_build - cat <<-EOF > $dummy.c + eval "$set_cc_for_build" + cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc @@ -149,13 +149,20 @@ LIBC=gnu #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" + + # If ldd exists, use it to detect musl libc. + if command -v ldd >/dev/null && \ + ldd --version 2>&1 | grep -q ^musl + then + LIBC=musl + fi ;; esac # Note: order is significant - the case branches are not exclusive. -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in +case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, @@ -169,30 +176,30 @@ # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - /sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || \ + "/sbin/$sysctl" 2>/dev/null || \ + "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` - case "${UNAME_MACHINE_ARCH}" in + case "$UNAME_MACHINE_ARCH" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) - arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` - endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` - machine=${arch}${endian}-unknown + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + machine="${arch}${endian}"-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. - case "${UNAME_MACHINE_ARCH}" in + case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build + eval "$set_cc_for_build" if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then @@ -208,10 +215,10 @@ ;; esac # Determine ABI tags. - case "${UNAME_MACHINE_ARCH}" in + case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' - abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release @@ -219,46 +226,55 @@ # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in + case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}${abi}" + echo "$machine-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} + echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" + exit ;; + *:MidnightBSD:*:*) + echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} + echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) - echo ${UNAME_MACHINE}-unknown-sortix + echo "$UNAME_MACHINE"-unknown-sortix + exit ;; + *:Redox:*:*) + echo "$UNAME_MACHINE"-unknown-redox exit ;; + mips:OSF1:*.*) + echo mips-dec-osf1 + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -310,28 +326,19 @@ # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos + echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos + echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition @@ -343,7 +350,7 @@ echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} + echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos @@ -370,19 +377,19 @@ sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} + echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build + eval "$set_cc_for_build" SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. @@ -395,13 +402,13 @@ SUN_ARCH=x86_64 fi fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in @@ -410,25 +417,25 @@ ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" exit ;; sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} + echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 + test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) - echo m68k-sun-sunos${UNAME_RELEASE} + echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) - echo sparc-sun-sunos${UNAME_RELEASE} + echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} + echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not @@ -439,44 +446,44 @@ # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} + echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} + echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} + echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} + echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} + echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} + echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} + echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} + echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { @@ -485,23 +492,23 @@ #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} + echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax @@ -527,17 +534,17 @@ AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] + if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ + [ "$TARGET_BINARY_INTERFACE"x = x ] then - echo m88k-dg-dgux${UNAME_RELEASE} + echo m88k-dg-dgux"$UNAME_RELEASE" else - echo m88k-dg-dguxbcs${UNAME_RELEASE} + echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else - echo i586-dg-dgux${UNAME_RELEASE} + echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) @@ -554,7 +561,7 @@ echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id @@ -566,14 +573,14 @@ if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" #include main() @@ -584,7 +591,7 @@ exit(0); } EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then echo "$SYSTEM_NAME" else @@ -598,7 +605,7 @@ exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc @@ -607,18 +614,18 @@ IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} + echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx @@ -633,28 +640,28 @@ echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; + HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` + case "$UNAME_MACHINE" in + 9000/31?) HP_ARCH=m68000 ;; + 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in + case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in + case "$sc_kernel_bits" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + if [ "$HP_ARCH" = "" ]; then + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include @@ -687,13 +694,13 @@ exit (0); } EOF - (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ ${HP_ARCH} = hppa2.0w ] + if [ "$HP_ARCH" = hppa2.0w ] then - eval $set_cc_for_build + eval "$set_cc_for_build" # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler @@ -712,15 +719,15 @@ HP_ARCH=hppa64 fi fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} + echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} + HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" #include int main () @@ -745,11 +752,11 @@ exit (0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) @@ -758,7 +765,7 @@ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) @@ -766,9 +773,9 @@ exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk + echo "$UNAME_MACHINE"-unknown-osf1mk else - echo ${UNAME_MACHINE}-unknown-osf1 + echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) @@ -793,127 +800,109 @@ echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} + echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` - case ${UNAME_PROCESSOR} in + case "$UNAME_PROCESSOR" in amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; esac + echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin + echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) - echo ${UNAME_MACHINE}-pc-mingw64 + echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 + echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) - echo ${UNAME_MACHINE}-pc-msys - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 + echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 + echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) - case ${UNAME_MACHINE} in + case "$UNAME_MACHINE" in x86) - echo i586-pc-interix${UNAME_RELEASE} + echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix${UNAME_RELEASE} + echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) - echo ia64-unknown-interix${UNAME_RELEASE} + echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin + echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix + echo "$UNAME_MACHINE"-pc-minix exit ;; aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -927,63 +916,63 @@ esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) - eval $set_cc_for_build + eval "$set_cc_for_build" if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} + echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} + echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} + echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + eval "$set_cc_for_build" + sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el @@ -997,70 +986,70 @@ #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } + eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" + test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } ;; mips64el:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) - echo or1k-unknown-linux-${LIBC} + echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-${LIBC} + echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-${LIBC} + echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; - PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; - *) echo hppa-unknown-linux-${LIBC} ;; + PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; + PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; + *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-${LIBC} + echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-${LIBC} + echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-${LIBC} + echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) - echo powerpcle-unknown-linux-${LIBC} + echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux-${LIBC} + echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-${LIBC} + echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} + echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1074,34 +1063,34 @@ # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx + echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop + echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos + echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable + echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} + echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp + echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + i*86:*:4.*:*) + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; i*86:*:5:[678]*) @@ -1111,12 +1100,12 @@ *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 @@ -1126,9 +1115,9 @@ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else - echo ${UNAME_MACHINE}-pc-sysv32 + echo "$UNAME_MACHINE"-pc-sysv32 fi exit ;; pc:*:*:*) @@ -1148,9 +1137,9 @@ exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) @@ -1170,9 +1159,9 @@ test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; @@ -1181,28 +1170,28 @@ test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} + echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} + echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} + echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} + echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} + echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 @@ -1213,7 +1202,7 @@ *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 + echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi @@ -1233,23 +1222,23 @@ exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos + echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} + echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} + echo mips-nec-sysv"$UNAME_RELEASE" else - echo mips-unknown-sysv${UNAME_RELEASE} + echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. @@ -1268,49 +1257,56 @@ echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} + echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} + echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} + echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} + echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} + echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} + echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) - echo sxace-nec-superux${UNAME_RELEASE} + echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} + echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval $set_cc_for_build + eval "$set_cc_for_build" if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi - if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub @@ -1321,7 +1317,7 @@ # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` @@ -1329,19 +1325,25 @@ UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} + NEO-*:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} + echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} + NSR-*:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSV-*:NONSTOP_KERNEL:*:*) + echo nsv-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSX-*:NONSTOP_KERNEL:*:*) + echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux @@ -1350,7 +1352,7 @@ echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 @@ -1361,7 +1363,7 @@ else UNAME_MACHINE="$cputype" fi - echo ${UNAME_MACHINE}-unknown-plan9 + echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 @@ -1382,14 +1384,14 @@ echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} + echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in + case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; @@ -1398,32 +1400,44 @@ echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` + echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos + echo "$UNAME_MACHINE"-pc-rdos exit ;; i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros + echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) - echo ${UNAME_MACHINE}-unknown-esx + echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; esac +echo "$0: unable to guess system type" >&2 + +case "$UNAME_MACHINE:$UNAME_SYSTEM" in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <&2 </dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} +UNAME_MACHINE = "$UNAME_MACHINE" +UNAME_RELEASE = "$UNAME_RELEASE" +UNAME_SYSTEM = "$UNAME_SYSTEM" +UNAME_VERSION = "$UNAME_VERSION" EOF exit 1 # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" diff -Nru libsmdev-20171112/config.sub libsmdev-20181227/config.sub --- libsmdev-20171112/config.sub 2017-11-12 14:33:39.000000000 +0000 +++ libsmdev-20181227/config.sub 2018-12-27 19:19:37.000000000 +0000 @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2016 Free Software Foundation, Inc. +# Copyright 1992-2018 Free Software Foundation, Inc. -timestamp='2016-09-05' +timestamp='2018-05-05' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -33,7 +33,7 @@ # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -57,7 +57,7 @@ Canonicalize a configuration name. -Operation modes: +Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit @@ -67,7 +67,7 @@ version="\ GNU config.sub ($timestamp) -Copyright 1992-2016 Free Software Foundation, Inc. +Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -94,7 +94,7 @@ *local*) # First pass through any local machine types. - echo $1 + echo "$1" exit ;; * ) @@ -110,28 +110,48 @@ exit 1;; esac -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ - kopensolaris*-gnu* | cloudabi*-eabi* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - android-linux) - os=-linux-android - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; +# Spilt fields of configuration type +IFS="-" read -r field1 field2 field3 field4 <&2 + echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. @@ -380,14 +403,14 @@ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | cydra-* \ + | c8051-* | clipper-* | craynv-* | csky-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ + | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ @@ -421,6 +444,7 @@ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ + | nfp-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ @@ -428,6 +452,7 @@ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ | pyramid-* \ | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ @@ -444,6 +469,7 @@ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ + | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -457,7 +483,7 @@ # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) - basic_machine=i386-unknown + basic_machine=i386-pc os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) @@ -491,7 +517,7 @@ basic_machine=x86_64-pc ;; amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl @@ -536,7 +562,7 @@ os=-linux ;; blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) @@ -544,13 +570,13 @@ os=-cnk ;; c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray @@ -639,7 +665,7 @@ basic_machine=rs6000-bull os=-bosx ;; - dpx2* | dpx2*-bull) + dpx2*) basic_machine=m68k-bull os=-sysv3 ;; @@ -648,7 +674,7 @@ os=$os"spe" ;; e500v[12]-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=$os"spe" ;; ebmon29k) @@ -740,9 +766,6 @@ hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; - hppa-next) - os=-nextstep3 - ;; hppaosf) basic_machine=hppa1.1-hp os=-osf @@ -755,26 +778,26 @@ basic_machine=i370-ibm ;; i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; - i386-vsta | vsta) + vsta) basic_machine=i386-unknown os=-vsta ;; @@ -793,19 +816,16 @@ os=-sysv ;; leon-*|leon[3-9]-*) - basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; - m88k-omron*) - basic_machine=m88k-omron - ;; magnum | m3230) basic_machine=mips-mips os=-sysv @@ -837,10 +857,10 @@ os=-mint ;; mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` ;; mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k @@ -859,7 +879,7 @@ os=-msdos ;; ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc @@ -901,7 +921,7 @@ basic_machine=v70-nec os=-sysv ;; - next | m*-next ) + next | m*-next) basic_machine=m68k-next case $os in -nextstep* ) @@ -946,6 +966,12 @@ nsr-tandem) basic_machine=nsr-tandem ;; + nsv-tandem) + basic_machine=nsv-tandem + ;; + nsx-tandem) + basic_machine=nsx-tandem + ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf @@ -978,7 +1004,7 @@ os=-linux ;; parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; pbd) @@ -994,7 +1020,7 @@ basic_machine=i386-pc ;; pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc @@ -1009,16 +1035,16 @@ basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould @@ -1028,23 +1054,23 @@ ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; - ppc64-* | ppc64p7-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm @@ -1098,17 +1124,10 @@ sequent) basic_machine=i386-sequent ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; sh5el) basic_machine=sh5le-unknown ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) + simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; @@ -1127,7 +1146,7 @@ os=-sysv4 ;; strongarm-* | thumb-*) - basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun @@ -1249,6 +1268,9 @@ basic_machine=hppa1.1-winbond os=-proelf ;; + x64) + basic_machine=x86_64-pc + ;; xbox) basic_machine=i686-pc os=-mingw32 @@ -1257,20 +1279,12 @@ basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) - basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; none) basic_machine=none-none os=-none @@ -1299,10 +1313,6 @@ vax) basic_machine=vax-dec ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; pdp11) basic_machine=pdp11-dec ;; @@ -1312,9 +1322,6 @@ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; cydra) basic_machine=cydra-cydrome ;; @@ -1334,7 +1341,7 @@ # Make sure to match an already-canonicalized machine name. ;; *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; esac @@ -1342,10 +1349,10 @@ # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` ;; *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` ;; *) ;; @@ -1353,11 +1360,11 @@ # Decode manufacturer-specific aliases for certain operating systems. -if [ x"$os" != x"" ] +if [ x$os != x ] then case $os in - # First match some system type aliases - # that might get confused with valid system types. + # First match some system type aliases that might get confused + # with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux @@ -1368,18 +1375,19 @@ -solaris) os=-solaris2 ;; - -svr4*) - os=-sysv4 - ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; - # First accept the basic system types. + # es1800 is here to avoid being matched by es* (a different OS) + -es1800*) + os=-ose + ;; + # Now accept the basic system types. # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. + # Each alternative MUST end in a * to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ @@ -1389,25 +1397,26 @@ | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* | -hcos* \ + | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -morphos* | -superux* | -rtmk* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ - | -onefs* | -tirtos* | -phoenix*) + | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ + | -midnightbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1424,12 +1433,12 @@ -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + -sim | -xray | -os68k* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) - os=`echo $os | sed -e 's|mac|macos|'` + os=`echo "$os" | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc @@ -1438,10 +1447,10 @@ os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` + os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` + os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition @@ -1452,12 +1461,6 @@ -wince*) os=-wince ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; -utek*) os=-bsd ;; @@ -1482,7 +1485,7 @@ -nova*) os=-rtmk-nova ;; - -ns2 ) + -ns2) os=-nextstep2 ;; -nsk*) @@ -1504,7 +1507,7 @@ -oss*) os=-sysv3 ;; - -svr4) + -svr4*) os=-sysv4 ;; -svr3) @@ -1519,34 +1522,44 @@ -ose*) os=-ose ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; - -aros*) - os=-aros - ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; + -pikeos*) + # Until real need of OS specific support for + # particular features comes up, bare metal + # configurations are quite functional. + case $basic_machine in + arm*) + os=-eabi + ;; + *) + os=-elf + ;; + esac + ;; -nacl*) ;; -ios) ;; -none) ;; + -*-eabi) + case $basic_machine in + arm*) + ;; + esac + ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac @@ -1636,12 +1649,12 @@ sparc-* | *-sun) os=-sunos4.1.1 ;; + pru-*) + os=-elf + ;; *-be) os=-beos ;; - *-haiku) - os=-haiku - ;; *-ibm) os=-aix ;; @@ -1681,7 +1694,7 @@ m88k-omron*) os=-luna ;; - *-next ) + *-next) os=-nextstep ;; *-sequent) @@ -1696,9 +1709,6 @@ i370-*) os=-mvs ;; - *-next) - os=-nextstep3 - ;; *-gould) os=-sysv ;; @@ -1808,15 +1818,15 @@ vendor=stratus ;; esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` ;; esac -echo $basic_machine$os +echo "$basic_machine$os" exit # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" diff -Nru libsmdev-20171112/configure libsmdev-20181227/configure --- libsmdev-20171112/configure 2017-11-12 14:33:38.000000000 +0000 +++ libsmdev-20181227/configure 2018-12-27 19:19:35.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libsmdev 20171112. +# Generated by GNU Autoconf 2.69 for libsmdev 20181227. # # Report bugs to . # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='libsmdev' PACKAGE_TARNAME='libsmdev' -PACKAGE_VERSION='20171112' -PACKAGE_STRING='libsmdev 20171112' +PACKAGE_VERSION='20181227' +PACKAGE_STRING='libsmdev 20181227' PACKAGE_BUGREPORT='joachim.metz@gmail.com' PACKAGE_URL='' @@ -639,14 +639,18 @@ LIBOBJS SPEC_DATE DPKG_DATE -libsmdev_spec_build_requires libsmdev_spec_requires +LIBSMDEV_DLL_EXPORT LIBSMDEV_DLL_IMPORT STATIC_LDFLAGS HAVE_PYTHON_TESTS_FALSE HAVE_PYTHON_TESTS_TRUE HAVE_PYTHON3_FALSE HAVE_PYTHON3_TRUE +HAVE_PYTHON2_FALSE +HAVE_PYTHON2_TRUE +HAVE_PYTHON_FALSE +HAVE_PYTHON_TRUE PYTHON3_PACKAGE_DIR PYTHON3_LIBRARY_DIR pyexecdir3 @@ -659,8 +663,6 @@ PYTHON3_PLATFORM PYTHON3_VERSION PYTHON3 -HAVE_PYTHON2_FALSE -HAVE_PYTHON2_TRUE PYTHON2_PACKAGE_DIR PYTHON2_LIBRARY_DIR pyexecdir2 @@ -673,8 +675,6 @@ PYTHON2_PLATFORM PYTHON2_VERSION PYTHON2 -HAVE_PYTHON_FALSE -HAVE_PYTHON_TRUE PYTHON_PACKAGE_DIR PYTHON_LIBRARY_DIR pyexecdir @@ -830,7 +830,6 @@ AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE -am__quote am__include DEPDIR OBJEXT @@ -915,7 +914,8 @@ PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR -SHELL' +SHELL +am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking @@ -934,8 +934,11 @@ with_libiconv_prefix with_libintl_prefix enable_largefile +enable_shared_libs enable_winapi enable_wide_character_type +enable_verbose_output +enable_debug_output with_libcerror enable_multi_threading_support with_libcthreads @@ -945,8 +948,6 @@ with_libcnotify with_libuna with_libcfile -enable_verbose_output -enable_debug_output with_pyprefix enable_python with_pythondir @@ -1523,7 +1524,7 @@ # 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 libsmdev 20171112 to adapt to many kinds of systems. +\`configure' configures libsmdev 20181227 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1593,7 +1594,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libsmdev 20171112:";; + short | recursive ) echo "Configuration of libsmdev 20181227:";; esac cat <<\_ACEOF @@ -1615,14 +1616,15 @@ --disable-nls do not use Native Language Support --disable-rpath do not hardcode runtime library paths --disable-largefile omit support for large files + --disable-shared-libs disable shared library support --enable-winapi enable WINAPI support for cross-compilation [default=auto-detect] --enable-wide-character-type enable wide character type support [default=no] - --enable-multi-threading-support - enable multi-threading support [default=yes] --enable-verbose-output enable verbose output [default=no] --enable-debug-output enable debug output [default=no] + --enable-multi-threading-support + enable multi-threading support [default=yes] --enable-python build Python bindings [default=no] --enable-python2 build Python 2 bindings [default=no] --enable-python3 build Python 3 bindings [default=no] @@ -1789,7 +1791,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libsmdev configure 20171112 +libsmdev configure 20181227 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2441,7 +2443,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libsmdev $as_me 20171112, which was +It was created by libsmdev $as_me 20181227, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2793,7 +2795,7 @@ -am__api_version='1.15' +am__api_version='1.16' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do @@ -3308,7 +3310,7 @@ # Define the identity of the package. PACKAGE='libsmdev' - VERSION='20171112' + VERSION='20181227' cat >>confdefs.h <<_ACEOF @@ -3338,8 +3340,8 @@ # 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 @@ -3506,7 +3508,7 @@ 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 @@ -4747,45 +4749,45 @@ ac_config_commands="$ac_config_commands depfiles" - -am_make=${MAKE-make} -cat > confinc << 'END' +{ $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 + @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. -{ $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 +# 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 -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf +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 : @@ -15393,6 +15395,26 @@ + # Check whether --enable-shared-libs was given. +if test "${enable_shared_libs+set}" = set; then : + enableval=$enable_shared_libs; ac_cv_enable_shared_libs=$enableval +else + ac_cv_enable_shared_libs="yes" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to disable disable shared library support" >&5 +$as_echo_n "checking whether to disable disable shared library support... " >&6; } +if ${ac_cv_enable_shared_libs+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_enable_shared_libs="yes" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_shared_libs" >&5 +$as_echo "$ac_cv_enable_shared_libs" >&6; } + + + + # Check whether --enable-winapi was given. if test "${enable_winapi+set}" = set; then : enableval=$enable_winapi; ac_cv_enable_winapi=$enableval @@ -15422,6 +15444,10 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: detected MinGW enabling WINAPI support for cross-compilation" >&5 $as_echo "$as_me: detected MinGW enabling WINAPI support for cross-compilation" >&6;} ac_cv_enable_winapi=yes ;; #( + *msys*) : + { $as_echo "$as_me:${as_lineno-$LINENO}: detected MSYS enabling WINAPI support for cross-compilation" >&5 +$as_echo "$as_me: detected MSYS enabling WINAPI support for cross-compilation" >&6;} + ac_cv_enable_winapi=yes ;; #( *) : ac_cv_enable_winapi=no ;; #( *) : @@ -15451,6 +15477,62 @@ $as_echo "$ac_cv_enable_wide_character_type" >&6; } + + + # Check whether --enable-verbose-output was given. +if test "${enable_verbose_output+set}" = set; then : + enableval=$enable_verbose_output; ac_cv_enable_verbose_output=$enableval +else + ac_cv_enable_verbose_output=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable enable verbose output" >&5 +$as_echo_n "checking whether to enable enable verbose output... " >&6; } +if ${ac_cv_enable_verbose_output+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_enable_verbose_output=no +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_verbose_output" >&5 +$as_echo "$ac_cv_enable_verbose_output" >&6; } + + if test "x$ac_cv_enable_verbose_output" != xno ; then : + +$as_echo "#define HAVE_VERBOSE_OUTPUT 1" >>confdefs.h + + + ac_cv_enable_verbose_output=yes +fi + + + + + # Check whether --enable-debug-output was given. +if test "${enable_debug_output+set}" = set; then : + enableval=$enable_debug_output; ac_cv_enable_debug_output=$enableval +else + ac_cv_enable_debug_output=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable enable debug output" >&5 +$as_echo_n "checking whether to enable enable debug output... " >&6; } +if ${ac_cv_enable_debug_output+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_enable_debug_output=no +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_debug_output" >&5 +$as_echo "$ac_cv_enable_debug_output" >&6; } + + if test "x$ac_cv_enable_debug_output" != xno ; then : + +$as_echo "#define HAVE_DEBUG_OUTPUT 1" >>confdefs.h + + + ac_cv_enable_debug_output=yes +fi + + if test "x$ac_cv_enable_winapi" = xyes; then : ac_cv_enable_wide_character_type=yes fi @@ -15654,6 +15736,39 @@ # 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 off_t" >&5 $as_echo_n "checking size of off_t... " >&6; } if ${ac_cv_sizeof_off_t+:} false; then : @@ -16540,22 +16655,23 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_with_libcerror" >&5 $as_echo "$ac_cv_with_libcerror" >&6; } - if test "x$ac_cv_with_libcerror" != x && test "x$ac_cv_with_libcerror" != xno && test "x$ac_cv_with_libcerror" != xauto-detect; then : + if test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libcerror" = xno; then : + ac_cv_libcerror=no +else + if test "x$ac_cv_with_libcerror" != x && test "x$ac_cv_with_libcerror" != xauto-detect; then : if test -d "$ac_cv_with_libcerror"; then : CFLAGS="$CFLAGS -I${ac_cv_with_libcerror}/include" - LDFLAGS="$LDFLAGS -L${ac_cv_with_libcerror}/lib" + LDFLAGS="$LDFLAGS -L${ac_cv_with_libcerror}/lib" else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no such directory: $ac_cv_with_libcerror" >&5 -$as_echo "$as_me: WARNING: no such directory: $ac_cv_with_libcerror" >&2;} - -fi + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 1 "no such directory: $ac_cv_with_libcerror +See \`config.log' for more details" "$LINENO" 5; } fi - - if test "x$ac_cv_with_libcerror" = xno; then : - ac_cv_libcerror=no + ac_cv_libcerror=check else - if test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"; then : + if test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcerror" >&5 @@ -16629,10 +16745,11 @@ fi fi - - if test "x$ac_cv_libcerror" = xyes; then : + if test "x$ac_cv_libcerror" = xyes; then : ac_cv_libcerror_CPPFLAGS="$pkg_cv_libcerror_CFLAGS" - ac_cv_libcerror_LIBADD="$pkg_cv_libcerror_LIBS" + ac_cv_libcerror_LIBADD="$pkg_cv_libcerror_LIBS" +fi + fi if test "x$ac_cv_libcerror" = xcheck; then : @@ -17036,8 +17153,14 @@ ac_cv_libcerror_LIBADD="-lcerror" +fi fi + if test "x$ac_cv_with_libcerror" != x && test "x$ac_cv_with_libcerror" != xauto-detect && test "x$ac_cv_libcerror" != xyes; 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 1 "unable to find supported libcerror in directory: $ac_cv_with_libcerror +See \`config.log' for more details" "$LINENO" 5; } fi @@ -17310,22 +17433,23 @@ ac_cv_libcthreads="no" ac_cv_libcthreads_multi_threading="no" else - if test "x$ac_cv_with_libcthreads" != x && test "x$ac_cv_with_libcthreads" != xno && test "x$ac_cv_with_libcthreads" != xauto-detect; then : + if test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libcthreads" = xno; then : + ac_cv_libcthreads=no +else + if test "x$ac_cv_with_libcthreads" != x && test "x$ac_cv_with_libcthreads" != xauto-detect; then : if test -d "$ac_cv_with_libcthreads"; then : CFLAGS="$CFLAGS -I${ac_cv_with_libcthreads}/include" - LDFLAGS="$LDFLAGS -L${ac_cv_with_libcthreads}/lib" + LDFLAGS="$LDFLAGS -L${ac_cv_with_libcthreads}/lib" else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no such directory: $ac_cv_with_libcthreads" >&5 -$as_echo "$as_me: WARNING: no such directory: $ac_cv_with_libcthreads" >&2;} - -fi + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 1 "no such directory: $ac_cv_with_libcthreads +See \`config.log' for more details" "$LINENO" 5; } fi - - if test "x$ac_cv_with_libcthreads" = xno; then : - ac_cv_libcthreads=no + ac_cv_libcthreads=check else - if test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"; then : + if test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcthreads" >&5 @@ -17399,10 +17523,11 @@ fi fi - - if test "x$ac_cv_libcthreads" = xyes; then : + if test "x$ac_cv_libcthreads" = xyes; then : ac_cv_libcthreads_CPPFLAGS="$pkg_cv_libcthreads_CFLAGS" - ac_cv_libcthreads_LIBADD="$pkg_cv_libcthreads_LIBS" + ac_cv_libcthreads_LIBADD="$pkg_cv_libcthreads_LIBS" +fi + fi if test "x$ac_cv_libcthreads" = xcheck; then : @@ -18946,9 +19071,16 @@ ac_cv_libcthreads_LIBADD="-lcthreads" +fi fi + if test "x$ac_cv_with_libcthreads" != x && test "x$ac_cv_with_libcthreads" != xauto-detect && test "x$ac_cv_libcthreads" != xyes; 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 1 "unable to find supported libcthreads in directory: $ac_cv_with_libcthreads +See \`config.log' for more details" "$LINENO" 5; } + fi fi @@ -19920,22 +20052,23 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_with_libcdata" >&5 $as_echo "$ac_cv_with_libcdata" >&6; } - if test "x$ac_cv_with_libcdata" != x && test "x$ac_cv_with_libcdata" != xno && test "x$ac_cv_with_libcdata" != xauto-detect; then : + if test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libcdata" = xno; then : + ac_cv_libcdata=no +else + if test "x$ac_cv_with_libcdata" != x && test "x$ac_cv_with_libcdata" != xauto-detect; then : if test -d "$ac_cv_with_libcdata"; then : CFLAGS="$CFLAGS -I${ac_cv_with_libcdata}/include" - LDFLAGS="$LDFLAGS -L${ac_cv_with_libcdata}/lib" + LDFLAGS="$LDFLAGS -L${ac_cv_with_libcdata}/lib" else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no such directory: $ac_cv_with_libcdata" >&5 -$as_echo "$as_me: WARNING: no such directory: $ac_cv_with_libcdata" >&2;} - -fi + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 1 "no such directory: $ac_cv_with_libcdata +See \`config.log' for more details" "$LINENO" 5; } fi - - if test "x$ac_cv_with_libcdata" = xno; then : - ac_cv_libcdata=no + ac_cv_libcdata=check else - if test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"; then : + if test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcdata" >&5 @@ -19945,12 +20078,12 @@ pkg_cv_libcdata_CFLAGS="$libcdata_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcdata >= 20160108\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libcdata >= 20160108") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcdata >= 20181216\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libcdata >= 20181216") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_libcdata_CFLAGS=`$PKG_CONFIG --cflags "libcdata >= 20160108" 2>/dev/null` + pkg_cv_libcdata_CFLAGS=`$PKG_CONFIG --cflags "libcdata >= 20181216" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -19962,12 +20095,12 @@ pkg_cv_libcdata_LIBS="$libcdata_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcdata >= 20160108\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libcdata >= 20160108") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcdata >= 20181216\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libcdata >= 20181216") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_libcdata_LIBS=`$PKG_CONFIG --libs "libcdata >= 20160108" 2>/dev/null` + pkg_cv_libcdata_LIBS=`$PKG_CONFIG --libs "libcdata >= 20181216" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -19988,9 +20121,9 @@ _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - libcdata_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libcdata >= 20160108" 2>&1` + libcdata_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libcdata >= 20181216" 2>&1` else - libcdata_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libcdata >= 20160108" 2>&1` + libcdata_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libcdata >= 20181216" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$libcdata_PKG_ERRORS" >&5 @@ -20009,10 +20142,11 @@ fi fi - - if test "x$ac_cv_libcdata" = xyes; then : + if test "x$ac_cv_libcdata" = xyes; then : ac_cv_libcdata_CPPFLAGS="$pkg_cv_libcdata_CFLAGS" - ac_cv_libcdata_LIBADD="$pkg_cv_libcdata_LIBS" + ac_cv_libcdata_LIBADD="$pkg_cv_libcdata_LIBS" +fi + fi if test "x$ac_cv_libcdata" = xcheck; then : @@ -20666,6 +20800,343 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libfdata_btree_initialize in -lcdata" >&5 +$as_echo_n "checking for libfdata_btree_initialize in -lcdata... " >&6; } +if ${ac_cv_lib_cdata_libfdata_btree_initialize+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcdata $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 libfdata_btree_initialize (); +int +main () +{ +return libfdata_btree_initialize (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_cdata_libfdata_btree_initialize=yes +else + ac_cv_lib_cdata_libfdata_btree_initialize=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_cdata_libfdata_btree_initialize" >&5 +$as_echo "$ac_cv_lib_cdata_libfdata_btree_initialize" >&6; } +if test "x$ac_cv_lib_cdata_libfdata_btree_initialize" = xyes; then : + ac_cv_libcdata_dummy=yes +else + ac_cv_libcdata=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcdata_btree_free in -lcdata" >&5 +$as_echo_n "checking for libcdata_btree_free in -lcdata... " >&6; } +if ${ac_cv_lib_cdata_libcdata_btree_free+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcdata $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 libcdata_btree_free (); +int +main () +{ +return libcdata_btree_free (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_cdata_libcdata_btree_free=yes +else + ac_cv_lib_cdata_libcdata_btree_free=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_cdata_libcdata_btree_free" >&5 +$as_echo "$ac_cv_lib_cdata_libcdata_btree_free" >&6; } +if test "x$ac_cv_lib_cdata_libcdata_btree_free" = xyes; then : + ac_cv_libcdata_dummy=yes +else + ac_cv_libcdata=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcdata_btree_get_number_of_values in -lcdata" >&5 +$as_echo_n "checking for libcdata_btree_get_number_of_values in -lcdata... " >&6; } +if ${ac_cv_lib_cdata_libcdata_btree_get_number_of_values+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcdata $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 libcdata_btree_get_number_of_values (); +int +main () +{ +return libcdata_btree_get_number_of_values (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_cdata_libcdata_btree_get_number_of_values=yes +else + ac_cv_lib_cdata_libcdata_btree_get_number_of_values=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_cdata_libcdata_btree_get_number_of_values" >&5 +$as_echo "$ac_cv_lib_cdata_libcdata_btree_get_number_of_values" >&6; } +if test "x$ac_cv_lib_cdata_libcdata_btree_get_number_of_values" = xyes; then : + ac_cv_libcdata_dummy=yes +else + ac_cv_libcdata=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcdata_btree_get_value_by_index in -lcdata" >&5 +$as_echo_n "checking for libcdata_btree_get_value_by_index in -lcdata... " >&6; } +if ${ac_cv_lib_cdata_libcdata_btree_get_value_by_index+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcdata $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 libcdata_btree_get_value_by_index (); +int +main () +{ +return libcdata_btree_get_value_by_index (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_cdata_libcdata_btree_get_value_by_index=yes +else + ac_cv_lib_cdata_libcdata_btree_get_value_by_index=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_cdata_libcdata_btree_get_value_by_index" >&5 +$as_echo "$ac_cv_lib_cdata_libcdata_btree_get_value_by_index" >&6; } +if test "x$ac_cv_lib_cdata_libcdata_btree_get_value_by_index" = xyes; then : + ac_cv_libcdata_dummy=yes +else + ac_cv_libcdata=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcdata_btree_get_value_by_value in -lcdata" >&5 +$as_echo_n "checking for libcdata_btree_get_value_by_value in -lcdata... " >&6; } +if ${ac_cv_lib_cdata_libcdata_btree_get_value_by_value+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcdata $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 libcdata_btree_get_value_by_value (); +int +main () +{ +return libcdata_btree_get_value_by_value (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_cdata_libcdata_btree_get_value_by_value=yes +else + ac_cv_lib_cdata_libcdata_btree_get_value_by_value=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_cdata_libcdata_btree_get_value_by_value" >&5 +$as_echo "$ac_cv_lib_cdata_libcdata_btree_get_value_by_value" >&6; } +if test "x$ac_cv_lib_cdata_libcdata_btree_get_value_by_value" = xyes; then : + ac_cv_libcdata_dummy=yes +else + ac_cv_libcdata=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcdata_btree_insert_value in -lcdata" >&5 +$as_echo_n "checking for libcdata_btree_insert_value in -lcdata... " >&6; } +if ${ac_cv_lib_cdata_libcdata_btree_insert_value+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcdata $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 libcdata_btree_insert_value (); +int +main () +{ +return libcdata_btree_insert_value (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_cdata_libcdata_btree_insert_value=yes +else + ac_cv_lib_cdata_libcdata_btree_insert_value=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_cdata_libcdata_btree_insert_value" >&5 +$as_echo "$ac_cv_lib_cdata_libcdata_btree_insert_value" >&6; } +if test "x$ac_cv_lib_cdata_libcdata_btree_insert_value" = xyes; then : + ac_cv_libcdata_dummy=yes +else + ac_cv_libcdata=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcdata_btree_replace_value in -lcdata" >&5 +$as_echo_n "checking for libcdata_btree_replace_value in -lcdata... " >&6; } +if ${ac_cv_lib_cdata_libcdata_btree_replace_value+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcdata $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 libcdata_btree_replace_value (); +int +main () +{ +return libcdata_btree_replace_value (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_cdata_libcdata_btree_replace_value=yes +else + ac_cv_lib_cdata_libcdata_btree_replace_value=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_cdata_libcdata_btree_replace_value" >&5 +$as_echo "$ac_cv_lib_cdata_libcdata_btree_replace_value" >&6; } +if test "x$ac_cv_lib_cdata_libcdata_btree_replace_value" = xyes; then : + ac_cv_libcdata_dummy=yes +else + ac_cv_libcdata=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcdata_btree_remove_value in -lcdata" >&5 +$as_echo_n "checking for libcdata_btree_remove_value in -lcdata... " >&6; } +if ${ac_cv_lib_cdata_libcdata_btree_remove_value+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcdata $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 libcdata_btree_remove_value (); +int +main () +{ +return libcdata_btree_remove_value (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_cdata_libcdata_btree_remove_value=yes +else + ac_cv_lib_cdata_libcdata_btree_remove_value=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_cdata_libcdata_btree_remove_value" >&5 +$as_echo "$ac_cv_lib_cdata_libcdata_btree_remove_value" >&6; } +if test "x$ac_cv_lib_cdata_libcdata_btree_remove_value" = xyes; then : + ac_cv_libcdata_dummy=yes +else + ac_cv_libcdata=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcdata_list_initialize in -lcdata" >&5 $as_echo_n "checking for libcdata_list_initialize in -lcdata... " >&6; } if ${ac_cv_lib_cdata_libcdata_list_initialize+:} false; then : @@ -23233,8 +23704,14 @@ ac_cv_libcdata_LIBADD="-lcdata" +fi fi + if test "x$ac_cv_with_libcdata" != x && test "x$ac_cv_with_libcdata" != xauto-detect && test "x$ac_cv_libcdata" != xyes; 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 1 "unable to find supported libcdata in directory: $ac_cv_with_libcdata +See \`config.log' for more details" "$LINENO" 5; } fi @@ -23326,22 +23803,23 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_with_libclocale" >&5 $as_echo "$ac_cv_with_libclocale" >&6; } - if test "x$ac_cv_with_libclocale" != x && test "x$ac_cv_with_libclocale" != xno && test "x$ac_cv_with_libclocale" != xauto-detect; then : + if test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libclocale" = xno; then : + ac_cv_libclocale=no +else + if test "x$ac_cv_with_libclocale" != x && test "x$ac_cv_with_libclocale" != xauto-detect; then : if test -d "$ac_cv_with_libclocale"; then : CFLAGS="$CFLAGS -I${ac_cv_with_libclocale}/include" - LDFLAGS="$LDFLAGS -L${ac_cv_with_libclocale}/lib" + LDFLAGS="$LDFLAGS -L${ac_cv_with_libclocale}/lib" else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no such directory: $ac_cv_with_libclocale" >&5 -$as_echo "$as_me: WARNING: no such directory: $ac_cv_with_libclocale" >&2;} - -fi + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 1 "no such directory: $ac_cv_with_libclocale +See \`config.log' for more details" "$LINENO" 5; } fi - - if test "x$ac_cv_with_libclocale" = xno; then : - ac_cv_libclocale=no + ac_cv_libclocale=check else - if test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"; then : + if test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libclocale" >&5 @@ -23415,8 +23893,7 @@ fi fi - - if test "x$ac_cv_libclocale" = xyes && test "x$ac_cv_enable_wide_character_type" != xno; then : + if test "x$ac_cv_libclocale" = xyes && test "x$ac_cv_enable_wide_character_type" != xno; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libclocale/features.h defines LIBCLOCALE_HAVE_WIDE_CHARACTER_TYPE as 1" >&5 $as_echo_n "checking whether libclocale/features.h defines LIBCLOCALE_HAVE_WIDE_CHARACTER_TYPE as 1... " >&6; } if ${ac_cv_header_libclocale_features_h_have_wide_character_type+:} false; then : @@ -23428,7 +23905,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -23436,7 +23913,7 @@ { #if !defined( LIBCLOCALE_HAVE_WIDE_CHARACTER_TYPE ) || ( LIBCLOCALE_HAVE_WIDE_CHARACTER_TYPE != 1 ) #error LIBCLOCALE_HAVE_WIDE_CHARACTER_TYPE not defined -##endif +#endif ; return 0; } @@ -23447,7 +23924,7 @@ ac_cv_header_libclocale_features_h_have_wide_character_type=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c + 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' @@ -23457,15 +23934,16 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_libclocale_features_h_have_wide_character_type" >&5 $as_echo "$ac_cv_header_libclocale_features_h_have_wide_character_type" >&6; } - if test "x$ac_cv_header_libclocale_features_h_have_wide_character_type" = xno; then : + if test "x$ac_cv_header_libclocale_features_h_have_wide_character_type" = xno; then : ac_cv_libclocale=no fi fi - - if test "x$ac_cv_libclocale" = xyes; then : + if test "x$ac_cv_libclocale" = xyes; then : ac_cv_libclocale_CPPFLAGS="$pkg_cv_libclocale_CFLAGS" - ac_cv_libclocale_LIBADD="$pkg_cv_libclocale_LIBS" + ac_cv_libclocale_LIBADD="$pkg_cv_libclocale_LIBS" +fi + fi if test "x$ac_cv_libclocale" = xcheck; then : @@ -23699,7 +24177,7 @@ fi - if test "x$ac_cv_enable_wide_character_type" != xno; then : + if test "x$ac_cv_enable_wide_character_type" != xno; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libclocale_codepage_copy_from_string_wide in -lclocale" >&5 $as_echo_n "checking for libclocale_codepage_copy_from_string_wide in -lclocale... " >&6; } if ${ac_cv_lib_clocale_libclocale_codepage_copy_from_string_wide+:} false; then : @@ -23874,8 +24352,14 @@ ac_cv_libclocale_LIBADD="-lclocale" +fi fi + if test "x$ac_cv_with_libclocale" != x && test "x$ac_cv_with_libclocale" != xauto-detect && test "x$ac_cv_libclocale" != xyes; 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 1 "unable to find supported libclocale in directory: $ac_cv_with_libclocale +See \`config.log' for more details" "$LINENO" 5; } fi @@ -24106,22 +24590,23 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_with_libcnotify" >&5 $as_echo "$ac_cv_with_libcnotify" >&6; } - if test "x$ac_cv_with_libcnotify" != x && test "x$ac_cv_with_libcnotify" != xno && test "x$ac_cv_with_libcnotify" != xauto-detect; then : + if test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libcnotify" = xno; then : + ac_cv_libcnotify=no +else + if test "x$ac_cv_with_libcnotify" != x && test "x$ac_cv_with_libcnotify" != xauto-detect; then : if test -d "$ac_cv_with_libcnotify"; then : CFLAGS="$CFLAGS -I${ac_cv_with_libcnotify}/include" - LDFLAGS="$LDFLAGS -L${ac_cv_with_libcnotify}/lib" + LDFLAGS="$LDFLAGS -L${ac_cv_with_libcnotify}/lib" else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no such directory: $ac_cv_with_libcnotify" >&5 -$as_echo "$as_me: WARNING: no such directory: $ac_cv_with_libcnotify" >&2;} - -fi + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 1 "no such directory: $ac_cv_with_libcnotify +See \`config.log' for more details" "$LINENO" 5; } fi - - if test "x$ac_cv_with_libcnotify" = xno; then : - ac_cv_libcnotify=no + ac_cv_libcnotify=check else - if test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"; then : + if test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcnotify" >&5 @@ -24195,10 +24680,11 @@ fi fi - - if test "x$ac_cv_libcnotify" = xyes; then : + if test "x$ac_cv_libcnotify" = xyes; then : ac_cv_libcnotify_CPPFLAGS="$pkg_cv_libcnotify_CFLAGS" - ac_cv_libcnotify_LIBADD="$pkg_cv_libcnotify_LIBS" + ac_cv_libcnotify_LIBADD="$pkg_cv_libcnotify_LIBS" +fi + fi if test "x$ac_cv_libcnotify" = xcheck; then : @@ -24561,8 +25047,14 @@ ac_cv_libcnotify_LIBADD="-lcnotify" +fi fi + if test "x$ac_cv_with_libcnotify" != x && test "x$ac_cv_with_libcnotify" != xauto-detect && test "x$ac_cv_libcnotify" != xyes; 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 1 "unable to find supported libcnotify in directory: $ac_cv_with_libcnotify +See \`config.log' for more details" "$LINENO" 5; } fi @@ -24688,22 +25180,23 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_with_libuna" >&5 $as_echo "$ac_cv_with_libuna" >&6; } - if test "x$ac_cv_with_libuna" != x && test "x$ac_cv_with_libuna" != xno && test "x$ac_cv_with_libuna" != xauto-detect; then : + if test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libuna" = xno; then : + ac_cv_libuna=no +else + if test "x$ac_cv_with_libuna" != x && test "x$ac_cv_with_libuna" != xauto-detect; then : if test -d "$ac_cv_with_libuna"; then : CFLAGS="$CFLAGS -I${ac_cv_with_libuna}/include" - LDFLAGS="$LDFLAGS -L${ac_cv_with_libuna}/lib" + LDFLAGS="$LDFLAGS -L${ac_cv_with_libuna}/lib" else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no such directory: $ac_cv_with_libuna" >&5 -$as_echo "$as_me: WARNING: no such directory: $ac_cv_with_libuna" >&2;} - -fi + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 1 "no such directory: $ac_cv_with_libuna +See \`config.log' for more details" "$LINENO" 5; } fi - - if test "x$ac_cv_with_libuna" = xno; then : - ac_cv_libuna=no + ac_cv_libuna=check else - if test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"; then : + if test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libuna" >&5 @@ -24713,12 +25206,12 @@ pkg_cv_libuna_CFLAGS="$libuna_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libuna >= 20120425\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libuna >= 20120425") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libuna >= 20181006\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libuna >= 20181006") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_libuna_CFLAGS=`$PKG_CONFIG --cflags "libuna >= 20120425" 2>/dev/null` + pkg_cv_libuna_CFLAGS=`$PKG_CONFIG --cflags "libuna >= 20181006" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -24730,12 +25223,12 @@ pkg_cv_libuna_LIBS="$libuna_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libuna >= 20120425\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libuna >= 20120425") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libuna >= 20181006\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libuna >= 20181006") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_libuna_LIBS=`$PKG_CONFIG --libs "libuna >= 20120425" 2>/dev/null` + pkg_cv_libuna_LIBS=`$PKG_CONFIG --libs "libuna >= 20181006" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -24756,18 +25249,18 @@ _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - libuna_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libuna >= 20120425" 2>&1` + libuna_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libuna >= 20181006" 2>&1` else - libuna_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libuna >= 20120425" 2>&1` + libuna_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libuna >= 20181006" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$libuna_PKG_ERRORS" >&5 - ac_cv_libuna=no + ac_cv_libuna=check elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - ac_cv_libuna=no + ac_cv_libuna=check else libuna_CFLAGS=$pkg_cv_libuna_CFLAGS libuna_LIBS=$pkg_cv_libuna_LIBS @@ -24777,11 +25270,14 @@ fi fi - - if test "x$ac_cv_libuna" = xyes; then : + if test "x$ac_cv_libuna" = xyes; then : ac_cv_libuna_CPPFLAGS="$pkg_cv_libuna_CFLAGS" - ac_cv_libuna_LIBADD="$pkg_cv_libuna_LIBS" -else + ac_cv_libuna_LIBADD="$pkg_cv_libuna_LIBS" +fi + +fi + + if test "x$ac_cv_libuna" = xcheck; then : for ac_header in libuna.h do : ac_fn_c_check_header_mongrel "$LINENO" "libuna.h" "ac_cv_header_libuna_h" "$ac_includes_default" @@ -29474,8 +29970,14 @@ ac_cv_libuna_LIBADD="-luna" +fi fi + if test "x$ac_cv_with_libuna" != x && test "x$ac_cv_with_libuna" != xauto-detect && test "x$ac_cv_libuna" != xyes; 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 1 "unable to find supported libuna in directory: $ac_cv_with_libuna +See \`config.log' for more details" "$LINENO" 5; } fi @@ -29567,22 +30069,23 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_with_libcfile" >&5 $as_echo "$ac_cv_with_libcfile" >&6; } - if test "x$ac_cv_with_libcfile" != x && test "x$ac_cv_with_libcfile" != xno && test "x$ac_cv_with_libcfile" != xauto-detect; then : + if test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libcfile" = xno; then : + ac_cv_libcfile=no +else + if test "x$ac_cv_with_libcfile" != x && test "x$ac_cv_with_libcfile" != xauto-detect; then : if test -d "$ac_cv_with_libcfile"; then : CFLAGS="$CFLAGS -I${ac_cv_with_libcfile}/include" - LDFLAGS="$LDFLAGS -L${ac_cv_with_libcfile}/lib" + LDFLAGS="$LDFLAGS -L${ac_cv_with_libcfile}/lib" else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no such directory: $ac_cv_with_libcfile" >&5 -$as_echo "$as_me: WARNING: no such directory: $ac_cv_with_libcfile" >&2;} - -fi + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 1 "no such directory: $ac_cv_with_libcfile +See \`config.log' for more details" "$LINENO" 5; } fi - - if test "x$ac_cv_with_libcfile" = xno; then : - ac_cv_libcfile=no + ac_cv_libcfile=check else - if test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"; then : + if test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcfile" >&5 @@ -29656,8 +30159,7 @@ fi fi - - if test "x$ac_cv_libcfile" = xyes && test "x$ac_cv_enable_wide_character_type" != xno; then : + if test "x$ac_cv_libcfile" = xyes && test "x$ac_cv_enable_wide_character_type" != xno; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libcfile/features.h defines LIBCFILE_HAVE_WIDE_CHARACTER_TYPE as 1" >&5 $as_echo_n "checking whether libcfile/features.h defines LIBCFILE_HAVE_WIDE_CHARACTER_TYPE as 1... " >&6; } if ${ac_cv_header_libcfile_features_h_have_wide_character_type+:} false; then : @@ -29669,7 +30171,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -29677,7 +30179,7 @@ { #if !defined( LIBCFILE_HAVE_WIDE_CHARACTER_TYPE ) || ( LIBCFILE_HAVE_WIDE_CHARACTER_TYPE != 1 ) #error LIBCFILE_HAVE_WIDE_CHARACTER_TYPE not defined -##endif +#endif ; return 0; } @@ -29688,7 +30190,7 @@ ac_cv_header_libcfile_features_h_have_wide_character_type=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c + 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' @@ -29698,15 +30200,16 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_libcfile_features_h_have_wide_character_type" >&5 $as_echo "$ac_cv_header_libcfile_features_h_have_wide_character_type" >&6; } - if test "x$ac_cv_header_libcfile_features_h_have_wide_character_type" = xno; then : + if test "x$ac_cv_header_libcfile_features_h_have_wide_character_type" = xno; then : ac_cv_libcfile=no fi fi - - if test "x$ac_cv_libcfile" = xyes; then : + if test "x$ac_cv_libcfile" = xyes; then : ac_cv_libcfile_CPPFLAGS="$pkg_cv_libcfile_CFLAGS" - ac_cv_libcfile_LIBADD="$pkg_cv_libcfile_LIBS" + ac_cv_libcfile_LIBADD="$pkg_cv_libcfile_LIBS" +fi + fi if test "x$ac_cv_libcfile" = xcheck; then : @@ -30748,8 +31251,14 @@ fi ac_cv_libcfile_LIBADD="-lcfile" +fi fi + if test "x$ac_cv_with_libcfile" != x && test "x$ac_cv_with_libcfile" != xauto-detect && test "x$ac_cv_libcfile" != xyes; 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 1 "unable to find supported libcfile in directory: $ac_cv_with_libcfile +See \`config.log' for more details" "$LINENO" 5; } fi @@ -31472,6 +31981,7 @@ $as_echo "$ac_cv_with_pyprefix" >&6; } + # Check whether --enable-python was given. if test "${enable_python+set}" = set; then : enableval=$enable_python; ac_cv_enable_python=$enableval @@ -31507,11 +32017,83 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_with_pythondir" >&5 $as_echo "$ac_cv_with_pythondir" >&6; } + + # Check whether --enable-python2 was given. +if test "${enable_python2+set}" = set; then : + enableval=$enable_python2; ac_cv_enable_python2=$enableval +else + ac_cv_enable_python2=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable build Python 2 bindings" >&5 +$as_echo_n "checking whether to enable build Python 2 bindings... " >&6; } +if ${ac_cv_enable_python2+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_enable_python2=no +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_python2" >&5 +$as_echo "$ac_cv_enable_python2" >&6; } + + +# Check whether --with-pythondir2 was given. +if test "${with_pythondir2+set}" = set; then : + withval=$with_pythondir2; ac_cv_with_pythondir2=$withval +else + ac_cv_with_pythondir2=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use use to specify the Python 2 directory (pythondir2)" >&5 +$as_echo_n "checking whether to use use to specify the Python 2 directory (pythondir2)... " >&6; } +if ${ac_cv_with_pythondir2+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_with_pythondir2=no +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_with_pythondir2" >&5 +$as_echo "$ac_cv_with_pythondir2" >&6; } + + + # Check whether --enable-python3 was given. +if test "${enable_python3+set}" = set; then : + enableval=$enable_python3; ac_cv_enable_python3=$enableval +else + ac_cv_enable_python3=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable build Python 3 bindings" >&5 +$as_echo_n "checking whether to enable build Python 3 bindings... " >&6; } +if ${ac_cv_enable_python3+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_enable_python3=no +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_python3" >&5 +$as_echo "$ac_cv_enable_python3" >&6; } + + +# Check whether --with-pythondir3 was given. +if test "${with_pythondir3+set}" = set; then : + withval=$with_pythondir3; ac_cv_with_pythondir3=$withval +else + ac_cv_with_pythondir3=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use use to specify the Python 3 directory (pythondir3)" >&5 +$as_echo_n "checking whether to use use to specify the Python 3 directory (pythondir3)... " >&6; } +if ${ac_cv_with_pythondir3+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_with_pythondir3=no +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_with_pythondir3" >&5 +$as_echo "$ac_cv_with_pythondir3" >&6; } + if test "x${ac_cv_enable_python}" != xno; then : if test "x${PYTHON_VERSION}" != x; then : ax_python_progs="python${PYTHON_VERSION}" else - ax_python_progs="python python2 python2.7 python2.6 python2.5 python3 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0" + ax_python_progs="python python2 python2.7 python2.6 python2.5 python3 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0" fi for ac_prog in $ax_python_progs do @@ -31735,58 +32317,6 @@ fi - if test "x${ac_cv_enable_python}" != xno; then : - -$as_echo "#define HAVE_PYTHON 1" >>confdefs.h - - -fi - - if test "x${ac_cv_enable_python}" != xno; then - HAVE_PYTHON_TRUE= - HAVE_PYTHON_FALSE='#' -else - HAVE_PYTHON_TRUE='#' - HAVE_PYTHON_FALSE= -fi - - - - # Check whether --enable-python2 was given. -if test "${enable_python2+set}" = set; then : - enableval=$enable_python2; ac_cv_enable_python2=$enableval -else - ac_cv_enable_python2=no -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable build Python 2 bindings" >&5 -$as_echo_n "checking whether to enable build Python 2 bindings... " >&6; } -if ${ac_cv_enable_python2+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_enable_python2=no -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_python2" >&5 -$as_echo "$ac_cv_enable_python2" >&6; } - - -# Check whether --with-pythondir2 was given. -if test "${with_pythondir2+set}" = set; then : - withval=$with_pythondir2; ac_cv_with_pythondir2=$withval -else - ac_cv_with_pythondir2=no -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use use to specify the Python 2 directory (pythondir2)" >&5 -$as_echo_n "checking whether to use use to specify the Python 2 directory (pythondir2)... " >&6; } -if ${ac_cv_with_pythondir2+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_with_pythondir2=no -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_with_pythondir2" >&5 -$as_echo "$ac_cv_with_pythondir2" >&6; } - if test "x${ac_cv_enable_python2}" != xno; then : ax_python2_progs="python2 python2.7 python2.6 python2.5" for ac_prog in $ax_python2_progs @@ -31915,6 +32445,15 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON2_LDFLAGS" >&5 $as_echo "$PYTHON2_LDFLAGS" >&6; } + case $host_os in #( + cygwin*) : + PYTHON2_LDFLAGS="${PYTHON2_LDFLAGS} -no-undefined" ;; #( + *) : + ;; #( + *) : + ;; +esac + BACKUP_CPPFLAGS="${CPPFLAGS}" CPPFLAGS="${CPPFLAGS} ${PYTHON2_INCLUDES}" @@ -32002,58 +32541,6 @@ fi - if test "x${ac_cv_enable_python2}" != xno; then : - -$as_echo "#define HAVE_PYTHON2 1" >>confdefs.h - - -fi - - if test "x${ac_cv_enable_python2}" != xno; then - HAVE_PYTHON2_TRUE= - HAVE_PYTHON2_FALSE='#' -else - HAVE_PYTHON2_TRUE='#' - HAVE_PYTHON2_FALSE= -fi - - - - # Check whether --enable-python3 was given. -if test "${enable_python3+set}" = set; then : - enableval=$enable_python3; ac_cv_enable_python3=$enableval -else - ac_cv_enable_python3=no -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable build Python 3 bindings" >&5 -$as_echo_n "checking whether to enable build Python 3 bindings... " >&6; } -if ${ac_cv_enable_python3+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_enable_python3=no -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_python3" >&5 -$as_echo "$ac_cv_enable_python3" >&6; } - - -# Check whether --with-pythondir3 was given. -if test "${with_pythondir3+set}" = set; then : - withval=$with_pythondir3; ac_cv_with_pythondir3=$withval -else - ac_cv_with_pythondir3=no -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use use to specify the Python 3 directory (pythondir3)" >&5 -$as_echo_n "checking whether to use use to specify the Python 3 directory (pythondir3)... " >&6; } -if ${ac_cv_with_pythondir3+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_with_pythondir3=no -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_with_pythondir3" >&5 -$as_echo "$ac_cv_with_pythondir3" >&6; } - if test "x${ac_cv_enable_python3}" != xno; then : ax_python3_progs="python3 python3.4 python3.3 python3.2 python3.1 python3.0" for ac_prog in $ax_python3_progs @@ -32182,6 +32669,15 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON3_LDFLAGS" >&5 $as_echo "$PYTHON3_LDFLAGS" >&6; } + case $host_os in #( + cygwin*) : + PYTHON3_LDFLAGS="${PYTHON3_LDFLAGS} -no-undefined" ;; #( + *) : + ;; #( + *) : + ;; +esac + BACKUP_CPPFLAGS="${CPPFLAGS}" CPPFLAGS="${CPPFLAGS} ${PYTHON3_INCLUDES}" @@ -32269,13 +32765,24 @@ fi - if test "x${ac_cv_enable_python3}" != xno; then : - -$as_echo "#define HAVE_PYTHON3 1" >>confdefs.h + if test "x${ac_cv_enable_python}" != xno; then + HAVE_PYTHON_TRUE= + HAVE_PYTHON_FALSE='#' +else + HAVE_PYTHON_TRUE='#' + HAVE_PYTHON_FALSE= +fi + if test "x${ac_cv_enable_python2}" != xno; then + HAVE_PYTHON2_TRUE= + HAVE_PYTHON2_FALSE='#' +else + HAVE_PYTHON2_TRUE='#' + HAVE_PYTHON2_FALSE= fi + if test "x${ac_cv_enable_python3}" != xno; then HAVE_PYTHON3_TRUE= HAVE_PYTHON3_FALSE='#' @@ -32285,6 +32792,33 @@ fi + if test "x${ac_cv_enable_python}" != xno || test "x${ac_cv_enable_python2}" != xno || test "x${ac_cv_enable_python3}" != xno; then + HAVE_PYTHON_TESTS_TRUE= + HAVE_PYTHON_TESTS_FALSE='#' +else + HAVE_PYTHON_TESTS_TRUE='#' + HAVE_PYTHON_TESTS_FALSE= +fi + + + if test "x${ac_cv_enable_python}" = xno; then : + if test "x${ac_cv_enable_python2}" != xno || test "x${ac_cv_enable_python3}" != xno; then : + if test "x${ac_cv_enable_python2}" != xno; then : + ac_cv_enable_python=${ac_cv_enable_python2} +else + ac_cv_enable_python="" +fi + if test "x${ac_cv_enable_python3}" != xno; then : + if test "x${ac_cv_enable_python}" != x; then : + ac_cv_enable_python="${ac_cv_enable_python}, " +fi + ac_cv_enable_python="${ac_cv_enable_python}${ac_cv_enable_python3}" +fi + +fi + +fi + if test "x${ac_cv_enable_python}" != xno || test "x${ac_cv_enable_python2}" != xno || test "x${ac_cv_enable_python3}" != xno; then : for ac_header in stdarg.h varargs.h @@ -32311,15 +32845,6 @@ fi - if test "x${ac_cv_enable_python}" != xno || test "x${ac_cv_enable_python2}" != xno || test "x${ac_cv_enable_python3}" != xno; then - HAVE_PYTHON_TESTS_TRUE= - HAVE_PYTHON_TESTS_FALSE='#' -else - HAVE_PYTHON_TESTS_TRUE='#' - HAVE_PYTHON_TESTS_FALSE= -fi - - for ac_header in signal.h sys/signal.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` @@ -32380,6 +32905,7 @@ ac_cv_enable_static_executables=yes + enable_shared=no fi @@ -32396,62 +32922,6 @@ fi - - - # Check whether --enable-verbose-output was given. -if test "${enable_verbose_output+set}" = set; then : - enableval=$enable_verbose_output; ac_cv_enable_verbose_output=$enableval -else - ac_cv_enable_verbose_output=no -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable enable verbose output" >&5 -$as_echo_n "checking whether to enable enable verbose output... " >&6; } -if ${ac_cv_enable_verbose_output+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_enable_verbose_output=no -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_verbose_output" >&5 -$as_echo "$ac_cv_enable_verbose_output" >&6; } - - if test "x$ac_cv_enable_verbose_output" != xno ; then : - -$as_echo "#define HAVE_VERBOSE_OUTPUT 1" >>confdefs.h - - - ac_cv_enable_verbose_output=yes -fi - - - - - # Check whether --enable-debug-output was given. -if test "${enable_debug_output+set}" = set; then : - enableval=$enable_debug_output; ac_cv_enable_debug_output=$enableval -else - ac_cv_enable_debug_output=no -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable enable debug output" >&5 -$as_echo_n "checking whether to enable enable debug output... " >&6; } -if ${ac_cv_enable_debug_output+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_enable_debug_output=no -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_debug_output" >&5 -$as_echo "$ac_cv_enable_debug_output" >&6; } - - if test "x$ac_cv_enable_debug_output" != xno ; then : - -$as_echo "#define HAVE_DEBUG_OUTPUT 1" >>confdefs.h - - - ac_cv_enable_debug_output=yes -fi - - for ac_header in dlfcn.h do : ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" @@ -32465,7 +32935,7 @@ done - for ac_func in fmemopen getopt + for ac_func in fmemopen getopt mkstemp unlink 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" @@ -32534,14 +33004,17 @@ if test "x$enable_shared" = xyes; then : case $host in #( - *cygwin* | *mingw*) : + *cygwin* | *mingw* | *msys*) : $as_echo "#define HAVE_DLLMAIN 1" >>confdefs.h HAVE_DLLMAIN=1 - LIBSMDEV_DLL_IMPORT="-DLIBSMDEV_DLL_IMPORT" + LIBSMDEV_DLL_EXPORT="-DLIBSMDEV_DLL_EXPORT" + + + LIBSMDEV_DLL_IMPORT="-DLIBSMDEV_DLL_IMPORT" ;; #( *) : @@ -32555,8 +33028,6 @@ if test "x$ac_cv_libcerror" = xyes || test "x$ac_cv_libcthreads" = xyes || test "x$ac_cv_libcdata" = xyes || test "x$ac_cv_libclocale" = xyes || test "x$ac_cv_libcnotify" = xyes || test "x$ac_cv_libuna" = xyes || test "x$ac_cv_libcfile" = xyes; then : libsmdev_spec_requires=Requires: - libsmdev_spec_build_requires=BuildRequires: - fi @@ -33203,7 +33674,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libsmdev $as_me 20171112, which was +This file was extended by libsmdev $as_me 20181227, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -33269,7 +33740,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libsmdev config.status 20171112 +libsmdev config.status 20181227 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -33388,7 +33859,7 @@ # # INIT-COMMANDS # -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" # The HP-UX ksh and POSIX shell print the target directory to stdout @@ -34323,29 +34794,35 @@ # 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 @@ -34363,53 +34840,48 @@ 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\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^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\(\/\).*/{ + /^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 } ;; "libtool":C) @@ -35125,8 +35597,6 @@ Wide character type support: $ac_cv_enable_wide_character_type smdevtools are build as static executables: $ac_cv_enable_static_executables Python (pysmdev) support: $ac_cv_enable_python - Python version 2 (pysmdev) support: $ac_cv_enable_python2 - Python version 3 (pysmdev) support: $ac_cv_enable_python3 Verbose output: $ac_cv_enable_verbose_output Debug output: $ac_cv_enable_debug_output " >&5 @@ -35145,8 +35615,6 @@ Wide character type support: $ac_cv_enable_wide_character_type smdevtools are build as static executables: $ac_cv_enable_static_executables Python (pysmdev) support: $ac_cv_enable_python - Python version 2 (pysmdev) support: $ac_cv_enable_python2 - Python version 3 (pysmdev) support: $ac_cv_enable_python3 Verbose output: $ac_cv_enable_verbose_output Debug output: $ac_cv_enable_debug_output " >&6;}; diff -Nru libsmdev-20171112/configure.ac libsmdev-20181227/configure.ac --- libsmdev-20171112/configure.ac 2017-11-12 14:19:27.000000000 +0000 +++ libsmdev-20181227/configure.ac 2018-12-27 14:12:43.000000000 +0000 @@ -2,7 +2,7 @@ AC_INIT( [libsmdev], - [20171112], + [20181227], [joachim.metz@gmail.com]) AC_CONFIG_SRCDIR( @@ -42,12 +42,21 @@ dnl Check for large file support AC_SYS_LARGEFILE +dnl Check if shared library support should be disabled +AX_COMMON_CHECK_DISABLE_SHARED_LIBS + dnl Check if WINAPI support should be enabled AX_COMMON_CHECK_ENABLE_WINAPI dnl Check if wide character type should be enabled AX_COMMON_CHECK_ENABLE_WIDE_CHARACTER_TYPE +dnl Check if verbose output should be enabled +AX_COMMON_CHECK_ENABLE_VERBOSE_OUTPUT + +dnl Check if debug output should be enabled +AX_COMMON_CHECK_ENABLE_DEBUG_OUTPUT + dnl Check for type definitions AX_TYPES_CHECK_LOCAL @@ -79,10 +88,7 @@ AX_LIBSMDEV_CHECK_LOCAL dnl Check if libsmdev Python bindings (pysmdev) required headers and functions are available -AX_PYTHON_CHECK_PYPREFIX AX_PYTHON_CHECK_ENABLE -AX_PYTHON2_CHECK_ENABLE -AX_PYTHON3_CHECK_ENABLE AS_IF( [test "x${ac_cv_enable_python}" != xno || test "x${ac_cv_enable_python2}" != xno || test "x${ac_cv_enable_python3}" != xno], @@ -97,19 +103,9 @@ ]) ]) -AM_CONDITIONAL( - HAVE_PYTHON_TESTS, - [test "x${ac_cv_enable_python}" != xno || test "x${ac_cv_enable_python2}" != xno || test "x${ac_cv_enable_python3}" != xno]) - dnl Check if smdevtools required headers and functions are available AX_SMDEVTOOLS_CHECK_LOCAL -dnl Check if libsmdev should be build with verbose output -AX_COMMON_CHECK_ENABLE_VERBOSE_OUTPUT - -dnl Check if libsmdev should be build with debug output -AX_COMMON_CHECK_ENABLE_DEBUG_OUTPUT - dnl Check if tests required headers and functions are available AX_TESTS_CHECK_LOCAL @@ -118,7 +114,7 @@ [test "x$enable_shared" = xyes], [AS_CASE( [$host], - [*cygwin* | *mingw*], + [*cygwin* | *mingw* | *msys*], [AC_DEFINE( [HAVE_DLLMAIN], [1], @@ -127,7 +123,10 @@ [HAVE_DLLMAIN], [1]) - dnl Used in tests + AC_SUBST( + [LIBSMDEV_DLL_EXPORT], + ["-DLIBSMDEV_DLL_EXPORT"]) + AC_SUBST( [LIBSMDEV_DLL_IMPORT], ["-DLIBSMDEV_DLL_IMPORT"]) @@ -143,9 +142,6 @@ [AC_SUBST( [libsmdev_spec_requires], [Requires:]) - AC_SUBST( - [libsmdev_spec_build_requires], - [BuildRequires:]) ]) dnl Set the date for the dpkg files @@ -212,8 +208,6 @@ Wide character type support: $ac_cv_enable_wide_character_type smdevtools are build as static executables: $ac_cv_enable_static_executables Python (pysmdev) support: $ac_cv_enable_python - Python version 2 (pysmdev) support: $ac_cv_enable_python2 - Python version 3 (pysmdev) support: $ac_cv_enable_python3 Verbose output: $ac_cv_enable_verbose_output Debug output: $ac_cv_enable_debug_output ]); diff -Nru libsmdev-20171112/COPYING libsmdev-20181227/COPYING --- libsmdev-20171112/COPYING 2010-01-10 11:08:52.000000000 +0000 +++ libsmdev-20181227/COPYING 2018-12-27 14:12:43.000000000 +0000 @@ -10,7 +10,7 @@ the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. - 0. Additional Definitions. + 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU @@ -111,7 +111,7 @@ a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked - Version. + Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the diff -Nru libsmdev-20171112/debian/changelog libsmdev-20181227/debian/changelog --- libsmdev-20171112/debian/changelog 2018-10-31 12:35:39.000000000 +0000 +++ libsmdev-20181227/debian/changelog 2019-01-13 22:28:10.000000000 +0000 @@ -1,8 +1,19 @@ -libsmdev (20171112-1build1) disco; urgency=medium +libsmdev (20181227-1) unstable; urgency=medium - * No-change rebuild to build for python3.7 as the default. + [ Raphaël Hertzog ] + * Update team maintainer address to Debian Security Tools + + * Update Vcs-Git and Vcs-Browser for the move to salsa.debian.org - -- Matthias Klose Wed, 31 Oct 2018 12:35:39 +0000 + [ Hilko Bengen ] + * New upstream version 20181227 + * Drop unneeded dh --parallel parameter + * Bump Debhelper compat level + * Replace dh_install --fail-missing + * Bump Standards-Version + * Enable hardening rules + + -- Hilko Bengen Sun, 13 Jan 2019 23:28:10 +0100 libsmdev (20171112-1) unstable; urgency=medium diff -Nru libsmdev-20171112/debian/compat libsmdev-20181227/debian/compat --- libsmdev-20171112/debian/compat 2017-11-12 15:00:04.000000000 +0000 +++ libsmdev-20181227/debian/compat 2019-01-13 22:26:04.000000000 +0000 @@ -1 +1 @@ -10 +11 diff -Nru libsmdev-20171112/debian/control libsmdev-20181227/debian/control --- libsmdev-20171112/debian/control 2017-11-12 15:00:04.000000000 +0000 +++ libsmdev-20181227/debian/control 2019-01-13 22:26:47.000000000 +0000 @@ -1,14 +1,14 @@ Source: libsmdev Priority: optional -Maintainer: Debian Forensics +Maintainer: Debian Security Tools Uploaders: Hilko Bengen -Build-Depends: debhelper (>= 10),dh-python, +Build-Depends: debhelper (>= 11),dh-python, pkg-config, python-dev, python3-dev, -Standards-Version: 4.1.1 +Standards-Version: 4.3.0 Section: libs Homepage: https://github.com/libyal/libsmdev -Vcs-Git: https://anonscm.debian.org/git/forensics/libsmdev.git -Vcs-Browser: https://anonscm.debian.org/git/forensics/libsmdev.git +Vcs-Git: https://salsa.debian.org/pkg-security-team/libsmdev.git +Vcs-Browser: https://salsa.debian.org/pkg-security-team/libsmdev Package: libsmdev-dev Section: libdevel diff -Nru libsmdev-20171112/debian/rules libsmdev-20181227/debian/rules --- libsmdev-20171112/debian/rules 2017-11-12 15:00:49.000000000 +0000 +++ libsmdev-20181227/debian/rules 2019-01-13 22:27:11.000000000 +0000 @@ -4,13 +4,19 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all +export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + export SKIP_PYTHON_TESTS=1 %: - dh $@ --with python2,python3 --parallel + dh $@ --with python2,python3 override_dh_auto_configure: - dh_auto_configure -- --enable-python2 --enable-python3 CFLAGS="-g" + dh_auto_configure -- --enable-python2 --enable-python3 + +override_dh_missing: + dh_missing -X.la -X/pysmdev.a --fail-missing override_dh_install: - dh_install -X.la -X/pysmdev.a --fail-missing + dh_install -X.la -X/pysmdev.a diff -Nru libsmdev-20171112/depcomp libsmdev-20181227/depcomp --- libsmdev-20171112/depcomp 2017-11-12 14:33:40.000000000 +0000 +++ libsmdev-20181227/depcomp 2018-12-27 19:19:40.000000000 +0000 @@ -1,9 +1,9 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2013-05-30.07; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -783,9 +783,9 @@ # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff -Nru libsmdev-20171112/dpkg/changelog libsmdev-20181227/dpkg/changelog --- libsmdev-20171112/dpkg/changelog 2017-11-12 14:33:50.000000000 +0000 +++ libsmdev-20181227/dpkg/changelog 2018-12-27 19:20:30.000000000 +0000 @@ -1,5 +1,5 @@ -libsmdev (20171112-1) unstable; urgency=low +libsmdev (20181227-1) unstable; urgency=low * Auto-generated - -- Joachim Metz Sun, 12 Nov 2017 15:33:49 +0100 + -- Joachim Metz Thu, 27 Dec 2018 20:20:29 +0100 diff -Nru libsmdev-20171112/dpkg/control libsmdev-20181227/dpkg/control --- libsmdev-20171112/dpkg/control 2017-11-12 14:19:27.000000000 +0000 +++ libsmdev-20181227/dpkg/control 2018-12-27 14:12:43.000000000 +0000 @@ -9,6 +9,8 @@ Package: libsmdev Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} +Conflicts: libsmdev1 +Replaces: libsmdev1 Suggests: libsmdev-dbg Description: Library to access and read storage media (SM) devices libsmdev is a library to access and read storage media (SM) devices. @@ -31,6 +33,8 @@ Section: utils Architecture: any Depends: libsmdev (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Conflicts: libsmdev-utils +Replaces: libsmdev-utils Description: Several tools for accessing storage media (SM) devices Several tools for accessing storage media (SM) devices. @@ -45,6 +49,8 @@ Section: python Architecture: any Depends: libsmdev (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Conflicts: python-libsmdev +Replaces: python-libsmdev Suggests: libsmdev-python-dbg Description: Python 2 bindings for libsmdev Python 2 bindings for libsmdev. @@ -60,6 +66,8 @@ Section: python Architecture: any Depends: libsmdev (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Conflicts: python3-libsmdev +Replaces: python3-libsmdev Suggests: libsmdev-python3-dbg Description: Python 3 bindings for libsmdev Python 3 bindings for libsmdev. diff -Nru libsmdev-20171112/dpkg/copyright libsmdev-20181227/dpkg/copyright --- libsmdev-20171112/dpkg/copyright 2017-11-12 14:19:27.000000000 +0000 +++ libsmdev-20181227/dpkg/copyright 2018-12-27 14:12:59.000000000 +0000 @@ -3,7 +3,7 @@ Source: https://github.com/libyal/libsmdev Files: * -Copyright: 2010-2017, Joachim Metz +Copyright: 2010-2018, Joachim Metz License: LGPL-3.0+ License: LGPL-3.0+ diff -Nru libsmdev-20171112/include/libsmdev/codepage.h libsmdev-20181227/include/libsmdev/codepage.h --- libsmdev-20171112/include/libsmdev/codepage.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/include/libsmdev/codepage.h 2018-12-27 14:12:56.000000000 +0000 @@ -1,7 +1,7 @@ /* * Codepage definitions for libsmdev * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/include/libsmdev/definitions.h libsmdev-20181227/include/libsmdev/definitions.h --- libsmdev-20171112/include/libsmdev/definitions.h 2017-11-12 14:33:50.000000000 +0000 +++ libsmdev-20181227/include/libsmdev/definitions.h 2018-12-27 19:20:30.000000000 +0000 @@ -1,7 +1,7 @@ /* * Definitions for libsmdev * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -24,11 +24,11 @@ #include -#define LIBSMDEV_VERSION 20171112 +#define LIBSMDEV_VERSION 20181227 /* The version string */ -#define LIBSMDEV_VERSION_STRING "20171112" +#define LIBSMDEV_VERSION_STRING "20181227" /* The access flags definitions * bit 1 set to 1 for read access diff -Nru libsmdev-20171112/include/libsmdev/definitions.h.in libsmdev-20181227/include/libsmdev/definitions.h.in --- libsmdev-20171112/include/libsmdev/definitions.h.in 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/include/libsmdev/definitions.h.in 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Definitions for libsmdev * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/include/libsmdev/error.h libsmdev-20181227/include/libsmdev/error.h --- libsmdev-20171112/include/libsmdev/error.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/include/libsmdev/error.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * The error code definitions for libsmdev * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/include/libsmdev/extern.h libsmdev-20181227/include/libsmdev/extern.h --- libsmdev-20171112/include/libsmdev/extern.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/include/libsmdev/extern.h 2018-12-27 14:12:57.000000000 +0000 @@ -4,7 +4,7 @@ * This header should be included in header files that export or import * library functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/include/libsmdev/features.h libsmdev-20181227/include/libsmdev/features.h --- libsmdev-20171112/include/libsmdev/features.h 2017-11-12 14:33:50.000000000 +0000 +++ libsmdev-20181227/include/libsmdev/features.h 2018-12-27 19:20:30.000000000 +0000 @@ -1,7 +1,7 @@ /* * Features of libsmdev * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/include/libsmdev/features.h.in libsmdev-20181227/include/libsmdev/features.h.in --- libsmdev-20171112/include/libsmdev/features.h.in 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/include/libsmdev/features.h.in 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Features of libsmdev * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/include/libsmdev/types.h libsmdev-20181227/include/libsmdev/types.h --- libsmdev-20171112/include/libsmdev/types.h 2017-11-12 14:33:50.000000000 +0000 +++ libsmdev-20181227/include/libsmdev/types.h 2018-12-27 19:20:30.000000000 +0000 @@ -1,7 +1,7 @@ /* * Type definitions for libsmdev * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/include/libsmdev/types.h.in libsmdev-20181227/include/libsmdev/types.h.in --- libsmdev-20171112/include/libsmdev/types.h.in 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/include/libsmdev/types.h.in 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Type definitions for libsmdev * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/include/libsmdev.h libsmdev-20181227/include/libsmdev.h --- libsmdev-20171112/include/libsmdev.h 2017-11-12 14:33:50.000000000 +0000 +++ libsmdev-20181227/include/libsmdev.h 2018-12-27 19:20:30.000000000 +0000 @@ -1,7 +1,7 @@ /* * Library to access and read the storage media (SM) devices * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/include/libsmdev.h.in libsmdev-20181227/include/libsmdev.h.in --- libsmdev-20171112/include/libsmdev.h.in 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/include/libsmdev.h.in 2018-12-27 14:12:56.000000000 +0000 @@ -1,7 +1,7 @@ /* * Library to access and read the storage media (SM) devices * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/include/Makefile.in libsmdev-20181227/include/Makefile.in --- libsmdev-20171112/include/Makefile.in 2017-11-12 14:33:39.000000000 +0000 +++ libsmdev-20181227/include/Makefile.in 2018-12-27 19:19:38.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 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, @@ -266,6 +266,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSMDEV_DLL_EXPORT = @LIBSMDEV_DLL_EXPORT@ LIBSMDEV_DLL_IMPORT = @LIBSMDEV_DLL_IMPORT@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -415,7 +416,6 @@ libcthreads_LIBS = @libcthreads_LIBS@ libdir = @libdir@ libexecdir = @libexecdir@ -libsmdev_spec_build_requires = @libsmdev_spec_build_requires@ libsmdev_spec_requires = @libsmdev_spec_requires@ libuna_CFLAGS = @libuna_CFLAGS@ libuna_LIBS = @libuna_LIBS@ @@ -482,8 +482,8 @@ *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) @@ -597,7 +597,10 @@ 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 -Nru libsmdev-20171112/INSTALL libsmdev-20181227/INSTALL --- libsmdev-20171112/INSTALL 2017-11-12 14:33:39.000000000 +0000 +++ libsmdev-20181227/INSTALL 2018-12-27 19:19:37.000000000 +0000 @@ -1,8 +1,8 @@ Installation Instructions ************************* -Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, -Inc. + Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software +Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright @@ -12,97 +12,96 @@ Basic Installation ================== - Briefly, the shell command `./configure && make && make install' + Briefly, the shell command './configure && make && make install' should configure, build, and install this package. The following -more-detailed instructions are generic; see the `README' file for +more-detailed instructions are generic; see the 'README' file for instructions specific to this package. Some packages provide this -`INSTALL' file but do not implement all of the features documented +'INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. - The `configure' shell script attempts to guess correct values for + The 'configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that +those values to create a 'Makefile' in each directory of the package. +It may also create one or more '.h' files containing system-dependent +definitions. Finally, it creates a shell script 'config.status' that you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). +file 'config.log' containing compiler output (useful mainly for +debugging 'configure'). - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. Caching is -disabled by default to prevent problems with accidental use of stale -cache files. + It can also use an optional file (typically called 'config.cache' and +enabled with '--cache-file=config.cache' or simply '-C') that saves the +results of its tests to speed up reconfiguring. Caching is disabled by +default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can +to figure out how 'configure' could check whether to do them, and mail +diffs or instructions to the address given in the 'README' so they can be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you +some point 'config.cache' contains results you don't want to keep, you may remove or edit it. - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You need `configure.ac' if -you want to change it or regenerate `configure' using a newer version -of `autoconf'. + The file 'configure.ac' (or 'configure.in') is used to create +'configure' by a program called 'autoconf'. You need 'configure.ac' if +you want to change it or regenerate 'configure' using a newer version of +'autoconf'. The simplest way to compile this package is: - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. + 1. 'cd' to the directory containing the package's source code and type + './configure' to configure the package for your system. - Running `configure' might take a while. While running, it prints + Running 'configure' might take a while. While running, it prints some messages telling which features it is checking for. - 2. Type `make' to compile the package. + 2. Type 'make' to compile the package. - 3. Optionally, type `make check' to run any self-tests that come with + 3. Optionally, type 'make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. - 4. Type `make install' to install the programs and any data files and + 4. Type 'make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular - user, and only the `make install' phase executed with root + user, and only the 'make install' phase executed with root privileges. - 5. Optionally, type `make installcheck' to repeat any self-tests, but + 5. Optionally, type 'make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a - regular user, particularly if the prior `make install' required + regular user, particularly if the prior 'make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly + source code directory by typing 'make clean'. To also remove the + files that 'configure' created (so you can compile the package for + a different kind of computer), type 'make distclean'. There is + also a 'make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. - 7. Often, you can also type `make uninstall' to remove the installed + 7. Often, you can also type 'make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. - 8. Some packages, particularly those that use Automake, provide `make + 8. Some packages, particularly those that use Automake, provide 'make distcheck', which can by used by developers to test that all other - targets like `make install' and `make uninstall' work correctly. + targets like 'make install' and 'make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that -the `configure' script does not know about. Run `./configure --help' +the 'configure' script does not know about. Run './configure --help' for details on some of the pertinent environment variables. - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: + You can give 'configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here is +an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix @@ -113,21 +112,21 @@ You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their -own directory. To do this, you can use GNU `make'. `cd' to the +own directory. To do this, you can use GNU 'make'. 'cd' to the directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. This -is known as a "VPATH" build. +the 'configure' script. 'configure' automatically checks for the source +code in the directory that 'configure' is in and in '..'. This is known +as a "VPATH" build. - With a non-GNU `make', it is safer to compile the package for one + With a non-GNU 'make', it is safer to compile the package for one architecture at a time in the source code directory. After you have -installed the package for one architecture, use `make distclean' before +installed the package for one architecture, use 'make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or -"universal" binaries--by specifying multiple `-arch' options to the -compiler but only a single `-arch' option to the preprocessor. Like +"universal" binaries--by specifying multiple '-arch' options to the +compiler but only a single '-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ @@ -136,105 +135,104 @@ This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results -using the `lipo' tool if you have problems. +using the 'lipo' tool if you have problems. Installation Names ================== - By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX', where PREFIX must be an + By default, 'make install' installs the package's commands under +'/usr/local/bin', include files under '/usr/local/include', etc. You +can specify an installation prefix other than '/usr/local' by giving +'configure' the option '--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses +pass the option '--exec-prefix=PREFIX' to 'configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. In general, the -default for these options is expressed in terms of `${prefix}', so that -specifying just `--prefix' will affect all of the other directory +options like '--bindir=DIR' to specify different values for particular +kinds of files. Run 'configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the default +for these options is expressed in terms of '${prefix}', so that +specifying just '--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the -correct locations to `configure'; however, many packages provide one or +correct locations to 'configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the -`make install' command line to change installation locations without +'make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each -affected directory. For example, `make install +affected directory. For example, 'make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of -`${prefix}'. Any directories that were specified during `configure', -but not in terms of `${prefix}', must each be overridden at install -time for the entire installation to be relocated. The approach of -makefile variable overrides for each directory variable is required by -the GNU Coding Standards, and ideally causes no recompilation. -However, some platforms have known limitations with the semantics of -shared libraries that end up requiring recompilation when using this -method, particularly noticeable in packages that use GNU Libtool. - - The second method involves providing the `DESTDIR' variable. For -example, `make install DESTDIR=/alternate/directory' will prepend -`/alternate/directory' before all installation names. The approach of -`DESTDIR' overrides is not required by the GNU Coding Standards, and +'${prefix}'. Any directories that were specified during 'configure', +but not in terms of '${prefix}', must each be overridden at install time +for the entire installation to be relocated. The approach of makefile +variable overrides for each directory variable is required by the GNU +Coding Standards, and ideally causes no recompilation. However, some +platforms have known limitations with the semantics of shared libraries +that end up requiring recompilation when using this method, particularly +noticeable in packages that use GNU Libtool. + + The second method involves providing the 'DESTDIR' variable. For +example, 'make install DESTDIR=/alternate/directory' will prepend +'/alternate/directory' before all installation names. The approach of +'DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even -when some directory options were not specified in terms of `${prefix}' -at `configure' time. +when some directory options were not specified in terms of '${prefix}' +at 'configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. +with an extra prefix or suffix on their names by giving 'configure' the +option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the + Some packages pay attention to '--enable-FEATURE' options to +'configure', where FEATURE indicates an optional part of the package. +They may also pay attention to '--with-PACKAGE' options, where PACKAGE +is something like 'gnu-as' or 'x' (for the X Window System). The +'README' should mention any '--enable-' and '--with-' options that the package recognizes. - For packages that use the X Window System, `configure' can usually + For packages that use the X Window System, 'configure' can usually find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. +you can use the 'configure' options '--x-includes=DIR' and +'--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the -execution of `make' will be. For these packages, running `./configure +execution of 'make' will be. For these packages, running './configure --enable-silent-rules' sets the default to minimal output, which can be -overridden with `make V=1'; while running `./configure +overridden with 'make V=1'; while running './configure --disable-silent-rules' sets the default to verbose, which can be -overridden with `make V=0'. +overridden with 'make V=0'. Particular systems ================== - On HP-UX, the default C compiler is not ANSI C compatible. If GNU -CC is not installed, it is recommended to use the following options in + On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC +is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. - HP-UX `make' updates targets which have the same time stamps as -their prerequisites, which makes it generally unusable when shipped -generated files such as `configure' are involved. Use GNU `make' -instead. + HP-UX 'make' updates targets which have the same time stamps as their +prerequisites, which makes it generally unusable when shipped generated +files such as 'configure' are involved. Use GNU 'make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot -parse its `' header file. The option `-nodtk' can be used as -a workaround. If GNU CC is not installed, it is therefore recommended -to try +parse its '' header file. The option '-nodtk' can be used as a +workaround. If GNU CC is not installed, it is therefore recommended to +try ./configure CC="cc" @@ -242,26 +240,26 @@ ./configure CC="cc -nodtk" - On Solaris, don't put `/usr/ucb' early in your `PATH'. This + On Solaris, don't put '/usr/ucb' early in your 'PATH'. This directory contains several dysfunctional programs; working variants of -these programs are available in `/usr/bin'. So, if you need `/usr/ucb' -in your `PATH', put it _after_ `/usr/bin'. +these programs are available in '/usr/bin'. So, if you need '/usr/ucb' +in your 'PATH', put it _after_ '/usr/bin'. - On Haiku, software installed for all users goes in `/boot/common', -not `/usr/local'. It is recommended to use the following options: + On Haiku, software installed for all users goes in '/boot/common', +not '/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== - There may be some features `configure' cannot figure out + There may be some features 'configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the -_same_ architectures, `configure' can figure that out, but if it prints +_same_ architectures, 'configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: +'--build=TYPE' option. TYPE can either be a short name for the system +type, such as 'sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM @@ -270,101 +268,101 @@ OS KERNEL-OS - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't + See the file 'config.sub' for the possible values of each field. If +'config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will +use the option '--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. +eventually be run) with '--host=TYPE'. Sharing Defaults ================ - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. + If you want to set default values for 'configure' scripts to share, +you can create a site shell script called 'config.site' that gives +default values for variables like 'CC', 'cache_file', and 'prefix'. +'configure' looks for 'PREFIX/share/config.site' if it exists, then +'PREFIX/etc/config.site' if it exists. Or, you can set the +'CONFIG_SITE' environment variable to the location of the site script. +A warning: not all 'configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run +environment passed to 'configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: +them in the 'configure' command line, using 'VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc -causes the specified `gcc' to be used as the C compiler (unless it is +causes the specified 'gcc' to be used as the C compiler (unless it is overridden in the site shell script). -Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf limitation. Until the limitation is lifted, you can use -this workaround: +Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an +Autoconf limitation. Until the limitation is lifted, you can use this +workaround: CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash -`configure' Invocation +'configure' Invocation ====================== - `configure' recognizes the following options to control how it + 'configure' recognizes the following options to control how it operates. -`--help' -`-h' - Print a summary of all of the options to `configure', and exit. +'--help' +'-h' + Print a summary of all of the options to 'configure', and exit. -`--help=short' -`--help=recursive' +'--help=short' +'--help=recursive' Print a summary of the options unique to this package's - `configure', and exit. The `short' variant lists options used - only in the top level, while the `recursive' variant lists options - also present in any nested packages. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' + 'configure', and exit. The 'short' variant lists options used only + in the top level, while the 'recursive' variant lists options also + present in any nested packages. + +'--version' +'-V' + Print the version of Autoconf used to generate the 'configure' script, and exit. -`--cache-file=FILE' +'--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to + traditionally 'config.cache'. FILE defaults to '/dev/null' to disable caching. -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' +'--config-cache' +'-C' + Alias for '--cache-file=config.cache'. + +'--quiet' +'--silent' +'-q' Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error + suppress all normal output, redirect it to '/dev/null' (any error messages will still be shown). -`--srcdir=DIR' +'--srcdir=DIR' Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. + 'configure' can determine that directory automatically. -`--prefix=DIR' - Use DIR as the installation prefix. *note Installation Names:: - for more details, including other options available for fine-tuning - the installation locations. +'--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: for + more details, including other options available for fine-tuning the + installation locations. -`--no-create' -`-n' +'--no-create' +'-n' Run the configure checks, but stop before creating any output files. -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. +'configure' also accepts some other, not widely useful, options. Run +'configure --help' for more details. diff -Nru libsmdev-20171112/install-sh libsmdev-20181227/install-sh --- libsmdev-20171112/install-sh 2017-11-12 14:33:39.000000000 +0000 +++ libsmdev-20181227/install-sh 2018-12-27 19:19:37.000000000 +0000 @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2013-12-25.23; # UTC +scriptversion=2018-03-11.20; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -271,15 +271,18 @@ fi dst=$dst_arg - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. + # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst - dst=$dstdir/`basename "$src"` + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac dstdir_status=0 else dstdir=`dirname "$dst"` @@ -288,6 +291,11 @@ fi fi + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + obsolete_mkdir_used=false if test $dstdir_status != 0; then @@ -324,34 +332,43 @@ # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) + # Note that $RANDOM variable is not portable (e.g. dash); Use it + # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p' feature. if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi - rmdir "$tmpdir/d" "$tmpdir" + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac;; @@ -427,8 +444,8 @@ else # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ + dsttmp=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 @@ -493,9 +510,9 @@ done # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff -Nru libsmdev-20171112/libcdata/libcdata_array.c libsmdev-20181227/libcdata/libcdata_array.c --- libsmdev-20171112/libcdata/libcdata_array.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_array.c 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * Array functions * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -514,7 +514,6 @@ libcdata_internal_array_t *internal_source_array = NULL; static char *function = "libcdata_array_clone"; int entry_iterator = 0; - int result = 1; if( destination_array == NULL ) { @@ -605,7 +604,7 @@ "%s: unable to grab read/write lock for reading.", function ); - goto on_error; + return( -1 ); } #endif if( internal_source_array->entries != NULL ) @@ -616,12 +615,10 @@ { if( internal_source_array->entries[ entry_iterator ] != NULL ) { - result = entry_clone_function( - &( internal_destination_array->entries[ entry_iterator ] ), - internal_source_array->entries[ entry_iterator ], - error ); - - if( result != 1 ) + if( entry_clone_function( + &( internal_destination_array->entries[ entry_iterator ] ), + internal_source_array->entries[ entry_iterator ], + error ) != 1 ) { libcerror_error_set( error, @@ -648,7 +645,12 @@ "%s: unable to release read/write lock for reading.", function ); - goto on_error; + libcdata_array_free( + (libcdata_array_t **) &internal_destination_array, + entry_free_function, + NULL ); + + return( -1 ); } #endif *destination_array = (libcdata_array_t *) internal_destination_array; diff -Nru libsmdev-20171112/libcdata/libcdata_array.h libsmdev-20181227/libcdata/libcdata_array.h --- libsmdev-20171112/libcdata/libcdata_array.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_array.h 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * Array functions * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcdata/libcdata_btree.c libsmdev-20181227/libcdata/libcdata_btree.c --- libsmdev-20171112/libcdata/libcdata_btree.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_btree.c 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * Balanced tree type functions * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -27,6 +27,7 @@ #include "libcdata_btree.h" #include "libcdata_definitions.h" #include "libcdata_libcerror.h" +#include "libcdata_libcthreads.h" #include "libcdata_list.h" #include "libcdata_list_element.h" #include "libcdata_tree_node.h" @@ -137,6 +138,21 @@ } internal_tree->maximum_number_of_values = maximum_number_of_values; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_initialize( + &( internal_tree->read_write_lock ), + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, + "%s: unable to intialize read/write lock.", + function ); + + goto on_error; + } +#endif *tree = (libcdata_btree_t *) internal_tree; return( 1 ); @@ -188,6 +204,21 @@ internal_tree = (libcdata_internal_btree_t *) *tree; *tree = NULL; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_free( + &( internal_tree->read_write_lock ), + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to free read/write lock.", + function ); + + result = -1; + } +#endif if( libcdata_tree_node_free( &( internal_tree->root_node ), (int (*)(intptr_t **, libcerror_error_t **)) &libcdata_btree_free_values_list, @@ -286,15 +317,28 @@ libcdata_list_element_t **values_list_element, libcerror_error_t **error ) { - libcdata_list_t *values_list = NULL; - intptr_t *values_list_value = NULL; - static char *function = "libcdata_btree_node_get_sub_node_by_value"; - int number_of_sub_nodes = 0; - int number_of_values_list_elements = 0; - int result = 0; - int sub_node_index = 0; - int values_list_element_index = 0; + libcdata_list_t *values_list = NULL; + libcdata_list_element_t *safe_values_list_element = NULL; + libcdata_tree_node_t *safe_sub_node = NULL; + intptr_t *values_list_value = NULL; + static char *function = "libcdata_btree_node_get_sub_node_by_value"; + int number_of_sub_nodes = 0; + int number_of_values_list_elements = 0; + int result = 0; + int sub_node_index = 0; + int values_list_element_index = 0; + + if( node == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid node.", + function ); + return( -1 ); + } if( value == NULL ) { libcerror_error_set( @@ -328,7 +372,8 @@ return( -1 ); } - *sub_node = NULL; + *sub_node = NULL; + *values_list_element = NULL; if( libcdata_tree_node_get_value( node, @@ -375,44 +420,25 @@ return( -1 ); } - if( number_of_sub_nodes != 0 ) + if( ( number_of_sub_nodes != 0 ) + && ( ( number_of_values_list_elements + 1 ) != number_of_sub_nodes ) ) { - if( ( number_of_values_list_elements + 1 ) != number_of_sub_nodes ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS, - "%s: invalid number of values list elements value out of bounds.", - function ); - - return( -1 ); - } - if( libcdata_tree_node_get_sub_node_by_index( - node, - 0, - sub_node, - error ) != 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_GET_FAILED, - "%s: unable to retrieve sub node: 0.", - function ); + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS, + "%s: invalid number of values list elements value out of bounds.", + function ); - return( -1 ); - } + return( -1 ); } if( number_of_values_list_elements == 0 ) { - *values_list_element = NULL; - return( 0 ); } if( libcdata_list_get_first_element( values_list, - values_list_element, + &safe_values_list_element, error ) != 1 ) { libcerror_error_set( @@ -424,12 +450,30 @@ return( -1 ); } + if( number_of_sub_nodes != 0 ) + { + if( libcdata_tree_node_get_sub_node_by_index( + node, + 0, + &safe_sub_node, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to retrieve sub node: 0.", + function ); + + return( -1 ); + } + } for( values_list_element_index = 0; values_list_element_index < number_of_values_list_elements; values_list_element_index++ ) { if( libcdata_list_element_get_value( - *values_list_element, + safe_values_list_element, &values_list_value, error ) != 1 ) { @@ -455,56 +499,59 @@ return( -1 ); } - if( value_compare_function == NULL ) - { - if( value == values_list_value ) - { - return( 1 ); - } - } - else + if( value_compare_function != NULL ) { result = value_compare_function( value, values_list_value, error ); + } + else if( value == values_list_value ) + { + result = LIBCDATA_COMPARE_EQUAL; + } + else + { + result = LIBCDATA_COMPARE_GREATER; + } + if( result == -1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to compare value with values list value: %d.", + function, + values_list_element_index ); - if( result == -1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_GET_FAILED, - "%s: unable to compare value with values list value: %d.", - function, - values_list_element_index ); + return( -1 ); + } + else if( result == LIBCDATA_COMPARE_EQUAL ) + { + *sub_node = safe_sub_node; + *values_list_element = safe_values_list_element; - return( -1 ); - } - else if( result == LIBCDATA_COMPARE_EQUAL ) - { - return( 1 ); - } - else if( result == LIBCDATA_COMPARE_LESS ) - { - break; - } - else if( result != LIBCDATA_COMPARE_GREATER ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, - "%s: unsupported value compare function return value: %d.", - function, - result ); + return( 1 ); + } + else if( result == LIBCDATA_COMPARE_LESS ) + { + break; + } + else if( result != LIBCDATA_COMPARE_GREATER ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, + "%s: unsupported value compare function return value: %d.", + function, + result ); - return( -1 ); - } + return( -1 ); } if( libcdata_list_element_get_next_element( - *values_list_element, - values_list_element, + safe_values_list_element, + &safe_values_list_element, error ) != 1 ) { libcerror_error_set( @@ -520,8 +567,8 @@ if( number_of_sub_nodes != 0 ) { if( libcdata_tree_node_get_next_node( - *sub_node, - sub_node, + safe_sub_node, + &safe_sub_node, error ) != 1 ) { libcerror_error_set( @@ -537,6 +584,9 @@ sub_node_index++; } } + *sub_node = safe_sub_node; + *values_list_element = safe_values_list_element; + return( 0 ); } @@ -1487,6 +1537,17 @@ int sub_node_index = 0; int values_list_element_index = 0; + if( node == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid node.", + function ); + + return( -1 ); + } if( libcdata_tree_node_get_number_of_sub_nodes( node, &number_of_sub_nodes, diff -Nru libsmdev-20171112/libcdata/libcdata_btree.h libsmdev-20181227/libcdata/libcdata_btree.h --- libsmdev-20171112/libcdata/libcdata_btree.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_btree.h 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * Balanced tree type functions * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -27,6 +27,7 @@ #include "libcdata_extern.h" #include "libcdata_libcerror.h" +#include "libcdata_libcthreads.h" #include "libcdata_types.h" #if defined( __cplusplus ) @@ -52,6 +53,12 @@ /* The maximum number of values */ int maximum_number_of_values; + +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + /* The read/write lock + */ + libcthreads_read_write_lock_t *read_write_lock; +#endif }; LIBCDATA_EXTERN \ diff -Nru libsmdev-20171112/libcdata/libcdata_definitions.h libsmdev-20181227/libcdata/libcdata_definitions.h --- libsmdev-20171112/libcdata/libcdata_definitions.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_definitions.h 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal definitions * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -35,11 +35,11 @@ */ #else -#define LIBCDATA_VERSION 20171014 +#define LIBCDATA_VERSION 20181216 /* The libcdata version string */ -#define LIBCDATA_VERSION_STRING "20171014" +#define LIBCDATA_VERSION_STRING "20181216" /* The comparison function definitions */ diff -Nru libsmdev-20171112/libcdata/libcdata_error.c libsmdev-20181227/libcdata/libcdata_error.c --- libsmdev-20171112/libcdata/libcdata_error.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_error.c 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * Error functions * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcdata/libcdata_error.h libsmdev-20181227/libcdata/libcdata_error.h --- libsmdev-20171112/libcdata/libcdata_error.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_error.h 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * Error functions * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcdata/libcdata_extern.h libsmdev-20181227/libcdata/libcdata_extern.h --- libsmdev-20171112/libcdata/libcdata_extern.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_extern.h 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal extern definition * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -28,17 +28,13 @@ */ #if !defined( HAVE_LOCAL_LIBCDATA ) -/* If libtool DLL support is enabled set LIBCDATA_DLL_EXPORT - * before including libcdata/extern.h - */ -#if defined( _WIN32 ) && defined( DLL_EXPORT ) -#define LIBCDATA_DLL_EXPORT -#endif - #include +#define LIBCDATA_EXTERN_VARIABLE LIBCDATA_EXTERN + #else -#define LIBCDATA_EXTERN /* extern */ +#define LIBCDATA_EXTERN /* extern */ +#define LIBCDATA_EXTERN_VARIABLE extern #endif /* !defined( HAVE_LOCAL_LIBCDATA ) */ diff -Nru libsmdev-20171112/libcdata/libcdata_libcerror.h libsmdev-20181227/libcdata/libcdata_libcerror.h --- libsmdev-20171112/libcdata/libcdata_libcerror.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_libcerror.h 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* - * The internal libcerror header + * The libcerror header wrapper * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcdata/libcdata_libcthreads.h libsmdev-20181227/libcdata/libcdata_libcthreads.h --- libsmdev-20171112/libcdata/libcdata_libcthreads.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_libcthreads.h 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* - * The internal libcthreads header + * The libcthreads header wrapper * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcdata/libcdata_list.c libsmdev-20181227/libcdata/libcdata_list.c --- libsmdev-20171112/libcdata/libcdata_list.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_list.c 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * List functions * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -153,35 +153,35 @@ internal_list = (libcdata_internal_list_t *) *list; *list = NULL; -#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) - if( libcthreads_read_write_lock_free( - &( internal_list->read_write_lock ), + if( libcdata_list_empty( + (libcdata_list_t*) internal_list, + value_free_function, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, - "%s: unable to free read/write lock.", + "%s: unable to empty list.", function ); result = -1; } -#endif - if( libcdata_internal_list_empty( - internal_list, - value_free_function, +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_free( + &( internal_list->read_write_lock ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, - "%s: unable to empty list.", + "%s: unable to free read/write lock.", function ); result = -1; } +#endif memory_free( internal_list ); } @@ -190,24 +190,24 @@ /* Empties a list and frees the elements * Uses the value_free_function to free the element value - * This function is not multi-thread safe acquire write lock before call * Returns 1 if successful or -1 on error */ -int libcdata_internal_list_empty( - libcdata_internal_list_t *internal_list, +int libcdata_list_empty( + libcdata_list_t *list, int (*value_free_function)( intptr_t **value, libcerror_error_t **error ), libcerror_error_t **error ) { - libcdata_list_element_t *list_element = NULL; - libcdata_list_element_t *next_element = NULL; - static char *function = "libcdata_internal_list_empty"; - int element_index = 0; - int number_of_elements = 0; - int result = 1; + libcdata_internal_list_t *internal_list = NULL; + libcdata_list_element_t *list_element = NULL; + libcdata_list_element_t *next_element = NULL; + static char *function = "libcdata_list_empty"; + int element_index = 0; + int number_of_elements = 0; + int result = 1; - if( internal_list == NULL ) + if( list == NULL ) { libcerror_error_set( error, @@ -218,6 +218,23 @@ return( -1 ); } + internal_list = (libcdata_internal_list_t *) list; + +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + + return( -1 ); + } +#endif if( internal_list->number_of_elements > 0 ) { number_of_elements = internal_list->number_of_elements; @@ -241,7 +258,7 @@ function, element_index ); - return( -1 ); + goto on_error; } internal_list->first_element = next_element; @@ -266,7 +283,7 @@ function, element_index + 1 ); - return( -1 ); + goto on_error; } } if( libcdata_list_element_set_next_element( @@ -282,7 +299,7 @@ function, element_index ); - return( -1 ); + goto on_error; } if( libcdata_list_element_free( &list_element, @@ -297,71 +314,11 @@ function, element_index ); - return( -1 ); + result = -1; } list_element = next_element; } } - return( result ); -} - -/* Empties a list and frees the elements - * Uses the value_free_function to free the element value - * Returns 1 if successful or -1 on error - */ -int libcdata_list_empty( - libcdata_list_t *list, - int (*value_free_function)( - intptr_t **value, - libcerror_error_t **error ), - libcerror_error_t **error ) -{ - libcdata_internal_list_t *internal_list = NULL; - static char *function = "libcdata_list_empty"; - int result = 1; - - if( list == NULL ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, - "%s: invalid list.", - function ); - - return( -1 ); - } - internal_list = (libcdata_internal_list_t *) list; - -#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) - if( libcthreads_read_write_lock_grab_for_write( - internal_list->read_write_lock, - error ) != 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_SET_FAILED, - "%s: unable to grab read/write lock for writing.", - function ); - - return( -1 ); - } -#endif - if( libcdata_internal_list_empty( - internal_list, - value_free_function, - error ) != 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, - "%s: unable to empty list.", - function ); - - result = -1; - } #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) if( libcthreads_read_write_lock_release_for_write( internal_list->read_write_lock, @@ -378,6 +335,14 @@ } #endif return( result ); + +on_error: +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_write( + internal_list->read_write_lock, + NULL ); +#endif + return( -1 ); } /* Clones the list and its elements @@ -399,13 +364,12 @@ libcerror_error_t **error ), libcerror_error_t **error ) { - libcdata_internal_list_t *internal_source_list = NULL; - libcdata_list_element_t *source_list_element = NULL; - intptr_t *destination_value = NULL; - intptr_t *source_value = NULL; - static char *function = "libcdata_list_clone"; - int element_index = 0; - int result = 1; + libcdata_internal_list_t *internal_destination_list = NULL; + libcdata_internal_list_t *internal_source_list = NULL; + libcdata_internal_list_element_t *internal_source_list_element = NULL; + intptr_t *destination_value = NULL; + static char *function = "libcdata_list_clone"; + int element_index = 0; if( destination_list == NULL ) { @@ -460,7 +424,7 @@ internal_source_list = (libcdata_internal_list_t *) source_list; if( libcdata_list_initialize( - destination_list, + (libcdata_list_t **) &internal_destination_list, error ) != 1 ) { libcerror_error_set( @@ -470,9 +434,9 @@ "%s: unable to create destination list.", function ); - goto on_error; + return( -1 ); } - if( *destination_list == NULL ) + if( internal_destination_list == NULL ) { libcerror_error_set( error, @@ -481,7 +445,7 @@ "%s: missing destination list.", function ); - goto on_error; + return( -1 ); } #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) if( libcthreads_read_write_lock_grab_for_read( @@ -495,83 +459,62 @@ "%s: unable to grab read/write lock for reading.", function ); - goto on_error; + return( -1 ); } #endif - source_list_element = internal_source_list->first_element; - - for( element_index = 0; - element_index < internal_source_list->number_of_elements; - element_index++ ) - { - result = libcdata_list_element_get_value( - source_list_element, - &source_value, - error ); - - if( result != 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_GET_FAILED, - "%s: unable to retrieve value from source list element: %d.", - function, - element_index ); - - break; - } - result = value_clone_function( - &destination_value, - source_value, - error ); - - if( result != 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, - "%s: unable to create destination value: %d.", - function, - element_index ); - - break; - } - result = libcdata_list_append_value( - *destination_list, - destination_value, - error ); + if( internal_source_list->first_element != NULL ) + { + internal_source_list_element = (libcdata_internal_list_element_t *) internal_source_list->first_element; - if( result != 1 ) + for( element_index = 0; + element_index < internal_source_list->number_of_elements; + element_index++ ) { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, - "%s: unable to append destination value to destination list.", - function ); + if( internal_source_list_element == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, + "%s: missing source list element: %d.", + function, + element_index ); - break; - } - destination_value = NULL; + goto on_error; + } + if( value_clone_function( + &destination_value, + internal_source_list_element->value, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, + "%s: unable to create destination value: %d.", + function, + element_index ); - result = libcdata_list_element_get_next_element( - source_list_element, - &source_list_element, - error ); + goto on_error; + } + if( libcdata_list_append_value( + (libcdata_list_t *) internal_destination_list, + destination_value, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, + "%s: unable to append value: %d to destination list.", + function, + element_index ); - if( result != 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_GET_FAILED, - "%s: unable to retrieve next element from source list element: %d.", - function, - element_index ); + goto on_error; + } + destination_value = NULL; - break; + internal_source_list_element = (libcdata_internal_list_element_t *) internal_source_list_element->next_element; } } #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) @@ -586,26 +529,34 @@ "%s: unable to release read/write lock for reading.", function ); - goto on_error; + libcdata_list_free( + (libcdata_list_t **) &internal_destination_list, + value_free_function, + error ); + + return( -1 ); } #endif - if( result != 1 ) - { - goto on_error; - } + *destination_list = (libcdata_list_t *) internal_destination_list; + return( 1 ); on_error: +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_read( + internal_source_list->read_write_lock, + NULL ); +#endif if( destination_value != NULL ) { value_free_function( &destination_value, NULL ); } - if( *destination_list != NULL ) + if( internal_destination_list != NULL ) { libcdata_list_free( - destination_list, + (libcdata_list_t **) &internal_destination_list, value_free_function, error ); } @@ -1477,15 +1428,14 @@ /* Appends a list element to the list * Returns 1 if successful or -1 on error */ -int libcdata_list_append_element( - libcdata_list_t *list, +int libcdata_internal_list_append_element( + libcdata_internal_list_t *internal_list, libcdata_list_element_t *element, libcerror_error_t **error ) { - libcdata_internal_list_t *internal_list = NULL; - static char *function = "libcdata_list_append_element"; + static char *function = "libcdata_internal_list_append_element"; - if( list == NULL ) + if( internal_list == NULL ) { libcerror_error_set( error, @@ -1496,8 +1446,6 @@ return( -1 ); } - internal_list = (libcdata_internal_list_t *) list; - if( element == NULL ) { libcerror_error_set( @@ -1509,21 +1457,6 @@ return( -1 ); } -#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) - if( libcthreads_read_write_lock_grab_for_write( - internal_list->read_write_lock, - error ) != 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_SET_FAILED, - "%s: unable to grab read/write lock for writing.", - function ); - - return( -1 ); - } -#endif if( internal_list->first_element == NULL ) { internal_list->first_element = element; @@ -1540,12 +1473,40 @@ "%s: unable to set last element.", function ); - goto on_error; + return( -1 ); } internal_list->number_of_elements++; + return( 1 ); +} + +/* Appends a list element to the list + * Returns 1 if successful or -1 on error + */ +int libcdata_list_append_element( + libcdata_list_t *list, + libcdata_list_element_t *element, + libcerror_error_t **error ) +{ + libcdata_internal_list_t *internal_list = NULL; + static char *function = "libcdata_list_append_element"; + int result = 1; + + if( list == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid list.", + function ); + + return( -1 ); + } + internal_list = (libcdata_internal_list_t *) list; + #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) - if( libcthreads_read_write_lock_release_for_write( + if( libcthreads_read_write_lock_grab_for_write( internal_list->read_write_lock, error ) != 1 ) { @@ -1553,22 +1514,43 @@ error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, - "%s: unable to release read/write lock for writing.", + "%s: unable to grab read/write lock for writing.", function ); return( -1 ); } #endif - return( 1 ); - -on_error: -#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) - libcthreads_read_write_lock_release_for_write( - internal_list->read_write_lock, - NULL ); -#endif - return( -1 ); -} + if( libcdata_internal_list_append_element( + internal_list, + element, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, + "%s: unable to append element to list.", + function ); + + result = -1; + } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif + return( result ); +} /* Appends a value to the list * Creates a new list element @@ -1579,11 +1561,40 @@ intptr_t *value, libcerror_error_t **error ) { - libcdata_list_element_t *list_element = NULL; - static char *function = "libcdata_list_append_value"; + libcdata_internal_list_t *internal_list = NULL; + libcdata_list_element_t *element = NULL; + static char *function = "libcdata_list_append_value"; + + if( list == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid list.", + function ); + return( -1 ); + } + internal_list = (libcdata_internal_list_t *) list; + +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + + return( -1 ); + } +#endif if( libcdata_list_element_initialize( - &list_element, + &element, error ) != 1 ) { libcerror_error_set( @@ -1595,9 +1606,23 @@ goto on_error; } - if( libcdata_list_append_element( - list, - list_element, + if( libcdata_list_element_set_value( + element, + value, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to set value of list element.", + function ); + + goto on_error; + } + if( libcdata_internal_list_append_element( + internal_list, + element, error ) != 1 ) { libcerror_error_set( @@ -1609,27 +1634,33 @@ goto on_error; } - if( libcdata_list_element_set_value( - list_element, - value, +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_list->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_GET_FAILED, - "%s: unable to set value of list element.", + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", function ); - goto on_error; + return( -1 ); } +#endif return( 1 ); on_error: - if( list_element != NULL ) +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_write( + internal_list->read_write_lock, + NULL ); +#endif + if( element != NULL ) { libcdata_list_element_free( - &list_element, + &element, NULL, NULL ); } @@ -1647,8 +1678,8 @@ * * Returns 1 if successful, 0 if the list element already exists or -1 on error */ -int libcdata_list_insert_element( - libcdata_list_t *list, +int libcdata_internal_list_insert_element( + libcdata_internal_list_t *internal_list, libcdata_list_element_t *element, int (*value_compare_function)( intptr_t *first_value, @@ -1657,18 +1688,17 @@ uint8_t insert_flags, libcerror_error_t **error ) { - libcdata_internal_list_t *internal_list = NULL; libcdata_list_element_t *list_element = NULL; libcdata_list_element_t *next_element = NULL; libcdata_list_element_t *previous_element = NULL; intptr_t *element_value = NULL; intptr_t *list_element_value = NULL; - static char *function = "libcdata_list_insert_element"; + static char *function = "libcdata_internal_list_insert_element"; int compare_result = 0; int element_index = 0; int result = 1; - if( list == NULL ) + if( internal_list == NULL ) { libcerror_error_set( error, @@ -1679,8 +1709,6 @@ return( -1 ); } - internal_list = (libcdata_internal_list_t *) list; - if( element == NULL ) { libcerror_error_set( @@ -1756,21 +1784,6 @@ return( -1 ); } -#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) - if( libcthreads_read_write_lock_grab_for_write( - internal_list->read_write_lock, - error ) != 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_SET_FAILED, - "%s: unable to grab read/write lock for writing.", - function ); - - return( -1 ); - } -#endif if( internal_list->number_of_elements == 0 ) { if( internal_list->first_element != NULL ) @@ -1782,7 +1795,7 @@ "%s: corruption detected - first element already set.", function ); - goto on_error; + return( -1 ); } if( internal_list->last_element != NULL ) { @@ -1793,7 +1806,7 @@ "%s: corruption detected - last element already set.", function ); - goto on_error; + return( -1 ); } internal_list->first_element = element; internal_list->last_element = element; @@ -1811,7 +1824,7 @@ "%s: corruption detected - missing first.", function ); - goto on_error; + return( -1 ); } if( internal_list->last_element == NULL ) { @@ -1822,7 +1835,7 @@ "%s: corruption detected - missing last.", function ); - goto on_error; + return( -1 ); } list_element = internal_list->first_element; @@ -1843,7 +1856,7 @@ function, element_index ); - goto on_error; + return( -1 ); } compare_result = value_compare_function( element_value, @@ -1860,7 +1873,7 @@ function, element_index ); - goto on_error; + return( -1 ); } else if( compare_result == LIBCDATA_COMPARE_EQUAL ) { @@ -1887,7 +1900,7 @@ function, compare_result ); - goto on_error; + return( -1 ); } if( libcdata_list_element_get_next_element( list_element, @@ -1902,7 +1915,7 @@ function, element_index ); - goto on_error; + return( -1 ); } } if( result != 0 ) @@ -1922,7 +1935,7 @@ function, element_index ); - goto on_error; + return( -1 ); } if( libcdata_list_element_set_elements( element, @@ -1937,7 +1950,7 @@ "%s: unable to set previous and next element of list element.", function ); - goto on_error; + return( -1 ); } if( list_element == internal_list->first_element ) { @@ -1958,7 +1971,7 @@ function, element_index - 1 ); - goto on_error; + return( -1 ); } } if( libcdata_list_element_set_previous_element( @@ -1974,7 +1987,7 @@ function, element_index ); - goto on_error; + return( -1 ); } } else @@ -1991,14 +2004,55 @@ "%s: unable to set last element.", function ); - goto on_error; + return( -1 ); } } internal_list->number_of_elements++; } } + return( result ); +} + +/* Inserts a list element into the list + * + * Uses the value_compare_function to determine the order of the entries + * The value_compare_function should return LIBCDATA_COMPARE_LESS, + * LIBCDATA_COMPARE_EQUAL, LIBCDATA_COMPARE_GREATER if successful or -1 on error + * + * Duplicate entries are allowed by default and inserted after the last duplicate value. + * Only allowing unique entries can be enforced by setting the flag LIBCDATA_INSERT_FLAG_UNIQUE_ENTRIES + * + * Returns 1 if successful, 0 if the list element already exists or -1 on error + */ +int libcdata_list_insert_element( + libcdata_list_t *list, + libcdata_list_element_t *element, + int (*value_compare_function)( + intptr_t *first_value, + intptr_t *second_value, + libcerror_error_t **error ), + uint8_t insert_flags, + libcerror_error_t **error ) +{ + libcdata_internal_list_t *internal_list = NULL; + static char *function = "libcdata_list_insert_element"; + int result = 1; + + if( list == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid list.", + function ); + + return( -1 ); + } + internal_list = (libcdata_internal_list_t *) list; + #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) - if( libcthreads_read_write_lock_release_for_write( + if( libcthreads_read_write_lock_grab_for_write( internal_list->read_write_lock, error ) != 1 ) { @@ -2006,21 +2060,46 @@ error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, - "%s: unable to release read/write lock for writing.", + "%s: unable to grab read/write lock for writing.", function ); return( -1 ); } #endif - return( result ); + result = libcdata_internal_list_insert_element( + internal_list, + element, + value_compare_function, + insert_flags, + error ); -on_error: + if( result == -1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, + "%s: unable to insert element to list.", + function ); + + result = -1; + } #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) - libcthreads_read_write_lock_release_for_write( - internal_list->read_write_lock, - NULL ); + if( libcthreads_read_write_lock_release_for_write( + internal_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } #endif - return( -1 ); + return( result ); } /* Inserts a value to the list @@ -2046,12 +2125,41 @@ uint8_t insert_flags, libcerror_error_t **error ) { - libcdata_list_element_t *list_element = NULL; - static char *function = "libcdata_list_insert_value"; - int result = 0; + libcdata_internal_list_t *internal_list = NULL; + libcdata_list_element_t *element = NULL; + static char *function = "libcdata_list_insert_value"; + int result = 1; + + if( list == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid list.", + function ); + + return( -1 ); + } + internal_list = (libcdata_internal_list_t *) list; + +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + return( -1 ); + } +#endif if( libcdata_list_element_initialize( - &list_element, + &element, error ) != 1 ) { libcerror_error_set( @@ -2064,7 +2172,7 @@ return( -1 ); } if( libcdata_list_element_set_value( - list_element, + element, value, error ) != 1 ) { @@ -2077,9 +2185,9 @@ goto on_error; } - result = libcdata_list_insert_element( - list, - list_element, + result = libcdata_internal_list_insert_element( + internal_list, + element, value_compare_function, insert_flags, error ); @@ -2098,7 +2206,7 @@ else if( result == 0 ) { if( libcdata_list_element_free( - &list_element, + &element, NULL, error ) != 1 ) { @@ -2112,13 +2220,33 @@ goto on_error; } } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif return( result ); on_error: - if( list_element != NULL ) +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_write( + internal_list->read_write_lock, + NULL ); +#endif + if( element != NULL ) { libcdata_list_element_free( - &list_element, + &element, NULL, NULL ); } @@ -2162,6 +2290,21 @@ return( -1 ); } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + + return( -1 ); + } +#endif if( libcdata_list_element_get_elements( element, &previous_element, @@ -2175,7 +2318,7 @@ "%s: unable to retrieve previous and next element from list element.", function ); - return( -1 ); + goto on_error; } if( element == internal_list->first_element ) { @@ -2199,7 +2342,7 @@ "%s: unable to set previous element of next element.", function ); - return( -1 ); + goto on_error; } } if( previous_element != NULL ) @@ -2216,7 +2359,7 @@ "%s: unable to set next element of previous element.", function ); - return( -1 ); + goto on_error; } } if( libcdata_list_element_set_elements( @@ -2232,10 +2375,33 @@ "%s: unable to set previous and next element of list element.", function ); - return( -1 ); + goto on_error; } internal_list->number_of_elements--; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif return( 1 ); + +on_error: +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_write( + internal_list->read_write_lock, + NULL ); +#endif + return( -1 ); } diff -Nru libsmdev-20171112/libcdata/libcdata_list_element.c libsmdev-20181227/libcdata/libcdata_list_element.c --- libsmdev-20171112/libcdata/libcdata_list_element.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_list_element.c 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * List element functions * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcdata/libcdata_list_element.h libsmdev-20181227/libcdata/libcdata_list_element.h --- libsmdev-20171112/libcdata/libcdata_list_element.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_list_element.h 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * List element functions * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcdata/libcdata_list.h libsmdev-20181227/libcdata/libcdata_list.h --- libsmdev-20171112/libcdata/libcdata_list.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_list.h 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * List functions * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -162,6 +162,11 @@ intptr_t *value, libcerror_error_t **error ); +int libcdata_internal_list_append_element( + libcdata_internal_list_t *internal_list, + libcdata_list_element_t *element, + libcerror_error_t **error ); + LIBCDATA_EXTERN \ int libcdata_list_append_element( libcdata_list_t *list, @@ -174,6 +179,16 @@ intptr_t *value, libcerror_error_t **error ); +int libcdata_internal_list_insert_element( + libcdata_internal_list_t *internal_list, + libcdata_list_element_t *element, + int (*value_compare_function)( + intptr_t *first, + intptr_t *second, + libcerror_error_t **error ), + uint8_t insert_flags, + libcerror_error_t **error ); + LIBCDATA_EXTERN \ int libcdata_list_insert_element( libcdata_list_t *list, diff -Nru libsmdev-20171112/libcdata/libcdata_range_list.c libsmdev-20181227/libcdata/libcdata_range_list.c --- libsmdev-20171112/libcdata/libcdata_range_list.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_range_list.c 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * Range list * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -25,6 +25,7 @@ #include "libcdata_definitions.h" #include "libcdata_libcerror.h" +#include "libcdata_libcthreads.h" #include "libcdata_list_element.h" #include "libcdata_range_list.h" #include "libcdata_range_list_value.h" @@ -89,8 +90,26 @@ "%s: unable to clear range list.", function ); + memory_free( + internal_range_list ); + + return( -1 ); + } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_initialize( + &( internal_range_list->read_write_lock ), + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, + "%s: unable to intialize read/write lock.", + function ); + goto on_error; } +#endif *range_list = (libcdata_range_list_t *) internal_range_list; return( 1 ); @@ -115,8 +134,9 @@ libcerror_error_t **error ), libcerror_error_t **error ) { - static char *function = "libcdata_range_list_free"; - int result = 1; + libcdata_internal_range_list_t *internal_range_list = NULL; + static char *function = "libcdata_range_list_free"; + int result = 1; if( range_list == NULL ) { @@ -131,12 +151,13 @@ } if( *range_list != NULL ) { - result = libcdata_range_list_empty( - *range_list, - value_free_function, - error ); + internal_range_list = (libcdata_internal_range_list_t *) *range_list; + *range_list = NULL; - if( result != 1 ) + if( libcdata_range_list_empty( + (libcdata_range_list_t *) internal_range_list, + value_free_function, + error ) != 1 ) { libcerror_error_set( error, @@ -144,11 +165,26 @@ LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to empty range list.", function ); + + result = -1; } - memory_free( - *range_list ); +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_free( + &( internal_range_list->read_write_lock ), + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to free read/write lock.", + function ); - *range_list = NULL; + result = -1; + } +#endif + memory_free( + internal_range_list ); } return( result ); } @@ -186,11 +222,25 @@ } internal_range_list = (libcdata_internal_range_list_t *) range_list; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + + return( -1 ); + } +#endif if( internal_range_list->number_of_elements > 0 ) { number_of_elements = internal_range_list->number_of_elements; - - list_element = internal_range_list->first_element; + list_element = internal_range_list->first_element; for( element_index = 0; element_index < number_of_elements; @@ -209,7 +259,7 @@ function, element_index ); - return( -1 ); + goto on_error; } internal_range_list->first_element = next_element; @@ -234,7 +284,7 @@ function, element_index + 1 ); - return( -1 ); + goto on_error; } } if( libcdata_list_element_set_next_element( @@ -250,7 +300,7 @@ function, element_index ); - return( -1 ); + goto on_error; } if( libcdata_list_element_get_value( list_element, @@ -265,7 +315,7 @@ function, element_index ); - result = -1; + goto on_error; } if( libcdata_range_list_value_free( &range_list_value, @@ -302,7 +352,30 @@ internal_range_list->current_element = NULL; internal_range_list->current_element_index = 0; } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif return( result ); + +on_error: +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_write( + internal_range_list->read_write_lock, + NULL ); +#endif + return( -1 ); } /* Clones the range list @@ -324,12 +397,12 @@ libcerror_error_t **error ), libcerror_error_t **error ) { - libcdata_internal_range_list_t *source_internal_range_list = NULL; - libcdata_list_element_t *source_list_element = NULL; - libcdata_range_list_value_t *destination_range_list_value = NULL; - libcdata_range_list_value_t *source_range_list_value = NULL; - static char *function = "libcdata_range_list_clone"; - int element_index = 0; + libcdata_internal_list_element_t *internal_source_list_element = NULL; + libcdata_internal_range_list_t *internal_destination_range_list = NULL; + libcdata_internal_range_list_t *internal_source_range_list = NULL; + libcdata_range_list_value_t *destination_range_list_value = NULL; + static char *function = "libcdata_range_list_clone"; + int element_index = 0; if( destination_range_list == NULL ) { @@ -359,10 +432,10 @@ return( 1 ); } - source_internal_range_list = (libcdata_internal_range_list_t *) source_range_list; + internal_source_range_list = (libcdata_internal_range_list_t *) source_range_list; if( libcdata_range_list_initialize( - destination_range_list, + (libcdata_range_list_t **) &internal_destination_range_list, error ) != 1 ) { libcerror_error_set( @@ -372,9 +445,9 @@ "%s: unable to create destination range list.", function ); - goto on_error; + return( -1 ); } - if( *destination_range_list == NULL ) + if( internal_destination_range_list == NULL ) { libcerror_error_set( error, @@ -383,82 +456,110 @@ "%s: missing destination range list.", function ); - goto on_error; + return( -1 ); } - source_list_element = source_internal_range_list->first_element; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_read( + internal_source_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for reading.", + function ); - for( element_index = 0; - element_index < source_internal_range_list->number_of_elements; - element_index++ ) + return( -1 ); + } +#endif + if( internal_source_range_list->first_element != NULL ) { - if( libcdata_list_element_get_value( - source_list_element, - (intptr_t **) &source_range_list_value, - error ) != 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_GET_FAILED, - "%s: unable to retrieve value from source list element: %d.", - function, - element_index ); + internal_source_list_element = (libcdata_internal_list_element_t *) internal_source_range_list->first_element; - goto on_error; - } - if( libcdata_range_list_value_clone( - &destination_range_list_value, - source_range_list_value, - value_free_function, - value_clone_function, - error ) != 1 ) + for( element_index = 0; + element_index < internal_source_range_list->number_of_elements; + element_index++ ) { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, - "%s: unable to create destination range list value: %d.", - function, - element_index ); + if( internal_source_list_element == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, + "%s: missing source list element: %d.", + function, + element_index ); - goto on_error; - } - if( libcdata_range_list_append_value( - *destination_range_list, - destination_range_list_value, - error ) != 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_GET_FAILED, - "%s: unable to set value of destination element: %d.", - function, - element_index ); + goto on_error; + } + if( libcdata_range_list_value_clone( + &destination_range_list_value, + (libcdata_range_list_value_t *) internal_source_list_element->value, + value_free_function, + value_clone_function, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, + "%s: unable to create destination range list value: %d.", + function, + element_index ); - goto on_error; - } - destination_range_list_value = NULL; + goto on_error; + } + if( libcdata_internal_range_list_append_value( + internal_destination_range_list, + destination_range_list_value, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to append value: %d to destination range list.", + function, + element_index ); - if( libcdata_list_element_get_next_element( - source_list_element, - &source_list_element, - error ) != 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_GET_FAILED, - "%s: unable to retrieve next element from list element: %d.", - function, - element_index ); + goto on_error; + } + destination_range_list_value = NULL; - goto on_error; + internal_source_list_element = (libcdata_internal_list_element_t *) internal_source_list_element->next_element; } } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_read( + internal_source_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for reading.", + function ); + + libcdata_range_list_free( + (libcdata_range_list_t **) &internal_destination_range_list, + value_free_function, + NULL ); + + return( -1 ); + } +#endif + *destination_range_list = (libcdata_range_list_t *) internal_destination_range_list; + return( 1 ); on_error: +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_read( + internal_source_range_list->read_write_lock, + NULL ); +#endif if( destination_range_list_value != NULL ) { libcdata_range_list_value_free( @@ -466,10 +567,10 @@ value_free_function, NULL ); } - if( *destination_range_list != NULL ) + if( internal_destination_range_list != NULL ) { libcdata_range_list_free( - destination_range_list, + (libcdata_range_list_t **) &internal_destination_range_list, value_free_function, NULL ); } @@ -511,21 +612,51 @@ return( -1 ); } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_read( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for reading.", + function ); + + return( -1 ); + } +#endif *number_of_elements = internal_range_list->number_of_elements; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_read( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for reading.", + function ); + + return( -1 ); + } +#endif return( 1 ); } -/* Sets the first element in the range list +/* Retrieves the first elements in the range list * Returns 1 if successful or -1 on error */ -int libcdata_range_list_set_first_element( +int libcdata_range_list_get_first_element( libcdata_range_list_t *range_list, - libcdata_list_element_t *element, + libcdata_list_element_t **element, libcerror_error_t **error ) { libcdata_internal_range_list_t *internal_range_list = NULL; - static char *function = "libcdata_range_list_set_first_element"; + static char *function = "libcdata_range_list_get_first_element"; if( range_list == NULL ) { @@ -540,6 +671,73 @@ } internal_range_list = (libcdata_internal_range_list_t *) range_list; + if( element == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid element.", + function ); + + return( -1 ); + } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_read( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for reading.", + function ); + + return( -1 ); + } +#endif + *element = internal_range_list->first_element; + +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_read( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for reading.", + function ); + + return( -1 ); + } +#endif + return( 1 ); +} + +/* Sets the first element in the range list + * Returns 1 if successful or -1 on error + */ +int libcdata_internal_range_list_set_first_element( + libcdata_internal_range_list_t *internal_range_list, + libcdata_list_element_t *element, + libcerror_error_t **error ) +{ + static char *function = "libcdata_internal_range_list_set_first_element"; + + if( internal_range_list == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid range list.", + function ); + + return( -1 ); + } if( element != NULL ) { if( libcdata_list_element_set_next_element( @@ -579,16 +777,16 @@ return( 1 ); } -/* Sets the last element in the list +/* Retrieves the last elements in the range list * Returns 1 if successful or -1 on error */ -int libcdata_range_list_set_last_element( +int libcdata_range_list_get_last_element( libcdata_range_list_t *range_list, - libcdata_list_element_t *element, + libcdata_list_element_t **element, libcerror_error_t **error ) { libcdata_internal_range_list_t *internal_range_list = NULL; - static char *function = "libcdata_list_set_last_element"; + static char *function = "libcdata_range_list_get_last_element"; if( range_list == NULL ) { @@ -603,6 +801,73 @@ } internal_range_list = (libcdata_internal_range_list_t *) range_list; + if( element == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid element.", + function ); + + return( -1 ); + } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_read( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for reading.", + function ); + + return( -1 ); + } +#endif + *element = internal_range_list->last_element; + +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_read( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for reading.", + function ); + + return( -1 ); + } +#endif + return( 1 ); +} + +/* Sets the last element in the list + * Returns 1 if successful or -1 on error + */ +int libcdata_internal_range_list_set_last_element( + libcdata_internal_range_list_t *internal_range_list, + libcdata_list_element_t *element, + libcerror_error_t **error ) +{ + static char *function = "libcdata_internal_range_list_set_last_element"; + + if( internal_range_list == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid range list.", + function ); + + return( -1 ); + } if( element != NULL ) { if( libcdata_list_element_set_previous_element( @@ -645,15 +910,14 @@ /* Append a list element to the list * Returns 1 if successful or -1 on error */ -int libcdata_range_list_append_element( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_append_element( + libcdata_internal_range_list_t *internal_range_list, libcdata_list_element_t *element, libcerror_error_t **error ) { - libcdata_internal_range_list_t *internal_range_list = NULL; - static char *function = "libcdata_range_list_append_element"; + static char *function = "libcdata_internal_range_list_append_element"; - if( range_list == NULL ) + if( internal_range_list == NULL ) { libcerror_error_set( error, @@ -664,8 +928,6 @@ return( -1 ); } - internal_range_list = (libcdata_internal_range_list_t *) range_list; - if( element == NULL ) { libcerror_error_set( @@ -681,8 +943,8 @@ { internal_range_list->first_element = element; } - if( libcdata_range_list_set_last_element( - range_list, + if( libcdata_internal_range_list_set_last_element( + internal_range_list, element, error ) != 1 ) { @@ -704,13 +966,13 @@ * Creates a new list element * Returns 1 if successful or -1 on error */ -int libcdata_range_list_append_value( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_append_value( + libcdata_internal_range_list_t *internal_range_list, libcdata_range_list_value_t *value, libcerror_error_t **error ) { libcdata_list_element_t *list_element = NULL; - static char *function = "libcdata_range_list_append_value"; + static char *function = "libcdata_internal_range_list_append_value"; if( libcdata_list_element_initialize( &list_element, @@ -725,30 +987,30 @@ goto on_error; } - if( libcdata_range_list_append_element( - range_list, + if( libcdata_list_element_set_value( list_element, + (intptr_t *) value, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, - "%s: unable to append element to list.", + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to set value of list element.", function ); goto on_error; } - if( libcdata_list_element_set_value( + if( libcdata_internal_range_list_append_element( + internal_range_list, list_element, - (intptr_t *) value, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_GET_FAILED, - "%s: unable to set value of list element.", + LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, + "%s: unable to append element to range list.", function ); goto on_error; @@ -776,8 +1038,8 @@ * * Returns 1 if successful, or -1 on error */ -int libcdata_range_list_insert_range( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_insert_range( + libcdata_internal_range_list_t *internal_range_list, uint64_t range_start, uint64_t range_size, intptr_t *value, @@ -790,7 +1052,6 @@ libcerror_error_t **error ), libcerror_error_t **error ) { - libcdata_internal_range_list_t *internal_range_list = NULL; libcdata_list_element_t *last_element = NULL; libcdata_list_element_t *list_element = NULL; libcdata_list_element_t *next_element = NULL; @@ -799,14 +1060,14 @@ libcdata_range_list_value_t *new_range_list_value = NULL; libcdata_range_list_value_t *range_list_value = NULL; libcdata_range_list_value_t *previous_range_list_value = NULL; - static char *function = "libcdata_range_list_insert_range"; + static char *function = "libcdata_internal_range_list_insert_range"; uint64_t range_end = 0; int create_element = 0; int element_index = 0; int merge_next_element_check = 0; int merge_previous_element_check = 0; - if( range_list == NULL ) + if( internal_range_list == NULL ) { libcerror_error_set( error, @@ -817,8 +1078,6 @@ return( -1 ); } - internal_range_list = (libcdata_internal_range_list_t *) range_list; - if( range_start > (uint64_t) INT64_MAX ) { libcerror_error_set( @@ -1238,12 +1497,14 @@ "%s: unable to merge range list value with previous.", function ); + previous_range_list_value = NULL; + goto on_error; } /* Remove previous list element */ - if( libcdata_range_list_remove_element( - range_list, + if( libcdata_internal_range_list_remove_element( + internal_range_list, previous_element, error ) != 1 ) { @@ -1255,6 +1516,8 @@ function, element_index - 1 ); + previous_range_list_value = NULL; + goto on_error; } if( libcdata_list_element_free( @@ -1270,11 +1533,6 @@ function, element_index - 1 ); - libcdata_range_list_value_free( - &previous_range_list_value, - value_free_function, - NULL ); - goto on_error; } if( libcdata_range_list_value_free( @@ -1293,6 +1551,7 @@ goto on_error; } } + previous_range_list_value = NULL; } } /* Check if the current range should be merged with the next range @@ -1360,12 +1619,14 @@ "%s: unable to merge range list value with next.", function ); + next_range_list_value = NULL; + goto on_error; } /* Remove next list element */ - if( libcdata_range_list_remove_element( - range_list, + if( libcdata_internal_range_list_remove_element( + internal_range_list, next_element, error ) != 1 ) { @@ -1377,6 +1638,8 @@ function, element_index + 1 ); + next_range_list_value = NULL; + goto on_error; } if( libcdata_list_element_free( @@ -1392,11 +1655,6 @@ function, element_index + 1 ); - libcdata_range_list_value_free( - &next_range_list_value, - value_free_function, - NULL ); - goto on_error; } if( libcdata_range_list_value_free( @@ -1415,6 +1673,7 @@ goto on_error; } } + next_range_list_value = NULL; } } } @@ -1449,8 +1708,8 @@ new_range_list_value->end = range_end; new_range_list_value->value = value; - if( libcdata_range_list_insert_value( - range_list, + if( libcdata_internal_range_list_insert_value( + internal_range_list, last_element, new_range_list_value, error ) != 1 ) @@ -1483,7 +1742,7 @@ "%s: invalid value free function.", function ); - return( -1 ); + goto on_error; } if( value_merge_function == NULL ) { @@ -1494,7 +1753,7 @@ "%s: invalid value merge function.", function ); - return( -1 ); + goto on_error; } if( value_merge_function( range_list_value->value, @@ -1508,7 +1767,7 @@ "%s: unable to merge value.", function ); - return( -1 ); + goto on_error; } if( value_free_function( &value, @@ -1521,13 +1780,27 @@ "%s: unable to free value.", function ); - return( -1 ); + goto on_error; } } } return( 1 ); on_error: + if( next_range_list_value != NULL ) + { + libcdata_range_list_value_free( + &next_range_list_value, + value_free_function, + NULL ); + } + if( previous_range_list_value != NULL ) + { + libcdata_range_list_value_free( + &previous_range_list_value, + value_free_function, + NULL ); + } if( new_range_list_value != NULL ) { libcdata_range_list_value_free( @@ -1538,6 +1811,98 @@ return( -1 ); } +/* Inserts a range + * + * The values are merged using the value_merge_function. + * If the source value is NULL the merge function is not called. + * + * After a merge and on error the values are freed using + * the value_free_function + * + * Returns 1 if successful, or -1 on error + */ +int libcdata_range_list_insert_range( + libcdata_range_list_t *range_list, + uint64_t range_start, + uint64_t range_size, + intptr_t *value, + int (*value_free_function)( + intptr_t **value, + libcerror_error_t **error ), + int (*value_merge_function)( + intptr_t *destination_value, + intptr_t *source_value, + libcerror_error_t **error ), + libcerror_error_t **error ) +{ + libcdata_internal_range_list_t *internal_range_list = NULL; + static char *function = "libcdata_range_list_insert_range"; + int result = 1; + + if( range_list == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid range list.", + function ); + + return( -1 ); + } + internal_range_list = (libcdata_internal_range_list_t *) range_list; + +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + + return( -1 ); + } +#endif + if( libcdata_internal_range_list_insert_range( + internal_range_list, + range_start, + range_size, + value, + value_free_function, + value_merge_function, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, + "%s: unable to insert range list into range list.", + function ); + + result = -1; + } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif + return( result ); +} + /* Inserts a range list * * The values are merged using the value_merge_function. @@ -1562,11 +1927,12 @@ libcerror_error_t **error ), libcerror_error_t **error ) { - libcdata_internal_range_list_t *source_internal_range_list = NULL; - libcdata_list_element_t *source_list_element = NULL; - libcdata_range_list_value_t *source_range_list_value = NULL; - static char *function = "libcdata_range_list_insert_range_list"; - int element_index = 0; + libcdata_internal_range_list_t *internal_range_list = NULL; + libcdata_list_element_t *source_list_element = NULL; + libcdata_range_list_value_t *source_range_list_value = NULL; + static char *function = "libcdata_range_list_insert_range_list"; + int element_index = 0; + int number_of_elements = 0; if( range_list == NULL ) { @@ -1579,6 +1945,8 @@ return( -1 ); } + internal_range_list = (libcdata_internal_range_list_t *) range_list; + if( source_range_list == NULL ) { libcerror_error_set( @@ -1590,12 +1958,51 @@ return( -1 ); } - source_internal_range_list = (libcdata_internal_range_list_t *) source_range_list; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + + return( -1 ); + } +#endif + if( libcdata_range_list_get_number_of_elements( + source_range_list, + &number_of_elements, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to retrieve number of source list elements.", + function ); - source_list_element = source_internal_range_list->first_element; + goto on_error; + } + if( libcdata_range_list_get_first_element( + source_range_list, + &source_list_element, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to retrieve first element from source list.", + function ); + goto on_error; + } for( element_index = 0; - element_index < source_internal_range_list->number_of_elements; + element_index < number_of_elements; element_index++ ) { if( libcdata_list_element_get_value( @@ -1611,10 +2018,10 @@ function, element_index ); - return( -1 ); + goto on_error; } - if( libcdata_range_list_insert_range( - range_list, + if( libcdata_internal_range_list_insert_range( + internal_range_list, source_range_list_value->start, source_range_list_value->size, source_range_list_value->value, @@ -1630,7 +2037,7 @@ function, element_index ); - return( -1 ); + goto on_error; } if( libcdata_list_element_get_next_element( source_list_element, @@ -1645,28 +2052,50 @@ function, element_index ); - return( -1 ); + goto on_error; } } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif return( 1 ); + +on_error: +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_write( + internal_range_list->read_write_lock, + NULL ); +#endif + return( -1 ); } /* Inserts the element in the range list after the range list element * If range_list_element is NULL the element is inserted before the first element in the list * Returns 1 if successful, or -1 on error */ -int libcdata_range_list_insert_element( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_insert_element( + libcdata_internal_range_list_t *internal_range_list, libcdata_list_element_t *range_list_element, libcdata_list_element_t *element, libcerror_error_t **error ) { - libcdata_internal_range_list_t *internal_range_list = NULL; - libcdata_list_element_t *next_element = NULL; - libcdata_list_element_t *previous_element = NULL; - static char *function = "libcdata_range_list_insert_element"; + libcdata_list_element_t *next_element = NULL; + libcdata_list_element_t *previous_element = NULL; + static char *function = "libcdata_internal_range_list_insert_element"; - if( range_list == NULL ) + if( internal_range_list == NULL ) { libcerror_error_set( error, @@ -1677,8 +2106,6 @@ return( -1 ); } - internal_range_list = (libcdata_internal_range_list_t *) range_list; - if( libcdata_list_element_get_elements( element, &previous_element, @@ -1759,8 +2186,8 @@ } if( range_list_element == NULL ) { - if( libcdata_range_list_set_first_element( - range_list, + if( libcdata_internal_range_list_set_first_element( + internal_range_list, element, error ) != 1 ) { @@ -1859,18 +2286,19 @@ } /* Inserts the range list value in the range list after the range list element + * If range_list_element is NULL the value is inserted before the first element in the list * Returns 1 if successful, or -1 on error */ -int libcdata_range_list_insert_value( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_insert_value( + libcdata_internal_range_list_t *internal_range_list, libcdata_list_element_t *range_list_element, - libcdata_range_list_value_t *range_list_value, + libcdata_range_list_value_t *value, libcerror_error_t **error ) { libcdata_list_element_t *list_element = NULL; - static char *function = "libcdata_range_list_insert_value"; + static char *function = "libcdata_internal_range_list_insert_value"; - if( range_list == NULL ) + if( internal_range_list == NULL ) { libcerror_error_set( error, @@ -1896,7 +2324,7 @@ } if( libcdata_list_element_set_value( list_element, - (intptr_t *) range_list_value, + (intptr_t *) value, error ) != 1 ) { libcerror_error_set( @@ -1908,8 +2336,8 @@ goto on_error; } - if( libcdata_range_list_insert_element( - range_list, + if( libcdata_internal_range_list_insert_element( + internal_range_list, range_list_element, list_element, error ) != 1 ) @@ -1941,17 +2369,16 @@ /* Removes an element from the range list * Returns 1 if successful, or -1 on error */ -int libcdata_range_list_remove_element( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_remove_element( + libcdata_internal_range_list_t *internal_range_list, libcdata_list_element_t *element, libcerror_error_t **error ) { - libcdata_internal_range_list_t *internal_range_list = NULL; - libcdata_list_element_t *next_element = NULL; - libcdata_list_element_t *previous_element = NULL; - static char *function = "libcdata_range_list_remove_element"; + libcdata_list_element_t *next_element = NULL; + libcdata_list_element_t *previous_element = NULL; + static char *function = "libcdata_internal_range_list_remove_element"; - if( range_list == NULL ) + if( internal_range_list == NULL ) { libcerror_error_set( error, @@ -1962,8 +2389,6 @@ return( -1 ); } - internal_range_list = (libcdata_internal_range_list_t *) range_list; - if( libcdata_list_element_get_elements( element, &previous_element, @@ -2053,8 +2478,8 @@ * * Returns 1 if successful, or -1 on error */ -int libcdata_range_list_remove_range( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_remove_range( + libcdata_internal_range_list_t *internal_range_list, uint64_t range_start, uint64_t range_size, int (*value_free_function)( @@ -2071,12 +2496,12 @@ libcdata_range_list_value_t *range_list_value = NULL; libcdata_range_list_value_t *split_range_list_value = NULL; intptr_t *split_value = NULL; - static char *function = "libcdata_range_list_remove_range"; + static char *function = "libcdata_internal_range_list_remove_range"; uint64_t next_range_start = 0; uint64_t range_end = 0; int result = 0; - if( range_list == NULL ) + if( internal_range_list == NULL ) { libcerror_error_set( error, @@ -2124,8 +2549,8 @@ } while( range_start < range_end ) { - result = libcdata_range_list_get_element_at_offset( - range_list, + result = libcdata_internal_range_list_get_element_at_offset( + internal_range_list, range_start, &list_element, error ); @@ -2247,8 +2672,8 @@ /* If the range marked for removal overlaps with the current range, * remove the current range entirely. */ - if( libcdata_range_list_remove_element( - range_list, + if( libcdata_internal_range_list_remove_element( + internal_range_list, list_element, error ) != 1 ) { @@ -2462,8 +2887,8 @@ range_list_value->size = range_start - range_list_value->start; range_list_value->end = range_start; - if( libcdata_range_list_insert_value( - range_list, + if( libcdata_internal_range_list_insert_value( + internal_range_list, list_element, split_range_list_value, error ) != 1 ) @@ -2475,39 +2900,131 @@ "%s: unable to insert range list value in range list.", function ); - goto on_error; - } - split_range_list_value = NULL; - } - } - range_start = next_range_start; + goto on_error; + } + split_range_list_value = NULL; + } + } + range_start = next_range_start; + } + return( 1 ); + +on_error: + if( split_range_list_value != NULL ) + { + libcdata_range_list_value_free( + &split_range_list_value, + value_free_function, + NULL ); + } + return( -1 ); +} + +/* Removes a range + * + * The values are split using the value_merge_function. + * If the source value is NULL the split function is not called. + * On return destination_value of the value_merge_function + * should contain data greater equal to the split_range_offset. + * + * After a split and on error the values are freed using + * the value_free_function + * + * Returns 1 if successful, or -1 on error + */ +int libcdata_range_list_remove_range( + libcdata_range_list_t *range_list, + uint64_t range_start, + uint64_t range_size, + int (*value_free_function)( + intptr_t **value, + libcerror_error_t **error ), + int (*value_split_function)( + intptr_t **destination_value, + intptr_t *source_value, + uint64_t split_range_offset, + libcerror_error_t **error ), + libcerror_error_t **error ) +{ + libcdata_internal_range_list_t *internal_range_list = NULL; + static char *function = "libcdata_range_list_remove_range"; + int result = 1; + + if( range_list == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid range list.", + function ); + + return( -1 ); + } + internal_range_list = (libcdata_internal_range_list_t *) range_list; + +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + + return( -1 ); } - return( 1 ); +#endif + if( libcdata_internal_range_list_remove_range( + internal_range_list, + range_start, + range_size, + value_free_function, + value_split_function, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_REMOVE_FAILED, + "%s: unable to remove range.", + function ); -on_error: - if( split_range_list_value != NULL ) + result = -1; + } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_range_list->read_write_lock, + error ) != 1 ) { - libcdata_range_list_value_free( - &split_range_list_value, - value_free_function, - NULL ); + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); } - return( -1 ); +#endif + return( result ); } /* Retrieves a specific element from the range list * Returns 1 if successful or -1 on error */ -int libcdata_range_list_get_element_by_index( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_get_element_by_index( + libcdata_internal_range_list_t *internal_range_list, int element_index, libcdata_list_element_t **element, libcerror_error_t **error ) { - libcdata_internal_range_list_t *internal_range_list = NULL; - static char *function = "libcdata_range_list_get_element_by_index"; + static char *function = "libcdata_internal_range_list_get_element_by_index"; - if( range_list == NULL ) + if( internal_range_list == NULL ) { libcerror_error_set( error, @@ -2518,8 +3035,6 @@ return( -1 ); } - internal_range_list = (libcdata_internal_range_list_t *) range_list; - if( ( element_index < 0 ) || ( element_index >= internal_range_list->number_of_elements ) ) { @@ -2661,18 +3176,18 @@ * containing the next range list value. * Returns 1 if successful, 0 if not found or -1 on error */ -int libcdata_range_list_get_element_at_offset( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_get_element_at_offset( + libcdata_internal_range_list_t *internal_range_list, uint64_t range_offset, libcdata_list_element_t **element, libcerror_error_t **error ) { - libcdata_internal_range_list_t *internal_range_list = NULL; - libcdata_range_list_value_t *range_list_value = NULL; - static char *function = "libcdata_range_list_get_element_at_offset"; - int element_index = 0; + libcdata_list_element_t *range_list_element = NULL; + libcdata_range_list_value_t *range_list_value = NULL; + static char *function = "libcdata_internal_range_list_get_element_at_offset"; + int element_index = 0; - if( range_list == NULL ) + if( internal_range_list == NULL ) { libcerror_error_set( error, @@ -2683,8 +3198,6 @@ return( -1 ); } - internal_range_list = (libcdata_internal_range_list_t *) range_list; - if( range_offset > (uint64_t) INT64_MAX ) { libcerror_error_set( @@ -2708,14 +3221,14 @@ return( -1 ); } /* TODO add optimization using current element */ - *element = internal_range_list->first_element; + range_list_element = internal_range_list->first_element; for( element_index = 0; element_index < internal_range_list->number_of_elements; element_index++ ) { if( libcdata_list_element_get_value( - *element, + range_list_element, (intptr_t **) &range_list_value, error ) != 1 ) { @@ -2748,11 +3261,13 @@ if( ( range_offset >= range_list_value->start ) && ( range_offset < range_list_value->end ) ) { + *element = range_list_element; + return( 1 ); } if( libcdata_list_element_get_next_element( - *element, - element, + range_list_element, + &range_list_element, error ) != 1 ) { libcerror_error_set( @@ -2766,20 +3281,22 @@ return( -1 ); } } + *element = NULL; + return( 0 ); } /* Retrieves a specific value from the range list * Returns 1 if successful or -1 on error */ -int libcdata_range_list_get_value_by_index( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_get_value_by_index( + libcdata_internal_range_list_t *internal_range_list, int element_index, libcdata_range_list_value_t **range_list_value, libcerror_error_t **error ) { libcdata_list_element_t *list_element = NULL; - static char *function = "libcdata_range_list_get_value_by_index"; + static char *function = "libcdata_internal_range_list_get_value_by_index"; if( range_list_value == NULL ) { @@ -2792,8 +3309,8 @@ return( -1 ); } - if( libcdata_range_list_get_element_by_index( - range_list, + if( libcdata_internal_range_list_get_element_by_index( + internal_range_list, element_index, &list_element, error ) != 1 ) @@ -2841,14 +3358,14 @@ /* Retrieves the value that contains the range offset * Returns 1 if successful, 0 if no value was found or -1 on error */ -int libcdata_range_list_get_value_at_offset( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_get_value_at_offset( + libcdata_internal_range_list_t *internal_range_list, uint64_t range_offset, libcdata_range_list_value_t **range_list_value, libcerror_error_t **error ) { libcdata_list_element_t *list_element = NULL; - static char *function = "libcdata_range_list_get_value_at_offset"; + static char *function = "libcdata_internal_range_list_get_value_at_offset"; int result = 0; if( range_list_value == NULL ) @@ -2862,8 +3379,8 @@ return( -1 ); } - result = libcdata_range_list_get_element_at_offset( - range_list, + result = libcdata_internal_range_list_get_element_at_offset( + internal_range_list, range_offset, &list_element, error ); @@ -2924,8 +3441,22 @@ intptr_t **value, libcerror_error_t **error ) { - libcdata_range_list_value_t *range_list_value = NULL; - static char *function = "libcdata_range_list_get_range_by_index"; + libcdata_internal_range_list_t *internal_range_list = NULL; + libcdata_range_list_value_t *range_list_value = NULL; + static char *function = "libcdata_range_list_get_range_by_index"; + + if( range_list == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid range list.", + function ); + + return( -1 ); + } + internal_range_list = (libcdata_internal_range_list_t *) range_list; if( range_start == NULL ) { @@ -2960,8 +3491,23 @@ return( -1 ); } - if( libcdata_range_list_get_value_by_index( - range_list, +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_read( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for reading.", + function ); + + return( -1 ); + } +#endif + if( libcdata_internal_range_list_get_value_by_index( + internal_range_list, element_index, &range_list_value, error ) != 1 ) @@ -2974,7 +3520,7 @@ function, element_index ); - return( -1 ); + goto on_error; } if( range_list_value == NULL ) { @@ -2986,13 +3532,36 @@ function, element_index ); - return( -1 ); + goto on_error; } *range_start = range_list_value->start; *range_size = range_list_value->size; *value = range_list_value->value; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_read( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for reading.", + function ); + + return( -1 ); + } +#endif return( 1 ); + +on_error: +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_read( + internal_range_list->read_write_lock, + NULL ); +#endif + return( -1 ); } /* Retrieves a range for a specific range offset @@ -3006,9 +3575,23 @@ intptr_t **value, libcerror_error_t **error ) { - libcdata_range_list_value_t *range_list_value = NULL; - static char *function = "libcdata_range_list_get_range_at_offset"; - int result = 0; + libcdata_internal_range_list_t *internal_range_list = NULL; + libcdata_range_list_value_t *range_list_value = NULL; + static char *function = "libcdata_range_list_get_range_at_offset"; + int result = 0; + + if( range_list == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid range list.", + function ); + + return( -1 ); + } + internal_range_list = (libcdata_internal_range_list_t *) range_list; if( range_start == NULL ) { @@ -3043,8 +3626,23 @@ return( -1 ); } - result = libcdata_range_list_get_value_at_offset( - range_list, +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_read( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for reading.", + function ); + + return( -1 ); + } +#endif + result = libcdata_internal_range_list_get_value_at_offset( + internal_range_list, range_offset, &range_list_value, error ); @@ -3059,7 +3657,7 @@ function, range_offset ); - return( -1 ); + goto on_error; } else if( result != 0 ) { @@ -3073,13 +3671,36 @@ function, range_offset ); - return( -1 ); + goto on_error; } *range_start = range_list_value->start; *range_size = range_list_value->size; *value = range_list_value->value; } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_read( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for reading.", + function ); + + return( -1 ); + } +#endif return( result ); + +on_error: +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_read( + internal_range_list->read_write_lock, + NULL ); +#endif + return( -1 ); } /* Determines if a certain range is present @@ -3097,6 +3718,7 @@ static char *function = "libcdata_range_list_range_is_present"; uint64_t range_end = 0; int element_index = 0; + int result = 0; if( range_list == NULL ) { @@ -3146,6 +3768,21 @@ return( -1 ); } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_read( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for reading.", + function ); + + return( -1 ); + } +#endif /* TODO add optimization using current element */ list_element = internal_range_list->first_element; @@ -3166,7 +3803,7 @@ function, element_index ); - return( -1 ); + goto on_error; } if( range_end < range_list_value->start ) { @@ -3175,7 +3812,9 @@ if( ( range_start >= range_list_value->start ) && ( range_end <= range_list_value->end ) ) { - return( 1 ); + result = 1; + + break; } if( libcdata_list_element_get_next_element( list_element, @@ -3190,10 +3829,33 @@ function, element_index ); - return( -1 ); + goto on_error; } } - return( 0 ); +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_read( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for reading.", + function ); + + return( -1 ); + } +#endif + return( result ); + +on_error: +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_read( + internal_range_list->read_write_lock, + NULL ); +#endif + return( -1 ); } /* Retrieves the range spanning the ranges in the range list @@ -3209,6 +3871,7 @@ libcdata_internal_range_list_t *internal_range_list = NULL; static char *function = "libcdata_range_list_get_spanning_range"; int element_index = 0; + int result = 0; if( range_list == NULL ) { @@ -3245,45 +3908,26 @@ return( -1 ); } - if( internal_range_list->number_of_elements == 0 ) - { - return( 0 ); - } - if( libcdata_range_list_get_value_by_index( - range_list, - 0, - &range_list_value, +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_read( + internal_range_list->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_GET_FAILED, - "%s: unable to retrieve range list value: 0.", - function ); - - return( -1 ); - } - if( range_list_value == NULL ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, - "%s: missing range list value: 0.", + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for reading.", function ); return( -1 ); } - *range_start = range_list_value->start; - - if( internal_range_list->number_of_elements > 1 ) +#endif + if( internal_range_list->number_of_elements > 0 ) { - element_index = internal_range_list->number_of_elements - 1; - - if( libcdata_range_list_get_value_by_index( - range_list, - element_index, + if( libcdata_internal_range_list_get_value_by_index( + internal_range_list, + 0, &range_list_value, error ) != 1 ) { @@ -3291,11 +3935,10 @@ error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, - "%s: unable to retrieve range list value: %d.", - function, - element_index ); + "%s: unable to retrieve range list value: 0.", + function ); - return( -1 ); + goto on_error; } if( range_list_value == NULL ) { @@ -3303,15 +3946,73 @@ error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, - "%s: missing range list value: %d.", - function, - element_index ); + "%s: missing range list value: 0.", + function ); - return( -1 ); + goto on_error; + } + *range_start = range_list_value->start; + + if( internal_range_list->number_of_elements > 1 ) + { + element_index = internal_range_list->number_of_elements - 1; + + if( libcdata_internal_range_list_get_value_by_index( + internal_range_list, + element_index, + &range_list_value, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to retrieve range list value: %d.", + function, + element_index ); + + goto on_error; + } + if( range_list_value == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, + "%s: missing range list value: %d.", + function, + element_index ); + + goto on_error; + } } + *range_size = range_list_value->end - *range_start; + + result = 1; + } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_read( + internal_range_list->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for reading.", + function ); + + return( -1 ); } - *range_size = range_list_value->end - *range_start; +#endif + return( result ); - return( 1 ); +on_error: +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_read( + internal_range_list->read_write_lock, + NULL ); +#endif + return( -1 ); } diff -Nru libsmdev-20171112/libcdata/libcdata_range_list.h libsmdev-20181227/libcdata/libcdata_range_list.h --- libsmdev-20171112/libcdata/libcdata_range_list.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_range_list.h 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * Range list * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -27,6 +27,7 @@ #include "libcdata_extern.h" #include "libcdata_libcerror.h" +#include "libcdata_libcthreads.h" #include "libcdata_range_list_value.h" #include "libcdata_types.h" @@ -57,6 +58,12 @@ /* The current list element index */ int current_element_index; + +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + /* The read/write lock + */ + libcthreads_read_write_lock_t *read_write_lock; +#endif }; LIBCDATA_EXTERN \ @@ -72,6 +79,13 @@ libcerror_error_t **error ), libcerror_error_t **error ); +int libcdata_internal_range_list_empty( + libcdata_internal_range_list_t *internal_range_list, + int (*value_free_function)( + intptr_t **value, + libcerror_error_t **error ), + libcerror_error_t **error ); + LIBCDATA_EXTERN \ int libcdata_range_list_empty( libcdata_range_list_t *range_list, @@ -99,26 +113,50 @@ int *number_of_elements, libcerror_error_t **error ); -int libcdata_range_list_set_first_element( +int libcdata_range_list_get_first_element( libcdata_range_list_t *range_list, + libcdata_list_element_t **element, + libcerror_error_t **error ); + +int libcdata_internal_range_list_set_first_element( + libcdata_internal_range_list_t *internal_range_list, libcdata_list_element_t *element, libcerror_error_t **error ); -int libcdata_range_list_set_last_element( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_set_last_element( + libcdata_internal_range_list_t *internal_range_list, libcdata_list_element_t *element, libcerror_error_t **error ); -int libcdata_range_list_append_element( +int libcdata_range_list_get_last_element( libcdata_range_list_t *range_list, + libcdata_list_element_t **element, + libcerror_error_t **error ); + +int libcdata_internal_range_list_append_element( + libcdata_internal_range_list_t *internal_range_list, libcdata_list_element_t *element, libcerror_error_t **error ); -int libcdata_range_list_append_value( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_append_value( + libcdata_internal_range_list_t *internal_range_list, libcdata_range_list_value_t *value, libcerror_error_t **error ); +int libcdata_internal_range_list_insert_range( + libcdata_internal_range_list_t *internal_range_list, + uint64_t range_start, + uint64_t range_size, + intptr_t *value, + int (*value_free_function)( + intptr_t **value, + libcerror_error_t **error ), + int (*value_merge_function)( + intptr_t *destination_value, + intptr_t *source_value, + libcerror_error_t **error ), + libcerror_error_t **error ); + LIBCDATA_EXTERN \ int libcdata_range_list_insert_range( libcdata_range_list_t *range_list, @@ -147,23 +185,37 @@ libcerror_error_t **error ), libcerror_error_t **error ); -int libcdata_range_list_insert_element( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_insert_element( + libcdata_internal_range_list_t *internal_range_list, libcdata_list_element_t *range_list_element, libcdata_list_element_t *element, libcerror_error_t **error ); -int libcdata_range_list_insert_value( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_insert_value( + libcdata_internal_range_list_t *internal_range_list, libcdata_list_element_t *range_list_element, - libcdata_range_list_value_t *range_list_value, + libcdata_range_list_value_t *value, libcerror_error_t **error ); -int libcdata_range_list_remove_element( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_remove_element( + libcdata_internal_range_list_t *internal_range_list, libcdata_list_element_t *element, libcerror_error_t **error ); +int libcdata_internal_range_list_remove_range( + libcdata_internal_range_list_t *internal_range_list, + uint64_t range_start, + uint64_t range_size, + int (*value_free_function)( + intptr_t **value, + libcerror_error_t **error ), + int (*value_split_function)( + intptr_t **destination_value, + intptr_t *source_value, + uint64_t split_range_offset, + libcerror_error_t **error ), + libcerror_error_t **error ); + LIBCDATA_EXTERN \ int libcdata_range_list_remove_range( libcdata_range_list_t *range_list, @@ -179,26 +231,26 @@ libcerror_error_t **error ), libcerror_error_t **error ); -int libcdata_range_list_get_element_by_index( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_get_element_by_index( + libcdata_internal_range_list_t *internal_range_list, int element_index, libcdata_list_element_t **element, libcerror_error_t **error ); -int libcdata_range_list_get_element_at_offset( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_get_element_at_offset( + libcdata_internal_range_list_t *internal_range_list, uint64_t range_offset, libcdata_list_element_t **element, libcerror_error_t **error ); -int libcdata_range_list_get_value_by_index( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_get_value_by_index( + libcdata_internal_range_list_t *internal_range_list, int element_index, libcdata_range_list_value_t **range_list_value, libcerror_error_t **error ); -int libcdata_range_list_get_value_at_offset( - libcdata_range_list_t *range_list, +int libcdata_internal_range_list_get_value_at_offset( + libcdata_internal_range_list_t *internal_range_list, uint64_t range_offset, libcdata_range_list_value_t **range_list_value, libcerror_error_t **error ); diff -Nru libsmdev-20171112/libcdata/libcdata_range_list_value.c libsmdev-20181227/libcdata/libcdata_range_list_value.c --- libsmdev-20171112/libcdata/libcdata_range_list_value.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_range_list_value.c 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * Range list value * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcdata/libcdata_range_list_value.h libsmdev-20181227/libcdata/libcdata_range_list_value.h --- libsmdev-20171112/libcdata/libcdata_range_list_value.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_range_list_value.h 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * Range list value * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcdata/libcdata_support.c libsmdev-20181227/libcdata/libcdata_support.c --- libsmdev-20171112/libcdata/libcdata_support.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_support.c 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * Support functions * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcdata/libcdata_support.h libsmdev-20181227/libcdata/libcdata_support.h --- libsmdev-20171112/libcdata/libcdata_support.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_support.h 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * Support functions * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcdata/libcdata_tree_node.c libsmdev-20181227/libcdata/libcdata_tree_node.c --- libsmdev-20171112/libcdata/libcdata_tree_node.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_tree_node.c 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * Tree functions * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -25,6 +25,7 @@ #include "libcdata_definitions.h" #include "libcdata_libcerror.h" +#include "libcdata_libcthreads.h" #include "libcdata_list.h" #include "libcdata_tree_node.h" #include "libcdata_types.h" @@ -88,8 +89,26 @@ "%s: unable to clear node.", function ); + memory_free( + internal_node ); + + return( -1 ); + } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_initialize( + &( internal_node->read_write_lock ), + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, + "%s: unable to intialize read/write lock.", + function ); + goto on_error; } +#endif *node = (libcdata_tree_node_t *) internal_node; return( 1 ); @@ -115,14 +134,8 @@ libcerror_error_t **error ) { libcdata_internal_tree_node_t *internal_node = NULL; - libcdata_tree_node_t *next_node = NULL; - libcdata_tree_node_t *parent_node = NULL; - libcdata_tree_node_t *previous_node = NULL; - libcdata_tree_node_t *sub_node = NULL; static char *function = "libcdata_tree_node_free"; - int number_of_sub_nodes = 0; int result = 1; - int sub_node_index = 0; if( node == NULL ) { @@ -152,103 +165,37 @@ return( -1 ); } - number_of_sub_nodes = internal_node->number_of_sub_nodes; - - sub_node = internal_node->first_sub_node; + *node = NULL; - for( sub_node_index = 0; - sub_node_index < number_of_sub_nodes; - sub_node_index++ ) + if( libcdata_tree_node_empty( + (libcdata_tree_node_t *) internal_node, + value_free_function, + error ) != 1 ) { - if( libcdata_tree_node_get_nodes( - sub_node, - &parent_node, - &previous_node, - &next_node, - error ) != 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_GET_FAILED, - "%s: unable to retrieve nodes of sub node: %d.", - function, - sub_node_index ); - - return( -1 ); - } - if( previous_node != NULL ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, - "%s: invalid sub node: %d - previous node is set.", - function, - sub_node_index ); - - return( -1 ); - } - internal_node->first_sub_node = next_node; - - if( internal_node->last_sub_node == sub_node ) - { - internal_node->last_sub_node = next_node; - } - internal_node->number_of_sub_nodes--; - - if( next_node != NULL ) - { - if( libcdata_tree_node_set_previous_node( - next_node, - NULL, - error ) != 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_SET_FAILED, - "%s: unable to set previous node of sub node: %d.", - function, - sub_node_index + 1 ); - - return( -1 ); - } - } - if( libcdata_tree_node_set_nodes( - sub_node, - NULL, - NULL, - NULL, - error ) != 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_SET_FAILED, - "%s: unable to set nodes of sub node: %d.", - function, - sub_node_index ); + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to empty node.", + function ); - return( -1 ); - } - if( libcdata_tree_node_free( - &sub_node, - value_free_function, - error ) != 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, - "%s: unable to free sub node: %d.", - function, - sub_node_index ); + result = -1; + } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_free( + &( internal_node->read_write_lock ), + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to free read/write lock.", + function ); - result = -1; - } - sub_node = next_node; + result = -1; } +#endif if( internal_node->value != NULL ) { if( value_free_function != NULL ) @@ -271,8 +218,6 @@ } memory_free( internal_node ); - - *node = NULL; } return( result ); } @@ -282,7 +227,7 @@ * Returns 1 if successful or -1 on error */ int libcdata_tree_node_empty( - libcdata_tree_node_t *node, + libcdata_tree_node_t *tree_node, int (*value_free_function)( intptr_t **value, libcerror_error_t **error ), @@ -298,19 +243,34 @@ int result = 1; int sub_node_index = 0; - if( node == NULL ) + if( tree_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, - "%s: invalid node.", + "%s: invalid tree node.", function ); return( -1 ); } - internal_node = (libcdata_internal_tree_node_t *) node; + internal_node = (libcdata_internal_tree_node_t *) tree_node; + +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + return( -1 ); + } +#endif number_of_sub_nodes = internal_node->number_of_sub_nodes; sub_node = internal_node->first_sub_node; @@ -334,7 +294,7 @@ function, sub_node_index ); - return( -1 ); + goto on_error; } if( previous_node != NULL ) { @@ -346,7 +306,7 @@ function, sub_node_index ); - return( -1 ); + goto on_error; } internal_node->first_sub_node = next_node; @@ -371,7 +331,7 @@ function, sub_node_index + 1 ); - return( -1 ); + goto on_error; } } if( libcdata_tree_node_set_nodes( @@ -389,7 +349,7 @@ function, sub_node_index ); - return( -1 ); + goto on_error; } if( libcdata_tree_node_free( &sub_node, @@ -408,7 +368,30 @@ } sub_node = next_node; } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif return( result ); + +on_error: +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_write( + internal_node->read_write_lock, + NULL ); +#endif + return( -1 ); } /* Clones the tree node and its sub nodes @@ -433,7 +416,7 @@ libcdata_internal_tree_node_t *internal_destination_node = NULL; libcdata_internal_tree_node_t *internal_source_node = NULL; libcdata_tree_node_t *destination_sub_node = NULL; - libcdata_tree_node_t *source_sub_node = NULL; + libcdata_tree_node_t *sub_node = NULL; static char *function = "libcdata_tree_node_clone"; int sub_node_index = 0; @@ -490,7 +473,7 @@ internal_source_node = (libcdata_internal_tree_node_t *) source_node; if( libcdata_tree_node_initialize( - destination_node, + (libcdata_tree_node_t **) &internal_destination_node, error ) != 1 ) { libcerror_error_set( @@ -502,7 +485,7 @@ return( -1 ); } - if( *destination_node == NULL ) + if( internal_destination_node == NULL ) { libcerror_error_set( error, @@ -513,8 +496,21 @@ return( -1 ); } - internal_destination_node = (libcdata_internal_tree_node_t *) *destination_node; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_read( + internal_source_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for reading.", + function ); + return( -1 ); + } +#endif if( value_clone_function( &( internal_destination_node->value ), internal_source_node->value, @@ -531,13 +527,13 @@ } /* Clone the sub nodes */ - source_sub_node = internal_source_node->first_sub_node; + sub_node = internal_source_node->first_sub_node; for( sub_node_index = 0; sub_node_index < internal_source_node->number_of_sub_nodes; sub_node_index++ ) { - if( source_sub_node == NULL ) + if( sub_node == NULL ) { libcerror_error_set( error, @@ -551,7 +547,7 @@ } if( libcdata_tree_node_clone( &destination_sub_node, - source_sub_node, + sub_node, value_free_function, value_clone_function, error ) != 1 ) @@ -566,8 +562,8 @@ goto on_error; } - if( libcdata_tree_node_append_node( - *destination_node, + if( libcdata_internal_tree_node_append_node( + internal_destination_node, destination_sub_node, error ) != 1 ) { @@ -584,24 +580,51 @@ destination_sub_node = NULL; if( libcdata_tree_node_get_next_node( - source_sub_node, - &source_sub_node, + sub_node, + &sub_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, - "%s: unable to retrieve next node of source sub node: %d.", + "%s: unable to retrieve next node of sub node: %d.", function, sub_node_index ); goto on_error; } } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_read( + internal_source_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for reading.", + function ); + + libcdata_tree_node_free( + &destination_sub_node, + value_free_function, + NULL ); + + return( -1 ); + } +#endif + *destination_node = (libcdata_tree_node_t *) internal_destination_node; + return( 1 ); on_error: +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_read( + internal_source_node->read_write_lock, + NULL ); +#endif if( destination_sub_node != NULL ) { libcdata_tree_node_free( @@ -609,10 +632,10 @@ value_free_function, NULL ); } - if( destination_node != NULL ) + if( internal_destination_node != NULL ) { libcdata_tree_node_free( - destination_node, + (libcdata_tree_node_t **) &internal_destination_node, value_free_function, NULL ); } @@ -654,8 +677,38 @@ return( -1 ); } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_read( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for reading.", + function ); + + return( -1 ); + } +#endif *value = internal_node->value; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_read( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for reading.", + function ); + + return( -1 ); + } +#endif return( 1 ); } @@ -683,8 +736,38 @@ } internal_node = (libcdata_internal_tree_node_t *) node; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + + return( -1 ); + } +#endif internal_node->value = value; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif return( 1 ); } @@ -723,8 +806,38 @@ return( -1 ); } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_read( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for reading.", + function ); + + return( -1 ); + } +#endif *parent_node = internal_node->parent_node; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_read( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for reading.", + function ); + + return( -1 ); + } +#endif return( 1 ); } @@ -752,8 +865,38 @@ } internal_node = (libcdata_internal_tree_node_t *) node; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + + return( -1 ); + } +#endif internal_node->parent_node = parent_node; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif return( 1 ); } @@ -792,8 +935,38 @@ return( -1 ); } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_read( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for reading.", + function ); + + return( -1 ); + } +#endif *previous_node = internal_node->previous_node; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_read( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for reading.", + function ); + + return( -1 ); + } +#endif return( 1 ); } @@ -821,8 +994,38 @@ } internal_node = (libcdata_internal_tree_node_t *) node; - internal_node->previous_node = previous_node; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + + return( -1 ); + } +#endif + internal_node->previous_node = previous_node; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif return( 1 ); } @@ -861,8 +1064,38 @@ return( -1 ); } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_read( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for reading.", + function ); + + return( -1 ); + } +#endif *next_node = internal_node->next_node; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_read( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for reading.", + function ); + + return( -1 ); + } +#endif return( 1 ); } @@ -890,8 +1123,38 @@ } internal_node = (libcdata_internal_tree_node_t *) node; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + + return( -1 ); + } +#endif internal_node->next_node = next_node; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif return( 1 ); } @@ -954,10 +1217,40 @@ return( -1 ); } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_read( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for reading.", + function ); + + return( -1 ); + } +#endif *parent_node = internal_node->parent_node; *previous_node = internal_node->previous_node; *next_node = internal_node->next_node; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_read( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for reading.", + function ); + + return( -1 ); + } +#endif return( 1 ); } @@ -987,37 +1280,137 @@ } internal_node = (libcdata_internal_tree_node_t *) node; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + + return( -1 ); + } +#endif internal_node->parent_node = parent_node; internal_node->previous_node = previous_node; internal_node->next_node = next_node; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif return( 1 ); } -/* Appends a tree node to the parent node +/* Retrieves the sub nodes from the tree node * Returns 1 if successful or -1 on error */ -int libcdata_tree_node_append_node( - libcdata_tree_node_t *parent_node, +int libcdata_tree_node_get_sub_nodes( libcdata_tree_node_t *node, + libcdata_tree_node_t **first_sub_node, + libcdata_tree_node_t **last_sub_node, libcerror_error_t **error ) { - libcdata_internal_tree_node_t *internal_node = NULL; - libcdata_internal_tree_node_t *internal_parent_node = NULL; - static char *function = "libcdata_tree_node_append_node"; + libcdata_internal_tree_node_t *internal_node = NULL; + static char *function = "libcdata_tree_node_sub_get_nodes"; - if( parent_node == NULL ) + if( node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, - "%s: invalid parent node.", + "%s: invalid node.", + function ); + + return( -1 ); + } + internal_node = (libcdata_internal_tree_node_t *) node; + + if( first_sub_node == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid first sub node.", + function ); + + return( -1 ); + } + if( last_sub_node == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid last sub node.", + function ); + + return( -1 ); + } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_read( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for reading.", + function ); + + return( -1 ); + } +#endif + *first_sub_node = internal_node->first_sub_node; + *last_sub_node = internal_node->last_sub_node; + +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_read( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for reading.", function ); return( -1 ); } - internal_parent_node = (libcdata_internal_tree_node_t *) parent_node; +#endif + return( 1 ); +} + +/* Sets the sub nodes in the tree node + * Returns 1 if successful or -1 on error + */ +int libcdata_tree_node_set_sub_nodes( + libcdata_tree_node_t *node, + libcdata_tree_node_t *first_sub_node, + libcdata_tree_node_t *last_sub_node, + libcerror_error_t **error ) +{ + libcdata_internal_tree_node_t *internal_node = NULL; + static char *function = "libcdata_tree_node_set_sub_nodes"; if( node == NULL ) { @@ -1032,24 +1425,109 @@ } internal_node = (libcdata_internal_tree_node_t *) node; - if( ( internal_node->parent_node != NULL ) - || ( internal_node->previous_node != NULL ) - || ( internal_node->next_node != NULL ) ) +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_node->read_write_lock, + error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, - "%s: invalid node - node is already part of a tree.", + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", function ); return( -1 ); } - internal_node->parent_node = parent_node; +#endif + internal_node->first_sub_node = first_sub_node; + internal_node->last_sub_node = last_sub_node; + +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif + return( 1 ); +} + +/* Appends a sub tree node to the node + * Returns 1 if successful or -1 on error + */ +int libcdata_internal_tree_node_append_node( + libcdata_internal_tree_node_t *internal_node, + libcdata_tree_node_t *node_to_append, + libcerror_error_t **error ) +{ + libcdata_tree_node_t *to_append_next_node = NULL; + libcdata_tree_node_t *to_append_parent_node = NULL; + libcdata_tree_node_t *to_append_previous_node = NULL; + static char *function = "libcdata_internal_tree_node_append_node"; + + if( internal_node == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid node.", + function ); + + return( -1 ); + } + if( node_to_append == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid node to append.", + function ); + + return( -1 ); + } + if( libcdata_tree_node_get_nodes( + node_to_append, + &to_append_parent_node, + &to_append_previous_node, + &to_append_next_node, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to retrieve nodes of node to append.", + function ); + + return( -1 ); + } + if( ( to_append_parent_node != NULL ) + || ( to_append_previous_node != NULL ) + || ( to_append_next_node != NULL ) ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, + "%s: invalid node to append - node is already part of a tree.", + function ); - if( internal_parent_node->number_of_sub_nodes == 0 ) + return( -1 ); + } + if( internal_node->number_of_sub_nodes == 0 ) { - if( internal_parent_node->first_sub_node != NULL ) + if( internal_node->first_sub_node != NULL ) { libcerror_error_set( error, @@ -1060,7 +1538,7 @@ return( -1 ); } - if( internal_parent_node->last_sub_node != NULL ) + if( internal_node->last_sub_node != NULL ) { libcerror_error_set( error, @@ -1071,12 +1549,12 @@ return( -1 ); } - internal_parent_node->first_sub_node = node; - internal_parent_node->last_sub_node = node; + internal_node->first_sub_node = node_to_append; + internal_node->last_sub_node = node_to_append; } else { - if( internal_parent_node->first_sub_node == NULL ) + if( internal_node->first_sub_node == NULL ) { libcerror_error_set( error, @@ -1087,7 +1565,7 @@ return( -1 ); } - if( internal_parent_node->last_sub_node == NULL ) + if( internal_node->last_sub_node == NULL ) { libcerror_error_set( error, @@ -1099,8 +1577,8 @@ return( -1 ); } if( libcdata_tree_node_set_next_node( - internal_parent_node->last_sub_node, - node, + internal_node->last_sub_node, + node_to_append, error ) != 1 ) { libcerror_error_set( @@ -1112,55 +1590,169 @@ return( -1 ); } - internal_node->previous_node = internal_parent_node->last_sub_node; - internal_parent_node->last_sub_node = node; + if( libcdata_tree_node_set_previous_node( + node_to_append, + internal_node->last_sub_node, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to set previous node of node to append.", + function ); + + return( -1 ); + } + internal_node->last_sub_node = node_to_append; } - internal_parent_node->number_of_sub_nodes++; + if( libcdata_tree_node_set_parent_node( + node_to_append, + (libcdata_tree_node_t *) internal_node, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to set parent node of node to append.", + function ); + + return( -1 ); + } + internal_node->number_of_sub_nodes++; return( 1 ); } -/* Appends a value to the parent node - * Creates a new tree node +/* Appends a tree node to the node + * Returns 1 if successful or -1 on error + */ +int libcdata_tree_node_append_node( + libcdata_tree_node_t *node, + libcdata_tree_node_t *sub_node, + libcerror_error_t **error ) +{ + libcdata_internal_tree_node_t *internal_node = NULL; + static char *function = "libcdata_tree_node_append_node"; + int result = 1; + + if( node == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid node.", + function ); + + return( -1 ); + } + internal_node = (libcdata_internal_tree_node_t *) node; + +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + + return( -1 ); + } +#endif + if( libcdata_internal_tree_node_append_node( + internal_node, + sub_node, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, + "%s: unable to append node.", + function ); + + result = -1; + } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif + return( result ); +} + +/* Appends a value to the node + * Creates a new sub tree node * Returns 1 if successful or -1 on error */ int libcdata_tree_node_append_value( - libcdata_tree_node_t *parent_node, + libcdata_tree_node_t *node, intptr_t *value, libcerror_error_t **error ) { - libcdata_tree_node_t *tree_node = NULL; - static char *function = "libcdata_tree_node_append_value"; + libcdata_internal_tree_node_t *internal_node = NULL; + libcdata_tree_node_t *sub_node = NULL; + static char *function = "libcdata_tree_node_append_value"; + + if( node == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid node.", + function ); - if( libcdata_tree_node_initialize( - &tree_node, + return( -1 ); + } + internal_node = (libcdata_internal_tree_node_t *) node; + +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_node->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, - "%s: unable to create tree node.", + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", function ); - goto on_error; + return( -1 ); } - if( libcdata_tree_node_append_node( - parent_node, - tree_node, +#endif + if( libcdata_tree_node_initialize( + &sub_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, - "%s: unable to append tree node.", + LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, + "%s: unable to create sub node.", function ); goto on_error; } if( libcdata_tree_node_set_value( - tree_node, + sub_node, value, error ) != 1 ) { @@ -1168,25 +1760,59 @@ error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, - "%s: unable to set value in tree node.", + "%s: unable to set value in sub node.", + function ); + + goto on_error; + } + if( libcdata_internal_tree_node_append_node( + internal_node, + sub_node, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, + "%s: unable to append sub node to node.", function ); goto on_error; } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif return( 1 ); on_error: - if( tree_node != NULL ) +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_write( + internal_node->read_write_lock, + NULL ); +#endif + if( sub_node != NULL ) { libcdata_tree_node_free( - &tree_node, + &sub_node, NULL, NULL ); } return( -1 ); } -/* Inserts a tree node in the parent node +/* Inserts a sub tree node in the node * * Uses the entry_compare_function to determine the order of the entries * The entry_compare_function should return LIBCDATA_COMPARE_LESS, @@ -1197,9 +1823,9 @@ * * Returns 1 if successful, 0 if the node already exists or -1 on error */ -int libcdata_tree_node_insert_node( - libcdata_tree_node_t *parent_node, - libcdata_tree_node_t *node, +int libcdata_internal_tree_node_insert_node( + libcdata_internal_tree_node_t *internal_node, + libcdata_tree_node_t *node_to_insert, int (*value_compare_function)( intptr_t *first_value, intptr_t *second_value, @@ -1207,50 +1833,64 @@ uint8_t insert_flags, libcerror_error_t **error ) { - libcdata_internal_tree_node_t *internal_node = NULL; - libcdata_internal_tree_node_t *internal_parent_node = NULL; - libcdata_tree_node_t *previous_node = NULL; - libcdata_tree_node_t *sub_node = NULL; - intptr_t *sub_node_value = NULL; - static char *function = "libcdata_tree_node_insert_node"; - int result = -1; - int sub_node_index = 0; + libcdata_tree_node_t *previous_node = NULL; + libcdata_tree_node_t *sub_node = NULL; + libcdata_tree_node_t *to_insert_next_node = NULL; + libcdata_tree_node_t *to_insert_parent_node = NULL; + libcdata_tree_node_t *to_insert_previous_node = NULL; + intptr_t *sub_node_value = NULL; + intptr_t *value_to_insert = NULL; + static char *function = "libcdata_internal_tree_node_insert_node"; + int result = -1; + int sub_node_index = 0; - if( parent_node == NULL ) + if( internal_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, - "%s: invalid parent node.", + "%s: invalid node.", function ); return( -1 ); } - internal_parent_node = (libcdata_internal_tree_node_t *) parent_node; - - if( node == NULL ) + if( node_to_insert == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, - "%s: invalid node.", + "%s: invalid node to insert.", function ); return( -1 ); } - internal_node = (libcdata_internal_tree_node_t *) node; + if( libcdata_tree_node_get_nodes( + node_to_insert, + &to_insert_parent_node, + &to_insert_previous_node, + &to_insert_next_node, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to retrieve nodes of node to insert.", + function ); - if( ( internal_node->parent_node != NULL ) - || ( internal_node->previous_node != NULL ) - || ( internal_node->next_node != NULL ) ) + return( -1 ); + } + if( ( to_insert_parent_node != NULL ) + || ( to_insert_previous_node != NULL ) + || ( to_insert_next_node != NULL ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, - "%s: invalid node - node is already part of a tree.", + "%s: invalid node to insert - node is already part of a tree.", function ); return( -1 ); @@ -1278,9 +1918,9 @@ return( -1 ); } - if( internal_parent_node->number_of_sub_nodes == 0 ) + if( internal_node->number_of_sub_nodes == 0 ) { - if( internal_parent_node->first_sub_node != NULL ) + if( internal_node->first_sub_node != NULL ) { libcerror_error_set( error, @@ -1291,7 +1931,7 @@ return( -1 ); } - if( internal_parent_node->last_sub_node != NULL ) + if( internal_node->last_sub_node != NULL ) { libcerror_error_set( error, @@ -1302,12 +1942,12 @@ return( -1 ); } - internal_parent_node->first_sub_node = node; - internal_parent_node->last_sub_node = node; + internal_node->first_sub_node = node_to_insert; + internal_node->last_sub_node = node_to_insert; } else { - if( internal_parent_node->first_sub_node == NULL ) + if( internal_node->first_sub_node == NULL ) { libcerror_error_set( error, @@ -1318,7 +1958,7 @@ return( -1 ); } - if( internal_parent_node->last_sub_node == NULL ) + if( internal_node->last_sub_node == NULL ) { libcerror_error_set( error, @@ -1329,10 +1969,24 @@ return( -1 ); } - sub_node = internal_parent_node->first_sub_node; + if( libcdata_tree_node_get_value( + node_to_insert, + &value_to_insert, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to retrieve value of node to insert.", + function ); + + return( -1 ); + } + sub_node = internal_node->first_sub_node; for( sub_node_index = 0; - sub_node_index < internal_parent_node->number_of_sub_nodes; + sub_node_index < internal_node->number_of_sub_nodes; sub_node_index++ ) { if( libcdata_tree_node_get_value( @@ -1351,7 +2005,7 @@ return( -1 ); } result = value_compare_function( - internal_node->value, + value_to_insert, sub_node_value, error ); @@ -1423,12 +2077,25 @@ return( -1 ); } - internal_node->previous_node = previous_node; - internal_node->next_node = sub_node; + if( libcdata_tree_node_set_nodes( + node_to_insert, + NULL, + previous_node, + sub_node, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to set previous and next node of node to insert.", + function ); - if( sub_node == internal_parent_node->first_sub_node ) + return( -1 ); + } + if( sub_node == internal_node->first_sub_node ) { - internal_parent_node->first_sub_node = node; + internal_node->first_sub_node = node_to_insert; } else { @@ -1446,7 +2113,7 @@ } if( libcdata_tree_node_set_next_node( previous_node, - node, + node_to_insert, error ) != 1 ) { libcerror_error_set( @@ -1462,7 +2129,7 @@ } if( libcdata_tree_node_set_previous_node( sub_node, - node, + node_to_insert, error ) != 1 ) { libcerror_error_set( @@ -1479,8 +2146,8 @@ else { if( libcdata_tree_node_set_next_node( - internal_parent_node->last_sub_node, - node, + internal_node->last_sub_node, + node_to_insert, error ) != 1 ) { libcerror_error_set( @@ -1492,20 +2159,134 @@ return( -1 ); } - internal_node->previous_node = internal_parent_node->last_sub_node; - internal_parent_node->last_sub_node = node; + if( libcdata_tree_node_set_previous_node( + node_to_insert, + internal_node->last_sub_node, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to set previous node of node to insert.", + function ); + + return( -1 ); + } + internal_node->last_sub_node = node_to_insert; } } - internal_node->parent_node = parent_node; + if( libcdata_tree_node_set_parent_node( + node_to_insert, + (libcdata_tree_node_t *) internal_node, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to set parent node of node to insert.", + function ); - internal_parent_node->number_of_sub_nodes++; + return( -1 ); + } + internal_node->number_of_sub_nodes++; return( 1 ); } -/* Inserts a value in the parent node +/* Inserts a sub tree node in the node + * + * Uses the entry_compare_function to determine the order of the entries + * The entry_compare_function should return LIBCDATA_COMPARE_LESS, + * LIBCDATA_COMPARE_EQUAL, LIBCDATA_COMPARE_GREATER if successful or -1 on error + * + * Duplicate entries are allowed by default and inserted after the last duplicate entry. + * Only allowing unique entries can be enforced by setting the flag LIBCDATA_INSERT_FLAG_UNIQUE_ENTRIES + * + * Returns 1 if successful, 0 if the node already exists or -1 on error + */ +int libcdata_tree_node_insert_node( + libcdata_tree_node_t *node, + libcdata_tree_node_t *node_to_insert, + int (*value_compare_function)( + intptr_t *first_value, + intptr_t *second_value, + libcerror_error_t **error ), + uint8_t insert_flags, + libcerror_error_t **error ) +{ + libcdata_internal_tree_node_t *internal_node = NULL; + static char *function = "libcdata_tree_node_insert_node"; + int result = 1; + + if( node == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid node.", + function ); + + return( -1 ); + } + internal_node = (libcdata_internal_tree_node_t *) node; + +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + + return( -1 ); + } +#endif + result = libcdata_internal_tree_node_insert_node( + internal_node, + node_to_insert, + value_compare_function, + insert_flags, + error ); + + if( result == -1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, + "%s: unable to insert node.", + function ); + + result = -1; + } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif + return( result ); +} + +/* Inserts a value in the node * - * Creates a new tree node + * Creates a new sub tree node * * Uses the entry_compare_function to determine the order of the entries * The entry_compare_function should return LIBCDATA_COMPARE_LESS, @@ -1517,7 +2298,7 @@ * Returns 1 if successful, 0 if the node already exists or -1 on error */ int libcdata_tree_node_insert_value( - libcdata_tree_node_t *parent_node, + libcdata_tree_node_t *node, intptr_t *value, int (*value_compare_function)( intptr_t *first_value, @@ -1526,25 +2307,54 @@ uint8_t insert_flags, libcerror_error_t **error ) { - libcdata_tree_node_t *tree_node = NULL; - static char *function = "libcdata_tree_node_insert_value"; - int result = 0; + libcdata_internal_tree_node_t *internal_node = NULL; + libcdata_tree_node_t *sub_node = NULL; + static char *function = "libcdata_tree_node_insert_value"; + int result = 0; + + if( node == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid node.", + function ); + + return( -1 ); + } + internal_node = (libcdata_internal_tree_node_t *) node; + +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + return( -1 ); + } +#endif if( libcdata_tree_node_initialize( - &tree_node, + &sub_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, - "%s: unable to create tree node.", + "%s: unable to create sub node.", function ); goto on_error; } if( libcdata_tree_node_set_value( - tree_node, + sub_node, value, error ) != 1 ) { @@ -1552,14 +2362,14 @@ error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, - "%s: unable to set value in tree node.", + "%s: unable to set value in sub node.", function ); goto on_error; } - result = libcdata_tree_node_insert_node( - parent_node, - tree_node, + result = libcdata_internal_tree_node_insert_node( + internal_node, + sub_node, value_compare_function, insert_flags, error ); @@ -1578,7 +2388,7 @@ else if( result == 0 ) { if( libcdata_tree_node_free( - &tree_node, + &sub_node, NULL, error ) != 1 ) { @@ -1586,19 +2396,39 @@ error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, - "%s: unable to free tree node.", + "%s: unable to free sub node.", function ); goto on_error; } } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif return( result ); on_error: - if( tree_node != NULL ) +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_write( + internal_node->read_write_lock, + NULL ); +#endif + if( sub_node != NULL ) { libcdata_tree_node_free( - &tree_node, + &sub_node, NULL, NULL ); } @@ -1613,216 +2443,364 @@ libcdata_tree_node_t *replacement_node, libcerror_error_t **error ) { - libcdata_internal_tree_node_t *internal_node = NULL; - libcdata_internal_tree_node_t *internal_replacement_node = NULL; - libcdata_tree_node_t *first_sub_node = NULL; - libcdata_tree_node_t *last_sub_node = NULL; - libcdata_tree_node_t *sub_node = NULL; - intptr_t *value = NULL; - static char *function = "libcdata_tree_node_replace_node"; - int number_of_sub_nodes = 0; - int sub_node_index = 0; + libcdata_internal_tree_node_t *internal_node = NULL; + libcdata_tree_node_t *next_node = NULL; + libcdata_tree_node_t *parent_first_sub_node = NULL; + libcdata_tree_node_t *parent_last_sub_node = NULL; + libcdata_tree_node_t *parent_node = NULL; + libcdata_tree_node_t *previous_node = NULL; + libcdata_tree_node_t *replacement_next_node = NULL; + libcdata_tree_node_t *replacement_parent_node = NULL; + libcdata_tree_node_t *replacement_previous_node = NULL; + static char *function = "libcdata_tree_node_replace_node"; if( node == NULL ) { libcerror_error_set( error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, - "%s: invalid node.", + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid node.", + function ); + + return( -1 ); + } + internal_node = (libcdata_internal_tree_node_t *) node; + + if( replacement_node == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid replacement node.", + function ); + + return( -1 ); + } + if( replacement_node == node ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, + "%s: cannot replace node with itself.", + function ); + + return( -1 ); + } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", + function ); + + return( -1 ); + } +#endif + if( libcdata_tree_node_get_nodes( + replacement_node, + &replacement_parent_node, + &replacement_previous_node, + &replacement_next_node, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to retrieve nodes of replacement node.", + function ); + + goto on_error; + } + if( ( replacement_parent_node != NULL ) + || ( replacement_previous_node != NULL ) + || ( replacement_next_node != NULL ) ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, + "%s: invalid replacement node - node is already part of a tree.", function ); - return( -1 ); + goto on_error; } - internal_node = (libcdata_internal_tree_node_t *) node; - - if( replacement_node == NULL ) + if( libcdata_tree_node_get_sub_nodes( + internal_node->parent_node, + &parent_first_sub_node, + &parent_last_sub_node, + error ) != 1 ) { libcerror_error_set( error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, - "%s: invalid replacement node.", + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to retrieve sub nodes of parent node.", function ); - return( -1 ); + goto on_error; } - internal_replacement_node = (libcdata_internal_tree_node_t *) replacement_node; + parent_node = internal_node->parent_node; + internal_node->parent_node = replacement_parent_node; + replacement_parent_node = parent_node; - if( replacement_node == node ) + previous_node = internal_node->previous_node; + internal_node->previous_node = replacement_previous_node; + replacement_previous_node = previous_node; + + next_node = internal_node->next_node; + internal_node->next_node = replacement_next_node; + replacement_next_node = next_node; + + if( parent_first_sub_node == node ) + { + parent_first_sub_node = replacement_node; + } + if( parent_last_sub_node == node ) + { + parent_last_sub_node = replacement_node; + } + if( libcdata_tree_node_set_nodes( + replacement_node, + replacement_parent_node, + replacement_previous_node, + replacement_next_node, + error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, - "%s: cannot replace node with itself.", + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to set nodes of replacement node.", function ); - return( -1 ); + goto on_error; } - if( ( internal_replacement_node->parent_node != NULL ) - || ( internal_replacement_node->previous_node != NULL ) - || ( internal_replacement_node->next_node != NULL ) ) + if( libcdata_tree_node_set_sub_nodes( + parent_node, + parent_first_sub_node, + parent_last_sub_node, + error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, - "%s: invalid replacement node - node is already part of a tree.", + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to set sub nodes of parent node.", function ); - return( -1 ); + goto on_error; } - value = internal_node->value; - first_sub_node = internal_node->first_sub_node; - last_sub_node = internal_node->last_sub_node; - number_of_sub_nodes = internal_node->number_of_sub_nodes; - - internal_node->value = internal_replacement_node->value; - internal_node->first_sub_node = internal_replacement_node->first_sub_node; - internal_node->last_sub_node = internal_replacement_node->last_sub_node; - internal_node->number_of_sub_nodes = internal_replacement_node->number_of_sub_nodes; - - internal_replacement_node->value = value; - internal_replacement_node->first_sub_node = first_sub_node; - internal_replacement_node->last_sub_node = last_sub_node; - internal_replacement_node->number_of_sub_nodes = number_of_sub_nodes; - - sub_node = internal_node->first_sub_node; - - for( sub_node_index = 0; - sub_node_index < internal_node->number_of_sub_nodes; - sub_node_index++ ) + if( previous_node != NULL ) { - if( libcdata_tree_node_set_parent_node( - sub_node, - node, + if( libcdata_tree_node_set_next_node( + previous_node, + replacement_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, - "%s: unable to set parent node value of sub node: %d.", - function, - sub_node_index ); + "%s: unable to set next node of previous node.", + function ); - return( -1 ); + goto on_error; } - if( libcdata_tree_node_get_next_node( - sub_node, - &sub_node, + } + if( next_node != NULL ) + { + if( libcdata_tree_node_set_previous_node( + next_node, + replacement_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_GET_FAILED, - "%s: unable to retrieve next node of sub node: %d.", - function, - sub_node_index ); + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to set previous node of next node.", + function ); - return( -1 ); + goto on_error; } } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + + return( -1 ); + } +#endif return( 1 ); + +on_error: +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_write( + internal_node->read_write_lock, + NULL ); +#endif + return( -1 ); } -/* Removes a tree node from the parent node +/* Removes a sub tree node from the tree node * Returns 1 if successful or -1 on error */ int libcdata_tree_node_remove_node( - libcdata_tree_node_t *parent_node, libcdata_tree_node_t *node, + libcdata_tree_node_t *node_to_remove, libcerror_error_t **error ) { - libcdata_internal_tree_node_t *internal_node = NULL; - libcdata_internal_tree_node_t *internal_parent_node = NULL; - static char *function = "libcdata_tree_node_remove_node"; + libcdata_internal_tree_node_t *internal_node = NULL; + libcdata_tree_node_t *to_remove_next_node = NULL; + libcdata_tree_node_t *to_remove_parent_node = NULL; + libcdata_tree_node_t *to_remove_previous_node = NULL; + static char *function = "libcdata_tree_node_remove_node"; - if( parent_node == NULL ) + if( node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, - "%s: invalid parent node.", + "%s: invalid node.", function ); return( -1 ); } - internal_parent_node = (libcdata_internal_tree_node_t *) parent_node; + internal_node = (libcdata_internal_tree_node_t *) node; - if( node == NULL ) + if( node_to_remove == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, - "%s: invalid node.", + "%s: invalid node to remove.", function ); return( -1 ); } - internal_node = (libcdata_internal_tree_node_t *) node; - - if( parent_node != internal_node->parent_node ) + if( internal_node->number_of_sub_nodes == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, - "%s: invalid node - parent node mismatch.", + LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, + "%s: invalid node - missing number of sub nodes.", function ); return( -1 ); } - if( internal_parent_node->number_of_sub_nodes == 0 ) + if( internal_node->first_sub_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, - "%s: invalid parent node - missing number of sub nodes.", + "%s: invalid node - missing first sub node.", function ); return( -1 ); } - if( internal_parent_node->first_sub_node == NULL ) + if( internal_node->last_sub_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, - "%s: invalid parent node - missing first sub node.", + "%s: invalid node - missing last sub node.", function ); return( -1 ); } - if( internal_parent_node->last_sub_node == NULL ) +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_write( + internal_node->read_write_lock, + error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, - "%s: invalid parent node - missing last sub node.", + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for writing.", function ); return( -1 ); } - if( internal_parent_node->first_sub_node == node ) +#endif + if( libcdata_tree_node_get_nodes( + node_to_remove, + &to_remove_parent_node, + &to_remove_previous_node, + &to_remove_next_node, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to retrieve nodes of node to remove.", + function ); + + goto on_error; + } + if( to_remove_parent_node != node ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, + "%s: invalid node to remove - parent node mismatch.", + function ); + + goto on_error; + } + if( libcdata_tree_node_set_nodes( + node_to_remove, + NULL, + NULL, + NULL, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to set nodes of node to remove.", + function ); + + goto on_error; + } + if( internal_node->first_sub_node == node_to_remove ) { - internal_parent_node->first_sub_node = internal_node->next_node; + internal_node->first_sub_node = to_remove_next_node; } - if( internal_parent_node->last_sub_node == node ) + if( internal_node->last_sub_node == node_to_remove ) { - internal_parent_node->last_sub_node = internal_node->previous_node; + internal_node->last_sub_node = to_remove_previous_node; } - if( internal_node->next_node != NULL ) + if( to_remove_next_node != NULL ) { if( libcdata_tree_node_set_previous_node( - internal_node->next_node, - internal_node->previous_node, + to_remove_next_node, + to_remove_previous_node, error ) != 1 ) { libcerror_error_set( @@ -1832,14 +2810,14 @@ "%s: unable to set previous node of next node.", function ); - return( -1 ); + goto on_error; } } - if( internal_node->previous_node != NULL ) + if( to_remove_previous_node != NULL ) { if( libcdata_tree_node_set_next_node( - internal_node->previous_node, - internal_node->next_node, + to_remove_previous_node, + to_remove_next_node, error ) != 1 ) { libcerror_error_set( @@ -1849,16 +2827,35 @@ "%s: unable to set next node of previous node.", function ); - return( -1 ); + goto on_error; } } - internal_node->parent_node = NULL; - internal_node->previous_node = NULL; - internal_node->next_node = NULL; + internal_node->number_of_sub_nodes--; - internal_parent_node->number_of_sub_nodes--; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_write( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for writing.", + function ); + return( -1 ); + } +#endif return( 1 ); + +on_error: +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_write( + internal_node->read_write_lock, + NULL ); +#endif + return( -1 ); } /* Retrieves the number of sub nodes in the tree node @@ -1896,8 +2893,38 @@ return( -1 ); } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_read( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for reading.", + function ); + + return( -1 ); + } +#endif *number_of_sub_nodes = internal_node->number_of_sub_nodes; +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_read( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for reading.", + function ); + + return( -1 ); + } +#endif return( 1 ); } @@ -1911,6 +2938,7 @@ libcerror_error_t **error ) { libcdata_internal_tree_node_t *internal_node = NULL; + libcdata_tree_node_t *safe_sub_node = NULL; static char *function = "libcdata_tree_node_get_sub_node_by_index"; int result = -1; int sub_node_iterator = 0; @@ -1951,12 +2979,27 @@ return( -1 ); } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_read( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for reading.", + function ); + + return( -1 ); + } +#endif /* Check if the sub nodes should be searched front to back * or back to front */ if( sub_node_index < ( internal_node->number_of_sub_nodes / 2 ) ) { - *sub_node = internal_node->first_sub_node; + safe_sub_node = internal_node->first_sub_node; for( sub_node_iterator = 0; sub_node_iterator < internal_node->number_of_sub_nodes; @@ -1969,8 +3012,8 @@ break; } if( libcdata_tree_node_get_next_node( - *sub_node, - sub_node, + safe_sub_node, + &safe_sub_node, error ) != 1 ) { libcerror_error_set( @@ -1981,13 +3024,13 @@ function, sub_node_iterator ); - return( -1 ); + goto on_error; } } } else { - *sub_node = internal_node->last_sub_node; + safe_sub_node = internal_node->last_sub_node; for( sub_node_iterator = ( internal_node->number_of_sub_nodes - 1 ); sub_node_iterator >= 0; @@ -2000,8 +3043,8 @@ break; } if( libcdata_tree_node_get_previous_node( - *sub_node, - sub_node, + safe_sub_node, + &safe_sub_node, error ) != 1 ) { libcerror_error_set( @@ -2012,11 +3055,36 @@ function, sub_node_iterator ); - return( -1 ); + goto on_error; } } } + *sub_node = safe_sub_node; + +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_read( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for reading.", + function ); + + return( -1 ); + } +#endif return( result ); + +on_error: +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_read( + internal_node->read_write_lock, + NULL ); +#endif + return( -1 ); } /* Retrieves a list of all the leaf nodes @@ -2056,6 +3124,21 @@ return( -1 ); } +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_grab_for_read( + internal_node->read_write_lock, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to grab read/write lock for reading.", + function ); + + return( -1 ); + } +#endif if( *leaf_node_list == NULL ) { if( libcdata_list_initialize( @@ -2069,12 +3152,40 @@ "%s: unable to create leaf node list.", function ); - return( -1 ); + goto on_error; } } /* Traverse the sub nodes */ - if( internal_node->number_of_sub_nodes > 0 ) + if( internal_node->number_of_sub_nodes == 0 ) + { + if( internal_node->value == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, + "%s: invalid node - missing value.", + function ); + + goto on_error; + } + if( libcdata_list_append_value( + *leaf_node_list, + internal_node->value, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, + "%s: unable to append tree node to leaf node list.", + function ); + + goto on_error; + } + } + else { sub_node = internal_node->first_sub_node; @@ -2092,7 +3203,7 @@ function, sub_node_index ); - return( -1 ); + goto on_error; } if( libcdata_tree_node_get_leaf_node_list( sub_node, @@ -2107,7 +3218,7 @@ function, sub_node_index ); - return( -1 ); + goto on_error; } if( libcdata_tree_node_get_next_node( sub_node, @@ -2122,38 +3233,33 @@ function, sub_node_index ); - return( -1 ); + goto on_error; } } } - else +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + if( libcthreads_read_write_lock_release_for_read( + internal_node->read_write_lock, + error ) != 1 ) { - if( internal_node->value == NULL ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, - "%s: invalid node - missing value.", - function ); - - return( -1 ); - } - if( libcdata_list_append_value( - *leaf_node_list, - internal_node->value, - error ) != 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, - "%s: unable to append tree node to leaf node list.", - function ); + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_SET_FAILED, + "%s: unable to release read/write lock for reading.", + function ); - return( -1 ); - } + return( -1 ); } +#endif return( 1 ); + +on_error: +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + libcthreads_read_write_lock_release_for_read( + internal_node->read_write_lock, + NULL ); +#endif + return( -1 ); } diff -Nru libsmdev-20171112/libcdata/libcdata_tree_node.h libsmdev-20181227/libcdata/libcdata_tree_node.h --- libsmdev-20171112/libcdata/libcdata_tree_node.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_tree_node.h 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * Tree functions * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -27,6 +27,7 @@ #include "libcdata_extern.h" #include "libcdata_libcerror.h" +#include "libcdata_libcthreads.h" #include "libcdata_types.h" #if defined( __cplusplus ) @@ -64,6 +65,12 @@ /* The node value */ intptr_t *value; + +#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA ) + /* The read/write lock + */ + libcthreads_read_write_lock_t *read_write_lock; +#endif }; LIBCDATA_EXTERN \ @@ -164,22 +171,49 @@ libcdata_tree_node_t *next_node, libcerror_error_t **error ); +int libcdata_tree_node_get_sub_nodes( + libcdata_tree_node_t *node, + libcdata_tree_node_t **first_sub_node, + libcdata_tree_node_t **last_sub_node, + libcerror_error_t **error ); + +int libcdata_tree_node_set_sub_nodes( + libcdata_tree_node_t *node, + libcdata_tree_node_t *first_sub_node, + libcdata_tree_node_t *last_sub_node, + libcerror_error_t **error ); + +int libcdata_internal_tree_node_append_node( + libcdata_internal_tree_node_t *internal_node, + libcdata_tree_node_t *sub_node, + libcerror_error_t **error ); + LIBCDATA_EXTERN \ int libcdata_tree_node_append_node( - libcdata_tree_node_t *parent_node, libcdata_tree_node_t *node, + libcdata_tree_node_t *node_to_append, libcerror_error_t **error ); LIBCDATA_EXTERN \ int libcdata_tree_node_append_value( - libcdata_tree_node_t *parent_node, + libcdata_tree_node_t *node, intptr_t *value, libcerror_error_t **error ); +int libcdata_internal_tree_node_insert_node( + libcdata_internal_tree_node_t *internal_node, + libcdata_tree_node_t *sub_node, + int (*value_compare_function)( + intptr_t *first_value, + intptr_t *second_value, + libcerror_error_t **error ), + uint8_t insert_flags, + libcerror_error_t **error ); + LIBCDATA_EXTERN \ int libcdata_tree_node_insert_node( - libcdata_tree_node_t *parent_node, libcdata_tree_node_t *node, + libcdata_tree_node_t *node_to_insert, int (*value_compare_function)( intptr_t *first_value, intptr_t *second_value, @@ -189,7 +223,7 @@ LIBCDATA_EXTERN \ int libcdata_tree_node_insert_value( - libcdata_tree_node_t *parent_node, + libcdata_tree_node_t *node, intptr_t *value, int (*value_compare_function)( intptr_t *first_value, @@ -206,8 +240,8 @@ LIBCDATA_EXTERN \ int libcdata_tree_node_remove_node( - libcdata_tree_node_t *parent_node, libcdata_tree_node_t *node, + libcdata_tree_node_t *node_to_remove, libcerror_error_t **error ); LIBCDATA_EXTERN \ diff -Nru libsmdev-20171112/libcdata/libcdata_types.h libsmdev-20181227/libcdata/libcdata_types.h --- libsmdev-20171112/libcdata/libcdata_types.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_types.h 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal type definitions * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcdata/libcdata_unused.h libsmdev-20181227/libcdata/libcdata_unused.h --- libsmdev-20171112/libcdata/libcdata_unused.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcdata/libcdata_unused.h 2018-12-27 19:18:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal unused definition * - * Copyright (C) 2006-2017, Joachim Metz + * Copyright (C) 2006-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcdata/Makefile.am libsmdev-20181227/libcdata/Makefile.am --- libsmdev-20171112/libcdata/Makefile.am 2017-07-22 09:22:10.000000000 +0000 +++ libsmdev-20181227/libcdata/Makefile.am 2018-12-27 19:18:59.000000000 +0000 @@ -4,7 +4,7 @@ -I$(top_srcdir)/common \ @LIBCERROR_CPPFLAGS@ \ @LIBCTHREADS_CPPFLAGS@ \ - @PTHREAD_CPPFLAGS@ + @PTHREAD_CPPFLAGS@ noinst_LTLIBRARIES = libcdata.la diff -Nru libsmdev-20171112/libcdata/Makefile.in libsmdev-20181227/libcdata/Makefile.in --- libsmdev-20171112/libcdata/Makefile.in 2017-11-12 14:33:40.000000000 +0000 +++ libsmdev-20181227/libcdata/Makefile.in 2018-12-27 19:19:39.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 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,15 @@ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/libcdata_array.Plo \ + ./$(DEPDIR)/libcdata_btree.Plo ./$(DEPDIR)/libcdata_error.Plo \ + ./$(DEPDIR)/libcdata_list.Plo \ + ./$(DEPDIR)/libcdata_list_element.Plo \ + ./$(DEPDIR)/libcdata_range_list.Plo \ + ./$(DEPDIR)/libcdata_range_list_value.Plo \ + ./$(DEPDIR)/libcdata_support.Plo \ + ./$(DEPDIR)/libcdata_tree_node.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -283,6 +291,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSMDEV_DLL_EXPORT = @LIBSMDEV_DLL_EXPORT@ LIBSMDEV_DLL_IMPORT = @LIBSMDEV_DLL_IMPORT@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -432,7 +441,6 @@ libcthreads_LIBS = @libcthreads_LIBS@ libdir = @libdir@ libexecdir = @libexecdir@ -libsmdev_spec_build_requires = @libsmdev_spec_build_requires@ libsmdev_spec_requires = @libsmdev_spec_requires@ libuna_CFLAGS = @libuna_CFLAGS@ libuna_LIBS = @libuna_LIBS@ @@ -464,7 +472,7 @@ @HAVE_LOCAL_LIBCDATA_TRUE@ -I$(top_srcdir)/common \ @HAVE_LOCAL_LIBCDATA_TRUE@ @LIBCERROR_CPPFLAGS@ \ @HAVE_LOCAL_LIBCDATA_TRUE@ @LIBCTHREADS_CPPFLAGS@ \ -@HAVE_LOCAL_LIBCDATA_TRUE@ @PTHREAD_CPPFLAGS@ +@HAVE_LOCAL_LIBCDATA_TRUE@ @PTHREAD_CPPFLAGS@ @HAVE_LOCAL_LIBCDATA_TRUE@noinst_LTLIBRARIES = libcdata.la @HAVE_LOCAL_LIBCDATA_TRUE@libcdata_la_SOURCES = \ @@ -508,8 +516,8 @@ *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) @@ -541,15 +549,21 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdata_array.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdata_btree.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdata_error.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdata_list.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdata_list_element.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdata_range_list.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdata_range_list_value.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdata_support.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdata_tree_node.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdata_array.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdata_btree.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdata_error.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdata_list.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdata_list_element.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdata_range_list.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdata_range_list_value.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdata_support.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdata_tree_node.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -630,7 +644,10 @@ 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)'; \ @@ -744,7 +761,15 @@ installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/libcdata_array.Plo + -rm -f ./$(DEPDIR)/libcdata_btree.Plo + -rm -f ./$(DEPDIR)/libcdata_error.Plo + -rm -f ./$(DEPDIR)/libcdata_list.Plo + -rm -f ./$(DEPDIR)/libcdata_list_element.Plo + -rm -f ./$(DEPDIR)/libcdata_range_list.Plo + -rm -f ./$(DEPDIR)/libcdata_range_list_value.Plo + -rm -f ./$(DEPDIR)/libcdata_support.Plo + -rm -f ./$(DEPDIR)/libcdata_tree_node.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -765,16 +790,16 @@ .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am diff -Nru libsmdev-20171112/libcerror/libcerror_definitions.h libsmdev-20181227/libcerror/libcerror_definitions.h --- libsmdev-20171112/libcerror/libcerror_definitions.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcerror/libcerror_definitions.h 2018-12-27 19:19:02.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal definitions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -35,11 +35,11 @@ */ #else -#define LIBCERROR_VERSION 20171107 +#define LIBCERROR_VERSION 20181117 /* The libcerror version string */ -#define LIBCERROR_VERSION_STRING "20171107" +#define LIBCERROR_VERSION_STRING "20181117" /* The error domains */ diff -Nru libsmdev-20171112/libcerror/libcerror_error.c libsmdev-20181227/libcerror/libcerror_error.c --- libsmdev-20171112/libcerror/libcerror_error.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcerror/libcerror_error.c 2018-12-27 19:19:02.000000000 +0000 @@ -1,7 +1,7 @@ /* * Error functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -498,6 +498,12 @@ int message_index = 0; int print_count = 0; +#if defined( WINAPI ) + const char *format_string = "%" PRIs_SYSTEM "\r\n"; +#else + const char *format_string = "%" PRIs_SYSTEM "\n"; +#endif + if( error == NULL ) { return( -1 ); @@ -517,17 +523,11 @@ if( error_string != NULL ) { -#if defined( WINAPI ) print_count = fprintf( stream, - "%" PRIs_SYSTEM "\r\n", + format_string, error_string ); -#else - print_count = fprintf( - stream, - "%" PRIs_SYSTEM "\n", - error_string ); -#endif + if( print_count <= -1 ) { return( -1 ); @@ -564,6 +564,10 @@ { return( -1 ); } + if( internal_error->sizes == NULL ) + { + return( -1 ); + } if( string == NULL ) { return( -1 ); @@ -646,6 +650,12 @@ int print_count = 0; int total_print_count = 0; +#if defined( WINAPI ) + const char *format_string = "%" PRIs_SYSTEM "\r\n"; +#else + const char *format_string = "%" PRIs_SYSTEM "\n"; +#endif + if( error == NULL ) { return( -1 ); @@ -668,17 +678,11 @@ if( error_string != NULL ) { -#if defined( WINAPI ) print_count = fprintf( stream, - "%" PRIs_SYSTEM "\r\n", + format_string, error_string ); -#else - print_count = fprintf( - stream, - "%" PRIs_SYSTEM "\n", - error_string ); -#endif + if( print_count <= -1 ) { return( -1 ); diff -Nru libsmdev-20171112/libcerror/libcerror_error.h libsmdev-20181227/libcerror/libcerror_error.h --- libsmdev-20171112/libcerror/libcerror_error.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcerror/libcerror_error.h 2018-12-27 19:19:02.000000000 +0000 @@ -1,7 +1,7 @@ /* * Error functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcerror/libcerror_extern.h libsmdev-20181227/libcerror/libcerror_extern.h --- libsmdev-20171112/libcerror/libcerror_extern.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcerror/libcerror_extern.h 2018-12-27 19:19:02.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal extern definition * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -28,17 +28,13 @@ */ #if !defined( HAVE_LOCAL_LIBCERROR ) -/* If libtool DLL support is enabled set LIBCERROR_DLL_EXPORT - * before including libcerror/extern.h - */ -#if defined( _WIN32 ) && defined( DLL_EXPORT ) -#define LIBCERROR_DLL_EXPORT -#endif - #include +#define LIBCERROR_EXTERN_VARIABLE LIBCERROR_EXTERN + #else -#define LIBCERROR_EXTERN /* extern */ +#define LIBCERROR_EXTERN /* extern */ +#define LIBCERROR_EXTERN_VARIABLE extern #endif /* !defined( HAVE_LOCAL_LIBCERROR ) */ diff -Nru libsmdev-20171112/libcerror/libcerror_support.c libsmdev-20181227/libcerror/libcerror_support.c --- libsmdev-20171112/libcerror/libcerror_support.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcerror/libcerror_support.c 2018-12-27 19:19:02.000000000 +0000 @@ -1,7 +1,7 @@ /* * Support functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcerror/libcerror_support.h libsmdev-20181227/libcerror/libcerror_support.h --- libsmdev-20171112/libcerror/libcerror_support.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcerror/libcerror_support.h 2018-12-27 19:19:02.000000000 +0000 @@ -1,7 +1,7 @@ /* * Support functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcerror/libcerror_system.c libsmdev-20181227/libcerror/libcerror_system.c --- libsmdev-20171112/libcerror/libcerror_system.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcerror/libcerror_system.c 2018-12-27 19:19:02.000000000 +0000 @@ -1,7 +1,7 @@ /* * System functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -69,7 +69,7 @@ #if defined( WINAPI ) && ( WINVER <= 0x0500 ) /* Cross Windows safe version of FormatMessageA - * Returns TRUE if successful or FALSE on error + * Returns the number of printed characters without the end-of-string character or 0 on error */ DWORD libcerror_FormatMessageA( DWORD flags, @@ -82,18 +82,18 @@ { FARPROC function = NULL; HMODULE library_handle = NULL; - DWORD result = 0; + DWORD print_count = 0; if( string == NULL ) { - return( FALSE ); + return( 0 ); } library_handle = LoadLibrary( _SYSTEM_STRING( "kernel32.dll" ) ); if( library_handle == NULL ) { - return( FALSE ); + return( 0 ); } function = GetProcAddress( library_handle, @@ -101,14 +101,14 @@ if( function != NULL ) { - result = function( - flags, - source, - message_identifier, - language_identifier, - string, - string_size, - argument_list ); + print_count = function( + flags, + source, + message_identifier, + language_identifier, + string, + string_size, + argument_list ); } /* This call should be after using the function * in most cases kernel32.dll will still be available after free @@ -116,13 +116,13 @@ if( FreeLibrary( library_handle ) != TRUE ) { - result = FALSE; + print_count = 0; } - return( result ); + return( print_count ); } /* Cross Windows safe version of FormatMessageW - * Returns TRUE if successful or FALSE on error + * Returns the number of printed characters without the end-of-string character or 0 on error */ DWORD libcerror_FormatMessageW( DWORD flags, @@ -135,33 +135,33 @@ { FARPROC function = NULL; HMODULE library_handle = NULL; - DWORD result = 0; + DWORD print_count = 0; if( string == NULL ) { - return( FALSE ); + return( 0 ); } library_handle = LoadLibrary( _SYSTEM_STRING( "kernel32.dll" ) ); if( library_handle == NULL ) { - return( FALSE ); + return( 0 ); } function = GetProcAddress( library_handle, - (LPCSTR) "FormatMessageA" ); + (LPCSTR) "FormatMessageW" ); if( function != NULL ) { - result = function( - flags, - source, - message_identifier, - language_identifier, - string, - string_size, - argument_list ); + print_count = function( + flags, + source, + message_identifier, + language_identifier, + string, + string_size, + argument_list ); } /* This call should be after using the function * in most cases kernel32.dll will still be available after free @@ -169,9 +169,9 @@ if( FreeLibrary( library_handle ) != TRUE ) { - result = FALSE; + print_count = 0; } - return( result ); + return( print_count ); } #endif /* defined( WINAPI ) && ( WINVER <= 0x0500 ) */ @@ -202,21 +202,18 @@ size_t string_size, uint32_t error_number ) { - DWORD flags = 0; DWORD print_count = 0; if( string == NULL ) { return( -1 ); } - flags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS; - if( string_size > (size_t) INT_MAX ) { return( -1 ); } print_count = libcerror_system_FormatMessage( - flags, + FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, (DWORD) error_number, MAKELANGID( diff -Nru libsmdev-20171112/libcerror/libcerror_system.h libsmdev-20181227/libcerror/libcerror_system.h --- libsmdev-20171112/libcerror/libcerror_system.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcerror/libcerror_system.h 2018-12-27 19:19:02.000000000 +0000 @@ -1,7 +1,7 @@ /* * System functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcerror/libcerror_types.h libsmdev-20181227/libcerror/libcerror_types.h --- libsmdev-20171112/libcerror/libcerror_types.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcerror/libcerror_types.h 2018-12-27 19:19:02.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal type definitions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcerror/libcerror_unused.h libsmdev-20181227/libcerror/libcerror_unused.h --- libsmdev-20171112/libcerror/libcerror_unused.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcerror/libcerror_unused.h 2018-12-27 19:19:02.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal unused definition * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcerror/Makefile.am libsmdev-20181227/libcerror/Makefile.am --- libsmdev-20171112/libcerror/Makefile.am 2017-07-22 09:22:12.000000000 +0000 +++ libsmdev-20181227/libcerror/Makefile.am 2018-12-27 19:19:02.000000000 +0000 @@ -1,7 +1,7 @@ if HAVE_LOCAL_LIBCERROR AM_CPPFLAGS = \ -I$(top_srcdir)/include \ - -I$(top_srcdir)/common + -I$(top_srcdir)/common noinst_LTLIBRARIES = libcerror.la diff -Nru libsmdev-20171112/libcerror/Makefile.in libsmdev-20181227/libcerror/Makefile.in --- libsmdev-20171112/libcerror/Makefile.in 2017-11-12 14:33:40.000000000 +0000 +++ libsmdev-20181227/libcerror/Makefile.in 2018-12-27 19:19:39.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 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, @@ -142,7 +142,10 @@ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/libcerror_error.Plo \ + ./$(DEPDIR)/libcerror_support.Plo \ + ./$(DEPDIR)/libcerror_system.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -273,6 +276,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSMDEV_DLL_EXPORT = @LIBSMDEV_DLL_EXPORT@ LIBSMDEV_DLL_IMPORT = @LIBSMDEV_DLL_IMPORT@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -422,7 +426,6 @@ libcthreads_LIBS = @libcthreads_LIBS@ libdir = @libdir@ libexecdir = @libexecdir@ -libsmdev_spec_build_requires = @libsmdev_spec_build_requires@ libsmdev_spec_requires = @libsmdev_spec_requires@ libuna_CFLAGS = @libuna_CFLAGS@ libuna_LIBS = @libuna_LIBS@ @@ -451,7 +454,7 @@ top_srcdir = @top_srcdir@ @HAVE_LOCAL_LIBCERROR_TRUE@AM_CPPFLAGS = \ @HAVE_LOCAL_LIBCERROR_TRUE@ -I$(top_srcdir)/include \ -@HAVE_LOCAL_LIBCERROR_TRUE@ -I$(top_srcdir)/common +@HAVE_LOCAL_LIBCERROR_TRUE@ -I$(top_srcdir)/common @HAVE_LOCAL_LIBCERROR_TRUE@noinst_LTLIBRARIES = libcerror.la @HAVE_LOCAL_LIBCERROR_TRUE@libcerror_la_SOURCES = \ @@ -487,8 +490,8 @@ *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) @@ -520,9 +523,15 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcerror_error.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcerror_support.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcerror_system.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcerror_error.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcerror_support.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcerror_system.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -603,7 +612,10 @@ 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)'; \ @@ -717,7 +729,9 @@ installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/libcerror_error.Plo + -rm -f ./$(DEPDIR)/libcerror_support.Plo + -rm -f ./$(DEPDIR)/libcerror_system.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -738,16 +752,16 @@ .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am diff -Nru libsmdev-20171112/libcfile/libcfile_definitions.h libsmdev-20181227/libcfile/libcfile_definitions.h --- libsmdev-20171112/libcfile/libcfile_definitions.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcfile/libcfile_definitions.h 2018-12-27 19:19:05.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal definitions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -35,11 +35,11 @@ */ #else -#define LIBCFILE_VERSION 20171006 +#define LIBCFILE_VERSION 20180102 /* The libcfile version string */ -#define LIBCFILE_VERSION_STRING "20171006" +#define LIBCFILE_VERSION_STRING "20180102" /* The file access flags * bit 1 set to 1 for read access diff -Nru libsmdev-20171112/libcfile/libcfile_error.c libsmdev-20181227/libcfile/libcfile_error.c --- libsmdev-20171112/libcfile/libcfile_error.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcfile/libcfile_error.c 2018-12-27 19:19:05.000000000 +0000 @@ -1,7 +1,7 @@ /* * Error functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcfile/libcfile_error.h libsmdev-20181227/libcfile/libcfile_error.h --- libsmdev-20171112/libcfile/libcfile_error.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcfile/libcfile_error.h 2018-12-27 19:19:05.000000000 +0000 @@ -1,7 +1,7 @@ /* * Error functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcfile/libcfile_extern.h libsmdev-20181227/libcfile/libcfile_extern.h --- libsmdev-20171112/libcfile/libcfile_extern.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcfile/libcfile_extern.h 2018-12-27 19:19:05.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal extern definition * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcfile/libcfile_file.c libsmdev-20181227/libcfile/libcfile_file.c --- libsmdev-20171112/libcfile/libcfile_file.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcfile/libcfile_file.c 2018-12-27 19:19:05.000000000 +0000 @@ -1,7 +1,7 @@ /* * File functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcfile/libcfile_file.h libsmdev-20181227/libcfile/libcfile_file.h --- libsmdev-20171112/libcfile/libcfile_file.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcfile/libcfile_file.h 2018-12-27 19:19:05.000000000 +0000 @@ -1,7 +1,7 @@ /* * File functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcfile/libcfile_libcerror.h libsmdev-20181227/libcfile/libcfile_libcerror.h --- libsmdev-20171112/libcfile/libcfile_libcerror.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcfile/libcfile_libcerror.h 2018-12-27 19:19:05.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal libcerror header * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcfile/libcfile_libclocale.h libsmdev-20181227/libcfile/libcfile_libclocale.h --- libsmdev-20171112/libcfile/libcfile_libclocale.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcfile/libcfile_libclocale.h 2018-12-27 19:19:05.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal libclocale header * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcfile/libcfile_libcnotify.h libsmdev-20181227/libcfile/libcfile_libcnotify.h --- libsmdev-20171112/libcfile/libcfile_libcnotify.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcfile/libcfile_libcnotify.h 2018-12-27 19:19:05.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal libcnotify header * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcfile/libcfile_libuna.h libsmdev-20181227/libcfile/libcfile_libuna.h --- libsmdev-20171112/libcfile/libcfile_libuna.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcfile/libcfile_libuna.h 2018-12-27 19:19:05.000000000 +0000 @@ -1,7 +1,7 @@ /* * The libuna header wrapper * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcfile/libcfile_notify.c libsmdev-20181227/libcfile/libcfile_notify.c --- libsmdev-20171112/libcfile/libcfile_notify.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcfile/libcfile_notify.c 2018-12-27 19:19:05.000000000 +0000 @@ -1,7 +1,7 @@ /* * Notification functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcfile/libcfile_notify.h libsmdev-20181227/libcfile/libcfile_notify.h --- libsmdev-20171112/libcfile/libcfile_notify.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcfile/libcfile_notify.h 2018-12-27 19:19:05.000000000 +0000 @@ -1,7 +1,7 @@ /* * Notification functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcfile/libcfile_support.c libsmdev-20181227/libcfile/libcfile_support.c --- libsmdev-20171112/libcfile/libcfile_support.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcfile/libcfile_support.c 2018-12-27 19:19:05.000000000 +0000 @@ -1,7 +1,7 @@ /* * Support functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcfile/libcfile_support.h libsmdev-20181227/libcfile/libcfile_support.h --- libsmdev-20171112/libcfile/libcfile_support.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcfile/libcfile_support.h 2018-12-27 19:19:05.000000000 +0000 @@ -1,7 +1,7 @@ /* * Support functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcfile/libcfile_system_string.c libsmdev-20181227/libcfile/libcfile_system_string.c --- libsmdev-20171112/libcfile/libcfile_system_string.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcfile/libcfile_system_string.c 2018-12-27 19:19:05.000000000 +0000 @@ -1,7 +1,7 @@ /* * System string functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcfile/libcfile_system_string.h libsmdev-20181227/libcfile/libcfile_system_string.h --- libsmdev-20171112/libcfile/libcfile_system_string.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcfile/libcfile_system_string.h 2018-12-27 19:19:05.000000000 +0000 @@ -1,7 +1,7 @@ /* * System string functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcfile/libcfile_types.h libsmdev-20181227/libcfile/libcfile_types.h --- libsmdev-20171112/libcfile/libcfile_types.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcfile/libcfile_types.h 2018-12-27 19:19:05.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal type definitions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcfile/libcfile_unused.h libsmdev-20181227/libcfile/libcfile_unused.h --- libsmdev-20171112/libcfile/libcfile_unused.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcfile/libcfile_unused.h 2018-12-27 19:19:05.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal unused definition * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcfile/Makefile.in libsmdev-20181227/libcfile/Makefile.in --- libsmdev-20171112/libcfile/Makefile.in 2017-11-12 14:33:40.000000000 +0000 +++ libsmdev-20181227/libcfile/Makefile.in 2018-12-27 19:19:39.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 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, @@ -145,7 +145,11 @@ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/libcfile_error.Plo \ + ./$(DEPDIR)/libcfile_file.Plo ./$(DEPDIR)/libcfile_notify.Plo \ + ./$(DEPDIR)/libcfile_support.Plo \ + ./$(DEPDIR)/libcfile_system_string.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -276,6 +280,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSMDEV_DLL_EXPORT = @LIBSMDEV_DLL_EXPORT@ LIBSMDEV_DLL_IMPORT = @LIBSMDEV_DLL_IMPORT@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -425,7 +430,6 @@ libcthreads_LIBS = @libcthreads_LIBS@ libdir = @libdir@ libexecdir = @libexecdir@ -libsmdev_spec_build_requires = @libsmdev_spec_build_requires@ libsmdev_spec_requires = @libsmdev_spec_requires@ libuna_CFLAGS = @libuna_CFLAGS@ libuna_LIBS = @libuna_LIBS@ @@ -500,8 +504,8 @@ *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) @@ -533,11 +537,17 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfile_error.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfile_file.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfile_notify.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfile_support.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfile_system_string.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfile_error.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfile_file.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfile_notify.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfile_support.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfile_system_string.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -618,7 +628,10 @@ 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)'; \ @@ -732,7 +745,11 @@ installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/libcfile_error.Plo + -rm -f ./$(DEPDIR)/libcfile_file.Plo + -rm -f ./$(DEPDIR)/libcfile_notify.Plo + -rm -f ./$(DEPDIR)/libcfile_support.Plo + -rm -f ./$(DEPDIR)/libcfile_system_string.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -753,16 +770,16 @@ .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am diff -Nru libsmdev-20171112/libclocale/libclocale_codepage.c libsmdev-20181227/libclocale/libclocale_codepage.c --- libsmdev-20171112/libclocale/libclocale_codepage.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libclocale/libclocale_codepage.c 2018-12-27 19:19:08.000000000 +0000 @@ -1,7 +1,7 @@ /* * Codepage functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libclocale/libclocale_codepage.h libsmdev-20181227/libclocale/libclocale_codepage.h --- libsmdev-20171112/libclocale/libclocale_codepage.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libclocale/libclocale_codepage.h 2018-12-27 19:19:08.000000000 +0000 @@ -1,7 +1,7 @@ /* * Codepage functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libclocale/libclocale_definitions.h libsmdev-20181227/libclocale/libclocale_definitions.h --- libsmdev-20171112/libclocale/libclocale_definitions.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libclocale/libclocale_definitions.h 2018-12-27 19:19:08.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal definitions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -34,11 +34,11 @@ */ #else -#define LIBCLOCALE_VERSION 20171006 +#define LIBCLOCALE_VERSION 20180721 /* The libclocale version string */ -#define LIBCLOCALE_VERSION_STRING "20171006" +#define LIBCLOCALE_VERSION_STRING "20180721" /* The codepage feature flag definitions */ @@ -61,7 +61,7 @@ /* The codepage definitions */ -enum LIBCLOCALE_CODEPAGESS +enum LIBCLOCALE_CODEPAGES { LIBCLOCALE_CODEPAGE_ASCII = 20127, @@ -100,7 +100,7 @@ LIBCLOCALE_CODEPAGE_WINDOWS_1258 = 1258 }; -#endif +#endif /* !defined( HAVE_LOCAL_LIBCLOCALE ) */ -#endif +#endif /* !defined( _LIBCLOCALE_INTERNAL_DEFINITIONS_H ) */ diff -Nru libsmdev-20171112/libclocale/libclocale_extern.h libsmdev-20181227/libclocale/libclocale_extern.h --- libsmdev-20171112/libclocale/libclocale_extern.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libclocale/libclocale_extern.h 2018-12-27 19:19:08.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal extern definition * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -37,8 +37,11 @@ #include +#define LIBCLOCALE_EXTERN_VARIABLE LIBCLOCALE_EXTERN + #else -#define LIBCLOCALE_EXTERN /* extern */ +#define LIBCLOCALE_EXTERN /* extern */ +#define LIBCLOCALE_EXTERN_VARIABLE extern #endif /* !defined( HAVE_LOCAL_LIBCLOCALE ) */ diff -Nru libsmdev-20171112/libclocale/libclocale_libcerror.h libsmdev-20181227/libclocale/libclocale_libcerror.h --- libsmdev-20171112/libclocale/libclocale_libcerror.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libclocale/libclocale_libcerror.h 2018-12-27 19:19:08.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal libcerror header * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libclocale/libclocale_locale.c libsmdev-20181227/libclocale/libclocale_locale.c --- libsmdev-20171112/libclocale/libclocale_locale.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libclocale/libclocale_locale.c 2018-12-27 19:19:08.000000000 +0000 @@ -1,7 +1,7 @@ /* * Locale functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -86,22 +86,20 @@ return( result ); } -#endif +#endif /* defined( WINAPI ) && ( WINVER < 0x0500 ) */ -/* Retrieves the codepage for the locale character set +/* Retrieves the codepage from the locale character set * The codepage is set to 0 if the character set is UTF-8 * and will default to LIBCLOCALE_CODEPAGE_ASCII the codepage cannot be determined - * Returns 1 if success, 0 if no codepage could be found or -1 on error + * Returns 1 if successful or -1 on error */ -int libclocale_locale_get_codepage( +int libclocale_locale_get_codepage_from_charset( int *codepage, + char *charset, + size_t charset_length, libcerror_error_t **error ) { - char *locale = NULL; - char *charset = NULL; - static char *function = "libclocale_locale_get_codepage"; - size_t charset_length = 0; - size_t locale_length = 0; + static char *function = "libclocale_locale_get_codepage_from_charset"; if( codepage == NULL ) { @@ -114,87 +112,37 @@ return( -1 ); } -#if defined( HAVE_LANGINFO_CODESET ) - charset = nl_langinfo( - CODESET ); -#endif - if( ( charset != NULL ) - && ( charset[ 0 ] != 0 ) ) + if( charset == NULL ) { - charset_length = narrow_string_length( - charset ); + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid charset.", + function ); + + return( -1 ); } - else + if( charset_length > (size_t) SSIZE_MAX ) { -#if defined( HAVE_SETLOCALE ) || ( defined( __BORLANDC__ ) && __BORLANDC__ <= 0x0520 ) - locale = setlocale( - LC_CTYPE, - "" ); - - /* Check if the locale returned is not "C" - */ - if( ( locale != NULL ) - && ( locale[ 0 ] != 0 ) ) - { - if( ( locale[ 0 ] == 'C' ) - && ( locale[ 1 ] != 0 ) ) - { - locale = NULL; - } - } -#endif -#if defined( HAVE_GETENV ) || defined( WINAPI ) - /* Check if the locale can be determined from the environment variables - */ - if( ( locale == NULL ) - || ( locale[ 0 ] == 0 ) ) - { - locale = getenv( - "LC_ALL" ); - } - if( ( locale == NULL ) - || ( locale[ 0 ] == 0 ) ) - { - locale = getenv( - "LC_TYPE" ); - } - if( ( locale == NULL ) - || ( locale[ 0 ] == 0 ) ) - { - locale = getenv( - "LANG" ); - } -#endif - if( ( locale == NULL ) - || ( locale[ 0 ] == 0 ) ) - { - return( LIBCLOCALE_CODEPAGE_ASCII ); - } - locale_length = narrow_string_length( - locale ); - - charset = narrow_string_search_character( - locale, - '.', - locale_length + 1 ); - - if( charset == NULL ) - { - return( LIBCLOCALE_CODEPAGE_ASCII ); - } - charset++; + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM, + "%s: invalid charset length value exceeds maximum.", + function ); - charset_length = locale_length - (size_t) ( charset - locale ); + return( -1 ); } /* Determine codepage */ - *codepage = LIBCLOCALE_CODEPAGE_ASCII; + *codepage = -1; - if( *codepage == LIBCLOCALE_CODEPAGE_ASCII ) + if( *codepage == -1 ) { if( charset_length == 5 ) { - if( narrow_string_compare( + if( narrow_string_compare_no_case( "UTF-8", charset, 5 ) == 0 ) @@ -203,7 +151,7 @@ } } } - if( *codepage == LIBCLOCALE_CODEPAGE_ASCII ) + if( *codepage == -1 ) { if( charset_length >= 3 ) { @@ -244,7 +192,7 @@ } } } - if( *codepage == LIBCLOCALE_CODEPAGE_ASCII ) + if( *codepage == -1 ) { if( charset_length >= 4 ) { @@ -311,7 +259,7 @@ { *codepage = LIBCLOCALE_CODEPAGE_WINDOWS_1258; } - else if( narrow_string_compare( + else if( narrow_string_compare_no_case( "utf8", charset, 4 ) == 0 ) @@ -320,6 +268,130 @@ } } } + if( *codepage == -1 ) + { + *codepage = LIBCLOCALE_CODEPAGE_ASCII; + } + return( 1 ); +} + +/* Retrieves the codepage for the locale character set + * The codepage is set to 0 if the character set is UTF-8 + * and will default to LIBCLOCALE_CODEPAGE_ASCII the codepage cannot be determined + * Returns 1 if successful or -1 on error + */ +int libclocale_locale_get_codepage( + int *codepage, + libcerror_error_t **error ) +{ + char *locale = NULL; + char *charset = NULL; + static char *function = "libclocale_locale_get_codepage"; + size_t charset_length = 0; + size_t locale_length = 0; + + if( codepage == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid codepage.", + function ); + + return( -1 ); + } +#if defined( HAVE_LANGINFO_CODESET ) + charset = nl_langinfo( + CODESET ); +#endif + if( ( charset != NULL ) + && ( charset[ 0 ] != 0 ) ) + { + charset_length = narrow_string_length( + charset ); + } + else + { +#if defined( HAVE_SETLOCALE ) || ( defined( __BORLANDC__ ) && __BORLANDC__ <= 0x0520 ) + locale = setlocale( + LC_CTYPE, + "" ); + + /* Check if the locale returned is not "C" + */ + if( ( locale != NULL ) + && ( locale[ 0 ] != 0 ) ) + { + if( ( locale[ 0 ] == 'C' ) + && ( locale[ 1 ] != 0 ) ) + { + locale = NULL; + } + } +#endif +#if defined( HAVE_GETENV ) || defined( WINAPI ) + /* Check if the locale can be determined from the environment variables + */ + if( ( locale == NULL ) + || ( locale[ 0 ] == 0 ) ) + { + locale = getenv( + "LC_ALL" ); + } + if( ( locale == NULL ) + || ( locale[ 0 ] == 0 ) ) + { + locale = getenv( + "LC_TYPE" ); + } + if( ( locale == NULL ) + || ( locale[ 0 ] == 0 ) ) + { + locale = getenv( + "LANG" ); + } +#endif + if( ( locale == NULL ) + || ( locale[ 0 ] == 0 ) ) + { + *codepage = LIBCLOCALE_CODEPAGE_ASCII; + + return( 1 ); + } + locale_length = narrow_string_length( + locale ); + + charset = narrow_string_search_character( + locale, + '.', + locale_length + 1 ); + + if( charset == NULL ) + { + *codepage = LIBCLOCALE_CODEPAGE_ASCII; + + return( 1 ); + } + charset++; + + charset_length = locale_length - (size_t) ( charset - locale ); + } + if( libclocale_locale_get_codepage_from_charset( + codepage, + charset, + charset_length, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_GET_FAILED, + "%s: unable to retrieve codepage.", + function ); + + return( -1 ); + } return( 1 ); } @@ -335,6 +407,7 @@ #if defined( WINAPI ) DWORD error_code = 0; DWORD locale_data = 0; + int read_count = 0; #else struct lconv *locale_data = NULL; #endif @@ -354,51 +427,26 @@ #if defined( WINAPI ) #if ( WINVER >= 0x0600 ) - if( GetLocaleInfoEx( - LOCALE_NAME_USER_DEFAULT, - LOCALE_SDECIMAL, - (LPWSTR) &locale_data, - sizeof( DWORD ) / sizeof( wchar_t ) ) == 0 ) - { - error_code = GetLastError(); - - libcerror_system_set_error( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_GET_FAILED, - error_code, - "%s: unable to retrieve locale information.", - function ); - - return( -1 ); - } + read_count = GetLocaleInfoEx( + LOCALE_NAME_USER_DEFAULT, + LOCALE_SDECIMAL, + (LPWSTR) &locale_data, + sizeof( DWORD ) / sizeof( wchar_t ) ); #elif ( WINVER >= 0x0500 ) - if( GetLocaleInfoA( - LOCALE_USER_DEFAULT, - LOCALE_SDECIMAL, - (LPSTR) &locale_data, - sizeof( DWORD ) / sizeof( char ) ) == 0 ) - { - error_code = GetLastError(); - - libcerror_system_set_error( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_GET_FAILED, - error_code, - "%s: unable to retrieve locale information.", - function ); - - return( -1 ); - } - + read_count = GetLocaleInfoA( + LOCALE_USER_DEFAULT, + LOCALE_SDECIMAL, + (LPSTR) &locale_data, + sizeof( DWORD ) / sizeof( char ) ); #else - if( libclocale_GetLocaleInfoA( - LOCALE_USER_DEFAULT, - LOCALE_SDECIMAL, - (LPSTR) &locale_data, - sizeof( DWORD ) / sizeof( char ) ) == 0 ) + read_count = libclocale_GetLocaleInfoA( + LOCALE_USER_DEFAULT, + LOCALE_SDECIMAL, + (LPSTR) &locale_data, + sizeof( DWORD ) / sizeof( char ) ); +#endif + if( read_count == 0 ) { error_code = GetLastError(); @@ -412,8 +460,6 @@ return( -1 ); } - -#endif *decimal_point = (int) locale_data; #else diff -Nru libsmdev-20171112/libclocale/libclocale_locale.h libsmdev-20181227/libclocale/libclocale_locale.h --- libsmdev-20171112/libclocale/libclocale_locale.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libclocale/libclocale_locale.h 2018-12-27 19:19:08.000000000 +0000 @@ -1,7 +1,7 @@ /* * Locale functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -42,6 +42,12 @@ #endif /* defined( WINAPI ) && ( WINVER < 0x0500 ) */ +int libclocale_locale_get_codepage_from_charset( + int *codepage, + char *charset, + size_t charset_length, + libcerror_error_t **error ); + LIBCLOCALE_EXTERN \ int libclocale_locale_get_codepage( int *codepage, diff -Nru libsmdev-20171112/libclocale/libclocale_support.c libsmdev-20181227/libclocale/libclocale_support.c --- libsmdev-20171112/libclocale/libclocale_support.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libclocale/libclocale_support.c 2018-12-27 19:19:08.000000000 +0000 @@ -1,7 +1,7 @@ /* * Support functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libclocale/libclocale_support.h libsmdev-20181227/libclocale/libclocale_support.h --- libsmdev-20171112/libclocale/libclocale_support.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libclocale/libclocale_support.h 2018-12-27 19:19:08.000000000 +0000 @@ -1,7 +1,7 @@ /* * Support functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libclocale/libclocale_unused.h libsmdev-20181227/libclocale/libclocale_unused.h --- libsmdev-20171112/libclocale/libclocale_unused.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libclocale/libclocale_unused.h 2018-12-27 19:19:08.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal unused definition * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libclocale/libclocale_wide_string.c libsmdev-20181227/libclocale/libclocale_wide_string.c --- libsmdev-20171112/libclocale/libclocale_wide_string.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libclocale/libclocale_wide_string.c 2018-12-27 19:19:08.000000000 +0000 @@ -1,7 +1,7 @@ /* * Wide character string functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libclocale/libclocale_wide_string.h libsmdev-20181227/libclocale/libclocale_wide_string.h --- libsmdev-20171112/libclocale/libclocale_wide_string.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libclocale/libclocale_wide_string.h 2018-12-27 19:19:08.000000000 +0000 @@ -1,7 +1,7 @@ /* * Wide character string functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libclocale/Makefile.in libsmdev-20181227/libclocale/Makefile.in --- libsmdev-20171112/libclocale/Makefile.in 2017-11-12 14:33:40.000000000 +0000 +++ libsmdev-20181227/libclocale/Makefile.in 2018-12-27 19:19:39.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 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, @@ -145,7 +145,11 @@ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/libclocale_codepage.Plo \ + ./$(DEPDIR)/libclocale_locale.Plo \ + ./$(DEPDIR)/libclocale_support.Plo \ + ./$(DEPDIR)/libclocale_wide_string.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -276,6 +280,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSMDEV_DLL_EXPORT = @LIBSMDEV_DLL_EXPORT@ LIBSMDEV_DLL_IMPORT = @LIBSMDEV_DLL_IMPORT@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -425,7 +430,6 @@ libcthreads_LIBS = @libcthreads_LIBS@ libdir = @libdir@ libexecdir = @libexecdir@ -libsmdev_spec_build_requires = @libsmdev_spec_build_requires@ libsmdev_spec_requires = @libsmdev_spec_requires@ libuna_CFLAGS = @libuna_CFLAGS@ libuna_LIBS = @libuna_LIBS@ @@ -493,8 +497,8 @@ *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) @@ -526,10 +530,16 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclocale_codepage.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclocale_locale.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclocale_support.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclocale_wide_string.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclocale_codepage.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclocale_locale.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclocale_support.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclocale_wide_string.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -610,7 +620,10 @@ 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)'; \ @@ -724,7 +737,10 @@ installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/libclocale_codepage.Plo + -rm -f ./$(DEPDIR)/libclocale_locale.Plo + -rm -f ./$(DEPDIR)/libclocale_support.Plo + -rm -f ./$(DEPDIR)/libclocale_wide_string.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -745,16 +761,16 @@ .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am diff -Nru libsmdev-20171112/libcnotify/libcnotify_definitions.h libsmdev-20181227/libcnotify/libcnotify_definitions.h --- libsmdev-20171112/libcnotify/libcnotify_definitions.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcnotify/libcnotify_definitions.h 2018-12-27 19:19:10.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal definitions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -35,11 +35,11 @@ */ #else -#define LIBCNOTIFY_VERSION 20171006 +#define LIBCNOTIFY_VERSION 20180102 /* The libcnotify version string */ -#define LIBCNOTIFY_VERSION_STRING "20171006" +#define LIBCNOTIFY_VERSION_STRING "20180102" /* The print data flags */ diff -Nru libsmdev-20171112/libcnotify/libcnotify_extern.h libsmdev-20181227/libcnotify/libcnotify_extern.h --- libsmdev-20171112/libcnotify/libcnotify_extern.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcnotify/libcnotify_extern.h 2018-12-27 19:19:10.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal extern definition * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcnotify/libcnotify_libcerror.h libsmdev-20181227/libcnotify/libcnotify_libcerror.h --- libsmdev-20171112/libcnotify/libcnotify_libcerror.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcnotify/libcnotify_libcerror.h 2018-12-27 19:19:10.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal libcerror header * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcnotify/libcnotify_print.c libsmdev-20181227/libcnotify/libcnotify_print.c --- libsmdev-20171112/libcnotify/libcnotify_print.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcnotify/libcnotify_print.c 2018-12-27 19:19:10.000000000 +0000 @@ -1,7 +1,7 @@ /* * Notification print functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcnotify/libcnotify_print.h libsmdev-20181227/libcnotify/libcnotify_print.h --- libsmdev-20171112/libcnotify/libcnotify_print.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcnotify/libcnotify_print.h 2018-12-27 19:19:10.000000000 +0000 @@ -1,7 +1,7 @@ /* * Notification print functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcnotify/libcnotify_stream.c libsmdev-20181227/libcnotify/libcnotify_stream.c --- libsmdev-20171112/libcnotify/libcnotify_stream.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcnotify/libcnotify_stream.c 2018-12-27 19:19:10.000000000 +0000 @@ -1,7 +1,7 @@ /* * Notification stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcnotify/libcnotify_stream.h libsmdev-20181227/libcnotify/libcnotify_stream.h --- libsmdev-20171112/libcnotify/libcnotify_stream.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcnotify/libcnotify_stream.h 2018-12-27 19:19:10.000000000 +0000 @@ -1,7 +1,7 @@ /* * Notification stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcnotify/libcnotify_support.c libsmdev-20181227/libcnotify/libcnotify_support.c --- libsmdev-20171112/libcnotify/libcnotify_support.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcnotify/libcnotify_support.c 2018-12-27 19:19:10.000000000 +0000 @@ -1,7 +1,7 @@ /* * Support functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcnotify/libcnotify_support.h libsmdev-20181227/libcnotify/libcnotify_support.h --- libsmdev-20171112/libcnotify/libcnotify_support.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcnotify/libcnotify_support.h 2018-12-27 19:19:10.000000000 +0000 @@ -1,7 +1,7 @@ /* * Support functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcnotify/libcnotify_unused.h libsmdev-20181227/libcnotify/libcnotify_unused.h --- libsmdev-20171112/libcnotify/libcnotify_unused.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcnotify/libcnotify_unused.h 2018-12-27 19:19:10.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal unused definition * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcnotify/libcnotify_verbose.c libsmdev-20181227/libcnotify/libcnotify_verbose.c --- libsmdev-20171112/libcnotify/libcnotify_verbose.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcnotify/libcnotify_verbose.c 2018-12-27 19:19:10.000000000 +0000 @@ -1,7 +1,7 @@ /* * Verbose functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcnotify/libcnotify_verbose.h libsmdev-20181227/libcnotify/libcnotify_verbose.h --- libsmdev-20171112/libcnotify/libcnotify_verbose.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcnotify/libcnotify_verbose.h 2018-12-27 19:19:10.000000000 +0000 @@ -1,7 +1,7 @@ /* * Verbose functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcnotify/Makefile.in libsmdev-20181227/libcnotify/Makefile.in --- libsmdev-20171112/libcnotify/Makefile.in 2017-11-12 14:33:40.000000000 +0000 +++ libsmdev-20181227/libcnotify/Makefile.in 2018-12-27 19:19:39.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 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, @@ -144,7 +144,11 @@ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/libcnotify_print.Plo \ + ./$(DEPDIR)/libcnotify_stream.Plo \ + ./$(DEPDIR)/libcnotify_support.Plo \ + ./$(DEPDIR)/libcnotify_verbose.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -275,6 +279,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSMDEV_DLL_EXPORT = @LIBSMDEV_DLL_EXPORT@ LIBSMDEV_DLL_IMPORT = @LIBSMDEV_DLL_IMPORT@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -424,7 +429,6 @@ libcthreads_LIBS = @libcthreads_LIBS@ libdir = @libdir@ libexecdir = @libexecdir@ -libsmdev_spec_build_requires = @libsmdev_spec_build_requires@ libsmdev_spec_requires = @libsmdev_spec_requires@ libuna_CFLAGS = @libuna_CFLAGS@ libuna_LIBS = @libuna_LIBS@ @@ -491,8 +495,8 @@ *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) @@ -524,10 +528,16 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcnotify_print.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcnotify_stream.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcnotify_support.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcnotify_verbose.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcnotify_print.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcnotify_stream.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcnotify_support.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcnotify_verbose.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -608,7 +618,10 @@ 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)'; \ @@ -722,7 +735,10 @@ installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/libcnotify_print.Plo + -rm -f ./$(DEPDIR)/libcnotify_stream.Plo + -rm -f ./$(DEPDIR)/libcnotify_support.Plo + -rm -f ./$(DEPDIR)/libcnotify_verbose.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -743,16 +759,16 @@ .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am diff -Nru libsmdev-20171112/libcthreads/libcthreads_condition.c libsmdev-20181227/libcthreads/libcthreads_condition.c --- libsmdev-20171112/libcthreads/libcthreads_condition.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_condition.c 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Condition functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -165,17 +165,31 @@ &( internal_condition->condition ), NULL ); - if( pthread_result != 0 ) + switch( pthread_result ) { - libcerror_system_set_error( - error, - pthread_result, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, - "%s: unable to initialize condition.", - function ); + case 0: + break; - goto on_error; + case EAGAIN: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to initialize condition with error: Insufficient resources.", + function ); + + goto on_error; + + default: + libcerror_system_set_error( + error, + pthread_result, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to initialize condition.", + function ); + + goto on_error; } #endif *condition = (libcthreads_condition_t *) internal_condition; @@ -274,32 +288,44 @@ pthread_result = pthread_cond_destroy( &( internal_condition->condition ) ); - if( pthread_result != 0 ) + switch( pthread_result ) { - switch( pthread_result ) - { - case EBUSY: - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, - "%s: unable to destroy condition with error: Resource busy.", - function ); - - break; - - default: - libcerror_system_set_error( - error, - pthread_result, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, - "%s: unable to destroy condition.", - function ); + case 0: + break; - break; - } - result = -1; + case EAGAIN: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to destroy condition with error: Insufficient resources.", + function ); + + result = -1; + break; + + case EBUSY: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to destroy condition with error: Resource busy.", + function ); + + result = -1; + break; + + default: + libcerror_system_set_error( + error, + pthread_result, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to destroy condition.", + function ); + + result = -1; + break; } #endif memory_free( diff -Nru libsmdev-20171112/libcthreads/libcthreads_condition.h libsmdev-20181227/libcthreads/libcthreads_condition.h --- libsmdev-20171112/libcthreads/libcthreads_condition.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_condition.h 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Condition functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcthreads/libcthreads_definitions.h libsmdev-20181227/libcthreads/libcthreads_definitions.h --- libsmdev-20171112/libcthreads/libcthreads_definitions.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_definitions.h 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal definitions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -35,11 +35,11 @@ */ #else -#define LIBCTHREADS_VERSION 20171111 +#define LIBCTHREADS_VERSION 20180724 /* The libcthreads version string */ -#define LIBCTHREADS_VERSION_STRING "20171111" +#define LIBCTHREADS_VERSION_STRING "20180724" /* The comparison function definitions */ diff -Nru libsmdev-20171112/libcthreads/libcthreads_error.c libsmdev-20181227/libcthreads/libcthreads_error.c --- libsmdev-20171112/libcthreads/libcthreads_error.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_error.c 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Error functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcthreads/libcthreads_error.h libsmdev-20181227/libcthreads/libcthreads_error.h --- libsmdev-20171112/libcthreads/libcthreads_error.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_error.h 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Error functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcthreads/libcthreads_extern.h libsmdev-20181227/libcthreads/libcthreads_extern.h --- libsmdev-20171112/libcthreads/libcthreads_extern.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_extern.h 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal extern definition * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -37,8 +37,11 @@ #include +#define LIBCTHREADS_EXTERN_VARIABLE LIBCTHREADS_EXTERN + #else -#define LIBCTHREADS_EXTERN /* extern */ +#define LIBCTHREADS_EXTERN /* extern */ +#define LIBCTHREADS_EXTERN_VARIABLE extern #endif /* !defined( HAVE_LOCAL_LIBCTHREADS ) */ diff -Nru libsmdev-20171112/libcthreads/libcthreads_libcerror.h libsmdev-20181227/libcthreads/libcthreads_libcerror.h --- libsmdev-20171112/libcthreads/libcthreads_libcerror.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_libcerror.h 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* - * The internal libcerror header + * The libcerror header wrapper * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcthreads/libcthreads_lock.c libsmdev-20181227/libcthreads/libcthreads_lock.c --- libsmdev-20171112/libcthreads/libcthreads_lock.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_lock.c 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Lock functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -112,17 +112,31 @@ &( internal_lock->mutex ), NULL ); - if( pthread_result != 0 ) + switch( pthread_result ) { - libcerror_system_set_error( - error, - pthread_result, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, - "%s: unable to initialize mutex.", - function ); + case 0: + break; - goto on_error; + case EAGAIN: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to initialize mutex with error: Insufficient resources.", + function ); + + goto on_error; + + default: + libcerror_system_set_error( + error, + pthread_result, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to initialize mutex.", + function ); + + goto on_error; } #endif *lock = (libcthreads_lock_t *) internal_lock; @@ -177,32 +191,44 @@ pthread_result = pthread_mutex_destroy( &( internal_lock->mutex ) ); - if( pthread_result != 0 ) + switch( pthread_result ) { - switch( pthread_result ) - { - case EBUSY: - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, - "%s: unable to destroy mutex with error: Resource busy.", - function ); - - break; - - default: - libcerror_system_set_error( - error, - pthread_result, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, - "%s: unable to destroy mutex.", - function ); - - break; - } - result = -1; + case 0: + break; + + case EAGAIN: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to destroy mutex with error: Insufficient resources.", + function ); + + result = -1; + break; + + case EBUSY: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to destroy mutex with error: Resource busy.", + function ); + + result = -1; + break; + + default: + libcerror_system_set_error( + error, + pthread_result, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to destroy mutex.", + function ); + + result = -1; + break; } #endif memory_free( @@ -246,17 +272,41 @@ pthread_result = pthread_mutex_lock( &( internal_lock->mutex ) ); - if( pthread_result != 0 ) + switch( pthread_result ) { - libcerror_system_set_error( - error, - pthread_result, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_SET_FAILED, - "%s: unable to lock mutex.", - function ); + case 0: + break; - return( -1 ); + case EAGAIN: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to lock mutex with error: Maximum number of locks exceeded.", + function ); + + return( -1 ); + + case EDEADLK: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to lock mutex with error: Deadlock condition detected.", + function ); + + return( -1 ); + + default: + libcerror_system_set_error( + error, + pthread_result, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to lock mutex.", + function ); + + return( -1 ); } #endif return( 1 ); @@ -297,17 +347,41 @@ pthread_result = pthread_mutex_unlock( &( internal_lock->mutex ) ); - if( pthread_result != 0 ) + switch( pthread_result ) { - libcerror_system_set_error( - error, - pthread_result, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_SET_FAILED, - "%s: unable to unlock mutex.", - function ); + case 0: + break; - return( -1 ); + case EAGAIN: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to lock mutex with error: Maximum number of locks exceeded.", + function ); + + return( -1 ); + + case EDEADLK: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to unlock mutex with error: Deadlock condition detected.", + function ); + + return( -1 ); + + default: + libcerror_system_set_error( + error, + pthread_result, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to unlock mutex.", + function ); + + return( -1 ); } #endif return( 1 ); diff -Nru libsmdev-20171112/libcthreads/libcthreads_lock.h libsmdev-20181227/libcthreads/libcthreads_lock.h --- libsmdev-20171112/libcthreads/libcthreads_lock.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_lock.h 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Lock functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcthreads/libcthreads_mutex.c libsmdev-20181227/libcthreads/libcthreads_mutex.c --- libsmdev-20171112/libcthreads/libcthreads_mutex.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_mutex.c 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Mutex functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcthreads/libcthreads_mutex.h libsmdev-20181227/libcthreads/libcthreads_mutex.h --- libsmdev-20171112/libcthreads/libcthreads_mutex.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_mutex.h 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Mutex functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcthreads/libcthreads_queue.c libsmdev-20181227/libcthreads/libcthreads_queue.c --- libsmdev-20171112/libcthreads/libcthreads_queue.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_queue.c 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Queue functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcthreads/libcthreads_queue.h libsmdev-20181227/libcthreads/libcthreads_queue.h --- libsmdev-20171112/libcthreads/libcthreads_queue.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_queue.h 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Queue functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcthreads/libcthreads_read_write_lock.c libsmdev-20181227/libcthreads/libcthreads_read_write_lock.c --- libsmdev-20171112/libcthreads/libcthreads_read_write_lock.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_read_write_lock.c 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Read/Write lock functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -150,17 +150,31 @@ &( internal_read_write_lock->read_write_lock ), NULL ); - if( pthread_result != 0 ) + switch( pthread_result ) { - libcerror_system_set_error( - error, - pthread_result, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, - "%s: unable to initialize read/write lock.", - function ); + case 0: + break; - goto on_error; + case EAGAIN: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to initialize read/write lock with error: Insufficient resources.", + function ); + + goto on_error; + + default: + libcerror_system_set_error( + error, + pthread_result, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to initialize read/write lock.", + function ); + + goto on_error; } #endif *read_write_lock = (libcthreads_read_write_lock_t *) internal_read_write_lock; @@ -247,32 +261,44 @@ pthread_result = pthread_rwlock_destroy( &( internal_read_write_lock->read_write_lock ) ); - if( pthread_result != 0 ) + switch( pthread_result ) { - switch( pthread_result ) - { - case EBUSY: - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, - "%s: unable to destroy read/write lock with error: Resource busy.", - function ); - - break; - - default: - libcerror_system_set_error( - error, - pthread_result, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, - "%s: unable to destroy read/write lock.", - function ); + case 0: + break; - break; - } - result = -1; + case EAGAIN: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to destroy read/write lock with error: Insufficient resources.", + function ); + + result = -1; + break; + + case EBUSY: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to destroy read/write lock with error: Resource busy.", + function ); + + result = -1; + break; + + default: + libcerror_system_set_error( + error, + pthread_result, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to destroy read/write lock.", + function ); + + result = -1; + break; } #endif memory_free( @@ -367,17 +393,41 @@ pthread_result = pthread_rwlock_rdlock( &( internal_read_write_lock->read_write_lock ) ); - if( pthread_result != 0 ) + switch( pthread_result ) { - libcerror_system_set_error( - error, - pthread_result, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_SET_FAILED, - "%s: unable to lock read/write lock for read.", - function ); + case 0: + break; - return( -1 ); + case EAGAIN: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to lock read/write lock for read with error: Maximum number of locks exceeded.", + function ); + + return( -1 ); + + case EDEADLK: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to lock read/write lock for read with error: Deadlock condition detected.", + function ); + + return( -1 ); + + default: + libcerror_system_set_error( + error, + pthread_result, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to lock read/write lock for read.", + function ); + + return( -1 ); } #endif return( 1 ); @@ -451,17 +501,31 @@ pthread_result = pthread_rwlock_wrlock( &( internal_read_write_lock->read_write_lock ) ); - if( pthread_result != 0 ) + switch( pthread_result ) { - libcerror_system_set_error( - error, - pthread_result, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_SET_FAILED, - "%s: unable to lock read/write lock for write.", - function ); + case 0: + break; - return( -1 ); + case EDEADLK: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to lock read/write lock for write with error: Deadlock condition detected.", + function ); + + return( -1 ); + + default: + libcerror_system_set_error( + error, + pthread_result, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to lock read/write lock for write.", + function ); + + return( -1 ); } #endif return( 1 ); diff -Nru libsmdev-20171112/libcthreads/libcthreads_read_write_lock.h libsmdev-20181227/libcthreads/libcthreads_read_write_lock.h --- libsmdev-20171112/libcthreads/libcthreads_read_write_lock.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_read_write_lock.h 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Read/Write lock functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcthreads/libcthreads_repeating_thread.c libsmdev-20181227/libcthreads/libcthreads_repeating_thread.c --- libsmdev-20171112/libcthreads/libcthreads_repeating_thread.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_repeating_thread.c 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Repeating thread functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -23,6 +23,8 @@ #include #include +#include + #if defined( WINAPI ) && ( WINVER >= 0x0602 ) #include #include @@ -322,17 +324,31 @@ &libcthreads_repeating_thread_start_function_helper, (void *) internal_repeating_thread ); - if( pthread_result != 0 ) + switch( pthread_result ) { - libcerror_system_set_error( - error, - pthread_result, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, - "%s: unable to create thread.", - function ); + case 0: + break; - goto on_error; + case EAGAIN: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to create thread with error: Insufficient resources.", + function ); + + goto on_error; + + default: + libcerror_system_set_error( + error, + pthread_result, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to create thread.", + function ); + + goto on_error; } #endif *repeating_thread = (libcthreads_repeating_thread_t *) internal_repeating_thread; @@ -544,7 +560,18 @@ internal_repeating_thread->thread, (void **) &thread_return_value ); - if( pthread_result != 0 ) + if( pthread_result == EDEADLK ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to join thread with error: Deadlock condition detected.", + function ); + + result = -1; + } + else if( pthread_result != 0 ) { libcerror_system_set_error( error, diff -Nru libsmdev-20171112/libcthreads/libcthreads_repeating_thread.h libsmdev-20181227/libcthreads/libcthreads_repeating_thread.h --- libsmdev-20171112/libcthreads/libcthreads_repeating_thread.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_repeating_thread.h 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Repeating thread functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcthreads/libcthreads_support.c libsmdev-20181227/libcthreads/libcthreads_support.c --- libsmdev-20171112/libcthreads/libcthreads_support.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_support.c 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Support functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcthreads/libcthreads_support.h libsmdev-20181227/libcthreads/libcthreads_support.h --- libsmdev-20171112/libcthreads/libcthreads_support.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_support.h 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Support functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcthreads/libcthreads_thread_attributes.c libsmdev-20181227/libcthreads/libcthreads_thread_attributes.c --- libsmdev-20171112/libcthreads/libcthreads_thread_attributes.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_thread_attributes.c 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Thread attributes functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcthreads/libcthreads_thread_attributes.h libsmdev-20181227/libcthreads/libcthreads_thread_attributes.h --- libsmdev-20171112/libcthreads/libcthreads_thread_attributes.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_thread_attributes.h 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Thread attributes functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcthreads/libcthreads_thread.c libsmdev-20181227/libcthreads/libcthreads_thread.c --- libsmdev-20171112/libcthreads/libcthreads_thread.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_thread.c 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Thread functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -23,6 +23,8 @@ #include #include +#include + #if defined( WINAPI ) && ( WINVER >= 0x0602 ) #include #include @@ -236,17 +238,31 @@ &libcthreads_thread_callback_function_helper, (void *) internal_thread ); - if( pthread_result != 0 ) + switch( pthread_result ) { - libcerror_system_set_error( - error, - pthread_result, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, - "%s: unable to create thread.", - function ); + case 0: + break; - goto on_error; + case EAGAIN: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to create thread with error: Insufficient resources.", + function ); + + goto on_error; + + default: + libcerror_system_set_error( + error, + pthread_result, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to create thread.", + function ); + + goto on_error; } #endif *thread = (libcthreads_thread_t *) internal_thread; @@ -333,7 +349,18 @@ internal_thread->thread, (void **) &thread_return_value ); - if( pthread_result != 0 ) + if( pthread_result == EDEADLK ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to join thread with error: Deadlock condition detected.", + function ); + + result = -1; + } + else if( pthread_result != 0 ) { libcerror_system_set_error( error, diff -Nru libsmdev-20171112/libcthreads/libcthreads_thread.h libsmdev-20181227/libcthreads/libcthreads_thread.h --- libsmdev-20171112/libcthreads/libcthreads_thread.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_thread.h 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Thread functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcthreads/libcthreads_thread_pool.c libsmdev-20181227/libcthreads/libcthreads_thread_pool.c --- libsmdev-20171112/libcthreads/libcthreads_thread_pool.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_thread_pool.c 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Thread pool functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -23,6 +23,8 @@ #include #include +#include + #if defined( WINAPI ) && ( WINVER >= 0x0602 ) #include #endif @@ -772,18 +774,33 @@ &libcthreads_thread_pool_callback_function_helper, (void *) internal_thread_pool ); - if( pthread_result != 0 ) + switch( pthread_result ) { - libcerror_system_set_error( - error, - pthread_result, - LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, - "%s: unable to create thread: %d.", - function, - thread_index ); + case 0: + break; - goto on_error; + case EAGAIN: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to create thread: %d with error: Insufficient resources.", + function, + thread_index ); + + goto on_error; + + default: + libcerror_system_set_error( + error, + pthread_result, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to create thread: %d.", + function, + thread_index ); + + goto on_error; } } #endif /* defined( WINAPI ) && ( WINVER >= 0x0602 ) */ @@ -1591,7 +1608,19 @@ internal_thread_pool->threads_array[ thread_index ], (void **) &thread_return_value ); - if( pthread_result != 0 ) + if( pthread_result == EDEADLK ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, + "%s: unable to join thread: %d with error: Deadlock condition detected.", + function, + thread_index ); + + result = -1; + } + else if( pthread_result != 0 ) { libcerror_system_set_error( error, diff -Nru libsmdev-20171112/libcthreads/libcthreads_thread_pool.h libsmdev-20181227/libcthreads/libcthreads_thread_pool.h --- libsmdev-20171112/libcthreads/libcthreads_thread_pool.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_thread_pool.h 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * Thread pool functions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcthreads/libcthreads_types.h libsmdev-20181227/libcthreads/libcthreads_types.h --- libsmdev-20171112/libcthreads/libcthreads_types.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_types.h 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal type definitions * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcthreads/libcthreads_unused.h libsmdev-20181227/libcthreads/libcthreads_unused.h --- libsmdev-20171112/libcthreads/libcthreads_unused.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libcthreads/libcthreads_unused.h 2018-12-27 19:19:13.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal unused definition * - * Copyright (C) 2012-2017, Joachim Metz + * Copyright (C) 2012-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libcthreads/Makefile.in libsmdev-20181227/libcthreads/Makefile.in --- libsmdev-20171112/libcthreads/Makefile.in 2017-11-12 14:33:40.000000000 +0000 +++ libsmdev-20181227/libcthreads/Makefile.in 2018-12-27 19:19:39.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 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, @@ -159,7 +159,18 @@ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/libcthreads_condition.Plo \ + ./$(DEPDIR)/libcthreads_error.Plo \ + ./$(DEPDIR)/libcthreads_lock.Plo \ + ./$(DEPDIR)/libcthreads_mutex.Plo \ + ./$(DEPDIR)/libcthreads_queue.Plo \ + ./$(DEPDIR)/libcthreads_read_write_lock.Plo \ + ./$(DEPDIR)/libcthreads_repeating_thread.Plo \ + ./$(DEPDIR)/libcthreads_support.Plo \ + ./$(DEPDIR)/libcthreads_thread.Plo \ + ./$(DEPDIR)/libcthreads_thread_attributes.Plo \ + ./$(DEPDIR)/libcthreads_thread_pool.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -290,6 +301,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSMDEV_DLL_EXPORT = @LIBSMDEV_DLL_EXPORT@ LIBSMDEV_DLL_IMPORT = @LIBSMDEV_DLL_IMPORT@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -439,7 +451,6 @@ libcthreads_LIBS = @libcthreads_LIBS@ libdir = @libdir@ libexecdir = @libexecdir@ -libsmdev_spec_build_requires = @libsmdev_spec_build_requires@ libsmdev_spec_requires = @libsmdev_spec_requires@ libuna_CFLAGS = @libuna_CFLAGS@ libuna_LIBS = @libuna_LIBS@ @@ -515,8 +526,8 @@ *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) @@ -548,17 +559,23 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_condition.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_error.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_lock.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_mutex.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_queue.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_read_write_lock.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_repeating_thread.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_support.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_thread.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_thread_attributes.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_thread_pool.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_condition.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_error.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_lock.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_mutex.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_queue.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_read_write_lock.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_repeating_thread.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_support.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_thread.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_thread_attributes.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcthreads_thread_pool.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -639,7 +656,10 @@ 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)'; \ @@ -753,7 +773,17 @@ installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/libcthreads_condition.Plo + -rm -f ./$(DEPDIR)/libcthreads_error.Plo + -rm -f ./$(DEPDIR)/libcthreads_lock.Plo + -rm -f ./$(DEPDIR)/libcthreads_mutex.Plo + -rm -f ./$(DEPDIR)/libcthreads_queue.Plo + -rm -f ./$(DEPDIR)/libcthreads_read_write_lock.Plo + -rm -f ./$(DEPDIR)/libcthreads_repeating_thread.Plo + -rm -f ./$(DEPDIR)/libcthreads_support.Plo + -rm -f ./$(DEPDIR)/libcthreads_thread.Plo + -rm -f ./$(DEPDIR)/libcthreads_thread_attributes.Plo + -rm -f ./$(DEPDIR)/libcthreads_thread_pool.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -774,16 +804,16 @@ .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am diff -Nru libsmdev-20171112/libsmdev/libsmdev_ata.c libsmdev-20181227/libsmdev/libsmdev_ata.c --- libsmdev-20171112/libsmdev/libsmdev_ata.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_ata.c 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * ATA/ATAPI functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_ata.h libsmdev-20181227/libsmdev/libsmdev_ata.h --- libsmdev-20171112/libsmdev/libsmdev_ata.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_ata.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * ATA/ATAPI functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev.c libsmdev-20181227/libsmdev/libsmdev.c --- libsmdev-20171112/libsmdev/libsmdev.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev.c 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Library to access and read storage media (SM) devices * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_codepage.h libsmdev-20181227/libsmdev/libsmdev_codepage.h --- libsmdev-20171112/libsmdev/libsmdev_codepage.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_codepage.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Codepage functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_debug.c libsmdev-20181227/libsmdev/libsmdev_debug.c --- libsmdev-20171112/libsmdev/libsmdev_debug.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_debug.c 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Debug functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_debug.h libsmdev-20181227/libsmdev/libsmdev_debug.h --- libsmdev-20171112/libsmdev/libsmdev_debug.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_debug.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Debug functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_definitions.h libsmdev-20181227/libsmdev/libsmdev_definitions.h --- libsmdev-20171112/libsmdev/libsmdev_definitions.h 2017-11-12 14:33:50.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_definitions.h 2018-12-27 19:20:30.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal definitions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -35,11 +35,11 @@ #else -#define LIBSMDEV_VERSION 20171112 +#define LIBSMDEV_VERSION 20181227 /* The version string */ -#define LIBSMDEV_VERSION_STRING "20171112" +#define LIBSMDEV_VERSION_STRING "20181227" /* The access flags definitions * bit 1 set to 1 for read access diff -Nru libsmdev-20171112/libsmdev/libsmdev_definitions.h.in libsmdev-20181227/libsmdev/libsmdev_definitions.h.in --- libsmdev-20171112/libsmdev/libsmdev_definitions.h.in 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_definitions.h.in 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal definitions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_error.c libsmdev-20181227/libsmdev/libsmdev_error.c --- libsmdev-20171112/libsmdev/libsmdev_error.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_error.c 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Error functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_error.h libsmdev-20181227/libsmdev/libsmdev_error.h --- libsmdev-20171112/libsmdev/libsmdev_error.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_error.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Error functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_extern.h libsmdev-20181227/libsmdev/libsmdev_extern.h --- libsmdev-20171112/libsmdev/libsmdev_extern.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_extern.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal extern definition * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -28,17 +28,13 @@ */ #if !defined( HAVE_LOCAL_LIBSMDEV ) -/* If libtool DLL support is enabled set LIBSMDEV_DLL_EXPORT - * before including libsmdev/extern.h - */ -#if defined( _WIN32 ) && defined( DLL_EXPORT ) -#define LIBSMDEV_DLL_EXPORT -#endif - #include +#define LIBSMDEV_EXTERN_VARIABLE LIBSMDEV_EXTERN + #else -#define LIBSMDEV_EXTERN /* extern */ +#define LIBSMDEV_EXTERN /* extern */ +#define LIBSMDEV_EXTERN_VARIABLE extern #endif /* !defined( HAVE_LOCAL_LIBSMDEV ) */ diff -Nru libsmdev-20171112/libsmdev/libsmdev_handle.c libsmdev-20181227/libsmdev/libsmdev_handle.c --- libsmdev-20171112/libsmdev/libsmdev_handle.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_handle.c 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Handle functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_handle.h libsmdev-20181227/libsmdev/libsmdev_handle.h --- libsmdev-20171112/libsmdev/libsmdev_handle.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_handle.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Handle functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_libcdata.h libsmdev-20181227/libsmdev/libsmdev_libcdata.h --- libsmdev-20171112/libsmdev/libsmdev_libcdata.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_libcdata.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* - * The internal libcdata header + * The libcdata header wrapper * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_libcerror.h libsmdev-20181227/libsmdev/libsmdev_libcerror.h --- libsmdev-20171112/libsmdev/libsmdev_libcerror.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_libcerror.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* - * The internal libcerror header + * The libcerror header wrapper * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_libcfile.h libsmdev-20181227/libsmdev/libsmdev_libcfile.h --- libsmdev-20171112/libsmdev/libsmdev_libcfile.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_libcfile.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal libcfile header * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_libclocale.h libsmdev-20181227/libsmdev/libsmdev_libclocale.h --- libsmdev-20171112/libsmdev/libsmdev_libclocale.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_libclocale.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* - * The internal libclocale header + * The libclocale header wrapper * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_libcnotify.h libsmdev-20181227/libsmdev/libsmdev_libcnotify.h --- libsmdev-20171112/libsmdev/libsmdev_libcnotify.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_libcnotify.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* - * The internal libcnotify header + * The libcnotify header wrapper * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_libuna.h libsmdev-20181227/libsmdev/libsmdev_libuna.h --- libsmdev-20171112/libsmdev/libsmdev_libuna.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_libuna.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * The libuna header wrapper * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_notify.c libsmdev-20181227/libsmdev/libsmdev_notify.c --- libsmdev-20171112/libsmdev/libsmdev_notify.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_notify.c 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Notification functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_notify.h libsmdev-20181227/libsmdev/libsmdev_notify.h --- libsmdev-20171112/libsmdev/libsmdev_notify.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_notify.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Notification functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_optical_disc.c libsmdev-20181227/libsmdev/libsmdev_optical_disc.c --- libsmdev-20171112/libsmdev/libsmdev_optical_disc.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_optical_disc.c 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Optical disk functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_optical_disc.h libsmdev-20181227/libsmdev/libsmdev_optical_disc.h --- libsmdev-20171112/libsmdev/libsmdev_optical_disc.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_optical_disc.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Optical disk functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev.rc libsmdev-20181227/libsmdev/libsmdev.rc --- libsmdev-20171112/libsmdev/libsmdev.rc 2017-11-12 14:33:50.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev.rc 2018-12-27 19:20:30.000000000 +0000 @@ -22,12 +22,12 @@ BLOCK "040904E4" BEGIN VALUE "FileDescription", "Library to access and read storage media (SM) devices\0" - VALUE "FileVersion", "20171112" "\0" + VALUE "FileVersion", "20181227" "\0" VALUE "InternalName", "libsmdev.dll\0" - VALUE "LegalCopyright", "(C) 2010-2017, Joachim Metz \0" + VALUE "LegalCopyright", "(C) 2010-2018, Joachim Metz \0" VALUE "OriginalFilename", "libsmdev.dll\0" VALUE "ProductName", "libsmdev\0" - VALUE "ProductVersion", "20171112" "\0" + VALUE "ProductVersion", "20181227" "\0" VALUE "Comments", "For more information visit https://github.com/libyal/libsmdev/\0" END END diff -Nru libsmdev-20171112/libsmdev/libsmdev.rc.in libsmdev-20181227/libsmdev/libsmdev.rc.in --- libsmdev-20171112/libsmdev/libsmdev.rc.in 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev.rc.in 2018-12-27 14:12:57.000000000 +0000 @@ -24,7 +24,7 @@ VALUE "FileDescription", "Library to access and read storage media (SM) devices\0" VALUE "FileVersion", "@VERSION@" "\0" VALUE "InternalName", "libsmdev.dll\0" - VALUE "LegalCopyright", "(C) 2010-2017, Joachim Metz \0" + VALUE "LegalCopyright", "(C) 2010-2018, Joachim Metz \0" VALUE "OriginalFilename", "libsmdev.dll\0" VALUE "ProductName", "libsmdev\0" VALUE "ProductVersion", "@VERSION@" "\0" diff -Nru libsmdev-20171112/libsmdev/libsmdev_scsi.c libsmdev-20181227/libsmdev/libsmdev_scsi.c --- libsmdev-20171112/libsmdev/libsmdev_scsi.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_scsi.c 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * SCSI functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_scsi.h libsmdev-20181227/libsmdev/libsmdev_scsi.h --- libsmdev-20171112/libsmdev/libsmdev_scsi.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_scsi.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * SCSI functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_sector_range.c libsmdev-20181227/libsmdev/libsmdev_sector_range.c --- libsmdev-20171112/libsmdev/libsmdev_sector_range.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_sector_range.c 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Sector range functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_sector_range.h libsmdev-20181227/libsmdev/libsmdev_sector_range.h --- libsmdev-20171112/libsmdev/libsmdev_sector_range.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_sector_range.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Sector range functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_string.c libsmdev-20181227/libsmdev/libsmdev_string.c --- libsmdev-20171112/libsmdev/libsmdev_string.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_string.c 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * System character type string functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_string.h libsmdev-20181227/libsmdev/libsmdev_string.h --- libsmdev-20171112/libsmdev/libsmdev_string.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_string.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Character type string functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_support.c libsmdev-20181227/libsmdev/libsmdev_support.c --- libsmdev-20171112/libsmdev/libsmdev_support.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_support.c 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Support functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_support.h libsmdev-20181227/libsmdev/libsmdev_support.h --- libsmdev-20171112/libsmdev/libsmdev_support.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_support.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Support functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_track_value.c libsmdev-20181227/libsmdev/libsmdev_track_value.c --- libsmdev-20171112/libsmdev/libsmdev_track_value.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_track_value.c 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Track value functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_track_value.h libsmdev-20181227/libsmdev/libsmdev_track_value.h --- libsmdev-20171112/libsmdev/libsmdev_track_value.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_track_value.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Track value functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_types.h libsmdev-20181227/libsmdev/libsmdev_types.h --- libsmdev-20171112/libsmdev/libsmdev_types.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_types.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal type definitions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_unused.h libsmdev-20181227/libsmdev/libsmdev_unused.h --- libsmdev-20171112/libsmdev/libsmdev_unused.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_unused.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal unused definition * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_usb.c libsmdev-20181227/libsmdev/libsmdev_usb.c --- libsmdev-20171112/libsmdev/libsmdev_usb.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_usb.c 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * USB functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/libsmdev_usb.h libsmdev-20181227/libsmdev/libsmdev_usb.h --- libsmdev-20171112/libsmdev/libsmdev_usb.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/libsmdev/libsmdev_usb.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * USB functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libsmdev/Makefile.am libsmdev-20181227/libsmdev/Makefile.am --- libsmdev-20171112/libsmdev/Makefile.am 2017-11-05 14:16:02.000000000 +0000 +++ libsmdev-20181227/libsmdev/Makefile.am 2018-08-31 05:22:34.000000000 +0000 @@ -8,7 +8,8 @@ @LIBCNOTIFY_CPPFLAGS@ \ @LIBUNA_CPPFLAGS@ \ @LIBCFILE_CPPFLAGS@ \ - @PTHREAD_CPPFLAGS@ + @PTHREAD_CPPFLAGS@ \ + @LIBSMDEV_DLL_EXPORT@ lib_LTLIBRARIES = libsmdev.la diff -Nru libsmdev-20171112/libsmdev/Makefile.in libsmdev-20181227/libsmdev/Makefile.in --- libsmdev-20171112/libsmdev/Makefile.in 2017-11-12 14:33:40.000000000 +0000 +++ libsmdev-20181227/libsmdev/Makefile.in 2018-12-27 19:19:39.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 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, @@ -169,7 +169,18 @@ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/libsmdev.Plo \ + ./$(DEPDIR)/libsmdev_ata.Plo ./$(DEPDIR)/libsmdev_debug.Plo \ + ./$(DEPDIR)/libsmdev_error.Plo ./$(DEPDIR)/libsmdev_handle.Plo \ + ./$(DEPDIR)/libsmdev_notify.Plo \ + ./$(DEPDIR)/libsmdev_optical_disc.Plo \ + ./$(DEPDIR)/libsmdev_scsi.Plo \ + ./$(DEPDIR)/libsmdev_sector_range.Plo \ + ./$(DEPDIR)/libsmdev_string.Plo \ + ./$(DEPDIR)/libsmdev_support.Plo \ + ./$(DEPDIR)/libsmdev_track_value.Plo \ + ./$(DEPDIR)/libsmdev_usb.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -301,6 +312,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSMDEV_DLL_EXPORT = @LIBSMDEV_DLL_EXPORT@ LIBSMDEV_DLL_IMPORT = @LIBSMDEV_DLL_IMPORT@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -450,7 +462,6 @@ libcthreads_LIBS = @libcthreads_LIBS@ libdir = @libdir@ libexecdir = @libexecdir@ -libsmdev_spec_build_requires = @libsmdev_spec_build_requires@ libsmdev_spec_requires = @libsmdev_spec_requires@ libuna_CFLAGS = @libuna_CFLAGS@ libuna_LIBS = @libuna_LIBS@ @@ -487,7 +498,8 @@ @LIBCNOTIFY_CPPFLAGS@ \ @LIBUNA_CPPFLAGS@ \ @LIBCFILE_CPPFLAGS@ \ - @PTHREAD_CPPFLAGS@ + @PTHREAD_CPPFLAGS@ \ + @LIBSMDEV_DLL_EXPORT@ lib_LTLIBRARIES = libsmdev.la libsmdev_la_SOURCES = \ @@ -556,8 +568,8 @@ *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) @@ -617,19 +629,25 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_ata.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_debug.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_error.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_handle.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_notify.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_optical_disc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_scsi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_sector_range.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_string.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_support.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_track_value.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_usb.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_ata.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_debug.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_error.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_handle.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_notify.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_optical_disc.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_scsi.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_sector_range.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_string.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_support.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_track_value.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsmdev_usb.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -710,7 +728,10 @@ 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)'; \ @@ -827,7 +848,19 @@ installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/libsmdev.Plo + -rm -f ./$(DEPDIR)/libsmdev_ata.Plo + -rm -f ./$(DEPDIR)/libsmdev_debug.Plo + -rm -f ./$(DEPDIR)/libsmdev_error.Plo + -rm -f ./$(DEPDIR)/libsmdev_handle.Plo + -rm -f ./$(DEPDIR)/libsmdev_notify.Plo + -rm -f ./$(DEPDIR)/libsmdev_optical_disc.Plo + -rm -f ./$(DEPDIR)/libsmdev_scsi.Plo + -rm -f ./$(DEPDIR)/libsmdev_sector_range.Plo + -rm -f ./$(DEPDIR)/libsmdev_string.Plo + -rm -f ./$(DEPDIR)/libsmdev_support.Plo + -rm -f ./$(DEPDIR)/libsmdev_track_value.Plo + -rm -f ./$(DEPDIR)/libsmdev_usb.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -848,9 +881,9 @@ .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libLTLIBRARIES clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ diff -Nru libsmdev-20171112/libsmdev.spec libsmdev-20181227/libsmdev.spec --- libsmdev-20171112/libsmdev.spec 2017-11-12 14:33:50.000000000 +0000 +++ libsmdev-20181227/libsmdev.spec 2018-12-27 19:20:30.000000000 +0000 @@ -1,5 +1,5 @@ Name: libsmdev -Version: 20171112 +Version: 20181227 Release: 1 Summary: Library to access and read storage media (SM) devices Group: System Environment/Libraries @@ -8,43 +8,45 @@ URL: https://github.com/libyal/libsmdev BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - +BuildRequires: gcc -%description +%description -n libsmdev Library to access and read storage media (SM) devices -%package devel +%package -n libsmdev-devel Summary: Header files and libraries for developing applications for libsmdev Group: Development/Libraries Requires: libsmdev = %{version}-%{release} -%description devel +%description -n libsmdev-devel Header files and libraries for developing applications for libsmdev. -%package python +%package -n libsmdev-python2 +Obsoletes: libsmdev-python < %{version} +Provides: libsmdev-python = %{version} Summary: Python 2 bindings for libsmdev Group: System Environment/Libraries -Requires: libsmdev = %{version}-%{release} python -BuildRequires: python-devel +Requires: libsmdev = %{version}-%{release} python2 +BuildRequires: python2-devel -%description python +%description -n libsmdev-python2 Python 2 bindings for libsmdev -%package python3 +%package -n libsmdev-python3 Summary: Python 3 bindings for libsmdev Group: System Environment/Libraries Requires: libsmdev = %{version}-%{release} python3 BuildRequires: python3-devel -%description python3 +%description -n libsmdev-python3 Python 3 bindings for libsmdev -%package tools +%package -n libsmdev-tools Summary: Several tools for accessing storage media (SM) devices Group: Applications/System Requires: libsmdev = %{version}-%{release} -%description tools +%description -n libsmdev-tools Several tools for accessing storage media (SM) devices %prep @@ -65,13 +67,13 @@ %postun -p /sbin/ldconfig -%files +%files -n libsmdev %defattr(644,root,root,755) %license COPYING %doc AUTHORS README %attr(755,root,root) %{_libdir}/*.so.* -%files devel +%files -n libsmdev-devel %defattr(644,root,root,755) %license COPYING %doc AUTHORS README ChangeLog @@ -82,7 +84,7 @@ %{_includedir}/* %{_mandir}/man3/* -%files python +%files -n libsmdev-python2 %defattr(644,root,root,755) %license COPYING %doc AUTHORS README @@ -90,7 +92,7 @@ %{_libdir}/python2*/site-packages/*.la %{_libdir}/python2*/site-packages/*.so -%files python3 +%files -n libsmdev-python3 %defattr(644,root,root,755) %license COPYING %doc AUTHORS README @@ -98,7 +100,7 @@ %{_libdir}/python3*/site-packages/*.la %{_libdir}/python3*/site-packages/*.so -%files tools +%files -n libsmdev-tools %defattr(644,root,root,755) %license COPYING %doc AUTHORS README @@ -106,6 +108,6 @@ %{_mandir}/man1/* %changelog -* Sun Nov 12 2017 Joachim Metz 20171112-1 +* Thu Dec 27 2018 Joachim Metz 20181227-1 - Auto-generated diff -Nru libsmdev-20171112/libsmdev.spec.in libsmdev-20181227/libsmdev.spec.in --- libsmdev-20171112/libsmdev.spec.in 2017-11-12 14:19:27.000000000 +0000 +++ libsmdev-20181227/libsmdev.spec.in 2018-12-27 14:12:43.000000000 +0000 @@ -8,43 +8,45 @@ URL: https://github.com/libyal/libsmdev BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @libsmdev_spec_requires@ @ax_libcdata_spec_requires@ @ax_libcerror_spec_requires@ @ax_libcfile_spec_requires@ @ax_libclocale_spec_requires@ @ax_libcnotify_spec_requires@ @ax_libcthreads_spec_requires@ @ax_libuna_spec_requires@ -@libsmdev_spec_build_requires@ @ax_libcdata_spec_build_requires@ @ax_libcerror_spec_build_requires@ @ax_libcfile_spec_build_requires@ @ax_libclocale_spec_build_requires@ @ax_libcnotify_spec_build_requires@ @ax_libcthreads_spec_build_requires@ @ax_libuna_spec_build_requires@ +BuildRequires: gcc @ax_libcdata_spec_build_requires@ @ax_libcerror_spec_build_requires@ @ax_libcfile_spec_build_requires@ @ax_libclocale_spec_build_requires@ @ax_libcnotify_spec_build_requires@ @ax_libcthreads_spec_build_requires@ @ax_libuna_spec_build_requires@ -%description +%description -n libsmdev Library to access and read storage media (SM) devices -%package devel +%package -n libsmdev-devel Summary: Header files and libraries for developing applications for libsmdev Group: Development/Libraries Requires: libsmdev = %{version}-%{release} -%description devel +%description -n libsmdev-devel Header files and libraries for developing applications for libsmdev. -%package python +%package -n libsmdev-python2 +Obsoletes: libsmdev-python < %{version} +Provides: libsmdev-python = %{version} Summary: Python 2 bindings for libsmdev Group: System Environment/Libraries -Requires: libsmdev = %{version}-%{release} python -BuildRequires: python-devel +Requires: libsmdev = %{version}-%{release} python2 +BuildRequires: python2-devel -%description python +%description -n libsmdev-python2 Python 2 bindings for libsmdev -%package python3 +%package -n libsmdev-python3 Summary: Python 3 bindings for libsmdev Group: System Environment/Libraries Requires: libsmdev = %{version}-%{release} python3 BuildRequires: python3-devel -%description python3 +%description -n libsmdev-python3 Python 3 bindings for libsmdev -%package tools +%package -n libsmdev-tools Summary: Several tools for accessing storage media (SM) devices Group: Applications/System Requires: libsmdev = %{version}-%{release} -%description tools +%description -n libsmdev-tools Several tools for accessing storage media (SM) devices %prep @@ -65,13 +67,13 @@ %postun -p /sbin/ldconfig -%files +%files -n libsmdev %defattr(644,root,root,755) %license COPYING %doc AUTHORS README %attr(755,root,root) %{_libdir}/*.so.* -%files devel +%files -n libsmdev-devel %defattr(644,root,root,755) %license COPYING %doc AUTHORS README ChangeLog @@ -82,7 +84,7 @@ %{_includedir}/* %{_mandir}/man3/* -%files python +%files -n libsmdev-python2 %defattr(644,root,root,755) %license COPYING %doc AUTHORS README @@ -90,7 +92,7 @@ %{_libdir}/python2*/site-packages/*.la %{_libdir}/python2*/site-packages/*.so -%files python3 +%files -n libsmdev-python3 %defattr(644,root,root,755) %license COPYING %doc AUTHORS README @@ -98,7 +100,7 @@ %{_libdir}/python3*/site-packages/*.la %{_libdir}/python3*/site-packages/*.so -%files tools +%files -n libsmdev-tools %defattr(644,root,root,755) %license COPYING %doc AUTHORS README diff -Nru libsmdev-20171112/libuna/libuna_base16_stream.c libsmdev-20181227/libuna/libuna_base16_stream.c --- libsmdev-20171112/libuna/libuna_base16_stream.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_base16_stream.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Base16 stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -28,6 +28,96 @@ #include "libuna_libcerror.h" #include "libuna_types.h" +/* Copies a base16 character from a base16 stream + * Returns 1 if successful or -1 on error + */ +int libuna_base16_character_copy_from_base16_stream( + uint32_t *base16_character, + const uint8_t *base16_stream, + uint32_t base16_variant, + libcerror_error_t **error ) +{ + static char *function = "libuna_base16_character_copy_from_base16_stream"; + uint32_t safe_base16_character = 0; + + if( base16_character == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid base16 character.", + function ); + + return( -1 ); + } + if( base16_stream == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid base16 stream.", + function ); + + return( -1 ); + } + switch( base16_variant & 0xf0000000UL ) + { + case LIBUNA_BASE16_VARIANT_ENCODING_BYTE_STREAM: + safe_base16_character = *base16_stream; + break; + + case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_BIG_ENDIAN: + byte_stream_copy_to_uint16_big_endian( + base16_stream, + safe_base16_character ); + break; + + case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: + byte_stream_copy_to_uint16_little_endian( + base16_stream, + safe_base16_character ); + break; + + case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_BIG_ENDIAN: + byte_stream_copy_to_uint32_big_endian( + base16_stream, + safe_base16_character ); + break; + + case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: + byte_stream_copy_to_uint32_little_endian( + base16_stream, + safe_base16_character ); + break; + + default: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, + "%s: unsupported base16 variant.", + function ); + + return( -1 ); + } + if( ( safe_base16_character & 0xffffff00UL ) != 0 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, + "%s: invalid base16 character.", + function ); + + return( -1 ); + } + *base16_character = safe_base16_character; + + return( 1 ); +} + /* Determines the size of a byte stream from a base16 stream * * LIBUNA_BASE16_FLAG_STRIP_WHITESPACE removes leading space and tab characters, @@ -65,14 +155,13 @@ return( -1 ); } - if( ( base16_stream_size == 0 ) - || ( base16_stream_size > (size_t) SSIZE_MAX ) ) + if( base16_stream_size > (size_t) SSIZE_MAX ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS, - "%s: invalid base16 stream size value out of bounds.", + LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM, + "%s: invalid base16 stream size value exceeds maximum.", function ); return( -1 ); @@ -162,17 +251,6 @@ return( -1 ); } - if( base16_stream_size < base16_character_size ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: invalid base16 stream value too small.", - function ); - - return( -1 ); - } if( ( flags & ~( LIBUNA_BASE16_FLAG_STRIP_WHITESPACE ) ) != 0 ) { libcerror_error_set( @@ -184,130 +262,71 @@ return( -1 ); } - base16_stream_index = base16_stream_size - base16_character_size; - whitespace_size = 0; - - while( base16_stream_index > base16_character_size ) + /* Ignore trailing whitespace + */ + if( base16_stream_size > base16_character_size ) { - switch( base16_variant & 0xf0000000UL ) - { - case LIBUNA_BASE16_VARIANT_ENCODING_BYTE_STREAM: - base16_character1 = base16_stream[ base16_stream_index ]; - break; + base16_stream_index = base16_stream_size - base16_character_size; + whitespace_size = 0; - case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_BIG_ENDIAN: - byte_stream_copy_to_uint16_big_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); - break; + while( base16_stream_index > base16_character_size ) + { + if( libuna_base16_character_copy_from_base16_stream( + &base16_character1, + &( base16_stream[ base16_stream_index ] ), + base16_variant, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, + "%s: unable to copy base16 character at index: %" PRIzd ".", + function, + base16_stream_index ); - case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: - byte_stream_copy_to_uint16_little_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); - break; + return( -1 ); + } + base16_stream_index -= base16_character_size; - case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_BIG_ENDIAN: - byte_stream_copy_to_uint32_big_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); + if( ( base16_character1 == (uint32_t) '\n' ) + || ( base16_character1 == (uint32_t) '\r' ) ) + { + whitespace_size += base16_character_size; + } + else if( ( flags & LIBUNA_BASE16_FLAG_STRIP_WHITESPACE ) == 0 ) + { break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: - byte_stream_copy_to_uint32_little_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); + } + else if( ( base16_character1 == (uint32_t) ' ' ) + || ( base16_character1 == (uint32_t) '\t' ) + || ( base16_character1 == (uint32_t) '\v' ) ) + { + whitespace_size += base16_character_size; + } + else + { break; + } } - if( ( base16_character1 & 0xffffff00UL ) != 0 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, - "%s: invalid base16 character at index: %" PRIzd ".", - function, - base16_stream_index ); - - return( -1 ); - } - base16_stream_index -= base16_character_size; - - if( ( base16_character1 == (uint32_t) '\n' ) - || ( base16_character1 == (uint32_t) '\r' ) ) - { - whitespace_size += base16_character_size; - } - else if( ( flags & LIBUNA_BASE16_FLAG_STRIP_WHITESPACE ) == 0 ) - { - break; - } - else if( ( base16_character1 == (uint32_t) ' ' ) - || ( base16_character1 == (uint32_t) '\t' ) - || ( base16_character1 == (uint32_t) '\v' ) ) - { - whitespace_size += base16_character_size; - } - else - { - break; - } - } - base16_stream_size -= whitespace_size; - - if( base16_stream_size < base16_character_size ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: invalid base16 stream value too small.", - function ); - - return( -1 ); + base16_stream_size -= whitespace_size; } base16_stream_index = 0; whitespace_size = 0; while( base16_stream_index < base16_stream_size ) { - switch( base16_variant & 0xf0000000UL ) - { - case LIBUNA_BASE16_VARIANT_ENCODING_BYTE_STREAM: - base16_character1 = base16_stream[ base16_stream_index ]; - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_BIG_ENDIAN: - byte_stream_copy_to_uint16_big_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: - byte_stream_copy_to_uint16_little_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_BIG_ENDIAN: - byte_stream_copy_to_uint32_big_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: - byte_stream_copy_to_uint32_little_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); - break; - } - if( ( base16_character1 & 0xffffff00UL ) != 0 ) + if( libuna_base16_character_copy_from_base16_stream( + &base16_character1, + &( base16_stream[ base16_stream_index ] ), + base16_variant, + error ) != 1 ) { libcerror_error_set( error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, - "%s: invalid base16 character at index: %" PRIzd ".", + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, + "%s: unable to copy base16 character at index: %" PRIzd ".", function, base16_stream_index ); @@ -325,45 +344,21 @@ } else { + /* Handle multi-character end-of-line + */ if( ( base16_stream_index + base16_character_size ) < base16_stream_size ) { - switch( base16_variant & 0xf0000000UL ) - { - case LIBUNA_BASE16_VARIANT_ENCODING_BYTE_STREAM: - base16_character2 = base16_stream[ base16_stream_index ]; - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_BIG_ENDIAN: - byte_stream_copy_to_uint16_big_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character2 ); - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: - byte_stream_copy_to_uint16_little_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character2 ); - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_BIG_ENDIAN: - byte_stream_copy_to_uint32_big_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character2 ); - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: - byte_stream_copy_to_uint32_little_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character2 ); - break; - } - if( ( base16_character2 & 0xffffff00UL ) != 0 ) + if( libuna_base16_character_copy_from_base16_stream( + &base16_character2, + &( base16_stream[ base16_stream_index + base16_character_size ] ), + base16_variant, + error ) != 1 ) { libcerror_error_set( error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, - "%s: invalid base16 character at index: %" PRIzd ".", + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, + "%s: unable to copy base16 character at index: %" PRIzd ".", function, base16_stream_index ); @@ -659,17 +654,6 @@ return( -1 ); } - if( base16_stream_size < base16_character_size ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: invalid base16 stream value too small.", - function ); - - return( -1 ); - } if( ( flags & ~( LIBUNA_BASE16_FLAG_STRIP_WHITESPACE ) ) != 0 ) { libcerror_error_set( @@ -681,135 +665,76 @@ return( -1 ); } - if( ( flags & LIBUNA_BASE16_FLAG_STRIP_WHITESPACE ) == 0 ) + /* Ignore trailing whitespace + */ + if( base16_stream_size > base16_character_size ) { - strip_mode = LIBUNA_STRIP_MODE_NON_WHITESPACE; - } - base16_stream_index = base16_stream_size - base16_character_size; - whitespace_size = 0; + base16_stream_index = base16_stream_size - base16_character_size; + whitespace_size = 0; - while( base16_stream_index > base16_character_size ) - { - switch( base16_variant & 0xf0000000UL ) + while( base16_stream_index > base16_character_size ) { - case LIBUNA_BASE16_VARIANT_ENCODING_BYTE_STREAM: - base16_character1 = base16_stream[ base16_stream_index ]; - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_BIG_ENDIAN: - byte_stream_copy_to_uint16_big_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); - break; + if( libuna_base16_character_copy_from_base16_stream( + &base16_character1, + &( base16_stream[ base16_stream_index ] ), + base16_variant, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, + "%s: unable to copy base16 character at index: %" PRIzd ".", + function, + base16_stream_index ); - case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: - byte_stream_copy_to_uint16_little_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); - break; + return( -1 ); + } + base16_stream_index -= base16_character_size; - case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_BIG_ENDIAN: - byte_stream_copy_to_uint32_big_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); + if( ( base16_character1 == (uint32_t) '\n' ) + || ( base16_character1 == (uint32_t) '\r' ) ) + { + whitespace_size += base16_character_size; + } + else if( ( flags & LIBUNA_BASE16_FLAG_STRIP_WHITESPACE ) == 0 ) + { break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: - byte_stream_copy_to_uint32_little_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); + } + else if( ( base16_character1 == (uint32_t) ' ' ) + || ( base16_character1 == (uint32_t) '\t' ) + || ( base16_character1 == (uint32_t) '\v' ) ) + { + whitespace_size += base16_character_size; + } + else + { break; + } } - if( ( base16_character1 & 0xffffff00UL ) != 0 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, - "%s: invalid base16 character at index: %" PRIzd ".", - function, - base16_stream_index ); - - return( -1 ); - } - base16_stream_index -= base16_character_size; - - if( ( base16_character1 == (uint32_t) '\n' ) - || ( base16_character1 == (uint32_t) '\r' ) ) - { - whitespace_size += base16_character_size; - } - else if( ( flags & LIBUNA_BASE16_FLAG_STRIP_WHITESPACE ) == 0 ) - { - break; - } - else if( ( base16_character1 == (uint32_t) ' ' ) - || ( base16_character1 == (uint32_t) '\t' ) - || ( base16_character1 == (uint32_t) '\v' ) ) - { - whitespace_size += base16_character_size; - } - else - { - break; - } + base16_stream_size -= whitespace_size; } - base16_stream_size -= whitespace_size; - - if( base16_stream_size < base16_character_size ) + if( ( flags & LIBUNA_BASE16_FLAG_STRIP_WHITESPACE ) == 0 ) { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: invalid base16 stream value too small.", - function ); - - return( -1 ); + strip_mode = LIBUNA_STRIP_MODE_NON_WHITESPACE; } base16_stream_index = 0; while( base16_stream_index < base16_stream_size ) { - switch( base16_variant & 0xf0000000UL ) - { - case LIBUNA_BASE16_VARIANT_ENCODING_BYTE_STREAM: - base16_character1 = base16_stream[ base16_stream_index ]; - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_BIG_ENDIAN: - byte_stream_copy_to_uint16_big_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: - byte_stream_copy_to_uint16_little_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_BIG_ENDIAN: - byte_stream_copy_to_uint32_big_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: - byte_stream_copy_to_uint32_little_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); - break; - } - if( ( base16_character1 & 0xffffff00UL ) != 0 ) + if( libuna_base16_character_copy_from_base16_stream( + &base16_character1, + &( base16_stream[ base16_stream_index ] ), + base16_variant, + error ) != 1 ) { libcerror_error_set( error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, - "%s: invalid base16 character at index: %" PRIzd ".", - base16_stream_index, - function ); + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, + "%s: unable to copy base16 character at index: %" PRIzd ".", + function, + base16_stream_index ); return( -1 ); } @@ -825,45 +750,21 @@ } else { + /* Handle multi-character end-of-line + */ if( ( base16_stream_index + base16_character_size ) < base16_stream_size ) { - switch( base16_variant & 0xf0000000UL ) - { - case LIBUNA_BASE16_VARIANT_ENCODING_BYTE_STREAM: - base16_character2 = base16_stream[ base16_stream_index ]; - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_BIG_ENDIAN: - byte_stream_copy_to_uint16_big_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character2 ); - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: - byte_stream_copy_to_uint16_little_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character2 ); - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_BIG_ENDIAN: - byte_stream_copy_to_uint32_big_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character2 ); - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: - byte_stream_copy_to_uint32_little_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character2 ); - break; - } - if( ( base16_character2 & 0xffffff00UL ) != 0 ) + if( libuna_base16_character_copy_from_base16_stream( + &base16_character2, + &( base16_stream[ base16_stream_index + base16_character_size ] ), + base16_variant, + error ) != 1 ) { libcerror_error_set( error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, - "%s: invalid base16 character at index: %" PRIzd ".", + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, + "%s: unable to copy base16 character at index: %" PRIzd ".", function, base16_stream_index ); @@ -981,45 +882,19 @@ } byte_value <<= 4; - switch( base16_variant & 0xf0000000UL ) - { - case LIBUNA_BASE16_VARIANT_ENCODING_BYTE_STREAM: - base16_character1 = base16_stream[ base16_stream_index ]; - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_BIG_ENDIAN: - byte_stream_copy_to_uint16_big_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: - byte_stream_copy_to_uint16_little_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_BIG_ENDIAN: - byte_stream_copy_to_uint32_big_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); - break; - - case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: - byte_stream_copy_to_uint32_little_endian( - &( base16_stream[ base16_stream_index ] ), - base16_character1 ); - break; - } - if( ( base16_character1 & 0xffffff00UL ) != 0 ) + if( libuna_base16_character_copy_from_base16_stream( + &base16_character1, + &( base16_stream[ base16_stream_index ] ), + base16_variant, + error ) != 1 ) { libcerror_error_set( error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, - "%s: invalid base16 character at index: %" PRIzd ".", - base16_stream_index, - function ); + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, + "%s: unable to copy base16 character at index: %" PRIzd ".", + function, + base16_stream_index ); return( -1 ); } @@ -1109,10 +984,11 @@ uint32_t base16_variant, libcerror_error_t **error ) { - static char *function = "libuna_base16_stream_size_from_byte_stream"; - size_t base16_character_size = 0; - size_t whitespace_size = 0; - uint8_t character_limit = 0; + static char *function = "libuna_base16_stream_size_from_byte_stream"; + size_t base16_character_size = 0; + size_t safe_base16_stream_size = 0; + size_t whitespace_size = 0; + uint8_t character_limit = 0; if( byte_stream == NULL ) { @@ -1171,6 +1047,23 @@ return( -1 ); } + switch( base16_variant & 0x000f0000UL ) + { + case LIBUNA_BASE16_VARIANT_CASE_LOWER: + case LIBUNA_BASE16_VARIANT_CASE_MIXED: + case LIBUNA_BASE16_VARIANT_CASE_UPPER: + break; + + default: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, + "%s: unsupported base16 variant.", + function ); + + return( -1 ); + } switch( base16_variant & 0xf0000000UL ) { case LIBUNA_BASE16_VARIANT_ENCODING_BYTE_STREAM: @@ -1199,19 +1092,19 @@ } /* The base16 stream contains 2 characters for every byte */ - *base16_stream_size = byte_stream_size * 2; + safe_base16_stream_size = byte_stream_size * 2; if( character_limit != 0 ) { - whitespace_size = *base16_stream_size / character_limit; + whitespace_size = safe_base16_stream_size / character_limit; - if( ( *base16_stream_size % character_limit ) != 0 ) + if( ( safe_base16_stream_size % character_limit ) != 0 ) { whitespace_size += 1; } - *base16_stream_size += whitespace_size; + safe_base16_stream_size += whitespace_size; } - *base16_stream_size *= base16_character_size; + *base16_stream_size = safe_base16_stream_size * base16_character_size; return( 1 ); } @@ -1264,11 +1157,11 @@ libcerror_error_t **error ) { static char *function = "libuna_base16_stream_with_index_copy_from_byte_stream"; - size_t calculated_base16_stream_size = 0; size_t base16_character_size = 0; - size_t stream_index = 0; size_t byte_stream_index = 0; + size_t calculated_base16_stream_size = 0; size_t number_of_characters = 0; + size_t safe_base16_stream_index = 0; size_t whitespace_size = 0; uint32_t a_character_value = 0; uint32_t base16_character = 0; @@ -1411,7 +1304,7 @@ return( -1 ); } - stream_index = *base16_stream_index; + safe_base16_stream_index = *base16_stream_index; /* Make sure the base16 stream is able to hold * at least 2 bytes for each byte @@ -1456,34 +1349,34 @@ switch( base16_variant & 0xf0000000UL ) { case LIBUNA_BASE16_VARIANT_ENCODING_BYTE_STREAM: - base16_stream[ stream_index ] = (uint8_t) base16_character; + base16_stream[ safe_base16_stream_index ] = (uint8_t) base16_character; break; case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_from_uint16_big_endian( - &( base16_stream[ stream_index ] ), + &( base16_stream[ safe_base16_stream_index ] ), base16_character ); break; case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_from_uint16_little_endian( - &( base16_stream[ stream_index ] ), + &( base16_stream[ safe_base16_stream_index ] ), base16_character ); break; case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_from_uint32_big_endian( - &( base16_stream[ stream_index ] ), + &( base16_stream[ safe_base16_stream_index ] ), base16_character ); break; case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_from_uint32_little_endian( - &( base16_stream[ stream_index ] ), + &( base16_stream[ safe_base16_stream_index ] ), base16_character ); break; } - stream_index += base16_character_size; + safe_base16_stream_index += base16_character_size; base16_character = byte_stream[ byte_stream_index ] & 0x0f; @@ -1498,34 +1391,34 @@ switch( base16_variant & 0xf0000000UL ) { case LIBUNA_BASE16_VARIANT_ENCODING_BYTE_STREAM: - base16_stream[ stream_index ] = (uint8_t) base16_character; + base16_stream[ safe_base16_stream_index ] = (uint8_t) base16_character; break; case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_from_uint16_big_endian( - &( base16_stream[ stream_index ] ), + &( base16_stream[ safe_base16_stream_index ] ), base16_character ); break; case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_from_uint16_little_endian( - &( base16_stream[ stream_index ] ), + &( base16_stream[ safe_base16_stream_index ] ), base16_character ); break; case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_from_uint32_big_endian( - &( base16_stream[ stream_index ] ), + &( base16_stream[ safe_base16_stream_index ] ), base16_character ); break; case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_from_uint32_little_endian( - &( base16_stream[ stream_index ] ), + &( base16_stream[ safe_base16_stream_index ] ), base16_character ); break; } - stream_index += base16_character_size; + safe_base16_stream_index += base16_character_size; if( character_limit != 0 ) { @@ -1538,34 +1431,34 @@ switch( base16_variant & 0xf0000000UL ) { case LIBUNA_BASE16_VARIANT_ENCODING_BYTE_STREAM: - base16_stream[ stream_index ] = (uint8_t) base16_character; + base16_stream[ safe_base16_stream_index ] = (uint8_t) base16_character; break; case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_from_uint16_big_endian( - &( base16_stream[ stream_index ] ), + &( base16_stream[ safe_base16_stream_index ] ), base16_character ); break; case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_from_uint16_little_endian( - &( base16_stream[ stream_index ] ), + &( base16_stream[ safe_base16_stream_index ] ), base16_character ); break; case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_from_uint32_big_endian( - &( base16_stream[ stream_index ] ), + &( base16_stream[ safe_base16_stream_index ] ), base16_character ); break; case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_from_uint32_little_endian( - &( base16_stream[ stream_index ] ), + &( base16_stream[ safe_base16_stream_index ] ), base16_character ); break; } - stream_index += base16_character_size; + safe_base16_stream_index += base16_character_size; number_of_characters = 0; } @@ -1581,37 +1474,37 @@ switch( base16_variant & 0xf0000000UL ) { case LIBUNA_BASE16_VARIANT_ENCODING_BYTE_STREAM: - base16_stream[ stream_index ] = (uint8_t) base16_character; + base16_stream[ safe_base16_stream_index ] = (uint8_t) base16_character; break; case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_from_uint16_big_endian( - &( base16_stream[ stream_index ] ), + &( base16_stream[ safe_base16_stream_index ] ), base16_character ); break; case LIBUNA_BASE16_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_from_uint16_little_endian( - &( base16_stream[ stream_index ] ), + &( base16_stream[ safe_base16_stream_index ] ), base16_character ); break; case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_from_uint32_big_endian( - &( base16_stream[ stream_index ] ), + &( base16_stream[ safe_base16_stream_index ] ), base16_character ); break; case LIBUNA_BASE16_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_from_uint32_little_endian( - &( base16_stream[ stream_index ] ), + &( base16_stream[ safe_base16_stream_index ] ), base16_character ); break; } - stream_index += base16_character_size; + safe_base16_stream_index += base16_character_size; } } - *base16_stream_index = stream_index; + *base16_stream_index = safe_base16_stream_index; return( 1 ); } diff -Nru libsmdev-20171112/libuna/libuna_base16_stream.h libsmdev-20181227/libuna/libuna_base16_stream.h --- libsmdev-20171112/libuna/libuna_base16_stream.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_base16_stream.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Base16 stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -33,6 +33,12 @@ extern "C" { #endif +int libuna_base16_character_copy_from_base16_stream( + uint32_t *base16_character, + const uint8_t *base16_stream, + uint32_t base16_variant, + libcerror_error_t **error ); + LIBUNA_EXTERN \ int libuna_base16_stream_size_to_byte_stream( const uint8_t *base16_stream, diff -Nru libsmdev-20171112/libuna/libuna_base32_stream.c libsmdev-20181227/libuna/libuna_base32_stream.c --- libsmdev-20171112/libuna/libuna_base32_stream.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_base32_stream.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Base32 stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -28,11 +28,13 @@ #include "libuna_libcerror.h" #include "libuna_types.h" -static uint8_t *libuna_base32_quintet_to_character_table = \ - (uint8_t *) "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; - -static uint8_t *libuna_base32hex_quintet_to_character_table = \ - (uint8_t *) "0123456789ABCDEFGHIJKLMNOPQRSTUV"; +static uint8_t libuna_base32_quintet_to_character_table[ 32 ] = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '2', '3', '4', '5', '6', '7' }; + +static uint8_t libuna_base32hex_quintet_to_character_table[ 32 ] = { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', + 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V' }; /* Copies a base32 character to a base32 quintet * Returns 1 if successful or -1 on error @@ -43,7 +45,8 @@ uint32_t base32_variant, libcerror_error_t **error ) { - static char *function = "libuna_base32_character_copy_to_quintet"; + static char *function = "libuna_base32_character_copy_to_quintet"; + uint8_t safe_base32_quintet = 0; if( base32_quintet == NULL ) { @@ -65,22 +68,22 @@ if( ( base32_character >= (uint8_t) 'A' ) && ( base32_character <= (uint8_t) 'I' ) ) { - *base32_quintet = base32_character - (uint8_t) 'A'; + safe_base32_quintet = base32_character - (uint8_t) 'A'; } else if( ( base32_character >= (uint8_t) 'J' ) && ( base32_character <= (uint8_t) 'R' ) ) { - *base32_quintet = base32_character - (uint8_t) 'J' + 9; + safe_base32_quintet = base32_character - (uint8_t) 'J' + 9; } else if( ( base32_character >= (uint8_t) 'S' ) && ( base32_character <= (uint8_t) 'Z' ) ) { - *base32_quintet = base32_character - (uint8_t) 'S' + 18; + safe_base32_quintet = base32_character - (uint8_t) 'S' + 18; } else if( ( base32_character >= (uint8_t) '2' ) && ( base32_character <= (uint8_t) '7' ) ) { - *base32_quintet = base32_character - (uint8_t) '2' + 26; + safe_base32_quintet = base32_character - (uint8_t) '2' + 26; } else { @@ -100,7 +103,7 @@ if( ( base32_character >= (uint8_t) '0' ) && ( base32_character <= (uint8_t) '9' ) ) { - *base32_quintet = base32_character - (uint8_t) '0'; + safe_base32_quintet = base32_character - (uint8_t) '0'; } /* A-V is not a continous range on an EBCDIC based system * it consists of the ranges: A-I, J-R, S-V @@ -108,17 +111,17 @@ else if( ( base32_character >= (uint8_t) 'A' ) && ( base32_character <= (uint8_t) 'I' ) ) { - *base32_quintet = base32_character - (uint8_t) 'A' + 10; + safe_base32_quintet = base32_character - (uint8_t) 'A' + 10; } else if( ( base32_character >= (uint8_t) 'J' ) && ( base32_character <= (uint8_t) 'R' ) ) { - *base32_quintet = base32_character - (uint8_t) 'J' + 19; + safe_base32_quintet = base32_character - (uint8_t) 'J' + 19; } else if( ( base32_character >= (uint8_t) 'S' ) && ( base32_character <= (uint8_t) 'V' ) ) { - *base32_quintet = base32_character - (uint8_t) 'J' + 27; + safe_base32_quintet = base32_character - (uint8_t) 'S' + 27; } else { @@ -144,6 +147,8 @@ return( -1 ); } + *base32_quintet = safe_base32_quintet; + return( 1 ); } @@ -163,20 +168,21 @@ uint32_t base32_variant, libcerror_error_t **error ) { - static char *function = "libuna_base32_quintuplet_copy_from_base32_stream"; - size_t base32_character_size = 0; - size_t stream_index = 0; - uint32_t base32_character1 = 0; - uint32_t base32_character2 = 0; - uint8_t padding_character = 0; - uint8_t quintet1 = 0; - uint8_t quintet2 = 0; - uint8_t quintet3 = 0; - uint8_t quintet4 = 0; - uint8_t quintet5 = 0; - uint8_t quintet6 = 0; - uint8_t quintet7 = 0; - uint8_t quintet8 = 0; + static char *function = "libuna_base32_quintuplet_copy_from_base32_stream"; + size_t base32_character_size = 0; + size_t safe_base32_stream_index = 0; + uint64_t safe_base32_quintuplet = 0; + uint32_t base32_character1 = 0; + uint32_t base32_character2 = 0; + uint8_t quintet1 = 0; + uint8_t quintet2 = 0; + uint8_t quintet3 = 0; + uint8_t quintet4 = 0; + uint8_t quintet5 = 0; + uint8_t quintet6 = 0; + uint8_t quintet7 = 0; + uint8_t quintet8 = 0; + uint8_t safe_padding_size = 0; if( base32_quintuplet == NULL ) { @@ -247,15 +253,8 @@ switch( base32_variant & 0x0f000000UL ) { case LIBUNA_BASE32_VARIANT_PADDING_NONE: - padding_character = 0; - break; - case LIBUNA_BASE32_VARIANT_PADDING_OPTIONAL: - padding_character = (uint8_t) '='; - break; - case LIBUNA_BASE32_VARIANT_PADDING_REQUIRED: - padding_character = (uint8_t) '='; break; default: @@ -294,9 +293,9 @@ return( -1 ); } - stream_index = *base32_stream_index; + safe_base32_stream_index = *base32_stream_index; - if( ( stream_index + base32_character_size ) > base32_stream_size ) + if( base32_character_size > ( base32_stream_size - safe_base32_stream_index ) ) { libcerror_error_set( error, @@ -310,34 +309,34 @@ switch( base32_variant & 0xf0000000UL ) { case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: - base32_character1 = base32_stream[ stream_index ]; + base32_character1 = base32_stream[ safe_base32_stream_index ]; break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_to_uint16_big_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_to_uint16_little_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_to_uint32_big_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_to_uint32_little_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); break; } - stream_index += base32_character_size; + safe_base32_stream_index += base32_character_size; if( ( base32_character1 & 0xffffff00UL ) != 0 ) { @@ -365,7 +364,7 @@ return( -1 ); } - if( ( stream_index + base32_character_size ) > base32_stream_size ) + if( base32_character_size > ( base32_stream_size - safe_base32_stream_index ) ) { libcerror_error_set( error, @@ -379,34 +378,34 @@ switch( base32_variant & 0xf0000000UL ) { case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: - base32_character1 = base32_stream[ stream_index ]; + base32_character1 = base32_stream[ safe_base32_stream_index ]; break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_to_uint16_big_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_to_uint16_little_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_to_uint32_big_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_to_uint32_little_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); break; } - stream_index += base32_character_size; + safe_base32_stream_index += base32_character_size; if( ( base32_character1 & 0xffffff00UL ) != 0 ) { @@ -434,58 +433,58 @@ return( -1 ); } - *padding_size = 6; + safe_padding_size = 6; - if( ( stream_index + ( 2 * base32_character_size ) ) <= base32_stream_size ) + if( ( 2 * base32_character_size ) <= ( base32_stream_size - safe_base32_stream_index ) ) { switch( base32_variant & 0xf0000000UL ) { case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: - base32_character1 = base32_stream[ stream_index ]; - base32_character2 = base32_stream[ stream_index + 1 ]; + base32_character1 = base32_stream[ safe_base32_stream_index ]; + base32_character2 = base32_stream[ safe_base32_stream_index + 1 ]; break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_to_uint16_big_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); byte_stream_copy_to_uint16_big_endian( - &( base32_stream[ stream_index + 2 ] ), + &( base32_stream[ safe_base32_stream_index + 2 ] ), base32_character2 ); break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_to_uint16_little_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); byte_stream_copy_to_uint16_little_endian( - &( base32_stream[ stream_index + 2 ] ), + &( base32_stream[ safe_base32_stream_index + 2 ] ), base32_character2 ); break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_to_uint32_big_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); byte_stream_copy_to_uint32_big_endian( - &( base32_stream[ stream_index + 4 ] ), + &( base32_stream[ safe_base32_stream_index + 4 ] ), base32_character2 ); break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_to_uint32_little_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); byte_stream_copy_to_uint32_little_endian( - &( base32_stream[ stream_index + 4 ] ), + &( base32_stream[ safe_base32_stream_index + 4 ] ), base32_character2 ); break; } - stream_index += 2 * base32_character_size; + safe_base32_stream_index += 2 * base32_character_size; if( ( base32_character1 & 0xffffff00UL ) != 0 ) { @@ -509,11 +508,21 @@ return( -1 ); } - if( ( padding_character != 0 ) - && ( ( base32_character1 == (uint32_t) padding_character ) - || ( base32_character2 == (uint32_t) padding_character ) ) ) + if( ( base32_character1 == (uint32_t) '=' ) + || ( base32_character2 == (uint32_t) '=' ) ) { - if( base32_character1 != (uint32_t) padding_character ) + if( ( base32_variant & 0x0f000000UL ) == LIBUNA_BASE32_VARIANT_PADDING_NONE ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, + "%s: padding where not supposed to - invalid 3rd or 4th base32 character.", + function ); + + return( -1 ); + } + if( base32_character1 != (uint32_t) '=' ) { libcerror_error_set( error, @@ -524,7 +533,7 @@ return( -1 ); } - if( base32_character2 != (uint32_t) padding_character ) + if( base32_character2 != (uint32_t) '=' ) { libcerror_error_set( error, @@ -535,16 +544,14 @@ return( -1 ); } - quintet3 = 0; - quintet4 = 0; } - else if( libuna_base32_character_copy_to_quintet( - (uint8_t) base32_character1, - &quintet3, - base32_variant, - error ) != 1 ) + else { - if( padding_character != 0 ) + if( libuna_base32_character_copy_to_quintet( + (uint8_t) base32_character1, + &quintet3, + base32_variant, + error ) != 1 ) { libcerror_error_set( error, @@ -555,16 +562,11 @@ return( -1 ); } - libcerror_error_free( - error ); - } - else if( libuna_base32_character_copy_to_quintet( - (uint8_t) base32_character2, - &quintet4, - base32_variant, - error ) != 1 ) - { - if( padding_character != 0 ) + if( libuna_base32_character_copy_to_quintet( + (uint8_t) base32_character2, + &quintet4, + base32_variant, + error ) != 1 ) { libcerror_error_set( error, @@ -575,72 +577,53 @@ return( -1 ); } - libcerror_error_free( - error ); - } - else - { - *padding_size -= 2; + safe_padding_size -= 2; } } - else if( padding_character != 0 ) + else if( ( base32_variant & 0x0f000000UL ) != LIBUNA_BASE32_VARIANT_PADDING_NONE ) { - if( ( stream_index + base32_character_size ) > base32_stream_size ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing 3rd base32 character.", - function ); - - return( -1 ); - } - else - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing 4th base32 character.", - function ); + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, + "%s: missing 3rd or 4th base32 character.", + function ); - return( -1 ); - } + return( -1 ); } - if( ( stream_index + base32_character_size ) <= base32_stream_size ) + if( base32_character_size <= ( base32_stream_size - safe_base32_stream_index ) ) { switch( base32_variant & 0xf0000000UL ) { case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: - base32_character1 = base32_stream[ stream_index ]; + base32_character1 = base32_stream[ safe_base32_stream_index ]; break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_to_uint16_big_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_to_uint16_little_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_to_uint32_big_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_to_uint32_little_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); break; } - stream_index += base32_character_size; + safe_base32_stream_index += base32_character_size; if( ( base32_character1 & 0xffffff00UL ) != 0 ) { @@ -653,32 +636,38 @@ return( -1 ); } - if( ( padding_character != 0 ) - && ( base32_character1 == (uint32_t) padding_character ) ) - { - quintet5 = 0; - } - else if( *padding_size > 4 ) + if( base32_character1 == (uint32_t) '=' ) { - if( padding_character != 0 ) + if( ( base32_variant & 0x0f000000UL ) == LIBUNA_BASE32_VARIANT_PADDING_NONE ) { libcerror_error_set( error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, - "%s: invalid 5th base32 quintet.", + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, + "%s: padding where not supposed to - invalid 5th base32 character.", function ); return( -1 ); } } - else if( libuna_base32_character_copy_to_quintet( - (uint8_t) base32_character1, - &quintet5, - base32_variant, - error ) != 1 ) + else { - if( padding_character != 0 ) + if( safe_padding_size > 4 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, + "%s: non-padding where not supposed to - invalid 5th base32 character.", + function ); + + return( -1 ); + } + if( libuna_base32_character_copy_to_quintet( + (uint8_t) base32_character1, + &quintet5, + base32_variant, + error ) != 1 ) { libcerror_error_set( error, @@ -689,15 +678,10 @@ return( -1 ); } - libcerror_error_free( - error ); - } - else - { - *padding_size -= 1; + safe_padding_size -= 1; } } - else if( padding_character != 0 ) + else if( ( base32_variant & 0x0f000000UL ) != LIBUNA_BASE32_VARIANT_PADDING_NONE ) { libcerror_error_set( error, @@ -708,56 +692,56 @@ return( -1 ); } - if( ( stream_index + ( 2 * base32_character_size ) ) <= base32_stream_size ) + if( ( 2 * base32_character_size ) <= ( base32_stream_size - safe_base32_stream_index ) ) { switch( base32_variant & 0xf0000000UL ) { case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: - base32_character1 = base32_stream[ stream_index ]; - base32_character2 = base32_stream[ stream_index + 1 ]; + base32_character1 = base32_stream[ safe_base32_stream_index ]; + base32_character2 = base32_stream[ safe_base32_stream_index + 1 ]; break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_to_uint16_big_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); byte_stream_copy_to_uint16_big_endian( - &( base32_stream[ stream_index + 2 ] ), + &( base32_stream[ safe_base32_stream_index + 2 ] ), base32_character2 ); break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_to_uint16_little_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); byte_stream_copy_to_uint16_little_endian( - &( base32_stream[ stream_index + 2 ] ), + &( base32_stream[ safe_base32_stream_index + 2 ] ), base32_character2 ); break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_to_uint32_big_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); byte_stream_copy_to_uint32_big_endian( - &( base32_stream[ stream_index + 4 ] ), + &( base32_stream[ safe_base32_stream_index + 4 ] ), base32_character2 ); break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_to_uint32_little_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); byte_stream_copy_to_uint32_little_endian( - &( base32_stream[ stream_index + 4 ] ), + &( base32_stream[ safe_base32_stream_index + 4 ] ), base32_character2 ); break; } - stream_index += 2 * base32_character_size; + safe_base32_stream_index += 2 * base32_character_size; if( ( base32_character1 & 0xffffff00UL ) != 0 ) { @@ -781,11 +765,21 @@ return( -1 ); } - if( ( padding_character != 0 ) - && ( ( base32_character1 == (uint32_t) padding_character ) - || ( base32_character2 == (uint32_t) padding_character ) ) ) + if( ( base32_character1 == (uint32_t) '=' ) + || ( base32_character2 == (uint32_t) '=' ) ) { - if( base32_character1 != (uint32_t) padding_character ) + if( ( base32_variant & 0x0f000000UL ) == LIBUNA_BASE32_VARIANT_PADDING_NONE ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, + "%s: padding where not supposed to - invalid 6th or 7th base32 character.", + function ); + + return( -1 ); + } + if( base32_character1 != (uint32_t) '=' ) { libcerror_error_set( error, @@ -796,7 +790,7 @@ return( -1 ); } - if( base32_character2 != (uint32_t) padding_character ) + if( base32_character2 != (uint32_t) '=' ) { libcerror_error_set( error, @@ -807,30 +801,25 @@ return( -1 ); } - quintet6 = 0; - quintet7 = 0; } - else if( *padding_size > 3 ) + else { - if( padding_character != 0 ) + if( safe_padding_size > 3 ) { libcerror_error_set( error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, - "%s: invalid 6th and 7th base32 quintet.", + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, + "%s: non-padding where not supposed to - invalid 6th or 7th base32 character.", function ); return( -1 ); } - } - else if( libuna_base32_character_copy_to_quintet( - (uint8_t) base32_character1, - &quintet6, - base32_variant, - error ) != 1 ) - { - if( padding_character != 0 ) + if( libuna_base32_character_copy_to_quintet( + (uint8_t) base32_character1, + &quintet6, + base32_variant, + error ) != 1 ) { libcerror_error_set( error, @@ -841,16 +830,11 @@ return( -1 ); } - libcerror_error_free( - error ); - } - else if( libuna_base32_character_copy_to_quintet( - (uint8_t) base32_character2, - &quintet7, - base32_variant, - error ) != 1 ) - { - if( padding_character != 0 ) + if( libuna_base32_character_copy_to_quintet( + (uint8_t) base32_character2, + &quintet7, + base32_variant, + error ) != 1 ) { libcerror_error_set( error, @@ -861,72 +845,53 @@ return( -1 ); } - libcerror_error_free( - error ); - } - else - { - *padding_size -= 2; + safe_padding_size -= 2; } } - else if( padding_character != 0 ) + else if( ( base32_variant & 0x0f000000UL ) != LIBUNA_BASE32_VARIANT_PADDING_NONE ) { - if( ( stream_index + base32_character_size ) > base32_stream_size ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing 6th base32 character.", - function ); - - return( -1 ); - } - else - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing 7th base32 character.", - function ); + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, + "%s: missing 6th or 7th base32 character.", + function ); - return( -1 ); - } + return( -1 ); } - if( ( stream_index + base32_character_size ) <= base32_stream_size ) + if( base32_character_size <= ( base32_stream_size - safe_base32_stream_index ) ) { switch( base32_variant & 0xf0000000UL ) { case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: - base32_character1 = base32_stream[ stream_index ]; + base32_character1 = base32_stream[ safe_base32_stream_index ]; break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_to_uint16_big_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_to_uint16_little_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_to_uint32_big_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); break; case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_to_uint32_little_endian( - &( base32_stream[ stream_index ] ), + &( base32_stream[ safe_base32_stream_index ] ), base32_character1 ); break; } - stream_index += base32_character_size; + safe_base32_stream_index += base32_character_size; if( ( base32_character1 & 0xffffff00UL ) != 0 ) { @@ -939,32 +904,38 @@ return( -1 ); } - if( ( padding_character != 0 ) - && ( base32_character1 == (uint32_t) padding_character ) ) - { - quintet8 = 0; - } - else if( *padding_size > 1 ) + if( base32_character1 == (uint32_t) '=' ) { - if( padding_character != 0 ) + if( ( base32_variant & 0x0f000000UL ) == LIBUNA_BASE32_VARIANT_PADDING_NONE ) { libcerror_error_set( error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, - "%s: invalid 8th base32 quintet.", + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, + "%s: padding where not supposed to - invalid 8th base32 character.", function ); return( -1 ); } } - else if( libuna_base32_character_copy_to_quintet( - (uint8_t) base32_character1, - &quintet8, - base32_variant, - error ) != 1 ) + else { - if( padding_character != 0 ) + if( safe_padding_size > 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, + "%s: non-padding where not supposed to - invalid 8th base32 character.", + function ); + + return( -1 ); + } + if( libuna_base32_character_copy_to_quintet( + (uint8_t) base32_character1, + &quintet8, + base32_variant, + error ) != 1 ) { libcerror_error_set( error, @@ -975,15 +946,10 @@ return( -1 ); } - libcerror_error_free( - error ); - } - else - { - *padding_size -= 1; + safe_padding_size -= 1; } } - else if( padding_character != 0 ) + else if( ( base32_variant & 0x0f000000UL ) != LIBUNA_BASE32_VARIANT_PADDING_NONE ) { libcerror_error_set( error, @@ -994,23 +960,25 @@ return( -1 ); } - *base32_quintuplet = quintet1; - *base32_quintuplet <<= 5; - *base32_quintuplet |= quintet2; - *base32_quintuplet <<= 5; - *base32_quintuplet |= quintet3; - *base32_quintuplet <<= 5; - *base32_quintuplet |= quintet4; - *base32_quintuplet <<= 5; - *base32_quintuplet |= quintet5; - *base32_quintuplet <<= 5; - *base32_quintuplet |= quintet6; - *base32_quintuplet <<= 5; - *base32_quintuplet |= quintet7; - *base32_quintuplet <<= 5; - *base32_quintuplet |= quintet8; - - *base32_stream_index = stream_index; + safe_base32_quintuplet = quintet1; + safe_base32_quintuplet <<= 5; + safe_base32_quintuplet |= quintet2; + safe_base32_quintuplet <<= 5; + safe_base32_quintuplet |= quintet3; + safe_base32_quintuplet <<= 5; + safe_base32_quintuplet |= quintet4; + safe_base32_quintuplet <<= 5; + safe_base32_quintuplet |= quintet5; + safe_base32_quintuplet <<= 5; + safe_base32_quintuplet |= quintet6; + safe_base32_quintuplet <<= 5; + safe_base32_quintuplet |= quintet7; + safe_base32_quintuplet <<= 5; + safe_base32_quintuplet |= quintet8; + + *base32_stream_index = safe_base32_stream_index; + *base32_quintuplet = safe_base32_quintuplet; + *padding_size = safe_padding_size; return( 1 ); } @@ -1029,7 +997,10 @@ { uint8_t *quintet_to_character_table = NULL; static char *function = "libuna_base32_quintuplet_copy_to_base32_stream"; - uint8_t padding_character = 0; + size_t base32_character_size = 0; + size_t safe_base32_stream_index = 0; + uint32_t base32_character1 = 0; + uint32_t base32_character2 = 0; uint8_t quintet1 = 0; uint8_t quintet2 = 0; uint8_t quintet3 = 0; @@ -1118,11 +1089,33 @@ { case LIBUNA_BASE32_VARIANT_PADDING_NONE: case LIBUNA_BASE32_VARIANT_PADDING_OPTIONAL: - padding_character = 0; + case LIBUNA_BASE32_VARIANT_PADDING_REQUIRED: break; - case LIBUNA_BASE32_VARIANT_PADDING_REQUIRED: - padding_character = (uint8_t) '='; + default: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, + "%s: unsupported base32 variant.", + function ); + + return( -1 ); + } + switch( base32_variant & 0xf0000000UL ) + { + case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: + base32_character_size = 1; + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: + base32_character_size = 2; + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: + base32_character_size = 4; break; default: @@ -1135,7 +1128,7 @@ return( -1 ); } -/* TODO encoding support */ + safe_base32_stream_index = *base32_stream_index; /* Separate the 3 bytes value into 8 x 5 bit values */ @@ -1157,130 +1150,337 @@ /* Spread the encoding over 2 characters if 1 byte is available */ - if( ( *base32_stream_index + 1 ) >= base32_stream_size ) + if( ( 2 * base32_character_size ) > ( base32_stream_size - safe_base32_stream_index ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: base32 stream is too small.", + "%s: base32 stream is too small - insufficient space for 1st and 2nd base32 characters.", function ); return( -1 ); } - base32_stream[ *base32_stream_index ] = quintet_to_character_table[ quintet1 ]; - base32_stream[ *base32_stream_index + 1 ] = quintet_to_character_table[ quintet2 ]; - - *base32_stream_index += 2; + base32_character1 = (uint32_t) quintet_to_character_table[ quintet1 ]; + base32_character2 = (uint32_t) quintet_to_character_table[ quintet2 ]; - /* Spread the encoding over 4 characters if 2 bytes are available - * Otherwise pad the remaining bytes if required - */ - if( ( *base32_stream_index + 1 ) >= base32_stream_size ) + switch( base32_variant & 0xf0000000UL ) { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: base32 stream is too small.", - function ); + case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: + base32_stream[ safe_base32_stream_index ] = (uint8_t) base32_character1; + base32_stream[ safe_base32_stream_index + 1 ] = (uint8_t) base32_character2; + break; - return( -1 ); - } - if( padding_size < 6 ) - { - base32_stream[ *base32_stream_index ] = quintet_to_character_table[ quintet3 ]; - base32_stream[ *base32_stream_index + 1 ] = quintet_to_character_table[ quintet4 ]; + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: + byte_stream_copy_from_uint16_big_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); - *base32_stream_index += 2; - } - else if( padding_character != 0 ) - { - base32_stream[ *base32_stream_index ] = padding_character; - base32_stream[ *base32_stream_index + 1 ] = padding_character; + byte_stream_copy_from_uint16_big_endian( + &( base32_stream[ safe_base32_stream_index + 2 ] ), + base32_character2 ); + break; - *base32_stream_index += 2; - } - /* Spread the encoding over 5 characters if 3 bytes are available - * Otherwise pad the remaining bytes if required - */ - if( *base32_stream_index >= base32_stream_size ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: base32 stream is too small.", - function ); + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: + byte_stream_copy_from_uint16_little_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); - return( -1 ); - } - if( padding_size < 4 ) - { - base32_stream[ *base32_stream_index ] = quintet_to_character_table[ quintet5 ]; + byte_stream_copy_from_uint16_little_endian( + &( base32_stream[ safe_base32_stream_index + 2 ] ), + base32_character2 ); + break; - *base32_stream_index += 1; - } - else if( padding_character != 0 ) - { - base32_stream[ *base32_stream_index ] = padding_character; + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: + byte_stream_copy_from_uint32_big_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); - *base32_stream_index += 1; - } - /* Spread the encoding over 7 characters if 4 bytes are available - * Otherwise pad the remaining bytes if required - */ - if( ( *base32_stream_index + 1 ) >= base32_stream_size ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: base32 stream is too small.", - function ); + byte_stream_copy_from_uint32_big_endian( + &( base32_stream[ safe_base32_stream_index + 4 ] ), + base32_character2 ); + break; - return( -1 ); - } - if( padding_size < 3 ) - { - base32_stream[ *base32_stream_index ] = quintet_to_character_table[ quintet6 ]; - base32_stream[ *base32_stream_index + 1 ] = quintet_to_character_table[ quintet7 ]; + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: + byte_stream_copy_from_uint32_little_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); - *base32_stream_index += 2; + byte_stream_copy_from_uint32_little_endian( + &( base32_stream[ safe_base32_stream_index + 4 ] ), + base32_character2 ); + break; } - else if( padding_character != 0 ) - { - base32_stream[ *base32_stream_index ] = padding_character; - base32_stream[ *base32_stream_index + 1 ] = padding_character; + safe_base32_stream_index += 2 * base32_character_size; - *base32_stream_index += 2; - } - /* Spread the encoding over 8 characters if 5 bytes are available + /* Spread the encoding over 4 characters if 2 bytes are available * Otherwise pad the remaining bytes if required */ - if( *base32_stream_index >= base32_stream_size ) + if( ( padding_size < 6 ) + || ( ( base32_variant & 0x0f000000UL ) != LIBUNA_BASE32_VARIANT_PADDING_NONE ) ) { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: base32 stream is too small.", - function ); + if( ( 2 * base32_character_size ) > ( base32_stream_size - safe_base32_stream_index ) ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, + "%s: base32 stream is too small - insufficient space for 3rd and 4th base32 characters.", + function ); - return( -1 ); - } - if( padding_size < 1 ) - { - base32_stream[ *base32_stream_index ] = quintet_to_character_table[ quintet8 ]; + return( -1 ); + } + if( padding_size < 6 ) + { + base32_character1 = (uint32_t) quintet_to_character_table[ quintet3 ]; + base32_character2 = (uint32_t) quintet_to_character_table[ quintet4 ]; + } + else + { + base32_character1 = (uint32_t) '='; + base32_character2 = (uint32_t) '='; + } + switch( base32_variant & 0xf0000000UL ) + { + case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: + base32_stream[ safe_base32_stream_index ] = (uint8_t) base32_character1; + base32_stream[ safe_base32_stream_index + 1 ] = (uint8_t) base32_character2; + break; - *base32_stream_index += 1; - } - else if( padding_character != 0 ) - { - base32_stream[ *base32_stream_index ] = padding_character; + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: + byte_stream_copy_from_uint16_big_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); + + byte_stream_copy_from_uint16_big_endian( + &( base32_stream[ safe_base32_stream_index + 2 ] ), + base32_character2 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: + byte_stream_copy_from_uint16_little_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); + + byte_stream_copy_from_uint16_little_endian( + &( base32_stream[ safe_base32_stream_index + 2 ] ), + base32_character2 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: + byte_stream_copy_from_uint32_big_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); + + byte_stream_copy_from_uint32_big_endian( + &( base32_stream[ safe_base32_stream_index + 4 ] ), + base32_character2 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: + byte_stream_copy_from_uint32_little_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); + + byte_stream_copy_from_uint32_little_endian( + &( base32_stream[ safe_base32_stream_index + 4 ] ), + base32_character2 ); + break; + } + safe_base32_stream_index += 2 * base32_character_size; + } + /* Spread the encoding over 5 characters if 3 bytes are available + * Otherwise pad the remaining bytes if required + */ + if( ( padding_size < 4 ) + || ( ( base32_variant & 0x0f000000UL ) != LIBUNA_BASE32_VARIANT_PADDING_NONE ) ) + { + if( base32_character_size > ( base32_stream_size - safe_base32_stream_index ) ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, + "%s: base32 stream is too small - insufficient space for 5th base32 character.", + function ); + + return( -1 ); + } + if( padding_size < 4 ) + { + base32_character1 = (uint32_t) quintet_to_character_table[ quintet5 ]; + } + else + { + base32_character1 = (uint32_t) '='; + } + switch( base32_variant & 0xf0000000UL ) + { + case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: + base32_stream[ safe_base32_stream_index ] = (uint8_t) base32_character1; + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: + byte_stream_copy_from_uint16_big_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: + byte_stream_copy_from_uint16_little_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: + byte_stream_copy_from_uint32_big_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: + byte_stream_copy_from_uint32_little_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); + break; + } + safe_base32_stream_index += base32_character_size; + } + /* Spread the encoding over 7 characters if 4 bytes are available + * Otherwise pad the remaining bytes if required + */ + if( ( padding_size < 3 ) + || ( ( base32_variant & 0x0f000000UL ) != LIBUNA_BASE32_VARIANT_PADDING_NONE ) ) + { + if( ( 2 * base32_character_size ) > ( base32_stream_size - safe_base32_stream_index ) ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, + "%s: base32 stream is too small - insufficient space for 6th and 7th base32 characters.", + function ); + + return( -1 ); + } + if( padding_size < 3 ) + { + base32_character1 = (uint32_t) quintet_to_character_table[ quintet6 ]; + base32_character2 = (uint32_t) quintet_to_character_table[ quintet7 ]; + } + else + { + base32_character1 = (uint32_t) '='; + base32_character2 = (uint32_t) '='; + } + switch( base32_variant & 0xf0000000UL ) + { + case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: + base32_stream[ safe_base32_stream_index ] = (uint8_t) base32_character1; + base32_stream[ safe_base32_stream_index + 1 ] = (uint8_t) base32_character2; + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: + byte_stream_copy_from_uint16_big_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); + + byte_stream_copy_from_uint16_big_endian( + &( base32_stream[ safe_base32_stream_index + 2 ] ), + base32_character2 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: + byte_stream_copy_from_uint16_little_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); + + byte_stream_copy_from_uint16_little_endian( + &( base32_stream[ safe_base32_stream_index + 2 ] ), + base32_character2 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: + byte_stream_copy_from_uint32_big_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); + + byte_stream_copy_from_uint32_big_endian( + &( base32_stream[ safe_base32_stream_index + 4 ] ), + base32_character2 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: + byte_stream_copy_from_uint32_little_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); + + byte_stream_copy_from_uint32_little_endian( + &( base32_stream[ safe_base32_stream_index + 4 ] ), + base32_character2 ); + break; + } + safe_base32_stream_index += 2 * base32_character_size; + } + /* Spread the encoding over 8 characters if 5 bytes are available + * Otherwise pad the remaining bytes if required + */ + if( ( padding_size < 1 ) + || ( ( base32_variant & 0x0f000000UL ) != LIBUNA_BASE32_VARIANT_PADDING_NONE ) ) + { + if( base32_character_size > ( base32_stream_size - safe_base32_stream_index ) ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, + "%s: base32 stream is too small - insufficient space for 8th base32 character.", + function ); + + return( -1 ); + } + if( padding_size < 1 ) + { + base32_character1 = (uint32_t) quintet_to_character_table[ quintet8 ]; + } + else + { + base32_character1 = (uint32_t) '='; + } + switch( base32_variant & 0xf0000000UL ) + { + case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: + base32_stream[ safe_base32_stream_index ] = (uint8_t) base32_character1; + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: + byte_stream_copy_from_uint16_big_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: + byte_stream_copy_from_uint16_little_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: + byte_stream_copy_from_uint32_big_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: + byte_stream_copy_from_uint32_little_endian( + &( base32_stream[ safe_base32_stream_index ] ), + base32_character1 ); + break; + } + safe_base32_stream_index += base32_character_size; + } + *base32_stream_index = safe_base32_stream_index; - *base32_stream_index += 1; - } return( 1 ); } @@ -1295,7 +1495,10 @@ uint8_t *padding_size, libcerror_error_t **error ) { - static char *function = "libuna_base32_quintuplet_copy_from_byte_stream"; + static char *function = "libuna_base32_quintuplet_copy_from_byte_stream"; + size_t safe_byte_stream_index = 0; + uint64_t safe_base32_quintuplet = 0; + uint8_t safe_padding_size = 0; if( base32_quintuplet == NULL ) { @@ -1352,36 +1555,56 @@ return( -1 ); } + if( padding_size == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid padding size.", + function ); + + return( -1 ); + } /* Determine the value of 5 bytes (40 bits) */ - *base32_quintuplet = (uint64_t) byte_stream[ *byte_stream_index ] << 32; - *byte_stream_index += 1; - *padding_size = 6; + safe_byte_stream_index = *byte_stream_index; - if( *byte_stream_index < byte_stream_size ) + safe_base32_quintuplet = byte_stream[ safe_byte_stream_index++ ]; + safe_padding_size = 6; + + safe_base32_quintuplet <<= 8; + + if( safe_byte_stream_index < byte_stream_size ) { - *base32_quintuplet |= (uint64_t) byte_stream[ *byte_stream_index ] << 24; - *byte_stream_index += 1; - *padding_size -= 2; + safe_base32_quintuplet |= byte_stream[ safe_byte_stream_index++ ]; + safe_padding_size -= 2; } - if( *byte_stream_index < byte_stream_size ) + safe_base32_quintuplet <<= 8; + + if( safe_byte_stream_index < byte_stream_size ) { - *base32_quintuplet |= (uint64_t) byte_stream[ *byte_stream_index ] << 16; - *byte_stream_index += 1; - *padding_size -= 1; + safe_base32_quintuplet |= byte_stream[ safe_byte_stream_index++ ]; + safe_padding_size -= 1; } - if( *byte_stream_index < byte_stream_size ) + safe_base32_quintuplet <<= 8; + + if( safe_byte_stream_index < byte_stream_size ) { - *base32_quintuplet |= (uint64_t) byte_stream[ *byte_stream_index ] << 8; - *byte_stream_index += 1; - *padding_size -= 2; + safe_base32_quintuplet |= byte_stream[ safe_byte_stream_index++ ]; + safe_padding_size -= 2; } - if( *byte_stream_index < byte_stream_size ) + safe_base32_quintuplet <<= 8; + + if( safe_byte_stream_index < byte_stream_size ) { - *base32_quintuplet |= (uint64_t) byte_stream[ *byte_stream_index ]; - *byte_stream_index += 1; - *padding_size -= 1; + safe_base32_quintuplet |= byte_stream[ safe_byte_stream_index++ ]; + safe_padding_size -= 1; } + *base32_quintuplet = safe_base32_quintuplet; + *byte_stream_index = safe_byte_stream_index; + *padding_size = safe_padding_size; + return( 1 ); } @@ -1396,7 +1619,8 @@ uint8_t padding_size, libcerror_error_t **error ) { - static char *function = "libuna_base32_quintuplet_copy_to_byte_stream"; + static char *function = "libuna_base32_quintuplet_copy_to_byte_stream"; + size_t safe_byte_stream_index = 0; if( byte_stream == NULL ) { @@ -1453,13 +1677,13 @@ return( -1 ); } - byte_stream[ *byte_stream_index ] = (uint8_t) ( ( base32_quintuplet >> 32 ) & 0xff ); + safe_byte_stream_index = *byte_stream_index; - *byte_stream_index += 1; + byte_stream[ safe_byte_stream_index++ ] = (uint8_t) ( ( base32_quintuplet >> 32 ) & 0xff ); if( padding_size <= 4 ) { - if( *byte_stream_index >= byte_stream_size ) + if( safe_byte_stream_index >= byte_stream_size ) { libcerror_error_set( error, @@ -1470,13 +1694,11 @@ return( -1 ); } - byte_stream[ *byte_stream_index ] = (uint8_t) ( ( base32_quintuplet >> 24 ) & 0xff ); - - *byte_stream_index += 1; + byte_stream[ safe_byte_stream_index++ ] = (uint8_t) ( ( base32_quintuplet >> 24 ) & 0xff ); } if( padding_size <= 3 ) { - if( *byte_stream_index >= byte_stream_size ) + if( safe_byte_stream_index >= byte_stream_size ) { libcerror_error_set( error, @@ -1487,13 +1709,11 @@ return( -1 ); } - byte_stream[ *byte_stream_index ] = (uint8_t) ( ( base32_quintuplet >> 16 ) & 0xff ); - - *byte_stream_index += 1; + byte_stream[ safe_byte_stream_index++ ] = (uint8_t) ( ( base32_quintuplet >> 16 ) & 0xff ); } if( padding_size <= 2 ) { - if( *byte_stream_index >= byte_stream_size ) + if( safe_byte_stream_index >= byte_stream_size ) { libcerror_error_set( error, @@ -1504,13 +1724,11 @@ return( -1 ); } - byte_stream[ *byte_stream_index ] = (uint8_t) ( ( base32_quintuplet >> 8 ) & 0xff ); - - *byte_stream_index += 1; + byte_stream[ safe_byte_stream_index++ ] = (uint8_t) ( ( base32_quintuplet >> 8 ) & 0xff ); } if( padding_size == 0 ) { - if( *byte_stream_index >= byte_stream_size ) + if( safe_byte_stream_index >= byte_stream_size ) { libcerror_error_set( error, @@ -1521,10 +1739,10 @@ return( -1 ); } - byte_stream[ *byte_stream_index ] = (uint8_t) ( base32_quintuplet & 0xff ); - - *byte_stream_index += 1; + byte_stream[ safe_byte_stream_index++ ] = (uint8_t) ( base32_quintuplet & 0xff ); } + *byte_stream_index = safe_byte_stream_index; + return( 1 ); } @@ -1543,13 +1761,17 @@ uint8_t flags, libcerror_error_t **error ) { - static char *function = "libuna_base32_stream_size_to_byte_stream"; - size_t base32_stream_index = 0; - size_t number_of_characters = 0; - size_t whitespace_size = 0; - uint8_t character_limit = 0; - uint8_t padding_size = 0; - uint8_t strip_mode = LIBUNA_STRIP_MODE_LEADING_WHITESPACE; + static char *function = "libuna_base32_stream_size_to_byte_stream"; + size_t base32_character_size = 0; + size_t base32_stream_index = 0; + size_t number_of_characters = 0; + size_t safe_byte_stream_size = 0; + size_t whitespace_size = 0; + uint32_t base32_character1 = 0; + uint32_t base32_character2 = 0; + uint8_t character_limit = 0; + uint8_t padding_size = 0; + uint8_t strip_mode = LIBUNA_STRIP_MODE_LEADING_WHITESPACE; if( base32_stream == NULL ) { @@ -1562,14 +1784,13 @@ return( -1 ); } - if( ( base32_stream_size == 0 ) - || ( base32_stream_size > (size_t) SSIZE_MAX ) ) + if( base32_stream_size > (size_t) SSIZE_MAX ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS, - "%s: invalid base32 stream size value out of bounds.", + LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM, + "%s: invalid base32 stream size value exceeds maximum.", function ); return( -1 ); @@ -1608,9 +1829,33 @@ switch( base32_variant & 0x000f0000UL ) { case LIBUNA_BASE32_VARIANT_ALPHABET_NORMAL: + case LIBUNA_BASE32_VARIANT_ALPHABET_HEX: break; - case LIBUNA_BASE32_VARIANT_ALPHABET_HEX: + default: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, + "%s: unsupported base32 variant.", + function ); + + return( -1 ); + } + switch( base32_variant & 0xf0000000UL ) + { + case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: + base32_character_size = 1; + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: + base32_character_size = 2; + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: + base32_character_size = 4; break; default: @@ -1634,79 +1879,167 @@ return( -1 ); } - base32_stream_index = base32_stream_size - 1; - whitespace_size = 0; - - while( base32_stream_index > 0 ) + /* Ignore trailing whitespace + */ + if( base32_stream_size > base32_character_size ) { - if( ( base32_stream[ base32_stream_index ] == (uint8_t) '\n' ) - || ( base32_stream[ base32_stream_index ] == (uint8_t) '\r' ) ) - { - whitespace_size++; - } - else if( ( base32_stream[ base32_stream_index ] == (uint8_t) ' ' ) - || ( base32_stream[ base32_stream_index ] == (uint8_t) '\t' ) - || ( base32_stream[ base32_stream_index ] == (uint8_t) '\v' ) ) + base32_stream_index = base32_stream_size - base32_character_size; + whitespace_size = 0; + + while( base32_stream_index > base32_character_size ) { - if( ( flags & LIBUNA_BASE32_FLAG_STRIP_WHITESPACE ) != 0 ) + switch( base32_variant & 0xf0000000UL ) { - whitespace_size++; + case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: + base32_character1 = base32_stream[ base32_stream_index ]; + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: + byte_stream_copy_to_uint16_big_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: + byte_stream_copy_to_uint16_little_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: + byte_stream_copy_to_uint32_big_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: + byte_stream_copy_to_uint32_little_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + } + base32_stream_index -= base32_character_size; + + if( ( base32_character1 == (uint32_t) '\n' ) + || ( base32_character1 == (uint32_t) '\r' ) ) + { + whitespace_size += base32_character_size; + + continue; + } + else if( ( flags & LIBUNA_BASE32_FLAG_STRIP_WHITESPACE ) == 0 ) + { + break; + } + if( ( base32_character1 == (uint32_t) ' ' ) + || ( base32_character1 == (uint32_t) '\t' ) + || ( base32_character1 == (uint32_t) '\v' ) ) + { + whitespace_size += base32_character_size; } else { break; } } - else - { - break; - } - base32_stream_index--; - } - base32_stream_size -= whitespace_size; - - if( base32_stream[ base32_stream_size - 1 ] == (uint8_t) '=' ) - { - padding_size += 1; - } - if( base32_stream[ base32_stream_size - 2 ] == (uint8_t) '=' ) - { - padding_size += 1; - } - if( base32_stream[ base32_stream_size - 3 ] == (uint8_t) '=' ) - { - padding_size += 1; - } - if( base32_stream[ base32_stream_size - 4 ] == (uint8_t) '=' ) - { - padding_size += 1; - } - if( base32_stream[ base32_stream_size - 5 ] == (uint8_t) '=' ) - { - padding_size += 1; + base32_stream_size -= whitespace_size; } - if( base32_stream[ base32_stream_size - 6 ] == (uint8_t) '=' ) - { - padding_size += 1; - } - if( base32_stream[ base32_stream_size - 7 ] == (uint8_t) '=' ) + /* Determine and ignore the padding + */ + if( base32_stream_size > base32_character_size ) { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_CONVERSION, - LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, - "%s: invalid number of padding bytes.", - function ); + base32_stream_index = base32_stream_size - base32_character_size; - return( -1 ); + while( ( base32_stream_index > base32_character_size ) + && ( padding_size <= 6 ) ) + { + switch( base32_variant & 0xf0000000UL ) + { + case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: + base32_character1 = base32_stream[ base32_stream_index ]; + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: + byte_stream_copy_to_uint16_big_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: + byte_stream_copy_to_uint16_little_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: + byte_stream_copy_to_uint32_big_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: + byte_stream_copy_to_uint32_little_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + } + base32_stream_index -= base32_character_size; + + if( base32_character1 == (uint32_t) '=' ) + { + padding_size += 1; + } + } + if( padding_size > 6 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, + "%s: invalid amount of padding - found more than 6 padding characters.", + function ); + + return( -1 ); + } + base32_stream_size -= padding_size * base32_character_size; } base32_stream_index = 0; whitespace_size = 0; - while( base32_stream_index < base32_stream_size ) + while( ( base32_stream_index + base32_character_size ) < base32_stream_size ) { - if( ( base32_stream[ base32_stream_index ] == (uint8_t) '\n' ) - || ( base32_stream[ base32_stream_index ] == (uint8_t) '\r' ) ) + switch( base32_variant & 0xf0000000UL ) + { + case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: + base32_character1 = base32_stream[ base32_stream_index ]; + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: + byte_stream_copy_to_uint16_big_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: + byte_stream_copy_to_uint16_little_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: + byte_stream_copy_to_uint32_big_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: + byte_stream_copy_to_uint32_little_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + } + if( ( base32_character1 == (uint32_t) '\n' ) + || ( base32_character1 == (uint32_t) '\r' ) ) { if( ( strip_mode != LIBUNA_STRIP_MODE_NON_WHITESPACE ) && ( strip_mode != LIBUNA_STRIP_MODE_TRAILING_WHITESPACE ) ) @@ -1715,19 +2048,52 @@ } else { - if( base32_stream_index < base32_stream_size ) + /* Handle multi-character end-of-line + */ + if( ( base32_stream_index + base32_character_size ) < base32_stream_size ) { - if( ( base32_stream[ base32_stream_index + 1 ] == (uint8_t) '\n' ) - || ( base32_stream[ base32_stream_index + 1 ] == (uint8_t) '\r' ) ) + switch( base32_variant & 0xf0000000UL ) + { + case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: + base32_character2 = base32_stream[ base32_stream_index + 1 ]; + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: + byte_stream_copy_to_uint16_big_endian( + &( base32_stream[ base32_stream_index + 2 ] ), + base32_character2 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: + byte_stream_copy_to_uint16_little_endian( + &( base32_stream[ base32_stream_index + 2 ] ), + base32_character2 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: + byte_stream_copy_to_uint32_big_endian( + &( base32_stream[ base32_stream_index + 4 ] ), + base32_character2 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: + byte_stream_copy_to_uint32_little_endian( + &( base32_stream[ base32_stream_index + 4 ] ), + base32_character2 ); + break; + } + if( ( base32_character2 == (uint32_t) '\n' ) + || ( base32_character2 == (uint32_t) '\r' ) ) { - base32_stream_index++; + base32_stream_index += base32_character_size; - whitespace_size++; + whitespace_size += base32_character_size; } } strip_mode = LIBUNA_STRIP_MODE_LEADING_WHITESPACE; } - if( character_limit != 0 ) + if( ( number_of_characters != 0 ) + && ( character_limit != 0 ) ) { if( number_of_characters != (size_t) character_limit ) { @@ -1735,20 +2101,26 @@ error, LIBCERROR_ERROR_DOMAIN_CONVERSION, LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, - "%s: number of characters in line does not match character limit.", - function ); + "%s: number of characters in line: %" PRIzd " does not match character limit: %" PRIu8 ".", + function, + number_of_characters, + character_limit ); return( -1 ); } number_of_characters = 0; } - whitespace_size++; + whitespace_size += base32_character_size; } - else if( ( base32_stream[ base32_stream_index ] == (uint8_t) ' ' ) - || ( base32_stream[ base32_stream_index ] == (uint8_t) '\t' ) - || ( base32_stream[ base32_stream_index ] == (uint8_t) '\v' ) ) + else if( ( base32_character1 == (uint32_t) ' ' ) + || ( base32_character1 == (uint32_t) '\t' ) + || ( base32_character1 == (uint32_t) '\v' ) ) { - if( ( flags & LIBUNA_BASE32_FLAG_STRIP_WHITESPACE ) != 0 ) + if( ( flags & LIBUNA_BASE32_FLAG_STRIP_WHITESPACE ) == 0 ) + { + strip_mode = LIBUNA_STRIP_MODE_INVALID_CHARACTER; + } + else { if( strip_mode == LIBUNA_STRIP_MODE_NON_WHITESPACE ) { @@ -1761,13 +2133,9 @@ } else { - whitespace_size++; + whitespace_size += base32_character_size; } } - else - { - strip_mode = LIBUNA_STRIP_MODE_INVALID_CHARACTER; - } } else if( strip_mode == LIBUNA_STRIP_MODE_LEADING_WHITESPACE ) { @@ -1785,23 +2153,23 @@ /* A-Z is not a continous range on an EBCDIC based system * it consists of the ranges: A-I, J-R, S-Z */ - if( ( base32_stream[ base32_stream_index ] >= (uint8_t) 'A' ) - && ( base32_stream[ base32_stream_index ] <= (uint8_t) 'I' ) ) + if( ( base32_character1 >= (uint32_t) 'A' ) + && ( base32_character1 <= (uint32_t) 'I' ) ) { number_of_characters++; } - else if( ( base32_stream[ base32_stream_index ] >= (uint8_t) 'J' ) - && ( base32_stream[ base32_stream_index ] <= (uint8_t) 'R' ) ) + else if( ( base32_character1 >= (uint32_t) 'J' ) + && ( base32_character1 <= (uint32_t) 'R' ) ) { number_of_characters++; } - else if( ( base32_stream[ base32_stream_index ] >= (uint8_t) 'S' ) - && ( base32_stream[ base32_stream_index ] <= (uint8_t) 'Z' ) ) + else if( ( base32_character1 >= (uint32_t) 'S' ) + && ( base32_character1 <= (uint32_t) 'Z' ) ) { number_of_characters++; } - else if( ( base32_stream[ base32_stream_index ] >= (uint8_t) '2' ) - && ( base32_stream[ base32_stream_index ] <= (uint8_t) '7' ) ) + else if( ( base32_character1 >= (uint32_t) '2' ) + && ( base32_character1 <= (uint32_t) '7' ) ) { number_of_characters++; } @@ -1812,26 +2180,26 @@ break; case LIBUNA_BASE32_VARIANT_ALPHABET_HEX: - if( ( base32_stream[ base32_stream_index ] >= (uint8_t) '0' ) - && ( base32_stream[ base32_stream_index ] <= (uint8_t) '9' ) ) + if( ( base32_character1 >= (uint32_t) '0' ) + && ( base32_character1 <= (uint32_t) '9' ) ) { number_of_characters++; } /* A-V is not a continous range on an EBCDIC based system * it consists of the ranges: A-I, J-R, S-V */ - else if( ( base32_stream[ base32_stream_index ] >= (uint8_t) 'A' ) - && ( base32_stream[ base32_stream_index ] <= (uint8_t) 'I' ) ) + else if( ( base32_character1 >= (uint32_t) 'A' ) + && ( base32_character1 <= (uint32_t) 'I' ) ) { number_of_characters++; } - else if( ( base32_stream[ base32_stream_index ] >= (uint8_t) 'J' ) - && ( base32_stream[ base32_stream_index ] <= (uint8_t) 'R' ) ) + else if( ( base32_character1 >= (uint32_t) 'J' ) + && ( base32_character1 <= (uint32_t) 'R' ) ) { number_of_characters++; } - else if( ( base32_stream[ base32_stream_index ] >= (uint8_t) 'S' ) - && ( base32_stream[ base32_stream_index ] <= (uint8_t) 'V' ) ) + else if( ( base32_character1 >= (uint32_t) 'S' ) + && ( base32_character1 <= (uint32_t) 'V' ) ) { number_of_characters++; } @@ -1857,7 +2225,7 @@ return( -1 ); } - base32_stream_index++; + base32_stream_index += base32_character_size; } if( character_limit != 0 ) { @@ -1878,13 +2246,9 @@ /* Make sure the byte stream is able to hold * at least 5 bytes for each 8 base32 characters */ - *byte_stream_size = base32_stream_size / 8; + safe_byte_stream_size = ( base32_stream_size * 5 ) / ( base32_character_size * 8 ); - if( ( base32_stream_size % 8 ) != 0 ) - { - *byte_stream_size += 1; - } - *byte_stream_size *= 5; + *byte_stream_size = safe_byte_stream_size * base32_character_size; return( 1 ); } @@ -1905,14 +2269,18 @@ uint8_t flags, libcerror_error_t **error ) { - static char *function = "libuna_base32_stream_copy_to_byte_stream"; - size_t base32_stream_index = 0; - size_t byte_stream_index = 0; - size_t number_of_characters = 0; - uint64_t base32_quintuplet = 0; - uint8_t character_limit = 0; - uint8_t padding_size = 0; - uint8_t strip_mode = LIBUNA_STRIP_MODE_LEADING_WHITESPACE; + static char *function = "libuna_base32_stream_copy_to_byte_stream"; + size_t base32_character_size = 0; + size_t base32_stream_index = 0; + size_t byte_stream_index = 0; + size_t number_of_characters = 0; + size_t whitespace_size = 0; + uint64_t base32_quintuplet = 0; + uint32_t base32_character1 = 0; + uint32_t base32_character2 = 0; + uint8_t character_limit = 0; + uint8_t padding_size = 0; + uint8_t strip_mode = LIBUNA_STRIP_MODE_LEADING_WHITESPACE; if( base32_stream == NULL ) { @@ -1978,6 +2346,32 @@ return( -1 ); } + switch( base32_variant & 0xf0000000UL ) + { + case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: + base32_character_size = 1; + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: + base32_character_size = 2; + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: + base32_character_size = 4; + break; + + default: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, + "%s: unsupported base32 variant.", + function ); + + return( -1 ); + } if( ( flags & ~( LIBUNA_BASE32_FLAG_STRIP_WHITESPACE ) ) != 0 ) { libcerror_error_set( @@ -1989,14 +2383,111 @@ return( -1 ); } + /* Ignore trailing whitespace + */ + if( base32_stream_size > base32_character_size ) + { + base32_stream_index = base32_stream_size - base32_character_size; + whitespace_size = 0; + + while( base32_stream_index > base32_character_size ) + { + switch( base32_variant & 0xf0000000UL ) + { + case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: + base32_character1 = base32_stream[ base32_stream_index ]; + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: + byte_stream_copy_to_uint16_big_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: + byte_stream_copy_to_uint16_little_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: + byte_stream_copy_to_uint32_big_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: + byte_stream_copy_to_uint32_little_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + } + base32_stream_index -= base32_character_size; + + if( ( base32_character1 == (uint32_t) '\n' ) + || ( base32_character1 == (uint32_t) '\r' ) ) + { + whitespace_size += base32_character_size; + + continue; + } + else if( ( flags & LIBUNA_BASE32_FLAG_STRIP_WHITESPACE ) == 0 ) + { + break; + } + if( ( base32_character1 == (uint32_t) ' ' ) + || ( base32_character1 == (uint32_t) '\t' ) + || ( base32_character1 == (uint32_t) '\v' ) ) + { + whitespace_size += base32_character_size; + } + else + { + break; + } + } + base32_stream_size -= whitespace_size; + } if( ( flags & LIBUNA_BASE32_FLAG_STRIP_WHITESPACE ) == 0 ) { strip_mode = LIBUNA_STRIP_MODE_NON_WHITESPACE; } - while( base32_stream_index < base32_stream_size ) + base32_stream_index = 0; + + while( ( base32_stream_index + base32_character_size ) < base32_stream_size ) { - if( ( base32_stream[ base32_stream_index ] == (uint8_t) '\n' ) - || ( base32_stream[ base32_stream_index ] == (uint8_t) '\r' ) ) + switch( base32_variant & 0xf0000000UL ) + { + case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: + base32_character1 = base32_stream[ base32_stream_index ]; + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: + byte_stream_copy_to_uint16_big_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: + byte_stream_copy_to_uint16_little_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: + byte_stream_copy_to_uint32_big_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: + byte_stream_copy_to_uint32_little_endian( + &( base32_stream[ base32_stream_index ] ), + base32_character1 ); + break; + } + if( ( base32_character1 == (uint32_t) '\n' ) + || ( base32_character1 == (uint32_t) '\r' ) ) { if( ( strip_mode != LIBUNA_STRIP_MODE_NON_WHITESPACE ) && ( strip_mode != LIBUNA_STRIP_MODE_TRAILING_WHITESPACE ) ) @@ -2005,17 +2496,49 @@ } else { - if( base32_stream_index < base32_stream_size ) + /* Handle multi-character end-of-line + */ + if( ( base32_stream_index + base32_character_size ) < base32_stream_size ) { - if( ( base32_stream[ base32_stream_index + 1 ] == (uint8_t) '\n' ) - || ( base32_stream[ base32_stream_index + 1 ] == (uint8_t) '\r' ) ) + switch( base32_variant & 0xf0000000UL ) + { + case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: + base32_character2 = base32_stream[ base32_stream_index + 1 ]; + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: + byte_stream_copy_to_uint16_big_endian( + &( base32_stream[ base32_stream_index + 2 ] ), + base32_character2 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: + byte_stream_copy_to_uint16_little_endian( + &( base32_stream[ base32_stream_index + 2 ] ), + base32_character2 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: + byte_stream_copy_to_uint32_big_endian( + &( base32_stream[ base32_stream_index + 4 ] ), + base32_character2 ); + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: + byte_stream_copy_to_uint32_little_endian( + &( base32_stream[ base32_stream_index + 4 ] ), + base32_character2 ); + break; + } + if( ( base32_character2 == (uint32_t) '\n' ) + || ( base32_character2 == (uint32_t) '\r' ) ) { - base32_stream_index++; + base32_stream_index += base32_character_size; } } strip_mode = LIBUNA_STRIP_MODE_LEADING_WHITESPACE; - base32_stream_index++; + base32_stream_index += base32_character_size; } if( character_limit != 0 ) { @@ -2033,9 +2556,9 @@ number_of_characters = 0; } } - else if( ( base32_stream[ base32_stream_index ] == (uint8_t) ' ' ) - || ( base32_stream[ base32_stream_index ] == (uint8_t) '\t' ) - || ( base32_stream[ base32_stream_index ] == (uint8_t) '\v' ) ) + else if( ( base32_character1 == (uint32_t) ' ' ) + || ( base32_character1 == (uint32_t) '\t' ) + || ( base32_character1 == (uint32_t) '\v' ) ) { if( ( flags & LIBUNA_BASE32_FLAG_STRIP_WHITESPACE ) != 0 ) { @@ -2048,7 +2571,7 @@ { strip_mode = LIBUNA_STRIP_MODE_INVALID_CHARACTER; } - base32_stream_index++; + base32_stream_index += base32_character_size; } else { @@ -2157,9 +2680,11 @@ uint32_t base32_variant, libcerror_error_t **error ) { - static char *function = "libuna_base32_stream_size_from_byte_stream"; - size_t whitespace_size = 0; - uint8_t character_limit = 0; + static char *function = "libuna_base32_stream_size_from_byte_stream"; + size_t base32_character_size = 0; + size_t safe_base32_stream_size = 0; + size_t whitespace_size = 0; + uint8_t character_limit = 0; if( byte_stream == NULL ) { @@ -2214,27 +2739,55 @@ return( -1 ); } + switch( base32_variant & 0xf0000000UL ) + { + case LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM: + base32_character_size = 1; + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_BIG_ENDIAN: + case LIBUNA_BASE32_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: + base32_character_size = 2; + break; + + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_BIG_ENDIAN: + case LIBUNA_BASE32_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: + base32_character_size = 4; + break; + + default: + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, + "%s: unsupported base32 variant.", + function ); + + return( -1 ); + } /* Make sure the base32 stream is able to hold * at least 8 base32 characters for each 5 bytes */ - *base32_stream_size = byte_stream_size / 5; + safe_base32_stream_size = byte_stream_size / 5; if( ( byte_stream_size % 5 ) != 0 ) { - *base32_stream_size += 1; + safe_base32_stream_size += 1; } - *base32_stream_size *= 8; + safe_base32_stream_size *= 8; if( character_limit != 0 ) { - whitespace_size = *base32_stream_size / character_limit; + whitespace_size = safe_base32_stream_size / character_limit; - if( ( *base32_stream_size % character_limit ) != 0 ) + if( ( safe_base32_stream_size % character_limit ) != 0 ) { whitespace_size += 1; } - *base32_stream_size += whitespace_size; + safe_base32_stream_size += whitespace_size; } + *base32_stream_size = safe_base32_stream_size * base32_character_size; + return( 1 ); } @@ -2287,7 +2840,7 @@ { static char *function = "libuna_base32_stream_with_index_copy_from_byte_stream"; size_t calculated_base32_stream_size = 0; - size_t stream_index = 0; + size_t safe_base32_stream_index = 0; size_t byte_stream_index = 0; size_t number_of_characters = 0; size_t whitespace_size = 0; @@ -2381,7 +2934,7 @@ return( -1 ); } - stream_index = *base32_stream_index; + safe_base32_stream_index = *base32_stream_index; /* Make sure the base32 stream is able to hold * at least 8 base32 characters for each 5 bytes @@ -2442,7 +2995,7 @@ base32_quintuplet, base32_stream, base32_stream_size, - &stream_index, + &safe_base32_stream_index, padding_size, base32_variant, error ) != 1 ) @@ -2462,7 +3015,7 @@ if( number_of_characters >= (size_t) character_limit ) { - base32_stream[ stream_index++ ] = (uint8_t) '\n'; + base32_stream[ safe_base32_stream_index++ ] = (uint8_t) '\n'; number_of_characters = 0; } @@ -2472,10 +3025,10 @@ { if( number_of_characters != 0 ) { - base32_stream[ stream_index++ ] = (uint8_t) '\n'; + base32_stream[ safe_base32_stream_index++ ] = (uint8_t) '\n'; } } - *base32_stream_index = stream_index; + *base32_stream_index = safe_base32_stream_index; return( 1 ); } diff -Nru libsmdev-20171112/libuna/libuna_base32_stream.h libsmdev-20181227/libuna/libuna_base32_stream.h --- libsmdev-20171112/libuna/libuna_base32_stream.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_base32_stream.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Base32 stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_base64_stream.c libsmdev-20181227/libuna/libuna_base64_stream.c --- libsmdev-20171112/libuna/libuna_base64_stream.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_base64_stream.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Base64 stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -28,22 +28,29 @@ #include "libuna_libcerror.h" #include "libuna_types.h" -static uint8_t *libuna_base64_sixtet_to_character_table = \ - (uint8_t *) "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -static uint8_t *libuna_base64url_sixtet_to_character_table = \ - (uint8_t *) "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; +static uint8_t libuna_base64_sixtet_to_character_table[ 64 ] = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', + 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' }; + +static uint8_t libuna_base64url_sixtet_to_character_table[ 64 ] = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', + 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_' }; /* Copies a base64 character to a base64 sixtet - * Returns 1 if successful or -1 on error + * Returns 1 if successful, 0 if not a valid base64 character or -1 on error */ int libuna_base64_character_copy_to_sixtet( - uint8_t base64_character, + uint32_t base64_character, uint8_t *base64_sixtet, uint32_t base64_variant, libcerror_error_t **error ) { static char *function = "libuna_base64_character_copy_to_sixtet"; + uint32_t safe_base64_sixtet = 0; uint8_t base64_character_62 = 0; uint8_t base64_character_63 = 0; @@ -80,67 +87,65 @@ return( -1 ); } + if( ( base64_character & 0xffffff00UL ) != 0 ) + { + return( 0 ); + } /* A-Z is not a continous range on an EBCDIC based system * it consists of the ranges: A-I, J-R, S-Z */ - if( ( base64_character >= (uint8_t) 'A' ) - && ( base64_character <= (uint8_t) 'I' ) ) + if( ( base64_character >= (uint32_t) 'A' ) + && ( base64_character <= (uint32_t) 'I' ) ) { - *base64_sixtet = base64_character - (uint8_t) 'A'; + safe_base64_sixtet = base64_character - (uint32_t) 'A'; } - else if( ( base64_character >= (uint8_t) 'J' ) - && ( base64_character <= (uint8_t) 'R' ) ) + else if( ( base64_character >= (uint32_t) 'J' ) + && ( base64_character <= (uint32_t) 'R' ) ) { - *base64_sixtet = base64_character - (uint8_t) 'J' + 9; + safe_base64_sixtet = base64_character - (uint32_t) 'J' + 9; } - else if( ( base64_character >= (uint8_t) 'S' ) - && ( base64_character <= (uint8_t) 'Z' ) ) + else if( ( base64_character >= (uint32_t) 'S' ) + && ( base64_character <= (uint32_t) 'Z' ) ) { - *base64_sixtet = base64_character - (uint8_t) 'S' + 18; + safe_base64_sixtet = base64_character - (uint32_t) 'S' + 18; } /* a-z is not a continous range on an EBCDIC based system * it consists of the ranges: a-i, j-r, s-z */ - else if( ( base64_character >= (uint8_t) 'a' ) - && ( base64_character <= (uint8_t) 'i' ) ) + else if( ( base64_character >= (uint32_t) 'a' ) + && ( base64_character <= (uint32_t) 'i' ) ) { - *base64_sixtet = base64_character - (uint8_t) 'a' + 26; + safe_base64_sixtet = base64_character - (uint32_t) 'a' + 26; } - else if( ( base64_character >= (uint8_t) 'j' ) - && ( base64_character <= (uint8_t) 'r' ) ) + else if( ( base64_character >= (uint32_t) 'j' ) + && ( base64_character <= (uint32_t) 'r' ) ) { - *base64_sixtet = base64_character - (uint8_t) 'j' + 35; + safe_base64_sixtet = base64_character - (uint32_t) 'j' + 35; } - else if( ( base64_character >= (uint8_t) 's' ) - && ( base64_character <= (uint8_t) 'z' ) ) + else if( ( base64_character >= (uint32_t) 's' ) + && ( base64_character <= (uint32_t) 'z' ) ) { - *base64_sixtet = base64_character - (uint8_t) 's' + 44; + safe_base64_sixtet = base64_character - (uint32_t) 's' + 44; } - else if( ( base64_character >= (uint8_t) '0' ) - && ( base64_character <= (uint8_t) '9' ) ) + else if( ( base64_character >= (uint32_t) '0' ) + && ( base64_character <= (uint32_t) '9' ) ) { - *base64_sixtet = base64_character - (uint8_t) '0' + 52; + safe_base64_sixtet = base64_character - (uint32_t) '0' + 52; } else if( base64_character == base64_character_62 ) { - *base64_sixtet = 62; + safe_base64_sixtet = 62; } else if( base64_character == base64_character_63 ) { - *base64_sixtet = 63; + safe_base64_sixtet = 63; } else { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, - "%s: invalid base64 character: 0x%02" PRIx8 ".", - function, - base64_character ); - - return( -1 ); + return( 0 ); } + *base64_sixtet = (uint8_t) ( safe_base64_sixtet & 0xff ); + return( 1 ); } @@ -160,15 +165,17 @@ uint32_t base64_variant, libcerror_error_t **error ) { - static char *function = "libuna_base64_triplet_copy_from_base64_stream"; - size_t base64_character_size = 0; - size_t stream_index = 0; - uint32_t base64_character = 0; - uint8_t padding_character = 0; - uint8_t sixtet1 = 0; - uint8_t sixtet2 = 0; - uint8_t sixtet3 = 0; - uint8_t sixtet4 = 0; + static char *function = "libuna_base64_triplet_copy_from_base64_stream"; + size_t base64_character_size = 0; + size_t safe_base64_stream_index = 0; + uint32_t base64_character = 0; + uint32_t safe_base64_triplet = 0; + uint8_t safe_padding_size = 0; + uint8_t sixtet1 = 0; + uint8_t sixtet2 = 0; + uint8_t sixtet3 = 0; + uint8_t sixtet4 = 0; + int result = 0; if( base64_triplet == NULL ) { @@ -239,15 +246,9 @@ switch( base64_variant & 0x0f000000UL ) { case LIBUNA_BASE64_VARIANT_PADDING_NONE: - padding_character = 0; - break; - case LIBUNA_BASE64_VARIANT_PADDING_OPTIONAL: - padding_character = (uint8_t) '='; - break; - case LIBUNA_BASE64_VARIANT_PADDING_REQUIRED: - padding_character = (uint8_t) '='; + case LIBUNA_BASE64_VARIANT_PADDING_INVALID: break; default: @@ -286,9 +287,9 @@ return( -1 ); } - stream_index = *base64_stream_index; + safe_base64_stream_index = *base64_stream_index; - if( ( stream_index + base64_character_size ) > base64_stream_size ) + if( ( safe_base64_stream_index + base64_character_size ) > base64_stream_size ) { libcerror_error_set( error, @@ -302,62 +303,64 @@ switch( base64_variant & 0xf0000000UL ) { case LIBUNA_BASE64_VARIANT_ENCODING_BYTE_STREAM: - base64_character = base64_stream[ stream_index ]; + base64_character = base64_stream[ safe_base64_stream_index ]; break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_to_uint16_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_to_uint16_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_to_uint32_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_to_uint32_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; } - stream_index += base64_character_size; + safe_base64_stream_index += base64_character_size; - if( ( base64_character & 0xffffff00UL ) != 0 ) + result = libuna_base64_character_copy_to_sixtet( + base64_character, + &sixtet1, + base64_variant, + error ); + + if( result == -1 ) { libcerror_error_set( error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, - "%s: invalid 1st base64 character.", + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, + "%s: unable to copy base64 character to 1st sixtet.", function ); return( -1 ); } - if( libuna_base64_character_copy_to_sixtet( - (uint8_t) base64_character, - &sixtet1, - base64_variant, - error ) != 1 ) + else if( result == 0 ) { libcerror_error_set( error, - LIBCERROR_ERROR_DOMAIN_CONVERSION, - LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, - "%s: unable to copy base64 character to 1st sixtet.", + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, + "%s: invalid 1st base64 character.", function ); return( -1 ); } - if( ( stream_index + base64_character_size ) > base64_stream_size ) + if( ( safe_base64_stream_index + base64_character_size ) > base64_stream_size ) { libcerror_error_set( error, @@ -371,96 +374,98 @@ switch( base64_variant & 0xf0000000UL ) { case LIBUNA_BASE64_VARIANT_ENCODING_BYTE_STREAM: - base64_character = base64_stream[ stream_index ]; + base64_character = base64_stream[ safe_base64_stream_index ]; break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_to_uint16_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_to_uint16_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_to_uint32_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_to_uint32_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; } - stream_index += base64_character_size; + safe_base64_stream_index += base64_character_size; - if( ( base64_character & 0xffffff00UL ) != 0 ) + result = libuna_base64_character_copy_to_sixtet( + base64_character, + &sixtet2, + base64_variant, + error ); + + if( result == -1 ) { libcerror_error_set( error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, - "%s: invalid 2nd base64 character.", + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, + "%s: unable to copy base64 character to 2nd sixtet.", function ); return( -1 ); } - if( libuna_base64_character_copy_to_sixtet( - (uint8_t) base64_character, - &sixtet2, - base64_variant, - error ) != 1 ) + else if( result == 0 ) { libcerror_error_set( error, - LIBCERROR_ERROR_DOMAIN_CONVERSION, - LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, - "%s: unable to copy base64 character to 2nd sixtet.", + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, + "%s: invalid 2nd base64 character.", function ); return( -1 ); } - *padding_size = 2; + safe_padding_size = 2; - if( ( stream_index + base64_character_size ) <= base64_stream_size ) + if( ( safe_base64_stream_index + base64_character_size ) <= base64_stream_size ) { switch( base64_variant & 0xf0000000UL ) { case LIBUNA_BASE64_VARIANT_ENCODING_BYTE_STREAM: - base64_character = base64_stream[ stream_index ]; + base64_character = base64_stream[ safe_base64_stream_index ]; break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_to_uint16_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_to_uint16_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_to_uint32_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_to_uint32_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; } - stream_index += base64_character_size; + safe_base64_stream_index += base64_character_size; if( ( base64_character & 0xffffff00UL ) != 0 ) { @@ -473,37 +478,60 @@ return( -1 ); } - if( ( padding_character != 0 ) - && ( base64_character == (uint32_t) padding_character ) ) - { - sixtet3 = 0; - } - else if( libuna_base64_character_copy_to_sixtet( - (uint8_t) base64_character, - &sixtet3, - base64_variant, - error ) != 1 ) + if( base64_character == (uint32_t) '=' ) { - if( padding_character != 0 ) + if( ( base64_variant & 0x0f000000UL ) == LIBUNA_BASE64_VARIANT_PADDING_NONE ) { libcerror_error_set( error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, - "%s: invalid 3rd base64 sixtet.", + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, + "%s: padding where not supposed to - invalid 3rd base64 character.", function ); return( -1 ); } - libcerror_error_free( - error ); } else { - *padding_size -= 1; + result = libuna_base64_character_copy_to_sixtet( + base64_character, + &sixtet3, + base64_variant, + error ); + + if( result == -1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, + "%s: unable to copy base64 character to 3rd sixtet.", + function ); + + return( -1 ); + } + else if( result == 0 ) + { + if( ( base64_variant & 0x0f000000UL ) != LIBUNA_BASE64_VARIANT_PADDING_INVALID ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, + "%s: invalid 3rd base64 sixtet.", + function ); + + return( -1 ); + } + } + else + { + safe_padding_size -= 1; + } } } - else if( padding_character != 0 ) + else if( ( base64_variant & 0x0f000000UL ) != LIBUNA_BASE64_VARIANT_PADDING_NONE ) { libcerror_error_set( error, @@ -514,39 +542,39 @@ return( -1 ); } - if( ( stream_index + base64_character_size ) <= base64_stream_size ) + if( ( safe_base64_stream_index + base64_character_size ) <= base64_stream_size ) { switch( base64_variant & 0xf0000000UL ) { case LIBUNA_BASE64_VARIANT_ENCODING_BYTE_STREAM: - base64_character = base64_stream[ stream_index ]; + base64_character = base64_stream[ safe_base64_stream_index ]; break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_to_uint16_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_to_uint16_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_to_uint32_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_to_uint32_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; } - stream_index += base64_character_size; + safe_base64_stream_index += base64_character_size; if( ( base64_character & 0xffffff00UL ) != 0 ) { @@ -559,51 +587,71 @@ return( -1 ); } - if( ( padding_character != 0 ) - && ( base64_character == (uint32_t) padding_character ) ) - { - sixtet4 = 0; - } - else if( *padding_size > 1 ) + if( base64_character == (uint32_t) '=' ) { - if( padding_character != 0 ) + if( ( base64_variant & 0x0f000000UL ) == LIBUNA_BASE64_VARIANT_PADDING_NONE ) { libcerror_error_set( error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, - "%s: invalid 4th base64 sixtet.", + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, + "%s: padding where not supposed to - invalid 4th base64 character.", function ); return( -1 ); } } - else if( libuna_base64_character_copy_to_sixtet( - (uint8_t) base64_character, - &sixtet4, - base64_variant, - error ) != 1 ) + else { - if( padding_character != 0 ) + result = libuna_base64_character_copy_to_sixtet( + base64_character, + &sixtet4, + base64_variant, + error ); + + if( result == -1 ) { libcerror_error_set( error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, - "%s: invalid 4rd base64 sixtet.", + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, + "%s: unable to copy base64 character to 4th sixtet.", function ); return( -1 ); } - libcerror_error_free( - error ); - } - else - { - *padding_size -= 1; + else if( result == 0 ) + { + if( ( base64_variant & 0x0f000000UL ) != LIBUNA_BASE64_VARIANT_PADDING_INVALID ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, + "%s: invalid 4th base64 sixtet.", + function ); + + return( -1 ); + } + } + else + { + if( safe_padding_size > 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, + "%s: non-padding where not supposed to - invalid 4th base64 character.", + function ); + + return( -1 ); + } + safe_padding_size -= 1; + } } } - else if( padding_character != 0 ) + else if( ( base64_variant & 0x0f000000UL ) != LIBUNA_BASE64_VARIANT_PADDING_NONE ) { libcerror_error_set( error, @@ -614,15 +662,17 @@ return( -1 ); } - *base64_triplet = sixtet1; - *base64_triplet <<= 6; - *base64_triplet |= sixtet2; - *base64_triplet <<= 6; - *base64_triplet |= sixtet3; - *base64_triplet <<= 6; - *base64_triplet |= sixtet4; - - *base64_stream_index = stream_index; + safe_base64_triplet = sixtet1; + safe_base64_triplet <<= 6; + safe_base64_triplet |= sixtet2; + safe_base64_triplet <<= 6; + safe_base64_triplet |= sixtet3; + safe_base64_triplet <<= 6; + safe_base64_triplet |= sixtet4; + + *base64_triplet = safe_base64_triplet; + *base64_stream_index = safe_base64_stream_index; + *padding_size = safe_padding_size; return( 1 ); } @@ -642,7 +692,7 @@ uint8_t *sixtet_to_character_table = NULL; static char *function = "libuna_base64_triplet_copy_to_base64_stream"; size_t base64_character_size = 0; - size_t stream_index = 0; + size_t safe_base64_stream_index = 0; uint32_t base64_character = 0; uint8_t padding_character = 0; uint8_t sixtet1 = 0; @@ -729,6 +779,7 @@ { case LIBUNA_BASE64_VARIANT_PADDING_NONE: case LIBUNA_BASE64_VARIANT_PADDING_OPTIONAL: + case LIBUNA_BASE64_VARIANT_PADDING_INVALID: padding_character = 0; break; @@ -773,7 +824,7 @@ return( -1 ); } - stream_index = *base64_stream_index; + safe_base64_stream_index = *base64_stream_index; /* Separate the 3 bytes value into 4 x 6 bit values */ @@ -787,7 +838,7 @@ /* Spread the encoding over 2 characters if 1 byte is available */ - if( ( stream_index + ( base64_character_size * 2 ) ) > base64_stream_size ) + if( ( safe_base64_stream_index + ( base64_character_size * 2 ) ) > base64_stream_size ) { libcerror_error_set( error, @@ -803,73 +854,73 @@ switch( base64_variant & 0xf0000000UL ) { case LIBUNA_BASE64_VARIANT_ENCODING_BYTE_STREAM: - base64_stream[ stream_index ] = (uint8_t) base64_character; + base64_stream[ safe_base64_stream_index ] = (uint8_t) base64_character; break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_from_uint16_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_from_uint16_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_from_uint32_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_from_uint32_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; } - stream_index += base64_character_size; + safe_base64_stream_index += base64_character_size; base64_character = sixtet_to_character_table[ sixtet2 ]; switch( base64_variant & 0xf0000000UL ) { case LIBUNA_BASE64_VARIANT_ENCODING_BYTE_STREAM: - base64_stream[ stream_index ] = (uint8_t) base64_character; + base64_stream[ safe_base64_stream_index ] = (uint8_t) base64_character; break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_from_uint16_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_from_uint16_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_from_uint32_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_from_uint32_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; } - stream_index += base64_character_size; + safe_base64_stream_index += base64_character_size; /* Spread the encoding over 3 characters if 2 bytes are available * Otherwise pad the remaining bytes if required */ - if( ( stream_index + base64_character_size ) > base64_stream_size ) + if( ( safe_base64_stream_index + base64_character_size ) > base64_stream_size ) { libcerror_error_set( error, @@ -894,39 +945,39 @@ switch( base64_variant & 0xf0000000UL ) { case LIBUNA_BASE64_VARIANT_ENCODING_BYTE_STREAM: - base64_stream[ stream_index ] = (uint8_t) base64_character; + base64_stream[ safe_base64_stream_index ] = (uint8_t) base64_character; break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_from_uint16_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_from_uint16_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_from_uint32_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_from_uint32_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; } - stream_index += base64_character_size; + safe_base64_stream_index += base64_character_size; } /* Spread the encoding over 4 characters if 3 bytes are available * Otherwise pad the remaining bytes if required */ - if( ( stream_index + base64_character_size ) > base64_stream_size ) + if( ( safe_base64_stream_index + base64_character_size ) > base64_stream_size ) { libcerror_error_set( error, @@ -951,36 +1002,36 @@ switch( base64_variant & 0xf0000000UL ) { case LIBUNA_BASE64_VARIANT_ENCODING_BYTE_STREAM: - base64_stream[ stream_index ] = (uint8_t) base64_character; + base64_stream[ safe_base64_stream_index ] = (uint8_t) base64_character; break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_from_uint16_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_from_uint16_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_from_uint32_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_from_uint32_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; } - stream_index += base64_character_size; + safe_base64_stream_index += base64_character_size; } - *base64_stream_index = stream_index; + *base64_stream_index = safe_base64_stream_index; return( 1 ); } @@ -996,7 +1047,10 @@ uint8_t *padding_size, libcerror_error_t **error ) { - static char *function = "libuna_base64_triplet_copy_from_byte_stream"; + static char *function = "libuna_base64_triplet_copy_from_byte_stream"; + size_t safe_byte_stream_index = 0; + uint32_t safe_base64_triplet = 0; + uint8_t safe_padding_size = 0; if( base64_triplet == NULL ) { @@ -1053,24 +1107,42 @@ return( -1 ); } + if( padding_size == NULL ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, + "%s: invalid padding size.", + function ); + + return( -1 ); + } + safe_byte_stream_index = *byte_stream_index; + /* Determine the value of 3 bytes (24 bits) */ - *base64_triplet = (uint32_t) byte_stream[ *byte_stream_index ] << 16; - *byte_stream_index += 1; - *padding_size = 2; + safe_base64_triplet = byte_stream[ safe_byte_stream_index++ ]; + safe_padding_size = 2; + + safe_base64_triplet <<= 8; - if( *byte_stream_index < byte_stream_size ) + if( safe_byte_stream_index < byte_stream_size ) { - *base64_triplet |= (uint32_t) byte_stream[ *byte_stream_index ] << 8; - *byte_stream_index += 1; - *padding_size -= 1; + safe_base64_triplet |= byte_stream[ safe_byte_stream_index++ ]; + safe_padding_size -= 1; } - if( *byte_stream_index < byte_stream_size ) + safe_base64_triplet <<= 8; + + if( safe_byte_stream_index < byte_stream_size ) { - *base64_triplet |= (uint32_t) byte_stream[ *byte_stream_index ]; - *byte_stream_index += 1; - *padding_size -= 1; + safe_base64_triplet |= byte_stream[ safe_byte_stream_index++ ]; + safe_padding_size -= 1; } + *base64_triplet = safe_base64_triplet; + *byte_stream_index = safe_byte_stream_index; + *padding_size = safe_padding_size; + return( 1 ); } @@ -1085,7 +1157,8 @@ uint8_t padding_size, libcerror_error_t **error ) { - static char *function = "libuna_base64_triplet_copy_to_byte_stream"; + static char *function = "libuna_base64_triplet_copy_to_byte_stream"; + size_t safe_byte_stream_index = 0; if( byte_stream == NULL ) { @@ -1142,13 +1215,13 @@ return( -1 ); } - byte_stream[ *byte_stream_index ] = (uint8_t) ( ( base64_triplet >> 16 ) & 0xff ); + safe_byte_stream_index = *byte_stream_index; - *byte_stream_index += 1; + byte_stream[ safe_byte_stream_index++ ] = (uint8_t) ( ( base64_triplet >> 16 ) & 0xff ); if( padding_size <= 1 ) { - if( *byte_stream_index >= byte_stream_size ) + if( safe_byte_stream_index >= byte_stream_size ) { libcerror_error_set( error, @@ -1159,13 +1232,11 @@ return( -1 ); } - byte_stream[ *byte_stream_index ] = (uint8_t) ( ( base64_triplet >> 8 ) & 0xff ); - - *byte_stream_index += 1; + byte_stream[ safe_byte_stream_index++ ] = (uint8_t) ( ( base64_triplet >> 8 ) & 0xff ); } if( padding_size == 0 ) { - if( *byte_stream_index >= byte_stream_size ) + if( safe_byte_stream_index >= byte_stream_size ) { libcerror_error_set( error, @@ -1176,10 +1247,10 @@ return( -1 ); } - byte_stream[ *byte_stream_index ] = (uint8_t) ( base64_triplet & 0xff ); - - *byte_stream_index += 1; + byte_stream[ safe_byte_stream_index++ ] = (uint8_t) ( base64_triplet & 0xff ); } + *byte_stream_index = safe_byte_stream_index; + return( 1 ); } @@ -1202,6 +1273,7 @@ size_t base64_character_size = 0; size_t base64_stream_index = 0; size_t number_of_characters = 0; + size_t safe_byte_stream_size = 0; size_t whitespace_size = 0; uint32_t base64_character1 = 0; uint32_t base64_character2 = 0; @@ -1624,7 +1696,8 @@ } strip_mode = LIBUNA_STRIP_MODE_LEADING_WHITESPACE; } - if( character_limit != 0 ) + if( ( number_of_characters != 0 ) + && ( character_limit != 0 ) ) { if( number_of_characters != (size_t) character_limit ) { @@ -1761,17 +1834,17 @@ */ base64_character_size *= 4; - *byte_stream_size = base64_stream_size / base64_character_size; + safe_byte_stream_size = base64_stream_size / base64_character_size; if( ( base64_stream_size % base64_character_size ) != 0 ) { - *byte_stream_size += 1; + safe_byte_stream_size += 1; } - *byte_stream_size *= 3; + safe_byte_stream_size *= 3; - /* In this case the padding size contains the number of bytes to correct + /* The padding size contains the number of bytes to correct */ - *byte_stream_size -= padding_size; + *byte_stream_size = safe_byte_stream_size - padding_size; return( 1 ); } @@ -2213,12 +2286,13 @@ uint32_t base64_variant, libcerror_error_t **error ) { - static char *function = "libuna_base64_stream_size_from_byte_stream"; - size_t base64_character_size = 0; - size_t remaining_size = 0; - size_t whitespace_size = 0; - uint8_t character_limit = 0; - uint8_t padding_character = 0; + static char *function = "libuna_base64_stream_size_from_byte_stream"; + size_t base64_character_size = 0; + size_t calculated_base64_stream_size = 0; + size_t remaining_size = 0; + size_t whitespace_size = 0; + uint8_t character_limit = 0; + uint8_t padding_character = 0; if( byte_stream == NULL ) { @@ -2333,7 +2407,7 @@ /* Make sure the base64 stream is able to hold * at least 4 base64 characters for each 3 bytes */ - *base64_stream_size = ( byte_stream_size / 3 ) * 4; + calculated_base64_stream_size = ( byte_stream_size / 3 ) * 4; remaining_size = byte_stream_size % 3; @@ -2341,28 +2415,34 @@ { if( padding_character != 0 ) { - *base64_stream_size += 4; + calculated_base64_stream_size += 4; } else if( remaining_size == 1 ) { - *base64_stream_size += 2; + calculated_base64_stream_size += 2; } else if( remaining_size == 2 ) { - *base64_stream_size += 3; + calculated_base64_stream_size += 3; } } if( character_limit != 0 ) { - whitespace_size = *base64_stream_size / character_limit; - - if( ( *base64_stream_size % character_limit ) != 0 ) + if( calculated_base64_stream_size > character_limit ) { - whitespace_size += 1; + whitespace_size = calculated_base64_stream_size / character_limit; + + if( ( calculated_base64_stream_size % character_limit ) != 0 ) + { + whitespace_size += 1; + } + calculated_base64_stream_size += whitespace_size; } - *base64_stream_size += whitespace_size; + calculated_base64_stream_size += 1; } - *base64_stream_size *= base64_character_size; + calculated_base64_stream_size *= base64_character_size; + + *base64_stream_size = calculated_base64_stream_size; return( 1 ); } @@ -2420,7 +2500,7 @@ size_t byte_stream_index = 0; size_t number_of_characters = 0; size_t remaining_size = 0; - size_t stream_index = 0; + size_t safe_base64_stream_index = 0; size_t whitespace_size = 0; uint32_t base64_character = 0; uint32_t base64_triplet = 0; @@ -2571,7 +2651,7 @@ return( -1 ); } - stream_index = *base64_stream_index; + safe_base64_stream_index = *base64_stream_index; /* Make sure the base64 stream is able to hold * at least 4 base64 characters for each 3 bytes @@ -2595,17 +2675,19 @@ calculated_base64_stream_size += 3; } } - calculated_base64_stream_size += 1; - if( character_limit != 0 ) { - whitespace_size = calculated_base64_stream_size / character_limit; - - if( ( calculated_base64_stream_size % character_limit ) != 0 ) + if( calculated_base64_stream_size > character_limit ) { - whitespace_size += 1; + whitespace_size = calculated_base64_stream_size / character_limit; + + if( ( calculated_base64_stream_size % character_limit ) != 0 ) + { + whitespace_size += 1; + } + calculated_base64_stream_size += whitespace_size; } - calculated_base64_stream_size += whitespace_size; + calculated_base64_stream_size += 1; } calculated_base64_stream_size *= base64_character_size; @@ -2647,7 +2729,7 @@ base64_triplet, base64_stream, base64_stream_size, - &stream_index, + &safe_base64_stream_index, padding_size, base64_variant, error ) != 1 ) @@ -2672,34 +2754,34 @@ switch( base64_variant & 0xf0000000UL ) { case LIBUNA_BASE64_VARIANT_ENCODING_BYTE_STREAM: - base64_stream[ stream_index ] = (uint8_t) base64_character; + base64_stream[ safe_base64_stream_index ] = (uint8_t) base64_character; break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_from_uint16_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_from_uint16_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_from_uint32_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_from_uint32_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; } - stream_index += base64_character_size; + safe_base64_stream_index += base64_character_size; number_of_characters = 0; } @@ -2714,37 +2796,37 @@ switch( base64_variant & 0xf0000000UL ) { case LIBUNA_BASE64_VARIANT_ENCODING_BYTE_STREAM: - base64_stream[ stream_index ] = (uint8_t) base64_character; + base64_stream[ safe_base64_stream_index ] = (uint8_t) base64_character; break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_BIG_ENDIAN: byte_stream_copy_from_uint16_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN: byte_stream_copy_from_uint16_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_BIG_ENDIAN: byte_stream_copy_from_uint32_big_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; case LIBUNA_BASE64_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN: byte_stream_copy_from_uint32_little_endian( - &( base64_stream[ stream_index ] ), + &( base64_stream[ safe_base64_stream_index ] ), base64_character ); break; } - stream_index += base64_character_size; + safe_base64_stream_index += base64_character_size; } } - *base64_stream_index = stream_index; + *base64_stream_index = safe_base64_stream_index; return( 1 ); } diff -Nru libsmdev-20171112/libuna/libuna_base64_stream.h libsmdev-20181227/libuna/libuna_base64_stream.h --- libsmdev-20171112/libuna/libuna_base64_stream.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_base64_stream.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Base64 stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -34,7 +34,7 @@ #endif int libuna_base64_character_copy_to_sixtet( - uint8_t base64_character, + uint32_t base64_character, uint8_t *base64_sixtet, uint32_t base64_variant, libcerror_error_t **error ); diff -Nru libsmdev-20171112/libuna/libuna_byte_stream.c libsmdev-20181227/libuna/libuna_byte_stream.c --- libsmdev-20171112/libuna/libuna_byte_stream.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_byte_stream.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Byte stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -79,7 +79,7 @@ while( utf8_string_index < utf8_string_size ) { - /* Convert the UTF-8 character bytes into a Unicode character + /* Convert the UTF-8 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &unicode_character, @@ -114,6 +114,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } @@ -180,7 +184,7 @@ } while( utf8_string_index < utf8_string_size ) { - /* Convert the UTF-8 string bytes into a Unicode character + /* Convert the UTF-8 string bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &unicode_character, @@ -217,6 +221,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } @@ -272,7 +280,7 @@ while( utf16_string_index < utf16_string_size ) { - /* Convert the UTF-16 character bytes into a Unicode character + /* Convert the UTF-16 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16( &unicode_character, @@ -307,6 +315,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } @@ -373,7 +385,7 @@ } while( utf16_string_index < utf16_string_size ) { - /* Convert the UTF-16 string bytes into a Unicode character + /* Convert the UTF-16 string bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16( &unicode_character, @@ -410,6 +422,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } @@ -465,7 +481,7 @@ while( utf32_string_index < utf32_string_size ) { - /* Convert the UTF-32 character bytes into a Unicode character + /* Convert the UTF-32 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32( &unicode_character, @@ -500,6 +516,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } @@ -566,7 +586,7 @@ } while( utf32_string_index < utf32_string_size ) { - /* Convert the UTF-32 string bytes into a Unicode character + /* Convert the UTF-32 string bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32( &unicode_character, @@ -603,6 +623,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } diff -Nru libsmdev-20171112/libuna/libuna_byte_stream.h libsmdev-20181227/libuna/libuna_byte_stream.h --- libsmdev-20171112/libuna/libuna_byte_stream.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_byte_stream.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Byte stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_10.c libsmdev-20181227/libuna/libuna_codepage_iso_8859_10.c --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_10.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_10.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-10 codepage (Nordic) function * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_10.h libsmdev-20181227/libuna/libuna_codepage_iso_8859_10.h --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_10.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_10.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-10 codepage (Nordic) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_13.c libsmdev-20181227/libuna/libuna_codepage_iso_8859_13.c --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_13.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_13.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-13 codepage (Baltic) function * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_13.h libsmdev-20181227/libuna/libuna_codepage_iso_8859_13.h --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_13.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_13.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-13 codepage (Baltic) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_14.c libsmdev-20181227/libuna/libuna_codepage_iso_8859_14.c --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_14.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_14.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-14 codepage (Celtic) function * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_14.h libsmdev-20181227/libuna/libuna_codepage_iso_8859_14.h --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_14.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_14.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-14 codepage (Celtic) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_15.c libsmdev-20181227/libuna/libuna_codepage_iso_8859_15.c --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_15.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_15.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-15 codepage (Latin 9) function * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_15.h libsmdev-20181227/libuna/libuna_codepage_iso_8859_15.h --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_15.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_15.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-15 codepage (Latin 9) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_16.c libsmdev-20181227/libuna/libuna_codepage_iso_8859_16.c --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_16.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_16.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-16 codepage (Latin 10) function * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_16.h libsmdev-20181227/libuna/libuna_codepage_iso_8859_16.h --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_16.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_16.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-16 codepage (Latin 10) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_2.c libsmdev-20181227/libuna/libuna_codepage_iso_8859_2.c --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_2.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_2.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-2 codepage (Central European) function * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_2.h libsmdev-20181227/libuna/libuna_codepage_iso_8859_2.h --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_2.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_2.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-2 codepage (Central European) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_3.c libsmdev-20181227/libuna/libuna_codepage_iso_8859_3.c --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_3.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_3.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-3 codepage (Latin 3) function * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_3.h libsmdev-20181227/libuna/libuna_codepage_iso_8859_3.h --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_3.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_3.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-3 codepage (Latin 3) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_4.c libsmdev-20181227/libuna/libuna_codepage_iso_8859_4.c --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_4.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_4.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-4 codepage (Baltic) function * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_4.h libsmdev-20181227/libuna/libuna_codepage_iso_8859_4.h --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_4.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_4.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-4 codepage (Baltic) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_5.c libsmdev-20181227/libuna/libuna_codepage_iso_8859_5.c --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_5.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_5.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-5 codepage (Cyrillic) function * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_5.h libsmdev-20181227/libuna/libuna_codepage_iso_8859_5.h --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_5.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_5.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-5 codepage (Cyrillic) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_6.c libsmdev-20181227/libuna/libuna_codepage_iso_8859_6.c --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_6.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_6.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-6 codepage (Arabic) function * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_6.h libsmdev-20181227/libuna/libuna_codepage_iso_8859_6.h --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_6.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_6.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-6 codepage (Arabic) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_7.c libsmdev-20181227/libuna/libuna_codepage_iso_8859_7.c --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_7.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_7.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-7 codepage (Greek) function * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_7.h libsmdev-20181227/libuna/libuna_codepage_iso_8859_7.h --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_7.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_7.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-7 codepage (Greek) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_8.c libsmdev-20181227/libuna/libuna_codepage_iso_8859_8.c --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_8.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_8.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-8 codepage (Hebrew) function * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_8.h libsmdev-20181227/libuna/libuna_codepage_iso_8859_8.h --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_8.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_8.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-8 codepage (Hebrew) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_9.c libsmdev-20181227/libuna/libuna_codepage_iso_8859_9.c --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_9.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_9.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-9 codepage (Turkish) function * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_iso_8859_9.h libsmdev-20181227/libuna/libuna_codepage_iso_8859_9.h --- libsmdev-20171112/libuna/libuna_codepage_iso_8859_9.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_iso_8859_9.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * ISO 8859-9 codepage (Turkish) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_koi8_r.c libsmdev-20181227/libuna/libuna_codepage_koi8_r.c --- libsmdev-20171112/libuna/libuna_codepage_koi8_r.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_koi8_r.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * KOI8-R codepage (Russian Cyrillic) function * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_koi8_r.h libsmdev-20181227/libuna/libuna_codepage_koi8_r.h --- libsmdev-20171112/libuna/libuna_codepage_koi8_r.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_koi8_r.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * KOI8-R codepage (Russian Cyrillic) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_koi8_u.c libsmdev-20181227/libuna/libuna_codepage_koi8_u.c --- libsmdev-20171112/libuna/libuna_codepage_koi8_u.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_koi8_u.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * KOI8-U codepage (Ukrainian Cyrillic) function * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_koi8_u.h libsmdev-20181227/libuna/libuna_codepage_koi8_u.h --- libsmdev-20171112/libuna/libuna_codepage_koi8_u.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_koi8_u.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * KOI8-U codepage (Ukrainian Cyrillic) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_1250.c libsmdev-20181227/libuna/libuna_codepage_windows_1250.c --- libsmdev-20171112/libuna/libuna_codepage_windows_1250.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_1250.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 1250 codepage (Central European) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_1250.h libsmdev-20181227/libuna/libuna_codepage_windows_1250.h --- libsmdev-20171112/libuna/libuna_codepage_windows_1250.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_1250.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 1250 codepage (Central European) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_1251.c libsmdev-20181227/libuna/libuna_codepage_windows_1251.c --- libsmdev-20171112/libuna/libuna_codepage_windows_1251.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_1251.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 1251 codepage (Cyrillic) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_1251.h libsmdev-20181227/libuna/libuna_codepage_windows_1251.h --- libsmdev-20171112/libuna/libuna_codepage_windows_1251.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_1251.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 1251 codepage (Cyrillic) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_1252.c libsmdev-20181227/libuna/libuna_codepage_windows_1252.c --- libsmdev-20171112/libuna/libuna_codepage_windows_1252.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_1252.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 1252 codepage (Western European/Latin 1) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_1252.h libsmdev-20181227/libuna/libuna_codepage_windows_1252.h --- libsmdev-20171112/libuna/libuna_codepage_windows_1252.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_1252.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 1252 codepage (Western European/Latin 1) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_1253.c libsmdev-20181227/libuna/libuna_codepage_windows_1253.c --- libsmdev-20171112/libuna/libuna_codepage_windows_1253.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_1253.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 1253 codepage (Greek) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_1253.h libsmdev-20181227/libuna/libuna_codepage_windows_1253.h --- libsmdev-20171112/libuna/libuna_codepage_windows_1253.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_1253.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 1253 codepage (Greek) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_1254.c libsmdev-20181227/libuna/libuna_codepage_windows_1254.c --- libsmdev-20171112/libuna/libuna_codepage_windows_1254.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_1254.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 1254 codepage (Turkish) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_1254.h libsmdev-20181227/libuna/libuna_codepage_windows_1254.h --- libsmdev-20171112/libuna/libuna_codepage_windows_1254.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_1254.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 1254 codepage (Turkish) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_1255.c libsmdev-20181227/libuna/libuna_codepage_windows_1255.c --- libsmdev-20171112/libuna/libuna_codepage_windows_1255.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_1255.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 1255 codepage (Hebrew) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_1255.h libsmdev-20181227/libuna/libuna_codepage_windows_1255.h --- libsmdev-20171112/libuna/libuna_codepage_windows_1255.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_1255.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 1255 codepage (Hebrew) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_1256.c libsmdev-20181227/libuna/libuna_codepage_windows_1256.c --- libsmdev-20171112/libuna/libuna_codepage_windows_1256.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_1256.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 1256 codepage (Arabic) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_1256.h libsmdev-20181227/libuna/libuna_codepage_windows_1256.h --- libsmdev-20171112/libuna/libuna_codepage_windows_1256.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_1256.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 1256 codepage (Arabic) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_1257.c libsmdev-20181227/libuna/libuna_codepage_windows_1257.c --- libsmdev-20171112/libuna/libuna_codepage_windows_1257.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_1257.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 1257 codepage (Baltic) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_1257.h libsmdev-20181227/libuna/libuna_codepage_windows_1257.h --- libsmdev-20171112/libuna/libuna_codepage_windows_1257.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_1257.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 1257 codepage (Baltic) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_1258.c libsmdev-20181227/libuna/libuna_codepage_windows_1258.c --- libsmdev-20171112/libuna/libuna_codepage_windows_1258.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_1258.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 1258 codepage (Vietnamese) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_1258.h libsmdev-20181227/libuna/libuna_codepage_windows_1258.h --- libsmdev-20171112/libuna/libuna_codepage_windows_1258.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_1258.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 1258 codepage (Vietnamese) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_874.c libsmdev-20181227/libuna/libuna_codepage_windows_874.c --- libsmdev-20171112/libuna/libuna_codepage_windows_874.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_874.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 874 codepage (Thai) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_874.h libsmdev-20181227/libuna/libuna_codepage_windows_874.h --- libsmdev-20171112/libuna/libuna_codepage_windows_874.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_874.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 874 codepage (Thai) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_932.c libsmdev-20181227/libuna/libuna_codepage_windows_932.c --- libsmdev-20171112/libuna/libuna_codepage_windows_932.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_932.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 932 codepage (Japanese Shift-JIS) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -4275,7 +4275,7 @@ return( 1 ); } -/* Copies a Unicode character from a byte stream +/* Copies an Unicode character from a byte stream * Returns 1 if successful or -1 on error */ int libuna_codepage_windows_932_copy_from_byte_stream( @@ -4385,7 +4385,7 @@ *unicode_character = libuna_codepage_windows_932_byte_stream_to_unicode_base_0x81c8[ additional_character ]; } else if( ( additional_character >= 0xda ) - && ( additional_character < 0xea ) ) + && ( additional_character < 0xe9 ) ) { additional_character -= 0xda; @@ -4840,7 +4840,7 @@ return( 1 ); } -/* Copies a Unicode character to a byte stream +/* Copies an Unicode character to a byte stream * Returns 1 if successful or -1 on error */ int libuna_codepage_windows_932_copy_to_byte_stream( diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_932.h libsmdev-20181227/libuna/libuna_codepage_windows_932.h --- libsmdev-20171112/libuna/libuna_codepage_windows_932.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_932.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 932 codepage (Japanese Shift-JIS) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_936.c libsmdev-20181227/libuna/libuna_codepage_windows_936.c --- libsmdev-20171112/libuna/libuna_codepage_windows_936.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_936.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 936 codepage (Chinese Simplified) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -6433,7 +6433,7 @@ return( 1 ); } -/* Copies a Unicode character from a byte stream +/* Copies an Unicode character from a byte stream * Returns 1 if successful or -1 on error */ int libuna_codepage_windows_936_copy_from_byte_stream( @@ -7334,7 +7334,7 @@ return( 1 ); } -/* Copies a Unicode character to a byte stream +/* Copies an Unicode character to a byte stream * Returns 1 if successful or -1 on error */ int libuna_codepage_windows_936_copy_to_byte_stream( diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_936.h libsmdev-20181227/libuna/libuna_codepage_windows_936.h --- libsmdev-20171112/libuna/libuna_codepage_windows_936.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_936.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 936 codepage (Chinese Simplified) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_949.c libsmdev-20181227/libuna/libuna_codepage_windows_949.c --- libsmdev-20171112/libuna/libuna_codepage_windows_949.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_949.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 949 codepage (Korean) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -7274,7 +7274,7 @@ byte_stream_value = libuna_codepage_windows_949_unicode_to_byte_stream_base_0xac00[ unicode_character ]; } else if( ( unicode_character >= 0xf900 ) - && ( unicode_character < 0xfa14 ) ) + && ( unicode_character < 0xfa0c ) ) { unicode_character -= 0xf900; byte_stream_value = libuna_codepage_windows_949_unicode_to_byte_stream_base_0xf900[ unicode_character ]; @@ -7298,7 +7298,7 @@ return( 1 ); } -/* Copies a Unicode character from a byte stream +/* Copies an Unicode character from a byte stream * Returns 1 if successful or -1 on error */ int libuna_codepage_windows_949_copy_from_byte_stream( @@ -8109,7 +8109,7 @@ return( 1 ); } -/* Copies a Unicode character to a byte stream +/* Copies an Unicode character to a byte stream * Returns 1 if successful or -1 on error */ int libuna_codepage_windows_949_copy_to_byte_stream( @@ -8207,7 +8207,7 @@ byte_stream_value = libuna_codepage_windows_949_unicode_to_byte_stream_base_0xac00[ unicode_character ]; } else if( ( unicode_character >= 0xf900 ) - && ( unicode_character < 0xfa14 ) ) + && ( unicode_character < 0xfa0c ) ) { unicode_character -= 0xf900; byte_stream_value = libuna_codepage_windows_949_unicode_to_byte_stream_base_0xf900[ unicode_character ]; diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_949.h libsmdev-20181227/libuna/libuna_codepage_windows_949.h --- libsmdev-20171112/libuna/libuna_codepage_windows_949.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_949.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 949 codepage (Korean) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_950.c libsmdev-20181227/libuna/libuna_codepage_windows_950.c --- libsmdev-20171112/libuna/libuna_codepage_windows_950.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_950.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 950 codepage (Traditional Chinese) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -5402,7 +5402,7 @@ return( 1 ); } -/* Copies a Unicode character from a byte stream +/* Copies an Unicode character from a byte stream * Returns 1 if successful or -1 on error */ int libuna_codepage_windows_950_copy_from_byte_stream( @@ -6288,7 +6288,7 @@ return( 1 ); } -/* Copies a Unicode character to a byte stream +/* Copies an Unicode character to a byte stream * Returns 1 if successful or -1 on error */ int libuna_codepage_windows_950_copy_to_byte_stream( diff -Nru libsmdev-20171112/libuna/libuna_codepage_windows_950.h libsmdev-20181227/libuna/libuna_codepage_windows_950.h --- libsmdev-20171112/libuna/libuna_codepage_windows_950.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_codepage_windows_950.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Windows 950 codepage (Traditional Chinese) functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_definitions.h libsmdev-20181227/libuna/libuna_definitions.h --- libsmdev-20171112/libuna/libuna_definitions.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_definitions.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal definitions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -35,11 +35,11 @@ #else #include -#define LIBUNA_VERSION 20171007 +#define LIBUNA_VERSION 20181006 /* The libuna version string */ -#define LIBUNA_VERSION_STRING "20171007" +#define LIBUNA_VERSION_STRING "20181006" /* The endian definitions */ @@ -172,6 +172,23 @@ #define LIBUNA_CODEPAGE_SHIFT_JIS LIBUNA_CODEPAGE_WINDOWS_932 #define LIBUNA_CODEPAGE_GB2312 LIBUNA_CODEPAGE_WINDOWS_936 +/* The comparison function definitions + */ +enum LIBUNA_COMPARE_DEFINITIONS +{ + /* The first string is less than the second string + */ + LIBUNA_COMPARE_LESS, + + /* The first and second strings are equal + */ + LIBUNA_COMPARE_EQUAL, + + /* The first string is greater than the second string + */ + LIBUNA_COMPARE_GREATER +}; + /* Base16 variants * Byte: * 0 - 1 Character limit @@ -196,6 +213,8 @@ LIBUNA_BASE16_VARIANT_ENCODING_UTF32_LITTLE_ENDIAN = 0x40000000UL }; +#define LIBUNA_BASE16_VARIANT_ENCODING_BYTE_STREAM 0 + #define LIBUNA_BASE16_VARIANT_RFC4648 \ LIBUNA_BASE16_VARIANT_CASE_MIXED | LIBUNA_BASE16_VARIANT_CHARACTER_LIMIT_NONE @@ -264,9 +283,14 @@ LIBUNA_BASE64_VARIANT_CHARACTER_LIMIT_64 = 0x00000040UL, LIBUNA_BASE64_VARIANT_CHARACTER_LIMIT_76 = 0x0000004cUL, + /* No padding */ LIBUNA_BASE64_VARIANT_PADDING_NONE = 0x01000000UL, + /* Padding is optional */ LIBUNA_BASE64_VARIANT_PADDING_OPTIONAL = 0x02000000UL, + /* Padding is required */ LIBUNA_BASE64_VARIANT_PADDING_REQUIRED = 0x03000000UL, + /* Invalid base64 characters are considered padding */ + LIBUNA_BASE64_VARIANT_PADDING_INVALID = 0x04000000UL, LIBUNA_BASE64_VARIANT_ENCODING_UTF16_BIG_ENDIAN = 0x10000000UL, LIBUNA_BASE64_VARIANT_ENCODING_UTF16_LITTLE_ENDIAN = 0x20000000UL, @@ -284,7 +308,7 @@ LIBUNA_BASE64_VARIANT_ALPHABET_NORMAL | LIBUNA_BASE64_VARIANT_CHARACTER_LIMIT_NONE | LIBUNA_BASE64_VARIANT_PADDING_NONE #define LIBUNA_BASE64_VARIANT_UTF7 \ - LIBUNA_BASE64_VARIANT_RFC1642 + LIBUNA_BASE64_VARIANT_ALPHABET_NORMAL | LIBUNA_BASE64_VARIANT_CHARACTER_LIMIT_NONE | LIBUNA_BASE64_VARIANT_PADDING_INVALID #define LIBUNA_BASE64_VARIANT_RFC2045 \ LIBUNA_BASE64_VARIANT_ALPHABET_NORMAL | LIBUNA_BASE64_VARIANT_CHARACTER_LIMIT_76 | LIBUNA_BASE64_VARIANT_PADDING_REQUIRED @@ -307,9 +331,8 @@ LIBUNA_BASE64_FLAG_STRIP_WHITESPACE = 0x01 }; -#endif +#endif /* !defined( HAVE_LOCAL_LIBUNA ) */ -#define LIBUNA_BASE16_VARIANT_ENCODING_BYTE_STREAM 0 #define LIBUNA_BASE32_VARIANT_ENCODING_BYTE_STREAM 0 #define LIBUNA_BASE64_VARIANT_ENCODING_BYTE_STREAM 0 @@ -351,5 +374,5 @@ */ #define LIBUNA_UTF7_IS_BASE64_ENCODED 0x80000000UL -#endif +#endif /* !defined( _LIBUNA_INTERNAL_DEFINITIONS_H ) */ diff -Nru libsmdev-20171112/libuna/libuna_error.c libsmdev-20181227/libuna/libuna_error.c --- libsmdev-20171112/libuna/libuna_error.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_error.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Error functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_error.h libsmdev-20181227/libuna/libuna_error.h --- libsmdev-20171112/libuna/libuna_error.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_error.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Error functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_extern.h libsmdev-20181227/libuna/libuna_extern.h --- libsmdev-20171112/libuna/libuna_extern.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_extern.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal extern definition * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -28,17 +28,13 @@ */ #if !defined( HAVE_LOCAL_LIBUNA ) -/* If libtool DLL support is enabled set LIBUNA_DLL_EXPORT - * before including libuna/extern.h - */ -#if defined( _WIN32 ) && defined( DLL_EXPORT ) -#define LIBUNA_DLL_EXPORT -#endif - #include +#define LIBUNA_EXTERN_VARIABLE LIBUNA_EXTERN + #else -#define LIBUNA_EXTERN /* extern */ +#define LIBUNA_EXTERN /* extern */ +#define LIBUNA_EXTERN_VARIABLE extern #endif /* !defined( HAVE_LOCAL_LIBUNA ) */ diff -Nru libsmdev-20171112/libuna/libuna_libcerror.h libsmdev-20181227/libuna/libuna_libcerror.h --- libsmdev-20171112/libuna/libuna_libcerror.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_libcerror.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* - * The internal libcerror header + * The libcerror header wrapper * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_support.c libsmdev-20181227/libuna/libuna_support.c --- libsmdev-20171112/libuna/libuna_support.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_support.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Support functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_support.h libsmdev-20181227/libuna/libuna_support.h --- libsmdev-20171112/libuna/libuna_support.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_support.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Support functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_types.h libsmdev-20181227/libuna/libuna_types.h --- libsmdev-20171112/libuna/libuna_types.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_types.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal type definitions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_unicode_character.c libsmdev-20181227/libuna/libuna_unicode_character.c --- libsmdev-20171112/libuna/libuna_unicode_character.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_unicode_character.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Unicode character functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -58,6 +58,48 @@ #include "libuna_unicode_character.h" #include "libuna_unused.h" +/* Valid directly encoded characters: A-Z, a-z, 0-9, '\', '(', ')', ',', '-', '.', '/', ':', '?' + * Valid directly encoded whitespace: '\t', '\n', '\r', ' ' + * Valid optional directly encoded characters: '!', '"', '#', '$', '%', '&', '*', ';', '<', '=', '>', '@', '[', ']', '^', '_', '`', '{', '|', '}' + */ +uint8_t libuna_unicode_character_utf7_valid_directly_encoded_character[ 256 ] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 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 }; + +/* Valid UTF-7 base64 characters: A-Z, a-z, 0-9, '+' and '/' + */ +uint8_t libuna_unicode_character_utf7_valid_base64_character[ 256 ] = { + 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, 1, 0, 0, 0, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 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 }; + /* Determines the size of a byte stream character from an Unicode character * Adds the size to the byte stream character size value * Returns 1 if successful or -1 on error @@ -168,7 +210,7 @@ return( result ); } -/* Copies a Unicode character from a byte stream +/* Copies an Unicode character from a byte stream * Returns 1 if successful or -1 on error */ int libuna_unicode_character_copy_from_byte_stream( @@ -745,7 +787,7 @@ return( result ); } -/* Copies a Unicode character to a byte stream +/* Copies an Unicode character to a byte stream * Returns 1 if successful or -1 on error */ int libuna_unicode_character_copy_to_byte_stream( @@ -2934,13 +2976,15 @@ uint32_t *utf7_stream_base64_data, libcerror_error_t **error ) { - libuna_utf16_character_t utf16_surrogate = 0; static char *function = "libuna_unicode_character_size_to_utf7_stream"; - uint8_t base64_encode_character = 0; + libuna_utf16_character_t utf16_surrogate = 0; + size_t safe_utf7_stream_character_size = 0; uint32_t base64_triplet = 0; - uint8_t number_of_bytes = 0; - uint8_t current_byte = 0; + uint32_t safe_utf7_stream_base64_data = 0; + uint8_t base64_encode_character = 0; uint8_t byte_bit_shift = 0; + uint8_t current_byte = 0; + uint8_t number_of_bytes = 0; if( utf7_stream_character_size == NULL ) { @@ -2964,96 +3008,18 @@ return( -1 ); } + safe_utf7_stream_character_size = *utf7_stream_character_size; + safe_utf7_stream_base64_data = *utf7_stream_base64_data; + /* Determine if the Unicode character is valid */ if( unicode_character > LIBUNA_UNICODE_CHARACTER_MAX ) { unicode_character = LIBUNA_UNICODE_REPLACEMENT_CHARACTER; } - /* A-Z is not a continous range on an EBCDIC based system - * it consists of the ranges: A-I, J-R, S-Z - */ - if( ( unicode_character >= 0x41 ) - && ( unicode_character <= 0x49 ) ) - { - } - else if( ( unicode_character >= 0x4a ) - && ( unicode_character <= 0x52 ) ) - { - } - else if( ( unicode_character >= 0x53 ) - && ( unicode_character <= 0x5a ) ) - { - } - /* a-z is not a continous range on an EBCDIC based system - * it consists of the ranges: a-i, j-r, s-z - */ - else if( ( unicode_character >= 0x61 ) - && ( unicode_character <= 0x69 ) ) - { - } - else if( ( unicode_character >= 0x6a ) - && ( unicode_character <= 0x72 ) ) - { - } - else if( ( unicode_character >= 0x73 ) - && ( unicode_character <= 0x7a ) ) - { - } - /* 0-9 - */ - else if( ( unicode_character >= 0x30 ) - && ( unicode_character <= 0x39 ) ) - { - } - /* Valid directly encoded whitespace - */ - else if( ( unicode_character == (libuna_unicode_character_t) '\t' ) - || ( unicode_character == (libuna_unicode_character_t) '\n' ) - || ( unicode_character == (libuna_unicode_character_t) '\r' ) - || ( unicode_character == (libuna_unicode_character_t) ' ' ) ) - { - } /* The + character must be escaped */ - else if( unicode_character == (libuna_unicode_character_t) '+' ) - { - } - /* Valid directly encoded characters - */ - else if( ( unicode_character == (libuna_unicode_character_t) '\'' ) - || ( unicode_character == (libuna_unicode_character_t) '(' ) - || ( unicode_character == (libuna_unicode_character_t) ')' ) - || ( unicode_character == (libuna_unicode_character_t) ',' ) - || ( unicode_character == (libuna_unicode_character_t) '-' ) - || ( unicode_character == (libuna_unicode_character_t) '.' ) - || ( unicode_character == (libuna_unicode_character_t) '/' ) - || ( unicode_character == (libuna_unicode_character_t) ':' ) - || ( unicode_character == (libuna_unicode_character_t) '?' ) ) - { - } - /* Valid optional directly encoded characters - */ - else if( ( unicode_character == (libuna_unicode_character_t) '!' ) - || ( unicode_character == (libuna_unicode_character_t) '"' ) - || ( unicode_character == (libuna_unicode_character_t) '#' ) - || ( unicode_character == (libuna_unicode_character_t) '$' ) - || ( unicode_character == (libuna_unicode_character_t) '%' ) - || ( unicode_character == (libuna_unicode_character_t) '&' ) - || ( unicode_character == (libuna_unicode_character_t) '*' ) - || ( unicode_character == (libuna_unicode_character_t) ';' ) - || ( unicode_character == (libuna_unicode_character_t) '<' ) - || ( unicode_character == (libuna_unicode_character_t) '=' ) - || ( unicode_character == (libuna_unicode_character_t) '>' ) - || ( unicode_character == (libuna_unicode_character_t) '@' ) - || ( unicode_character == (libuna_unicode_character_t) '[' ) - || ( unicode_character == (libuna_unicode_character_t) ']' ) - || ( unicode_character == (libuna_unicode_character_t) '^' ) - || ( unicode_character == (libuna_unicode_character_t) '_' ) - || ( unicode_character == (libuna_unicode_character_t) '`' ) - || ( unicode_character == (libuna_unicode_character_t) '{' ) - || ( unicode_character == (libuna_unicode_character_t) '|' ) - || ( unicode_character == (libuna_unicode_character_t) '}' ) ) + if( unicode_character == (libuna_unicode_character_t) '+' ) { } /* Allow for the end of string character @@ -3061,44 +3027,45 @@ else if( unicode_character == 0 ) { } - else + else if( ( unicode_character >= 256 ) + || ( libuna_unicode_character_utf7_valid_directly_encoded_character[ (uint8_t) unicode_character ] == 0 ) ) { base64_encode_character = 1; } if( base64_encode_character == 0 ) { - if( ( *utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) != 0 ) + if( ( safe_utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) != 0 ) { - *utf7_stream_base64_data = 0; + safe_utf7_stream_base64_data = 0; } - *utf7_stream_character_size += 1; + safe_utf7_stream_character_size += 1; /* The + character must be escaped */ if( unicode_character == (libuna_unicode_character_t) '+' ) { - *utf7_stream_character_size += 1; + safe_utf7_stream_character_size += 1; } } else { /* Escape the base64 encoded characters with a + */ - if( ( *utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) == 0 ) + if( ( safe_utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) == 0 ) { - *utf7_stream_character_size += 1; + safe_utf7_stream_character_size += 1; } /* Otherwise continue the previously base64 encoded characters */ else { - base64_triplet = *utf7_stream_base64_data & 0x00ffffff; - number_of_bytes = ( *utf7_stream_base64_data >> 24 ) & 0x03; - current_byte = ( *utf7_stream_base64_data >> 28 ) & 0x03; + base64_triplet = safe_utf7_stream_base64_data & 0x00ffffff; + number_of_bytes = ( safe_utf7_stream_base64_data >> 24 ) & 0x03; + current_byte = ( safe_utf7_stream_base64_data >> 28 ) & 0x03; if( number_of_bytes > 0 ) { - if( *utf7_stream_character_size < (size_t) ( number_of_bytes + 1 ) ) + if( safe_utf7_stream_character_size < (size_t) ( number_of_bytes + 1 ) ) { libcerror_error_set( error, @@ -3111,9 +3078,9 @@ } /* Correct the size for the last partial base64 stream */ - *utf7_stream_character_size -= number_of_bytes + 1; + safe_utf7_stream_character_size -= number_of_bytes + 1; } - if( *utf7_stream_character_size < 1 ) + if( safe_utf7_stream_character_size < 1 ) { libcerror_error_set( error, @@ -3126,9 +3093,9 @@ } /* Correct the size for the base64 stream termination character */ - *utf7_stream_character_size -= 1; + safe_utf7_stream_character_size -= 1; } - *utf7_stream_base64_data = LIBUNA_UTF7_IS_BASE64_ENCODED; + safe_utf7_stream_base64_data = LIBUNA_UTF7_IS_BASE64_ENCODED; if( unicode_character > LIBUNA_UNICODE_BASIC_MULTILINGUAL_PLANE_MAX ) { @@ -3143,10 +3110,10 @@ if( number_of_bytes == 3 ) { - *utf7_stream_character_size += 4; - number_of_bytes = 0; - current_byte = 0; - base64_triplet = 0; + safe_utf7_stream_character_size += 4; + number_of_bytes = 0; + current_byte = 0; + base64_triplet = 0; } byte_bit_shift = 16 - ( current_byte * 8 ); base64_triplet += (uint32_t) ( utf16_surrogate & 0xff ) << byte_bit_shift; @@ -3155,10 +3122,10 @@ if( number_of_bytes == 3 ) { - *utf7_stream_character_size += 4; - number_of_bytes = 0; - current_byte = 0; - base64_triplet = 0; + safe_utf7_stream_character_size += 4; + number_of_bytes = 0; + current_byte = 0; + base64_triplet = 0; } unicode_character = (libuna_utf16_character_t) ( ( unicode_character & 0x03ff ) + LIBUNA_UNICODE_SURROGATE_LOW_RANGE_START ); } @@ -3169,10 +3136,10 @@ if( number_of_bytes == 3 ) { - *utf7_stream_character_size += 4; - number_of_bytes = 0; - current_byte = 0; - base64_triplet = 0; + safe_utf7_stream_character_size += 4; + number_of_bytes = 0; + current_byte = 0; + base64_triplet = 0; } byte_bit_shift = 16 - ( current_byte * 8 ); base64_triplet += (uint32_t) ( unicode_character & 0xff ) << byte_bit_shift; @@ -3181,30 +3148,33 @@ if( number_of_bytes == 3 ) { - *utf7_stream_character_size += 4; - number_of_bytes = 0; - current_byte = 0; - base64_triplet = 0; + safe_utf7_stream_character_size += 4; + number_of_bytes = 0; + current_byte = 0; + base64_triplet = 0; } /* Terminate the base64 encoded characters */ if( number_of_bytes > 0 ) { - *utf7_stream_character_size += number_of_bytes + 1; + safe_utf7_stream_character_size += number_of_bytes + 1; } - *utf7_stream_character_size += 1; + safe_utf7_stream_character_size += 1; } - if( ( *utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) != 0 ) + if( ( safe_utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) != 0 ) { - *utf7_stream_base64_data = LIBUNA_UTF7_IS_BASE64_ENCODED; - *utf7_stream_base64_data |= (uint32_t) current_byte << 28; - *utf7_stream_base64_data |= (uint32_t) number_of_bytes << 24; - *utf7_stream_base64_data |= base64_triplet & 0x00ffffff; + safe_utf7_stream_base64_data = LIBUNA_UTF7_IS_BASE64_ENCODED; + safe_utf7_stream_base64_data |= (uint32_t) current_byte << 28; + safe_utf7_stream_base64_data |= (uint32_t) number_of_bytes << 24; + safe_utf7_stream_base64_data |= base64_triplet & 0x00ffffff; } + *utf7_stream_character_size = safe_utf7_stream_character_size; + *utf7_stream_base64_data = safe_utf7_stream_base64_data; + return( 1 ); } -/* Copies a Unicode character from an UTF-7 stream +/* Copies an Unicode character from an UTF-7 stream * The bits of the base64 data contain: * 0 - 23 the base64 triplet * 24 - 25 the number of bytes in the triplet @@ -3225,11 +3195,14 @@ { static char *function = "libuna_unicode_character_copy_from_utf7_stream"; libuna_utf16_character_t utf16_surrogate = 0; + size_t safe_utf7_stream_index = 0; uint32_t base64_triplet = 0; - uint8_t number_of_bytes = 0; + uint32_t safe_utf7_stream_base64_data = 0; + uint8_t byte_bit_shift = 0; uint8_t current_byte = 0; + uint8_t number_of_bytes = 0; uint8_t padding_size = 0; - uint8_t byte_bit_shift = 0; + uint8_t utf7_character_value = 0; if( unicode_character == NULL ) { @@ -3297,166 +3270,82 @@ return( -1 ); } - if( ( *utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) != 0 ) + safe_utf7_stream_index = *utf7_stream_index; + safe_utf7_stream_base64_data = *utf7_stream_base64_data; + + if( ( safe_utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) != 0 ) { - base64_triplet = *utf7_stream_base64_data & 0x00ffffff; - number_of_bytes = ( *utf7_stream_base64_data >> 24 ) & 0x03; - current_byte = ( *utf7_stream_base64_data >> 28 ) & 0x03; + base64_triplet = safe_utf7_stream_base64_data & 0x00ffffff; + number_of_bytes = ( safe_utf7_stream_base64_data >> 24 ) & 0x03; + current_byte = ( safe_utf7_stream_base64_data >> 28 ) & 0x03; if( current_byte >= number_of_bytes ) { - /* A-Z is not a continous range on an EBCDIC based system - * it consists of the ranges: A-I, J-R, S-Z - */ - if( ( utf7_stream[ *utf7_stream_index ] >= (uint8_t) 'A' ) - && ( utf7_stream[ *utf7_stream_index ] <= (uint8_t) 'I' ) ) - { - } - else if( ( utf7_stream[ *utf7_stream_index ] >= (uint8_t) 'J' ) - && ( utf7_stream[ *utf7_stream_index ] <= (uint8_t) 'R' ) ) - { - } - else if( ( utf7_stream[ *utf7_stream_index ] >= (uint8_t) 'S' ) - && ( utf7_stream[ *utf7_stream_index ] <= (uint8_t) 'Z' ) ) - { - } - /* a-z is not a continous range on an EBCDIC based system - * it consists of the ranges: a-i, j-r, s-z - */ - else if( ( utf7_stream[ *utf7_stream_index ] >= (uint8_t) 'a' ) - && ( utf7_stream[ *utf7_stream_index ] <= (uint8_t) 'i' ) ) - { - } - else if( ( utf7_stream[ *utf7_stream_index ] >= (uint8_t) 'j' ) - && ( utf7_stream[ *utf7_stream_index ] <= (uint8_t) 'r' ) ) - { - } - else if( ( utf7_stream[ *utf7_stream_index ] >= (uint8_t) 's' ) - && ( utf7_stream[ *utf7_stream_index ] <= (uint8_t) 'z' ) ) - { - } - /* 0-9 - */ - else if( ( utf7_stream[ *utf7_stream_index ] >= (uint8_t) '0' ) - && ( utf7_stream[ *utf7_stream_index ] <= (uint8_t) '9' ) ) - { - } - /* + or / - */ - else if( ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '+' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '/' ) ) + if( safe_utf7_stream_index >= utf7_stream_size ) { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, + "%s: invalid UTF-7 stream character size value out of bounds.", + function ); + + return( -1 ); } - /* Any character not in the modified base64 alphabet - * terminates the base64 encoded sequence + utf7_character_value = utf7_stream[ safe_utf7_stream_index ]; + + /* Any character not in the modified base64 alphabet terminates the base64 encoded sequence */ - else + if( libuna_unicode_character_utf7_valid_base64_character[ utf7_character_value ] == 0 ) { - *utf7_stream_base64_data = 0; + safe_utf7_stream_base64_data = 0; } } } - if( ( *utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) == 0 ) + if( ( safe_utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) == 0 ) { + if( safe_utf7_stream_index >= utf7_stream_size ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, + "%s: invalid UTF-7 stream character size value out of bounds.", + function ); + + return( -1 ); + } + utf7_character_value = utf7_stream[ safe_utf7_stream_index ]; + /* Determine if the character is modified base64 encoded * or a + character */ - if( utf7_stream[ *utf7_stream_index ] == (uint8_t) '+' ) + if( utf7_character_value == (uint8_t) '+' ) { - if( utf7_stream[ *utf7_stream_index + 1 ] != (uint8_t) '-' ) + if( ( safe_utf7_stream_index + 1 ) >= utf7_stream_size ) { - *utf7_stream_base64_data = LIBUNA_UTF7_IS_BASE64_ENCODED; + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, + "%s: invalid UTF-7 stream character size value out of bounds.", + function ); - *utf7_stream_index += 1; + return( -1 ); + } + if( utf7_stream[ safe_utf7_stream_index + 1 ] != (uint8_t) '-' ) + { + safe_utf7_stream_base64_data = LIBUNA_UTF7_IS_BASE64_ENCODED; + + safe_utf7_stream_index++; } - } - /* A-Z is not a continous range on an EBCDIC based system - * it consists of the ranges: A-I, J-R, S-Z - */ - else if( ( utf7_stream[ *utf7_stream_index ] >= (uint8_t) 'A' ) - && ( utf7_stream[ *utf7_stream_index ] <= (uint8_t) 'I' ) ) - { - } - else if( ( utf7_stream[ *utf7_stream_index ] >= (uint8_t) 'J' ) - && ( utf7_stream[ *utf7_stream_index ] <= (uint8_t) 'R' ) ) - { - } - else if( ( utf7_stream[ *utf7_stream_index ] >= (uint8_t) 'S' ) - && ( utf7_stream[ *utf7_stream_index ] <= (uint8_t) 'Z' ) ) - { - } - /* a-z is not a continous range on an EBCDIC based system - * it consists of the ranges: a-i, j-r, s-z - */ - else if( ( utf7_stream[ *utf7_stream_index ] >= (uint8_t) 'a' ) - && ( utf7_stream[ *utf7_stream_index ] <= (uint8_t) 'i' ) ) - { - } - else if( ( utf7_stream[ *utf7_stream_index ] >= (uint8_t) 'j' ) - && ( utf7_stream[ *utf7_stream_index ] <= (uint8_t) 'r' ) ) - { - } - else if( ( utf7_stream[ *utf7_stream_index ] >= (uint8_t) 's' ) - && ( utf7_stream[ *utf7_stream_index ] <= (uint8_t) 'z' ) ) - { - } - /* 0-9 - */ - else if( ( utf7_stream[ *utf7_stream_index ] >= (uint8_t) '0' ) - && ( utf7_stream[ *utf7_stream_index ] <= (uint8_t) '9' ) ) - { - } - /* Valid directly encoded whitespace - */ - else if( ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '\t' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '\n' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '\r' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) ' ' ) ) - { - } - /* Valid directly encoded characters - */ - else if( ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '\'' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '(' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) ')' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) ',' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '-' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '.' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '/' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) ':' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '?' ) ) - { - } - /* Valid optional directly encoded characters - */ - else if( ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '!' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '"' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '#' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '$' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '%' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '&' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '*' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) ';' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '<' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '=' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '>' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '@' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '[' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) ']' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '^' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '_' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '`' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '{' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '|' ) - || ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '}' ) ) - { } /* Allow for the end of string character */ - else if( utf7_stream[ *utf7_stream_index ] == 0 ) + else if( utf7_character_value == 0 ) { } - else + else if( libuna_unicode_character_utf7_valid_directly_encoded_character[ utf7_character_value ] == 0 ) { libcerror_error_set( error, @@ -3464,20 +3353,19 @@ LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, "%s: invalid directly encoded UTF-7 character byte: 0x%02" PRIx8 ".", function, - utf7_stream[ *utf7_stream_index ] ); + utf7_character_value ); return( -1 ); } } - if( ( *utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) == 0 ) + if( ( safe_utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) == 0 ) { - *unicode_character = utf7_stream[ *utf7_stream_index ]; - *utf7_stream_index += 1; + *unicode_character = utf7_stream[ safe_utf7_stream_index++ ]; if( ( *unicode_character == (libuna_unicode_character_t) '+' ) - && ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '-' ) ) + && ( utf7_stream[ safe_utf7_stream_index ] == (uint8_t) '-' ) ) { - *utf7_stream_index += 1; + safe_utf7_stream_index++; } } else if( ( number_of_bytes == 0 ) @@ -3487,7 +3375,7 @@ &base64_triplet, utf7_stream, utf7_stream_size, - utf7_stream_index, + &safe_utf7_stream_index, &padding_size, LIBUNA_BASE64_VARIANT_UTF7, error ) != 1 ) @@ -3515,7 +3403,7 @@ number_of_bytes = 3 - padding_size; current_byte = 0; } - if( ( *utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) != 0 ) + if( ( safe_utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) != 0 ) { byte_bit_shift = 16 - ( current_byte * 8 ); *unicode_character = ( ( base64_triplet >> byte_bit_shift ) & 0x000000ffUL ) << 8; @@ -3527,7 +3415,7 @@ &base64_triplet, utf7_stream, utf7_stream_size, - utf7_stream_index, + &safe_utf7_stream_index, &padding_size, LIBUNA_BASE64_VARIANT_UTF7, error ) != 1 ) @@ -3568,7 +3456,7 @@ &base64_triplet, utf7_stream, utf7_stream_size, - utf7_stream_index, + &safe_utf7_stream_index, &padding_size, LIBUNA_BASE64_VARIANT_UTF7, error ) != 1 ) @@ -3606,7 +3494,7 @@ &base64_triplet, utf7_stream, utf7_stream_size, - utf7_stream_index, + &safe_utf7_stream_index, &padding_size, LIBUNA_BASE64_VARIANT_UTF7, error ) != 1 ) @@ -3653,7 +3541,7 @@ *unicode_character = LIBUNA_UNICODE_REPLACEMENT_CHARACTER; } } - if( *utf7_stream_index >= utf7_stream_size ) + if( safe_utf7_stream_index >= utf7_stream_size ) { libcerror_error_set( error, @@ -3665,23 +3553,27 @@ return( -1 ); } if( ( current_byte >= number_of_bytes ) - && ( utf7_stream[ *utf7_stream_index ] == (uint8_t) '-' ) ) + && ( utf7_stream[ safe_utf7_stream_index ] == (uint8_t) '-' ) ) { - *utf7_stream_base64_data = 0; - *utf7_stream_index += 1; + safe_utf7_stream_base64_data = 0; + + safe_utf7_stream_index++; } } - if( ( *utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) != 0 ) + if( ( safe_utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) != 0 ) { - *utf7_stream_base64_data = LIBUNA_UTF7_IS_BASE64_ENCODED; - *utf7_stream_base64_data |= (uint32_t) current_byte << 28; - *utf7_stream_base64_data |= (uint32_t) number_of_bytes << 24; - *utf7_stream_base64_data |= base64_triplet & 0x00ffffff; + safe_utf7_stream_base64_data = LIBUNA_UTF7_IS_BASE64_ENCODED; + safe_utf7_stream_base64_data |= (uint32_t) current_byte << 28; + safe_utf7_stream_base64_data |= (uint32_t) number_of_bytes << 24; + safe_utf7_stream_base64_data |= base64_triplet & 0x00ffffff; } + *utf7_stream_index = safe_utf7_stream_index; + *utf7_stream_base64_data = safe_utf7_stream_base64_data; + return( 1 ); } -/* Copies a Unicode character into a UTF-7 stream +/* Copies an Unicode character into a UTF-7 stream * The bits of the base64 data contain: * 0 - 23 the base64 triplet * 24 - 25 the number of bytes in the triplet @@ -3702,11 +3594,13 @@ { static char *function = "libuna_unicode_character_copy_to_utf7_stream"; libuna_utf16_character_t utf16_surrogate = 0; + size_t safe_utf7_stream_index = 0; uint32_t base64_triplet = 0; - uint8_t number_of_bytes = 0; + uint32_t safe_utf7_stream_base64_data = 0; uint8_t base64_encode_character = 0; - uint8_t current_byte = 0; uint8_t byte_bit_shift = 0; + uint8_t current_byte = 0; + uint8_t number_of_bytes = 0; if( utf7_stream == NULL ) { @@ -3752,6 +3646,9 @@ return( -1 ); } + safe_utf7_stream_index = *utf7_stream_index; + safe_utf7_stream_base64_data = *utf7_stream_base64_data; + /* Determine if the Unicode character is valid */ if( unicode_character > LIBUNA_UNICODE_CHARACTER_MAX ) @@ -3801,72 +3698,28 @@ { unicode_character = ( unicode_character - 0x30 ) + (libuna_unicode_character_t) '0'; } - /* Valid directly encoded whitespace - */ - else if( ( unicode_character == (libuna_unicode_character_t) '\t' ) - || ( unicode_character == (libuna_unicode_character_t) '\n' ) - || ( unicode_character == (libuna_unicode_character_t) '\r' ) - || ( unicode_character == (libuna_unicode_character_t) ' ' ) ) - { - } /* The + character must be escaped */ else if( unicode_character == (libuna_unicode_character_t) '+' ) { } - /* Valid directly encoded characters - */ - else if( ( unicode_character == (libuna_unicode_character_t) '\'' ) - || ( unicode_character == (libuna_unicode_character_t) '(' ) - || ( unicode_character == (libuna_unicode_character_t) ')' ) - || ( unicode_character == (libuna_unicode_character_t) ',' ) - || ( unicode_character == (libuna_unicode_character_t) '-' ) - || ( unicode_character == (libuna_unicode_character_t) '.' ) - || ( unicode_character == (libuna_unicode_character_t) '/' ) - || ( unicode_character == (libuna_unicode_character_t) ':' ) - || ( unicode_character == (libuna_unicode_character_t) '?' ) ) - { - } - /* Valid optional directly encoded characters - */ - else if( ( unicode_character == (libuna_unicode_character_t) '!' ) - || ( unicode_character == (libuna_unicode_character_t) '"' ) - || ( unicode_character == (libuna_unicode_character_t) '#' ) - || ( unicode_character == (libuna_unicode_character_t) '$' ) - || ( unicode_character == (libuna_unicode_character_t) '%' ) - || ( unicode_character == (libuna_unicode_character_t) '&' ) - || ( unicode_character == (libuna_unicode_character_t) '*' ) - || ( unicode_character == (libuna_unicode_character_t) ';' ) - || ( unicode_character == (libuna_unicode_character_t) '<' ) - || ( unicode_character == (libuna_unicode_character_t) '=' ) - || ( unicode_character == (libuna_unicode_character_t) '>' ) - || ( unicode_character == (libuna_unicode_character_t) '@' ) - || ( unicode_character == (libuna_unicode_character_t) '[' ) - || ( unicode_character == (libuna_unicode_character_t) ']' ) - || ( unicode_character == (libuna_unicode_character_t) '^' ) - || ( unicode_character == (libuna_unicode_character_t) '_' ) - || ( unicode_character == (libuna_unicode_character_t) '`' ) - || ( unicode_character == (libuna_unicode_character_t) '{' ) - || ( unicode_character == (libuna_unicode_character_t) '|' ) - || ( unicode_character == (libuna_unicode_character_t) '}' ) ) - { - } /* Allow for the end of string character */ else if( unicode_character == 0 ) { } - else + else if( ( unicode_character >= 256 ) + || ( libuna_unicode_character_utf7_valid_directly_encoded_character[ (uint8_t) unicode_character ] == 0 ) ) { base64_encode_character = 1; } if( base64_encode_character == 0 ) { - if( ( *utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) != 0 ) + if( ( safe_utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) != 0 ) { - *utf7_stream_base64_data = 0; + safe_utf7_stream_base64_data = 0; } - if( *utf7_stream_index >= utf7_stream_size ) + if( safe_utf7_stream_index >= utf7_stream_size ) { libcerror_error_set( error, @@ -3877,15 +3730,13 @@ return( -1 ); } - utf7_stream[ *utf7_stream_index ] = (uint8_t) unicode_character; - - *utf7_stream_index += 1; + utf7_stream[ safe_utf7_stream_index++ ] = (uint8_t) unicode_character; /* The + character must be escaped */ if( unicode_character == (libuna_unicode_character_t) '+' ) { - if( *utf7_stream_index >= utf7_stream_size ) + if( safe_utf7_stream_index >= utf7_stream_size ) { libcerror_error_set( error, @@ -3896,18 +3747,16 @@ return( -1 ); } - utf7_stream[ *utf7_stream_index ] = (uint8_t) '-'; - - *utf7_stream_index += 1; + utf7_stream[ safe_utf7_stream_index++ ] = (uint8_t) '-'; } } else { /* Escape the base64 encoded chracters with a + */ - if( ( *utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) == 0 ) + if( ( safe_utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) == 0 ) { - if( *utf7_stream_index >= utf7_stream_size ) + if( safe_utf7_stream_index >= utf7_stream_size ) { libcerror_error_set( error, @@ -3918,29 +3767,27 @@ return( -1 ); } - utf7_stream[ *utf7_stream_index ] = (uint8_t) '+'; - - *utf7_stream_index += 1; + utf7_stream[ safe_utf7_stream_index++ ] = (uint8_t) '+'; } /* Otherwise continue the previously base64 encoded characters */ else { - base64_triplet = *utf7_stream_base64_data & 0x00ffffff; - number_of_bytes = ( *utf7_stream_base64_data >> 24 ) & 0x03; - current_byte = ( *utf7_stream_base64_data >> 28 ) & 0x03; + base64_triplet = safe_utf7_stream_base64_data & 0x00ffffff; + number_of_bytes = ( safe_utf7_stream_base64_data >> 24 ) & 0x03; + current_byte = ( safe_utf7_stream_base64_data >> 28 ) & 0x03; if( number_of_bytes > 0 ) { /* Correct the index for the last partial base64 stream */ - *utf7_stream_index -= number_of_bytes + 1; + safe_utf7_stream_index -= number_of_bytes + 1; } /* Correct the index for the base64 stream termination character */ - *utf7_stream_index -= 1; + safe_utf7_stream_index -= 1; } - *utf7_stream_base64_data = LIBUNA_UTF7_IS_BASE64_ENCODED; + safe_utf7_stream_base64_data = LIBUNA_UTF7_IS_BASE64_ENCODED; if( unicode_character > LIBUNA_UNICODE_BASIC_MULTILINGUAL_PLANE_MAX ) { @@ -3960,7 +3807,7 @@ base64_triplet, utf7_stream, utf7_stream_size, - utf7_stream_index, + &safe_utf7_stream_index, 0, LIBUNA_BASE64_VARIANT_UTF7, error ) != 1 ) @@ -3989,7 +3836,7 @@ base64_triplet, utf7_stream, utf7_stream_size, - utf7_stream_index, + &safe_utf7_stream_index, 0, LIBUNA_BASE64_VARIANT_UTF7, error ) != 1 ) @@ -4021,7 +3868,7 @@ base64_triplet, utf7_stream, utf7_stream_size, - utf7_stream_index, + &safe_utf7_stream_index, 0, LIBUNA_BASE64_VARIANT_UTF7, error ) != 1 ) @@ -4050,7 +3897,7 @@ base64_triplet, utf7_stream, utf7_stream_size, - utf7_stream_index, + &safe_utf7_stream_index, 0, LIBUNA_BASE64_VARIANT_UTF7, error ) != 1 ) @@ -4076,7 +3923,7 @@ base64_triplet, utf7_stream, utf7_stream_size, - utf7_stream_index, + &safe_utf7_stream_index, 3 - number_of_bytes, LIBUNA_BASE64_VARIANT_UTF7, error ) != 1 ) @@ -4091,7 +3938,7 @@ return( -1 ); } } - if( *utf7_stream_index >= utf7_stream_size ) + if( safe_utf7_stream_index >= utf7_stream_size ) { libcerror_error_set( error, @@ -4102,17 +3949,18 @@ return( -1 ); } - utf7_stream[ *utf7_stream_index ] = (uint8_t) '-'; - - *utf7_stream_index += 1; + utf7_stream[ safe_utf7_stream_index++ ] = (uint8_t) '-'; } - if( ( *utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) != 0 ) + if( ( safe_utf7_stream_base64_data & LIBUNA_UTF7_IS_BASE64_ENCODED ) != 0 ) { - *utf7_stream_base64_data = LIBUNA_UTF7_IS_BASE64_ENCODED; - *utf7_stream_base64_data |= (uint32_t) current_byte << 28; - *utf7_stream_base64_data |= (uint32_t) number_of_bytes << 24; - *utf7_stream_base64_data |= base64_triplet & 0x00ffffff; + safe_utf7_stream_base64_data = LIBUNA_UTF7_IS_BASE64_ENCODED; + safe_utf7_stream_base64_data |= (uint32_t) current_byte << 28; + safe_utf7_stream_base64_data |= (uint32_t) number_of_bytes << 24; + safe_utf7_stream_base64_data |= base64_triplet & 0x00ffffff; } + *utf7_stream_index = safe_utf7_stream_index; + *utf7_stream_base64_data = safe_utf7_stream_base64_data; + return( 1 ); } @@ -4138,15 +3986,15 @@ return( -1 ); } - if( unicode_character < 0x080 ) + if( unicode_character < 0x00000080UL ) { *utf8_character_size += 1; } - else if( unicode_character < 0x0800 ) + else if( unicode_character < 0x00000800UL ) { *utf8_character_size += 2; } - else if( unicode_character < 0x010000 ) + else if( unicode_character < 0x00010000UL ) { *utf8_character_size += 3; } @@ -4186,7 +4034,7 @@ return( 1 ); } -/* Copies a Unicode character from an UTF-8 string +/* Copies an Unicode character from an UTF-8 string * Returns 1 if successful or -1 on error */ int libuna_unicode_character_copy_from_utf8( @@ -4510,7 +4358,7 @@ return( 1 ); } -/* Copies a Unicode character into a UTF-8 string +/* Copies an Unicode character into a UTF-8 string * Returns 1 if successful or -1 on error */ int libuna_unicode_character_copy_to_utf8( @@ -4669,7 +4517,7 @@ return( 1 ); } -/* Copies a Unicode character from an UTF-16 string +/* Copies an Unicode character from an UTF-16 string * Returns 1 if successful or -1 on error */ int libuna_unicode_character_copy_from_utf16( @@ -4784,7 +4632,7 @@ return( 1 ); } -/* Copies a Unicode character into a UTF-16 string +/* Copies an Unicode character into a UTF-16 string * Returns 1 if successful or -1 on error */ int libuna_unicode_character_copy_to_utf16( @@ -4876,7 +4724,7 @@ return( 1 ); } -/* Copies a Unicode character from an UTF-16 stream +/* Copies an Unicode character from an UTF-16 stream * Returns 1 if successful or -1 on error */ int libuna_unicode_character_copy_from_utf16_stream( @@ -5026,7 +4874,7 @@ return( 1 ); } -/* Copies a Unicode character to an UTF-16 stream +/* Copies an Unicode character to an UTF-16 stream * Returns 1 if successful or -1 on error */ int libuna_unicode_character_copy_to_utf16_stream( @@ -5199,7 +5047,7 @@ return( 1 ); } -/* Copies a Unicode character from an UTF-32 string +/* Copies an Unicode character from an UTF-32 string * Returns 1 if successful or -1 on error */ int libuna_unicode_character_copy_from_utf32( @@ -5282,7 +5130,7 @@ return( 1 ); } -/* Copies a Unicode character into a UTF-32 string +/* Copies an Unicode character into a UTF-32 string * Returns 1 if successful or -1 on error */ int libuna_unicode_character_copy_to_utf32( @@ -5355,7 +5203,7 @@ return( 1 ); } -/* Copies a Unicode character from an UTF-32 stream +/* Copies an Unicode character from an UTF-32 stream * Returns 1 if successful or -1 on error */ int libuna_unicode_character_copy_from_utf32_stream( @@ -5467,7 +5315,7 @@ return( 1 ); } -/* Copies a Unicode character to an UTF-32 stream +/* Copies an Unicode character to an UTF-32 stream * Returns 1 if successful or -1 on error */ int libuna_unicode_character_copy_to_utf32_stream( diff -Nru libsmdev-20171112/libuna/libuna_unicode_character.h libsmdev-20181227/libuna/libuna_unicode_character.h --- libsmdev-20171112/libuna/libuna_unicode_character.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_unicode_character.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Unicode character functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_unused.h libsmdev-20181227/libuna/libuna_unused.h --- libsmdev-20171112/libuna/libuna_unused.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_unused.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal unused definition * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_url_stream.c libsmdev-20181227/libuna/libuna_url_stream.c --- libsmdev-20171112/libuna/libuna_url_stream.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_url_stream.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Percent or URL encoded stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_url_stream.h libsmdev-20181227/libuna/libuna_url_stream.h --- libsmdev-20171112/libuna/libuna_url_stream.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_url_stream.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * Percent or URL encoded stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_utf16_stream.c libsmdev-20181227/libuna/libuna_utf16_stream.c --- libsmdev-20171112/libuna/libuna_utf16_stream.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_utf16_stream.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * UTF-16 stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -121,8 +121,8 @@ libcerror_error_t **error ) { static char *function = "libuna_utf16_stream_size_from_utf8"; - size_t utf8_string_index = 0; libuna_unicode_character_t unicode_character = 0; + size_t utf8_string_index = 0; if( utf8_string == NULL ) { @@ -163,7 +163,7 @@ while( utf8_string_index < utf8_string_size ) { - /* Convert the UTF-8 character bytes into a Unicode character + /* Convert the UTF-8 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &unicode_character, @@ -197,6 +197,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } /* Convert the number of characters into bytes */ @@ -217,9 +221,9 @@ libcerror_error_t **error ) { static char *function = "libuna_utf16_stream_copy_from_utf8"; + libuna_unicode_character_t unicode_character = 0; size_t utf16_stream_index = 0; size_t utf8_string_index = 0; - libuna_unicode_character_t unicode_character = 0; if( utf16_stream == NULL ) { @@ -295,7 +299,7 @@ } while( utf8_string_index < utf8_string_size ) { - /* Convert the UTF-8 string bytes into a Unicode character + /* Convert the UTF-8 string bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &unicode_character, @@ -332,6 +336,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } @@ -345,7 +353,9 @@ size_t *utf16_stream_size, libcerror_error_t **error ) { - static char *function = "libuna_utf16_stream_size_from_utf16"; + static char *function = "libuna_utf16_stream_size_from_utf16"; + libuna_unicode_character_t unicode_character = 0; + size_t utf16_string_index = 0; if( utf16_string == NULL ) { @@ -381,10 +391,50 @@ return( -1 ); } /* Add the byte order mark - * Assumes the UTF-16 string is santized */ - *utf16_stream_size = 1 + utf16_string_size; + *utf16_stream_size = 1; + while( utf16_string_index < utf16_string_size ) + { + /* Convert the UTF-16 character bytes into an Unicode character + */ + if( libuna_unicode_character_copy_from_utf16( + &unicode_character, + utf16_string, + utf16_string_size, + &utf16_string_index, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, + "%s: unable to copy Unicode character from UTF-16.", + function ); + + return( -1 ); + } + /* Determine how many UTF-16 character bytes are required + */ + if( libuna_unicode_character_size_to_utf16( + unicode_character, + utf16_stream_size, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_OUTPUT_FAILED, + "%s: unable to determine size of Unicode character in UTF-16.", + function ); + + return( -1 ); + } + if( unicode_character == 0 ) + { + break; + } + } /* Convert the number of characters into bytes */ *utf16_stream_size *= 2; @@ -403,10 +453,10 @@ size_t utf16_string_size, libcerror_error_t **error ) { - static char *function = "libuna_utf16_stream_copy_from_utf16"; - size_t utf16_stream_index = 0; - size_t utf16_string_index = 0; - libuna_utf16_character_t utf16_character = 0; + static char *function = "libuna_utf16_stream_copy_from_utf16"; + libuna_unicode_character_t unicode_character = 0; + size_t utf16_stream_index = 0; + size_t utf16_string_index = 0; if( utf16_stream == NULL ) { @@ -480,36 +530,49 @@ return( -1 ); } - /* Assumes the UTF-16 string is santized - */ while( utf16_string_index < utf16_string_size ) { - if( ( utf16_stream_index + 2 ) > utf16_stream_size ) + /* Convert the UTF-16 string bytes into an Unicode character + */ + if( libuna_unicode_character_copy_from_utf16( + &unicode_character, + utf16_string, + utf16_string_size, + &utf16_string_index, + error ) != 1 ) { libcerror_error_set( error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: UTF-16 stream too small.", + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, + "%s: unable to copy Unicode character from UTF-16 string.", function ); return( -1 ); } - utf16_character = utf16_string[ utf16_string_index++ ]; - - if( byte_order == LIBUNA_ENDIAN_BIG ) + /* Convert the Unicode character into UTF-16 stream bytes + */ + if( libuna_unicode_character_copy_to_utf16_stream( + unicode_character, + utf16_stream, + utf16_stream_size, + &utf16_stream_index, + byte_order, + error ) != 1 ) { - utf16_stream[ utf16_stream_index + 1 ] = (uint8_t) ( utf16_character & 0xff ); - utf16_character >>= 8; - utf16_stream[ utf16_stream_index ] = (uint8_t) ( utf16_character & 0xff ); + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_OUTPUT_FAILED, + "%s: unable to copy Unicode character to UTF-16 stream.", + function ); + + return( -1 ); } - else if( byte_order == LIBUNA_ENDIAN_LITTLE ) + if( unicode_character == 0 ) { - utf16_stream[ utf16_stream_index ] = (uint8_t) ( utf16_character & 0xff ); - utf16_character >>= 8; - utf16_stream[ utf16_stream_index + 1 ] = (uint8_t) ( utf16_character & 0xff ); + break; } - utf16_stream_index += 2; } return( 1 ); } @@ -524,8 +587,8 @@ libcerror_error_t **error ) { static char *function = "libuna_utf16_stream_size_from_utf32"; - size_t utf32_string_index = 0; libuna_unicode_character_t unicode_character = 0; + size_t utf32_string_index = 0; if( utf32_string == NULL ) { @@ -566,7 +629,7 @@ while( utf32_string_index < utf32_string_size ) { - /* Convert the UTF-32 character bytes into a Unicode character + /* Convert the UTF-32 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32( &unicode_character, @@ -600,6 +663,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } /* Convert the number of characters into bytes */ @@ -620,9 +687,9 @@ libcerror_error_t **error ) { static char *function = "libuna_utf16_stream_copy_from_utf32"; + libuna_unicode_character_t unicode_character = 0; size_t utf16_stream_index = 0; size_t utf32_string_index = 0; - libuna_unicode_character_t unicode_character = 0; if( utf16_stream == NULL ) { @@ -698,7 +765,7 @@ } while( utf32_string_index < utf32_string_size ) { - /* Convert the UTF-32 string bytes into a Unicode character + /* Convert the UTF-32 string bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32( &unicode_character, @@ -735,6 +802,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } diff -Nru libsmdev-20171112/libuna/libuna_utf16_stream.h libsmdev-20181227/libuna/libuna_utf16_stream.h --- libsmdev-20171112/libuna/libuna_utf16_stream.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_utf16_stream.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * UTF-16 stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_utf16_string.c libsmdev-20181227/libuna/libuna_utf16_string.c --- libsmdev-20171112/libuna/libuna_utf16_string.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_utf16_string.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * UTF-16 string functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -77,15 +77,13 @@ } *utf16_string_size = 0; - /* Check if the byte stream is terminated with a zero byte - */ - if( byte_stream[ byte_stream_size - 1 ] != 0 ) + if( byte_stream_size == 0 ) { - *utf16_string_size += 1; + return( 1 ); } while( byte_stream_index < byte_stream_size ) { - /* Convert the byte stream bytes into a Unicode character + /* Convert the byte stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_byte_stream( &unicode_character, @@ -121,6 +119,12 @@ return( -1 ); } } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + *utf16_string_size += 1; + } return( 1 ); } @@ -174,7 +178,6 @@ static char *function = "libuna_utf16_string_with_index_copy_from_byte_stream"; size_t byte_stream_index = 0; libuna_unicode_character_t unicode_character = 0; - uint8_t zero_byte = 0; if( utf16_string == NULL ) { @@ -231,15 +234,20 @@ return( -1 ); } - /* Check if the byte stream is terminated with zero bytes - */ - if( byte_stream[ byte_stream_size - 1 ] != 0 ) + if( byte_stream_size == 0 ) { - zero_byte = 1; + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing byte stream value.", + function ); + + return( -1 ); } while( byte_stream_index < byte_stream_size ) { - /* Convert the byte stream bytes into a Unicode character + /* Convert the byte stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_byte_stream( &unicode_character, @@ -277,7 +285,9 @@ return( -1 ); } } - if( zero_byte != 0 ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { if( *utf16_string_index >= utf16_string_size ) { @@ -298,7 +308,7 @@ } /* Compares an UTF-16 string with a byte stream - * Returns 1 if the strings are equal, 0 if not or -1 on error + * Returns LIBUNA_COMPARE_LESS, LIBUNA_COMPARE_EQUAL, LIBUNA_COMPARE_GREATER if successful or -1 on error */ int libuna_utf16_string_compare_with_byte_stream( const libuna_utf16_character_t *utf16_string, @@ -358,6 +368,17 @@ return( -1 ); } + if( byte_stream_size == 0 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing byte stream value.", + function ); + + return( -1 ); + } if( utf16_string[ utf16_string_size - 1 ] == 0 ) { utf16_string_size -= 1; @@ -371,7 +392,7 @@ while( ( utf16_string_index < utf16_string_size ) && ( byte_stream_index < byte_stream_size ) ) { - /* Convert the UTF-16 character bytes into a Unicode character + /* Convert the UTF-16 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16( &utf16_unicode_character, @@ -389,7 +410,7 @@ return( -1 ); } - /* Convert the byte stream bytes into a Unicode character + /* Convert the byte stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_byte_stream( &byte_stream_unicode_character, @@ -408,19 +429,26 @@ return( -1 ); } - if( utf16_unicode_character != byte_stream_unicode_character ) + if( utf16_unicode_character < byte_stream_unicode_character ) { - return( 0 ); + return( LIBUNA_COMPARE_LESS ); + } + else if( utf16_unicode_character > byte_stream_unicode_character ) + { + return( LIBUNA_COMPARE_GREATER ); } } /* Check if both strings were entirely processed */ - if( ( utf16_string_index != utf16_string_size ) - || ( byte_stream_index != byte_stream_size ) ) + if( utf16_string_index < utf16_string_size ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } - return( 1 ); + else if( byte_stream_index < byte_stream_size ) + { + return( LIBUNA_COMPARE_LESS ); + } + return( LIBUNA_COMPARE_EQUAL ); } /* Determines the size of an UTF-16 string from an UTF-7 stream @@ -459,17 +487,6 @@ return( -1 ); } - if( utf7_stream_size < 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-7 stream bytes.", - function ); - - return( -1 ); - } if( utf16_string_size == NULL ) { libcerror_error_set( @@ -483,15 +500,13 @@ } *utf16_string_size = 0; - /* Check if the UTF-7 stream is terminated with a zero byte - */ - if( utf7_stream[ utf7_stream_size - 1 ] != 0 ) + if( utf7_stream_size == 0 ) { - *utf16_string_size += 1; + return( 1 ); } while( utf7_stream_index < utf7_stream_size ) { - /* Convert the UTF-7 stream bytes into a Unicode character + /* Convert the UTF-7 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf7_stream( &unicode_character, @@ -527,6 +542,12 @@ return( -1 ); } } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + *utf16_string_size += 1; + } return( 1 ); } @@ -578,7 +599,6 @@ size_t utf7_stream_index = 0; libuna_unicode_character_t unicode_character = 0; uint32_t utf7_stream_base64_data = 0; - uint8_t zero_byte = 0; if( utf16_string == NULL ) { @@ -635,26 +655,20 @@ return( -1 ); } - if( utf7_stream_size < 1 ) + if( utf7_stream_size == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-7 stream bytes.", + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-7 stream value.", function ); return( -1 ); } - /* Check if the UTF-7 stream is terminated with zero bytes - */ - if( utf7_stream[ utf7_stream_size - 1 ] != 0 ) - { - zero_byte = 1; - } while( utf7_stream_index < utf7_stream_size ) { - /* Convert the UTF-7 stream bytes into a Unicode character + /* Convert the UTF-7 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf7_stream( &unicode_character, @@ -692,7 +706,9 @@ return( -1 ); } } - if( zero_byte != 0 ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { if( *utf16_string_index >= utf16_string_size ) { @@ -713,7 +729,7 @@ } /* Compares an UTF-16 string with an UTF-7 stream - * Returns 1 if the strings are equal, 0 if not or -1 on error + * Returns LIBUNA_COMPARE_LESS, LIBUNA_COMPARE_EQUAL, LIBUNA_COMPARE_GREATER if successful or -1 on error */ int libuna_utf16_string_compare_with_utf7_stream( const libuna_utf16_character_t *utf16_string, @@ -773,13 +789,13 @@ return( -1 ); } - if( utf7_stream_size < 1 ) + if( utf7_stream_size == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-7 stream bytes.", + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-7 stream value.", function ); return( -1 ); @@ -797,7 +813,7 @@ while( ( utf16_string_index < utf16_string_size ) && ( utf7_stream_index < utf7_stream_size ) ) { - /* Convert the UTF-16 character bytes into a Unicode character + /* Convert the UTF-16 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16( &utf16_unicode_character, @@ -815,7 +831,7 @@ return( -1 ); } - /* Convert the UTF-7 character bytes into a Unicode character + /* Convert the UTF-7 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf7_stream( &utf7_stream_unicode_character, @@ -834,19 +850,26 @@ return( -1 ); } - if( utf16_unicode_character != utf7_stream_unicode_character ) + if( utf16_unicode_character < utf7_stream_unicode_character ) + { + return( LIBUNA_COMPARE_LESS ); + } + else if( utf16_unicode_character > utf7_stream_unicode_character ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } } /* Check if both strings were entirely processed */ - if( ( utf16_string_index != utf16_string_size ) - || ( utf7_stream_index != utf7_stream_size ) ) + if( utf16_string_index < utf16_string_size ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } - return( 1 ); + else if( utf7_stream_index < utf7_stream_size ) + { + return( LIBUNA_COMPARE_LESS ); + } + return( LIBUNA_COMPARE_EQUAL ); } /* Determines the size of an UTF-16 string from an UTF-8 string @@ -897,9 +920,13 @@ } *utf16_string_size = 0; + if( utf8_string_size == 0 ) + { + return( 1 ); + } while( utf8_string_index < utf8_string_size ) { - /* Convert the UTF-8 character bytes into a Unicode character + /* Convert the UTF-8 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &unicode_character, @@ -934,6 +961,12 @@ return( -1 ); } } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + *utf16_string_size += 1; + } return( 1 ); } @@ -1040,9 +1073,20 @@ return( -1 ); } + if( utf8_string_size == 0 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-8 string value.", + function ); + + return( -1 ); + } while( utf8_string_index < utf8_string_size ) { - /* Convert the UTF-8 character bytes into a Unicode character + /* Convert the UTF-8 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &unicode_character, @@ -1079,6 +1123,25 @@ return( -1 ); } } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + if( *utf16_string_index >= utf16_string_size ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, + "%s: UTF-16 string too small.", + function ); + + return( -1 ); + } + utf16_string[ *utf16_string_index ] = 0; + + *utf16_string_index += 1; + } return( 1 ); } @@ -1117,17 +1180,6 @@ return( -1 ); } - if( utf8_stream_size < 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-8 stream bytes.", - function ); - - return( -1 ); - } if( utf16_string_size == NULL ) { libcerror_error_set( @@ -1141,6 +1193,10 @@ } *utf16_string_size = 0; + if( utf8_stream_size == 0 ) + { + return( 1 ); + } /* Check if UTF-8 stream starts with a byte order mark (BOM) */ if( utf8_stream_size >= 3 ) @@ -1152,15 +1208,9 @@ utf8_stream_index += 3; } } - /* Check if the UTF-8 stream is terminated with a zero byte - */ - if( utf8_stream[ utf8_stream_size - 1 ] != 0 ) - { - *utf16_string_size += 1; - } while( utf8_stream_index < utf8_stream_size ) { - /* Convert the UTF-8 stream bytes into a Unicode character + /* Convert the UTF-8 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &unicode_character, @@ -1195,6 +1245,12 @@ return( -1 ); } } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + *utf16_string_size += 1; + } return( 1 ); } @@ -1245,7 +1301,6 @@ static char *function = "libuna_utf16_string_with_index_copy_from_utf8_stream"; size_t utf8_stream_index = 0; libuna_unicode_character_t unicode_character = 0; - uint8_t zero_byte = 0; if( utf16_string == NULL ) { @@ -1302,13 +1357,13 @@ return( -1 ); } - if( utf8_stream_size < 1 ) + if( utf8_stream_size == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-8 stream bytes.", + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-8 stream value.", function ); return( -1 ); @@ -1324,15 +1379,9 @@ utf8_stream_index += 3; } } - /* Check if the UTF-8 stream is terminated with zero bytes - */ - if( utf8_stream[ utf8_stream_size - 1 ] != 0 ) - { - zero_byte = 1; - } while( utf8_stream_index < utf8_stream_size ) { - /* Convert the UTF-8 stream bytes into a Unicode character + /* Convert the UTF-8 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &unicode_character, @@ -1369,7 +1418,9 @@ return( -1 ); } } - if( zero_byte != 0 ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { if( *utf16_string_index >= utf16_string_size ) { @@ -1390,7 +1441,7 @@ } /* Compares an UTF-16 string with an UTF-8 stream - * Returns 1 if the strings are equal, 0 if not or -1 on error + * Returns LIBUNA_COMPARE_LESS, LIBUNA_COMPARE_EQUAL, LIBUNA_COMPARE_GREATER if successful or -1 on error */ int libuna_utf16_string_compare_with_utf8_stream( const libuna_utf16_character_t *utf16_string, @@ -1449,13 +1500,13 @@ return( -1 ); } - if( utf8_stream_size < 1 ) + if( utf8_stream_size == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-8 stream bytes.", + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-8 stream value.", function ); return( -1 ); @@ -1484,7 +1535,7 @@ while( ( utf16_string_index < utf16_string_size ) && ( utf8_stream_index < utf8_stream_size ) ) { - /* Convert the UTF-16 character bytes into a Unicode character + /* Convert the UTF-16 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16( &utf16_unicode_character, @@ -1502,7 +1553,7 @@ return( -1 ); } - /* Convert the UTF-8 character bytes into a Unicode character + /* Convert the UTF-8 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &utf8_stream_unicode_character, @@ -1520,19 +1571,26 @@ return( -1 ); } - if( utf16_unicode_character != utf8_stream_unicode_character ) + if( utf16_unicode_character < utf8_stream_unicode_character ) + { + return( LIBUNA_COMPARE_LESS ); + } + else if( utf16_unicode_character > utf8_stream_unicode_character ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } } /* Check if both strings were entirely processed */ - if( ( utf16_string_index != utf16_string_size ) - || ( utf8_stream_index != utf8_stream_size ) ) + if( utf16_string_index < utf16_string_size ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } - return( 1 ); + else if( utf8_stream_index < utf8_stream_size ) + { + return( LIBUNA_COMPARE_LESS ); + } + return( LIBUNA_COMPARE_EQUAL ); } /* Determines the size of an UTF-16 string from an UTF-16 stream @@ -1572,14 +1630,13 @@ return( -1 ); } - if( ( utf16_stream_size < 2 ) - || ( ( utf16_stream_size % 2 ) != 0 ) ) + if( ( utf16_stream_size % 2 ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-16 stream bytes.", + "%s: missing UTF-16 stream value.", function ); return( -1 ); @@ -1597,23 +1654,30 @@ } *utf16_string_size = 0; - /* Check if UTF-16 stream is in big or little endian - */ - if( ( utf16_stream[ 0 ] == 0x0ff ) - && ( utf16_stream[ 1 ] == 0x0fe ) ) + if( utf16_stream_size == 0 ) { - read_byte_order = LIBUNA_ENDIAN_LITTLE; - utf16_stream_index = 2; + return( 1 ); } - else if( ( utf16_stream[ 0 ] == 0x0fe ) - && ( utf16_stream[ 1 ] == 0x0ff ) ) - { - read_byte_order = LIBUNA_ENDIAN_BIG; - utf16_stream_index = 2; - } - if( byte_order == 0 ) + /* Check if UTF-16 stream is in big or little endian + */ + if( utf16_stream_size >= 2 ) { - byte_order = read_byte_order; + if( ( utf16_stream[ 0 ] == 0x0ff ) + && ( utf16_stream[ 1 ] == 0x0fe ) ) + { + read_byte_order = LIBUNA_ENDIAN_LITTLE; + utf16_stream_index = 2; + } + else if( ( utf16_stream[ 0 ] == 0x0fe ) + && ( utf16_stream[ 1 ] == 0x0ff ) ) + { + read_byte_order = LIBUNA_ENDIAN_BIG; + utf16_stream_index = 2; + } + if( byte_order == 0 ) + { + byte_order = read_byte_order; + } } if( ( byte_order != LIBUNA_ENDIAN_BIG ) && ( byte_order != LIBUNA_ENDIAN_LITTLE ) ) @@ -1627,16 +1691,9 @@ return( -1 ); } - /* Check if the UTF-16 stream is terminated with zero bytes - */ - if( ( utf16_stream[ utf16_stream_size - 2 ] != 0 ) - || ( utf16_stream[ utf16_stream_size - 1 ] != 0 ) ) - { - *utf16_string_size += 1; - } while( ( utf16_stream_index + 1 ) < utf16_stream_size ) { - /* Convert the UTF-16 stream bytes into a Unicode character + /* Convert the UTF-16 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16_stream( &unicode_character, @@ -1672,16 +1729,11 @@ return( -1 ); } } - if( utf16_stream_index != utf16_stream_size ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-16 stream bytes.", - function ); - - return( -1 ); + *utf16_string_size += 1; } return( 1 ); } @@ -1736,7 +1788,6 @@ static char *function = "libuna_utf16_string_with_index_copy_from_utf16_stream"; size_t utf16_stream_index = 0; libuna_unicode_character_t unicode_character = 0; - uint8_t zero_byte = 0; int read_byte_order = 0; if( utf16_string == NULL ) @@ -1794,35 +1845,38 @@ return( -1 ); } - if( ( utf16_stream_size < 2 ) + if( ( utf16_stream_size == 0 ) || ( ( utf16_stream_size % 2 ) != 0 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-16 stream bytes.", + "%s: missing UTF-16 stream value.", function ); return( -1 ); } /* Check if UTF-16 stream is in big or little endian */ - if( ( utf16_stream[ 0 ] == 0x0ff ) - && ( utf16_stream[ 1 ] == 0x0fe ) ) - { - read_byte_order = LIBUNA_ENDIAN_LITTLE; - utf16_stream_index = 2; - } - else if( ( utf16_stream[ 0 ] == 0x0fe ) - && ( utf16_stream[ 1 ] == 0x0ff ) ) + if( utf16_stream_size >= 2 ) { - read_byte_order = LIBUNA_ENDIAN_BIG; - utf16_stream_index = 2; - } - if( byte_order == 0 ) - { - byte_order = read_byte_order; + if( ( utf16_stream[ 0 ] == 0x0ff ) + && ( utf16_stream[ 1 ] == 0x0fe ) ) + { + read_byte_order = LIBUNA_ENDIAN_LITTLE; + utf16_stream_index = 2; + } + else if( ( utf16_stream[ 0 ] == 0x0fe ) + && ( utf16_stream[ 1 ] == 0x0ff ) ) + { + read_byte_order = LIBUNA_ENDIAN_BIG; + utf16_stream_index = 2; + } + if( byte_order == 0 ) + { + byte_order = read_byte_order; + } } if( ( byte_order != LIBUNA_ENDIAN_BIG ) && ( byte_order != LIBUNA_ENDIAN_LITTLE ) ) @@ -1836,16 +1890,9 @@ return( -1 ); } - /* Check if the UTF-16 stream is terminated with zero bytes - */ - if( ( utf16_stream[ utf16_stream_size - 2 ] != 0 ) - || ( utf16_stream[ utf16_stream_size - 1 ] != 0 ) ) - { - zero_byte = 1; - } while( ( utf16_stream_index + 1 ) < utf16_stream_size ) { - /* Convert the UTF-16 stream bytes into a Unicode character + /* Convert the UTF-16 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16_stream( &unicode_character, @@ -1883,18 +1930,9 @@ return( -1 ); } } - if( utf16_stream_index != utf16_stream_size ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-16 stream bytes.", - function ); - - return( -1 ); - } - if( zero_byte != 0 ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { if( *utf16_string_index >= utf16_string_size ) { @@ -1915,7 +1953,7 @@ } /* Compares an UTF-16 string with an UTF-16 stream - * Returns 1 if the strings are equal, 0 if not or -1 on error + * Returns LIBUNA_COMPARE_LESS, LIBUNA_COMPARE_EQUAL, LIBUNA_COMPARE_GREATER if successful or -1 on error */ int libuna_utf16_string_compare_with_utf16_stream( const libuna_utf16_character_t *utf16_string, @@ -1976,35 +2014,38 @@ return( -1 ); } - if( ( utf16_stream_size < 2 ) + if( ( utf16_stream_size == 0 ) || ( ( utf16_stream_size % 2 ) != 0 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-16 stream bytes.", + "%s: missing UTF-16 stream value.", function ); return( -1 ); } /* Check if UTF-16 stream is in big or little endian */ - if( ( utf16_stream[ 0 ] == 0xfe ) - && ( utf16_stream[ 1 ] == 0xff ) ) + if( utf16_stream_size >= 2 ) { - read_byte_order = LIBUNA_ENDIAN_BIG; - utf16_stream_index = 2; - } - else if( ( utf16_stream[ 0 ] == 0xff ) - && ( utf16_stream[ 1 ] == 0xfe ) ) - { - read_byte_order = LIBUNA_ENDIAN_LITTLE; - utf16_stream_index = 2; - } - if( byte_order == 0 ) - { - byte_order = read_byte_order; + if( ( utf16_stream[ 0 ] == 0xfe ) + && ( utf16_stream[ 1 ] == 0xff ) ) + { + read_byte_order = LIBUNA_ENDIAN_BIG; + utf16_stream_index = 2; + } + else if( ( utf16_stream[ 0 ] == 0xff ) + && ( utf16_stream[ 1 ] == 0xfe ) ) + { + read_byte_order = LIBUNA_ENDIAN_LITTLE; + utf16_stream_index = 2; + } + if( byte_order == 0 ) + { + byte_order = read_byte_order; + } } if( ( byte_order != LIBUNA_ENDIAN_BIG ) && ( byte_order != LIBUNA_ENDIAN_LITTLE ) ) @@ -2032,7 +2073,7 @@ while( ( utf16_string_index < utf16_string_size ) && ( utf16_stream_index < utf16_stream_size ) ) { - /* Convert the UTF-16 character bytes into a Unicode character + /* Convert the UTF-16 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16( &utf16_unicode_character, @@ -2050,7 +2091,7 @@ return( -1 ); } - /* Convert the UTF-16 stream bytes into a Unicode character + /* Convert the UTF-16 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16_stream( &utf16_stream_unicode_character, @@ -2069,19 +2110,26 @@ return( -1 ); } - if( utf16_unicode_character != utf16_stream_unicode_character ) + if( utf16_unicode_character < utf16_stream_unicode_character ) + { + return( LIBUNA_COMPARE_LESS ); + } + else if( utf16_unicode_character > utf16_stream_unicode_character ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } } /* Check if both strings were entirely processed */ - if( ( utf16_string_index != utf16_string_size ) - || ( utf16_stream_index != utf16_stream_size ) ) + if( utf16_string_index < utf16_string_size ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } - return( 1 ); + else if( utf16_stream_index < utf16_stream_size ) + { + return( LIBUNA_COMPARE_LESS ); + } + return( LIBUNA_COMPARE_EQUAL ); } /* Determines the size of an UTF-16 string from an UTF-32 string @@ -2132,9 +2180,13 @@ } *utf16_string_size = 0; + if( utf32_string_size == 0 ) + { + return( 1 ); + } while( utf32_string_index < utf32_string_size ) { - /* Convert the UTF-32 character bytes into a Unicode character + /* Convert the UTF-32 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32( &unicode_character, @@ -2169,6 +2221,12 @@ return( -1 ); } } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + *utf16_string_size += 1; + } return( 1 ); } @@ -2275,9 +2333,20 @@ return( -1 ); } + if( utf32_string_size == 0 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-32 string value.", + function ); + + return( -1 ); + } while( utf32_string_index < utf32_string_size ) { - /* Convert the UTF-32 character bytes into a Unicode character + /* Convert the UTF-32 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32( &unicode_character, @@ -2314,11 +2383,30 @@ return( -1 ); } } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + if( *utf16_string_index >= utf16_string_size ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, + "%s: UTF-16 string too small.", + function ); + + return( -1 ); + } + utf16_string[ *utf16_string_index ] = 0; + + *utf16_string_index += 1; + } return( 1 ); } /* Compares an UTF-16 string with an UTF-32 string - * Returns 1 if the strings are equal, 0 if not or -1 on error + * Returns LIBUNA_COMPARE_LESS, LIBUNA_COMPARE_EQUAL, LIBUNA_COMPARE_GREATER if successful or -1 on error */ int libuna_utf16_string_compare_with_utf32( const libuna_utf16_character_t *utf16_string, @@ -2377,6 +2465,17 @@ return( -1 ); } + if( utf32_string_size == 0 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-32 string value.", + function ); + + return( -1 ); + } if( utf16_string[ utf16_string_size - 1 ] == 0 ) { utf16_string_size -= 1; @@ -2388,7 +2487,7 @@ while( ( utf16_string_index < utf16_string_size ) && ( utf32_string_index < utf32_string_size ) ) { - /* Convert the UTF-16 character bytes into a Unicode character + /* Convert the UTF-16 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16( &utf16_unicode_character, @@ -2406,7 +2505,7 @@ return( -1 ); } - /* Convert the UTF-32 character bytes into a Unicode character + /* Convert the UTF-32 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32( &utf32_unicode_character, @@ -2424,19 +2523,26 @@ return( -1 ); } - if( utf16_unicode_character != utf32_unicode_character ) + if( utf16_unicode_character < utf32_unicode_character ) { - return( 0 ); + return( LIBUNA_COMPARE_LESS ); + } + else if( utf16_unicode_character > utf32_unicode_character ) + { + return( LIBUNA_COMPARE_GREATER ); } } /* Check if both strings were entirely processed */ - if( ( utf16_string_index != utf16_string_size ) - || ( utf32_string_index != utf32_string_size ) ) + if( utf16_string_index < utf16_string_size ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } - return( 1 ); + else if( utf32_string_index < utf32_string_size ) + { + return( LIBUNA_COMPARE_LESS ); + } + return( LIBUNA_COMPARE_EQUAL ); } /* Determines the size of an UTF-16 string from an UTF-32 stream @@ -2476,14 +2582,13 @@ return( -1 ); } - if( ( utf32_stream_size < 4 ) - || ( ( utf32_stream_size % 4 ) != 0 ) ) + if( ( utf32_stream_size % 4 ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-32 stream bytes.", + "%s: missing UTF-32 stream value.", function ); return( -1 ); @@ -2501,27 +2606,34 @@ } *utf16_string_size = 0; - /* Check if UTF-32 stream is in big or little endian - */ - if( ( utf32_stream[ 0 ] == 0x00 ) - && ( utf32_stream[ 1 ] == 0x00 ) - && ( utf32_stream[ 2 ] == 0xfe ) - && ( utf32_stream[ 3 ] == 0xff ) ) + if( utf32_stream_size == 0 ) { - read_byte_order = LIBUNA_ENDIAN_BIG; - utf32_stream_index = 4; + return( 1 ); } - else if( ( utf32_stream[ 0 ] == 0xff ) - && ( utf32_stream[ 1 ] == 0xfe ) - && ( utf32_stream[ 2 ] == 0x00 ) - && ( utf32_stream[ 3 ] == 0x00 ) ) - { - read_byte_order = LIBUNA_ENDIAN_LITTLE; - utf32_stream_index = 4; - } - if( byte_order == 0 ) + /* Check if UTF-32 stream is in big or little endian + */ + if( utf32_stream_size >= 4 ) { - byte_order = read_byte_order; + if( ( utf32_stream[ 0 ] == 0x00 ) + && ( utf32_stream[ 1 ] == 0x00 ) + && ( utf32_stream[ 2 ] == 0xfe ) + && ( utf32_stream[ 3 ] == 0xff ) ) + { + read_byte_order = LIBUNA_ENDIAN_BIG; + utf32_stream_index = 4; + } + else if( ( utf32_stream[ 0 ] == 0xff ) + && ( utf32_stream[ 1 ] == 0xfe ) + && ( utf32_stream[ 2 ] == 0x00 ) + && ( utf32_stream[ 3 ] == 0x00 ) ) + { + read_byte_order = LIBUNA_ENDIAN_LITTLE; + utf32_stream_index = 4; + } + if( byte_order == 0 ) + { + byte_order = read_byte_order; + } } if( ( byte_order != LIBUNA_ENDIAN_BIG ) && ( byte_order != LIBUNA_ENDIAN_LITTLE ) ) @@ -2535,18 +2647,9 @@ return( -1 ); } - /* Check if the UTF-32 stream is terminated with zero bytes - */ - if( ( utf32_stream[ utf32_stream_size - 4 ] != 0 ) - || ( utf32_stream[ utf32_stream_size - 3 ] != 0 ) - || ( utf32_stream[ utf32_stream_size - 2 ] != 0 ) - || ( utf32_stream[ utf32_stream_size - 1 ] != 0 ) ) + while( ( utf32_stream_index + 3 ) < utf32_stream_size ) { - *utf16_string_size += 1; - } - while( ( utf32_stream_index + 1 ) < utf32_stream_size ) - { - /* Convert the UTF-32 stream bytes into a Unicode character + /* Convert the UTF-32 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32_stream( &unicode_character, @@ -2582,16 +2685,11 @@ return( -1 ); } } - if( utf32_stream_index != utf32_stream_size ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-32 stream bytes.", - function ); - - return( -1 ); + *utf16_string_size += 1; } return( 1 ); } @@ -2646,7 +2744,6 @@ static char *function = "libuna_utf16_string_with_index_copy_from_utf32_stream"; size_t utf32_stream_index = 0; libuna_unicode_character_t unicode_character = 0; - uint8_t zero_byte = 0; int read_byte_order = 0; if( utf16_string == NULL ) @@ -2704,39 +2801,42 @@ return( -1 ); } - if( ( utf32_stream_size < 4 ) + if( ( utf32_stream_size == 0 ) || ( ( utf32_stream_size % 4 ) != 0 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-32 stream bytes.", + "%s: missing UTF-32 stream value.", function ); return( -1 ); } /* Check if UTF-32 stream is in big or little endian */ - if( ( utf32_stream[ 0 ] == 0x00 ) - && ( utf32_stream[ 1 ] == 0x00 ) - && ( utf32_stream[ 2 ] == 0xfe ) - && ( utf32_stream[ 3 ] == 0xff ) ) - { - read_byte_order = LIBUNA_ENDIAN_BIG; - utf32_stream_index = 4; - } - else if( ( utf32_stream[ 0 ] == 0xff ) - && ( utf32_stream[ 1 ] == 0xfe ) - && ( utf32_stream[ 2 ] == 0x00 ) - && ( utf32_stream[ 3 ] == 0x00 ) ) + if( utf32_stream_size >=4 ) { - read_byte_order = LIBUNA_ENDIAN_LITTLE; - utf32_stream_index = 4; - } - if( byte_order == 0 ) - { - byte_order = read_byte_order; + if( ( utf32_stream[ 0 ] == 0x00 ) + && ( utf32_stream[ 1 ] == 0x00 ) + && ( utf32_stream[ 2 ] == 0xfe ) + && ( utf32_stream[ 3 ] == 0xff ) ) + { + read_byte_order = LIBUNA_ENDIAN_BIG; + utf32_stream_index = 4; + } + else if( ( utf32_stream[ 0 ] == 0xff ) + && ( utf32_stream[ 1 ] == 0xfe ) + && ( utf32_stream[ 2 ] == 0x00 ) + && ( utf32_stream[ 3 ] == 0x00 ) ) + { + read_byte_order = LIBUNA_ENDIAN_LITTLE; + utf32_stream_index = 4; + } + if( byte_order == 0 ) + { + byte_order = read_byte_order; + } } if( ( byte_order != LIBUNA_ENDIAN_BIG ) && ( byte_order != LIBUNA_ENDIAN_LITTLE ) ) @@ -2750,18 +2850,9 @@ return( -1 ); } - /* Check if the UTF-32 stream is terminated with zero bytes - */ - if( ( utf32_stream[ utf32_stream_size - 4 ] != 0 ) - || ( utf32_stream[ utf32_stream_size - 3 ] != 0 ) - || ( utf32_stream[ utf32_stream_size - 2 ] != 0 ) - || ( utf32_stream[ utf32_stream_size - 1 ] != 0 ) ) - { - zero_byte = 1; - } - while( ( utf32_stream_index + 1 ) < utf32_stream_size ) + while( ( utf32_stream_index + 3 ) < utf32_stream_size ) { - /* Convert the UTF-32 stream bytes into a Unicode character + /* Convert the UTF-32 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32_stream( &unicode_character, @@ -2799,18 +2890,9 @@ return( -1 ); } } - if( utf32_stream_index != utf32_stream_size ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-32 stream bytes.", - function ); - - return( -1 ); - } - if( zero_byte != 0 ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { if( *utf16_string_index >= utf16_string_size ) { @@ -2831,7 +2913,7 @@ } /* Compares an UTF-16 string with an UTF-32 stream - * Returns 1 if the strings are equal, 0 if not or -1 on error + * Returns LIBUNA_COMPARE_LESS, LIBUNA_COMPARE_EQUAL, LIBUNA_COMPARE_GREATER if successful or -1 on error */ int libuna_utf16_string_compare_with_utf32_stream( const libuna_utf16_character_t *utf16_string, @@ -2892,39 +2974,42 @@ return( -1 ); } - if( ( utf32_stream_size < 4 ) + if( ( utf32_stream_size == 0 ) || ( ( utf32_stream_size % 4 ) != 0 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-32 stream bytes.", + "%s: missing UTF-32 stream value.", function ); return( -1 ); } /* Check if UTF-32 stream is in big or little endian */ - if( ( utf32_stream[ 0 ] == 0x00 ) - && ( utf32_stream[ 1 ] == 0x00 ) - && ( utf32_stream[ 2 ] == 0xfe ) - && ( utf32_stream[ 3 ] == 0xff ) ) - { - read_byte_order = LIBUNA_ENDIAN_BIG; - utf32_stream_index = 4; - } - else if( ( utf32_stream[ 0 ] == 0xff ) - && ( utf32_stream[ 1 ] == 0xfe ) - && ( utf32_stream[ 2 ] == 0x00 ) - && ( utf32_stream[ 3 ] == 0x00 ) ) + if( utf32_stream_size >= 4 ) { - read_byte_order = LIBUNA_ENDIAN_LITTLE; - utf32_stream_index = 4; - } - if( byte_order == 0 ) - { - byte_order = read_byte_order; + if( ( utf32_stream[ 0 ] == 0x00 ) + && ( utf32_stream[ 1 ] == 0x00 ) + && ( utf32_stream[ 2 ] == 0xfe ) + && ( utf32_stream[ 3 ] == 0xff ) ) + { + read_byte_order = LIBUNA_ENDIAN_BIG; + utf32_stream_index = 4; + } + else if( ( utf32_stream[ 0 ] == 0xff ) + && ( utf32_stream[ 1 ] == 0xfe ) + && ( utf32_stream[ 2 ] == 0x00 ) + && ( utf32_stream[ 3 ] == 0x00 ) ) + { + read_byte_order = LIBUNA_ENDIAN_LITTLE; + utf32_stream_index = 4; + } + if( byte_order == 0 ) + { + byte_order = read_byte_order; + } } if( ( byte_order != LIBUNA_ENDIAN_BIG ) && ( byte_order != LIBUNA_ENDIAN_LITTLE ) ) @@ -2954,7 +3039,7 @@ while( ( utf16_string_index < utf16_string_size ) && ( utf32_stream_index < utf32_stream_size ) ) { - /* Convert the UTF-16 character bytes into a Unicode character + /* Convert the UTF-16 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16( &utf16_unicode_character, @@ -2972,7 +3057,7 @@ return( -1 ); } - /* Convert the UTF-32 stream bytes into a Unicode character + /* Convert the UTF-32 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32_stream( &utf32_stream_unicode_character, @@ -2991,18 +3076,25 @@ return( -1 ); } - if( utf16_unicode_character != utf32_stream_unicode_character ) + if( utf16_unicode_character < utf32_stream_unicode_character ) { - return( 0 ); + return( LIBUNA_COMPARE_LESS ); + } + else if( utf16_unicode_character > utf32_stream_unicode_character ) + { + return( LIBUNA_COMPARE_GREATER ); } } /* Check if both strings were entirely processed */ - if( ( utf16_string_index != utf16_string_size ) - || ( utf32_stream_index != utf32_stream_size ) ) + if( utf16_string_index < utf16_string_size ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } - return( 1 ); + else if( utf32_stream_index < utf32_stream_size ) + { + return( LIBUNA_COMPARE_LESS ); + } + return( LIBUNA_COMPARE_EQUAL ); } diff -Nru libsmdev-20171112/libuna/libuna_utf16_string.h libsmdev-20181227/libuna/libuna_utf16_string.h --- libsmdev-20171112/libuna/libuna_utf16_string.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_utf16_string.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * UTF-16 string functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_utf32_stream.c libsmdev-20181227/libuna/libuna_utf32_stream.c --- libsmdev-20171112/libuna/libuna_utf32_stream.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_utf32_stream.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * UTF-32 stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -125,8 +125,8 @@ libcerror_error_t **error ) { static char *function = "libuna_utf32_stream_size_from_utf8"; - size_t utf8_string_index = 0; libuna_unicode_character_t unicode_character = 0; + size_t utf8_string_index = 0; if( utf8_string == NULL ) { @@ -167,7 +167,7 @@ while( utf8_string_index < utf8_string_size ) { - /* Convert the UTF-8 character bytes into a Unicode character + /* Convert the UTF-8 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &unicode_character, @@ -201,6 +201,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } /* Convert the number of characters into bytes */ @@ -221,9 +225,9 @@ libcerror_error_t **error ) { static char *function = "libuna_utf32_stream_copy_from_utf8"; - size_t utf8_string_index = 0; - size_t utf32_stream_index = 0; libuna_unicode_character_t unicode_character = 0; + size_t utf32_stream_index = 0; + size_t utf8_string_index = 0; if( utf32_stream == NULL ) { @@ -299,7 +303,7 @@ } while( utf8_string_index < utf8_string_size ) { - /* Convert the UTF-8 string bytes into a Unicode character + /* Convert the UTF-8 string bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &unicode_character, @@ -336,6 +340,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } @@ -350,8 +358,8 @@ libcerror_error_t **error ) { static char *function = "libuna_utf32_stream_size_from_utf16"; - size_t utf16_string_index = 0; libuna_unicode_character_t unicode_character = 0; + size_t utf16_string_index = 0; if( utf16_string == NULL ) { @@ -392,7 +400,7 @@ while( utf16_string_index < utf16_string_size ) { - /* Convert the UTF-16 character bytes into a Unicode character + /* Convert the UTF-16 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16( &unicode_character, @@ -426,6 +434,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } /* Convert the number of characters into bytes */ @@ -446,9 +458,9 @@ libcerror_error_t **error ) { static char *function = "libuna_utf32_stream_copy_from_utf16"; + libuna_unicode_character_t unicode_character = 0; size_t utf16_string_index = 0; size_t utf32_stream_index = 0; - libuna_unicode_character_t unicode_character = 0; if( utf32_stream == NULL ) { @@ -524,7 +536,7 @@ } while( utf16_string_index < utf16_string_size ) { - /* Convert the UTF-16 string bytes into a Unicode character + /* Convert the UTF-16 string bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16( &unicode_character, @@ -561,6 +573,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } @@ -574,7 +590,9 @@ size_t *utf32_stream_size, libcerror_error_t **error ) { - static char *function = "libuna_utf32_stream_size_from_utf32"; + static char *function = "libuna_utf32_stream_size_from_utf32"; + libuna_unicode_character_t unicode_character = 0; + size_t utf32_string_index = 0; if( utf32_string == NULL ) { @@ -610,10 +628,50 @@ return( -1 ); } /* Add the byte order mark - * Assumes the UTF-32 string is santized */ - *utf32_stream_size = 1 + utf32_string_size; + *utf32_stream_size = 1; + while( utf32_string_index < utf32_string_size ) + { + /* Convert the UTF-32 character bytes into an Unicode character + */ + if( libuna_unicode_character_copy_from_utf32( + &unicode_character, + utf32_string, + utf32_string_size, + &utf32_string_index, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, + "%s: unable to copy Unicode character from UTF-32.", + function ); + + return( -1 ); + } + /* Determine how many UTF-32 character bytes are required + */ + if( libuna_unicode_character_size_to_utf32( + unicode_character, + utf32_stream_size, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_OUTPUT_FAILED, + "%s: unable to determine size of Unicode character in UTF-32.", + function ); + + return( -1 ); + } + if( unicode_character == 0 ) + { + break; + } + } /* Convert the number of characters into bytes */ *utf32_stream_size *= 4; @@ -632,10 +690,10 @@ size_t utf32_string_size, libcerror_error_t **error ) { - static char *function = "libuna_utf32_stream_copy_from_utf32"; - size_t utf32_string_index = 0; - size_t utf32_stream_index = 0; - libuna_utf32_character_t utf32_character = 0; + static char *function = "libuna_utf32_stream_copy_from_utf32"; + libuna_unicode_character_t unicode_character = 0; + size_t utf32_stream_index = 0; + size_t utf32_string_index = 0; if( utf32_stream == NULL ) { @@ -709,44 +767,49 @@ return( -1 ); } - /* Assumes the UTF-32 string is santized - */ while( utf32_string_index < utf32_string_size ) { - if( ( utf32_stream_index + 4 ) > utf32_stream_size ) + /* Convert the UTF-32 string bytes into an Unicode character + */ + if( libuna_unicode_character_copy_from_utf32( + &unicode_character, + utf32_string, + utf32_string_size, + &utf32_string_index, + error ) != 1 ) { libcerror_error_set( error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: UTF-32 stream too small.", + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, + "%s: unable to copy Unicode character from UTF-32 string.", function ); return( -1 ); } - utf32_character = utf32_string[ utf32_string_index++ ]; - - if( byte_order == LIBUNA_ENDIAN_BIG ) + /* Convert the Unicode character into UTF-32 stream bytes + */ + if( libuna_unicode_character_copy_to_utf32_stream( + unicode_character, + utf32_stream, + utf32_stream_size, + &utf32_stream_index, + byte_order, + error ) != 1 ) { - utf32_stream[ utf32_stream_index + 2 ] = (uint8_t) ( utf32_character & 0xff ); - utf32_character >>= 8; - utf32_stream[ utf32_stream_index + 3 ] = (uint8_t) ( utf32_character & 0xff ); - utf32_character >>= 8; - utf32_stream[ utf32_stream_index + 1 ] = (uint8_t) ( utf32_character & 0xff ); - utf32_character >>= 8; - utf32_stream[ utf32_stream_index ] = (uint8_t) ( utf32_character & 0xff ); + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_OUTPUT_FAILED, + "%s: unable to copy Unicode character to UTF-32 stream.", + function ); + + return( -1 ); } - else if( byte_order == LIBUNA_ENDIAN_LITTLE ) + if( unicode_character == 0 ) { - utf32_stream[ utf32_stream_index ] = (uint8_t) ( utf32_character & 0xff ); - utf32_character >>= 8; - utf32_stream[ utf32_stream_index + 1 ] = (uint8_t) ( utf32_character & 0xff ); - utf32_character >>= 8; - utf32_stream[ utf32_stream_index + 2 ] = (uint8_t) ( utf32_character & 0xff ); - utf32_character >>= 8; - utf32_stream[ utf32_stream_index + 3 ] = (uint8_t) ( utf32_character & 0xff ); + break; } - utf32_stream_index += 4; } return( 1 ); } diff -Nru libsmdev-20171112/libuna/libuna_utf32_stream.h libsmdev-20181227/libuna/libuna_utf32_stream.h --- libsmdev-20171112/libuna/libuna_utf32_stream.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_utf32_stream.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * UTF-32 stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_utf32_string.c libsmdev-20181227/libuna/libuna_utf32_string.c --- libsmdev-20171112/libuna/libuna_utf32_string.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_utf32_string.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * UTF-32 string functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -77,15 +77,13 @@ } *utf32_string_size = 0; - /* Check if the byte stream is terminated with a zero byte - */ - if( byte_stream[ byte_stream_size - 1 ] != 0 ) + if( byte_stream_size == 0 ) { - *utf32_string_size += 1; + return( 1 ); } while( byte_stream_index < byte_stream_size ) { - /* Convert the byte stream bytes into a Unicode character + /* Convert the byte stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_byte_stream( &unicode_character, @@ -121,6 +119,12 @@ return( -1 ); } } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + *utf32_string_size += 1; + } return( 1 ); } @@ -174,7 +178,6 @@ static char *function = "libuna_utf32_string_with_index_copy_from_byte_stream"; size_t byte_stream_index = 0; libuna_unicode_character_t unicode_character = 0; - uint8_t zero_byte = 0; if( utf32_string == NULL ) { @@ -231,15 +234,20 @@ return( -1 ); } - /* Check if the byte stream is terminated with zero bytes - */ - if( byte_stream[ byte_stream_size - 1 ] != 0 ) + if( byte_stream_size == 0 ) { - zero_byte = 1; + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing byte stream value.", + function ); + + return( -1 ); } while( byte_stream_index < byte_stream_size ) { - /* Convert the byte stream bytes into a Unicode character + /* Convert the byte stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_byte_stream( &unicode_character, @@ -277,7 +285,9 @@ return( -1 ); } } - if( zero_byte != 0 ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { if( *utf32_string_index >= utf32_string_size ) { @@ -298,7 +308,7 @@ } /* Compares an UTF-32 string with a byte stream - * Returns 1 if the strings are equal, 0 if not or -1 on error + * Returns LIBUNA_COMPARE_LESS, LIBUNA_COMPARE_EQUAL, LIBUNA_COMPARE_GREATER if successful or -1 on error */ int libuna_utf32_string_compare_with_byte_stream( const libuna_utf32_character_t *utf32_string, @@ -358,6 +368,17 @@ return( -1 ); } + if( byte_stream_size == 0 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing byte stream value.", + function ); + + return( -1 ); + } if( utf32_string[ utf32_string_size - 1 ] == 0 ) { utf32_string_size -= 1; @@ -371,7 +392,7 @@ while( ( utf32_string_index < utf32_string_size ) && ( byte_stream_index < byte_stream_size ) ) { - /* Convert the UTF-32 character bytes into a Unicode character + /* Convert the UTF-32 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32( &utf32_unicode_character, @@ -389,7 +410,7 @@ return( -1 ); } - /* Convert the byte stream bytes into a Unicode character + /* Convert the byte stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_byte_stream( &byte_stream_unicode_character, @@ -408,19 +429,26 @@ return( -1 ); } - if( utf32_unicode_character != byte_stream_unicode_character ) + if( utf32_unicode_character < byte_stream_unicode_character ) { - return( 0 ); + return( LIBUNA_COMPARE_LESS ); + } + else if( utf32_unicode_character > byte_stream_unicode_character ) + { + return( LIBUNA_COMPARE_GREATER ); } } /* Check if both strings were entirely processed */ - if( ( utf32_string_index != utf32_string_size ) - || ( byte_stream_index != byte_stream_size ) ) + if( utf32_string_index < utf32_string_size ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } - return( 1 ); + else if( byte_stream_index < byte_stream_size ) + { + return( LIBUNA_COMPARE_LESS ); + } + return( LIBUNA_COMPARE_EQUAL ); } /* Determines the size of an UTF-32 string from an UTF-7 stream @@ -459,17 +487,6 @@ return( -1 ); } - if( utf7_stream_size < 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-7 stream bytes.", - function ); - - return( -1 ); - } if( utf32_string_size == NULL ) { libcerror_error_set( @@ -483,15 +500,13 @@ } *utf32_string_size = 0; - /* Check if the UTF-7 stream is terminated with a zero byte - */ - if( utf7_stream[ utf7_stream_size - 1 ] != 0 ) + if( utf7_stream_size == 0 ) { - *utf32_string_size += 1; + return( 1 ); } while( utf7_stream_index < utf7_stream_size ) { - /* Convert the UTF-7 stream bytes into a Unicode character + /* Convert the UTF-7 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf7_stream( &unicode_character, @@ -527,6 +542,12 @@ return( -1 ); } } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + *utf32_string_size += 1; + } return( 1 ); } @@ -578,7 +599,6 @@ size_t utf7_stream_index = 0; libuna_unicode_character_t unicode_character = 0; uint32_t utf7_stream_base64_data = 0; - uint8_t zero_byte = 0; if( utf32_string == NULL ) { @@ -635,26 +655,20 @@ return( -1 ); } - if( utf7_stream_size < 1 ) + if( utf7_stream_size == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-7 stream bytes.", + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-7 stream value.", function ); return( -1 ); } - /* Check if the UTF-7 stream is terminated with zero bytes - */ - if( utf7_stream[ utf7_stream_size - 1 ] != 0 ) - { - zero_byte = 1; - } while( utf7_stream_index < utf7_stream_size ) { - /* Convert the UTF-7 stream bytes into a Unicode character + /* Convert the UTF-7 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf7_stream( &unicode_character, @@ -692,7 +706,9 @@ return( -1 ); } } - if( zero_byte != 0 ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { if( *utf32_string_index >= utf32_string_size ) { @@ -713,7 +729,7 @@ } /* Compares an UTF-32 string with an UTF-7 stream - * Returns 1 if the strings are equal, 0 if not or -1 on error + * Returns LIBUNA_COMPARE_LESS, LIBUNA_COMPARE_EQUAL, LIBUNA_COMPARE_GREATER if successful or -1 on error */ int libuna_utf32_string_compare_with_utf7_stream( const libuna_utf32_character_t *utf32_string, @@ -773,13 +789,13 @@ return( -1 ); } - if( utf7_stream_size < 1 ) + if( utf7_stream_size == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-7 stream bytes.", + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-7 stream value.", function ); return( -1 ); @@ -797,7 +813,7 @@ while( ( utf32_string_index < utf32_string_size ) && ( utf7_stream_index < utf7_stream_size ) ) { - /* Convert the UTF-32 character bytes into a Unicode character + /* Convert the UTF-32 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32( &utf32_unicode_character, @@ -815,7 +831,7 @@ return( -1 ); } - /* Convert the UTF-7 character bytes into a Unicode character + /* Convert the UTF-7 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf7_stream( &utf7_stream_unicode_character, @@ -834,22 +850,28 @@ return( -1 ); } - if( utf32_unicode_character != utf7_stream_unicode_character ) + if( utf32_unicode_character < utf7_stream_unicode_character ) { - return( 0 ); + return( LIBUNA_COMPARE_LESS ); + } + else if( utf32_unicode_character > utf7_stream_unicode_character ) + { + return( LIBUNA_COMPARE_GREATER ); } } /* Check if both strings were entirely processed */ - if( ( utf32_string_index != utf32_string_size ) - || ( utf7_stream_index != utf7_stream_size ) ) + if( utf32_string_index < utf32_string_size ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } - return( 1 ); + else if( utf7_stream_index < utf7_stream_size ) + { + return( LIBUNA_COMPARE_LESS ); + } + return( LIBUNA_COMPARE_EQUAL ); } - /* Determines the size of an UTF-32 string from an UTF-8 string * Returns 1 if successful or -1 on error */ @@ -898,9 +920,13 @@ } *utf32_string_size = 0; + if( utf8_string_size == 0 ) + { + return( 1 ); + } while( utf8_string_index < utf8_string_size ) { - /* Convert the UTF-8 character bytes into a Unicode character + /* Convert the UTF-8 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &unicode_character, @@ -935,6 +961,12 @@ return( -1 ); } } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + *utf32_string_size += 1; + } return( 1 ); } @@ -1041,9 +1073,20 @@ return( -1 ); } + if( utf8_string_size == 0 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-8 string value.", + function ); + + return( -1 ); + } while( utf8_string_index < utf8_string_size ) { - /* Convert the UTF-8 character bytes into a Unicode character + /* Convert the UTF-8 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &unicode_character, @@ -1080,6 +1123,25 @@ return( -1 ); } } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + if( *utf32_string_index >= utf32_string_size ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, + "%s: UTF-32 string too small.", + function ); + + return( -1 ); + } + utf32_string[ *utf32_string_index ] = 0; + + *utf32_string_index += 1; + } return( 1 ); } @@ -1118,17 +1180,6 @@ return( -1 ); } - if( utf8_stream_size < 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-8 stream bytes.", - function ); - - return( -1 ); - } if( utf32_string_size == NULL ) { libcerror_error_set( @@ -1142,6 +1193,10 @@ } *utf32_string_size = 0; + if( utf8_stream_size == 0 ) + { + return( 1 ); + } /* Check if UTF-8 stream starts with a byte order mark (BOM) */ if( utf8_stream_size >= 3 ) @@ -1153,15 +1208,9 @@ utf8_stream_index += 3; } } - /* Check if the UTF-8 stream is terminated with a zero byte - */ - if( utf8_stream[ utf8_stream_size - 1 ] != 0 ) - { - *utf32_string_size += 1; - } while( utf8_stream_index < utf8_stream_size ) { - /* Convert the UTF-8 stream bytes into a Unicode character + /* Convert the UTF-8 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &unicode_character, @@ -1196,6 +1245,12 @@ return( -1 ); } } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + *utf32_string_size += 1; + } return( 1 ); } @@ -1246,7 +1301,6 @@ static char *function = "libuna_utf32_string_with_index_copy_from_utf8_stream"; size_t utf8_stream_index = 0; libuna_unicode_character_t unicode_character = 0; - uint8_t zero_byte = 0; if( utf32_string == NULL ) { @@ -1303,13 +1357,13 @@ return( -1 ); } - if( utf8_stream_size < 1 ) + if( utf8_stream_size == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-8 stream bytes.", + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-8 stream value.", function ); return( -1 ); @@ -1325,15 +1379,9 @@ utf8_stream_index += 3; } } - /* Check if the UTF-8 stream is terminated with zero bytes - */ - if( utf8_stream[ utf8_stream_size - 1 ] != 0 ) - { - zero_byte = 1; - } while( utf8_stream_index < utf8_stream_size ) { - /* Convert the UTF-8 stream bytes into a Unicode character + /* Convert the UTF-8 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &unicode_character, @@ -1370,7 +1418,9 @@ return( -1 ); } } - if( zero_byte != 0 ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { if( *utf32_string_index >= utf32_string_size ) { @@ -1391,7 +1441,7 @@ } /* Compares an UTF-32 string with an UTF-8 stream - * Returns 1 if the strings are equal, 0 if not or -1 on error + * Returns LIBUNA_COMPARE_LESS, LIBUNA_COMPARE_EQUAL, LIBUNA_COMPARE_GREATER if successful or -1 on error */ int libuna_utf32_string_compare_with_utf8_stream( const libuna_utf32_character_t *utf32_string, @@ -1450,13 +1500,13 @@ return( -1 ); } - if( utf8_stream_size < 1 ) + if( utf8_stream_size == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-8 stream bytes.", + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-8 stream value.", function ); return( -1 ); @@ -1485,7 +1535,7 @@ while( ( utf32_string_index < utf32_string_size ) && ( utf8_stream_index < utf8_stream_size ) ) { - /* Convert the UTF-32 character bytes into a Unicode character + /* Convert the UTF-32 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32( &utf32_unicode_character, @@ -1503,7 +1553,7 @@ return( -1 ); } - /* Convert the UTF-8 character bytes into a Unicode character + /* Convert the UTF-8 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &utf8_stream_unicode_character, @@ -1521,19 +1571,26 @@ return( -1 ); } - if( utf32_unicode_character != utf8_stream_unicode_character ) + if( utf32_unicode_character < utf8_stream_unicode_character ) + { + return( LIBUNA_COMPARE_LESS ); + } + else if( utf32_unicode_character > utf8_stream_unicode_character ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } } /* Check if both strings were entirely processed */ - if( ( utf32_string_index != utf32_string_size ) - || ( utf8_stream_index != utf8_stream_size ) ) + if( utf32_string_index < utf32_string_size ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } - return( 1 ); + else if( utf8_stream_index < utf8_stream_size ) + { + return( LIBUNA_COMPARE_LESS ); + } + return( LIBUNA_COMPARE_EQUAL ); } /* Determines the size of an UTF-32 string from an UTF-16 string @@ -1584,9 +1641,13 @@ } *utf32_string_size = 0; + if( utf16_string_size == 0 ) + { + return( 1 ); + } while( utf16_string_index < utf16_string_size ) { - /* Convert the UTF-16 character bytes into a Unicode character + /* Convert the UTF-16 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16( &unicode_character, @@ -1621,6 +1682,12 @@ return( -1 ); } } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + *utf32_string_size += 1; + } return( 1 ); } @@ -1727,9 +1794,20 @@ return( -1 ); } + if( utf16_string_size == 0 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-16 string value.", + function ); + + return( -1 ); + } while( utf16_string_index < utf16_string_size ) { - /* Convert the UTF-16 character bytes into a Unicode character + /* Convert the UTF-16 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16( &unicode_character, @@ -1766,6 +1844,25 @@ return( -1 ); } } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + if( *utf32_string_index >= utf32_string_size ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, + "%s: UTF-32 string too small.", + function ); + + return( -1 ); + } + utf32_string[ *utf32_string_index ] = 0; + + *utf32_string_index += 1; + } return( 1 ); } @@ -1806,14 +1903,13 @@ return( -1 ); } - if( ( utf16_stream_size < 2 ) - || ( ( utf16_stream_size % 2 ) != 0 ) ) + if( ( utf16_stream_size % 2 ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-16 stream bytes.", + "%s: missing UTF-16 stream value.", function ); return( -1 ); @@ -1831,23 +1927,30 @@ } *utf32_string_size = 0; - /* Check if UTF-16 stream is in big or little endian - */ - if( ( utf16_stream[ 0 ] == 0x0ff ) - && ( utf16_stream[ 1 ] == 0x0fe ) ) + if( utf16_stream_size == 0 ) { - read_byte_order = LIBUNA_ENDIAN_LITTLE; - utf16_stream_index = 2; + return( 1 ); } - else if( ( utf16_stream[ 0 ] == 0x0fe ) - && ( utf16_stream[ 1 ] == 0x0ff ) ) - { - read_byte_order = LIBUNA_ENDIAN_BIG; - utf16_stream_index = 2; - } - if( byte_order == 0 ) + /* Check if UTF-16 stream is in big or little endian + */ + if( utf16_stream_size >= 2 ) { - byte_order = read_byte_order; + if( ( utf16_stream[ 0 ] == 0x0ff ) + && ( utf16_stream[ 1 ] == 0x0fe ) ) + { + read_byte_order = LIBUNA_ENDIAN_LITTLE; + utf16_stream_index = 2; + } + else if( ( utf16_stream[ 0 ] == 0x0fe ) + && ( utf16_stream[ 1 ] == 0x0ff ) ) + { + read_byte_order = LIBUNA_ENDIAN_BIG; + utf16_stream_index = 2; + } + if( byte_order == 0 ) + { + byte_order = read_byte_order; + } } if( ( byte_order != LIBUNA_ENDIAN_BIG ) && ( byte_order != LIBUNA_ENDIAN_LITTLE ) ) @@ -1861,16 +1964,9 @@ return( -1 ); } - /* Check if the UTF-16 stream is terminated with zero bytes - */ - if( ( utf16_stream[ utf16_stream_size - 2 ] != 0 ) - || ( utf16_stream[ utf16_stream_size - 1 ] != 0 ) ) - { - *utf32_string_size += 1; - } while( ( utf16_stream_index + 1 ) < utf16_stream_size ) { - /* Convert the UTF-16 stream bytes into a Unicode character + /* Convert the UTF-16 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16_stream( &unicode_character, @@ -1906,16 +2002,11 @@ return( -1 ); } } - if( utf16_stream_index != utf16_stream_size ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-16 stream bytes.", - function ); - - return( -1 ); + *utf32_string_size += 1; } return( 1 ); } @@ -1970,7 +2061,6 @@ static char *function = "libuna_utf32_string_with_index_copy_from_utf16_stream"; size_t utf16_stream_index = 0; libuna_unicode_character_t unicode_character = 0; - uint8_t zero_byte = 0; int read_byte_order = 0; if( utf32_string == NULL ) @@ -2028,35 +2118,38 @@ return( -1 ); } - if( ( utf16_stream_size < 2 ) + if( ( utf16_stream_size == 0 ) || ( ( utf16_stream_size % 2 ) != 0 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-16 stream bytes.", + "%s: missing UTF-16 stream value.", function ); return( -1 ); } /* Check if UTF-16 stream is in big or little endian */ - if( ( utf16_stream[ 0 ] == 0x0ff ) - && ( utf16_stream[ 1 ] == 0x0fe ) ) + if( utf16_stream_size >= 2 ) { - read_byte_order = LIBUNA_ENDIAN_LITTLE; - utf16_stream_index = 2; - } - else if( ( utf16_stream[ 0 ] == 0x0fe ) - && ( utf16_stream[ 1 ] == 0x0ff ) ) - { - read_byte_order = LIBUNA_ENDIAN_BIG; - utf16_stream_index = 2; - } - if( byte_order == 0 ) - { - byte_order = read_byte_order; + if( ( utf16_stream[ 0 ] == 0x0ff ) + && ( utf16_stream[ 1 ] == 0x0fe ) ) + { + read_byte_order = LIBUNA_ENDIAN_LITTLE; + utf16_stream_index = 2; + } + else if( ( utf16_stream[ 0 ] == 0x0fe ) + && ( utf16_stream[ 1 ] == 0x0ff ) ) + { + read_byte_order = LIBUNA_ENDIAN_BIG; + utf16_stream_index = 2; + } + if( byte_order == 0 ) + { + byte_order = read_byte_order; + } } if( ( byte_order != LIBUNA_ENDIAN_BIG ) && ( byte_order != LIBUNA_ENDIAN_LITTLE ) ) @@ -2070,16 +2163,9 @@ return( -1 ); } - /* Check if the UTF-16 stream is terminated with zero bytes - */ - if( ( utf16_stream[ utf16_stream_size - 2 ] != 0 ) - || ( utf16_stream[ utf16_stream_size - 1 ] != 0 ) ) - { - zero_byte = 1; - } while( ( utf16_stream_index + 1 ) < utf16_stream_size ) { - /* Convert the UTF-16 stream bytes into a Unicode character + /* Convert the UTF-16 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16_stream( &unicode_character, @@ -2117,18 +2203,9 @@ return( -1 ); } } - if( utf16_stream_index != utf16_stream_size ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-16 stream bytes.", - function ); - - return( -1 ); - } - if( zero_byte != 0 ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { if( *utf32_string_index >= utf32_string_size ) { @@ -2149,7 +2226,7 @@ } /* Compares an UTF-32 string with an UTF-16 stream - * Returns 1 if the strings are equal, 0 if not or -1 on error + * Returns LIBUNA_COMPARE_LESS, LIBUNA_COMPARE_EQUAL, LIBUNA_COMPARE_GREATER if successful or -1 on error */ int libuna_utf32_string_compare_with_utf16_stream( const libuna_utf32_character_t *utf32_string, @@ -2210,35 +2287,38 @@ return( -1 ); } - if( ( utf16_stream_size < 2 ) + if( ( utf16_stream_size == 0 ) || ( ( utf16_stream_size % 2 ) != 0 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-16 stream bytes.", + "%s: missing UTF-16 stream value.", function ); return( -1 ); } /* Check if UTF-16 stream is in big or little endian */ - if( ( utf16_stream[ 0 ] == 0xfe ) - && ( utf16_stream[ 1 ] == 0xff ) ) - { - read_byte_order = LIBUNA_ENDIAN_BIG; - utf16_stream_index = 2; - } - else if( ( utf16_stream[ 0 ] == 0xff ) - && ( utf16_stream[ 1 ] == 0xfe ) ) + if( utf16_stream_size >= 2 ) { - read_byte_order = LIBUNA_ENDIAN_LITTLE; - utf16_stream_index = 2; - } - if( byte_order == 0 ) - { - byte_order = read_byte_order; + if( ( utf16_stream[ 0 ] == 0xfe ) + && ( utf16_stream[ 1 ] == 0xff ) ) + { + read_byte_order = LIBUNA_ENDIAN_BIG; + utf16_stream_index = 2; + } + else if( ( utf16_stream[ 0 ] == 0xff ) + && ( utf16_stream[ 1 ] == 0xfe ) ) + { + read_byte_order = LIBUNA_ENDIAN_LITTLE; + utf16_stream_index = 2; + } + if( byte_order == 0 ) + { + byte_order = read_byte_order; + } } if( ( byte_order != LIBUNA_ENDIAN_BIG ) && ( byte_order != LIBUNA_ENDIAN_LITTLE ) ) @@ -2266,7 +2346,7 @@ while( ( utf32_string_index < utf32_string_size ) && ( utf16_stream_index < utf16_stream_size ) ) { - /* Convert the UTF-32 character bytes into a Unicode character + /* Convert the UTF-32 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32( &utf32_unicode_character, @@ -2284,7 +2364,7 @@ return( -1 ); } - /* Convert the UTF-16 stream bytes into a Unicode character + /* Convert the UTF-16 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16_stream( &utf16_stream_unicode_character, @@ -2303,19 +2383,26 @@ return( -1 ); } - if( utf32_unicode_character != utf16_stream_unicode_character ) + if( utf32_unicode_character < utf16_stream_unicode_character ) + { + return( LIBUNA_COMPARE_LESS ); + } + else if( utf32_unicode_character > utf16_stream_unicode_character ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } } /* Check if both strings were entirely processed */ - if( ( utf32_string_index != utf32_string_size ) - || ( utf16_stream_index != utf16_stream_size ) ) + if( utf32_string_index < utf32_string_size ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } - return( 1 ); + else if( utf16_stream_index < utf16_stream_size ) + { + return( LIBUNA_COMPARE_LESS ); + } + return( LIBUNA_COMPARE_EQUAL ); } /* Determines the size of an UTF-32 string from an UTF-32 stream @@ -2355,14 +2442,13 @@ return( -1 ); } - if( ( utf32_stream_size < 4 ) - || ( ( utf32_stream_size % 4 ) != 0 ) ) + if( ( utf32_stream_size % 4 ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-32 stream bytes.", + "%s: missing UTF-32 stream value.", function ); return( -1 ); @@ -2380,27 +2466,34 @@ } *utf32_string_size = 0; - /* Check if UTF-32 stream is in big or little endian - */ - if( ( utf32_stream[ 0 ] == 0x00 ) - && ( utf32_stream[ 1 ] == 0x00 ) - && ( utf32_stream[ 2 ] == 0xfe ) - && ( utf32_stream[ 3 ] == 0xff ) ) - { - read_byte_order = LIBUNA_ENDIAN_BIG; - utf32_stream_index = 4; - } - else if( ( utf32_stream[ 0 ] == 0xff ) - && ( utf32_stream[ 1 ] == 0xfe ) - && ( utf32_stream[ 2 ] == 0x00 ) - && ( utf32_stream[ 3 ] == 0x00 ) ) + if( utf32_stream_size == 0 ) { - read_byte_order = LIBUNA_ENDIAN_LITTLE; - utf32_stream_index = 4; + return( 1 ); } - if( byte_order == 0 ) + /* Check if UTF-32 stream is in big or little endian + */ + if( utf32_stream_size >= 4 ) { - byte_order = read_byte_order; + if( ( utf32_stream[ 0 ] == 0x00 ) + && ( utf32_stream[ 1 ] == 0x00 ) + && ( utf32_stream[ 2 ] == 0xfe ) + && ( utf32_stream[ 3 ] == 0xff ) ) + { + read_byte_order = LIBUNA_ENDIAN_BIG; + utf32_stream_index = 4; + } + else if( ( utf32_stream[ 0 ] == 0xff ) + && ( utf32_stream[ 1 ] == 0xfe ) + && ( utf32_stream[ 2 ] == 0x00 ) + && ( utf32_stream[ 3 ] == 0x00 ) ) + { + read_byte_order = LIBUNA_ENDIAN_LITTLE; + utf32_stream_index = 4; + } + if( byte_order == 0 ) + { + byte_order = read_byte_order; + } } if( ( byte_order != LIBUNA_ENDIAN_BIG ) && ( byte_order != LIBUNA_ENDIAN_LITTLE ) ) @@ -2414,18 +2507,9 @@ return( -1 ); } - /* Check if the UTF-32 stream is terminated with zero bytes - */ - if( ( utf32_stream[ utf32_stream_size - 4 ] != 0 ) - || ( utf32_stream[ utf32_stream_size - 3 ] != 0 ) - || ( utf32_stream[ utf32_stream_size - 2 ] != 0 ) - || ( utf32_stream[ utf32_stream_size - 1 ] != 0 ) ) - { - *utf32_string_size += 1; - } while( ( utf32_stream_index + 1 ) < utf32_stream_size ) { - /* Convert the UTF-32 stream bytes into a Unicode character + /* Convert the UTF-32 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32_stream( &unicode_character, @@ -2461,16 +2545,11 @@ return( -1 ); } } - if( utf32_stream_index != utf32_stream_size ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-32 stream bytes.", - function ); - - return( -1 ); + *utf32_string_size += 1; } return( 1 ); } @@ -2525,7 +2604,6 @@ static char *function = "libuna_utf32_string_with_index_copy_from_utf32_stream"; size_t utf32_stream_index = 0; libuna_unicode_character_t unicode_character = 0; - uint8_t zero_byte = 0; int read_byte_order = 0; if( utf32_string == NULL ) @@ -2583,39 +2661,42 @@ return( -1 ); } - if( ( utf32_stream_size < 4 ) + if( ( utf32_stream_size == 0 ) || ( ( utf32_stream_size % 4 ) != 0 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-32 stream bytes.", + "%s: missing UTF-32 stream value.", function ); return( -1 ); } /* Check if UTF-32 stream is in big or little endian */ - if( ( utf32_stream[ 0 ] == 0x00 ) - && ( utf32_stream[ 1 ] == 0x00 ) - && ( utf32_stream[ 2 ] == 0xfe ) - && ( utf32_stream[ 3 ] == 0xff ) ) - { - read_byte_order = LIBUNA_ENDIAN_BIG; - utf32_stream_index = 4; - } - else if( ( utf32_stream[ 0 ] == 0xff ) - && ( utf32_stream[ 1 ] == 0xfe ) - && ( utf32_stream[ 2 ] == 0x00 ) - && ( utf32_stream[ 3 ] == 0x00 ) ) - { - read_byte_order = LIBUNA_ENDIAN_LITTLE; - utf32_stream_index = 4; - } - if( byte_order == 0 ) + if( utf32_stream_size >= 4 ) { - byte_order = read_byte_order; + if( ( utf32_stream[ 0 ] == 0x00 ) + && ( utf32_stream[ 1 ] == 0x00 ) + && ( utf32_stream[ 2 ] == 0xfe ) + && ( utf32_stream[ 3 ] == 0xff ) ) + { + read_byte_order = LIBUNA_ENDIAN_BIG; + utf32_stream_index = 4; + } + else if( ( utf32_stream[ 0 ] == 0xff ) + && ( utf32_stream[ 1 ] == 0xfe ) + && ( utf32_stream[ 2 ] == 0x00 ) + && ( utf32_stream[ 3 ] == 0x00 ) ) + { + read_byte_order = LIBUNA_ENDIAN_LITTLE; + utf32_stream_index = 4; + } + if( byte_order == 0 ) + { + byte_order = read_byte_order; + } } if( ( byte_order != LIBUNA_ENDIAN_BIG ) && ( byte_order != LIBUNA_ENDIAN_LITTLE ) ) @@ -2629,18 +2710,9 @@ return( -1 ); } - /* Check if the UTF-32 stream is terminated with zero bytes - */ - if( ( utf32_stream[ utf32_stream_size - 4 ] != 0 ) - || ( utf32_stream[ utf32_stream_size - 3 ] != 0 ) - || ( utf32_stream[ utf32_stream_size - 2 ] != 0 ) - || ( utf32_stream[ utf32_stream_size - 1 ] != 0 ) ) - { - zero_byte = 1; - } while( ( utf32_stream_index + 1 ) < utf32_stream_size ) { - /* Convert the UTF-32 stream bytes into a Unicode character + /* Convert the UTF-32 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32_stream( &unicode_character, @@ -2678,18 +2750,9 @@ return( -1 ); } } - if( utf32_stream_index != utf32_stream_size ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-32 stream bytes.", - function ); - - return( -1 ); - } - if( zero_byte != 0 ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { if( *utf32_string_index >= utf32_string_size ) { @@ -2710,7 +2773,7 @@ } /* Compares an UTF-32 string with an UTF-32 stream - * Returns 1 if the strings are equal, 0 if not or -1 on error + * Returns LIBUNA_COMPARE_LESS, LIBUNA_COMPARE_EQUAL, LIBUNA_COMPARE_GREATER if successful or -1 on error */ int libuna_utf32_string_compare_with_utf32_stream( const libuna_utf32_character_t *utf32_string, @@ -2771,39 +2834,42 @@ return( -1 ); } - if( ( utf32_stream_size < 4 ) + if( ( utf32_stream_size == 0 ) || ( ( utf32_stream_size % 4 ) != 0 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-32 stream bytes.", + "%s: missing UTF-32 stream value.", function ); return( -1 ); } /* Check if UTF-32 stream is in big or little endian */ - if( ( utf32_stream[ 0 ] == 0x00 ) - && ( utf32_stream[ 1 ] == 0x00 ) - && ( utf32_stream[ 2 ] == 0xfe ) - && ( utf32_stream[ 3 ] == 0xff ) ) + if( utf32_stream_size >= 4 ) { - read_byte_order = LIBUNA_ENDIAN_BIG; - utf32_stream_index = 4; - } - else if( ( utf32_stream[ 0 ] == 0xff ) - && ( utf32_stream[ 1 ] == 0xfe ) - && ( utf32_stream[ 2 ] == 0x00 ) - && ( utf32_stream[ 3 ] == 0x00 ) ) - { - read_byte_order = LIBUNA_ENDIAN_LITTLE; - utf32_stream_index = 4; - } - if( byte_order == 0 ) - { - byte_order = read_byte_order; + if( ( utf32_stream[ 0 ] == 0x00 ) + && ( utf32_stream[ 1 ] == 0x00 ) + && ( utf32_stream[ 2 ] == 0xfe ) + && ( utf32_stream[ 3 ] == 0xff ) ) + { + read_byte_order = LIBUNA_ENDIAN_BIG; + utf32_stream_index = 4; + } + else if( ( utf32_stream[ 0 ] == 0xff ) + && ( utf32_stream[ 1 ] == 0xfe ) + && ( utf32_stream[ 2 ] == 0x00 ) + && ( utf32_stream[ 3 ] == 0x00 ) ) + { + read_byte_order = LIBUNA_ENDIAN_LITTLE; + utf32_stream_index = 4; + } + if( byte_order == 0 ) + { + byte_order = read_byte_order; + } } if( ( byte_order != LIBUNA_ENDIAN_BIG ) && ( byte_order != LIBUNA_ENDIAN_LITTLE ) ) @@ -2833,7 +2899,7 @@ while( ( utf32_string_index < utf32_string_size ) && ( utf32_stream_index < utf32_stream_size ) ) { - /* Convert the UTF-32 character bytes into a Unicode character + /* Convert the UTF-32 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32( &utf32_unicode_character, @@ -2851,7 +2917,7 @@ return( -1 ); } - /* Convert the UTF-32 stream bytes into a Unicode character + /* Convert the UTF-32 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32_stream( &utf32_stream_unicode_character, @@ -2870,18 +2936,25 @@ return( -1 ); } - if( utf32_unicode_character != utf32_stream_unicode_character ) + if( utf32_unicode_character < utf32_stream_unicode_character ) + { + return( LIBUNA_COMPARE_LESS ); + } + else if( utf32_unicode_character > utf32_stream_unicode_character ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } } /* Check if both strings were entirely processed */ - if( ( utf32_string_index != utf32_string_size ) - || ( utf32_stream_index != utf32_stream_size ) ) + if( utf32_string_index < utf32_string_size ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } - return( 1 ); + else if( utf32_stream_index < utf32_stream_size ) + { + return( LIBUNA_COMPARE_LESS ); + } + return( LIBUNA_COMPARE_EQUAL ); } diff -Nru libsmdev-20171112/libuna/libuna_utf32_string.h libsmdev-20181227/libuna/libuna_utf32_string.h --- libsmdev-20171112/libuna/libuna_utf32_string.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_utf32_string.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * UTF-32 string functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_utf7_stream.c libsmdev-20181227/libuna/libuna_utf7_stream.c --- libsmdev-20171112/libuna/libuna_utf7_stream.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_utf7_stream.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * UTF-7 stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -39,8 +39,8 @@ libcerror_error_t **error ) { static char *function = "libuna_utf7_stream_size_from_utf8"; - size_t utf8_string_index = 0; libuna_unicode_character_t unicode_character = 0; + size_t utf8_string_index = 0; uint32_t utf7_stream_base64_data = 0; if( utf8_string == NULL ) @@ -78,7 +78,7 @@ } while( utf8_string_index < utf8_string_size ) { - /* Convert the UTF-8 character bytes into a Unicode character + /* Convert the UTF-8 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &unicode_character, @@ -113,6 +113,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } @@ -128,9 +132,9 @@ libcerror_error_t **error ) { static char *function = "libuna_utf7_stream_copy_from_utf8"; + libuna_unicode_character_t unicode_character = 0; size_t utf7_stream_index = 0; size_t utf8_string_index = 0; - libuna_unicode_character_t unicode_character = 0; uint32_t utf7_stream_base64_data = 0; if( utf7_stream == NULL ) @@ -179,7 +183,7 @@ } while( utf8_string_index < utf8_string_size ) { - /* Convert the UTF-8 string bytes into a Unicode character + /* Convert the UTF-8 string bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &unicode_character, @@ -216,6 +220,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } @@ -230,8 +238,8 @@ libcerror_error_t **error ) { static char *function = "libuna_utf7_stream_size_from_utf16"; - size_t utf16_string_index = 0; libuna_unicode_character_t unicode_character = 0; + size_t utf16_string_index = 0; uint32_t utf7_stream_base64_data = 0; if( utf16_string == NULL ) @@ -269,7 +277,7 @@ } while( utf16_string_index < utf16_string_size ) { - /* Convert the UTF-16 character bytes into a Unicode character + /* Convert the UTF-16 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16( &unicode_character, @@ -304,6 +312,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } @@ -319,9 +331,9 @@ libcerror_error_t **error ) { static char *function = "libuna_utf7_stream_copy_from_utf16"; + libuna_unicode_character_t unicode_character = 0; size_t utf16_string_index = 0; size_t utf7_stream_index = 0; - libuna_unicode_character_t unicode_character = 0; uint32_t utf7_stream_base64_data = 0; if( utf7_stream == NULL ) @@ -370,7 +382,7 @@ } while( utf16_string_index < utf16_string_size ) { - /* Convert the UTF-16 string bytes into a Unicode character + /* Convert the UTF-16 string bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16( &unicode_character, @@ -407,6 +419,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } @@ -421,8 +437,8 @@ libcerror_error_t **error ) { static char *function = "libuna_utf7_stream_size_from_utf32"; - size_t utf32_string_index = 0; libuna_unicode_character_t unicode_character = 0; + size_t utf32_string_index = 0; uint32_t utf7_stream_base64_data = 0; if( utf32_string == NULL ) @@ -460,7 +476,7 @@ } while( utf32_string_index < utf32_string_size ) { - /* Convert the UTF-32 character bytes into a Unicode character + /* Convert the UTF-32 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32( &unicode_character, @@ -495,6 +511,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } @@ -510,9 +530,9 @@ libcerror_error_t **error ) { static char *function = "libuna_utf7_stream_copy_from_utf32"; + libuna_unicode_character_t unicode_character = 0; size_t utf32_string_index = 0; size_t utf7_stream_index = 0; - libuna_unicode_character_t unicode_character = 0; uint32_t utf7_stream_base64_data = 0; if( utf7_stream == NULL ) @@ -561,7 +581,7 @@ } while( utf32_string_index < utf32_string_size ) { - /* Convert the UTF-32 character bytes into a Unicode character + /* Convert the UTF-32 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32( &unicode_character, @@ -598,6 +618,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } diff -Nru libsmdev-20171112/libuna/libuna_utf7_stream.h libsmdev-20181227/libuna/libuna_utf7_stream.h --- libsmdev-20171112/libuna/libuna_utf7_stream.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_utf7_stream.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * UTF-7 stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_utf8_stream.c libsmdev-20181227/libuna/libuna_utf8_stream.c --- libsmdev-20171112/libuna/libuna_utf8_stream.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_utf8_stream.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * UTF-8 stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -102,7 +102,9 @@ size_t *utf8_stream_size, libcerror_error_t **error ) { - static char *function = "libuna_utf8_stream_size_from_utf8"; + static char *function = "libuna_utf8_stream_size_from_utf8"; + libuna_unicode_character_t unicode_character = 0; + size_t utf8_string_index = 0; if( utf8_string == NULL ) { @@ -138,10 +140,50 @@ return( -1 ); } /* Add the byte order mark - * Assumes the UTF-8 string is santized */ - *utf8_stream_size = 3 + utf8_string_size; + *utf8_stream_size = 3; + while( utf8_string_index < utf8_string_size ) + { + /* Convert the UTF-8 character bytes into an Unicode character + */ + if( libuna_unicode_character_copy_from_utf8( + &unicode_character, + utf8_string, + utf8_string_size, + &utf8_string_index, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, + "%s: unable to copy Unicode character from UTF-8.", + function ); + + return( -1 ); + } + /* Determine how many UTF-8 character bytes are required + */ + if( libuna_unicode_character_size_to_utf8( + unicode_character, + utf8_stream_size, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_OUTPUT_FAILED, + "%s: unable to determine size of Unicode character in UTF-8.", + function ); + + return( -1 ); + } + if( unicode_character == 0 ) + { + break; + } + } return( 1 ); } @@ -155,8 +197,10 @@ size_t utf8_string_size, libcerror_error_t **error ) { - static char *function = "libuna_utf8_stream_copy_from_utf8"; - size_t utf8_stream_index = 0; + static char *function = "libuna_utf8_stream_copy_from_utf8"; + libuna_unicode_character_t unicode_character = 0; + size_t utf8_stream_index = 0; + size_t utf8_string_index = 0; if( utf8_stream == NULL ) { @@ -228,21 +272,48 @@ return( -1 ); } - /* Assumes the UTF-8 string is santized - */ - if( memory_copy( - &utf8_stream[ utf8_stream_index ], - utf8_string, - utf8_string_size ) == NULL ) + while( utf8_string_index < utf8_string_size ) { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, - "%s: unable to copy UTF-8 string to stream.", - function ); + /* Convert the UTF-8 string bytes into an Unicode character + */ + if( libuna_unicode_character_copy_from_utf8( + &unicode_character, + utf8_string, + utf8_string_size, + &utf8_string_index, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, + "%s: unable to copy Unicode character from UTF-8 string.", + function ); - return( -1 ); + return( -1 ); + } + /* Convert the Unicode character into UTF-8 stream bytes + */ + if( libuna_unicode_character_copy_to_utf8( + unicode_character, + utf8_stream, + utf8_stream_size, + &utf8_stream_index, + error ) != 1 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_CONVERSION, + LIBCERROR_CONVERSION_ERROR_OUTPUT_FAILED, + "%s: unable to copy Unicode character to UTF-8 stream.", + function ); + + return( -1 ); + } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } @@ -257,8 +328,8 @@ libcerror_error_t **error ) { static char *function = "libuna_utf8_stream_size_from_utf16"; - size_t utf16_string_index = 0; libuna_unicode_character_t unicode_character = 0; + size_t utf16_string_index = 0; if( utf16_string == NULL ) { @@ -299,7 +370,7 @@ while( utf16_string_index < utf16_string_size ) { - /* Convert the UTF-16 character bytes into a Unicode character + /* Convert the UTF-16 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16( &unicode_character, @@ -333,6 +404,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } @@ -348,9 +423,9 @@ libcerror_error_t **error ) { static char *function = "libuna_utf8_stream_copy_from_utf16"; + libuna_unicode_character_t unicode_character = 0; size_t utf16_string_index = 0; size_t utf8_stream_index = 0; - libuna_unicode_character_t unicode_character = 0; if( utf8_stream == NULL ) { @@ -413,7 +488,7 @@ } while( utf16_string_index < utf16_string_size ) { - /* Convert the UTF-16 string bytes into a Unicode character + /* Convert the UTF-16 string bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16( &unicode_character, @@ -449,6 +524,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } @@ -463,8 +542,8 @@ libcerror_error_t **error ) { static char *function = "libuna_utf8_stream_size_from_utf32"; - size_t utf32_string_index = 0; libuna_unicode_character_t unicode_character = 0; + size_t utf32_string_index = 0; if( utf32_string == NULL ) { @@ -505,7 +584,7 @@ while( utf32_string_index < utf32_string_size ) { - /* Convert the UTF-32 character bytes into a Unicode character + /* Convert the UTF-32 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32( &unicode_character, @@ -539,6 +618,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } @@ -554,9 +637,9 @@ libcerror_error_t **error ) { static char *function = "libuna_utf8_stream_copy_from_utf32"; + libuna_unicode_character_t unicode_character = 0; size_t utf32_string_index = 0; size_t utf8_stream_index = 0; - libuna_unicode_character_t unicode_character = 0; if( utf8_stream == NULL ) { @@ -619,7 +702,7 @@ } while( utf32_string_index < utf32_string_size ) { - /* Convert the UTF-32 character bytes into a Unicode character + /* Convert the UTF-32 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32( &unicode_character, @@ -655,6 +738,10 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } return( 1 ); } diff -Nru libsmdev-20171112/libuna/libuna_utf8_stream.h libsmdev-20181227/libuna/libuna_utf8_stream.h --- libsmdev-20171112/libuna/libuna_utf8_stream.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_utf8_stream.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * UTF-8 stream functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/libuna_utf8_string.c libsmdev-20181227/libuna/libuna_utf8_string.c --- libsmdev-20171112/libuna/libuna_utf8_string.c 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_utf8_string.c 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * UTF-8 string functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -77,15 +77,13 @@ } *utf8_string_size = 0; - /* Check if the byte stream is terminated with a zero byte - */ - if( byte_stream[ byte_stream_size - 1 ] != 0 ) + if( byte_stream_size == 0 ) { - *utf8_string_size += 1; + return( 1 ); } while( byte_stream_index < byte_stream_size ) { - /* Convert the byte stream bytes into a Unicode character + /* Convert the byte stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_byte_stream( &unicode_character, @@ -120,6 +118,16 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } + } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + *utf8_string_size += 1; } return( 1 ); } @@ -174,7 +182,6 @@ static char *function = "libuna_utf8_string_with_index_copy_from_byte_stream"; size_t byte_stream_index = 0; libuna_unicode_character_t unicode_character = 0; - uint8_t zero_byte = 0; if( utf8_string == NULL ) { @@ -231,15 +238,20 @@ return( -1 ); } - /* Check if the byte stream is terminated with zero bytes - */ - if( byte_stream[ byte_stream_size - 1 ] != 0 ) + if( byte_stream_size == 0 ) { - zero_byte = 1; + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing byte stream value.", + function ); + + return( -1 ); } while( byte_stream_index < byte_stream_size ) { - /* Convert the byte stream bytes into a Unicode character + /* Convert the byte stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_byte_stream( &unicode_character, @@ -276,8 +288,14 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } - if( zero_byte != 0 ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { if( *utf8_string_index >= utf8_string_size ) { @@ -298,7 +316,7 @@ } /* Compares an UTF-8 string with a byte stream - * Returns 1 if the strings are equal, 0 if not or -1 on error + * Returns LIBUNA_COMPARE_LESS, LIBUNA_COMPARE_EQUAL, LIBUNA_COMPARE_GREATER if successful or -1 on error */ int libuna_utf8_string_compare_with_byte_stream( const libuna_utf8_character_t *utf8_string, @@ -358,6 +376,17 @@ return( -1 ); } + if( byte_stream_size == 0 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing byte stream value.", + function ); + + return( -1 ); + } if( utf8_string[ utf8_string_size - 1 ] == 0 ) { utf8_string_size -= 1; @@ -371,7 +400,7 @@ while( ( utf8_string_index < utf8_string_size ) && ( byte_stream_index < byte_stream_size ) ) { - /* Convert the UTF-8 character bytes into a Unicode character + /* Convert the UTF-8 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &utf8_unicode_character, @@ -389,7 +418,7 @@ return( -1 ); } - /* Convert the byte stream bytes into a Unicode character + /* Convert the byte stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_byte_stream( &byte_stream_unicode_character, @@ -408,19 +437,26 @@ return( -1 ); } - if( utf8_unicode_character != byte_stream_unicode_character ) + if( utf8_unicode_character < byte_stream_unicode_character ) + { + return( LIBUNA_COMPARE_LESS ); + } + else if( utf8_unicode_character > byte_stream_unicode_character ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } } /* Check if both strings were entirely processed */ - if( ( utf8_string_index != utf8_string_size ) - || ( byte_stream_index != byte_stream_size ) ) + if( utf8_string_index < utf8_string_size ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } - return( 1 ); + else if( byte_stream_index < byte_stream_size ) + { + return( LIBUNA_COMPARE_LESS ); + } + return( LIBUNA_COMPARE_EQUAL ); } /* Determines the size of an UTF-8 string from an UTF-7 stream @@ -459,17 +495,6 @@ return( -1 ); } - if( utf7_stream_size < 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-7 stream bytes.", - function ); - - return( -1 ); - } if( utf8_string_size == NULL ) { libcerror_error_set( @@ -483,15 +508,13 @@ } *utf8_string_size = 0; - /* Check if the UTF-7 stream is terminated with a zero byte - */ - if( utf7_stream[ utf7_stream_size - 1 ] != 0 ) + if( utf7_stream_size == 0 ) { - *utf8_string_size += 1; + return( 1 ); } while( utf7_stream_index < utf7_stream_size ) { - /* Convert the UTF-7 stream bytes into a Unicode character + /* Convert the UTF-7 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf7_stream( &unicode_character, @@ -526,6 +549,16 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } + } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + *utf8_string_size += 1; } return( 1 ); } @@ -578,7 +611,6 @@ size_t utf7_stream_index = 0; libuna_unicode_character_t unicode_character = 0; uint32_t utf7_stream_base64_data = 0; - uint8_t zero_byte = 0; if( utf8_string == NULL ) { @@ -635,26 +667,20 @@ return( -1 ); } - if( utf7_stream_size < 1 ) + if( utf7_stream_size == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-7 stream bytes.", + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-7 stream value.", function ); return( -1 ); } - /* Check if the UTF-7 stream is terminated with zero bytes - */ - if( utf7_stream[ utf7_stream_size - 1 ] != 0 ) - { - zero_byte = 1; - } while( utf7_stream_index < utf7_stream_size ) { - /* Convert the UTF-7 stream bytes into a Unicode character + /* Convert the UTF-7 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf7_stream( &unicode_character, @@ -691,8 +717,14 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } - if( zero_byte != 0 ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { if( *utf8_string_index >= utf8_string_size ) { @@ -713,7 +745,7 @@ } /* Compares an UTF-8 string with an UTF-7 stream - * Returns 1 if the strings are equal, 0 if not or -1 on error + * Returns LIBUNA_COMPARE_LESS, LIBUNA_COMPARE_EQUAL, LIBUNA_COMPARE_GREATER if successful or -1 on error */ int libuna_utf8_string_compare_with_utf7_stream( const libuna_utf8_character_t *utf8_string, @@ -773,13 +805,13 @@ return( -1 ); } - if( utf7_stream_size < 1 ) + if( utf7_stream_size == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-7 stream bytes.", + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-7 stream value.", function ); return( -1 ); @@ -797,7 +829,7 @@ while( ( utf8_string_index < utf8_string_size ) && ( utf7_stream_index < utf7_stream_size ) ) { - /* Convert the UTF-8 character bytes into a Unicode character + /* Convert the UTF-8 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &utf8_unicode_character, @@ -815,7 +847,7 @@ return( -1 ); } - /* Convert the UTF-7 character bytes into a Unicode character + /* Convert the UTF-7 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf7_stream( &utf7_stream_unicode_character, @@ -834,19 +866,26 @@ return( -1 ); } - if( utf8_unicode_character != utf7_stream_unicode_character ) + if( utf8_unicode_character < utf7_stream_unicode_character ) + { + return( LIBUNA_COMPARE_LESS ); + } + else if( utf8_unicode_character > utf7_stream_unicode_character ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } } /* Check if both strings were entirely processed */ - if( ( utf8_string_index != utf8_string_size ) - || ( utf7_stream_index != utf7_stream_size ) ) + if( utf8_string_index < utf8_string_size ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } - return( 1 ); + else if( utf7_stream_index < utf7_stream_size ) + { + return( LIBUNA_COMPARE_LESS ); + } + return( LIBUNA_COMPARE_EQUAL ); } /* Determines the size of an UTF-8 string from an UTF-8 stream @@ -884,17 +923,6 @@ return( -1 ); } - if( utf8_stream_size < 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-8 stream bytes.", - function ); - - return( -1 ); - } if( utf8_string_size == NULL ) { libcerror_error_set( @@ -908,6 +936,10 @@ } *utf8_string_size = 0; + if( utf8_stream_size == 0 ) + { + return( 1 ); + } /* Check if UTF-8 stream starts with a byte order mark (BOM) */ if( utf8_stream_size >= 3 ) @@ -919,15 +951,9 @@ utf8_stream_index += 3; } } - /* Check if the UTF-8 stream is terminated with a zero byte - */ - if( utf8_stream[ utf8_stream_size - 1 ] != 0 ) - { - *utf8_string_size += 1; - } while( utf8_stream_index < utf8_stream_size ) { - /* Convert the UTF-8 stream bytes into a Unicode character + /* Convert the UTF-8 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &unicode_character, @@ -961,6 +987,16 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } + } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + *utf8_string_size += 1; } return( 1 ); } @@ -1012,7 +1048,6 @@ static char *function = "libuna_utf8_string_with_index_copy_from_utf8_stream"; size_t utf8_stream_index = 0; libuna_unicode_character_t unicode_character = 0; - uint8_t zero_byte = 0; if( utf8_string == NULL ) { @@ -1069,13 +1104,13 @@ return( -1 ); } - if( utf8_stream_size < 1 ) + if( utf8_stream_size == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-8 stream bytes.", + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-8 stream value.", function ); return( -1 ); @@ -1091,15 +1126,9 @@ utf8_stream_index += 3; } } - /* Check if the UTF-8 stream is terminated with zero bytes - */ - if( utf8_stream[ utf8_stream_size - 1 ] != 0 ) - { - zero_byte = 1; - } while( utf8_stream_index < utf8_stream_size ) { - /* Convert the UTF-8 stream bytes into a Unicode character + /* Convert the UTF-8 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &unicode_character, @@ -1135,8 +1164,14 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } - if( zero_byte != 0 ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { if( *utf8_string_index >= utf8_string_size ) { @@ -1157,7 +1192,7 @@ } /* Compares an UTF-8 string with an UTF-8 stream - * Returns 1 if the strings are equal, 0 if not or -1 on error + * Returns LIBUNA_COMPARE_LESS, LIBUNA_COMPARE_EQUAL, LIBUNA_COMPARE_GREATER if successful or -1 on error */ int libuna_utf8_string_compare_with_utf8_stream( const libuna_utf8_character_t *utf8_string, @@ -1216,13 +1251,13 @@ return( -1 ); } - if( utf8_stream_size < 1 ) + if( utf8_stream_size == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-8 stream bytes.", + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-8 stream value.", function ); return( -1 ); @@ -1251,7 +1286,7 @@ while( ( utf8_string_index < utf8_string_size ) && ( utf8_stream_index < utf8_stream_size ) ) { - /* Convert the UTF-8 character bytes into a Unicode character + /* Convert the UTF-8 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &utf8_unicode_character, @@ -1269,7 +1304,7 @@ return( -1 ); } - /* Convert the UTF-8 character bytes into a Unicode character + /* Convert the UTF-8 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &utf8_stream_unicode_character, @@ -1287,19 +1322,26 @@ return( -1 ); } - if( utf8_unicode_character != utf8_stream_unicode_character ) + if( utf8_unicode_character < utf8_stream_unicode_character ) { - return( 0 ); + return( LIBUNA_COMPARE_LESS ); + } + else if( utf8_unicode_character > utf8_stream_unicode_character ) + { + return( LIBUNA_COMPARE_GREATER ); } } /* Check if both strings were entirely processed */ - if( ( utf8_string_index != utf8_string_size ) - || ( utf8_stream_index != utf8_stream_size ) ) + if( utf8_string_index < utf8_string_size ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } - return( 1 ); + else if( utf8_stream_index < utf8_stream_size ) + { + return( LIBUNA_COMPARE_LESS ); + } + return( LIBUNA_COMPARE_EQUAL ); } /* Determines the size of an UTF-8 string from an UTF-16 string @@ -1350,9 +1392,13 @@ } *utf8_string_size = 0; + if( utf16_string_size == 0 ) + { + return( 1 ); + } while( utf16_string_index < utf16_string_size ) { - /* Convert the UTF-16 character bytes into a Unicode character + /* Convert the UTF-16 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16( &unicode_character, @@ -1387,6 +1433,12 @@ return( -1 ); } } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + *utf8_string_size += 1; + } return( 1 ); } @@ -1493,9 +1545,20 @@ return( -1 ); } + if( utf16_string_size == 0 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-16 string value.", + function ); + + return( -1 ); + } while( utf16_string_index < utf16_string_size ) { - /* Convert the UTF-16 character bytes into a Unicode character + /* Convert the UTF-16 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16( &unicode_character, @@ -1532,11 +1595,30 @@ return( -1 ); } } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + if( *utf8_string_index >= utf8_string_size ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, + "%s: UTF-8 string too small.", + function ); + + return( -1 ); + } + utf8_string[ *utf8_string_index ] = 0; + + *utf8_string_index += 1; + } return( 1 ); } /* Compares an UTF-8 string with an UTF-16 string - * Returns 1 if the strings are equal, 0 if not or -1 on error + * Returns LIBUNA_COMPARE_LESS, LIBUNA_COMPARE_EQUAL, LIBUNA_COMPARE_GREATER if successful or -1 on error */ int libuna_utf8_string_compare_with_utf16( const libuna_utf8_character_t *utf8_string, @@ -1595,6 +1677,17 @@ return( -1 ); } + if( utf16_string_size == 0 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-16 string value.", + function ); + + return( -1 ); + } if( utf8_string[ utf8_string_size - 1 ] == 0 ) { utf8_string_size -= 1; @@ -1606,7 +1699,7 @@ while( ( utf8_string_index < utf8_string_size ) && ( utf16_string_index < utf16_string_size ) ) { - /* Convert the UTF-8 character bytes into a Unicode character + /* Convert the UTF-8 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &utf8_unicode_character, @@ -1624,7 +1717,7 @@ return( -1 ); } - /* Convert the UTF-16 character bytes into a Unicode character + /* Convert the UTF-16 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16( &utf16_unicode_character, @@ -1642,19 +1735,26 @@ return( -1 ); } - if( utf8_unicode_character != utf16_unicode_character ) + if( utf8_unicode_character < utf16_unicode_character ) + { + return( LIBUNA_COMPARE_LESS ); + } + else if( utf8_unicode_character > utf16_unicode_character ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } } /* Check if both strings were entirely processed */ - if( ( utf8_string_index != utf8_string_size ) - || ( utf16_string_index != utf16_string_size ) ) + if( utf8_string_index < utf8_string_size ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } - return( 1 ); + else if( utf16_string_index < utf16_string_size ) + { + return( LIBUNA_COMPARE_LESS ); + } + return( LIBUNA_COMPARE_EQUAL ); } /* Determines the size of an UTF-8 string from an UTF-16 stream @@ -1694,14 +1794,13 @@ return( -1 ); } - if( ( utf16_stream_size < 2 ) - || ( ( utf16_stream_size % 2 ) != 0 ) ) + if( ( utf16_stream_size % 2 ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-16 stream bytes.", + "%s: missing UTF-16 stream value.", function ); return( -1 ); @@ -1719,23 +1818,30 @@ } *utf8_string_size = 0; - /* Check if UTF-16 stream is in big or little endian - */ - if( ( utf16_stream[ 0 ] == 0xfe ) - && ( utf16_stream[ 1 ] == 0xff ) ) + if( utf16_stream_size == 0 ) { - read_byte_order = LIBUNA_ENDIAN_BIG; - utf16_stream_index = 2; + return( 1 ); } - else if( ( utf16_stream[ 0 ] == 0xff ) - && ( utf16_stream[ 1 ] == 0xfe ) ) - { - read_byte_order = LIBUNA_ENDIAN_LITTLE; - utf16_stream_index = 2; - } - if( byte_order == 0 ) + /* Check if UTF-16 stream is in big or little endian + */ + if( utf16_stream_size >= 2 ) { - byte_order = read_byte_order; + if( ( utf16_stream[ 0 ] == 0xfe ) + && ( utf16_stream[ 1 ] == 0xff ) ) + { + read_byte_order = LIBUNA_ENDIAN_BIG; + utf16_stream_index = 2; + } + else if( ( utf16_stream[ 0 ] == 0xff ) + && ( utf16_stream[ 1 ] == 0xfe ) ) + { + read_byte_order = LIBUNA_ENDIAN_LITTLE; + utf16_stream_index = 2; + } + if( byte_order == 0 ) + { + byte_order = read_byte_order; + } } if( ( byte_order != LIBUNA_ENDIAN_BIG ) && ( byte_order != LIBUNA_ENDIAN_LITTLE ) ) @@ -1749,16 +1855,9 @@ return( -1 ); } - /* Check if the UTF-16 stream is terminated with zero bytes - */ - if( ( utf16_stream[ utf16_stream_size - 2 ] != 0 ) - || ( utf16_stream[ utf16_stream_size - 1 ] != 0 ) ) - { - *utf8_string_size += 1; - } while( ( utf16_stream_index + 1 ) < utf16_stream_size ) { - /* Convert the UTF-16 stream bytes into a Unicode character + /* Convert the UTF-16 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16_stream( &unicode_character, @@ -1793,17 +1892,16 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } - if( utf16_stream_index != utf16_stream_size ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-16 stream bytes.", - function ); - - return( -1 ); + *utf8_string_size += 1; } return( 1 ); } @@ -1858,7 +1956,6 @@ static char *function = "libuna_utf8_string_with_index_copy_from_utf16_stream"; size_t utf16_stream_index = 0; libuna_unicode_character_t unicode_character = 0; - uint8_t zero_byte = 0; int read_byte_order = 0; if( utf8_string == NULL ) @@ -1916,35 +2013,38 @@ return( -1 ); } - if( ( utf16_stream_size < 2 ) + if( ( utf16_stream_size == 0 ) || ( ( utf16_stream_size % 2 ) != 0 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-16 stream bytes.", + "%s: missing UTF-16 stream value.", function ); return( -1 ); } /* Check if UTF-16 stream is in big or little endian */ - if( ( utf16_stream[ 0 ] == 0xfe ) - && ( utf16_stream[ 1 ] == 0xff ) ) + if( utf16_stream_size >= 2 ) { - read_byte_order = LIBUNA_ENDIAN_BIG; - utf16_stream_index = 2; - } - else if( ( utf16_stream[ 0 ] == 0xff ) - && ( utf16_stream[ 1 ] == 0xfe ) ) - { - read_byte_order = LIBUNA_ENDIAN_LITTLE; - utf16_stream_index = 2; - } - if( byte_order == 0 ) - { - byte_order = read_byte_order; + if( ( utf16_stream[ 0 ] == 0xfe ) + && ( utf16_stream[ 1 ] == 0xff ) ) + { + read_byte_order = LIBUNA_ENDIAN_BIG; + utf16_stream_index = 2; + } + else if( ( utf16_stream[ 0 ] == 0xff ) + && ( utf16_stream[ 1 ] == 0xfe ) ) + { + read_byte_order = LIBUNA_ENDIAN_LITTLE; + utf16_stream_index = 2; + } + if( byte_order == 0 ) + { + byte_order = read_byte_order; + } } if( ( byte_order != LIBUNA_ENDIAN_BIG ) && ( byte_order != LIBUNA_ENDIAN_LITTLE ) ) @@ -1958,16 +2058,9 @@ return( -1 ); } - /* Check if the UTF-16 stream is terminated with zero bytes - */ - if( ( utf16_stream[ utf16_stream_size - 2 ] != 0 ) - || ( utf16_stream[ utf16_stream_size - 1 ] != 0 ) ) - { - zero_byte = 1; - } while( ( utf16_stream_index + 1 ) < utf16_stream_size ) { - /* Convert the UTF-16 stream bytes into a Unicode character + /* Convert the UTF-16 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16_stream( &unicode_character, @@ -2004,19 +2097,14 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } - if( utf16_stream_index != utf16_stream_size ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-16 stream bytes.", - function ); - - return( -1 ); - } - if( zero_byte != 0 ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { if( *utf8_string_index >= utf8_string_size ) { @@ -2037,7 +2125,7 @@ } /* Compares an UTF-8 string with an UTF-16 stream - * Returns 1 if the strings are equal, 0 if not or -1 on error + * Returns LIBUNA_COMPARE_LESS, LIBUNA_COMPARE_EQUAL, LIBUNA_COMPARE_GREATER if successful or -1 on error */ int libuna_utf8_string_compare_with_utf16_stream( const libuna_utf8_character_t *utf8_string, @@ -2098,35 +2186,38 @@ return( -1 ); } - if( ( utf16_stream_size < 2 ) + if( ( utf16_stream_size == 0 ) || ( ( utf16_stream_size % 2 ) != 0 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-16 stream bytes.", + "%s: missing UTF-16 stream value.", function ); return( -1 ); } /* Check if UTF-16 stream is in big or little endian */ - if( ( utf16_stream[ 0 ] == 0xfe ) - && ( utf16_stream[ 1 ] == 0xff ) ) - { - read_byte_order = LIBUNA_ENDIAN_BIG; - utf16_stream_index = 2; - } - else if( ( utf16_stream[ 0 ] == 0xff ) - && ( utf16_stream[ 1 ] == 0xfe ) ) + if( utf16_stream_size >= 2 ) { - read_byte_order = LIBUNA_ENDIAN_LITTLE; - utf16_stream_index = 2; - } - if( byte_order == 0 ) - { - byte_order = read_byte_order; + if( ( utf16_stream[ 0 ] == 0xfe ) + && ( utf16_stream[ 1 ] == 0xff ) ) + { + read_byte_order = LIBUNA_ENDIAN_BIG; + utf16_stream_index = 2; + } + else if( ( utf16_stream[ 0 ] == 0xff ) + && ( utf16_stream[ 1 ] == 0xfe ) ) + { + read_byte_order = LIBUNA_ENDIAN_LITTLE; + utf16_stream_index = 2; + } + if( byte_order == 0 ) + { + byte_order = read_byte_order; + } } if( ( byte_order != LIBUNA_ENDIAN_BIG ) && ( byte_order != LIBUNA_ENDIAN_LITTLE ) ) @@ -2154,7 +2245,7 @@ while( ( utf8_string_index < utf8_string_size ) && ( utf16_stream_index < utf16_stream_size ) ) { - /* Convert the UTF-8 character bytes into a Unicode character + /* Convert the UTF-8 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &utf8_unicode_character, @@ -2172,7 +2263,7 @@ return( -1 ); } - /* Convert the UTF-16 stream bytes into a Unicode character + /* Convert the UTF-16 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf16_stream( &utf16_stream_unicode_character, @@ -2191,19 +2282,26 @@ return( -1 ); } - if( utf8_unicode_character != utf16_stream_unicode_character ) + if( utf8_unicode_character < utf16_stream_unicode_character ) { - return( 0 ); + return( LIBUNA_COMPARE_LESS ); + } + else if( utf8_unicode_character > utf16_stream_unicode_character ) + { + return( LIBUNA_COMPARE_GREATER ); } } /* Check if both strings were entirely processed */ - if( ( utf8_string_index != utf8_string_size ) - || ( utf16_stream_index != utf16_stream_size ) ) + if( utf8_string_index < utf8_string_size ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } - return( 1 ); + else if( utf16_stream_index < utf16_stream_size ) + { + return( LIBUNA_COMPARE_LESS ); + } + return( LIBUNA_COMPARE_EQUAL ); } /* Determines the size of an UTF-8 string from an UTF-32 string @@ -2254,9 +2352,13 @@ } *utf8_string_size = 0; + if( utf32_string_size == 0 ) + { + return( 1 ); + } while( utf32_string_index < utf32_string_size ) { - /* Convert the UTF-32 character bytes into a Unicode character + /* Convert the UTF-32 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32( &unicode_character, @@ -2291,6 +2393,12 @@ return( -1 ); } } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + *utf8_string_size += 1; + } return( 1 ); } @@ -2397,9 +2505,20 @@ return( -1 ); } + if( utf32_string_size == 0 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-32 string value.", + function ); + + return( -1 ); + } while( utf32_string_index < utf32_string_size ) { - /* Convert the UTF-32 character bytes into a Unicode character + /* Convert the UTF-32 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32( &unicode_character, @@ -2436,11 +2555,30 @@ return( -1 ); } } + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) + { + if( *utf8_string_index >= utf8_string_size ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, + "%s: UTF-8 string too small.", + function ); + + return( -1 ); + } + utf8_string[ *utf8_string_index ] = 0; + + *utf8_string_index += 1; + } return( 1 ); } /* Compares an UTF-8 string with an UTF-32 string - * Returns 1 if the strings are equal, 0 if not or -1 on error + * Returns LIBUNA_COMPARE_LESS, LIBUNA_COMPARE_EQUAL, LIBUNA_COMPARE_GREATER if successful or -1 on error */ int libuna_utf8_string_compare_with_utf32( const libuna_utf8_character_t *utf8_string, @@ -2499,6 +2637,17 @@ return( -1 ); } + if( utf32_string_size == 0 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_ARGUMENTS, + LIBCERROR_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS, + "%s: missing UTF-32 string value.", + function ); + + return( -1 ); + } if( utf8_string[ utf8_string_size - 1 ] == 0 ) { utf8_string_size -= 1; @@ -2510,7 +2659,7 @@ while( ( utf8_string_index < utf8_string_size ) && ( utf32_string_index < utf32_string_size ) ) { - /* Convert the UTF-8 character bytes into a Unicode character + /* Convert the UTF-8 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &utf8_unicode_character, @@ -2528,7 +2677,7 @@ return( -1 ); } - /* Convert the UTF-32 character bytes into a Unicode character + /* Convert the UTF-32 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32( &utf32_unicode_character, @@ -2546,19 +2695,26 @@ return( -1 ); } - if( utf8_unicode_character != utf32_unicode_character ) + if( utf8_unicode_character < utf32_unicode_character ) { - return( 0 ); + return( LIBUNA_COMPARE_LESS ); + } + else if( utf8_unicode_character > utf32_unicode_character ) + { + return( LIBUNA_COMPARE_GREATER ); } } /* Check if both strings were entirely processed */ - if( ( utf8_string_index != utf8_string_size ) - || ( utf32_string_index != utf32_string_size ) ) + if( utf8_string_index < utf8_string_size ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } - return( 1 ); + else if( utf32_string_index < utf32_string_size ) + { + return( LIBUNA_COMPARE_LESS ); + } + return( LIBUNA_COMPARE_EQUAL ); } /* Determines the size of an UTF-8 string from an UTF-32 stream @@ -2598,14 +2754,13 @@ return( -1 ); } - if( ( utf32_stream_size < 4 ) - || ( ( utf32_stream_size % 4 ) != 0 ) ) + if( ( utf32_stream_size % 4 ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-32 stream bytes.", + "%s: missing UTF-32 stream value.", function ); return( -1 ); @@ -2623,27 +2778,34 @@ } *utf8_string_size = 0; - /* Check if UTF-32 stream is in big or little endian - */ - if( ( utf32_stream[ 0 ] == 0x00 ) - && ( utf32_stream[ 1 ] == 0x00 ) - && ( utf32_stream[ 2 ] == 0xfe ) - && ( utf32_stream[ 3 ] == 0xff ) ) - { - read_byte_order = LIBUNA_ENDIAN_BIG; - utf32_stream_index = 4; - } - else if( ( utf32_stream[ 0 ] == 0xff ) - && ( utf32_stream[ 1 ] == 0xfe ) - && ( utf32_stream[ 2 ] == 0x00 ) - && ( utf32_stream[ 3 ] == 0x00 ) ) + if( utf32_stream_size == 0 ) { - read_byte_order = LIBUNA_ENDIAN_LITTLE; - utf32_stream_index = 4; + return( 1 ); } - if( byte_order == 0 ) + /* Check if UTF-32 stream is in big or little endian + */ + if( utf32_stream_size >= 4 ) { - byte_order = read_byte_order; + if( ( utf32_stream[ 0 ] == 0x00 ) + && ( utf32_stream[ 1 ] == 0x00 ) + && ( utf32_stream[ 2 ] == 0xfe ) + && ( utf32_stream[ 3 ] == 0xff ) ) + { + read_byte_order = LIBUNA_ENDIAN_BIG; + utf32_stream_index = 4; + } + else if( ( utf32_stream[ 0 ] == 0xff ) + && ( utf32_stream[ 1 ] == 0xfe ) + && ( utf32_stream[ 2 ] == 0x00 ) + && ( utf32_stream[ 3 ] == 0x00 ) ) + { + read_byte_order = LIBUNA_ENDIAN_LITTLE; + utf32_stream_index = 4; + } + if( byte_order == 0 ) + { + byte_order = read_byte_order; + } } if( ( byte_order != LIBUNA_ENDIAN_BIG ) && ( byte_order != LIBUNA_ENDIAN_LITTLE ) ) @@ -2657,18 +2819,9 @@ return( -1 ); } - /* Check if the UTF-32 stream is terminated with zero bytes - */ - if( ( utf32_stream[ utf32_stream_size - 4 ] != 0 ) - || ( utf32_stream[ utf32_stream_size - 3 ] != 0 ) - || ( utf32_stream[ utf32_stream_size - 2 ] != 0 ) - || ( utf32_stream[ utf32_stream_size - 1 ] != 0 ) ) - { - *utf8_string_size += 1; - } - while( ( utf32_stream_index + 1 ) < utf32_stream_size ) + while( ( utf32_stream_index + 3 ) < utf32_stream_size ) { - /* Convert the UTF-32 stream bytes into a Unicode character + /* Convert the UTF-32 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32_stream( &unicode_character, @@ -2703,17 +2856,16 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } - if( utf32_stream_index != utf32_stream_size ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-32 stream bytes.", - function ); - - return( -1 ); + *utf8_string_size += 1; } return( 1 ); } @@ -2768,7 +2920,6 @@ static char *function = "libuna_utf8_string_with_index_copy_from_utf32_stream"; size_t utf32_stream_index = 0; libuna_unicode_character_t unicode_character = 0; - uint8_t zero_byte = 0; int read_byte_order = 0; if( utf8_string == NULL ) @@ -2826,39 +2977,42 @@ return( -1 ); } - if( ( utf32_stream_size < 4 ) + if( ( utf32_stream_size == 0 ) || ( ( utf32_stream_size % 4 ) != 0 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-32 stream bytes.", + "%s: missing UTF-32 stream value.", function ); return( -1 ); } /* Check if UTF-32 stream is in big or little endian */ - if( ( utf32_stream[ 0 ] == 0x00 ) - && ( utf32_stream[ 1 ] == 0x00 ) - && ( utf32_stream[ 2 ] == 0xfe ) - && ( utf32_stream[ 3 ] == 0xff ) ) + if( utf32_stream_size >= 4 ) { - read_byte_order = LIBUNA_ENDIAN_BIG; - utf32_stream_index = 4; - } - else if( ( utf32_stream[ 0 ] == 0xff ) - && ( utf32_stream[ 1 ] == 0xfe ) - && ( utf32_stream[ 2 ] == 0x00 ) - && ( utf32_stream[ 3 ] == 0x00 ) ) - { - read_byte_order = LIBUNA_ENDIAN_LITTLE; - utf32_stream_index = 4; - } - if( byte_order == 0 ) - { - byte_order = read_byte_order; + if( ( utf32_stream[ 0 ] == 0x00 ) + && ( utf32_stream[ 1 ] == 0x00 ) + && ( utf32_stream[ 2 ] == 0xfe ) + && ( utf32_stream[ 3 ] == 0xff ) ) + { + read_byte_order = LIBUNA_ENDIAN_BIG; + utf32_stream_index = 4; + } + else if( ( utf32_stream[ 0 ] == 0xff ) + && ( utf32_stream[ 1 ] == 0xfe ) + && ( utf32_stream[ 2 ] == 0x00 ) + && ( utf32_stream[ 3 ] == 0x00 ) ) + { + read_byte_order = LIBUNA_ENDIAN_LITTLE; + utf32_stream_index = 4; + } + if( byte_order == 0 ) + { + byte_order = read_byte_order; + } } if( ( byte_order != LIBUNA_ENDIAN_BIG ) && ( byte_order != LIBUNA_ENDIAN_LITTLE ) ) @@ -2872,18 +3026,9 @@ return( -1 ); } - /* Check if the UTF-32 stream is terminated with zero bytes - */ - if( ( utf32_stream[ utf32_stream_size - 4 ] != 0 ) - || ( utf32_stream[ utf32_stream_size - 3 ] != 0 ) - || ( utf32_stream[ utf32_stream_size - 2 ] != 0 ) - || ( utf32_stream[ utf32_stream_size - 1 ] != 0 ) ) - { - zero_byte = 1; - } - while( ( utf32_stream_index + 1 ) < utf32_stream_size ) + while( ( utf32_stream_index + 3 ) < utf32_stream_size ) { - /* Convert the UTF-32 stream bytes into a Unicode character + /* Convert the UTF-32 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32_stream( &unicode_character, @@ -2920,19 +3065,14 @@ return( -1 ); } + if( unicode_character == 0 ) + { + break; + } } - if( utf32_stream_index != utf32_stream_size ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_ARGUMENTS, - LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-32 stream bytes.", - function ); - - return( -1 ); - } - if( zero_byte != 0 ) + /* Check if the string is terminated with an end-of-string character + */ + if( unicode_character != 0 ) { if( *utf8_string_index >= utf8_string_size ) { @@ -2953,7 +3093,7 @@ } /* Compares an UTF-8 string with an UTF-32 stream - * Returns 1 if the strings are equal, 0 if not or -1 on error + * Returns LIBUNA_COMPARE_LESS, LIBUNA_COMPARE_EQUAL, LIBUNA_COMPARE_GREATER if successful or -1 on error */ int libuna_utf8_string_compare_with_utf32_stream( const libuna_utf8_character_t *utf8_string, @@ -3014,39 +3154,42 @@ return( -1 ); } - if( ( utf32_stream_size < 4 ) + if( ( utf32_stream_size == 0 ) || ( ( utf32_stream_size % 4 ) != 0 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, - "%s: missing UTF-32 stream bytes.", + "%s: missing UTF-32 stream value.", function ); return( -1 ); } /* Check if UTF-32 stream is in big or little endian */ - if( ( utf32_stream[ 0 ] == 0x00 ) - && ( utf32_stream[ 1 ] == 0x00 ) - && ( utf32_stream[ 2 ] == 0xfe ) - && ( utf32_stream[ 3 ] == 0xff ) ) + if( utf32_stream_size >= 4 ) { - read_byte_order = LIBUNA_ENDIAN_BIG; - utf32_stream_index = 4; - } - else if( ( utf32_stream[ 0 ] == 0xff ) - && ( utf32_stream[ 1 ] == 0xfe ) - && ( utf32_stream[ 2 ] == 0x00 ) - && ( utf32_stream[ 3 ] == 0x00 ) ) - { - read_byte_order = LIBUNA_ENDIAN_LITTLE; - utf32_stream_index = 4; - } - if( byte_order == 0 ) - { - byte_order = read_byte_order; + if( ( utf32_stream[ 0 ] == 0x00 ) + && ( utf32_stream[ 1 ] == 0x00 ) + && ( utf32_stream[ 2 ] == 0xfe ) + && ( utf32_stream[ 3 ] == 0xff ) ) + { + read_byte_order = LIBUNA_ENDIAN_BIG; + utf32_stream_index = 4; + } + else if( ( utf32_stream[ 0 ] == 0xff ) + && ( utf32_stream[ 1 ] == 0xfe ) + && ( utf32_stream[ 2 ] == 0x00 ) + && ( utf32_stream[ 3 ] == 0x00 ) ) + { + read_byte_order = LIBUNA_ENDIAN_LITTLE; + utf32_stream_index = 4; + } + if( byte_order == 0 ) + { + byte_order = read_byte_order; + } } if( ( byte_order != LIBUNA_ENDIAN_BIG ) && ( byte_order != LIBUNA_ENDIAN_LITTLE ) ) @@ -3076,7 +3219,7 @@ while( ( utf8_string_index < utf8_string_size ) && ( utf32_stream_index < utf32_stream_size ) ) { - /* Convert the UTF-8 character bytes into a Unicode character + /* Convert the UTF-8 character bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf8( &utf8_unicode_character, @@ -3094,7 +3237,7 @@ return( -1 ); } - /* Convert the UTF-32 stream bytes into a Unicode character + /* Convert the UTF-32 stream bytes into an Unicode character */ if( libuna_unicode_character_copy_from_utf32_stream( &utf32_stream_unicode_character, @@ -3113,18 +3256,25 @@ return( -1 ); } - if( utf8_unicode_character != utf32_stream_unicode_character ) + if( utf8_unicode_character < utf32_stream_unicode_character ) { - return( 0 ); + return( LIBUNA_COMPARE_LESS ); + } + else if( utf8_unicode_character > utf32_stream_unicode_character ) + { + return( LIBUNA_COMPARE_GREATER ); } } /* Check if both strings were entirely processed */ - if( ( utf8_string_index != utf8_string_size ) - || ( utf32_stream_index != utf32_stream_size ) ) + if( utf8_string_index < utf8_string_size ) { - return( 0 ); + return( LIBUNA_COMPARE_GREATER ); } - return( 1 ); + else if( utf32_stream_index < utf32_stream_size ) + { + return( LIBUNA_COMPARE_LESS ); + } + return( LIBUNA_COMPARE_EQUAL ); } diff -Nru libsmdev-20171112/libuna/libuna_utf8_string.h libsmdev-20181227/libuna/libuna_utf8_string.h --- libsmdev-20171112/libuna/libuna_utf8_string.h 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/libuna/libuna_utf8_string.h 2018-12-27 19:19:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * UTF-8 string functions * - * Copyright (C) 2008-2017, Joachim Metz + * Copyright (C) 2008-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/libuna/Makefile.am libsmdev-20181227/libuna/Makefile.am --- libsmdev-20171112/libuna/Makefile.am 2017-07-22 09:22:22.000000000 +0000 +++ libsmdev-20181227/libuna/Makefile.am 2018-12-27 19:19:16.000000000 +0000 @@ -2,7 +2,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/include \ -I$(top_srcdir)/common \ - @LIBCERROR_CPPFLAGS@ + @LIBCERROR_CPPFLAGS@ noinst_LTLIBRARIES = libuna.la diff -Nru libsmdev-20171112/libuna/Makefile.in libsmdev-20181227/libuna/Makefile.in --- libsmdev-20171112/libuna/Makefile.in 2017-11-12 14:33:40.000000000 +0000 +++ libsmdev-20181227/libuna/Makefile.in 2018-12-27 19:19:39.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 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, @@ -223,7 +223,50 @@ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/libuna_base16_stream.Plo \ + ./$(DEPDIR)/libuna_base32_stream.Plo \ + ./$(DEPDIR)/libuna_base64_stream.Plo \ + ./$(DEPDIR)/libuna_byte_stream.Plo \ + ./$(DEPDIR)/libuna_codepage_iso_8859_10.Plo \ + ./$(DEPDIR)/libuna_codepage_iso_8859_13.Plo \ + ./$(DEPDIR)/libuna_codepage_iso_8859_14.Plo \ + ./$(DEPDIR)/libuna_codepage_iso_8859_15.Plo \ + ./$(DEPDIR)/libuna_codepage_iso_8859_16.Plo \ + ./$(DEPDIR)/libuna_codepage_iso_8859_2.Plo \ + ./$(DEPDIR)/libuna_codepage_iso_8859_3.Plo \ + ./$(DEPDIR)/libuna_codepage_iso_8859_4.Plo \ + ./$(DEPDIR)/libuna_codepage_iso_8859_5.Plo \ + ./$(DEPDIR)/libuna_codepage_iso_8859_6.Plo \ + ./$(DEPDIR)/libuna_codepage_iso_8859_7.Plo \ + ./$(DEPDIR)/libuna_codepage_iso_8859_8.Plo \ + ./$(DEPDIR)/libuna_codepage_iso_8859_9.Plo \ + ./$(DEPDIR)/libuna_codepage_koi8_r.Plo \ + ./$(DEPDIR)/libuna_codepage_koi8_u.Plo \ + ./$(DEPDIR)/libuna_codepage_windows_1250.Plo \ + ./$(DEPDIR)/libuna_codepage_windows_1251.Plo \ + ./$(DEPDIR)/libuna_codepage_windows_1252.Plo \ + ./$(DEPDIR)/libuna_codepage_windows_1253.Plo \ + ./$(DEPDIR)/libuna_codepage_windows_1254.Plo \ + ./$(DEPDIR)/libuna_codepage_windows_1255.Plo \ + ./$(DEPDIR)/libuna_codepage_windows_1256.Plo \ + ./$(DEPDIR)/libuna_codepage_windows_1257.Plo \ + ./$(DEPDIR)/libuna_codepage_windows_1258.Plo \ + ./$(DEPDIR)/libuna_codepage_windows_874.Plo \ + ./$(DEPDIR)/libuna_codepage_windows_932.Plo \ + ./$(DEPDIR)/libuna_codepage_windows_936.Plo \ + ./$(DEPDIR)/libuna_codepage_windows_949.Plo \ + ./$(DEPDIR)/libuna_codepage_windows_950.Plo \ + ./$(DEPDIR)/libuna_error.Plo ./$(DEPDIR)/libuna_support.Plo \ + ./$(DEPDIR)/libuna_unicode_character.Plo \ + ./$(DEPDIR)/libuna_url_stream.Plo \ + ./$(DEPDIR)/libuna_utf16_stream.Plo \ + ./$(DEPDIR)/libuna_utf16_string.Plo \ + ./$(DEPDIR)/libuna_utf32_stream.Plo \ + ./$(DEPDIR)/libuna_utf32_string.Plo \ + ./$(DEPDIR)/libuna_utf7_stream.Plo \ + ./$(DEPDIR)/libuna_utf8_stream.Plo \ + ./$(DEPDIR)/libuna_utf8_string.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -354,6 +397,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSMDEV_DLL_EXPORT = @LIBSMDEV_DLL_EXPORT@ LIBSMDEV_DLL_IMPORT = @LIBSMDEV_DLL_IMPORT@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -503,7 +547,6 @@ libcthreads_LIBS = @libcthreads_LIBS@ libdir = @libdir@ libexecdir = @libexecdir@ -libsmdev_spec_build_requires = @libsmdev_spec_build_requires@ libsmdev_spec_requires = @libsmdev_spec_requires@ libuna_CFLAGS = @libuna_CFLAGS@ libuna_LIBS = @libuna_LIBS@ @@ -533,7 +576,7 @@ @HAVE_LOCAL_LIBUNA_TRUE@AM_CPPFLAGS = \ @HAVE_LOCAL_LIBUNA_TRUE@ -I$(top_srcdir)/include \ @HAVE_LOCAL_LIBUNA_TRUE@ -I$(top_srcdir)/common \ -@HAVE_LOCAL_LIBUNA_TRUE@ @LIBCERROR_CPPFLAGS@ +@HAVE_LOCAL_LIBUNA_TRUE@ @LIBCERROR_CPPFLAGS@ @HAVE_LOCAL_LIBUNA_TRUE@noinst_LTLIBRARIES = libuna.la @HAVE_LOCAL_LIBUNA_TRUE@libuna_la_SOURCES = \ @@ -611,8 +654,8 @@ *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) @@ -644,50 +687,56 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_base16_stream.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_base32_stream.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_base64_stream.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_byte_stream.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_10.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_13.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_14.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_15.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_16.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_3.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_4.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_5.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_6.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_7.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_8.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_9.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_koi8_r.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_koi8_u.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_1250.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_1251.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_1252.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_1253.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_1254.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_1255.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_1256.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_1257.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_1258.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_874.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_932.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_936.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_949.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_950.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_error.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_support.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_unicode_character.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_url_stream.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_utf16_stream.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_utf16_string.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_utf32_stream.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_utf32_string.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_utf7_stream.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_utf8_stream.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_utf8_string.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_base16_stream.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_base32_stream.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_base64_stream.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_byte_stream.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_10.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_13.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_14.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_15.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_16.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_3.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_4.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_5.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_6.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_7.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_8.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_iso_8859_9.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_koi8_r.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_koi8_u.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_1250.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_1251.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_1252.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_1253.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_1254.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_1255.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_1256.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_1257.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_1258.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_874.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_932.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_936.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_949.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_codepage_windows_950.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_error.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_support.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_unicode_character.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_url_stream.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_utf16_stream.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_utf16_string.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_utf32_stream.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_utf32_string.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_utf7_stream.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_utf8_stream.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libuna_utf8_string.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -768,7 +817,10 @@ 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)'; \ @@ -882,7 +934,50 @@ installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/libuna_base16_stream.Plo + -rm -f ./$(DEPDIR)/libuna_base32_stream.Plo + -rm -f ./$(DEPDIR)/libuna_base64_stream.Plo + -rm -f ./$(DEPDIR)/libuna_byte_stream.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_iso_8859_10.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_iso_8859_13.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_iso_8859_14.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_iso_8859_15.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_iso_8859_16.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_iso_8859_2.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_iso_8859_3.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_iso_8859_4.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_iso_8859_5.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_iso_8859_6.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_iso_8859_7.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_iso_8859_8.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_iso_8859_9.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_koi8_r.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_koi8_u.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_windows_1250.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_windows_1251.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_windows_1252.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_windows_1253.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_windows_1254.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_windows_1255.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_windows_1256.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_windows_1257.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_windows_1258.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_windows_874.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_windows_932.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_windows_936.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_windows_949.Plo + -rm -f ./$(DEPDIR)/libuna_codepage_windows_950.Plo + -rm -f ./$(DEPDIR)/libuna_error.Plo + -rm -f ./$(DEPDIR)/libuna_support.Plo + -rm -f ./$(DEPDIR)/libuna_unicode_character.Plo + -rm -f ./$(DEPDIR)/libuna_url_stream.Plo + -rm -f ./$(DEPDIR)/libuna_utf16_stream.Plo + -rm -f ./$(DEPDIR)/libuna_utf16_string.Plo + -rm -f ./$(DEPDIR)/libuna_utf32_stream.Plo + -rm -f ./$(DEPDIR)/libuna_utf32_string.Plo + -rm -f ./$(DEPDIR)/libuna_utf7_stream.Plo + -rm -f ./$(DEPDIR)/libuna_utf8_stream.Plo + -rm -f ./$(DEPDIR)/libuna_utf8_string.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -903,16 +998,16 @@ .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am diff -Nru libsmdev-20171112/ltmain.sh libsmdev-20181227/ltmain.sh --- libsmdev-20171112/ltmain.sh 2017-11-12 14:33:34.000000000 +0000 +++ libsmdev-20181227/ltmain.sh 2018-12-27 19:19:28.000000000 +0000 @@ -2124,7 +2124,7 @@ # a configuration failure hint, and exit. func_fatal_configuration () { - func__fatal_error ${1+"$@"} \ + func_fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } @@ -7272,10 +7272,12 @@ # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ - -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*) + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ + -specs=*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" diff -Nru libsmdev-20171112/m4/common.m4 libsmdev-20181227/m4/common.m4 --- libsmdev-20171112/m4/common.m4 2017-09-20 04:57:31.000000000 +0000 +++ libsmdev-20181227/m4/common.m4 2018-12-15 08:05:28.000000000 +0000 @@ -1,6 +1,23 @@ dnl Checks for common headers and functions dnl -dnl Version: 20170903 +dnl Version: 20181117 + +dnl Function to test if a certain feature was disabled +AC_DEFUN([AX_COMMON_ARG_DISABLE], +[ + AC_ARG_ENABLE( + [$1], + [AS_HELP_STRING( + [--disable-$1], + [$3])], + [ac_cv_enable_$2=$enableval], + [ac_cv_enable_$2="yes"])dnl + + AC_CACHE_CHECK( + [whether to disable $3], + [ac_cv_enable_$2], + [ac_cv_enable_$2="yes"])dnl +]) dnl Function to test if a certain feature was enabled AC_DEFUN([AX_COMMON_ARG_ENABLE], @@ -36,30 +53,32 @@ [ac_cv_with_$2=$4])dnl ]) -dnl Function to detect whether WINAPI support should be enabled -AC_DEFUN([AX_COMMON_CHECK_ENABLE_WINAPI], +dnl Function to detect whether shared libary support should be disabled +AC_DEFUN([AX_COMMON_CHECK_DISABLE_SHARED_LIBS], +[ + AX_COMMON_ARG_DISABLE( + [shared-libs], + [shared_libs], + [disable shared library support]) +]) + +dnl Function to detect whether debug output should be enabled +AC_DEFUN([AX_COMMON_CHECK_ENABLE_DEBUG_OUTPUT], [ AX_COMMON_ARG_ENABLE( - [winapi], - [winapi], - [enable WINAPI support for cross-compilation], - [auto-detect]) + [debug-output], + [debug_output], + [enable debug output], + [no]) AS_IF( - [test "x$ac_cv_enable_winapi" = xauto-detect], - [ac_common_check_winapi_target_string="$target" - - AS_IF( - [test "x$ac_common_check_winapi_target_string" = x], - [ac_common_check_winapi_target_string="$host"]) + [test "x$ac_cv_enable_debug_output" != xno ], + [AC_DEFINE( + [HAVE_DEBUG_OUTPUT], + [1], + [Define to 1 if debug output should be used.]) - AS_CASE( - [$ac_common_check_winapi_target_string], - [*mingw*],[AC_MSG_NOTICE( - [detected MinGW enabling WINAPI support for cross-compilation]) - ac_cv_enable_winapi=yes], - [*],[ac_cv_enable_winapi=no]) - ]) + ac_cv_enable_debug_output=yes]) ]) dnl Function to detect whether static executables support should be enabled @@ -78,17 +97,8 @@ AC_SUBST( [STATIC_LDFLAGS]) - ac_cv_enable_static_executables=yes]) -]) - -dnl Function to detect whether static executables support should be enabled -AC_DEFUN([AX_COMMON_CHECK_ENABLE_WIDE_CHARACTER_TYPE], -[ - AX_COMMON_ARG_ENABLE( - [wide-character-type], - [wide_character_type], - [enable wide character type support], - [no]) + ac_cv_enable_static_executables=yes + enable_shared=no]) ]) dnl Function to detect whether verbose output should be enabled @@ -110,23 +120,43 @@ ac_cv_enable_verbose_output=yes]) ]) -dnl Function to detect whether debug output should be enabled -AC_DEFUN([AX_COMMON_CHECK_ENABLE_DEBUG_OUTPUT], +dnl Function to detect whether static executables support should be enabled +AC_DEFUN([AX_COMMON_CHECK_ENABLE_WIDE_CHARACTER_TYPE], [ AX_COMMON_ARG_ENABLE( - [debug-output], - [debug_output], - [enable debug output], + [wide-character-type], + [wide_character_type], + [enable wide character type support], [no]) +]) + +dnl Function to detect whether WINAPI support should be enabled +AC_DEFUN([AX_COMMON_CHECK_ENABLE_WINAPI], +[ + AX_COMMON_ARG_ENABLE( + [winapi], + [winapi], + [enable WINAPI support for cross-compilation], + [auto-detect]) AS_IF( - [test "x$ac_cv_enable_debug_output" != xno ], - [AC_DEFINE( - [HAVE_DEBUG_OUTPUT], - [1], - [Define to 1 if debug output should be used.]) + [test "x$ac_cv_enable_winapi" = xauto-detect], + [ac_common_check_winapi_target_string="$target" - ac_cv_enable_debug_output=yes]) + AS_IF( + [test "x$ac_common_check_winapi_target_string" = x], + [ac_common_check_winapi_target_string="$host"]) + + AS_CASE( + [$ac_common_check_winapi_target_string], + [*mingw*],[AC_MSG_NOTICE( + [detected MinGW enabling WINAPI support for cross-compilation]) + ac_cv_enable_winapi=yes], + [*msys*],[AC_MSG_NOTICE( + [detected MSYS enabling WINAPI support for cross-compilation]) + ac_cv_enable_winapi=yes], + [*],[ac_cv_enable_winapi=no]) + ]) ]) dnl Function to detect whether printf conversion specifier "%jd" is available diff -Nru libsmdev-20171112/m4/libcdata.m4 libsmdev-20181227/m4/libcdata.m4 --- libsmdev-20171112/m4/libcdata.m4 2017-09-20 04:57:32.000000000 +0000 +++ libsmdev-20181227/m4/libcdata.m4 2018-12-27 14:13:00.000000000 +0000 @@ -1,40 +1,41 @@ -dnl Checks for libcdata or required headers and functions +dnl Checks for libcdata required headers and functions dnl -dnl Version: 20170904 +dnl Version: 20181216 dnl Function to detect if libcdata is available dnl ac_libcdata_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBCDATA_CHECK_LIB], - [dnl Check if parameters were provided - AS_IF( - [test "x$ac_cv_with_libcdata" != x && test "x$ac_cv_with_libcdata" != xno && test "x$ac_cv_with_libcdata" != xauto-detect], - [AS_IF( - [test -d "$ac_cv_with_libcdata"], - [CFLAGS="$CFLAGS -I${ac_cv_with_libcdata}/include" - LDFLAGS="$LDFLAGS -L${ac_cv_with_libcdata}/lib"], - [AC_MSG_WARN([no such directory: $ac_cv_with_libcdata]) - ]) - ]) - - AS_IF( - [test "x$ac_cv_with_libcdata" = xno], + [AS_IF( + [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libcdata" = xno], [ac_cv_libcdata=no], - [dnl Check for a pkg-config file + [dnl Check if the directory provided as parameter exists AS_IF( - [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], - [PKG_CHECK_MODULES( - [libcdata], - [libcdata >= 20160108], - [ac_cv_libcdata=yes], - [ac_cv_libcdata=check]) + [test "x$ac_cv_with_libcdata" != x && test "x$ac_cv_with_libcdata" != xauto-detect], + [AS_IF( + [test -d "$ac_cv_with_libcdata"], + [CFLAGS="$CFLAGS -I${ac_cv_with_libcdata}/include" + LDFLAGS="$LDFLAGS -L${ac_cv_with_libcdata}/lib"], + [AC_MSG_FAILURE( + [no such directory: $ac_cv_with_libcdata], + [1]) + ]) + ac_cv_libcdata=check], + [dnl Check for a pkg-config file + AS_IF( + [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], + [PKG_CHECK_MODULES( + [libcdata], + [libcdata >= 20181216], + [ac_cv_libcdata=yes], + [ac_cv_libcdata=check]) + ]) + AS_IF( + [test "x$ac_cv_libcdata" = xyes], + [ac_cv_libcdata_CPPFLAGS="$pkg_cv_libcdata_CFLAGS" + ac_cv_libcdata_LIBADD="$pkg_cv_libcdata_LIBS"]) ]) AS_IF( - [test "x$ac_cv_libcdata" = xyes], - [ac_cv_libcdata_CPPFLAGS="$pkg_cv_libcdata_CFLAGS" - ac_cv_libcdata_LIBADD="$pkg_cv_libcdata_LIBS"]) - - AS_IF( [test "x$ac_cv_libcdata" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libcdata.h]) @@ -123,6 +124,48 @@ [ac_cv_libcdata_dummy=yes], [ac_cv_libcdata=no]) + dnl Balanced tree functions + AC_CHECK_LIB( + cdata, + libfdata_btree_initialize, + [ac_cv_libcdata_dummy=yes], + [ac_cv_libcdata=no]) + AC_CHECK_LIB( + cdata, + libcdata_btree_free, + [ac_cv_libcdata_dummy=yes], + [ac_cv_libcdata=no]) + AC_CHECK_LIB( + cdata, + libcdata_btree_get_number_of_values, + [ac_cv_libcdata_dummy=yes], + [ac_cv_libcdata=no]) + AC_CHECK_LIB( + cdata, + libcdata_btree_get_value_by_index, + [ac_cv_libcdata_dummy=yes], + [ac_cv_libcdata=no]) + AC_CHECK_LIB( + cdata, + libcdata_btree_get_value_by_value, + [ac_cv_libcdata_dummy=yes], + [ac_cv_libcdata=no]) + AC_CHECK_LIB( + cdata, + libcdata_btree_insert_value, + [ac_cv_libcdata_dummy=yes], + [ac_cv_libcdata=no]) + AC_CHECK_LIB( + cdata, + libcdata_btree_replace_value, + [ac_cv_libcdata_dummy=yes], + [ac_cv_libcdata=no]) + AC_CHECK_LIB( + cdata, + libcdata_btree_remove_value, + [ac_cv_libcdata_dummy=yes], + [ac_cv_libcdata=no]) + dnl List functions AC_CHECK_LIB( cdata, @@ -436,8 +479,13 @@ [ac_cv_libcdata_dummy=yes], [ac_cv_libcdata=no]) - ac_cv_libcdata_LIBADD="-lcdata" - ]) + ac_cv_libcdata_LIBADD="-lcdata"]) + ]) + AS_IF( + [test "x$ac_cv_with_libcdata" != x && test "x$ac_cv_with_libcdata" != xauto-detect && test "x$ac_cv_libcdata" != xyes], + [AC_MSG_FAILURE( + [unable to find supported libcdata in directory: $ac_cv_with_libcdata], + [1]) ]) ]) diff -Nru libsmdev-20171112/m4/libcerror.m4 libsmdev-20181227/m4/libcerror.m4 --- libsmdev-20171112/m4/libcerror.m4 2017-09-20 04:57:31.000000000 +0000 +++ libsmdev-20181227/m4/libcerror.m4 2018-12-15 08:05:28.000000000 +0000 @@ -1,40 +1,41 @@ -dnl Checks for libcerror or required headers and functions +dnl Checks for libcerror required headers and functions dnl -dnl Version: 20170904 +dnl Version: 20181117 dnl Function to detect if libcerror is available dnl ac_libcerror_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBCERROR_CHECK_LIB], - [dnl Check if parameters were provided - AS_IF( - [test "x$ac_cv_with_libcerror" != x && test "x$ac_cv_with_libcerror" != xno && test "x$ac_cv_with_libcerror" != xauto-detect], - [AS_IF( - [test -d "$ac_cv_with_libcerror"], - [CFLAGS="$CFLAGS -I${ac_cv_with_libcerror}/include" - LDFLAGS="$LDFLAGS -L${ac_cv_with_libcerror}/lib"], - [AC_MSG_WARN([no such directory: $ac_cv_with_libcerror]) - ]) - ]) - - AS_IF( - [test "x$ac_cv_with_libcerror" = xno], + [AS_IF( + [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libcerror" = xno], [ac_cv_libcerror=no], - [dnl Check for a pkg-config file + [dnl Check if the directory provided as parameter exists AS_IF( - [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], - [PKG_CHECK_MODULES( - [libcerror], - [libcerror >= 20120425], - [ac_cv_libcerror=yes], - [ac_cv_libcerror=check]) + [test "x$ac_cv_with_libcerror" != x && test "x$ac_cv_with_libcerror" != xauto-detect], + [AS_IF( + [test -d "$ac_cv_with_libcerror"], + [CFLAGS="$CFLAGS -I${ac_cv_with_libcerror}/include" + LDFLAGS="$LDFLAGS -L${ac_cv_with_libcerror}/lib"], + [AC_MSG_FAILURE( + [no such directory: $ac_cv_with_libcerror], + [1]) + ]) + ac_cv_libcerror=check], + [dnl Check for a pkg-config file + AS_IF( + [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], + [PKG_CHECK_MODULES( + [libcerror], + [libcerror >= 20120425], + [ac_cv_libcerror=yes], + [ac_cv_libcerror=check]) + ]) + AS_IF( + [test "x$ac_cv_libcerror" = xyes], + [ac_cv_libcerror_CPPFLAGS="$pkg_cv_libcerror_CFLAGS" + ac_cv_libcerror_LIBADD="$pkg_cv_libcerror_LIBS"]) ]) AS_IF( - [test "x$ac_cv_libcerror" = xyes], - [ac_cv_libcerror_CPPFLAGS="$pkg_cv_libcerror_CFLAGS" - ac_cv_libcerror_LIBADD="$pkg_cv_libcerror_LIBS"]) - - AS_IF( [test "x$ac_cv_libcerror" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libcerror.h]) @@ -95,8 +96,13 @@ [ac_cv_libcerror_dummy=yes], [ac_cv_libcerror=no]) - ac_cv_libcerror_LIBADD="-lcerror" - ]) + ac_cv_libcerror_LIBADD="-lcerror"]) + ]) + AS_IF( + [test "x$ac_cv_with_libcerror" != x && test "x$ac_cv_with_libcerror" != xauto-detect && test "x$ac_cv_libcerror" != xyes], + [AC_MSG_FAILURE( + [unable to find supported libcerror in directory: $ac_cv_with_libcerror], + [1]) ]) ]) diff -Nru libsmdev-20171112/m4/libcfile.m4 libsmdev-20181227/m4/libcfile.m4 --- libsmdev-20171112/m4/libcfile.m4 2017-09-20 04:57:32.000000000 +0000 +++ libsmdev-20181227/m4/libcfile.m4 2018-12-15 08:05:28.000000000 +0000 @@ -1,60 +1,60 @@ -dnl Checks for libcfile or required headers and functions +dnl Checks for libcfile required headers and functions dnl -dnl Version: 20170904 +dnl Version: 20181117 dnl Function to detect if libcfile is available dnl ac_libcfile_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBCFILE_CHECK_LIB], - [dnl Check if parameters were provided - AS_IF( - [test "x$ac_cv_with_libcfile" != x && test "x$ac_cv_with_libcfile" != xno && test "x$ac_cv_with_libcfile" != xauto-detect], - [AS_IF( - [test -d "$ac_cv_with_libcfile"], - [CFLAGS="$CFLAGS -I${ac_cv_with_libcfile}/include" - LDFLAGS="$LDFLAGS -L${ac_cv_with_libcfile}/lib"], - [AC_MSG_WARN([no such directory: $ac_cv_with_libcfile]) - ]) - ]) - - AS_IF( - [test "x$ac_cv_with_libcfile" = xno], + [AS_IF( + [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libcfile" = xno], [ac_cv_libcfile=no], - [dnl Check for a pkg-config file - AS_IF( - [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], - [PKG_CHECK_MODULES( - [libcfile], - [libcfile >= 20160409], - [ac_cv_libcfile=yes], - [ac_cv_libcfile=check]) - ]) - + [dnl Check if the directory provided as parameter exists AS_IF( - [test "x$ac_cv_libcfile" = xyes && test "x$ac_cv_enable_wide_character_type" != xno], - [AC_CACHE_CHECK( - [whether libcfile/features.h defines LIBCFILE_HAVE_WIDE_CHARACTER_TYPE as 1], - [ac_cv_header_libcfile_features_h_have_wide_character_type], - [AC_LANG_PUSH(C) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include ]], - [[#if !defined( LIBCFILE_HAVE_WIDE_CHARACTER_TYPE ) || ( LIBCFILE_HAVE_WIDE_CHARACTER_TYPE != 1 ) + [test "x$ac_cv_with_libcfile" != x && test "x$ac_cv_with_libcfile" != xauto-detect], + [AS_IF( + [test -d "$ac_cv_with_libcfile"], + [CFLAGS="$CFLAGS -I${ac_cv_with_libcfile}/include" + LDFLAGS="$LDFLAGS -L${ac_cv_with_libcfile}/lib"], + [AC_MSG_FAILURE( + [no such directory: $ac_cv_with_libcfile], + [1]) + ]) + ac_cv_libcfile=check], + [dnl Check for a pkg-config file + AS_IF( + [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], + [PKG_CHECK_MODULES( + [libcfile], + [libcfile >= 20160409], + [ac_cv_libcfile=yes], + [ac_cv_libcfile=check]) + ]) + AS_IF( + [test "x$ac_cv_libcfile" = xyes && test "x$ac_cv_enable_wide_character_type" != xno], + [AC_CACHE_CHECK( + [whether libcfile/features.h defines LIBCFILE_HAVE_WIDE_CHARACTER_TYPE as 1], + [ac_cv_header_libcfile_features_h_have_wide_character_type], + [AC_LANG_PUSH(C) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[#if !defined( LIBCFILE_HAVE_WIDE_CHARACTER_TYPE ) || ( LIBCFILE_HAVE_WIDE_CHARACTER_TYPE != 1 ) #error LIBCFILE_HAVE_WIDE_CHARACTER_TYPE not defined -##endif]] )], - [ac_cv_header_libcfile_features_h_have_wide_character_type=yes], +#endif]] )], + [ac_cv_header_libcfile_features_h_have_wide_character_type=yes], + [ac_cv_header_libcfile_features_h_have_wide_character_type=no]) + AC_LANG_POP(C)], [ac_cv_header_libcfile_features_h_have_wide_character_type=no]) - AC_LANG_POP(C)], - [ac_cv_header_libcfile_features_h_have_wide_character_type=no]) + AS_IF( + [test "x$ac_cv_header_libcfile_features_h_have_wide_character_type" = xno], + [ac_cv_libcfile=no]) + ]) AS_IF( - [test "x$ac_cv_header_libcfile_features_h_have_wide_character_type" = xno], - [ac_cv_libcfile=no]) - ]) - - AS_IF( - [test "x$ac_cv_libcfile" = xyes], - [ac_cv_libcfile_CPPFLAGS="$pkg_cv_libcfile_CFLAGS" - ac_cv_libcfile_LIBADD="$pkg_cv_libcfile_LIBS"]) + [test "x$ac_cv_libcfile" = xyes], + [ac_cv_libcfile_CPPFLAGS="$pkg_cv_libcfile_CFLAGS" + ac_cv_libcfile_LIBADD="$pkg_cv_libcfile_LIBS"]) + ]) AS_IF( [test "x$ac_cv_libcfile" = xcheck], @@ -200,8 +200,13 @@ [ac_cv_libcfile=no]) ]) - ac_cv_libcfile_LIBADD="-lcfile" - ]) + ac_cv_libcfile_LIBADD="-lcfile"]) + ]) + AS_IF( + [test "x$ac_cv_with_libcfile" != x && test "x$ac_cv_with_libcfile" != xauto-detect && test "x$ac_cv_libcfile" != xyes], + [AC_MSG_FAILURE( + [unable to find supported libcfile in directory: $ac_cv_with_libcfile], + [1]) ]) ]) diff -Nru libsmdev-20171112/m4/libclocale.m4 libsmdev-20181227/m4/libclocale.m4 --- libsmdev-20171112/m4/libclocale.m4 2017-09-20 04:57:32.000000000 +0000 +++ libsmdev-20181227/m4/libclocale.m4 2018-12-15 08:05:28.000000000 +0000 @@ -1,60 +1,60 @@ -dnl Checks for libclocale or required headers and functions +dnl Checks for libclocale required headers and functions dnl -dnl Version: 20170904 +dnl Version: 20181117 dnl Function to detect if libclocale is available dnl ac_libclocale_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBCLOCALE_CHECK_LIB], - [dnl Check if parameters were provided - AS_IF( - [test "x$ac_cv_with_libclocale" != x && test "x$ac_cv_with_libclocale" != xno && test "x$ac_cv_with_libclocale" != xauto-detect], - [AS_IF( - [test -d "$ac_cv_with_libclocale"], - [CFLAGS="$CFLAGS -I${ac_cv_with_libclocale}/include" - LDFLAGS="$LDFLAGS -L${ac_cv_with_libclocale}/lib"], - [AC_MSG_WARN([no such directory: $ac_cv_with_libclocale]) - ]) - ]) - - AS_IF( - [test "x$ac_cv_with_libclocale" = xno], + [AS_IF( + [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libclocale" = xno], [ac_cv_libclocale=no], - [dnl Check for a pkg-config file - AS_IF( - [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], - [PKG_CHECK_MODULES( - [libclocale], - [libclocale >= 20120425], - [ac_cv_libclocale=yes], - [ac_cv_libclocale=check]) - ]) - + [dnl Check if the directory provided as parameter exists AS_IF( - [test "x$ac_cv_libclocale" = xyes && test "x$ac_cv_enable_wide_character_type" != xno], - [AC_CACHE_CHECK( - [whether libclocale/features.h defines LIBCLOCALE_HAVE_WIDE_CHARACTER_TYPE as 1], - [ac_cv_header_libclocale_features_h_have_wide_character_type], - [AC_LANG_PUSH(C) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include ]], - [[#if !defined( LIBCLOCALE_HAVE_WIDE_CHARACTER_TYPE ) || ( LIBCLOCALE_HAVE_WIDE_CHARACTER_TYPE != 1 ) + [test "x$ac_cv_with_libclocale" != x && test "x$ac_cv_with_libclocale" != xauto-detect], + [AS_IF( + [test -d "$ac_cv_with_libclocale"], + [CFLAGS="$CFLAGS -I${ac_cv_with_libclocale}/include" + LDFLAGS="$LDFLAGS -L${ac_cv_with_libclocale}/lib"], + [AC_MSG_FAILURE( + [no such directory: $ac_cv_with_libclocale], + [1]) + ]) + ac_cv_libclocale=check], + [dnl Check for a pkg-config file + AS_IF( + [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], + [PKG_CHECK_MODULES( + [libclocale], + [libclocale >= 20120425], + [ac_cv_libclocale=yes], + [ac_cv_libclocale=check]) + ]) + AS_IF( + [test "x$ac_cv_libclocale" = xyes && test "x$ac_cv_enable_wide_character_type" != xno], + [AC_CACHE_CHECK( + [whether libclocale/features.h defines LIBCLOCALE_HAVE_WIDE_CHARACTER_TYPE as 1], + [ac_cv_header_libclocale_features_h_have_wide_character_type], + [AC_LANG_PUSH(C) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[#if !defined( LIBCLOCALE_HAVE_WIDE_CHARACTER_TYPE ) || ( LIBCLOCALE_HAVE_WIDE_CHARACTER_TYPE != 1 ) #error LIBCLOCALE_HAVE_WIDE_CHARACTER_TYPE not defined -##endif]] )], - [ac_cv_header_libclocale_features_h_have_wide_character_type=yes], - [ac_cv_header_libclocale_features_h_have_wide_character_type=no]) - AC_LANG_POP(C)], - [ac_cv_header_libclocale_features_h_have_wide_character_type=no]) +#endif]] )], + [ac_cv_header_libclocale_features_h_have_wide_character_type=yes], + [ac_cv_header_libclocale_features_h_have_wide_character_type=no]) + AC_LANG_POP(C)], + [ac_cv_header_libclocale_features_h_have_wide_character_type=no]) + AS_IF( + [test "x$ac_cv_header_libclocale_features_h_have_wide_character_type" = xno], + [ac_cv_libclocale=no]) + ]) AS_IF( - [test "x$ac_cv_header_libclocale_features_h_have_wide_character_type" = xno], - [ac_cv_libclocale=no]) - ]) - - AS_IF( - [test "x$ac_cv_libclocale" = xyes], - [ac_cv_libclocale_CPPFLAGS="$pkg_cv_libclocale_CFLAGS" - ac_cv_libclocale_LIBADD="$pkg_cv_libclocale_LIBS"]) + [test "x$ac_cv_libclocale" = xyes], + [ac_cv_libclocale_CPPFLAGS="$pkg_cv_libclocale_CFLAGS" + ac_cv_libclocale_LIBADD="$pkg_cv_libclocale_LIBS"]) + ]) AS_IF( [test "x$ac_cv_libclocale" = xcheck], @@ -95,14 +95,14 @@ [ac_cv_libclocale_dummy=yes], [ac_cv_libclocale=no]) - AS_IF( - [test "x$ac_cv_enable_wide_character_type" != xno], - [AC_CHECK_LIB( - clocale, - libclocale_codepage_copy_from_string_wide, - [ac_cv_libclocale_dummy=yes], - [ac_cv_libclocale=no]) - ]) + AS_IF( + [test "x$ac_cv_enable_wide_character_type" != xno], + [AC_CHECK_LIB( + clocale, + libclocale_codepage_copy_from_string_wide, + [ac_cv_libclocale_dummy=yes], + [ac_cv_libclocale=no]) + ]) dnl Locale functions AC_CHECK_LIB( @@ -123,8 +123,13 @@ [ac_cv_libclocale_dummy=yes], [ac_cv_libclocale=no]) - ac_cv_libclocale_LIBADD="-lclocale" - ]) + ac_cv_libclocale_LIBADD="-lclocale"]) + ]) + AS_IF( + [test "x$ac_cv_with_libclocale" != x && test "x$ac_cv_with_libclocale" != xauto-detect && test "x$ac_cv_libclocale" != xyes], + [AC_MSG_FAILURE( + [unable to find supported libclocale in directory: $ac_cv_with_libclocale], + [1]) ]) ]) diff -Nru libsmdev-20171112/m4/libcnotify.m4 libsmdev-20181227/m4/libcnotify.m4 --- libsmdev-20171112/m4/libcnotify.m4 2017-09-20 04:57:32.000000000 +0000 +++ libsmdev-20181227/m4/libcnotify.m4 2018-12-15 08:05:28.000000000 +0000 @@ -1,40 +1,41 @@ -dnl Checks for libcnotify or required headers and functions +dnl Checks for libcnotify required headers and functions dnl -dnl Version: 20170904 +dnl Version: 20181117 dnl Function to detect if libcnotify is available dnl ac_libcnotify_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBCNOTIFY_CHECK_LIB], - [dnl Check if parameters were provided - AS_IF( - [test "x$ac_cv_with_libcnotify" != x && test "x$ac_cv_with_libcnotify" != xno && test "x$ac_cv_with_libcnotify" != xauto-detect], - [AS_IF( - [test -d "$ac_cv_with_libcnotify"], - [CFLAGS="$CFLAGS -I${ac_cv_with_libcnotify}/include" - LDFLAGS="$LDFLAGS -L${ac_cv_with_libcnotify}/lib"], - [AC_MSG_WARN([no such directory: $ac_cv_with_libcnotify]) - ]) - ]) - - AS_IF( - [test "x$ac_cv_with_libcnotify" = xno], + [AS_IF( + [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libcnotify" = xno], [ac_cv_libcnotify=no], - [dnl Check for a pkg-config file + [dnl Check if the directory provided as parameter exists AS_IF( - [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], - [PKG_CHECK_MODULES( - [libcnotify], - [libcnotify >= 20120425], - [ac_cv_libcnotify=yes], - [ac_cv_libcnotify=check]) + [test "x$ac_cv_with_libcnotify" != x && test "x$ac_cv_with_libcnotify" != xauto-detect], + [AS_IF( + [test -d "$ac_cv_with_libcnotify"], + [CFLAGS="$CFLAGS -I${ac_cv_with_libcnotify}/include" + LDFLAGS="$LDFLAGS -L${ac_cv_with_libcnotify}/lib"], + [AC_MSG_FAILURE( + [no such directory: $ac_cv_with_libcnotify], + [1]) + ]) + ac_cv_libcnotify=check], + [dnl Check for a pkg-config file + AS_IF( + [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], + [PKG_CHECK_MODULES( + [libcnotify], + [libcnotify >= 20120425], + [ac_cv_libcnotify=yes], + [ac_cv_libcnotify=check]) + ]) + AS_IF( + [test "x$ac_cv_libcnotify" = xyes], + [ac_cv_libcnotify_CPPFLAGS="$pkg_cv_libcnotify_CFLAGS" + ac_cv_libcnotify_LIBADD="$pkg_cv_libcnotify_LIBS"]) ]) AS_IF( - [test "x$ac_cv_libcnotify" = xyes], - [ac_cv_libcnotify_CPPFLAGS="$pkg_cv_libcnotify_CFLAGS" - ac_cv_libcnotify_LIBADD="$pkg_cv_libcnotify_LIBS"]) - - AS_IF( [test "x$ac_cv_libcnotify" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libcnotify.h]) @@ -92,8 +93,13 @@ [ac_cv_libcnotify_dummy=yes], [ac_cv_libcnotify=no]) - ac_cv_libcnotify_LIBADD="-lcnotify" - ]) + ac_cv_libcnotify_LIBADD="-lcnotify"]) + ]) + AS_IF( + [test "x$ac_cv_with_libcnotify" != x && test "x$ac_cv_with_libcnotify" != xauto-detect && test "x$ac_cv_libcnotify" != xyes], + [AC_MSG_FAILURE( + [unable to find supported libcnotify in directory: $ac_cv_with_libcnotify], + [1]) ]) ]) diff -Nru libsmdev-20171112/m4/libcthreads.m4 libsmdev-20181227/m4/libcthreads.m4 --- libsmdev-20171112/m4/libcthreads.m4 2017-09-20 04:57:32.000000000 +0000 +++ libsmdev-20181227/m4/libcthreads.m4 2018-12-15 08:05:28.000000000 +0000 @@ -1,40 +1,41 @@ -dnl Checks for libcthreads or required headers and functions +dnl Checks for libcthreads required headers and functions dnl -dnl Version: 20170904 +dnl Version: 20181117 dnl Function to detect if libcthreads is available dnl ac_libcthreads_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBCTHREADS_CHECK_LIB], - [dnl Check if parameters were provided - AS_IF( - [test "x$ac_cv_with_libcthreads" != x && test "x$ac_cv_with_libcthreads" != xno && test "x$ac_cv_with_libcthreads" != xauto-detect], - [AS_IF( - [test -d "$ac_cv_with_libcthreads"], - [CFLAGS="$CFLAGS -I${ac_cv_with_libcthreads}/include" - LDFLAGS="$LDFLAGS -L${ac_cv_with_libcthreads}/lib"], - [AC_MSG_WARN([no such directory: $ac_cv_with_libcthreads]) - ]) - ]) - - AS_IF( - [test "x$ac_cv_with_libcthreads" = xno], + [AS_IF( + [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libcthreads" = xno], [ac_cv_libcthreads=no], - [dnl Check for a pkg-config file + [dnl Check if the directory provided as parameter exists AS_IF( - [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], - [PKG_CHECK_MODULES( - [libcthreads], - [libcthreads >= 20160404], - [ac_cv_libcthreads=yes], - [ac_cv_libcthreads=check]) + [test "x$ac_cv_with_libcthreads" != x && test "x$ac_cv_with_libcthreads" != xauto-detect], + [AS_IF( + [test -d "$ac_cv_with_libcthreads"], + [CFLAGS="$CFLAGS -I${ac_cv_with_libcthreads}/include" + LDFLAGS="$LDFLAGS -L${ac_cv_with_libcthreads}/lib"], + [AC_MSG_FAILURE( + [no such directory: $ac_cv_with_libcthreads], + [1]) + ]) + ac_cv_libcthreads=check], + [dnl Check for a pkg-config file + AS_IF( + [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], + [PKG_CHECK_MODULES( + [libcthreads], + [libcthreads >= 20160404], + [ac_cv_libcthreads=yes], + [ac_cv_libcthreads=check]) + ]) + AS_IF( + [test "x$ac_cv_libcthreads" = xyes], + [ac_cv_libcthreads_CPPFLAGS="$pkg_cv_libcthreads_CFLAGS" + ac_cv_libcthreads_LIBADD="$pkg_cv_libcthreads_LIBS"]) ]) AS_IF( - [test "x$ac_cv_libcthreads" = xyes], - [ac_cv_libcthreads_CPPFLAGS="$pkg_cv_libcthreads_CFLAGS" - ac_cv_libcthreads_LIBADD="$pkg_cv_libcthreads_LIBS"]) - - AS_IF( [test "x$ac_cv_libcthreads" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libcthreads.h]) @@ -242,8 +243,14 @@ [ac_cv_libcthreads_dummy=yes], [ac_cv_libcthreads=no]) - ac_cv_libcthreads_LIBADD="-lcthreads" - ]) + ac_cv_libcthreads_LIBADD="-lcthreads"]) + ]) + + AS_IF( + [test "x$ac_cv_with_libcthreads" != x && test "x$ac_cv_with_libcthreads" != xauto-detect && test "x$ac_cv_libcthreads" != xyes], + [AC_MSG_FAILURE( + [unable to find supported libcthreads in directory: $ac_cv_with_libcthreads], + [1]) ]) ]) diff -Nru libsmdev-20171112/m4/libuna.m4 libsmdev-20181227/m4/libuna.m4 --- libsmdev-20171112/m4/libuna.m4 2017-09-20 04:57:32.000000000 +0000 +++ libsmdev-20181227/m4/libuna.m4 2018-12-15 08:06:04.000000000 +0000 @@ -1,38 +1,42 @@ dnl Checks for libuna or required headers and functions dnl -dnl Version: 20170903 +dnl Version: 20181117 -dnl Function to detect if libuna is available as library +dnl Function to detect if libuna is available dnl ac_libuna_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBUNA_CHECK_LIB], - [dnl Check if parameters were provided - AS_IF( - [test "x$ac_cv_with_libuna" != x && test "x$ac_cv_with_libuna" != xno && test "x$ac_cv_with_libuna" != xauto-detect], - [AS_IF( - [test -d "$ac_cv_with_libuna"], - [CFLAGS="$CFLAGS -I${ac_cv_with_libuna}/include" - LDFLAGS="$LDFLAGS -L${ac_cv_with_libuna}/lib"], - [AC_MSG_WARN([no such directory: $ac_cv_with_libuna]) - ]) - ]) - - AS_IF( - [test "x$ac_cv_with_libuna" = xno], + [AS_IF( + [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libuna" = xno], [ac_cv_libuna=no], - [dnl Check for a pkg-config file + [dnl Check if the directory provided as parameter exists AS_IF( - [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], - [PKG_CHECK_MODULES( - [libuna], - [libuna >= 20120425], - [ac_cv_libuna=yes], - [ac_cv_libuna=no]) + [test "x$ac_cv_with_libuna" != x && test "x$ac_cv_with_libuna" != xauto-detect], + [AS_IF( + [test -d "$ac_cv_with_libuna"], + [CFLAGS="$CFLAGS -I${ac_cv_with_libuna}/include" + LDFLAGS="$LDFLAGS -L${ac_cv_with_libuna}/lib"], + [AC_MSG_FAILURE( + [no such directory: $ac_cv_with_libuna], + [1]) + ]) + ac_cv_libuna=check], + [dnl Check for a pkg-config file + AS_IF( + [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], + [PKG_CHECK_MODULES( + [libuna], + [libuna >= 20181006], + [ac_cv_libuna=yes], + [ac_cv_libuna=check]) + ]) + AS_IF( + [test "x$ac_cv_libuna" = xyes], + [ac_cv_libuna_CPPFLAGS="$pkg_cv_libuna_CFLAGS" + ac_cv_libuna_LIBADD="$pkg_cv_libuna_LIBS"]) ]) AS_IF( - [test "x$ac_cv_libuna" = xyes], - [ac_cv_libuna_CPPFLAGS="$pkg_cv_libuna_CFLAGS" - ac_cv_libuna_LIBADD="$pkg_cv_libuna_LIBS"], + [test "x$ac_cv_libuna" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libuna.h]) @@ -619,8 +623,13 @@ [ac_cv_libuna_dummy=yes], [ac_cv_libuna=no]) - ac_cv_libuna_LIBADD="-luna" - ]) + ac_cv_libuna_LIBADD="-luna"]) + ]) + AS_IF( + [test "x$ac_cv_with_libuna" != x && test "x$ac_cv_with_libuna" != xauto-detect && test "x$ac_cv_libuna" != xyes], + [AC_MSG_FAILURE( + [unable to find supported libuna in directory: $ac_cv_with_libuna], + [1]) ]) ]) diff -Nru libsmdev-20171112/m4/python.m4 libsmdev-20181227/m4/python.m4 --- libsmdev-20171112/m4/python.m4 2017-08-27 05:30:31.000000000 +0000 +++ libsmdev-20181227/m4/python.m4 2018-08-31 05:13:03.000000000 +0000 @@ -1,6 +1,6 @@ dnl Functions for Python bindings dnl -dnl Version: 20170806 +dnl Version: 20170830 dnl Function to check if the python binary is available dnl "python${PYTHON_VERSION} python python# python#.#" @@ -8,7 +8,7 @@ [AS_IF( [test "x${PYTHON_VERSION}" != x], [ax_python_progs="python${PYTHON_VERSION}"], - [ax_python_progs="python python2 python2.7 python2.6 python2.5 python3 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0"]) + [ax_python_progs="python python2 python2.7 python2.6 python2.5 python3 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0"]) AC_CHECK_PROGS( [PYTHON], [$ax_python_progs]) @@ -275,6 +275,12 @@ AC_MSG_RESULT( [$PYTHON2_LDFLAGS]) + dnl For CygWin add the -no-undefined linker flag + AS_CASE( + [$host_os], + [cygwin*],[PYTHON2_LDFLAGS="${PYTHON2_LDFLAGS} -no-undefined"], + [*],[]) + dnl Check for the existence of Python.h BACKUP_CPPFLAGS="${CPPFLAGS}" CPPFLAGS="${CPPFLAGS} ${PYTHON2_INCLUDES}" @@ -380,6 +386,12 @@ AC_MSG_RESULT( [$PYTHON3_LDFLAGS]) + dnl For CygWin add the -no-undefined linker flag + AS_CASE( + [$host_os], + [cygwin*],[PYTHON3_LDFLAGS="${PYTHON3_LDFLAGS} -no-undefined"], + [*],[]) + dnl Check for the existence of Python.h BACKUP_CPPFLAGS="${CPPFLAGS}" CPPFLAGS="${CPPFLAGS} ${PYTHON3_INCLUDES}" @@ -474,7 +486,9 @@ dnl Function to detect if to enable Python AC_DEFUN([AX_PYTHON_CHECK_ENABLE], - [AX_COMMON_ARG_ENABLE( + [AX_PYTHON_CHECK_PYPREFIX + + AX_COMMON_ARG_ENABLE( [python], [python], [build Python bindings], @@ -486,26 +500,7 @@ [no], [no]) - AS_IF( - [test "x${ac_cv_enable_python}" != xno], - [AX_PYTHON_CHECK]) - - AS_IF( - [test "x${ac_cv_enable_python}" != xno], - [AC_DEFINE( - [HAVE_PYTHON], - [1], - [Define to 1 if you have Python]) - ]) - - AM_CONDITIONAL( - HAVE_PYTHON, - [test "x${ac_cv_enable_python}" != xno]) -]) - -dnl Function to detect if to enable Python 2 -AC_DEFUN([AX_PYTHON2_CHECK_ENABLE], - [AX_COMMON_ARG_ENABLE( + AX_COMMON_ARG_ENABLE( [python2], [python2], [build Python 2 bindings], @@ -517,26 +512,7 @@ [no], [no]) - AS_IF( - [test "x${ac_cv_enable_python2}" != xno], - [AX_PYTHON2_CHECK]) - - AS_IF( - [test "x${ac_cv_enable_python2}" != xno], - [AC_DEFINE( - [HAVE_PYTHON2], - [1], - [Define to 1 if you have Python 2]) - ]) - - AM_CONDITIONAL( - HAVE_PYTHON2, - [test "x${ac_cv_enable_python2}" != xno]) -]) - -dnl Function to detect if to enable Python 3 -AC_DEFUN([AX_PYTHON3_CHECK_ENABLE], - [AX_COMMON_ARG_ENABLE( + AX_COMMON_ARG_ENABLE( [python3], [python3], [build Python 3 bindings], @@ -549,19 +525,49 @@ [no]) AS_IF( - [test "x${ac_cv_enable_python3}" != xno], - [AX_PYTHON3_CHECK]) + [test "x${ac_cv_enable_python}" != xno], + [AX_PYTHON_CHECK]) + + AS_IF( + [test "x${ac_cv_enable_python2}" != xno], + [AX_PYTHON2_CHECK]) AS_IF( [test "x${ac_cv_enable_python3}" != xno], - [AC_DEFINE( - [HAVE_PYTHON3], - [1], - [Define to 1 if you have Python 3]) - ]) + [AX_PYTHON3_CHECK]) + + AM_CONDITIONAL( + HAVE_PYTHON, + [test "x${ac_cv_enable_python}" != xno]) + + AM_CONDITIONAL( + HAVE_PYTHON2, + [test "x${ac_cv_enable_python2}" != xno]) AM_CONDITIONAL( HAVE_PYTHON3, [test "x${ac_cv_enable_python3}" != xno]) + + AM_CONDITIONAL( + HAVE_PYTHON_TESTS, + [test "x${ac_cv_enable_python}" != xno || test "x${ac_cv_enable_python2}" != xno || test "x${ac_cv_enable_python3}" != xno]) + + AS_IF( + [test "x${ac_cv_enable_python}" = xno], + [AS_IF( + [test "x${ac_cv_enable_python2}" != xno || test "x${ac_cv_enable_python3}" != xno], + [AS_IF( + [test "x${ac_cv_enable_python2}" != xno], + [ac_cv_enable_python=${ac_cv_enable_python2}], + [ac_cv_enable_python=""]) + AS_IF( + [test "x${ac_cv_enable_python3}" != xno], + [AS_IF( + [test "x${ac_cv_enable_python}" != x], + [ac_cv_enable_python="${ac_cv_enable_python}, "]) + ac_cv_enable_python="${ac_cv_enable_python}${ac_cv_enable_python3}"]) + ]) + ]) + ]) ]) diff -Nru libsmdev-20171112/m4/tests.m4 libsmdev-20181227/m4/tests.m4 --- libsmdev-20171112/m4/tests.m4 2016-12-22 06:23:21.000000000 +0000 +++ libsmdev-20181227/m4/tests.m4 2018-12-15 08:05:28.000000000 +0000 @@ -1,12 +1,12 @@ dnl Functions for testing dnl -dnl Version: 20161212 +dnl Version: 20180905 dnl Function to detect if tests dependencies are available AC_DEFUN([AX_TESTS_CHECK_LOCAL], [AC_CHECK_HEADERS([dlfcn.h]) - AC_CHECK_FUNCS([fmemopen getopt]) + AC_CHECK_FUNCS([fmemopen getopt mkstemp unlink]) AC_CHECK_LIB( dl, diff -Nru libsmdev-20171112/m4/types.m4 libsmdev-20181227/m4/types.m4 --- libsmdev-20171112/m4/types.m4 2016-11-09 02:11:37.000000000 +0000 +++ libsmdev-20181227/m4/types.m4 2018-08-31 05:13:03.000000000 +0000 @@ -1,6 +1,6 @@ dnl Functions for type definitions dnl -dnl Version: 20161004 +dnl Version: 20180727 dnl Function to detect if type definitions are available AC_DEFUN([AX_TYPES_CHECK_LOCAL], @@ -67,7 +67,7 @@ AC_TYPE_MODE_T AC_TYPE_OFF_T AC_TYPE_SIZE_T - + AC_CHECK_TYPE( [size32_t], [AC_SUBST( @@ -77,7 +77,7 @@ [HAVE_SIZE32_T], [0]) ]) - + AC_CHECK_TYPE( [ssize32_t], [AC_SUBST( @@ -87,7 +87,7 @@ [HAVE_SSIZE32_T], [0]) ]) - + AC_CHECK_TYPE( [size64_t], [AC_SUBST( @@ -97,7 +97,7 @@ [HAVE_SIZE64_T], [0]) ]) - + AC_CHECK_TYPE( [ssize64_t], [AC_SUBST( @@ -107,7 +107,7 @@ [HAVE_SSIZE64_T], [0]) ]) - + AC_CHECK_TYPE( [off64_t], [AC_SUBST( @@ -117,14 +117,15 @@ [HAVE_OFF64_T], [0]) ]) - + AC_CHECK_TYPE([ssize_t]) AC_CHECK_TYPE([u64]) - + AC_CHECK_SIZEOF([int]) + AC_CHECK_SIZEOF([long]) AC_CHECK_SIZEOF([off_t]) AC_CHECK_SIZEOF([size_t]) - + AS_IF( [test "x$ac_cv_header_wchar_h" = xyes], [AC_CHECK_SIZEOF([wchar_t])]) diff -Nru libsmdev-20171112/Makefile.in libsmdev-20181227/Makefile.in --- libsmdev-20171112/Makefile.in 2017-11-12 14:33:39.000000000 +0000 +++ libsmdev-20181227/Makefile.in 2018-12-27 19:19:38.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 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, @@ -180,7 +180,7 @@ $(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) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is @@ -334,6 +334,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSMDEV_DLL_EXPORT = @LIBSMDEV_DLL_EXPORT@ LIBSMDEV_DLL_IMPORT = @LIBSMDEV_DLL_IMPORT@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -483,7 +484,6 @@ libcthreads_LIBS = @libcthreads_LIBS@ libdir = @libdir@ libexecdir = @libexecdir@ -libsmdev_spec_build_requires = @libsmdev_spec_build_requires@ libsmdev_spec_requires = @libsmdev_spec_requires@ libuna_CFLAGS = @libuna_CFLAGS@ libuna_LIBS = @libuna_LIBS@ @@ -597,8 +597,8 @@ 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) @@ -758,7 +758,10 @@ -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 -Nru libsmdev-20171112/manuals/libsmdev.3 libsmdev-20181227/manuals/libsmdev.3 --- libsmdev-20171112/manuals/libsmdev.3 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/manuals/libsmdev.3 2018-12-27 14:12:59.000000000 +0000 @@ -153,7 +153,7 @@ .Sh AUTHOR These man pages are generated from "libsmdev.h". .Sh COPYRIGHT -Copyright (C) 2010-2017, Joachim Metz . +Copyright (C) 2010-2018, Joachim Metz . This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. diff -Nru libsmdev-20171112/manuals/Makefile.in libsmdev-20181227/manuals/Makefile.in --- libsmdev-20171112/manuals/Makefile.in 2017-11-12 14:33:40.000000000 +0000 +++ libsmdev-20181227/manuals/Makefile.in 2018-12-27 19:19:39.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 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, @@ -248,6 +248,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSMDEV_DLL_EXPORT = @LIBSMDEV_DLL_EXPORT@ LIBSMDEV_DLL_IMPORT = @LIBSMDEV_DLL_IMPORT@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -397,7 +398,6 @@ libcthreads_LIBS = @libcthreads_LIBS@ libdir = @libdir@ libexecdir = @libexecdir@ -libsmdev_spec_build_requires = @libsmdev_spec_build_requires@ libsmdev_spec_requires = @libsmdev_spec_requires@ libuna_CFLAGS = @libuna_CFLAGS@ libuna_LIBS = @libuna_LIBS@ @@ -455,8 +455,8 @@ *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) @@ -566,7 +566,10 @@ 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 -Nru libsmdev-20171112/manuals/smdevinfo.1 libsmdev-20181227/manuals/smdevinfo.1 --- libsmdev-20171112/manuals/smdevinfo.1 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/manuals/smdevinfo.1 2018-12-27 14:12:59.000000000 +0000 @@ -63,7 +63,7 @@ .Sh AUTHOR These man pages were written by Joachim Metz. .Sh COPYRIGHT -Copyright (C) 2010-2017, Joachim Metz . +Copyright (C) 2010-2018, Joachim Metz . This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .Sh SEE ALSO .Xr smdevexport 1 diff -Nru libsmdev-20171112/missing libsmdev-20181227/missing --- libsmdev-20171112/missing 2017-11-12 14:33:39.000000000 +0000 +++ libsmdev-20181227/missing 2018-12-27 19:19:37.000000000 +0000 @@ -1,9 +1,9 @@ #! /bin/sh # Common wrapper for a few potentially missing GNU programs. -scriptversion=2013-10-28.13; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -101,9 +101,9 @@ exit $st fi -perl_URL=http://www.perl.org/ -flex_URL=http://flex.sourceforge.net/ -gnu_software_URL=http://www.gnu.org/software +perl_URL=https://www.perl.org/ +flex_URL=https://github.com/westes/flex +gnu_software_URL=https://www.gnu.org/software program_details () { @@ -207,9 +207,9 @@ exit $st # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff -Nru libsmdev-20171112/msvscpp/libsmdev.sln libsmdev-20181227/msvscpp/libsmdev.sln --- libsmdev-20171112/msvscpp/libsmdev.sln 2017-11-12 14:20:08.000000000 +0000 +++ libsmdev-20181227/msvscpp/libsmdev.sln 2018-12-27 14:26:57.000000000 +0000 @@ -28,6 +28,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smdev_test_notify", "smdev_test_notify\smdev_test_notify.vcproj", "{FED1F2DA-99EC-473D-9AD7-2F22B89A1790}" ProjectSection(ProjectDependencies) = postProject {D236EB8A-199F-4C8B-AE1E-EF82FBBA0FE3} = {D236EB8A-199F-4C8B-AE1E-EF82FBBA0FE3} + {BD3A95FA-A3DE-4B79-A889-A7E5ECA4B69C} = {BD3A95FA-A3DE-4B79-A889-A7E5ECA4B69C} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smdev_test_sector_range", "smdev_test_sector_range\smdev_test_sector_range.vcproj", "{EAB771C7-C8CA-4780-B9F9-F535B9AF8AAC}" diff -Nru libsmdev-20171112/msvscpp/Makefile.in libsmdev-20181227/msvscpp/Makefile.in --- libsmdev-20171112/msvscpp/Makefile.in 2017-11-12 14:33:40.000000000 +0000 +++ libsmdev-20181227/msvscpp/Makefile.in 2018-12-27 19:19:40.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 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, @@ -216,6 +216,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSMDEV_DLL_EXPORT = @LIBSMDEV_DLL_EXPORT@ LIBSMDEV_DLL_IMPORT = @LIBSMDEV_DLL_IMPORT@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -365,7 +366,6 @@ libcthreads_LIBS = @libcthreads_LIBS@ libdir = @libdir@ libexecdir = @libexecdir@ -libsmdev_spec_build_requires = @libsmdev_spec_build_requires@ libsmdev_spec_requires = @libsmdev_spec_requires@ libuna_CFLAGS = @libuna_CFLAGS@ libuna_LIBS = @libuna_LIBS@ @@ -437,8 +437,8 @@ *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) @@ -462,7 +462,10 @@ 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 -Nru libsmdev-20171112/msvscpp/smdev_test_notify/smdev_test_notify.vcproj libsmdev-20181227/msvscpp/smdev_test_notify/smdev_test_notify.vcproj --- libsmdev-20171112/msvscpp/smdev_test_notify/smdev_test_notify.vcproj 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/msvscpp/smdev_test_notify/smdev_test_notify.vcproj 2018-12-27 14:26:57.000000000 +0000 @@ -186,6 +186,10 @@ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > + + diff -Nru libsmdev-20171112/NEWS libsmdev-20181227/NEWS --- libsmdev-20171112/NEWS 2010-01-10 11:08:55.000000000 +0000 +++ libsmdev-20181227/NEWS 2018-12-27 14:12:43.000000000 +0000 @@ -1 +0,0 @@ -Initial release diff -Nru libsmdev-20171112/pysmdev/Makefile.am libsmdev-20181227/pysmdev/Makefile.am --- libsmdev-20171112/pysmdev/Makefile.am 2016-11-09 02:11:33.000000000 +0000 +++ libsmdev-20181227/pysmdev/Makefile.am 2018-08-31 05:22:42.000000000 +0000 @@ -6,7 +6,8 @@ @LIBCDATA_CPPFLAGS@ \ @LIBCLOCALE_CPPFLAGS@ \ @LIBUNA_CPPFLAGS@ \ - @LIBCFILE_CPPFLAGS@ + @LIBCFILE_CPPFLAGS@ \ + @LIBSMDEV_DLL_IMPORT@ pyexec_LTLIBRARIES = pysmdev.la diff -Nru libsmdev-20171112/pysmdev/Makefile.in libsmdev-20181227/pysmdev/Makefile.in --- libsmdev-20171112/pysmdev/Makefile.in 2017-11-12 14:33:40.000000000 +0000 +++ libsmdev-20181227/pysmdev/Makefile.in 2018-12-27 19:19:40.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 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, @@ -175,7 +175,12 @@ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/pysmdev_la-pysmdev.Plo \ + ./$(DEPDIR)/pysmdev_la-pysmdev_error.Plo \ + ./$(DEPDIR)/pysmdev_la-pysmdev_handle.Plo \ + ./$(DEPDIR)/pysmdev_la-pysmdev_integer.Plo \ + ./$(DEPDIR)/pysmdev_la-pysmdev_metadata.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -306,6 +311,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSMDEV_DLL_EXPORT = @LIBSMDEV_DLL_EXPORT@ LIBSMDEV_DLL_IMPORT = @LIBSMDEV_DLL_IMPORT@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -455,7 +461,6 @@ libcthreads_LIBS = @libcthreads_LIBS@ libdir = @libdir@ libexecdir = @libexecdir@ -libsmdev_spec_build_requires = @libsmdev_spec_build_requires@ libsmdev_spec_requires = @libsmdev_spec_requires@ libuna_CFLAGS = @libuna_CFLAGS@ libuna_LIBS = @libuna_LIBS@ @@ -489,7 +494,8 @@ @HAVE_PYTHON_TRUE@ @LIBCDATA_CPPFLAGS@ \ @HAVE_PYTHON_TRUE@ @LIBCLOCALE_CPPFLAGS@ \ @HAVE_PYTHON_TRUE@ @LIBUNA_CPPFLAGS@ \ -@HAVE_PYTHON_TRUE@ @LIBCFILE_CPPFLAGS@ +@HAVE_PYTHON_TRUE@ @LIBCFILE_CPPFLAGS@ \ +@HAVE_PYTHON_TRUE@ @LIBSMDEV_DLL_IMPORT@ @HAVE_PYTHON_TRUE@pyexec_LTLIBRARIES = pysmdev.la @HAVE_PYTHON_TRUE@pysmdev_la_SOURCES = \ @@ -538,8 +544,8 @@ *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) @@ -595,11 +601,17 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_error.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_handle.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_integer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_metadata.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_error.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_handle.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_integer.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_metadata.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -715,7 +727,10 @@ 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)'; \ @@ -832,7 +847,11 @@ installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/pysmdev_la-pysmdev.Plo + -rm -f ./$(DEPDIR)/pysmdev_la-pysmdev_error.Plo + -rm -f ./$(DEPDIR)/pysmdev_la-pysmdev_handle.Plo + -rm -f ./$(DEPDIR)/pysmdev_la-pysmdev_integer.Plo + -rm -f ./$(DEPDIR)/pysmdev_la-pysmdev_metadata.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -853,19 +872,20 @@ .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-pyexecLTLIBRARIES cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-pyexecLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-pyexecLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am \ + install-pyexecLTLIBRARIES install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am \ uninstall-pyexecLTLIBRARIES .PRECIOUS: Makefile diff -Nru libsmdev-20171112/pysmdev/pysmdev.c libsmdev-20181227/pysmdev/pysmdev.c --- libsmdev-20171112/pysmdev/pysmdev.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/pysmdev/pysmdev.c 2018-12-27 14:14:29.000000000 +0000 @@ -1,7 +1,7 @@ /* * Python bindings module for libsmdev (pysmdev) * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/pysmdev/pysmdev_error.c libsmdev-20181227/pysmdev/pysmdev_error.c --- libsmdev-20171112/pysmdev/pysmdev_error.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/pysmdev/pysmdev_error.c 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Error functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/pysmdev/pysmdev_error.h libsmdev-20181227/pysmdev/pysmdev_error.h --- libsmdev-20171112/pysmdev/pysmdev_error.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/pysmdev/pysmdev_error.h 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Error functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/pysmdev/pysmdev.h libsmdev-20181227/pysmdev/pysmdev.h --- libsmdev-20171112/pysmdev/pysmdev.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/pysmdev/pysmdev.h 2018-12-27 14:14:29.000000000 +0000 @@ -1,7 +1,7 @@ /* * Python bindings for libsmdev (pysmdev) * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/pysmdev/pysmdev_handle.c libsmdev-20181227/pysmdev/pysmdev_handle.c --- libsmdev-20171112/pysmdev/pysmdev_handle.c 2017-11-12 14:20:08.000000000 +0000 +++ libsmdev-20181227/pysmdev/pysmdev_handle.c 2018-12-27 14:14:29.000000000 +0000 @@ -1,7 +1,7 @@ /* * Python object wrapper of libsmdev_handle_t * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/pysmdev/pysmdev_handle.h libsmdev-20181227/pysmdev/pysmdev_handle.h --- libsmdev-20171112/pysmdev/pysmdev_handle.h 2017-11-12 14:20:08.000000000 +0000 +++ libsmdev-20181227/pysmdev/pysmdev_handle.h 2018-12-27 14:14:29.000000000 +0000 @@ -1,7 +1,7 @@ /* * Python object wrapper of libsmdev_handle_t * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/pysmdev/pysmdev_integer.c libsmdev-20181227/pysmdev/pysmdev_integer.c --- libsmdev-20171112/pysmdev/pysmdev_integer.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/pysmdev/pysmdev_integer.c 2018-12-27 14:12:57.000000000 +0000 @@ -1,7 +1,7 @@ /* * Integer functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/pysmdev/pysmdev_integer.h libsmdev-20181227/pysmdev/pysmdev_integer.h --- libsmdev-20171112/pysmdev/pysmdev_integer.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/pysmdev/pysmdev_integer.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * Integer functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/pysmdev/pysmdev_libcerror.h libsmdev-20181227/pysmdev/pysmdev_libcerror.h --- libsmdev-20171112/pysmdev/pysmdev_libcerror.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/pysmdev/pysmdev_libcerror.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* - * The internal libcerror header + * The libcerror header wrapper * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/pysmdev/pysmdev_libclocale.h libsmdev-20181227/pysmdev/pysmdev_libclocale.h --- libsmdev-20171112/pysmdev/pysmdev_libclocale.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/pysmdev/pysmdev_libclocale.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* - * The internal libclocale header + * The libclocale header wrapper * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/pysmdev/pysmdev_libsmdev.h libsmdev-20181227/pysmdev/pysmdev_libsmdev.h --- libsmdev-20171112/pysmdev/pysmdev_libsmdev.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/pysmdev/pysmdev_libsmdev.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal libsmdev header * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -24,14 +24,7 @@ #include -/* If Cygwin libtool DLL support is enabled set LIBSMDEV_DLL_IMPORT - * before including libsmdev.h - */ -#if defined( _WIN32 ) && defined( DLL_EXPORT ) -#define LIBSMDEV_DLL_IMPORT -#endif - #include -#endif +#endif /* !defined( _PYSMDEV_LIBSMDEV_H ) */ diff -Nru libsmdev-20171112/pysmdev/pysmdev_metadata.c libsmdev-20181227/pysmdev/pysmdev_metadata.c --- libsmdev-20171112/pysmdev/pysmdev_metadata.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/pysmdev/pysmdev_metadata.c 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * Metadata functions for the Python object definition of the libsmdev handle * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/pysmdev/pysmdev_metadata.h libsmdev-20181227/pysmdev/pysmdev_metadata.h --- libsmdev-20171112/pysmdev/pysmdev_metadata.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/pysmdev/pysmdev_metadata.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * Metadata functions for the Python object definition of the libsmdev handle * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/pysmdev/pysmdev_python.h libsmdev-20181227/pysmdev/pysmdev_python.h --- libsmdev-20171112/pysmdev/pysmdev_python.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/pysmdev/pysmdev_python.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * The python header wrapper * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/pysmdev/pysmdev_unused.h libsmdev-20181227/pysmdev/pysmdev_unused.h --- libsmdev-20171112/pysmdev/pysmdev_unused.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/pysmdev/pysmdev_unused.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * The internal unused definition * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/pysmdev-python2/Makefile.am libsmdev-20181227/pysmdev-python2/Makefile.am --- libsmdev-20171112/pysmdev-python2/Makefile.am 2017-11-12 14:19:27.000000000 +0000 +++ libsmdev-20181227/pysmdev-python2/Makefile.am 2018-12-27 14:12:50.000000000 +0000 @@ -13,7 +13,8 @@ @LIBCLOCALE_CPPFLAGS@ \ @LIBUNA_CPPFLAGS@ \ @LIBCFILE_CPPFLAGS@ - @LIBFGUID_CPPFLAGS@ + @LIBFGUID_CPPFLAGS@ \ + @LIBSMDEV_DLL_IMPORT@ am_pysmdev_la_rpath = -rpath $(pyexecdir2) diff -Nru libsmdev-20171112/pysmdev-python2/Makefile.in libsmdev-20181227/pysmdev-python2/Makefile.in --- libsmdev-20171112/pysmdev-python2/Makefile.in 2017-11-12 14:33:40.000000000 +0000 +++ libsmdev-20181227/pysmdev-python2/Makefile.in 2018-12-27 19:19:40.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 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, @@ -169,7 +169,12 @@ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/pysmdev_la-pysmdev.Plo \ + ./$(DEPDIR)/pysmdev_la-pysmdev_error.Plo \ + ./$(DEPDIR)/pysmdev_la-pysmdev_handle.Plo \ + ./$(DEPDIR)/pysmdev_la-pysmdev_integer.Plo \ + ./$(DEPDIR)/pysmdev_la-pysmdev_metadata.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -300,6 +305,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSMDEV_DLL_EXPORT = @LIBSMDEV_DLL_EXPORT@ LIBSMDEV_DLL_IMPORT = @LIBSMDEV_DLL_IMPORT@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -449,7 +455,6 @@ libcthreads_LIBS = @libcthreads_LIBS@ libdir = @libdir@ libexecdir = @libexecdir@ -libsmdev_spec_build_requires = @libsmdev_spec_build_requires@ libsmdev_spec_requires = @libsmdev_spec_requires@ libuna_CFLAGS = @libuna_CFLAGS@ libuna_LIBS = @libuna_LIBS@ @@ -540,8 +545,8 @@ *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) @@ -597,11 +602,17 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_error.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_handle.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_integer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_metadata.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_error.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_handle.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_integer.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_metadata.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -717,7 +728,10 @@ 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)'; \ @@ -837,7 +851,11 @@ installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/pysmdev_la-pysmdev.Plo + -rm -f ./$(DEPDIR)/pysmdev_la-pysmdev_error.Plo + -rm -f ./$(DEPDIR)/pysmdev_la-pysmdev_handle.Plo + -rm -f ./$(DEPDIR)/pysmdev_la-pysmdev_integer.Plo + -rm -f ./$(DEPDIR)/pysmdev_la-pysmdev_metadata.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -858,15 +876,15 @@ .MAKE: all check install install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-local clean-pyexecLTLIBRARIES \ - cscopelist-am ctags ctags-am distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-local \ + clean-pyexecLTLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ install-pyexecLTLIBRARIES install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ @@ -876,7 +894,8 @@ .PRECIOUS: Makefile -@HAVE_PYTHON2_TRUE@ @LIBFGUID_CPPFLAGS@ +@HAVE_PYTHON2_TRUE@ @LIBFGUID_CPPFLAGS@ \ +@HAVE_PYTHON2_TRUE@ @LIBSMDEV_DLL_IMPORT@ @HAVE_PYTHON2_TRUE@$(BUILT_SOURCES): @HAVE_PYTHON2_TRUE@ /bin/cp -f $(top_srcdir)/pysmdev/$@ $@ diff -Nru libsmdev-20171112/pysmdev-python3/Makefile.am libsmdev-20181227/pysmdev-python3/Makefile.am --- libsmdev-20171112/pysmdev-python3/Makefile.am 2017-11-12 14:19:27.000000000 +0000 +++ libsmdev-20181227/pysmdev-python3/Makefile.am 2018-12-27 14:12:51.000000000 +0000 @@ -13,7 +13,8 @@ @LIBCLOCALE_CPPFLAGS@ \ @LIBUNA_CPPFLAGS@ \ @LIBCFILE_CPPFLAGS@ - @LIBFGUID_CPPFLAGS@ + @LIBFGUID_CPPFLAGS@ \ + @LIBSMDEV_DLL_IMPORT@ am_pysmdev_la_rpath = -rpath $(pyexecdir3) diff -Nru libsmdev-20171112/pysmdev-python3/Makefile.in libsmdev-20181227/pysmdev-python3/Makefile.in --- libsmdev-20171112/pysmdev-python3/Makefile.in 2017-11-12 14:33:40.000000000 +0000 +++ libsmdev-20181227/pysmdev-python3/Makefile.in 2018-12-27 19:19:40.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 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, @@ -169,7 +169,12 @@ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/pysmdev_la-pysmdev.Plo \ + ./$(DEPDIR)/pysmdev_la-pysmdev_error.Plo \ + ./$(DEPDIR)/pysmdev_la-pysmdev_handle.Plo \ + ./$(DEPDIR)/pysmdev_la-pysmdev_integer.Plo \ + ./$(DEPDIR)/pysmdev_la-pysmdev_metadata.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -300,6 +305,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSMDEV_DLL_EXPORT = @LIBSMDEV_DLL_EXPORT@ LIBSMDEV_DLL_IMPORT = @LIBSMDEV_DLL_IMPORT@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -449,7 +455,6 @@ libcthreads_LIBS = @libcthreads_LIBS@ libdir = @libdir@ libexecdir = @libexecdir@ -libsmdev_spec_build_requires = @libsmdev_spec_build_requires@ libsmdev_spec_requires = @libsmdev_spec_requires@ libuna_CFLAGS = @libuna_CFLAGS@ libuna_LIBS = @libuna_LIBS@ @@ -540,8 +545,8 @@ *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) @@ -597,11 +602,17 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_error.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_handle.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_integer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_metadata.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_error.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_handle.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_integer.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pysmdev_la-pysmdev_metadata.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -717,7 +728,10 @@ 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)'; \ @@ -837,7 +851,11 @@ installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/pysmdev_la-pysmdev.Plo + -rm -f ./$(DEPDIR)/pysmdev_la-pysmdev_error.Plo + -rm -f ./$(DEPDIR)/pysmdev_la-pysmdev_handle.Plo + -rm -f ./$(DEPDIR)/pysmdev_la-pysmdev_integer.Plo + -rm -f ./$(DEPDIR)/pysmdev_la-pysmdev_metadata.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -858,15 +876,15 @@ .MAKE: all check install install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-local clean-pyexecLTLIBRARIES \ - cscopelist-am ctags ctags-am distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-local \ + clean-pyexecLTLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ install-pyexecLTLIBRARIES install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ @@ -876,7 +894,8 @@ .PRECIOUS: Makefile -@HAVE_PYTHON3_TRUE@ @LIBFGUID_CPPFLAGS@ +@HAVE_PYTHON3_TRUE@ @LIBFGUID_CPPFLAGS@ \ +@HAVE_PYTHON3_TRUE@ @LIBSMDEV_DLL_IMPORT@ @HAVE_PYTHON3_TRUE@$(BUILT_SOURCES): @HAVE_PYTHON3_TRUE@ /bin/cp -f $(top_srcdir)/pysmdev/$@ $@ diff -Nru libsmdev-20171112/setup.py libsmdev-20181227/setup.py --- libsmdev-20171112/setup.py 2017-11-12 14:19:29.000000000 +0000 +++ libsmdev-20181227/setup.py 2018-12-27 14:13:35.000000000 +0000 @@ -1,17 +1,21 @@ #!/usr/bin/env python # # Script to build and install Python-bindings. -# Version: 20171105 +# Version: 20181117 from __future__ import print_function + import glob +import gzip import platform import os import shlex import shutil import subprocess import sys +import tarfile +from distutils import dist from distutils import sysconfig from distutils.ccompiler import new_compiler from distutils.command.build_ext import build_ext @@ -57,18 +61,16 @@ """Runs the command.""" arguments = shlex.split(command) process = subprocess.Popen( - arguments, stderr=subprocess.PIPE, stdout=subprocess.PIPE) + arguments, stderr=subprocess.PIPE, stdout=subprocess.PIPE, + universal_newlines=True) if not process: raise RuntimeError("Running: {0:s} failed.".format(command)) output, error = process.communicate() if process.returncode != 0: - error = "\n".join(error.split(b"\n")[-5:]) - if sys.version_info[0] >= 3: - error = error.decode("ascii", errors="replace") - raise RuntimeError( - "Running: {0:s} failed with error:\n{1:s}.".format( - command, error)) + error = "\n".join(error.split("\n")[-5:]) + raise RuntimeError("Running: {0:s} failed with error:\n{1:s}.".format( + command, error)) return output @@ -86,40 +88,16 @@ ] else: - # We need to run "configure" to make sure config.h is generated - # properly. We invoke "configure" with "sh" here to make sure - # that it works on mingw32 with the standard python.org binaries. - command = "sh configure --help" - output = self._RunCommand(command) - - # We want to build as much as possible self contained Python binding. - configure_arguments = [] - for line in output.split(b"\n"): - line = line.strip() - line, _, _ = line.rpartition(b"[=DIR]") - if line.startswith(b"--with-lib") and not line.endswith(b"-prefix"): - if sys.version_info[0] >= 3: - line = line.decode("ascii") - configure_arguments.append("{0:s}=no".format(line)) - elif line == b"--with-bzip2": - configure_arguments.append("--with-bzip2=no") - elif line == b"--with-openssl": - configure_arguments.append("--with-openssl=no") - elif line == b"--with-zlib": - configure_arguments.append("--with-zlib=no") - - command = "sh configure {0:s}".format(" ".join(configure_arguments)) + command = "sh configure --disable-shared-libs" output = self._RunCommand(command) print_line = False - for line in output.split(b"\n"): + for line in output.split("\n"): line = line.rstrip() - if line == b"configure:": + if line == "configure:": print_line = True if print_line: - if sys.version_info[0] >= 3: - line = line.decode("ascii") print(line) self.define = [ @@ -160,6 +138,24 @@ sdist_package_file = os.path.join("dist", sdist_package_file) os.rename(source_package_file, sdist_package_file) + # Create and add the PKG-INFO file to the source package. + with gzip.open(sdist_package_file, 'rb') as input_file: + with open(sdist_package_file[:-3], 'wb') as output_file: + shutil.copyfileobj(input_file, output_file) + os.remove(sdist_package_file) + + self.distribution.metadata.write_pkg_info(".") + pkg_info_path = "{0:s}-{1:s}/PKG-INFO".format( + source_package_prefix, source_package_suffix[:-7]) + with tarfile.open(sdist_package_file[:-3], "a:") as tar_file: + tar_file.add("PKG-INFO", arcname=pkg_info_path) + os.remove("PKG-INFO") + + with open(sdist_package_file[:-3], 'rb') as input_file: + with gzip.open(sdist_package_file, 'wb') as output_file: + shutil.copyfileobj(input_file, output_file) + os.remove(sdist_package_file[:-3]) + # Inform distutils what files were created. dist_files = getattr(self.distribution, "dist_files", []) dist_files.append(("sdist", "", sdist_package_file)) diff -Nru libsmdev-20171112/smdevtools/byte_size_string.c libsmdev-20181227/smdevtools/byte_size_string.c --- libsmdev-20171112/smdevtools/byte_size_string.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/smdevtools/byte_size_string.c 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * Byte size string functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/smdevtools/byte_size_string.h libsmdev-20181227/smdevtools/byte_size_string.h --- libsmdev-20171112/smdevtools/byte_size_string.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/smdevtools/byte_size_string.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * Byte size string functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/smdevtools/info_handle.c libsmdev-20181227/smdevtools/info_handle.c --- libsmdev-20171112/smdevtools/info_handle.c 2017-11-12 14:20:08.000000000 +0000 +++ libsmdev-20181227/smdevtools/info_handle.c 2018-12-27 14:14:29.000000000 +0000 @@ -1,7 +1,7 @@ /* * Info handle * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/smdevtools/info_handle.h libsmdev-20181227/smdevtools/info_handle.h --- libsmdev-20171112/smdevtools/info_handle.h 2017-11-12 14:20:08.000000000 +0000 +++ libsmdev-20181227/smdevtools/info_handle.h 2018-12-27 14:14:29.000000000 +0000 @@ -1,7 +1,7 @@ /* * Info handle * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/smdevtools/Makefile.in libsmdev-20181227/smdevtools/Makefile.in --- libsmdev-20171112/smdevtools/Makefile.in 2017-11-12 14:33:40.000000000 +0000 +++ libsmdev-20181227/smdevtools/Makefile.in 2018-12-27 19:19:40.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 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, @@ -139,7 +139,12 @@ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/byte_size_string.Po \ + ./$(DEPDIR)/info_handle.Po ./$(DEPDIR)/smdevinfo.Po \ + ./$(DEPDIR)/smdevtools_getopt.Po \ + ./$(DEPDIR)/smdevtools_output.Po \ + ./$(DEPDIR)/smdevtools_signal.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -270,6 +275,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSMDEV_DLL_EXPORT = @LIBSMDEV_DLL_EXPORT@ LIBSMDEV_DLL_IMPORT = @LIBSMDEV_DLL_IMPORT@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -419,7 +425,6 @@ libcthreads_LIBS = @libcthreads_LIBS@ libdir = @libdir@ libexecdir = @libexecdir@ -libsmdev_spec_build_requires = @libsmdev_spec_build_requires@ libsmdev_spec_requires = @libsmdev_spec_requires@ libuna_CFLAGS = @libuna_CFLAGS@ libuna_LIBS = @libuna_LIBS@ @@ -505,8 +510,8 @@ *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) @@ -577,12 +582,18 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/byte_size_string.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/info_handle.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdevinfo.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdevtools_getopt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdevtools_output.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdevtools_signal.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/byte_size_string.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/info_handle.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdevinfo.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdevtools_getopt.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdevtools_output.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdevtools_signal.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -663,7 +674,10 @@ 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)'; \ @@ -779,7 +793,12 @@ installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/byte_size_string.Po + -rm -f ./$(DEPDIR)/info_handle.Po + -rm -f ./$(DEPDIR)/smdevinfo.Po + -rm -f ./$(DEPDIR)/smdevtools_getopt.Po + -rm -f ./$(DEPDIR)/smdevtools_output.Po + -rm -f ./$(DEPDIR)/smdevtools_signal.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -800,7 +819,7 @@ .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ diff -Nru libsmdev-20171112/smdevtools/smdevinfo.c libsmdev-20181227/smdevtools/smdevinfo.c --- libsmdev-20171112/smdevtools/smdevinfo.c 2017-11-12 14:20:08.000000000 +0000 +++ libsmdev-20181227/smdevtools/smdevinfo.c 2018-12-27 14:14:29.000000000 +0000 @@ -1,7 +1,7 @@ /* * Shows information obtained from storage media (SM) devices * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -25,6 +25,12 @@ #include #include +#include + +#if defined( HAVE_IO_H ) || defined( WINAPI ) +#include +#endif + #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif @@ -33,10 +39,6 @@ #include #endif -#if defined( HAVE_IO_H ) || defined( WINAPI ) -#include -#endif - #include "info_handle.h" #include "smdevtools_getopt.h" #include "smdevtools_libcerror.h" @@ -309,7 +311,7 @@ { fprintf( stdout, - "%" PRIs_SYSTEM ": ABORTED\n", + "%s: ABORTED\n", program ); return( EXIT_FAILURE ); diff -Nru libsmdev-20171112/smdevtools/smdevtools_getopt.c libsmdev-20181227/smdevtools/smdevtools_getopt.c --- libsmdev-20171112/smdevtools/smdevtools_getopt.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/smdevtools/smdevtools_getopt.c 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * GetOpt functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -47,6 +47,10 @@ */ system_integer_t optopt = 0; +/* The next option in a group + */ +system_character_t *next_option = NULL; + /* Get the program options * Function for platforms that do not have the getopt function * Returns the option character processed, or -1 on error, @@ -62,33 +66,41 @@ static char *function = "smdevtools_getopt"; size_t options_string_length = 0; - if( optind >= argument_count ) + if( next_option != NULL ) { - return( (system_integer_t) -1 ); + argument_value = next_option; + next_option = NULL; } - argument_value = argument_values[ optind ]; - - /* Check if the argument value is not an empty string - */ - if( *argument_value == 0 ) + else if( optind >= argument_count ) { return( (system_integer_t) -1 ); } - /* Check if the first character is a option marker '-' - */ - if( *argument_value != (system_character_t) '-' ) + else { - return( (system_integer_t) -1 ); - } - argument_value++; + argument_value = argument_values[ optind ]; - /* Check if long options are provided '--' - */ - if( *argument_value == (system_character_t) '-' ) - { - optind++; + /* Check if the argument value is not an empty string + */ + if( *argument_value == (system_character_t) '\0' ) + { + return( (system_integer_t) -1 ); + } + /* Check if the first character is a option marker '-' + */ + if( *argument_value != (system_character_t) '-' ) + { + return( (system_integer_t) -1 ); + } + argument_value++; - return( (system_integer_t) -1 ); + /* Check if long options are provided '--' + */ + if( *argument_value == (system_character_t) '-' ) + { + optind++; + + return( (system_integer_t) -1 ); + } } options_string_length = system_string_length( options_string ); @@ -133,6 +145,12 @@ { optind++; } + else + { + /* Multiple options are grouped + */ + next_option = argument_value; + } } /* Check if the argument is right after the option flag with no space in between */ diff -Nru libsmdev-20171112/smdevtools/smdevtools_getopt.h libsmdev-20181227/smdevtools/smdevtools_getopt.h --- libsmdev-20171112/smdevtools/smdevtools_getopt.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/smdevtools/smdevtools_getopt.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * GetOpt functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/smdevtools/smdevtools_i18n.h libsmdev-20181227/smdevtools/smdevtools_i18n.h --- libsmdev-20171112/smdevtools/smdevtools_i18n.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/smdevtools/smdevtools_i18n.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * Internationalization (i18n) functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/smdevtools/smdevtools_libbfio.h libsmdev-20181227/smdevtools/smdevtools_libbfio.h --- libsmdev-20171112/smdevtools/smdevtools_libbfio.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/smdevtools/smdevtools_libbfio.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * The libbfio header wrapper * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/smdevtools/smdevtools_libcerror.h libsmdev-20181227/smdevtools/smdevtools_libcerror.h --- libsmdev-20171112/smdevtools/smdevtools_libcerror.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/smdevtools/smdevtools_libcerror.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* - * The internal libcerror header + * The libcerror header wrapper * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/smdevtools/smdevtools_libclocale.h libsmdev-20181227/smdevtools/smdevtools_libclocale.h --- libsmdev-20171112/smdevtools/smdevtools_libclocale.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/smdevtools/smdevtools_libclocale.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* - * The internal libclocale header + * The libclocale header wrapper * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/smdevtools/smdevtools_libcnotify.h libsmdev-20181227/smdevtools/smdevtools_libcnotify.h --- libsmdev-20171112/smdevtools/smdevtools_libcnotify.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/smdevtools/smdevtools_libcnotify.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* - * The internal libcnotify header + * The libcnotify header wrapper * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/smdevtools/smdevtools_libsmdev.h libsmdev-20181227/smdevtools/smdevtools_libsmdev.h --- libsmdev-20171112/smdevtools/smdevtools_libsmdev.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/smdevtools/smdevtools_libsmdev.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* - * The internal libsmdev header + * The libsmdev header wrapper * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -24,13 +24,6 @@ #include -/* If Cygwin libtool DLL support is enabled set LIBSMDEV_DLL_IMPORT - * before including libsmdev.h - */ -#if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) -#define LIBSMDEV_DLL_IMPORT -#endif - #include #endif /* !defined( _SMDEVTOOLS_LIBSMDEV_H ) */ diff -Nru libsmdev-20171112/smdevtools/smdevtools_libuna.h libsmdev-20181227/smdevtools/smdevtools_libuna.h --- libsmdev-20171112/smdevtools/smdevtools_libuna.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/smdevtools/smdevtools_libuna.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * The libuna header wrapper * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/smdevtools/smdevtools_output.c libsmdev-20181227/smdevtools/smdevtools_output.c --- libsmdev-20171112/smdevtools/smdevtools_output.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/smdevtools/smdevtools_output.c 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * Common output functions for the smdevtools * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -103,7 +103,7 @@ */ fprintf( stream, - _( "Copyright (C) 2010-2017, %s.\n" ), + _( "Copyright (C) 2010-2018, %s.\n" ), _( "Joachim Metz" ) ); fprintf( diff -Nru libsmdev-20171112/smdevtools/smdevtools_output.h libsmdev-20181227/smdevtools/smdevtools_output.h --- libsmdev-20171112/smdevtools/smdevtools_output.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/smdevtools/smdevtools_output.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * Common output functions for the smdevtools * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/smdevtools/smdevtools_signal.c libsmdev-20181227/smdevtools/smdevtools_signal.c --- libsmdev-20171112/smdevtools/smdevtools_signal.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/smdevtools/smdevtools_signal.c 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * Signal handling functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/smdevtools/smdevtools_signal.h libsmdev-20181227/smdevtools/smdevtools_signal.h --- libsmdev-20171112/smdevtools/smdevtools_signal.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/smdevtools/smdevtools_signal.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * Signal handling functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/smdevtools/smdevtools_unused.h libsmdev-20181227/smdevtools/smdevtools_unused.h --- libsmdev-20171112/smdevtools/smdevtools_unused.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/smdevtools/smdevtools_unused.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * The unused definition * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/test-driver libsmdev-20181227/test-driver --- libsmdev-20171112/test-driver 2017-11-12 14:33:40.000000000 +0000 +++ libsmdev-20181227/test-driver 2018-12-27 19:19:40.000000000 +0000 @@ -1,9 +1,9 @@ #! /bin/sh # test-driver - basic testsuite driver script. -scriptversion=2013-07-13.22; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 2011-2014 Free Software Foundation, Inc. +# Copyright (C) 2011-2018 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -140,9 +140,9 @@ # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff -Nru libsmdev-20171112/tests/Makefile.am libsmdev-20181227/tests/Makefile.am --- libsmdev-20171112/tests/Makefile.am 2017-11-12 14:33:05.000000000 +0000 +++ libsmdev-20181227/tests/Makefile.am 2018-12-27 14:14:29.000000000 +0000 @@ -73,13 +73,15 @@ @PTHREAD_LIBADD@ smdev_test_notify_SOURCES = \ + smdev_test_libcerror.h \ smdev_test_libsmdev.h \ smdev_test_macros.h \ smdev_test_notify.c \ smdev_test_unused.h smdev_test_notify_LDADD = \ - ../libsmdev/libsmdev.la + ../libsmdev/libsmdev.la \ + @LIBCERROR_LIBADD@ smdev_test_sector_range_SOURCES = \ smdev_test_libcerror.h \ diff -Nru libsmdev-20171112/tests/Makefile.in libsmdev-20181227/tests/Makefile.in --- libsmdev-20171112/tests/Makefile.in 2017-11-12 14:33:40.000000000 +0000 +++ libsmdev-20181227/tests/Makefile.in 2018-12-27 19:19:40.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 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, @@ -155,7 +155,16 @@ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/common depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/smdev_test_error.Po \ + ./$(DEPDIR)/smdev_test_functions.Po \ + ./$(DEPDIR)/smdev_test_getopt.Po \ + ./$(DEPDIR)/smdev_test_handle.Po \ + ./$(DEPDIR)/smdev_test_memory.Po \ + ./$(DEPDIR)/smdev_test_notify.Po \ + ./$(DEPDIR)/smdev_test_sector_range.Po \ + ./$(DEPDIR)/smdev_test_support.Po \ + ./$(DEPDIR)/smdev_test_track_value.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -499,6 +508,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSMDEV_DLL_EXPORT = @LIBSMDEV_DLL_EXPORT@ LIBSMDEV_DLL_IMPORT = @LIBSMDEV_DLL_IMPORT@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -648,7 +658,6 @@ libcthreads_LIBS = @libcthreads_LIBS@ libdir = @libdir@ libexecdir = @libexecdir@ -libsmdev_spec_build_requires = @libsmdev_spec_build_requires@ libsmdev_spec_requires = @libsmdev_spec_requires@ libuna_CFLAGS = @libuna_CFLAGS@ libuna_LIBS = @libuna_LIBS@ @@ -740,13 +749,15 @@ @PTHREAD_LIBADD@ smdev_test_notify_SOURCES = \ + smdev_test_libcerror.h \ smdev_test_libsmdev.h \ smdev_test_macros.h \ smdev_test_notify.c \ smdev_test_unused.h smdev_test_notify_LDADD = \ - ../libsmdev/libsmdev.la + ../libsmdev/libsmdev.la \ + @LIBCERROR_LIBADD@ smdev_test_sector_range_SOURCES = \ smdev_test_libcerror.h \ @@ -807,8 +818,8 @@ *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) @@ -859,15 +870,21 @@ distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdev_test_error.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdev_test_functions.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdev_test_getopt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdev_test_handle.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdev_test_memory.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdev_test_notify.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdev_test_sector_range.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdev_test_support.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdev_test_track_value.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdev_test_error.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdev_test_functions.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdev_test_getopt.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdev_test_handle.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdev_test_memory.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdev_test_notify.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdev_test_sector_range.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdev_test_support.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smdev_test_track_value.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -1068,7 +1085,7 @@ fi; \ $$success || exit 1 -check-TESTS: +check-TESTS: $(check_PROGRAMS) $(check_SCRIPTS) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @@ -1125,7 +1142,10 @@ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) -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)'; \ @@ -1244,7 +1264,15 @@ installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/smdev_test_error.Po + -rm -f ./$(DEPDIR)/smdev_test_functions.Po + -rm -f ./$(DEPDIR)/smdev_test_getopt.Po + -rm -f ./$(DEPDIR)/smdev_test_handle.Po + -rm -f ./$(DEPDIR)/smdev_test_memory.Po + -rm -f ./$(DEPDIR)/smdev_test_notify.Po + -rm -f ./$(DEPDIR)/smdev_test_sector_range.Po + -rm -f ./$(DEPDIR)/smdev_test_support.Po + -rm -f ./$(DEPDIR)/smdev_test_track_value.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -1265,16 +1293,16 @@ .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ - clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ - ctags ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ + check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am diff -Nru libsmdev-20171112/tests/pysmdev_test_handle.py libsmdev-20181227/tests/pysmdev_test_handle.py --- libsmdev-20171112/tests/pysmdev_test_handle.py 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/pysmdev_test_handle.py 2018-12-27 14:14:29.000000000 +0000 @@ -2,7 +2,7 @@ # # Python-bindings handle type test script # -# Copyright (C) 2010-2017, Joachim Metz +# Copyright (C) 2010-2018, Joachim Metz # # Refer to AUTHORS for acknowledgements. # diff -Nru libsmdev-20171112/tests/pysmdev_test_support.py libsmdev-20181227/tests/pysmdev_test_support.py --- libsmdev-20171112/tests/pysmdev_test_support.py 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/pysmdev_test_support.py 2018-12-27 14:12:59.000000000 +0000 @@ -2,7 +2,7 @@ # # Python-bindings support functions test script # -# Copyright (C) 2010-2017, Joachim Metz +# Copyright (C) 2010-2018, Joachim Metz # # Refer to AUTHORS for acknowledgements. # diff -Nru libsmdev-20171112/tests/smdev_test_error.c libsmdev-20181227/tests/smdev_test_error.c --- libsmdev-20171112/tests/smdev_test_error.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/smdev_test_error.c 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * Library error functions test program * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/tests/smdev_test_functions.c libsmdev-20181227/tests/smdev_test_functions.c --- libsmdev-20171112/tests/smdev_test_functions.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/smdev_test_functions.c 2018-12-27 14:14:29.000000000 +0000 @@ -1,7 +1,7 @@ /* * Functions for testing * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/tests/smdev_test_functions.h libsmdev-20181227/tests/smdev_test_functions.h --- libsmdev-20171112/tests/smdev_test_functions.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/smdev_test_functions.h 2018-12-27 14:18:24.000000000 +0000 @@ -1,7 +1,7 @@ /* * Functions for testing * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/tests/smdev_test_getopt.c libsmdev-20181227/tests/smdev_test_getopt.c --- libsmdev-20171112/tests/smdev_test_getopt.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/smdev_test_getopt.c 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * GetOpt functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -47,6 +47,10 @@ */ system_integer_t optopt = 0; +/* The next option in a group + */ +system_character_t *next_option = NULL; + /* Get the program options * Function for platforms that do not have the getopt function * Returns the option character processed, or -1 on error, @@ -62,33 +66,41 @@ static char *function = "smdev_test_getopt"; size_t options_string_length = 0; - if( optind >= argument_count ) + if( next_option != NULL ) { - return( (system_integer_t) -1 ); + argument_value = next_option; + next_option = NULL; } - argument_value = argument_values[ optind ]; - - /* Check if the argument value is not an empty string - */ - if( *argument_value == 0 ) + else if( optind >= argument_count ) { return( (system_integer_t) -1 ); } - /* Check if the first character is a option marker '-' - */ - if( *argument_value != (system_character_t) '-' ) + else { - return( (system_integer_t) -1 ); - } - argument_value++; + argument_value = argument_values[ optind ]; - /* Check if long options are provided '--' - */ - if( *argument_value == (system_character_t) '-' ) - { - optind++; + /* Check if the argument value is not an empty string + */ + if( *argument_value == (system_character_t) '\0' ) + { + return( (system_integer_t) -1 ); + } + /* Check if the first character is a option marker '-' + */ + if( *argument_value != (system_character_t) '-' ) + { + return( (system_integer_t) -1 ); + } + argument_value++; - return( (system_integer_t) -1 ); + /* Check if long options are provided '--' + */ + if( *argument_value == (system_character_t) '-' ) + { + optind++; + + return( (system_integer_t) -1 ); + } } options_string_length = system_string_length( options_string ); @@ -133,6 +145,12 @@ { optind++; } + else + { + /* Multiple options are grouped + */ + next_option = argument_value; + } } /* Check if the argument is right after the option flag with no space in between */ diff -Nru libsmdev-20171112/tests/smdev_test_getopt.h libsmdev-20181227/tests/smdev_test_getopt.h --- libsmdev-20171112/tests/smdev_test_getopt.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/smdev_test_getopt.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * GetOpt functions * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/tests/smdev_test_handle.c libsmdev-20181227/tests/smdev_test_handle.c --- libsmdev-20171112/tests/smdev_test_handle.c 2017-11-12 14:20:18.000000000 +0000 +++ libsmdev-20181227/tests/smdev_test_handle.c 2018-12-27 14:14:29.000000000 +0000 @@ -1,7 +1,7 @@ /* * Library handle type test program * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/tests/smdev_test_libcerror.h libsmdev-20181227/tests/smdev_test_libcerror.h --- libsmdev-20171112/tests/smdev_test_libcerror.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/smdev_test_libcerror.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* - * The internal libcerror header + * The libcerror header wrapper * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/tests/smdev_test_libclocale.h libsmdev-20181227/tests/smdev_test_libclocale.h --- libsmdev-20171112/tests/smdev_test_libclocale.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/smdev_test_libclocale.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* - * The internal libclocale header + * The libclocale header wrapper * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/tests/smdev_test_libcnotify.h libsmdev-20181227/tests/smdev_test_libcnotify.h --- libsmdev-20171112/tests/smdev_test_libcnotify.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/smdev_test_libcnotify.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* - * The internal libcnotify header + * The libcnotify header wrapper * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/tests/smdev_test_libsmdev.h libsmdev-20181227/tests/smdev_test_libsmdev.h --- libsmdev-20171112/tests/smdev_test_libsmdev.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/smdev_test_libsmdev.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* - * The internal libsmdev header + * The libsmdev header wrapper * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -24,13 +24,6 @@ #include -/* If Cygwin libtool DLL support is enabled and do not want to create static - * executables set LIBSMDEV_DLL_IMPORT before including libsmdev.h - */ -#if defined( _WIN32 ) && defined( DLL_EXPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) -#define LIBSMDEV_DLL_IMPORT -#endif - #include #endif /* !defined( _SMDEV_TEST_LIBSMDEV_H ) */ diff -Nru libsmdev-20171112/tests/smdev_test_libuna.h libsmdev-20181227/tests/smdev_test_libuna.h --- libsmdev-20171112/tests/smdev_test_libuna.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/smdev_test_libuna.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * The libuna header wrapper * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/tests/smdev_test_macros.h libsmdev-20181227/tests/smdev_test_macros.h --- libsmdev-20171112/tests/smdev_test_macros.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/smdev_test_macros.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * Macros for testing * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -57,6 +57,34 @@ goto on_error; \ } +#define SMDEV_TEST_ASSERT_EQUAL_INTPTR( name, value, expected_value ) \ + if( value != expected_value ) \ + { \ + fprintf( stdout, "%s:%d %s (0x%08x" PRIjx ") != 0x%08x" PRIjx "\n", __FILE__, __LINE__, name, value, expected_value ); \ + goto on_error; \ + } + +#define SMDEV_TEST_ASSERT_NOT_EQUAL_INTPTR( name, value, expected_value ) \ + if( value == expected_value ) \ + { \ + fprintf( stdout, "%s:%d %s (0x%08x" PRIjx ") == 0x%08x" PRIjx "\n", __FILE__, __LINE__, name, value, expected_value ); \ + goto on_error; \ + } + +#define SMDEV_TEST_ASSERT_EQUAL_FLOAT( name, value, expected_value ) \ + if( value != expected_value ) \ + { \ + fprintf( stdout, "%s:%d %s (%f) != %f\n", __FILE__, __LINE__, name, value, expected_value ); \ + goto on_error; \ + } + +#define SMDEV_TEST_ASSERT_NOT_EQUAL_FLOAT( name, value, expected_value ) \ + if( value == expected_value ) \ + { \ + fprintf( stdout, "%s:%d %s (%f) == %f\n", __FILE__, __LINE__, name, value, expected_value ); \ + goto on_error; \ + } + #define SMDEV_TEST_ASSERT_EQUAL_SIZE( name, value, expected_value ) \ if( value != expected_value ) \ { \ diff -Nru libsmdev-20171112/tests/smdev_test_memory.c libsmdev-20181227/tests/smdev_test_memory.c --- libsmdev-20171112/tests/smdev_test_memory.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/smdev_test_memory.c 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * Memory allocation functions for testing * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/tests/smdev_test_memory.h libsmdev-20181227/tests/smdev_test_memory.h --- libsmdev-20171112/tests/smdev_test_memory.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/smdev_test_memory.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * Memory allocation functions for testing * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/tests/smdev_test_notify.c libsmdev-20181227/tests/smdev_test_notify.c --- libsmdev-20171112/tests/smdev_test_notify.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/smdev_test_notify.c 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * Library notification functions test program * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * @@ -27,6 +27,7 @@ #include #endif +#include "smdev_test_libcerror.h" #include "smdev_test_libsmdev.h" #include "smdev_test_macros.h" #include "smdev_test_unused.h" @@ -51,13 +52,37 @@ int smdev_test_notify_set_stream( void ) { - /* Test invocation of function only + libcerror_error_t *error = NULL; + int result = 0; + + /* Test regular cases + */ + result = libsmdev_notify_set_stream( + NULL, + &error ); + + SMDEV_TEST_ASSERT_EQUAL_INT( + "result", + result, + 1 ); + + SMDEV_TEST_ASSERT_IS_NULL( + "error", + error ); + + /* Test error cases */ - libsmdev_notify_set_stream( - NULL, - NULL ); +/* TODO test libcnotify_stream_set failure */ return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); } /* Tests the libsmdev_notify_stream_open function @@ -66,13 +91,65 @@ int smdev_test_notify_stream_open( void ) { - /* Test invocation of function only + libcerror_error_t *error = NULL; + int result = 0; + + /* Test regular cases + */ + result = libsmdev_notify_stream_open( + "notify_stream.log", + &error ); + + SMDEV_TEST_ASSERT_EQUAL_INT( + "result", + result, + 1 ); + + SMDEV_TEST_ASSERT_IS_NULL( + "error", + error ); + + /* Test error cases + */ + result = libsmdev_notify_stream_open( + NULL, + &error ); + + SMDEV_TEST_ASSERT_EQUAL_INT( + "result", + result, + -1 ); + + SMDEV_TEST_ASSERT_IS_NOT_NULL( + "error", + error ); + + libcerror_error_free( + &error ); + + /* Clean up */ - libsmdev_notify_stream_open( - NULL, - NULL ); + result = libsmdev_notify_stream_close( + &error ); + + SMDEV_TEST_ASSERT_EQUAL_INT( + "result", + result, + 0 ); + + SMDEV_TEST_ASSERT_IS_NULL( + "error", + error ); return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); } /* Tests the libsmdev_notify_stream_close function @@ -81,12 +158,36 @@ int smdev_test_notify_stream_close( void ) { - /* Test invocation of function only + libcerror_error_t *error = NULL; + int result = 0; + + /* Test regular cases */ - libsmdev_notify_stream_close( - NULL ); + result = libsmdev_notify_stream_close( + &error ); + + SMDEV_TEST_ASSERT_EQUAL_INT( + "result", + result, + 0 ); + + SMDEV_TEST_ASSERT_IS_NULL( + "error", + error ); + + /* Test error cases + */ +/* TODO test libcnotify_stream_close failure */ return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); } /* The main program diff -Nru libsmdev-20171112/tests/smdev_test_sector_range.c libsmdev-20181227/tests/smdev_test_sector_range.c --- libsmdev-20171112/tests/smdev_test_sector_range.c 2017-11-12 14:20:18.000000000 +0000 +++ libsmdev-20181227/tests/smdev_test_sector_range.c 2018-12-27 14:14:29.000000000 +0000 @@ -1,7 +1,7 @@ /* * Library sector_range type test program * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/tests/smdev_test_support.c libsmdev-20181227/tests/smdev_test_support.c --- libsmdev-20171112/tests/smdev_test_support.c 2017-11-12 14:20:18.000000000 +0000 +++ libsmdev-20181227/tests/smdev_test_support.c 2018-12-27 14:14:29.000000000 +0000 @@ -1,7 +1,7 @@ /* * Library support functions test program * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/tests/smdev_test_track_value.c libsmdev-20181227/tests/smdev_test_track_value.c --- libsmdev-20171112/tests/smdev_test_track_value.c 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/smdev_test_track_value.c 2018-12-27 14:14:29.000000000 +0000 @@ -1,7 +1,7 @@ /* * Library track_value type test program * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/tests/smdev_test_unused.h libsmdev-20181227/tests/smdev_test_unused.h --- libsmdev-20171112/tests/smdev_test_unused.h 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/smdev_test_unused.h 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ /* * The unused definition * - * Copyright (C) 2010-2017, Joachim Metz + * Copyright (C) 2010-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff -Nru libsmdev-20171112/tests/test_library.sh libsmdev-20181227/tests/test_library.sh --- libsmdev-20171112/tests/test_library.sh 2017-11-12 14:20:24.000000000 +0000 +++ libsmdev-20181227/tests/test_library.sh 2018-12-27 14:18:47.000000000 +0000 @@ -1,7 +1,7 @@ #!/bin/bash # Tests C library functions and types. # -# Version: 20170722 +# Version: 20181221 EXIT_SUCCESS=0; EXIT_FAILURE=1; @@ -44,8 +44,87 @@ TEST_EXECUTABLE="${TEST_EXECUTABLE}.exe"; fi - run_test_on_input_directory "libsmdev" "${TEST_DESCRIPTION}" "default" "${OPTION_SETS}" "${TEST_EXECUTABLE}" "input" "${INPUT_GLOB}"; - local RESULT=$?; + if ! test -d "input"; + then + echo "Test input directory: input not found."; + + return ${EXIT_IGNORE}; + fi + local RESULT=`ls input/* | tr ' ' '\n' | wc -l`; + + if test ${RESULT} -eq ${EXIT_SUCCESS}; + then + echo "No files or directories found in the test input directory: input"; + + return ${EXIT_IGNORE}; + fi + + local TEST_PROFILE_DIRECTORY=$(get_test_profile_directory "input" "libsmdev"); + + local IGNORE_LIST=$(read_ignore_list "${TEST_PROFILE_DIRECTORY}"); + + RESULT=${EXIT_SUCCESS}; + + for TEST_SET_INPUT_DIRECTORY in input/*; + do + if ! test -d "${TEST_SET_INPUT_DIRECTORY}"; + then + continue; + fi + if check_for_directory_in_ignore_list "${TEST_SET_INPUT_DIRECTORY}" "${IGNORE_LIST}"; + then + continue; + fi + + local TEST_SET_DIRECTORY=$(get_test_set_directory "${TEST_PROFILE_DIRECTORY}" "${TEST_SET_INPUT_DIRECTORY}"); + + local OLDIFS=${IFS}; + + # IFS="\n" is not supported by all platforms. + IFS=" +"; + + if test -f "${TEST_SET_DIRECTORY}/files"; + then + for INPUT_FILE in `cat ${TEST_SET_DIRECTORY}/files | sed "s?^?${TEST_SET_INPUT_DIRECTORY}/?"`; + do + if test "${OSTYPE}" = "msys"; + then + # A test executable built with MinGW expects a Windows path. + INPUT_FILE=`echo ${INPUT_FILE} | sed 's?/?\\\\?g'`; + fi + run_test_on_input_file_with_options "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "${OPTION_SETS}" "${TEST_EXECUTABLE}" "${INPUT_FILE}"; + RESULT=$?; + + if test ${RESULT} -ne ${EXIT_SUCCESS}; + then + break; + fi + done + else + for INPUT_FILE in `ls -1 ${TEST_SET_INPUT_DIRECTORY}/${INPUT_GLOB}`; + do + if test "${OSTYPE}" = "msys"; + then + # A test executable built with MinGW expects a Windows path. + INPUT_FILE=`echo ${INPUT_FILE} | sed 's?/?\\\\?g'`; + fi + run_test_on_input_file_with_options "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "${OPTION_SETS}" "${TEST_EXECUTABLE}" "${INPUT_FILE}"; + RESULT=$?; + + if test ${RESULT} -ne ${EXIT_SUCCESS}; + then + break; + fi + done + fi + IFS=${OLDIFS}; + + if test ${RESULT} -ne ${EXIT_SUCCESS}; + then + break; + fi + done return ${RESULT}; } diff -Nru libsmdev-20171112/tests/test_python_module.sh libsmdev-20181227/tests/test_python_module.sh --- libsmdev-20171112/tests/test_python_module.sh 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/test_python_module.sh 2018-12-27 14:12:58.000000000 +0000 @@ -1,7 +1,7 @@ #!/bin/bash # Tests Python module functions and types. # -# Version: 20170722 +# Version: 20181221 EXIT_SUCCESS=0; EXIT_FAILURE=1; @@ -34,8 +34,77 @@ local TEST_DESCRIPTION="Testing Python-bindings functions: ${TEST_FUNCTION}"; local TEST_SCRIPT="${TEST_TOOL_DIRECTORY}/pysmdev_test_${TEST_FUNCTION}.py"; - run_test_on_input_directory "pysmdev" "${TEST_DESCRIPTION}" "default" "${OPTION_SETS}" "${TEST_SCRIPT}" "input" "${INPUT_GLOB}"; - local RESULT=$?; + if ! test -d "input"; + then + echo "Test input directory: input not found."; + + return ${EXIT_IGNORE}; + fi + local RESULT=`ls input/* | tr ' ' '\n' | wc -l`; + + if test ${RESULT} -eq ${EXIT_SUCCESS}; + then + echo "No files or directories found in the test input directory: input"; + + return ${EXIT_IGNORE}; + fi + + local TEST_PROFILE_DIRECTORY=$(get_test_profile_directory "input" "pysmdev"); + + local IGNORE_LIST=$(read_ignore_list "${TEST_PROFILE_DIRECTORY}"); + + RESULT=${EXIT_SUCCESS}; + + for TEST_SET_INPUT_DIRECTORY in input/*; + do + if ! test -d "${TEST_SET_INPUT_DIRECTORY}"; + then + continue; + fi + if check_for_directory_in_ignore_list "${TEST_SET_INPUT_DIRECTORY}" "${IGNORE_LIST}"; + then + continue; + fi + + local TEST_SET_DIRECTORY=$(get_test_set_directory "${TEST_PROFILE_DIRECTORY}" "${TEST_SET_INPUT_DIRECTORY}"); + + local OLDIFS=${IFS}; + + # IFS="\n"; is not supported by all platforms. + IFS=" +"; + + if test -f "${TEST_SET_DIRECTORY}/files"; + then + for INPUT_FILE in `cat ${TEST_SET_DIRECTORY}/files | sed "s?^?${TEST_SET_INPUT_DIRECTORY}/?"`; + do + run_test_on_input_file_with_options "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "${OPTION_SETS}" "${TEST_SCRIPT}" "${INPUT_FILE}"; + RESULT=$?; + + if test ${RESULT} -ne ${EXIT_SUCCESS}; + then + break; + fi + done + else + for INPUT_FILE in `ls -1 ${TEST_SET_INPUT_DIRECTORY}/${INPUT_GLOB}`; + do + run_test_on_input_file_with_options "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "${OPTION_SETS}" "${TEST_SCRIPT}" "${INPUT_FILE}"; + RESULT=$?; + + if test ${RESULT} -ne ${EXIT_SUCCESS}; + then + break; + fi + done + fi + IFS=${OLDIFS}; + + if test ${RESULT} -ne ${EXIT_SUCCESS}; + then + break; + fi + done return ${RESULT}; } @@ -81,8 +150,14 @@ for TEST_FUNCTION in ${TEST_FUNCTIONS_WITH_INPUT}; do - test_python_function_with_input "${TEST_FUNCTION}"; - RESULT=$?; + if test -d "input"; + then + test_python_function_with_input "${TEST_FUNCTION}"; + RESULT=$?; + else + test_python_function "${TEST_FUNCTION}"; + RESULT=$?; + fi if test ${RESULT} -ne ${EXIT_SUCCESS}; then diff -Nru libsmdev-20171112/tests/test_runner.sh libsmdev-20181227/tests/test_runner.sh --- libsmdev-20171112/tests/test_runner.sh 2017-11-12 14:19:28.000000000 +0000 +++ libsmdev-20181227/tests/test_runner.sh 2018-12-27 14:12:59.000000000 +0000 @@ -1,7 +1,7 @@ #!/bin/bash # Bash functions to run an executable for testing. # -# Version: 20170827 +# Version: 20180929 # # When CHECK_WITH_ASAN is set to a non-empty value the test executable # is run with asan, otherwise it is run without. @@ -82,7 +82,7 @@ check_for_directory_in_ignore_list() { local INPUT_DIRECTORY=$1; - local IGNORE_LIST=$@; + local IGNORE_LIST=$2; local INPUT_BASENAME=`basename ${INPUT_DIRECTORY}`; @@ -388,7 +388,7 @@ local TEST_DESCRIPTION=$1; local TEST_EXECUTABLE=$2; shift 2; - local ARGUMENTS=$@; + local ARGUMENTS=("$@"); if ! test -f "${TEST_EXECUTABLE}"; then @@ -468,7 +468,7 @@ exit ${EXIT_FAILURE}; fi - LIBASAN=`${LDCONFIG} -p | grep libasan | sed 's/^.* => //'`; + LIBASAN=`${LDCONFIG} -p | grep libasan | sed 's/^.* => //' | sort | tail -n 1`; if ! test -f ${LIBASAN}; then @@ -708,7 +708,7 @@ local TEST_EXECUTABLE=$1; local INPUT_FILE=$2; shift 2; - local ARGUMENTS=$@; + local ARGUMENTS=("$@"); if ! test -f "${TEST_EXECUTABLE}"; then @@ -789,7 +789,7 @@ exit ${EXIT_FAILURE}; fi - LIBASAN=`${LDCONFIG} -p | grep libasan | sed 's/^.* => //'`; + LIBASAN=`${LDCONFIG} -p | grep libasan | sed 's/^.* => //' | sort | tail -n 1`; if ! test -f ${LIBASAN}; then @@ -1022,7 +1022,7 @@ local TEST_EXECUTABLE=$5; local INPUT_FILE=$6; shift 6; - local ARGUMENTS=$@; + local ARGUMENTS=("$@"); local INPUT_NAME=`basename "${INPUT_FILE}"`; local OPTIONS=(); @@ -1044,7 +1044,7 @@ if test "${TEST_MODE}" = "with_callback"; then - test_callback "${TMPDIR}" "${TEST_SET_DIRECTORY}" "${TEST_OUTPUT}" "${TEST_EXECUTABLE}" "${TEST_INPUT}" ${ARGUMENTS[@]} ${OPTIONS[@]}; + test_callback "${TMPDIR}" "${TEST_SET_DIRECTORY}" "${TEST_OUTPUT}" "${TEST_EXECUTABLE}" "${TEST_INPUT}" ${ARGUMENTS[@]} "${OPTIONS[@]}"; RESULT=$?; elif test "${TEST_MODE}" = "with_stdout_reference"; @@ -1061,7 +1061,7 @@ local INPUT_FILE_FULL_PATH=$( readlink_f "${INPUT_FILE}" ); local TEST_LOG="${TEST_OUTPUT}.log"; - (cd ${TMPDIR} && run_test_with_input_and_arguments "${TEST_EXECUTABLE}" "${INPUT_FILE_FULL_PATH}" ${ARGUMENTS[@]} ${OPTIONS[@]} | sed '1,2d' > "${TEST_LOG}"); + (cd ${TMPDIR} && run_test_with_input_and_arguments "${TEST_EXECUTABLE}" "${INPUT_FILE_FULL_PATH}" ${ARGUMENTS[@]} "${OPTIONS[@]}" | sed '1,2d' > "${TEST_LOG}"); RESULT=$?; local TEST_RESULTS="${TMPDIR}/${TEST_LOG}"; @@ -1080,7 +1080,7 @@ fi else - run_test_with_input_and_arguments "${TEST_EXECUTABLE}" "${INPUT_FILE}" ${ARGUMENTS[@]} ${OPTIONS[@]}; + run_test_with_input_and_arguments "${TEST_EXECUTABLE}" "${INPUT_FILE}" ${ARGUMENTS[@]} "${OPTIONS[@]}"; RESULT=$?; fi @@ -1088,11 +1088,13 @@ if test -n "${TEST_DESCRIPTION}"; then - if test -z "${OPTION_SET}"; + OPTIONS=`echo "${OPTIONS[*]}" | tr '\n' ' ' | sed 's/[ ]\$//'`; + + if test -z "${OPTIONS}"; then echo -n "${TEST_DESCRIPTION} with input: ${INPUT_FILE}"; else - echo -n "${TEST_DESCRIPTION} with option: ${OPTION_SET} and input: ${INPUT_FILE}"; + echo -n "${TEST_DESCRIPTION} with options: '${OPTIONS}' and input: ${INPUT_FILE}"; fi if test ${RESULT} -ne ${EXIT_SUCCESS}; @@ -1131,7 +1133,7 @@ local TEST_EXECUTABLE=$5; local INPUT_FILE=$6; shift 6; - local ARGUMENTS=$@; + local ARGUMENTS=("$@"); local RESULT=${EXIT_SUCCESS}; local TESTED_WITH_OPTIONS=0; @@ -1163,122 +1165,3 @@ return ${RESULT}; } -# Runs the test on the input directory. -# -# Arguments: -# a string containing the name of the test profile -# a string containing the description of the test -# a string containing the test mode, supported tests modes are: -# default: the test executable should be be run without any test -# conditions. -# with_callback: the test executable should be run and the callback -# function should be called afterwards. The name of the -# callback function is "test_callback". -# with_stdout_reference: the test executable should be run and its output -# to stdout, except for the first 2 lines, should -# be compared to a reference file, if available. -# Note the globals override the test mode. -# a string containing the name of the option sets -# a string containing the path of the test executable -# a string containing the path of the test input directory -# a string containing the input glob -# an array containing the arguments for the test executable -# -# Returns: -# an integer containg the exit status of the test executable -# -run_test_on_input_directory() -{ - local TEST_PROFILE=$1; - local TEST_DESCRIPTION=$2; - local TEST_MODE=$3; - local OPTION_SETS=$4; - local TEST_EXECUTABLE=$5; - local TEST_INPUT_DIRECTORY=$6; - local INPUT_GLOB=$7; - shift 7; - local ARGUMENTS=$@; - - assert_availability_binaries; - - if ! test "${TEST_MODE}" = "default" && test "${TEST_MODE}" != "with_callback" && ! test "${TEST_MODE}" = "with_stdout_reference"; - then - echo "Unsupported test mode: ${TEST_MODE}"; - echo ""; - - return ${EXIT_FAILURE}; - fi - - if ! test -f "${TEST_EXECUTABLE}"; - then - echo "Missing test executable: ${TEST_EXECUTABLE}"; - echo ""; - - return ${EXIT_FAILURE}; - fi - - if ! test -d "${TEST_INPUT_DIRECTORY}"; - then - echo "Test input directory: ${TEST_INPUT_DIRECTORY} not found."; - - return ${EXIT_IGNORE}; - fi - local RESULT=`ls ${TEST_INPUT_DIRECTORY}/* | tr ' ' '\n' | wc -l`; - - if test ${RESULT} -eq ${EXIT_SUCCESS}; - then - echo "No files or directories found in the test input directory: ${TEST_INPUT_DIRECTORY}"; - - return ${EXIT_IGNORE}; - fi - - local TEST_PROFILE_DIRECTORY=$(get_test_profile_directory "${TEST_INPUT_DIRECTORY}" "${TEST_PROFILE}"); - - local IGNORE_LIST=$(read_ignore_list "${TEST_PROFILE_DIRECTORY}"); - - RESULT=${EXIT_SUCCESS}; - - for TEST_SET_INPUT_DIRECTORY in ${TEST_INPUT_DIRECTORY}/*; - do - if ! test -d "${TEST_SET_INPUT_DIRECTORY}"; - then - continue; - fi - if check_for_directory_in_ignore_list "${TEST_SET_INPUT_DIRECTORY}" "${IGNORE_LIST}"; - then - continue; - fi - - local TEST_SET_DIRECTORY=$(get_test_set_directory "${TEST_PROFILE_DIRECTORY}" "${TEST_SET_INPUT_DIRECTORY}"); - - local INPUT_FILES=""; - if test -f "${TEST_SET_DIRECTORY}/files"; - then - while read -r INPUT_FILE; - do - run_test_on_input_file_with_options "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "${TEST_MODE}" "${OPTION_SETS}" "${TEST_EXECUTABLE}" "${INPUT_FILE}" ${ARGUMENTS[@]}; - RESULT=$?; - - if test ${RESULT} -ne ${EXIT_SUCCESS}; - then - return ${RESULT}; - fi - done < <(cat ${TEST_SET_DIRECTORY}/files | sed "s?^?${TEST_SET_INPUT_DIRECTORY}/?"); - else - while read -r INPUT_FILE; - do - run_test_on_input_file_with_options "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "${TEST_MODE}" "${OPTION_SETS}" "${TEST_EXECUTABLE}" "${INPUT_FILE}" ${ARGUMENTS[@]}; - RESULT=$?; - - if test ${RESULT} -ne ${EXIT_SUCCESS}; - then - return ${RESULT}; - fi - done < <(ls -1 ${TEST_SET_INPUT_DIRECTORY}/${INPUT_GLOB}); - fi - - done - - return ${RESULT}; -} -