Hello community, here is the log from the commit of package libHX for openSUSE:Factory checked in at 2013-03-15 10:39:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libHX (Old) and /work/SRC/openSUSE:Factory/.libHX.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libHX", Maintainer is "[email protected]" Changes: -------- --- /work/SRC/openSUSE:Factory/libHX/libHX.changes 2013-01-02 12:58:32.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.libHX.new/libHX.changes 2013-03-15 10:39:59.000000000 +0100 @@ -1,0 +2,8 @@ +Thu Mar 7 20:29:53 UTC 2013 - [email protected] + +- Update to new upstream release 3.15 +* string: add HX_strchr2 +* string: add HXQUOTE_URIENC mechanism for HX_strquote +* defs: HXsizeof_member becomes FIELD_SIZEOF + +------------------------------------------------------------------- @@ -30 +38 @@ -Sat Feb 11 00:12:21 UTC 2012 - [email protected] +Sat Feb 11 00:12:21 UTC 2012 - [email protected] Old: ---- libHX-3.14.1.tar.xz libHX-3.14.1.tar.xz.asc New: ---- libHX-3.15.tar.xz libHX-3.15.tar.xz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libHX.spec ++++++ --- /var/tmp/diff_new_pack.5Ss3HQ/_old 2013-03-15 10:40:01.000000000 +0100 +++ /var/tmp/diff_new_pack.5Ss3HQ/_new 2013-03-15 10:40:01.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package libHX # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -21,7 +21,7 @@ Summary: Useful collection of routines for C and C++ programming License: LGPL-2.1 or LGPL-3.0 Group: Development/Libraries/C and C++ -Version: 3.14.1 +Version: 3.15 Release: 0 Url: http://libhx.sf.net/ @@ -31,7 +31,6 @@ Source4: %name.keyring BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: gcc-c++ -BuildRequires: libtool BuildRequires: pkgconfig BuildRequires: xz %if 0%{?suse_version} >= 1230 @@ -102,9 +101,7 @@ Jan Engelhardt <jengelh [at] medozas de> %prep -%if 0%{?gpg_verify:1} -%gpg_verify %{S:2} -%endif +%{?gpg_verify: %gpg_verify %{S:2}} %if 0%{?__xz:1} %setup -q %else @@ -127,7 +124,6 @@ make check %post -n %lname -p /sbin/ldconfig - %postun -n %lname -p /sbin/ldconfig %files -n %lname ++++++ libHX-3.14.1.tar.xz -> libHX-3.15.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libHX-3.14.1/configure new/libHX-3.15/configure --- old/libHX-3.14.1/configure 2012-12-31 09:54:59.000000000 +0100 +++ new/libHX-3.15/configure 2013-03-07 21:29:00.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libHX 3.14.1. +# Generated by GNU Autoconf 2.69 for libHX 3.15. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ # Identity of this package. PACKAGE_NAME='libHX' PACKAGE_TARNAME='libhx' -PACKAGE_VERSION='3.14.1' -PACKAGE_STRING='libHX 3.14.1' +PACKAGE_VERSION='3.15' +PACKAGE_STRING='libHX 3.15' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1332,7 +1332,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 libHX 3.14.1 to adapt to many kinds of systems. +\`configure' configures libHX 3.15 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1402,7 +1402,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libHX 3.14.1:";; + short | recursive ) echo "Configuration of libHX 3.15:";; esac cat <<\_ACEOF @@ -1512,7 +1512,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libHX configure 3.14.1 +libHX configure 3.15 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2151,7 +2151,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libHX $as_me 3.14.1, which was +It was created by libHX $as_me 3.15, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2978,7 +2978,7 @@ # Define the identity of the package. PACKAGE='libhx' - VERSION='3.14.1' + VERSION='3.15' cat >>confdefs.h <<_ACEOF @@ -16878,7 +16878,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libHX $as_me 3.14.1, which was +This file was extended by libHX $as_me 3.15, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16944,7 +16944,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libHX config.status 3.14.1 +libHX config.status 3.15 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libHX-3.14.1/configure.ac new/libHX-3.15/configure.ac --- old/libHX-3.14.1/configure.ac 2012-12-31 09:54:41.000000000 +0100 +++ new/libHX-3.15/configure.ac 2013-03-07 21:28:42.000000000 +0100 @@ -1,4 +1,4 @@ -AC_INIT([libHX], [3.14.1]) +AC_INIT([libHX], [3.15]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libHX-3.14.1/doc/api.txt new/libHX-3.15/doc/api.txt --- old/libHX-3.14.1/doc/api.txt 2012-12-31 09:54:41.000000000 +0100 +++ new/libHX-3.15/doc/api.txt 2013-03-07 21:28:42.000000000 +0100 @@ -15,6 +15,9 @@ RMV MinVer FirstA Name ---------------------------------------------------------------------- +3.15 3.15 3.15 FIELD_SIZEOF +3.15 3.15 3.15 HXQUOTE_URIENC +3.15 3.15 3.15 HX_strchr2 3.13 3.13 3.13 DEMOTE_TO_PTR 3.13 3.13 3.13 HXTYPE_SIZE_T 3.13 3.13 3.13 HX_TIMESPEC_EXP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libHX-3.14.1/doc/changelog.txt new/libHX-3.15/doc/changelog.txt --- old/libHX-3.14.1/doc/changelog.txt 2012-12-31 09:54:41.000000000 +0100 +++ new/libHX-3.15/doc/changelog.txt 2013-03-07 21:28:42.000000000 +0100 @@ -4,6 +4,16 @@ ==== +v3.15 (2013-03-07) +================== +Enhancements: +- string: add HX_strchr2 +- string: add HXQUOTE_URIENC mechanism for HX_strquote +Changes: +- defs: HXsizeof_member becomes FIELD_SIZEOF + (to match the Linux kernel's macro name) + + v3.14.1 (2012-12-31) ==================== Fixes: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libHX-3.14.1/doc/libHX_Documentation.lyx new/libHX-3.15/doc/libHX_Documentation.lyx --- old/libHX-3.14.1/doc/libHX_Documentation.lyx 2012-12-31 09:54:41.000000000 +0100 +++ new/libHX-3.15/doc/libHX_Documentation.lyx 2013-03-07 21:28:42.000000000 +0100 @@ -74,7 +74,7 @@ \begin_body \begin_layout Title -libHX 3.14 +libHX 3.15 \begin_inset Newline newline \end_inset @@ -2626,14 +2626,14 @@ \series bold size_t \series default - HXsizeof_member(struct_type, member); + FIELD_SIZEOF(struct_type, member); \begin_inset Index idx status open \begin_layout Plain Layout \family typewriter -HXsizeof_member +FIELD_SIZEOF \end_layout \end_inset @@ -2789,9 +2789,25 @@ \begin_layout Standard \family typewriter +FIELD_SIZEOF +\family default + (formerly +\family typewriter HXsizeof_member \family default - and + +\begin_inset Index idx +status open + +\begin_layout Plain Layout + +\family typewriter +HXsizeof_member +\end_layout + +\end_inset + +) and \family typewriter HXtypeof_member \family default @@ -2804,7 +2820,7 @@ \series bold char \series default - padding[HXsizeof_member( + padding[FIELD_SIZEOF( \series bold struct \series default @@ -10599,6 +10615,32 @@ \series bold +char * +\series default +HX_strchr2( +\series bold +const char * +\series default +s, +\series bold +const char * +\series default +accept); +\begin_inset Index idx +status open + +\begin_layout Plain Layout +HX_strchr2 +\end_layout + +\end_inset + + +\begin_inset Newline newline +\end_inset + + +\series bold size_t \series default HX_strrcspn( @@ -10707,6 +10749,39 @@ \end_layout \begin_layout Description + +\family typewriter +HX_strchr2 +\family default + This function searches the string +\family typewriter +s +\family default + for any set of bytes that are not specified in the second argument, +\family typewriter +n +\family default +. + In this regard, the function is the opposite to +\family typewriter +strpbrk +\family default +(3) +\begin_inset Index idx +status open + +\begin_layout Plain Layout + +\family typewriter +strpbrk +\end_layout + +\end_inset + +. +\end_layout + +\begin_layout Description \family typewriter HX_strrcspn Files old/libHX-3.14.1/doc/libHX_Documentation.pdf and new/libHX-3.15/doc/libHX_Documentation.pdf differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libHX-3.14.1/doc/other.txt new/libHX-3.15/doc/other.txt --- old/libHX-3.14.1/doc/other.txt 2012-12-31 09:54:41.000000000 +0100 +++ new/libHX-3.15/doc/other.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,52 +0,0 @@ -=============================================================================== -other - Uncategorized 2006-02-25 - - -DESCRIPTION - - It did not fit into any other category. - - -SYNOPSIS - - #include <libHX.h> - - void HX_zvecfree(char **VECP); - int HX_fsystem(unsigned long OPTS, const char *PROG, - const char *ARG0, ...); - int HX_vfsystem(unsigned long OPTS, const char *PROG, - const char *ARG0, va_list ARGP); - - -HX_zvecfree() - - Frees every element of VECP, and then VECP itself. VECP must have a NULL - terminator element. - - -HX_fsystem() - - vfsystem() runs (execs or fork-execs) an external program just like - execvp()/system() but it wraps system peculiarities up nicely. - - OPTS is a bitfield; the following options can be applied: - - HX_FSYSTEM_ARGV1 - - This flag specifies that the first dynamic argument is a - NULL-terminated array of strings that are to be prepended to the - final program arguments. - - HX_FSYSTEM_ARGV - - This flag specifies that the first dynamic argument is a - NULL-terminated array of strings that are to be appended to the - final program arguments. - - HX_FSYSTEM_EXEC - - exec()s instead of fork-exec()ing. Under Win32, this is emulated - using system-exit. - - -=============================================================================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libHX-3.14.1/include/libHX/defs.h new/libHX-3.15/include/libHX/defs.h --- old/libHX-3.14.1/include/libHX/defs.h 2012-12-31 09:54:41.000000000 +0100 +++ new/libHX-3.15/include/libHX/defs.h 2013-03-07 21:28:42.000000000 +0100 @@ -2,8 +2,9 @@ #define _LIBHX_DEFS_H 1 #ifdef __cplusplus -# define HXsizeof_member(type, member) \ +# define FIELD_SIZEOF(type, member) \ sizeof(static_cast<type *>(NULL)->member) +# define HXsizeof_member(type, member) FIELD_SIZEOF(type, member) # define HXtypeof_member(type, member) \ __typeof__(static_cast<type *>(NULL)->member) # if defined(__GNUC__) && __GNUC__ >= 4 && !defined(offsetof) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libHX-3.14.1/include/libHX/string.h new/libHX-3.15/include/libHX/string.h --- old/libHX-3.14.1/include/libHX/string.h 2012-12-31 09:54:41.000000000 +0100 +++ new/libHX-3.15/include/libHX/string.h 2013-03-07 21:28:42.000000000 +0100 @@ -25,6 +25,7 @@ HXQUOTE_LDAPFLT, HXQUOTE_LDAPRDN, HXQUOTE_BASE64, + HXQUOTE_URIENC, _HXQUOTE_MAX, }; @@ -66,6 +67,7 @@ extern char **HX_split4(char *, const char *, int *, int); extern int HX_split5(char *, const char *, int, char **); extern char *HX_strbchr(const char *, const char *, char); +extern char *HX_strchr2(const char *, const char *); extern char *HX_strclone(char **, const char *); extern char *HX_strdup(const char *); extern char *HX_strlcat(char *, const char *, size_t); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libHX-3.14.1/src/.gitignore new/libHX-3.15/src/.gitignore --- old/libHX-3.14.1/src/.gitignore 2012-12-31 09:54:41.000000000 +0100 +++ new/libHX-3.15/src/.gitignore 2013-03-07 21:28:42.000000000 +0100 @@ -17,5 +17,7 @@ /t?-rand /t?-realpath /t?-shconfig +/t?-strchr2 /t?-string +/t?-strquote /t?-time diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libHX-3.14.1/src/Makefile.am new/libHX-3.15/src/Makefile.am --- old/libHX-3.14.1/src/Makefile.am 2012-12-31 09:54:41.000000000 +0100 +++ new/libHX-3.15/src/Makefile.am 2013-03-07 21:28:42.000000000 +0100 @@ -9,8 +9,7 @@ mc.c misc.c opt.c \ rand.c string.c time.c libHX_la_LIBADD = ${libdl_LIBS} ${libpthread_LIBS} ${librt_LIBS} -# New in 29 (over 28): HX_timespec_* -libHX_la_LDFLAGS = -version-info 29:0:1 \ +libHX_la_LDFLAGS = -version-info 30:0:2 \ -Wl,--version-script=${srcdir}/libHX.map libHX_la_DEPENDENCIES = libHX.map @@ -31,7 +30,8 @@ check_PROGRAMS = tc-compile tc-cast tc-deque tc-dir tc-format tc-link \ tc-list tc-list2 tc-map tc-memmem tc-misc tc-netio \ tc-option tc-proc tc-rand tc-realpath \ - tc-shconfig tc-string tc-time + tc-shconfig tc-strchr2 tc-string tc-strquote tc-time +TESTS = tc-strchr2 tc-strquote tc_cast_CFLAGS = ${AM_CFLAGS} -std=c99 tc_cast_LDADD = libHX.la -lm tc_compile_LDADD = libHX.la @@ -50,13 +50,17 @@ tc_rand_LDADD = libHX.la tc_realpath_LDADD = libHX.la tc_shconfig_LDADD = libHX.la +tc_strchr2_LDADD = libHX.la tc_string_LDADD = libHX.la +tc_strquote_LDADD = libHX.la tc_time_LDADD = libHX.la if HAVE_CXX check_PROGRAMS += tx-compile tx-cast tx-deque tx-dir tx-list tx-list2 \ tx-misc tx-netio \ - tx-option tx-proc tx-rand tx-string tx-time + tx-option tx-proc tx-rand tx-strchr2 tx-string \ + tx-strquote tx-time +TESTS += tx-strchr2 tx-strquote tx_cast_SOURCES = tx-cast.cpp tx_cast_CXXFLAGS = ${AM_CXXFLAGS} -std=c++98 tx_cast_LDADD = libHX.la -lm @@ -80,8 +84,12 @@ tx_proc_LDADD = libHX.la tx_rand_SOURCES = tx-rand.cpp tx_rand_LDADD = libHX.la ${librt_LIBS} +tx_strchr2_SOURCES = tx-strchr2.cpp +tx_strchr2_LDADD = libHX.la tx_string_SOURCES = tx-string.cpp tx_string_LDADD = libHX.la +tx_strquote_SOURCES = tx-strquote.cpp +tx_strquote_LDADD = libHX.la tx_time_SOURCES = tx-time.cpp tx_time_LDADD = libHX.la ${librt_LIBS} endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libHX-3.14.1/src/Makefile.in new/libHX-3.15/src/Makefile.in --- old/libHX-3.14.1/src/Makefile.in 2012-12-31 09:55:00.000000000 +0100 +++ new/libHX-3.15/src/Makefile.in 2013-03-07 21:29:01.000000000 +0100 @@ -60,11 +60,15 @@ tc-map$(EXEEXT) tc-memmem$(EXEEXT) tc-misc$(EXEEXT) \ tc-netio$(EXEEXT) tc-option$(EXEEXT) tc-proc$(EXEEXT) \ tc-rand$(EXEEXT) tc-realpath$(EXEEXT) tc-shconfig$(EXEEXT) \ - tc-string$(EXEEXT) tc-time$(EXEEXT) $(am__EXEEXT_1) + tc-strchr2$(EXEEXT) tc-string$(EXEEXT) tc-strquote$(EXEEXT) \ + tc-time$(EXEEXT) $(am__EXEEXT_1) +TESTS = tc-strchr2$(EXEEXT) tc-strquote$(EXEEXT) $(am__EXEEXT_2) @HAVE_CXX_TRUE@am__append_3 = tx-compile tx-cast tx-deque tx-dir tx-list tx-list2 \ @HAVE_CXX_TRUE@ tx-misc tx-netio \ -@HAVE_CXX_TRUE@ tx-option tx-proc tx-rand tx-string tx-time +@HAVE_CXX_TRUE@ tx-option tx-proc tx-rand tx-strchr2 tx-string \ +@HAVE_CXX_TRUE@ tx-strquote tx-time +@HAVE_CXX_TRUE@am__append_4 = tx-strchr2 tx-strquote subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/build-aux/depcomp @@ -135,7 +139,8 @@ @HAVE_CXX_TRUE@ tx-list$(EXEEXT) tx-list2$(EXEEXT) \ @HAVE_CXX_TRUE@ tx-misc$(EXEEXT) tx-netio$(EXEEXT) \ @HAVE_CXX_TRUE@ tx-option$(EXEEXT) tx-proc$(EXEEXT) \ -@HAVE_CXX_TRUE@ tx-rand$(EXEEXT) tx-string$(EXEEXT) \ +@HAVE_CXX_TRUE@ tx-rand$(EXEEXT) tx-strchr2$(EXEEXT) \ +@HAVE_CXX_TRUE@ tx-string$(EXEEXT) tx-strquote$(EXEEXT) \ @HAVE_CXX_TRUE@ tx-time$(EXEEXT) tc_cast_SOURCES = tc-cast.c tc_cast_OBJECTS = tc_cast-tc-cast.$(OBJEXT) @@ -194,9 +199,15 @@ tc_shconfig_SOURCES = tc-shconfig.c tc_shconfig_OBJECTS = tc-shconfig.$(OBJEXT) tc_shconfig_DEPENDENCIES = libHX.la +tc_strchr2_SOURCES = tc-strchr2.c +tc_strchr2_OBJECTS = tc-strchr2.$(OBJEXT) +tc_strchr2_DEPENDENCIES = libHX.la tc_string_SOURCES = tc-string.c tc_string_OBJECTS = tc-string.$(OBJEXT) tc_string_DEPENDENCIES = libHX.la +tc_strquote_SOURCES = tc-strquote.c +tc_strquote_OBJECTS = tc-strquote.$(OBJEXT) +tc_strquote_DEPENDENCIES = libHX.la tc_time_SOURCES = tc-time.c tc_time_OBJECTS = tc-time.$(OBJEXT) tc_time_DEPENDENCIES = libHX.la @@ -250,10 +261,18 @@ @HAVE_CXX_TRUE@am_tx_rand_OBJECTS = tx-rand.$(OBJEXT) tx_rand_OBJECTS = $(am_tx_rand_OBJECTS) @HAVE_CXX_TRUE@tx_rand_DEPENDENCIES = libHX.la $(am__DEPENDENCIES_1) +am__tx_strchr2_SOURCES_DIST = tx-strchr2.cpp +@HAVE_CXX_TRUE@am_tx_strchr2_OBJECTS = tx-strchr2.$(OBJEXT) +tx_strchr2_OBJECTS = $(am_tx_strchr2_OBJECTS) +@HAVE_CXX_TRUE@tx_strchr2_DEPENDENCIES = libHX.la am__tx_string_SOURCES_DIST = tx-string.cpp @HAVE_CXX_TRUE@am_tx_string_OBJECTS = tx-string.$(OBJEXT) tx_string_OBJECTS = $(am_tx_string_OBJECTS) @HAVE_CXX_TRUE@tx_string_DEPENDENCIES = libHX.la +am__tx_strquote_SOURCES_DIST = tx-strquote.cpp +@HAVE_CXX_TRUE@am_tx_strquote_OBJECTS = tx-strquote.$(OBJEXT) +tx_strquote_OBJECTS = $(am_tx_strquote_OBJECTS) +@HAVE_CXX_TRUE@tx_strquote_DEPENDENCIES = libHX.la am__tx_time_SOURCES_DIST = tx-time.cpp @HAVE_CXX_TRUE@am_tx_time_OBJECTS = tx-time.$(OBJEXT) tx_time_OBJECTS = $(am_tx_time_OBJECTS) @@ -304,23 +323,25 @@ tc-compile.c tc-deque.c tc-dir.c tc-format.c tc-link.c \ tc-list.c tc-list2.c tc-map.c tc-memmem.c tc-misc.c tc-netio.c \ tc-option.c tc-proc.c tc-rand.c tc-realpath.c tc-shconfig.c \ - tc-string.c tc-time.c $(tx_cast_SOURCES) $(tx_compile_SOURCES) \ - $(tx_deque_SOURCES) $(tx_dir_SOURCES) $(tx_list_SOURCES) \ - $(tx_list2_SOURCES) $(tx_misc_SOURCES) $(tx_netio_SOURCES) \ - $(tx_option_SOURCES) $(tx_proc_SOURCES) $(tx_rand_SOURCES) \ - $(tx_string_SOURCES) $(tx_time_SOURCES) + tc-strchr2.c tc-string.c tc-strquote.c tc-time.c \ + $(tx_cast_SOURCES) $(tx_compile_SOURCES) $(tx_deque_SOURCES) \ + $(tx_dir_SOURCES) $(tx_list_SOURCES) $(tx_list2_SOURCES) \ + $(tx_misc_SOURCES) $(tx_netio_SOURCES) $(tx_option_SOURCES) \ + $(tx_proc_SOURCES) $(tx_rand_SOURCES) $(tx_strchr2_SOURCES) \ + $(tx_string_SOURCES) $(tx_strquote_SOURCES) $(tx_time_SOURCES) DIST_SOURCES = $(am__libHX_la_SOURCES_DIST) \ $(libHX_rtcheck_la_SOURCES) tc-cast.c tc-compile.c tc-deque.c \ tc-dir.c tc-format.c tc-link.c tc-list.c tc-list2.c tc-map.c \ tc-memmem.c tc-misc.c tc-netio.c tc-option.c tc-proc.c \ - tc-rand.c tc-realpath.c tc-shconfig.c tc-string.c tc-time.c \ - $(am__tx_cast_SOURCES_DIST) $(am__tx_compile_SOURCES_DIST) \ - $(am__tx_deque_SOURCES_DIST) $(am__tx_dir_SOURCES_DIST) \ - $(am__tx_list_SOURCES_DIST) $(am__tx_list2_SOURCES_DIST) \ - $(am__tx_misc_SOURCES_DIST) $(am__tx_netio_SOURCES_DIST) \ - $(am__tx_option_SOURCES_DIST) $(am__tx_proc_SOURCES_DIST) \ - $(am__tx_rand_SOURCES_DIST) $(am__tx_string_SOURCES_DIST) \ - $(am__tx_time_SOURCES_DIST) + tc-rand.c tc-realpath.c tc-shconfig.c tc-strchr2.c tc-string.c \ + tc-strquote.c tc-time.c $(am__tx_cast_SOURCES_DIST) \ + $(am__tx_compile_SOURCES_DIST) $(am__tx_deque_SOURCES_DIST) \ + $(am__tx_dir_SOURCES_DIST) $(am__tx_list_SOURCES_DIST) \ + $(am__tx_list2_SOURCES_DIST) $(am__tx_misc_SOURCES_DIST) \ + $(am__tx_netio_SOURCES_DIST) $(am__tx_option_SOURCES_DIST) \ + $(am__tx_proc_SOURCES_DIST) $(am__tx_rand_SOURCES_DIST) \ + $(am__tx_strchr2_SOURCES_DIST) $(am__tx_string_SOURCES_DIST) \ + $(am__tx_strquote_SOURCES_DIST) $(am__tx_time_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -328,6 +349,11 @@ esac ETAGS = etags CTAGS = ctags +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = $(am__tty_colors_dummy) +@HAVE_CXX_TRUE@am__EXEEXT_2 = tx-strchr2$(EXEEXT) tx-strquote$(EXEEXT) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -463,8 +489,7 @@ libHX_la_SOURCES = deque.c dl.c format.c io.c map.c mc.c misc.c opt.c \ rand.c string.c time.c $(am__append_1) $(am__append_2) libHX_la_LIBADD = ${libdl_LIBS} ${libpthread_LIBS} ${librt_LIBS} -# New in 29 (over 28): HX_timespec_* -libHX_la_LDFLAGS = -version-info 29:0:1 \ +libHX_la_LDFLAGS = -version-info 30:0:2 \ -Wl,--version-script=${srcdir}/libHX.map libHX_la_DEPENDENCIES = libHX.map @@ -492,7 +517,9 @@ tc_rand_LDADD = libHX.la tc_realpath_LDADD = libHX.la tc_shconfig_LDADD = libHX.la +tc_strchr2_LDADD = libHX.la tc_string_LDADD = libHX.la +tc_strquote_LDADD = libHX.la tc_time_LDADD = libHX.la @HAVE_CXX_TRUE@tx_cast_SOURCES = tx-cast.cpp @HAVE_CXX_TRUE@tx_cast_CXXFLAGS = ${AM_CXXFLAGS} -std=c++98 @@ -517,8 +544,12 @@ @HAVE_CXX_TRUE@tx_proc_LDADD = libHX.la @HAVE_CXX_TRUE@tx_rand_SOURCES = tx-rand.cpp @HAVE_CXX_TRUE@tx_rand_LDADD = libHX.la ${librt_LIBS} +@HAVE_CXX_TRUE@tx_strchr2_SOURCES = tx-strchr2.cpp +@HAVE_CXX_TRUE@tx_strchr2_LDADD = libHX.la @HAVE_CXX_TRUE@tx_string_SOURCES = tx-string.cpp @HAVE_CXX_TRUE@tx_string_LDADD = libHX.la +@HAVE_CXX_TRUE@tx_strquote_SOURCES = tx-strquote.cpp +@HAVE_CXX_TRUE@tx_strquote_LDADD = libHX.la @HAVE_CXX_TRUE@tx_time_SOURCES = tx-time.cpp @HAVE_CXX_TRUE@tx_time_LDADD = libHX.la ${librt_LIBS} all: all-am @@ -653,9 +684,15 @@ tc-shconfig$(EXEEXT): $(tc_shconfig_OBJECTS) $(tc_shconfig_DEPENDENCIES) $(EXTRA_tc_shconfig_DEPENDENCIES) @rm -f tc-shconfig$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tc_shconfig_OBJECTS) $(tc_shconfig_LDADD) $(LIBS) +tc-strchr2$(EXEEXT): $(tc_strchr2_OBJECTS) $(tc_strchr2_DEPENDENCIES) $(EXTRA_tc_strchr2_DEPENDENCIES) + @rm -f tc-strchr2$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(tc_strchr2_OBJECTS) $(tc_strchr2_LDADD) $(LIBS) tc-string$(EXEEXT): $(tc_string_OBJECTS) $(tc_string_DEPENDENCIES) $(EXTRA_tc_string_DEPENDENCIES) @rm -f tc-string$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tc_string_OBJECTS) $(tc_string_LDADD) $(LIBS) +tc-strquote$(EXEEXT): $(tc_strquote_OBJECTS) $(tc_strquote_DEPENDENCIES) $(EXTRA_tc_strquote_DEPENDENCIES) + @rm -f tc-strquote$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(tc_strquote_OBJECTS) $(tc_strquote_LDADD) $(LIBS) tc-time$(EXEEXT): $(tc_time_OBJECTS) $(tc_time_DEPENDENCIES) $(EXTRA_tc_time_DEPENDENCIES) @rm -f tc-time$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tc_time_OBJECTS) $(tc_time_LDADD) $(LIBS) @@ -692,9 +729,15 @@ tx-rand$(EXEEXT): $(tx_rand_OBJECTS) $(tx_rand_DEPENDENCIES) $(EXTRA_tx_rand_DEPENDENCIES) @rm -f tx-rand$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(tx_rand_OBJECTS) $(tx_rand_LDADD) $(LIBS) +tx-strchr2$(EXEEXT): $(tx_strchr2_OBJECTS) $(tx_strchr2_DEPENDENCIES) $(EXTRA_tx_strchr2_DEPENDENCIES) + @rm -f tx-strchr2$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(tx_strchr2_OBJECTS) $(tx_strchr2_LDADD) $(LIBS) tx-string$(EXEEXT): $(tx_string_OBJECTS) $(tx_string_DEPENDENCIES) $(EXTRA_tx_string_DEPENDENCIES) @rm -f tx-string$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(tx_string_OBJECTS) $(tx_string_LDADD) $(LIBS) +tx-strquote$(EXEEXT): $(tx_strquote_OBJECTS) $(tx_strquote_DEPENDENCIES) $(EXTRA_tx_strquote_DEPENDENCIES) + @rm -f tx-strquote$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(tx_strquote_OBJECTS) $(tx_strquote_LDADD) $(LIBS) tx-time$(EXEEXT): $(tx_time_OBJECTS) $(tx_time_DEPENDENCIES) $(EXTRA_tx_time_DEPENDENCIES) @rm -f tx-time$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(tx_time_OBJECTS) $(tx_time_LDADD) $(LIBS) @@ -732,7 +775,9 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-rand.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-realpath.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-shconfig.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-strchr2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-string.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-strquote.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-time.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc_cast-tc-cast.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc_list2-tc-list2.Po@am__quote@ @@ -746,7 +791,9 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tx-option.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tx-proc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tx-rand.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tx-strchr2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tx-string.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tx-strquote.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tx-time.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tx_cast-tx-cast.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tx_list2-tx-list2.Po@am__quote@ @@ -929,6 +976,99 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + fi; \ + echo "$${col}$$dashes$${std}"; \ + echo "$${col}$$banner$${std}"; \ + test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ + test -z "$$report" || echo "$${col}$$report$${std}"; \ + echo "$${col}$$dashes$${std}"; \ + test "$$failed" -eq 0; \ + else :; fi + distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -961,6 +1101,7 @@ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: @@ -1070,7 +1211,7 @@ .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-am clean \ +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \ clean-libtool cscopelist ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libHX-3.14.1/src/libHX.map new/libHX-3.15/src/libHX.map --- old/libHX-3.14.1/src/libHX.map 2012-12-31 09:54:41.000000000 +0100 +++ new/libHX-3.15/src/libHX.map 2013-03-07 21:28:42.000000000 +0100 @@ -173,6 +173,7 @@ HXmap_init; } LIBHX_3.10; +# ABI 29 LIBHX_3.13 { global: HX_timespec_add; @@ -183,3 +184,9 @@ HX_timespec_sub; HX_timeval_sub; } LIBHX_3.12; + +# ABI 30 +LIBHX_3.15 { +global: + HX_strchr2; +} LIBHX_3.13; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libHX-3.14.1/src/string.c new/libHX-3.15/src/string.c --- old/libHX-3.14.1/src/string.c 2012-12-31 09:54:41.000000000 +0100 +++ new/libHX-3.15/src/string.c 2013-03-07 21:28:42.000000000 +0100 @@ -18,6 +18,28 @@ #include <libHX/string.h> #include "internal.h" +/** + * %HXQUOTE_ACCEPT: the listed characters are passed through, + * all others need to be quoted + * %HXQUOTE_REJECT: the listed characters need to be quoted, + * all others pass through + */ +enum HX_quote_selector { + HXQUOTE_ACCEPT, + HXQUOTE_REJECT, +}; + +/** + * @selector: whether this rule is accept- or reject-based + * @qchars: characters that need (no) quoting + */ +struct HX_quote_rule { + char selector; + const char *chars; +}; + +static const char HX_hexenc[] = "0123456789ABCDEF"; + static __inline__ unsigned int min_uint(unsigned int a, unsigned int b) { return (a < b) ? a : b; @@ -259,6 +281,19 @@ return NULL; } +/** + * This is the counterpart to strpbrk(). Returns a pointer to the first + * character not in @accept, or otherwise %NULL. + */ +EXPORT_SYMBOL char *HX_strchr2(const char *s, const char *accept) +{ + size_t seg = strspn(s, accept); + + if (s[seg] == '\0') + return NULL; + return const_cast1(char *, s + seg); +} + EXPORT_SYMBOL char *HX_strclone(char **pa, const char *pb) { if (*pa == pb) @@ -447,24 +482,49 @@ return ret; } -static const char *const HX_quote_chars[] = { - [HXQUOTE_SQUOTE] = "'\\", - [HXQUOTE_DQUOTE] = "\"\\", - [HXQUOTE_HTML] = "\"&<>", - [HXQUOTE_LDAPFLT] = "\n*()\\", - [HXQUOTE_LDAPRDN] = "\n \"#+,;<=>\\", +static const struct HX_quote_rule HX_quote_rules[] = { + [HXQUOTE_SQUOTE] = {HXQUOTE_REJECT, "'\\"}, + [HXQUOTE_DQUOTE] = {HXQUOTE_REJECT, "\"\\"}, + [HXQUOTE_HTML] = {HXQUOTE_REJECT, "\"&<>"}, + [HXQUOTE_LDAPFLT] = {HXQUOTE_REJECT, "\n*()\\"}, + [HXQUOTE_LDAPRDN] = {HXQUOTE_REJECT, "\n \"#+,;<=>\\"}, + [HXQUOTE_URIENC] = {HXQUOTE_ACCEPT, "-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~"}, }; /** - * HX_qsize_backslash - calculate size of new buffer + * HX_qsize_bsa - calculate length of statically expanded string (for accepts) * @s: input string * @qchars: characters that need quoting * @cost: quoting cost per quoted character * - * The cost depends on the quote format (\a vs \07 vs \x07). + * The cost depends on the quote format. Typical values: + * 1 when "&" becomes "\&" (programming language-like) + * 2 when "&" becomes "\26" (LDAPRDN/HTTPURI-like hex encoding) + * 3 when "&" becomes "\x26" (hex encoding for programming) */ -static size_t HX_qsize_backslash(const char *s, const char *qchars, - unsigned int cost) +static size_t +HX_qsize_bsa(const char *s, const char *qchars, unsigned int cost) +{ + const char *p = s; + size_t n = strlen(s); + + while ((p = HX_strchr2(p, qchars)) != NULL) { + n += cost; + ++p; + } + return n; +} + +/** + * HX_qsize_bsr - calculate length of statically expanded string (for rejects) + * @s: input string + * @qchars: characters that need quoting + * @cost: quoting cost per quoted character + * + * Same as for HX_qsize_bsa, but for HXQUOTE_REJECT-type rules. + */ +static size_t +HX_qsize_bsr(const char *s, const char *qchars, unsigned int cost) { const char *p = s; size_t n = strlen(s); @@ -542,7 +602,7 @@ const char *p = s; size_t n = strlen(s); - while ((p = strpbrk(p, HX_quote_chars[HXQUOTE_HTML])) != NULL) { + while ((p = strpbrk(p, HX_quote_rules[HXQUOTE_HTML].chars)) != NULL) { switch (*p) { /* minus 2: \0 and the original char */ case '"': @@ -571,7 +631,7 @@ char *ret = dest; while (*src != '\0') { - size_t len = strcspn(src, HX_quote_chars[HXQUOTE_HTML]); + size_t len = strcspn(src, HX_quote_rules[HXQUOTE_HTML].chars); if (len > 0) { memcpy(dest, src, len); dest += len; @@ -593,7 +653,6 @@ static char *HX_quote_ldap(char *dest, const char *src, const char *qc) { - static const char hex[] = "0123456789ABCDEF"; char *ret = dest; size_t len; @@ -607,14 +666,36 @@ break; } *dest++ = '\\'; - *dest++ = hex[(*src >> 4) & 0x0F]; - *dest++ = hex[*src++ & 0x0F]; + *dest++ = HX_hexenc[(*src >> 4) & 0x0F]; + *dest++ = HX_hexenc[*src++ & 0x0F]; } *dest = '\0'; return ret; } +static char *HX_quote_urlenc(char *dest, const char *src) +{ + char *ret = dest; + size_t len; + + while (*src != '\0') { + len = strspn(src, HX_quote_rules[HXQUOTE_URIENC].chars); + if (len > 0) { + memcpy(dest, src, len); + dest += len; + src += len; + if (*src == '\0') + break; + } + *dest++ = '%'; + *dest++ = HX_hexenc[(*src >> 4) & 0x0F]; + *dest++ = HX_hexenc[*src++ & 0x0F]; + } + + *dest = '\0'; + return ret; +} /** * HX_quoted_size - @@ -628,14 +709,16 @@ switch (type) { case HXQUOTE_SQUOTE: case HXQUOTE_DQUOTE: - return HX_qsize_backslash(s, HX_quote_chars[type], 1); + return HX_qsize_bsr(s, HX_quote_rules[type].chars, 1); case HXQUOTE_HTML: return HX_qsize_html(s); case HXQUOTE_LDAPFLT: case HXQUOTE_LDAPRDN: - return HX_qsize_backslash(s, HX_quote_chars[type], 2); + return HX_qsize_bsr(s, HX_quote_rules[type].chars, 2); case HXQUOTE_BASE64: return (strlen(s) + 2) / 3 * 4; + case HXQUOTE_URIENC: + return HX_qsize_bsa(s, HX_quote_rules[type].chars, 2); default: return strlen(s); } @@ -644,6 +727,7 @@ EXPORT_SYMBOL char *HX_strquote(const char *src, unsigned int type, char **free_me) { + const struct HX_quote_rule *rule; bool do_quote; char *tmp; @@ -652,9 +736,15 @@ return NULL; } /* If quote_chars is NULL, it is clear all chars are to be encoded. */ - do_quote = type >= ARRAY_SIZE(HX_quote_chars) || - HX_quote_chars[type] == NULL || - strpbrk(src, HX_quote_chars[type]) != NULL; + rule = &HX_quote_rules[type]; + if (type >= ARRAY_SIZE(HX_quote_rules) || rule->chars == NULL) + do_quote = true; + else if (rule->selector == HXQUOTE_REJECT) + do_quote = strpbrk(src, rule->chars) != NULL; + else if (rule->selector == HXQUOTE_ACCEPT) + do_quote = HX_strchr2(src, rule->chars) != NULL; + else + do_quote = false; /* * free_me == NULL implies that we always allocate, even if * there is nothing to quote. @@ -677,14 +767,16 @@ switch (type) { case HXQUOTE_SQUOTE: case HXQUOTE_DQUOTE: - return HX_quote_backslash(*free_me, src, HX_quote_chars[type]); + return HX_quote_backslash(*free_me, src, rule->chars); case HXQUOTE_HTML: return HX_quote_html(*free_me, src); case HXQUOTE_LDAPFLT: case HXQUOTE_LDAPRDN: - return HX_quote_ldap(*free_me, src, HX_quote_chars[type]); + return HX_quote_ldap(*free_me, src, rule->chars); case HXQUOTE_BASE64: return HX_quote_base64(*free_me, src); + case HXQUOTE_URIENC: + return HX_quote_urlenc(*free_me, src); } return NULL; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libHX-3.14.1/src/tc-link.c new/libHX-3.15/src/tc-link.c --- old/libHX-3.14.1/src/tc-link.c 2012-12-31 09:54:41.000000000 +0100 +++ new/libHX-3.15/src/tc-link.c 2013-03-07 21:28:42.000000000 +0100 @@ -98,6 +98,7 @@ HX_split4, HX_split5, HX_strbchr, + HX_strchr2, HX_strclone, HX_strdup, HX_strlcat, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libHX-3.14.1/src/tc-strchr2.c new/libHX-3.15/src/tc-strchr2.c --- old/libHX-3.14.1/src/tc-strchr2.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libHX-3.15/src/tc-strchr2.c 2013-03-07 21:28:42.000000000 +0100 @@ -0,0 +1,26 @@ +/* + * Behavior Correctness Test for HX_strchr2 + * Copyright © Jan Engelhardt, 2013 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the WTF Public License version 2 or + * (at your option) any later version. + */ +#include <libHX/string.h> + +static const char alphabet[] = "abcdefghijklmnopqrstuvwxyz"; + +int main(void) +{ + char *z; + + z = HX_strchr2("qfm!bar", alphabet); + if (z == NULL || *z != '!') + return EXIT_FAILURE; + + z = HX_strchr2("qfmxbar", alphabet); + if (z != NULL) + return EXIT_FAILURE; + + return EXIT_SUCCESS; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libHX-3.14.1/src/tc-string.c new/libHX-3.15/src/tc-string.c --- old/libHX-3.14.1/src/tc-string.c 2012-12-31 09:54:41.000000000 +0100 +++ new/libHX-3.15/src/tc-string.c 2013-03-07 21:28:42.000000000 +0100 @@ -176,21 +176,6 @@ HX_zvecfree(a); } -static void t_quote(void) -{ - char *fm = NULL; - printf("%p %p\n", "a", HX_strquote("a", 0xffff, &fm)); - printf("%s\n", HX_strquote("\"Good\" ol' \\'escaped\\' strings", HXQUOTE_SQUOTE, &fm)); - printf("%s\n", HX_strquote("\"Good\" ol' \\'escaped\\' strings", HXQUOTE_DQUOTE, &fm)); - printf("%s\n", HX_strquote("<p style=\"height: 1;\">Foo & \"bar\"</p>", HXQUOTE_HTML, &fm)); - printf("(objectClass=%s)\n", HX_strquote(" #o=foo(*),bar ", HXQUOTE_LDAPFLT, &fm)); - printf("o=%s\n", HX_strquote(" #o=foo(*),bar ", HXQUOTE_LDAPRDN, &fm)); - printf("%s\n", HX_strquote("whatever", HXQUOTE_BASE64, &fm)); - free(fm); - if (HX_strquote("", -1, NULL) != NULL) - printf("Something is fishy with strquote\n"); -} - int main(int argc, const char **argv) { hxmc_t *tx = NULL; @@ -218,7 +203,6 @@ t_strsep(); t_split(); t_split2(); - t_quote(); HXmc_free(tx); HX_exit(); return EXIT_SUCCESS; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libHX-3.14.1/src/tc-strquote.c new/libHX-3.15/src/tc-strquote.c --- old/libHX-3.14.1/src/tc-strquote.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libHX-3.15/src/tc-strquote.c 2013-03-07 21:28:42.000000000 +0100 @@ -0,0 +1,65 @@ +/* + * Behavior Correctness Test for HX_strquote + * Copyright © Jan Engelhardt, 2013 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the WTF Public License version 2 or + * (at your option) any later version. + */ +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <libHX/string.h> + +static const char input1[] = "\"Good\" ol' \\'escaped\\' strings"; +static const char output1a[] = "\"Good\" ol\\' \\\\\\'escaped\\\\\\' strings"; +static const char output1b[] = "\\\"Good\\\" ol' \\\\'escaped\\\\' strings"; +static const char input2[] = "<p style=\"height: 1;\">Foo & \"bar\"</p>"; +static const char output2[] = + "<p style="height: 1;">Foo &amp; "bar"</p>"; +static const char input3[] = " #o=foo(*),ba\\r "; +static const char output3a[] = " #o=foo\\28\\2A\\29,ba\\5Cr "; +static const char output3b[] = "\\20\\23o\\3Dfoo(*)\\2Cba\\5Cr\\20"; +static const char output3c[] = "ICNvPWZvbygqKSxiYVxyIA=="; +static const char input4[] = "http://user:[email protected]/~path/file(msvc);stuff.php?query[phpindex]=value&another=one;stuff"; +static const char output4[] = "http%3A%2F%2Fuser%3Apass%40host.de%2F~path%2Ffile%28msvc%29%3Bstuff.php%3Fquery%5Bphpindex%5D%3Dvalue%26another%3Done%3Bstuff"; + +static int test(const char *input, unsigned int mode, const char *expect) +{ + char *output = HX_strquote(input, mode, NULL); + + if (output == NULL) { + fprintf(stderr, "HX_strquote returned NULL\n"); + return EXIT_FAILURE; + } + if (strcmp(output, expect) != 0) { + fprintf(stderr, "Input: %s\nOutput: %s\nExpected: %s\n", + input, output, expect); + free(output); + return EXIT_FAILURE; + } + free(output); + return EXIT_SUCCESS; +} + +int main(void) +{ +#define tst(a, b, c) \ + do { \ + int ret = test((a), (b), (c)); \ + if (ret != EXIT_SUCCESS) \ + return ret; \ + } while (false); + + if (HX_strquote(input1, ~0U, NULL) != NULL) + return EXIT_FAILURE; + tst(input1, HXQUOTE_SQUOTE, output1a); + tst(input1, HXQUOTE_DQUOTE, output1b); + tst(input2, HXQUOTE_HTML, output2); + tst(input3, HXQUOTE_LDAPFLT, output3a); + tst(input3, HXQUOTE_LDAPRDN, output3b); + tst(input3, HXQUOTE_BASE64, output3c); + tst(input4, HXQUOTE_URIENC, output4); + return 0; +#undef tst +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libHX-3.14.1/src/tx-strchr2.cpp new/libHX-3.15/src/tx-strchr2.cpp --- old/libHX-3.14.1/src/tx-strchr2.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/libHX-3.15/src/tx-strchr2.cpp 2013-03-07 21:28:42.000000000 +0100 @@ -0,0 +1 @@ +#include "tc-strchr2.c" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libHX-3.14.1/src/tx-strquote.cpp new/libHX-3.15/src/tx-strquote.cpp --- old/libHX-3.14.1/src/tx-strquote.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/libHX-3.15/src/tx-strquote.cpp 2013-03-07 21:28:42.000000000 +0100 @@ -0,0 +1 @@ +#include "tc-strquote.c" -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
