Commit eab71a70 authored by Hilko Bengen's avatar Hilko Bengen

New upstream version 20170115

parent b821540f
Acknowledgements: libfwnt
Copyright (C) 2009-2016, Joachim Metz <joachim.metz@gmail.com>
Copyright (C) 2009-2017, Joachim Metz <joachim.metz@gmail.com>
......@@ -3,7 +3,6 @@ ACLOCAL_AMFLAGS = -I m4
SUBDIRS = \
include \
common \
libcstring \
libcerror \
libcthreads \
libcdata \
......@@ -67,7 +66,6 @@ lib: library
library:
(cd $(srcdir)/common && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libcstring && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libcerror && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libcthreads && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libcdata && $(MAKE) $(AM_MAKEFLAGS))
......@@ -88,7 +86,6 @@ distclean: clean
done && test -z "$$fail"
splint:
(cd $(srcdir)/libcstring && $(MAKE) splint $(AM_MAKEFLAGS))
(cd $(srcdir)/libcerror && $(MAKE) splint $(AM_MAKEFLAGS))
(cd $(srcdir)/libcthreads && $(MAKE) splint $(AM_MAKEFLAGS))
(cd $(srcdir)/libcdata && $(MAKE) splint $(AM_MAKEFLAGS))
......
......@@ -95,14 +95,14 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/common.m4 \
$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/lib-ld.m4 \
$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
$(top_srcdir)/m4/libcdata.m4 $(top_srcdir)/m4/libcerror.m4 \
$(top_srcdir)/m4/libcnotify.m4 $(top_srcdir)/m4/libcstring.m4 \
$(top_srcdir)/m4/libcthreads.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/pthread.m4 \
$(top_srcdir)/m4/python.m4 $(top_srcdir)/m4/tests.m4 \
$(top_srcdir)/m4/types.m4 $(top_srcdir)/configure.ac
$(top_srcdir)/m4/libcnotify.m4 $(top_srcdir)/m4/libcthreads.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
$(top_srcdir)/m4/pthread.m4 $(top_srcdir)/m4/python.m4 \
$(top_srcdir)/m4/tests.m4 $(top_srcdir)/m4/types.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
......@@ -286,12 +286,10 @@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
HAVE_LIBCDATA = @HAVE_LIBCDATA@
HAVE_LIBCERROR = @HAVE_LIBCERROR@
HAVE_LIBCNOTIFY = @HAVE_LIBCNOTIFY@
HAVE_LIBCSTRING = @HAVE_LIBCSTRING@
HAVE_LIBCTHREADS = @HAVE_LIBCTHREADS@
HAVE_LOCAL_LIBCDATA = @HAVE_LOCAL_LIBCDATA@
HAVE_LOCAL_LIBCERROR = @HAVE_LOCAL_LIBCERROR@
HAVE_LOCAL_LIBCNOTIFY = @HAVE_LOCAL_LIBCNOTIFY@
HAVE_LOCAL_LIBCSTRING = @HAVE_LOCAL_LIBCSTRING@
HAVE_LOCAL_LIBCTHREADS = @HAVE_LOCAL_LIBCTHREADS@
HAVE_MULTI_THREAD_SUPPORT = @HAVE_MULTI_THREAD_SUPPORT@
HAVE_OFF64_T = @HAVE_OFF64_T@
......@@ -319,8 +317,6 @@ LIBCERROR_CPPFLAGS = @LIBCERROR_CPPFLAGS@
LIBCERROR_LIBADD = @LIBCERROR_LIBADD@
LIBCNOTIFY_CPPFLAGS = @LIBCNOTIFY_CPPFLAGS@
LIBCNOTIFY_LIBADD = @LIBCNOTIFY_LIBADD@
LIBCSTRING_CPPFLAGS = @LIBCSTRING_CPPFLAGS@
LIBCSTRING_LIBADD = @LIBCSTRING_LIBADD@
LIBCTHREADS_CPPFLAGS = @LIBCTHREADS_CPPFLAGS@
LIBCTHREADS_LIBADD = @LIBCTHREADS_LIBADD@
LIBFWNT_DLL_IMPORT = @LIBFWNT_DLL_IMPORT@
......@@ -426,9 +422,6 @@ ax_libcerror_spec_requires = @ax_libcerror_spec_requires@
ax_libcnotify_pc_libs_private = @ax_libcnotify_pc_libs_private@
ax_libcnotify_spec_build_requires = @ax_libcnotify_spec_build_requires@
ax_libcnotify_spec_requires = @ax_libcnotify_spec_requires@
ax_libcstring_pc_libs_private = @ax_libcstring_pc_libs_private@
ax_libcstring_spec_build_requires = @ax_libcstring_spec_build_requires@
ax_libcstring_spec_requires = @ax_libcstring_spec_requires@
ax_libcthreads_pc_libs_private = @ax_libcthreads_pc_libs_private@
ax_libcthreads_spec_build_requires = @ax_libcthreads_spec_build_requires@
ax_libcthreads_spec_requires = @ax_libcthreads_spec_requires@
......@@ -460,8 +453,6 @@ libcerror_CFLAGS = @libcerror_CFLAGS@
libcerror_LIBS = @libcerror_LIBS@
libcnotify_CFLAGS = @libcnotify_CFLAGS@
libcnotify_LIBS = @libcnotify_LIBS@
libcstring_CFLAGS = @libcstring_CFLAGS@
libcstring_LIBS = @libcstring_LIBS@
libcthreads_CFLAGS = @libcthreads_CFLAGS@
libcthreads_LIBS = @libcthreads_LIBS@
libdir = @libdir@
......@@ -495,7 +486,6 @@ ACLOCAL_AMFLAGS = -I m4
SUBDIRS = \
include \
common \
libcstring \
libcerror \
libcthreads \
libcdata \
......@@ -1061,7 +1051,6 @@ lib: library
library:
(cd $(srcdir)/common && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libcstring && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libcerror && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libcthreads && $(MAKE) $(AM_MAKEFLAGS))
(cd $(srcdir)/libcdata && $(MAKE) $(AM_MAKEFLAGS))
......@@ -1082,7 +1071,6 @@ distclean: clean
done && test -z "$$fail"
splint:
(cd $(srcdir)/libcstring && $(MAKE) splint $(AM_MAKEFLAGS))
(cd $(srcdir)/libcerror && $(MAKE) splint $(AM_MAKEFLAGS))
(cd $(srcdir)/libcthreads && $(MAKE) splint $(AM_MAKEFLAGS))
(cd $(srcdir)/libcdata && $(MAKE) splint $(AM_MAKEFLAGS))
......
......@@ -1468,7 +1468,6 @@ m4_include([m4/lib-prefix.m4])
m4_include([m4/libcdata.m4])
m4_include([m4/libcerror.m4])
m4_include([m4/libcnotify.m4])
m4_include([m4/libcstring.m4])
m4_include([m4/libcthreads.m4])
m4_include([m4/libtool.m4])
m4_include([m4/ltoptions.m4])
......
......@@ -9,8 +9,11 @@ EXTRA_DIST = \
config_winapi.h \
file_stream.h \
memory.h \
narrow_string.h \
system_string.h \
types.h \
types.h.in
types.h.in \
wide_string.h
MAINTAINERCLEANFILES = \
Makefile.in
......
......@@ -94,14 +94,14 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/common.m4 \
$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/lib-ld.m4 \
$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
$(top_srcdir)/m4/libcdata.m4 $(top_srcdir)/m4/libcerror.m4 \
$(top_srcdir)/m4/libcnotify.m4 $(top_srcdir)/m4/libcstring.m4 \
$(top_srcdir)/m4/libcthreads.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/pthread.m4 \
$(top_srcdir)/m4/python.m4 $(top_srcdir)/m4/tests.m4 \
$(top_srcdir)/m4/types.m4 $(top_srcdir)/configure.ac
$(top_srcdir)/m4/libcnotify.m4 $(top_srcdir)/m4/libcthreads.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
$(top_srcdir)/m4/pthread.m4 $(top_srcdir)/m4/python.m4 \
$(top_srcdir)/m4/tests.m4 $(top_srcdir)/m4/types.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
......@@ -187,12 +187,10 @@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
HAVE_LIBCDATA = @HAVE_LIBCDATA@
HAVE_LIBCERROR = @HAVE_LIBCERROR@
HAVE_LIBCNOTIFY = @HAVE_LIBCNOTIFY@
HAVE_LIBCSTRING = @HAVE_LIBCSTRING@
HAVE_LIBCTHREADS = @HAVE_LIBCTHREADS@
HAVE_LOCAL_LIBCDATA = @HAVE_LOCAL_LIBCDATA@
HAVE_LOCAL_LIBCERROR = @HAVE_LOCAL_LIBCERROR@
HAVE_LOCAL_LIBCNOTIFY = @HAVE_LOCAL_LIBCNOTIFY@
HAVE_LOCAL_LIBCSTRING = @HAVE_LOCAL_LIBCSTRING@
HAVE_LOCAL_LIBCTHREADS = @HAVE_LOCAL_LIBCTHREADS@
HAVE_MULTI_THREAD_SUPPORT = @HAVE_MULTI_THREAD_SUPPORT@
HAVE_OFF64_T = @HAVE_OFF64_T@
......@@ -220,8 +218,6 @@ LIBCERROR_CPPFLAGS = @LIBCERROR_CPPFLAGS@
LIBCERROR_LIBADD = @LIBCERROR_LIBADD@
LIBCNOTIFY_CPPFLAGS = @LIBCNOTIFY_CPPFLAGS@
LIBCNOTIFY_LIBADD = @LIBCNOTIFY_LIBADD@
LIBCSTRING_CPPFLAGS = @LIBCSTRING_CPPFLAGS@
LIBCSTRING_LIBADD = @LIBCSTRING_LIBADD@
LIBCTHREADS_CPPFLAGS = @LIBCTHREADS_CPPFLAGS@
LIBCTHREADS_LIBADD = @LIBCTHREADS_LIBADD@
LIBFWNT_DLL_IMPORT = @LIBFWNT_DLL_IMPORT@
......@@ -327,9 +323,6 @@ ax_libcerror_spec_requires = @ax_libcerror_spec_requires@
ax_libcnotify_pc_libs_private = @ax_libcnotify_pc_libs_private@
ax_libcnotify_spec_build_requires = @ax_libcnotify_spec_build_requires@
ax_libcnotify_spec_requires = @ax_libcnotify_spec_requires@
ax_libcstring_pc_libs_private = @ax_libcstring_pc_libs_private@
ax_libcstring_spec_build_requires = @ax_libcstring_spec_build_requires@
ax_libcstring_spec_requires = @ax_libcstring_spec_requires@
ax_libcthreads_pc_libs_private = @ax_libcthreads_pc_libs_private@
ax_libcthreads_spec_build_requires = @ax_libcthreads_spec_build_requires@
ax_libcthreads_spec_requires = @ax_libcthreads_spec_requires@
......@@ -361,8 +354,6 @@ libcerror_CFLAGS = @libcerror_CFLAGS@
libcerror_LIBS = @libcerror_LIBS@
libcnotify_CFLAGS = @libcnotify_CFLAGS@
libcnotify_LIBS = @libcnotify_LIBS@
libcstring_CFLAGS = @libcstring_CFLAGS@
libcstring_LIBS = @libcstring_LIBS@
libcthreads_CFLAGS = @libcthreads_CFLAGS@
libcthreads_LIBS = @libcthreads_LIBS@
libdir = @libdir@
......@@ -402,8 +393,11 @@ EXTRA_DIST = \
config_winapi.h \
file_stream.h \
memory.h \
narrow_string.h \
system_string.h \
types.h \
types.h.in
types.h.in \
wide_string.h
MAINTAINERCLEANFILES = \
Makefile.in
......
/*
* Byte stream functions
*
* Copyright (C) 2009-2016, Joachim Metz <joachim.metz@gmail.com>
* Copyright (C) 2009-2017, Joachim Metz <joachim.metz@gmail.com>
*
* Refer to AUTHORS for acknowledgements.
*
......
/*
* Common include file
*
* Copyright (C) 2009-2016, Joachim Metz <joachim.metz@gmail.com>
* Copyright (C) 2009-2017, Joachim Metz <joachim.metz@gmail.com>
*
* Refer to AUTHORS for acknowledgements.
*
......@@ -23,21 +23,21 @@
#define _COMMON_H
#if defined( HAVE_CONFIG_H )
#include <config.h>
#include "config.h"
#endif
/* Include the Borland/CodeGear C++ Builder compiler specific configuration
*/
#if defined( __BORLANDC__ )
#include <config_borlandc.h>
#include "config_borlandc.h"
/* Include the Microsoft Visual Studio C++ compiler specific configuration
*/
#elif defined( _MSC_VER )
#include <config_msc.h>
#include "config_msc.h"
#endif
#include <config_winapi.h>
#include "config_winapi.h"
#endif /* !defined( _COMMON_H ) */
......@@ -70,6 +70,9 @@
/* Define to 1 if you have the `fwrite' function. */
#define HAVE_FWRITE 1
/* Define to 1 if you have the `getopt' function. */
#define HAVE_GETOPT 1
/* Define if the GNU gettext() function is already present or preinstalled. */
#define HAVE_GETTEXT 1
......@@ -100,12 +103,6 @@
/* Define to 1 if you have the <libcnotify.h> header file. */
/* #undef HAVE_LIBCNOTIFY_H */
/* Define to 1 if you have the `cstring' library (-lcstring). */
/* #undef HAVE_LIBCSTRING */
/* Define to 1 if you have the <libcstring.h> header file. */
/* #undef HAVE_LIBCSTRING_H */
/* Define to 1 if you have the `cthreads' library (-lcthreads). */
/* #undef HAVE_LIBCTHREADS */
......@@ -130,9 +127,6 @@
/* Define to 1 if the local version of libcnotify is used. */
#define HAVE_LOCAL_LIBCNOTIFY 1
/* Define to 1 if the local version of libcstring is used. */
#define HAVE_LOCAL_LIBCSTRING 1
/* Define to 1 if the local version of libcthreads is used. */
#define HAVE_LOCAL_LIBCTHREADS 1
......@@ -335,7 +329,7 @@
#define PACKAGE_NAME "libfwnt"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "libfwnt 20161103"
#define PACKAGE_STRING "libfwnt 20170115"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libfwnt"
......@@ -344,7 +338,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "20161103"
#define PACKAGE_VERSION "20170115"
/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT 4
......@@ -365,7 +359,7 @@
/* #undef STRERROR_R_CHAR_P */
/* Version number of package */
#define VERSION "20161103"
#define VERSION "20170115"
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
......
......@@ -69,6 +69,9 @@
/* Define to 1 if you have the `fwrite' function. */
#undef HAVE_FWRITE
/* Define to 1 if you have the `getopt' function. */
#undef HAVE_GETOPT
/* Define if the GNU gettext() function is already present or preinstalled. */
#undef HAVE_GETTEXT
......@@ -99,12 +102,6 @@
/* Define to 1 if you have the <libcnotify.h> header file. */
#undef HAVE_LIBCNOTIFY_H
/* Define to 1 if you have the `cstring' library (-lcstring). */
#undef HAVE_LIBCSTRING
/* Define to 1 if you have the <libcstring.h> header file. */
#undef HAVE_LIBCSTRING_H
/* Define to 1 if you have the `cthreads' library (-lcthreads). */
#undef HAVE_LIBCTHREADS
......@@ -129,9 +126,6 @@
/* Define to 1 if the local version of libcnotify is used. */
#undef HAVE_LOCAL_LIBCNOTIFY
/* Define to 1 if the local version of libcstring is used. */
#undef HAVE_LOCAL_LIBCSTRING
/* Define to 1 if the local version of libcthreads is used. */
#undef HAVE_LOCAL_LIBCTHREADS
......
/*
* Configuration for the Borland/CodeGear C++ Builder compiler
*
* Copyright (C) 2009-2016, Joachim Metz <joachim.metz@gmail.com>
* Copyright (C) 2009-2017, Joachim Metz <joachim.metz@gmail.com>
*
* Refer to AUTHORS for acknowledgements.
*
......
/*
* Configuration for the Microsoft Visual Studio C++ compiler
*
* Copyright (C) 2009-2016, Joachim Metz <joachim.metz@gmail.com>
* Copyright (C) 2009-2017, Joachim Metz <joachim.metz@gmail.com>
*
* Refer to AUTHORS for acknowledgements.
*
......
/*
* Configuration file for WINAPI
*
* Copyright (C) 2009-2016, Joachim Metz <joachim.metz@gmail.com>
* Copyright (C) 2009-2017, Joachim Metz <joachim.metz@gmail.com>
*
* Refer to AUTHORS for acknowledgements.
*
......
/*
* FILE stream functions
*
* Copyright (C) 2009-2016, Joachim Metz <joachim.metz@gmail.com>
* Copyright (C) 2009-2017, Joachim Metz <joachim.metz@gmail.com>
*
* Refer to AUTHORS for acknowledgements.
*
......
/*
* Memory functions
*
* Copyright (C) 2009-2016, Joachim Metz <joachim.metz@gmail.com>
* Copyright (C) 2009-2017, Joachim Metz <joachim.metz@gmail.com>
*
* Refer to AUTHORS for acknowledgements.
*
......
/*
* Narrow character string functions
*
* Copyright (C) 2010-2016, Joachim Metz <joachim.metz@gmail.com>
* Copyright (C) 2009-2017, Joachim Metz <joachim.metz@gmail.com>
*
* Refer to AUTHORS for acknowledgements.
*
......@@ -19,12 +19,12 @@
* along with this software. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined( _LIBCSTRING_NARROW_STRING_H )
#define _LIBCSTRING_NARROW_STRING_H
#if !defined( _NARROW_STRING_H )
#define _NARROW_STRING_H
#include <common.h>
#include <memory.h>
#include <types.h>
#include "common.h"
#include "memory.h"
#include "types.h"
#if defined( HAVE_GLIB_H )
#include <glib.h>
......@@ -38,145 +38,143 @@
#include <string.h>
#endif
#include "libcstring_types.h"
#if defined( __cplusplus )
extern "C" {
#endif
/* String allocation
*/
#define libcstring_narrow_string_allocate( size ) \
#define narrow_string_allocate( size ) \
(char *) memory_allocate( sizeof( char ) * ( size ) )
/* String reallocation
*/
#define libcstring_narrow_string_reallocate( string, size ) \
#define narrow_string_reallocate( string, size ) \
(char *) memory_reallocate( string, ( sizeof( char ) * ( size ) ) )
/* String length
*/
#if defined( HAVE_STRLEN ) || defined( WINAPI )
#define libcstring_narrow_string_length( string ) \
#define narrow_string_length( string ) \
strlen( string )
#endif
/* String compare
*/
#if defined( HAVE_MEMCMP ) || defined( WINAPI )
#define libcstring_narrow_string_compare( string1, string2, size ) \
#define narrow_string_compare( string1, string2, size ) \
memcmp( (void *) string1, (void *) string2, size )
#elif defined( HAVE_STRNCMP )
#define libcstring_narrow_string_compare( string1, string2, size ) \
#define narrow_string_compare( string1, string2, size ) \
strncmp( string1, string2, size )
#endif
/* Caseless string compare
*/
#if defined( HAVE_GLIB_H )
#define libcstring_narrow_string_compare_no_case( string1, string2, size ) \
#define narrow_string_compare_no_case( string1, string2, size ) \
g_ascii_strncasecmp( string1, string2, size )
#elif defined( _MSC_VER )
#define libcstring_narrow_string_compare_no_case( string1, string2, size ) \
#define narrow_string_compare_no_case( string1, string2, size ) \
_strnicmp( string1, string2, size )
#elif defined( WINAPI ) || defined( HAVE_STRNICMP )
#define libcstring_narrow_string_compare_no_case( string1, string2, size ) \
#elif ( defined( WINAPI ) && !defined( __CYGWIN__ ) ) || defined( HAVE_STRNICMP )
#define narrow_string_compare_no_case( string1, string2, size ) \
strnicmp( string1, string2, size )
#elif defined( HAVE_STRNCASECMP )
#define libcstring_narrow_string_compare_no_case( string1, string2, size ) \
#define narrow_string_compare_no_case( string1, string2, size ) \
strncasecmp( string1, string2, size )
#elif defined( HAVE_STRCASECMP )
#define libcstring_narrow_string_compare_no_case( string1, string2, size ) \
#define narrow_string_compare_no_case( string1, string2, size ) \
strcasecmp( string1, string2 )
#endif
/* String copy
*/
#if defined( HAVE_MEMCPY ) || defined( WINAPI )
#define libcstring_narrow_string_copy( destination, source, size ) \
#define narrow_string_copy( destination, source, size ) \
(char *) memcpy( (void *) destination, (void *) source, size )
#elif defined( HAVE_STRNCPY )
#define libcstring_narrow_string_copy( destination, source, size ) \
#define narrow_string_copy( destination, source, size ) \
strncpy( destination, source, size )
#endif
/* String character search
*/
#if defined( HAVE_MEMCHR ) || defined( WINAPI )
#define libcstring_narrow_string_search_character( string, character, size ) \
#define narrow_string_search_character( string, character, size ) \
(char *) memchr( (void *) string, (int) character, size )
#elif defined( HAVE_STRCHR )
#define libcstring_narrow_string_search_character( string, character, size ) \
#define narrow_string_search_character( string, character, size ) \
strchr( string, (int) character )
#endif
/* String reverse character search
*/
#if defined( HAVE_MEMRCHR ) && ( HAVE_DECL_MEMRCHR == 1 )
#define libcstring_narrow_string_search_character_reverse( string, character, size ) \
#define narrow_string_search_character_reverse( string, character, size ) \
(char *) memrchr( (void *) string, (int) character, size )
#elif defined( HAVE_STRRCHR ) || defined( WINAPI )
#define libcstring_narrow_string_search_character_reverse( string, character, size ) \
#define narrow_string_search_character_reverse( string, character, size ) \
strrchr( string, (int) character )
#endif
/* String sub-string search
*/
#if defined( HAVE_STRSTR ) || defined( WINAPI )
#define libcstring_narrow_string_search_string( string, substring, size ) \
#define narrow_string_search_string( string, substring, size ) \
strstr( string, substring )
#endif
/* String formatted print (snprintf)
*/
#if defined( HAVE_GLIB_H )
#define libcstring_narrow_string_snprintf( target, size, ... ) \
#define narrow_string_snprintf( target, size, ... ) \
g_snprintf( target, size, __VA_ARGS__ )
#elif defined( _MSC_VER )
#define libcstring_narrow_string_snprintf( target, size, ... ) \
#define narrow_string_snprintf( target, size, ... ) \
sprintf_s( target, size, __VA_ARGS__ )
#elif defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 )
#define libcstring_narrow_string_snprintf \
#define narrow_string_snprintf \
snprintf
#elif defined( HAVE_SNPRINTF ) || defined( WINAPI )
#define libcstring_narrow_string_snprintf( target, size, ... ) \
#define narrow_string_snprintf( target, size, ... ) \
snprintf( target, size, __VA_ARGS__ )
#endif
/* String input conversion (sscanf)
*/
#if defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 )
#define libcstring_narrow_string_sscanf \
#define narrow_string_sscanf \
sscanf
#elif defined( HAVE_SSCANF ) || defined( WINAPI )
#define libcstring_narrow_string_sscanf( string, format, ... ) \
#define narrow_string_sscanf( string, format, ... ) \
sscanf( string, format, __VA_ARGS__ )
#endif
/* Variable arguments formatted print to string function (vsnprintf)
*/
#if defined( HAVE_GLIB_H )
#define libcstring_narrow_string_vsnprintf( string, size, format, ... ) \
#define narrow_string_vsnprintf( string, size, format, ... ) \
g_vsnprintf( string, size, format, __VA_ARGS__ )
#elif defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 )
#define libcstring_narrow_string_vsnprintf \
#define narrow_string_vsnprintf \
vsnprintf
#elif defined( HAVE_VSNPRINTF ) || defined( WINAPI )
#define libcstring_narrow_string_vsnprintf( string, size, format, ... ) \
#define narrow_string_vsnprintf( string, size, format, ... ) \
vsnprintf( string, size, format, __VA_ARGS__ )
#endif
......@@ -184,5 +182,5 @@ extern "C" {
}
#endif
#endif
#endif /* !defined( _NARROW_STRING_H ) */
/*
* System character string functions
*
* Copyright (C) 2009-2017, Joachim Metz <joachim.metz@gmail.com>
*
* Refer to AUTHORS for acknowledgements.
*
* This software is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined( _SYSTEM_STRING_H )
#define _SYSTEM_STRING_H
#include "common.h"
#include "narrow_string.h"
#include "types.h"
#include "wide_string.h"
#if defined( _cplusplus )
extern "C" {
#endif
#if defined( HAVE_WIDE_SYSTEM_CHARACTER )
#if SIZEOF_WCHAR_T != 2
#error Unsupported wide system character size
#endif
/* Intermediate version of the macro required
* for correct evaluation predefined string
*/
#define _SYSTEM_STRING_INTERMEDIATE( string ) \
L ## string
#define _SYSTEM_STRING( string ) \
_SYSTEM_STRING_INTERMEDIATE( string )
#define system_string_allocate( size ) \
wide_string_allocate( size )
#define system_string_reallocate( string, size ) \
wide_string_reallocate( string, size )
#define system_string_compare( destination, source, size ) \
wide_string_compare( destination, source, size )
#define system_string_compare_no_case( destination, source, size ) \
wide_string_compare_no_case( destination, source, size )
#define system_string_copy( destination, source, size ) \
wide_string_copy( destination, source, size )
#define system_string_length( string ) \
wide_string_length( string )
#define system_string_search_character( string, character, size ) \
wide_string_search_character( string, character, size )
<