summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog64
-rw-r--r--Makefile.am11
-rw-r--r--Makefile.in149
-rw-r--r--THANKS1
-rwxr-xr-xbuild-aux/config.guess116
-rwxr-xr-xbuild-aux/config.sub64
-rwxr-xr-xbuild-aux/install-sh21
-rw-r--r--build-aux/ltmain.sh10
-rw-r--r--config.h.in (renamed from test/config.h.in)39
-rwxr-xr-xconfigure2120
-rw-r--r--configure.ac60
-rw-r--r--doc/Mainpage.txt58
-rw-r--r--doc/Makefile.in6
-rw-r--r--include/uriparser/Uri.h318
-rw-r--r--include/uriparser/UriBase.h161
-rw-r--r--include/uriparser/UriDefsConfig.h2
-rw-r--r--m4/libtool.m413
-rw-r--r--src/UriCommon.c77
-rw-r--r--src/UriCommon.h19
-rw-r--r--src/UriMemory.c470
-rw-r--r--src/UriMemory.h59
-rw-r--r--src/UriNormalize.c165
-rw-r--r--src/UriParse.c691
-rw-r--r--src/UriQuery.c107
-rw-r--r--src/UriResolve.c69
-rw-r--r--src/UriShorten.c48
-rw-r--r--test/FourSuite.cpp689
-rw-r--r--test/FourSuite.h70
-rw-r--r--test/MemoryManagerSuite.cpp376
-rw-r--r--test/VersionSuite.cpp9
-rw-r--r--test/VersionSuite.h46
-rw-r--r--test/test.cpp1633
-rw-r--r--win32/Code_Blocks/test.cbp23
-rw-r--r--win32/MinGW/Makefile4
-rw-r--r--win32/Visual_Studio_2005/test.vcproj100
35 files changed, 5185 insertions, 2683 deletions
diff --git a/ChangeLog b/ChangeLog
index fc5be8a..3a05e7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,67 @@
+NOTE: uriparser is looking for help with a few things:
+ https://github.com/uriparser/uriparser/labels/help%20wanted
+ If you can help, please get in touch. Thanks!
+
+2018-10-27 -- 0.9.0
+
+>>>>>>>>>>>>> SECURITY >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+ * Fixed: Out-of-bounds write in uriComposeQuery* and uriComposeQueryEx*
+ Commit 864f5d4c127def386dd5cc926ad96934b297f04e
+ Thanks to Google Autofuzz team for the report!
+ * Fixed: Detect integer overflow in uriComposeQuery* and uriComposeQueryEx*
+ Commit f76275d4a91b28d687250525d3a0c5509bbd666f
+ Thanks to Google Autofuzz team for the report!
+ * Fixed: Protect uriResetUri* against acting on NULL input
+ Commit f58c25069cf4a986fe17a80c5b38687e31feb539
+>>>>>>>>>>>>> SECURITY >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+ * Fixed: Be fully compliant to C89 (Gitub #28) and C++98 in test code
+ * Fixed: Fix off-by-one in uriComposeQueryCharsRequired* and ...Ex*
+ Reported space requirements were 1 byte bigger than necessary
+ * Changed: Marked as deprecated:
+ Deprecated functions:
+ uriNormalizeSyntaxMaskRequired[AW]
+ uriParseUri[AW]
+ uriParseUriEx[AW]
+ * Added: Add convenience functions to ease user code to parse a single URI
+ New functions:
+ uriParseSingleUri[AW]
+ uriParseSingleUriEx[AW]
+ uriParseSingleUriExMm[AW]
+ * Added: Support for custom memory managers (GitHub #26, #35), see Doxygen
+ New functions (as extension of existing ones):
+ uriAddBaseUriExMm[AW]
+ uriComposeQueryMallocExMm[AW]
+ uriDissectQueryMallocExMm[AW]
+ uriFreeQueryListMm[AW]
+ uriFreeUriMembersMm[AW]
+ uriNormalizeSyntaxExMm[AW]
+ uriParseSingleUriExMm[AW]
+ uriRemoveBaseUriMm[AW]
+ New functions (for convenience):
+ uriCompleteMemoryManager
+ uriEmulateCalloc
+ uriEmulateReallocarray
+ uriTestMemoryManager
+ New error codes:
+ URI_ERROR_MEMORY_MANAGER_FAULTY
+ URI_ERROR_MEMORY_MANAGER_INCOMPLETE
+ New types:
+ UriFuncCalloc
+ UriFuncFree
+ UriFuncMalloc
+ UriFuncRealloc
+ UriFuncReallocarray
+ UriMemoryManager
+ * Added: Add non-void versions of uriNormalizeSyntaxMaskRequired*
+ New functions:
+ uriNormalizeSyntaxMaskRequiredEx[AW]
+ * Changed: Migrate test suite from CppTest to GoogleTest 1.8.1
+ * Improved: Make test suite free of memory leaks (GitHub #31)
+ Thanks to AddressSanitizer!
+ * Removed: Support for pointless define URI_SIZEDOWN (GitHub #29)
+ Related configure option --enable-sizedown has also been removed.
+ * Soname: 1:23:0
+
2018-08-18 -- 0.8.6
* Fixed: Bad/NULL .hostText.afterLast when parsing certain rather pathologic
diff --git a/Makefile.am b/Makefile.am
index 828723a..a479778 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,7 +34,7 @@ pkginclude_HEADERS = \
include/uriparser/UriIp4.h
-liburiparser_la_LDFLAGS = -version-info 1:22:0
+liburiparser_la_LDFLAGS = -version-info 1:23:0
if WIN32
liburiparser_la_LDFLAGS += -no-undefined
endif
@@ -48,6 +48,8 @@ liburiparser_la_SOURCES = \
src/UriIp4.c \
src/UriIp4Base.c \
src/UriIp4Base.h \
+ src/UriMemory.c \
+ src/UriMemory.h \
src/UriNormalize.c \
src/UriNormalizeBase.c \
src/UriNormalizeBase.h \
@@ -61,17 +63,16 @@ liburiparser_la_SOURCES = \
if URI_TEST_ENABLED
-test_uriparser_test_LDFLAGS = @CPPTEST_LIBS@
+test_uriparser_test_LDFLAGS = @GTEST_LIBS@
-test_uriparser_test_CFLAGS = @CPPTEST_CFLAGS@
+test_uriparser_test_CXXFLAGS = @GTEST_CFLAGS@
test_uriparser_test_LDADD = liburiparser.la
test_uriparser_test_SOURCES = \
test/FourSuite.cpp \
- test/FourSuite.h \
+ test/MemoryManagerSuite.cpp \
test/VersionSuite.cpp \
- test/VersionSuite.h \
test/test.cpp
endif
diff --git a/Makefile.in b/Makefile.in
index 190b353..1664414 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -108,7 +108,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/test/config.h
+CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = liburiparser.pc
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@@ -145,9 +145,10 @@ liburiparser_la_LIBADD =
am__dirstamp = $(am__leading_dot)dirstamp
am_liburiparser_la_OBJECTS = src/UriCommon.lo src/UriCompare.lo \
src/UriEscape.lo src/UriFile.lo src/UriIp4.lo \
- src/UriIp4Base.lo src/UriNormalize.lo src/UriNormalizeBase.lo \
- src/UriParse.lo src/UriParseBase.lo src/UriQuery.lo \
- src/UriRecompose.lo src/UriResolve.lo src/UriShorten.lo
+ src/UriIp4Base.lo src/UriMemory.lo src/UriNormalize.lo \
+ src/UriNormalizeBase.lo src/UriParse.lo src/UriParseBase.lo \
+ src/UriQuery.lo src/UriRecompose.lo src/UriResolve.lo \
+ src/UriShorten.lo
liburiparser_la_OBJECTS = $(am_liburiparser_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -159,19 +160,19 @@ liburiparser_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
-o $@
PROGRAMS = $(bin_PROGRAMS)
am__test_uriparser_test_SOURCES_DIST = test/FourSuite.cpp \
- test/FourSuite.h test/VersionSuite.cpp test/VersionSuite.h \
+ test/MemoryManagerSuite.cpp test/VersionSuite.cpp \
test/test.cpp
-@URI_TEST_ENABLED_TRUE@am_test_uriparser_test_OBJECTS = \
-@URI_TEST_ENABLED_TRUE@ test/FourSuite.$(OBJEXT) \
-@URI_TEST_ENABLED_TRUE@ test/VersionSuite.$(OBJEXT) \
-@URI_TEST_ENABLED_TRUE@ test/test.$(OBJEXT)
+@URI_TEST_ENABLED_TRUE@am_test_uriparser_test_OBJECTS = test/test_uriparser_test-FourSuite.$(OBJEXT) \
+@URI_TEST_ENABLED_TRUE@ test/test_uriparser_test-MemoryManagerSuite.$(OBJEXT) \
+@URI_TEST_ENABLED_TRUE@ test/test_uriparser_test-VersionSuite.$(OBJEXT) \
+@URI_TEST_ENABLED_TRUE@ test/test_uriparser_test-test.$(OBJEXT)
test_uriparser_test_OBJECTS = $(am_test_uriparser_test_OBJECTS)
@URI_TEST_ENABLED_TRUE@test_uriparser_test_DEPENDENCIES = \
@URI_TEST_ENABLED_TRUE@ liburiparser.la
test_uriparser_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
- $(AM_CXXFLAGS) $(CXXFLAGS) $(test_uriparser_test_LDFLAGS) \
- $(LDFLAGS) -o $@
+ $(test_uriparser_test_CXXFLAGS) $(CXXFLAGS) \
+ $(test_uriparser_test_LDFLAGS) $(LDFLAGS) -o $@
am_uriparse_OBJECTS = tool/uriparse-uriparse.$(OBJEXT)
uriparse_OBJECTS = $(am_uriparse_OBJECTS)
uriparse_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -189,7 +190,7 @@ AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/test
+DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
@@ -256,7 +257,8 @@ am__recursive_targets = \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
cscope check recheck distdir dist dist-all distcheck
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
+ $(LISP)config.h.in
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
@@ -453,16 +455,15 @@ TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver
TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
$(TEST_LOG_FLAGS)
DIST_SUBDIRS = . doc
-am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/liburiparser.pc.in \
- $(top_srcdir)/build-aux/compile \
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+ $(srcdir)/liburiparser.pc.in $(top_srcdir)/build-aux/compile \
$(top_srcdir)/build-aux/config.guess \
$(top_srcdir)/build-aux/config.sub \
$(top_srcdir)/build-aux/depcomp \
$(top_srcdir)/build-aux/install-sh \
$(top_srcdir)/build-aux/ltmain.sh \
$(top_srcdir)/build-aux/missing \
- $(top_srcdir)/build-aux/test-driver \
- $(top_srcdir)/test/config.h.in AUTHORS COPYING ChangeLog \
+ $(top_srcdir)/build-aux/test-driver AUTHORS COPYING ChangeLog \
THANKS build-aux/compile build-aux/config.guess \
build-aux/config.sub build-aux/depcomp build-aux/install-sh \
build-aux/ltmain.sh build-aux/missing
@@ -521,8 +522,6 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
-CPPTEST_CFLAGS = @CPPTEST_CFLAGS@
-CPPTEST_LIBS = @CPPTEST_LIBS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
@@ -543,6 +542,8 @@ FGREP = @FGREP@
GENERATE_HTMLHELP = @GENERATE_HTMLHELP@
GRAPHVIZ_CHECK = @GRAPHVIZ_CHECK@
GREP = @GREP@
+GTEST_CFLAGS = @GTEST_CFLAGS@
+GTEST_LIBS = @GTEST_LIBS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -655,7 +656,7 @@ pkginclude_HEADERS = \
include/uriparser/UriDefsUnicode.h \
include/uriparser/UriIp4.h
-liburiparser_la_LDFLAGS = -version-info 1:22:0 $(am__append_1)
+liburiparser_la_LDFLAGS = -version-info 1:23:0 $(am__append_1)
liburiparser_la_SOURCES = \
src/UriCommon.c \
src/UriCommon.h \
@@ -665,6 +666,8 @@ liburiparser_la_SOURCES = \
src/UriIp4.c \
src/UriIp4Base.c \
src/UriIp4Base.h \
+ src/UriMemory.c \
+ src/UriMemory.h \
src/UriNormalize.c \
src/UriNormalizeBase.c \
src/UriNormalizeBase.h \
@@ -676,14 +679,13 @@ liburiparser_la_SOURCES = \
src/UriResolve.c \
src/UriShorten.c
-@URI_TEST_ENABLED_TRUE@test_uriparser_test_LDFLAGS = @CPPTEST_LIBS@
-@URI_TEST_ENABLED_TRUE@test_uriparser_test_CFLAGS = @CPPTEST_CFLAGS@
+@URI_TEST_ENABLED_TRUE@test_uriparser_test_LDFLAGS = @GTEST_LIBS@
+@URI_TEST_ENABLED_TRUE@test_uriparser_test_CXXFLAGS = @GTEST_CFLAGS@
@URI_TEST_ENABLED_TRUE@test_uriparser_test_LDADD = liburiparser.la
@URI_TEST_ENABLED_TRUE@test_uriparser_test_SOURCES = \
@URI_TEST_ENABLED_TRUE@ test/FourSuite.cpp \
-@URI_TEST_ENABLED_TRUE@ test/FourSuite.h \
+@URI_TEST_ENABLED_TRUE@ test/MemoryManagerSuite.cpp \
@URI_TEST_ENABLED_TRUE@ test/VersionSuite.cpp \
-@URI_TEST_ENABLED_TRUE@ test/VersionSuite.h \
@URI_TEST_ENABLED_TRUE@ test/test.cpp
EXTRA_DIST = \
@@ -707,7 +709,8 @@ EXTRA_DIST = \
win32/Visual_Studio_2005/uriparser.sln \
win32/Visual_Studio_2005/uriparser.vcproj
-all: all-recursive
+all: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
.SUFFIXES: .c .cpp .lo .log .o .obj .test .test$(EXEEXT) .trs
@@ -745,20 +748,20 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
-test/config.h: test/stamp-h1
- @test -f $@ || rm -f test/stamp-h1
- @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) test/stamp-h1
+config.h: stamp-h1
+ @test -f $@ || rm -f stamp-h1
+ @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
-test/stamp-h1: $(top_srcdir)/test/config.h.in $(top_builddir)/config.status
- @rm -f test/stamp-h1
- cd $(top_builddir) && $(SHELL) ./config.status test/config.h
-$(top_srcdir)/test/config.h.in: $(am__configure_deps)
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
- rm -f test/stamp-h1
+ rm -f stamp-h1
touch $@
distclean-hdr:
- -rm -f test/config.h test/stamp-h1
+ -rm -f config.h stamp-h1
liburiparser.pc: $(top_builddir)/config.status $(srcdir)/liburiparser.pc.in
cd $(top_builddir) && $(SHELL) ./config.status $@
@@ -808,6 +811,7 @@ src/UriEscape.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/UriFile.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/UriIp4.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/UriIp4Base.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/UriMemory.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/UriNormalize.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/UriNormalizeBase.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
@@ -884,11 +888,13 @@ test/$(am__dirstamp):
test/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) test/$(DEPDIR)
@: > test/$(DEPDIR)/$(am__dirstamp)
-test/FourSuite.$(OBJEXT): test/$(am__dirstamp) \
+test/test_uriparser_test-FourSuite.$(OBJEXT): test/$(am__dirstamp) \
test/$(DEPDIR)/$(am__dirstamp)
-test/VersionSuite.$(OBJEXT): test/$(am__dirstamp) \
+test/test_uriparser_test-MemoryManagerSuite.$(OBJEXT): \
+ test/$(am__dirstamp) test/$(DEPDIR)/$(am__dirstamp)
+test/test_uriparser_test-VersionSuite.$(OBJEXT): test/$(am__dirstamp) \
test/$(DEPDIR)/$(am__dirstamp)
-test/test.$(OBJEXT): test/$(am__dirstamp) \
+test/test_uriparser_test-test.$(OBJEXT): test/$(am__dirstamp) \
test/$(DEPDIR)/$(am__dirstamp)
test/uriparser_test$(EXEEXT): $(test_uriparser_test_OBJECTS) $(test_uriparser_test_DEPENDENCIES) $(EXTRA_test_uriparser_test_DEPENDENCIES) test/$(am__dirstamp)
@@ -923,6 +929,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/UriFile.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/UriIp4.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/UriIp4Base.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/UriMemory.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/UriNormalize.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/UriNormalizeBase.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/UriParse.Plo@am__quote@
@@ -931,9 +938,10 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/UriRecompose.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/UriResolve.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/UriShorten.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/FourSuite.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/VersionSuite.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/test_uriparser_test-FourSuite.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/test_uriparser_test-MemoryManagerSuite.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/test_uriparser_test-VersionSuite.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/test_uriparser_test-test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tool/$(DEPDIR)/uriparse-uriparse.Po@am__quote@
.c.o:
@@ -998,6 +1006,62 @@ tool/uriparse-uriparse.obj: tool/uriparse.c
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
+test/test_uriparser_test-FourSuite.o: test/FourSuite.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_uriparser_test_CXXFLAGS) $(CXXFLAGS) -MT test/test_uriparser_test-FourSuite.o -MD -MP -MF test/$(DEPDIR)/test_uriparser_test-FourSuite.Tpo -c -o test/test_uriparser_test-FourSuite.o `test -f 'test/FourSuite.cpp' || echo '$(srcdir)/'`test/FourSuite.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) test/$(DEPDIR)/test_uriparser_test-FourSuite.Tpo test/$(DEPDIR)/test_uriparser_test-FourSuite.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test/FourSuite.cpp' object='test/test_uriparser_test-FourSuite.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_uriparser_test_CXXFLAGS) $(CXXFLAGS) -c -o test/test_uriparser_test-FourSuite.o `test -f 'test/FourSuite.cpp' || echo '$(srcdir)/'`test/FourSuite.cpp
+
+test/test_uriparser_test-FourSuite.obj: test/FourSuite.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_uriparser_test_CXXFLAGS) $(CXXFLAGS) -MT test/test_uriparser_test-FourSuite.obj -MD -MP -MF test/$(DEPDIR)/test_uriparser_test-FourSuite.Tpo -c -o test/test_uriparser_test-FourSuite.obj `if test -f 'test/FourSuite.cpp'; then $(CYGPATH_W) 'test/FourSuite.cpp'; else $(CYGPATH_W) '$(srcdir)/test/FourSuite.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) test/$(DEPDIR)/test_uriparser_test-FourSuite.Tpo test/$(DEPDIR)/test_uriparser_test-FourSuite.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test/FourSuite.cpp' object='test/test_uriparser_test-FourSuite.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_uriparser_test_CXXFLAGS) $(CXXFLAGS) -c -o test/test_uriparser_test-FourSuite.obj `if test -f 'test/FourSuite.cpp'; then $(CYGPATH_W) 'test/FourSuite.cpp'; else $(CYGPATH_W) '$(srcdir)/test/FourSuite.cpp'; fi`
+
+test/test_uriparser_test-MemoryManagerSuite.o: test/MemoryManagerSuite.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_uriparser_test_CXXFLAGS) $(CXXFLAGS) -MT test/test_uriparser_test-MemoryManagerSuite.o -MD -MP -MF test/$(DEPDIR)/test_uriparser_test-MemoryManagerSuite.Tpo -c -o test/test_uriparser_test-MemoryManagerSuite.o `test -f 'test/MemoryManagerSuite.cpp' || echo '$(srcdir)/'`test/MemoryManagerSuite.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) test/$(DEPDIR)/test_uriparser_test-MemoryManagerSuite.Tpo test/$(DEPDIR)/test_uriparser_test-MemoryManagerSuite.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test/MemoryManagerSuite.cpp' object='test/test_uriparser_test-MemoryManagerSuite.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_uriparser_test_CXXFLAGS) $(CXXFLAGS) -c -o test/test_uriparser_test-MemoryManagerSuite.o `test -f 'test/MemoryManagerSuite.cpp' || echo '$(srcdir)/'`test/MemoryManagerSuite.cpp
+
+test/test_uriparser_test-MemoryManagerSuite.obj: test/MemoryManagerSuite.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_uriparser_test_CXXFLAGS) $(CXXFLAGS) -MT test/test_uriparser_test-MemoryManagerSuite.obj -MD -MP -MF test/$(DEPDIR)/test_uriparser_test-MemoryManagerSuite.Tpo -c -o test/test_uriparser_test-MemoryManagerSuite.obj `if test -f 'test/MemoryManagerSuite.cpp'; then $(CYGPATH_W) 'test/MemoryManagerSuite.cpp'; else $(CYGPATH_W) '$(srcdir)/test/MemoryManagerSuite.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) test/$(DEPDIR)/test_uriparser_test-MemoryManagerSuite.Tpo test/$(DEPDIR)/test_uriparser_test-MemoryManagerSuite.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test/MemoryManagerSuite.cpp' object='test/test_uriparser_test-MemoryManagerSuite.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_uriparser_test_CXXFLAGS) $(CXXFLAGS) -c -o test/test_uriparser_test-MemoryManagerSuite.obj `if test -f 'test/MemoryManagerSuite.cpp'; then $(CYGPATH_W) 'test/MemoryManagerSuite.cpp'; else $(CYGPATH_W) '$(srcdir)/test/MemoryManagerSuite.cpp'; fi`
+
+test/test_uriparser_test-VersionSuite.o: test/VersionSuite.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_uriparser_test_CXXFLAGS) $(CXXFLAGS) -MT test/test_uriparser_test-VersionSuite.o -MD -MP -MF test/$(DEPDIR)/test_uriparser_test-VersionSuite.Tpo -c -o test/test_uriparser_test-VersionSuite.o `test -f 'test/VersionSuite.cpp' || echo '$(srcdir)/'`test/VersionSuite.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) test/$(DEPDIR)/test_uriparser_test-VersionSuite.Tpo test/$(DEPDIR)/test_uriparser_test-VersionSuite.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test/VersionSuite.cpp' object='test/test_uriparser_test-VersionSuite.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_uriparser_test_CXXFLAGS) $(CXXFLAGS) -c -o test/test_uriparser_test-VersionSuite.o `test -f 'test/VersionSuite.cpp' || echo '$(srcdir)/'`test/VersionSuite.cpp
+
+test/test_uriparser_test-VersionSuite.obj: test/VersionSuite.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_uriparser_test_CXXFLAGS) $(CXXFLAGS) -MT test/test_uriparser_test-VersionSuite.obj -MD -MP -MF test/$(DEPDIR)/test_uriparser_test-VersionSuite.Tpo -c -o test/test_uriparser_test-VersionSuite.obj `if test -f 'test/VersionSuite.cpp'; then $(CYGPATH_W) 'test/VersionSuite.cpp'; else $(CYGPATH_W) '$(srcdir)/test/VersionSuite.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) test/$(DEPDIR)/test_uriparser_test-VersionSuite.Tpo test/$(DEPDIR)/test_uriparser_test-VersionSuite.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test/VersionSuite.cpp' object='test/test_uriparser_test-VersionSuite.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_uriparser_test_CXXFLAGS) $(CXXFLAGS) -c -o test/test_uriparser_test-VersionSuite.obj `if test -f 'test/VersionSuite.cpp'; then $(CYGPATH_W) 'test/VersionSuite.cpp'; else $(CYGPATH_W) '$(srcdir)/test/VersionSuite.cpp'; fi`
+
+test/test_uriparser_test-test.o: test/test.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_uriparser_test_CXXFLAGS) $(CXXFLAGS) -MT test/test_uriparser_test-test.o -MD -MP -MF test/$(DEPDIR)/test_uriparser_test-test.Tpo -c -o test/test_uriparser_test-test.o `test -f 'test/test.cpp' || echo '$(srcdir)/'`test/test.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) test/$(DEPDIR)/test_uriparser_test-test.Tpo test/$(DEPDIR)/test_uriparser_test-test.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test/test.cpp' object='test/test_uriparser_test-test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_uriparser_test_CXXFLAGS) $(CXXFLAGS) -c -o test/test_uriparser_test-test.o `test -f 'test/test.cpp' || echo '$(srcdir)/'`test/test.cpp
+
+test/test_uriparser_test-test.obj: test/test.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_uriparser_test_CXXFLAGS) $(CXXFLAGS) -MT test/test_uriparser_test-test.obj -MD -MP -MF test/$(DEPDIR)/test_uriparser_test-test.Tpo -c -o test/test_uriparser_test-test.obj `if test -f 'test/test.cpp'; then $(CYGPATH_W) 'test/test.cpp'; else $(CYGPATH_W) '$(srcdir)/test/test.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) test/$(DEPDIR)/test_uriparser_test-test.Tpo test/$(DEPDIR)/test_uriparser_test-test.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test/test.cpp' object='test/test_uriparser_test-test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_uriparser_test_CXXFLAGS) $(CXXFLAGS) -c -o test/test_uriparser_test-test.obj `if test -f 'test/test.cpp'; then $(CYGPATH_W) 'test/test.cpp'; else $(CYGPATH_W) '$(srcdir)/test/test.cpp'; fi`
+
mostlyclean-libtool:
-rm -f *.lo
@@ -1510,7 +1574,8 @@ check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-recursive
-all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) $(HEADERS)
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) $(HEADERS) \
+ config.h
install-binPROGRAMS: install-libLTLIBRARIES
installdirs: installdirs-recursive
@@ -1632,7 +1697,7 @@ ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES \
uninstall-pkgconfigDATA uninstall-pkgincludeHEADERS
-.MAKE: $(am__recursive_targets) check-am install-am install-strip
+.MAKE: $(am__recursive_targets) all check-am install-am install-strip
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
am--refresh check check-TESTS check-am clean clean-binPROGRAMS \
diff --git a/THANKS b/THANKS
index 1f2ca8d..8105c94 100644
--- a/THANKS
+++ b/THANKS
@@ -30,6 +30,7 @@ Michael Anthony Puls II
Michelino Chionchio
Michel Zou
Mo McRoberts
+Periklis Akritidis
Philip de Nier
Radu Hociung
Ralf S. Engelschall
diff --git a/build-aux/config.guess b/build-aux/config.guess
index 83e1e95..3ecb90b 100755
--- a/build-aux/config.guess
+++ b/build-aux/config.guess
@@ -1,8 +1,8 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright 1992-2017 Free Software Foundation, Inc.
+# Copyright 1992-2018 Free Software Foundation, Inc.
-timestamp='2017-01-01'
+timestamp='2018-01-01'
# 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 @@ timestamp='2017-01-01'
# 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 <http://www.gnu.org/licenses/>.
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
#
# 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 @@ timestamp='2017-01-01'
# 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 <config-patches@gnu.org>.
@@ -39,7 +39,7 @@ Usage: $0 [OPTION]
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 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright 1992-2017 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."
@@ -244,6 +244,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
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}
exit ;;
@@ -259,6 +262,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*: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)
@@ -315,15 +324,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
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 ;;
@@ -485,13 +485,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
#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);
@@ -614,7 +614,7 @@ EOF
*: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
@@ -635,8 +635,8 @@ EOF
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 ;;
+ 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`
@@ -749,7 +749,7 @@ EOF
{ 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 +758,7 @@ EOF
*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:*:*)
@@ -837,10 +837,11 @@ EOF
UNAME_PROCESSOR=`/usr/bin/uname -p`
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
@@ -854,10 +855,6 @@ EOF
*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
- i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
- exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
@@ -873,27 +870,12 @@ EOF
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
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/[^.]*//'`
exit ;;
@@ -1107,7 +1089,7 @@ EOF
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit ;;
- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ 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}
@@ -1314,14 +1296,21 @@ EOF
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
@@ -1345,15 +1334,18 @@ EOF
*:QNX:*:4*)
echo i386-pc-qnx
exit ;;
- NEO-?:NONSTOP_KERNEL:*:*)
+ NEO-*:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
- NSR-?:NONSTOP_KERNEL:*:*)
+ NSR-*:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit ;;
+ NSX-*:NONSTOP_KERNEL:*:*)
+ echo nsx-tandem-nsk${UNAME_RELEASE}
+ exit ;;
*:NonStop-UX:*:*)
echo mips-compaq-nonstopux
exit ;;
@@ -1425,16 +1417,28 @@ EOF
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 <<EOF
+
+NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
+the system type. Please install a C compiler and try again.
+EOF
+ ;;
+esac
+
cat >&2 <<EOF
-$0: unable to guess system type
This script (version $timestamp), has failed to recognize the
-operating system you are using. If your script is old, overwrite
-config.guess and config.sub with the latest versions from:
+operating system you are using. If your script is old, overwrite *all*
+copies of config.guess and config.sub with the latest versions 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
and
- 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
If $0 has already been updated, send the following data and any
information you think might be pertinent to config-patches@gnu.org to
@@ -1466,7 +1470,7 @@ EOF
exit 1
# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'write-file-functions 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
diff --git a/build-aux/config.sub b/build-aux/config.sub
index 1ecabe4..47515cc 100755
--- a/build-aux/config.sub
+++ b/build-aux/config.sub
@@ -1,8 +1,8 @@
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright 1992-2017 Free Software Foundation, Inc.
+# Copyright 1992-2018 Free Software Foundation, Inc.
-timestamp='2017-01-01'
+timestamp='2018-01-01'
# 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 @@ timestamp='2017-01-01'
# 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 <http://www.gnu.org/licenses/>.
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
#
# 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 @@ timestamp='2017-01-01'
# 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 @@ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
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 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright 1992-2017 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."
@@ -229,9 +229,6 @@ case $os in
-ptx*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
-psos*)
os=-psos
;;
@@ -263,7 +260,7 @@ case $basic_machine in
| fido | fr30 | frv | ft32 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
- | i370 | i860 | i960 | ia64 \
+ | i370 | i860 | i960 | ia16 | ia64 \
| ip2k | iq2000 \
| k1om \
| le32 | le64 \
@@ -315,7 +312,7 @@ case $basic_machine in
| ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| visium \
- | we32k \
+ | wasm32 \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
basic_machine=$basic_machine-unknown
@@ -388,7 +385,7 @@ case $basic_machine in
| 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-* \
@@ -446,6 +443,7 @@ case $basic_machine in
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
| visium-* \
+ | wasm32-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
@@ -641,7 +639,7 @@ case $basic_machine in
basic_machine=rs6000-bull
os=-bosx
;;
- dpx2* | dpx2*-bull)
+ dpx2*)
basic_machine=m68k-bull
os=-sysv3
;;
@@ -921,7 +919,7 @@ case $basic_machine in
basic_machine=v70-nec
os=-sysv
;;
- next | m*-next )
+ next | m*-next)
basic_machine=m68k-next
case $os in
-nextstep* )
@@ -966,6 +964,9 @@ case $basic_machine in
nsr-tandem)
basic_machine=nsr-tandem
;;
+ nsx-tandem)
+ basic_machine=nsx-tandem
+ ;;
op50n-* | op60c-*)
basic_machine=hppa1.1-oki
os=-proelf
@@ -1261,6 +1262,9 @@ case $basic_machine in
basic_machine=a29k-wrs
os=-vxworks
;;
+ wasm32)
+ basic_machine=wasm32-unknown
+ ;;
w65*)
basic_machine=w65-wdc
os=-none
@@ -1269,6 +1273,9 @@ case $basic_machine in
basic_machine=hppa1.1-winbond
os=-proelf
;;
+ x64)
+ basic_machine=x86_64-pc
+ ;;
xbox)
basic_machine=i686-pc
os=-mingw32
@@ -1376,8 +1383,8 @@ esac
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
@@ -1397,9 +1404,9 @@ case $os in
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
- # First accept the basic system types.
+ # 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]*\
@@ -1427,7 +1434,7 @@ case $os in
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
- | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*)
+ | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1502,7 +1509,7 @@ case $os in
-nova*)
os=-rtmk-nova
;;
- -ns2 )
+ -ns2)
os=-nextstep2
;;
-nsk*)
@@ -1557,6 +1564,19 @@ case $os in
-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)
@@ -1704,7 +1724,7 @@ case $basic_machine in
m88k-omron*)
os=-luna
;;
- *-next )
+ *-next)
os=-nextstep
;;
*-sequent)
@@ -1839,7 +1859,7 @@ echo $basic_machine$os
exit
# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'write-file-functions 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
diff --git a/build-aux/install-sh b/build-aux/install-sh
index 0360b79..c143b86 100755
--- a/build-aux/install-sh
+++ b/build-aux/install-sh
@@ -324,34 +324,41 @@ do
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
+ # $RANDOM is not portable (e.g. dash); use it when possible 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
+ # As "mkdir -p" follows symlinks and we work in /tmp possibly; so
+ # create the $tmpdir first (and fail if unsuccessful) to make sure
+ # that nobody tries to guess the $tmpdir name.
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;;
diff --git a/build-aux/ltmain.sh b/build-aux/ltmain.sh
index b2549ee..e774ddf 100644
--- a/build-aux/ltmain.sh
+++ b/build-aux/ltmain.sh
@@ -7127,6 +7127,16 @@ func_mode_link ()
*" $arg "*) ;;
* ) func_append new_inherited_linker_flags " $arg" ;;
esac
+
+ # As we are forced to pass -nostdlib to g++ during linking, the option
+ # -pthread{,s} is not in effect; add the -lpthread to $deplist
+ # explicitly to link correctly.
+ if test "$tagname" = CXX -a x"$with_gcc" = xyes; then
+ case "$arg" in
+ -pthread*) func_append deplibs " -lpthread" ;;
+ esac
+ fi
+
continue
;;
diff --git a/test/config.h.in b/config.h.in
index b81315e..d77467e 100644
--- a/test/config.h.in
+++ b/config.h.in
@@ -1,4 +1,4 @@
-/* test/config.h.in. Generated from configure.ac by autoheader. */
+/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
@@ -9,6 +9,9 @@
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
+/* Define to 1 if you have the `reallocarray' function. */
+#undef HAVE_REALLOCARRAY
+
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
@@ -30,7 +33,7 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
-/* Define if your C runtime provides the wprintf function. */
+/* Define to 1 if you have the `wprintf' function. */
#undef HAVE_WPRINTF
/* Define to the sub-directory where libtool stores uninstalled libraries. */
@@ -60,5 +63,37 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
+/* Enable extensions on AIX 3, Interix. */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris. */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop. */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
/* Version number of package */
#undef VERSION
+
+/* Define to 1 if on MINIX. */
+#undef _MINIX
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+ this defined. */
+#undef _POSIX_1_SOURCE
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#undef _POSIX_SOURCE
diff --git a/configure b/configure
index 5ee2f56..0700592 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,8 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for uriparser 0.8.6.
+# Generated by GNU Autoconf 2.69 for uriparser 0.9.0.
+#
+# Report bugs to <https://github.com/uriparser/uriparser/issues>.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -196,6 +198,7 @@ test -x / || exit 1"
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1
test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
@@ -203,8 +206,7 @@ test -x / || exit 1"
ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
PATH=/empty FPATH=/empty; export PATH FPATH
test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
- || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1
-test \$(( 1 + 1 )) = 2 || exit 1"
+ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1"
if (eval "$as_required") 2>/dev/null; then :
as_have_required=yes
else
@@ -272,10 +274,11 @@ fi
$as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
else
- $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
-$0: including any error possibly output before this
-$0: message. Then install a modern shell, or manually run
-$0: the script under such a shell if you do have one."
+ $as_echo "$0: Please tell bug-autoconf@gnu.org and
+$0: https://github.com/uriparser/uriparser/issues about
+$0: your system, including any error possibly output before
+$0: this message. Then install a modern shell, or manually
+$0: run the script under such a shell if you do have one."
fi
exit 1
fi
@@ -587,10 +590,10 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='uriparser'
PACKAGE_TARNAME='uriparser'
-PACKAGE_VERSION='0.8.6'
-PACKAGE_STRING='uriparser 0.8.6'
-PACKAGE_BUGREPORT=''
-PACKAGE_URL=''
+PACKAGE_VERSION='0.9.0'
+PACKAGE_STRING='uriparser 0.9.0'
+PACKAGE_BUGREPORT='https://github.com/uriparser/uriparser/issues'
+PACKAGE_URL='https://uriparser.github.io/'
# Factoring default headers for most tests.
ac_includes_default="\
@@ -639,8 +642,8 @@ QHG_LOCATION
GENERATE_HTMLHELP
GRAPHVIZ_CHECK
DOXY_CHECK
-CPPTEST_LIBS
-CPPTEST_CFLAGS
+GTEST_LIBS
+GTEST_CFLAGS
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
PKG_CONFIG
@@ -649,7 +652,6 @@ URI_TEST_ENABLED_TRUE
WIN32_FALSE
WIN32_TRUE
CXXCPP
-CPP
LT_SYS_LIBRARY_PATH
OTOOL64
OTOOL
@@ -668,8 +670,6 @@ ac_ct_DUMPBIN
DUMPBIN
LD
FGREP
-EGREP
-GREP
SED
host_os
host_vendor
@@ -686,6 +686,9 @@ CXXDEPMODE
ac_ct_CXX
CXXFLAGS
CXX
+EGREP
+GREP
+CPP
am__fastdepCC_FALSE
am__fastdepCC_TRUE
CCDEPMODE
@@ -781,7 +784,6 @@ with_aix_soname
with_gnu_ld
with_sysroot
enable_libtool_lock
-enable_sizedown
enable_test
enable_char
enable_wchar_t
@@ -795,17 +797,17 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
+CPP
CXX
CXXFLAGS
CCC
LT_SYS_LIBRARY_PATH
-CPP
CXXCPP
PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
-CPPTEST_CFLAGS
-CPPTEST_LIBS'
+GTEST_CFLAGS
+GTEST_LIBS'
# Initialize some variables set by options.
@@ -1346,7 +1348,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures uriparser 0.8.6 to adapt to many kinds of systems.
+\`configure' configures uriparser 0.9.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1416,7 +1418,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of uriparser 0.8.6:";;
+ short | recursive ) echo "Configuration of uriparser 0.9.0:";;
esac
cat <<\_ACEOF
@@ -1438,9 +1440,7 @@ Optional Features:
==============================================================================
Extra options:
- --enable-sizedown save space whereever possible
- (resulting in slower code)
- --disable-test disable 'make check' and libcpptest dependency
+ --disable-test disable 'make check' and libgtest dependency
--disable-char disable code for type char *
--disable-wchar_t disable code for type wchar_t *
--disable-doc disable generation of API documentation with Doxygen
@@ -1466,26 +1466,26 @@ Some influential environment variables:
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
+ CPP C preprocessor
CXX C++ compiler command
CXXFLAGS C++ compiler flags
LT_SYS_LIBRARY_PATH
User-defined run-time library search path.
- CPP C preprocessor
CXXCPP C++ preprocessor
PKG_CONFIG path to pkg-config utility
PKG_CONFIG_PATH
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
- CPPTEST_CFLAGS
- C compiler flags for CPPTEST, overriding pkg-config
- CPPTEST_LIBS
- linker flags for CPPTEST, overriding pkg-config
+ GTEST_CFLAGS
+ C compiler flags for GTEST, overriding pkg-config
+ GTEST_LIBS linker flags for GTEST, overriding pkg-config
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
-Report bugs to the package provider.
+Report bugs to <https://github.com/uriparser/uriparser/issues>.
+uriparser home page: <https://uriparser.github.io/>.
_ACEOF
ac_status=$?
fi
@@ -1548,7 +1548,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-uriparser configure 0.8.6
+uriparser configure 0.9.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1600,21 +1600,20 @@ fi
} # ac_fn_c_try_compile
-# ac_fn_cxx_try_compile LINENO
-# ----------------------------
-# Try to compile conftest.$ac_ext, and return whether this succeeded.
-ac_fn_cxx_try_compile ()
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- rm -f conftest.$ac_objext
- if { { ac_try="$ac_compile"
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_compile") 2>conftest.err
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
@@ -1622,29 +1621,120 @@ $as_echo "$ac_try_echo"; } >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } && {
- test -z "$ac_cxx_werror_flag" ||
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
- } && test -s conftest.$ac_objext; then :
+ }; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_retval=1
+ ac_retval=1
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
-} # ac_fn_cxx_try_compile
+} # ac_fn_c_try_cpp
-# ac_fn_c_try_link LINENO
-# -----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_link ()
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if eval \${$3+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ------------------------------------------------------------ ##
+## Report this to https://github.com/uriparser/uriparser/issues ##
+## ------------------------------------------------------------ ##"
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- rm -f conftest.$ac_objext conftest$ac_exeext
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
@@ -1652,37 +1742,33 @@ case "(($ac_try" in
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_link") 2>conftest.err
+ (eval "$ac_link") 2>&5
ac_status=$?
- if test -s conftest.err; then
- grep -v '^ *+' conftest.err >conftest.er1
- cat conftest.er1 >&5
- mv -f conftest.er1 conftest.err
- fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- test -x conftest$ac_exeext
- }; then :
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then :
ac_retval=0
else
- $as_echo "$as_me: failed program was:" >&5
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+ $as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_retval=1
+ ac_retval=$ac_status
fi
- # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
- # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
- # interfere with the next link command; also delete a directory that is
- # left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
-} # ac_fn_c_try_link
+} # ac_fn_c_try_run
# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
@@ -1715,20 +1801,21 @@ $as_echo "$ac_res" >&6; }
} # ac_fn_c_check_header_compile
-# ac_fn_c_try_cpp LINENO
-# ----------------------
-# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_cpp ()
+# ac_fn_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if { { ac_try="$ac_cpp conftest.$ac_ext"
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ (eval "$ac_compile") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
@@ -1736,29 +1823,29 @@ $as_echo "$ac_try_echo"; } >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } > conftest.i && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test $ac_status = 0; } && {
+ test -z "$ac_cxx_werror_flag" ||
test ! -s conftest.err
- }; then :
+ } && test -s conftest.$ac_objext; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_retval=1
+ ac_retval=1
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
-} # ac_fn_c_try_cpp
+} # ac_fn_cxx_try_compile
-# ac_fn_c_try_run LINENO
-# ----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
-# that executables *can* be run.
-ac_fn_c_try_run ()
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
@@ -1766,33 +1853,37 @@ case "(($ac_try" in
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
- { { case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_try") 2>&5
+ (eval "$ac_link") 2>conftest.err
ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ test -x conftest$ac_exeext
+ }; then :
ac_retval=0
else
- $as_echo "$as_me: program exited with status $ac_status" >&5
- $as_echo "$as_me: failed program was:" >&5
+ $as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_retval=$ac_status
+ ac_retval=1
fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
-} # ac_fn_c_try_run
+} # ac_fn_c_try_link
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
@@ -1947,7 +2038,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by uriparser $as_me 0.8.6, which was
+It was created by uriparser $as_me 0.9.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2810,7 +2901,7 @@ fi
# Define the identity of the package.
PACKAGE='uriparser'
- VERSION='0.8.6'
+ VERSION='0.9.0'
cat >>confdefs.h <<_ACEOF
@@ -2906,6 +2997,69 @@ fi
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from 'make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -3753,68 +3907,1190 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-DEPDIR="${am__leading_dot}deps"
-ac_config_commands="$ac_config_commands depfiles"
+depcc="$CC" am_compiler_list=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
-am_make=${MAKE-make}
-cat > confinc << 'END'
-am__doit:
- @echo this is the am__doit target
-.PHONY: am__doit
-END
-# If we don't find an include directive, just comment out the code.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
-$as_echo_n "checking for style of include used by $am_make... " >&6; }
-am__include="#"
-am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from 'make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
- am__include=include
- am__quote=
- _am_result=GNU
- ;;
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok '-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if ${ac_cv_prog_CPP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
-# 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
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
-$as_echo "$_am_result" >&6; }
-rm -f confinc confmf
-# Check whether --enable-dependency-tracking was given.
-if test "${enable_dependency_tracking+set}" = set; then :
- enableval=$enable_dependency_tracking;
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
fi
-if test "x$enable_dependency_tracking" != xno; then
- am_depcomp="$ac_aux_dir/depcomp"
- AMDEPBACKSLASH='\'
- am__nodep='_no'
+ fi
fi
- if test "x$enable_dependency_tracking" != xno; then
- AMDEP_TRUE=
- AMDEP_FALSE='#'
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+ $as_echo_n "(cached) " >&6
else
- AMDEP_TRUE='#'
- AMDEP_FALSE=
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+ ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"
+if test "x$ac_cv_header_minix_config_h" = xyes; then :
+ MINIX=yes
+else
+ MINIX=
+fi
+
+
+ if test "$MINIX" = yes; then
+
+$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
+
+
+$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h
+
+
+$as_echo "#define _MINIX 1" >>confdefs.h
+
+ fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
+$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
+if ${ac_cv_safe_to_define___extensions__+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+# define __EXTENSIONS__ 1
+ $ac_includes_default
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_safe_to_define___extensions__=yes
+else
+ ac_cv_safe_to_define___extensions__=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5
+$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
+ test $ac_cv_safe_to_define___extensions__ = yes &&
+ $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h
+
+ $as_echo "#define _ALL_SOURCE 1" >>confdefs.h
+
+ $as_echo "#define _GNU_SOURCE 1" >>confdefs.h
+
+ $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
+
+ $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
+$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
+if ${am_cv_prog_cc_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ # Make sure it works both with $CC and with simple cc.
+ # Following AC_PROG_CC_C_O, we do the test twice because some
+ # compilers refuse to overwrite an existing .o file with -o,
+ # though they will create one.
+ am_cv_prog_cc_c_o=yes
+ for am_i in 1 2; do
+ if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
+ ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } \
+ && test -f conftest2.$ac_objext; then
+ : OK
+ else
+ am_cv_prog_cc_c_o=no
+ break
+ fi
+ done
+ rm -f core conftest*
+ unset am_i
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
+$as_echo "$am_cv_prog_cc_c_o" >&6; }
+if test "$am_cv_prog_cc_c_o" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
depcc="$CC" am_compiler_list=
@@ -4577,136 +5853,6 @@ Xsed="$SED -e 1s/^X//"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if ${ac_cv_path_GREP+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -z "$GREP"; then
- ac_path_GREP_found=false
- # Loop through the user's path and test for each of PROGNAME-LIST
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_prog in grep ggrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
- as_fn_executable_p "$ac_path_GREP" || continue
-# Check for GNU ac_path_GREP and select it if it is found.
- # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
- ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
- ac_count=0
- $as_echo_n 0123456789 >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- $as_echo 'GREP' >> "conftest.nl"
- "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- as_fn_arith $ac_count + 1 && ac_count=$as_val
- if test $ac_count -gt ${ac_path_GREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_GREP="$ac_path_GREP"
- ac_path_GREP_max=$ac_count
- fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
- $ac_path_GREP_found && break 3
- done
- done
- done
-IFS=$as_save_IFS
- if test -z "$ac_cv_path_GREP"; then
- as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
- fi
-else
- ac_cv_path_GREP=$GREP
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
-$as_echo "$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
-$as_echo_n "checking for egrep... " >&6; }
-if ${ac_cv_path_EGREP+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
- then ac_cv_path_EGREP="$GREP -E"
- else
- if test -z "$EGREP"; then
- ac_path_EGREP_found=false
- # Loop through the user's path and test for each of PROGNAME-LIST
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_prog in egrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
- as_fn_executable_p "$ac_path_EGREP" || continue
-# Check for GNU ac_path_EGREP and select it if it is found.
- # Check for GNU $ac_path_EGREP
-case `"$ac_path_EGREP" --version 2>&1` in
-*GNU*)
- ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
- ac_count=0
- $as_echo_n 0123456789 >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- $as_echo 'EGREP' >> "conftest.nl"
- "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- as_fn_arith $ac_count + 1 && ac_count=$as_val
- if test $ac_count -gt ${ac_path_EGREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_EGREP="$ac_path_EGREP"
- ac_path_EGREP_max=$ac_count
- fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
- $ac_path_EGREP_found && break 3
- done
- done
- done
-IFS=$as_save_IFS
- if test -z "$ac_cv_path_EGREP"; then
- as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
- fi
-else
- ac_cv_path_EGREP=$EGREP
-fi
-
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
-$as_echo "$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
-
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
$as_echo_n "checking for fgrep... " >&6; }
if ${ac_cv_path_FGREP+:} false; then :
@@ -5164,6 +6310,11 @@ else
lt_cv_sys_max_cmd_len=8192;
;;
+ mint*)
+ # On MiNT this can take a long time and run out of memory.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
amigaos*)
# On AmigaOS with pdksh, this test takes hours, literally.
# So we just punt and use a minimum line length of 8192.
@@ -5900,7 +7051,6 @@ test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
-
if test -n "$ac_tool_prefix"; then
for ac_prog in ar
do
@@ -6933,10 +8083,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- powerpcle-*linux*)
+ powerpcle-*linux*|powerpc64le-*linux*)
LD="${LD-ld} -m elf64lppc"
;;
- powerpc-*linux*)
+ powerpc-*linux*|powerpc64-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
@@ -7819,273 +8969,6 @@ func_munge_path_list ()
esac
}
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
-$as_echo_n "checking how to run the C preprocessor... " >&6; }
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
- if ${ac_cv_prog_CPP+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- # Double quotes because CPP needs to be expanded
- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
- do
- ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
-else
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether nonexistent headers
- # can be detected and how.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
- # Broken: success on invalid input.
-continue
-else
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
- break
-fi
-
- done
- ac_cv_prog_CPP=$CPP
-
-fi
- CPP=$ac_cv_prog_CPP
-else
- ac_cv_prog_CPP=$CPP
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
-$as_echo "$CPP" >&6; }
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
-else
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether nonexistent headers
- # can be detected and how.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
- # Broken: success on invalid input.
-continue
-else
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-
-else
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_header_stdc=yes
-else
- ac_cv_header_stdc=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then :
-
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then :
-
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then :
- :
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
- (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
- int i;
- for (i = 0; i < 256; i++)
- if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
- return 2;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-else
- ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
-
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
-do :
- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
-"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
for ac_header in dlfcn.h
do :
ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
@@ -11133,11 +12016,11 @@ darwin* | rhapsody*)
version_type=darwin
need_lib_prefix=no
need_version=no
- library_names_spec='$libname$release$major$shared_ext $libname$shared_ext'
+ library_names_spec='$libname$release$versuffix$shared_ext $libname$release$major$shared_ext $libname$shared_ext'
soname_spec='$libname$release$major$shared_ext'
shlibpath_overrides_runpath=yes
shlibpath_var=DYLD_LIBRARY_PATH
- shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+ shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`'
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
@@ -15109,11 +15992,11 @@ darwin* | rhapsody*)
version_type=darwin
need_lib_prefix=no
need_version=no
- library_names_spec='$libname$release$major$shared_ext $libname$shared_ext'
+ library_names_spec='$libname$release$versuffix$shared_ext $libname$release$major$shared_ext $libname$shared_ext'
soname_spec='$libname$release$major$shared_ext'
shlibpath_overrides_runpath=yes
shlibpath_var=DYLD_LIBRARY_PATH
- shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+ shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`'
sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
;;
@@ -15870,53 +16753,29 @@ fi
-## Check for wprintf
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for wprintf" >&5
-$as_echo_n "checking for wprintf... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
- #include <stdio.h>
- #include <wchar.h>
- int main() {
- wprintf((wchar_t *)0, 0);
- return 0;
- }
-
+## Check for functions
+for ac_func in wprintf
+do :
+ ac_fn_c_check_func "$LINENO" "wprintf" "ac_cv_func_wprintf"
+if test "x$ac_cv_func_wprintf" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_WPRINTF 1
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-
-
-$as_echo "#define HAVE_WPRINTF /**/" >>confdefs.h
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-else
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-
-
-## Option for URI_SIZEDOWN
-# Check whether --enable-sizedown was given.
-if test "${enable_sizedown+set}" = set; then :
- enableval=$enable_sizedown;
- URI_SIZE_DOWN_YESNO=${enableval}
- if test ${enableval} = yes ; then
- CPPFLAGS="${CPPFLAGS} -DURI_SIZEDOWN"
- fi
-
-else
+done
- URI_SIZE_DOWN_YESNO=no
+for ac_func in reallocarray
+do :
+ ac_fn_c_check_func "$LINENO" "reallocarray" "ac_cv_func_reallocarray"
+if test "x$ac_cv_func_reallocarray" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_REALLOCARRAY 1
+_ACEOF
fi
-
+done
+ # needs AC_USE_SYSTEM_EXTENSIONS (#define _GNU_SOURCE)
## Option --disable-test
@@ -15941,7 +16800,7 @@ fi
-## Check for CppTest
+## Check for Googletest
if test "${URI_TEST_YESNO}" = "yes"; then
@@ -16065,24 +16924,24 @@ $as_echo "no" >&6; }
fi
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CPPTEST" >&5
-$as_echo_n "checking for CPPTEST... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTEST" >&5
+$as_echo_n "checking for GTEST... " >&6; }
-if test -n "$CPPTEST_CFLAGS"; then
- pkg_cv_CPPTEST_CFLAGS="$CPPTEST_CFLAGS"
+if test -n "$GTEST_CFLAGS"; then
+ pkg_cv_GTEST_CFLAGS="$GTEST_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"
- libcpptest >= 1.1.0
+ gtest >= 1.8.1
\""; } >&5
($PKG_CONFIG --exists --print-errors "
- libcpptest >= 1.1.0
+ gtest >= 1.8.1
") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_CPPTEST_CFLAGS=`$PKG_CONFIG --cflags "
- libcpptest >= 1.1.0
+ pkg_cv_GTEST_CFLAGS=`$PKG_CONFIG --cflags "
+ gtest >= 1.8.1
" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
@@ -16091,21 +16950,21 @@ fi
else
pkg_failed=untried
fi
-if test -n "$CPPTEST_LIBS"; then
- pkg_cv_CPPTEST_LIBS="$CPPTEST_LIBS"
+if test -n "$GTEST_LIBS"; then
+ pkg_cv_GTEST_LIBS="$GTEST_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"
- libcpptest >= 1.1.0
+ gtest >= 1.8.1
\""; } >&5
($PKG_CONFIG --exists --print-errors "
- libcpptest >= 1.1.0
+ gtest >= 1.8.1
") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_CPPTEST_LIBS=`$PKG_CONFIG --libs "
- libcpptest >= 1.1.0
+ pkg_cv_GTEST_LIBS=`$PKG_CONFIG --libs "
+ gtest >= 1.8.1
" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
@@ -16127,19 +16986,19 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- CPPTEST_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "
- libcpptest >= 1.1.0
+ GTEST_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "
+ gtest >= 1.8.1
" 2>&1`
else
- CPPTEST_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "
- libcpptest >= 1.1.0
+ GTEST_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "
+ gtest >= 1.8.1
" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
- echo "$CPPTEST_PKG_ERRORS" >&5
+ echo "$GTEST_PKG_ERRORS" >&5
- as_fn_error $? "Please install libcpptest 1.1.0 or later.
+ as_fn_error $? "Please install Googletest 1.8.1 or later.
Alternatively, you could pass --disable-test to the call to configure.
However, it is not recommended to disable the test suite." "$LINENO" 5
@@ -16147,13 +17006,13 @@ elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- as_fn_error $? "Please install libcpptest 1.1.0 or later.
+ as_fn_error $? "Please install Googletest 1.8.1 or later.
Alternatively, you could pass --disable-test to the call to configure.
However, it is not recommended to disable the test suite." "$LINENO" 5
else
- CPPTEST_CFLAGS=$pkg_cv_CPPTEST_CFLAGS
- CPPTEST_LIBS=$pkg_cv_CPPTEST_LIBS
+ GTEST_CFLAGS=$pkg_cv_GTEST_CFLAGS
+ GTEST_LIBS=$pkg_cv_GTEST_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
@@ -16335,7 +17194,7 @@ ac_config_files="$ac_config_files liburiparser.pc Makefile doc/Makefile doc/Doxy
ac_config_files="$ac_config_files doc/release.sh"
-ac_config_headers="$ac_config_headers test/config.h"
+ac_config_headers="$ac_config_headers config.h"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -16470,6 +17329,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -16883,7 +17746,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by uriparser $as_me 0.8.6, which was
+This file was extended by uriparser $as_me 0.9.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -16943,13 +17806,14 @@ $config_headers
Configuration commands:
$config_commands
-Report bugs to the package provider."
+Report bugs to <https://github.com/uriparser/uriparser/issues>.
+uriparser home page: <https://uriparser.github.io/>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-uriparser config.status 0.8.6
+uriparser config.status 0.9.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -17466,7 +18330,7 @@ do
"doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
"doc/Doxyfile") CONFIG_FILES="$CONFIG_FILES doc/Doxyfile" ;;
"doc/release.sh") CONFIG_FILES="$CONFIG_FILES doc/release.sh" ;;
- "test/config.h") CONFIG_HEADERS="$CONFIG_HEADERS test/config.h" ;;
+ "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
@@ -18905,20 +19769,16 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
-cat <<CONFIG
+cat <<INFO
===========================================================================
Configuration
Prefix ............... ${prefix}
- Size down ............ ${URI_SIZE_DOWN_YESNO}
Code for char * ...... ${CHAR_YESNO}
Code for wchar_t * ... ${WCHAR_T_YESNO}
Test suite ........... ${URI_TEST_YESNO}
Documentation ........ ${URI_DOC_YESNO}
-CONFIG
-
-cat <<"INFO"
Continue with
make
make check
diff --git a/configure.ac b/configure.ac
index 2effbe9..7534c5f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,13 +1,15 @@
AC_PREREQ(2.61)
-AC_INIT([uriparser], [0.8.6])
+AC_INIT([uriparser], [0.9.0], [https://github.com/uriparser/uriparser/issues],
+ [uriparser], [https://uriparser.github.io/])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([1.10.1 foreign dist-zip dist-bzip2 no-dist-gzip subdir-objects])
AC_CONFIG_MACRO_DIR([m4])
+AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
AC_PROG_CXX
-AC_PROG_LIBTOOL
+LT_INIT
AC_HEADER_STDC
@@ -20,43 +22,17 @@ esac
AM_CONDITIONAL([WIN32], test "$WIN32" = "yes")
-## Check for wprintf
-AC_MSG_CHECKING(for wprintf)
-AC_LINK_IFELSE([AC_LANG_SOURCE([
- #include <stdio.h>
- #include <wchar.h>
- int main() {
- wprintf((wchar_t *)0, 0);
- return 0;
- }
-])],[
- AC_DEFINE([HAVE_WPRINTF],, [Define if your C runtime provides the wprintf function.])
- AC_MSG_RESULT(yes)
-],[
- AC_MSG_RESULT(no)
-])
+## Check for functions
+AC_CHECK_FUNCS([wprintf])
+AC_CHECK_FUNCS([reallocarray]) # needs AC_USE_SYSTEM_EXTENSIONS (#define _GNU_SOURCE)
-## Option for URI_SIZEDOWN
-AC_ARG_ENABLE(sizedown, [
+## Option --disable-test
+AC_ARG_ENABLE(test, [
==============================================================================
Extra options:
AS_HELP_STRING(
- [--enable-sizedown], [save space whereever possible])
-AS_HELP_STRING(
- [], [(resulting in slower code)])], [
- URI_SIZE_DOWN_YESNO=${enableval}
- if test ${enableval} = yes ; then
- CPPFLAGS="${CPPFLAGS} -DURI_SIZEDOWN"
- fi
-],[
- URI_SIZE_DOWN_YESNO=no
-])
-
-
-## Option --disable-test
-AC_ARG_ENABLE(test, [AS_HELP_STRING(
- [--disable-test], [disable 'make check' and libcpptest dependency]
+ [--disable-test], [disable 'make check' and libgtest dependency]
)], [
URI_TEST_YESNO=${enableval}
],[
@@ -65,12 +41,12 @@ AC_ARG_ENABLE(test, [AS_HELP_STRING(
AM_CONDITIONAL([URI_TEST_ENABLED], [test "${URI_TEST_YESNO}" = "yes"])
-## Check for CppTest
+## Check for Googletest
if test "${URI_TEST_YESNO}" = "yes"; then
- PKG_CHECK_MODULES([CPPTEST], [
- libcpptest >= 1.1.0
+ PKG_CHECK_MODULES([GTEST], [
+ gtest >= 1.8.1
], [], [
- AC_MSG_ERROR([Please install libcpptest 1.1.0 or later.
+ AC_MSG_ERROR([Please install Googletest 1.8.1 or later.
Alternatively, you could pass --disable-test to the call to configure.
However, it is not recommended to disable the test suite.])
])
@@ -158,23 +134,19 @@ AC_CONFIG_FILES([
doc/Doxyfile
])
AC_CONFIG_FILES([doc/release.sh], [chmod a+x doc/release.sh])
-AC_CONFIG_HEADERS([test/config.h])
+AC_CONFIG_HEADERS([config.h])
AC_OUTPUT
-cat <<CONFIG
+cat <<INFO
===========================================================================
Configuration
Prefix ............... ${prefix}
- Size down ............ ${URI_SIZE_DOWN_YESNO}
Code for char * ...... ${CHAR_YESNO}
Code for wchar_t * ... ${WCHAR_T_YESNO}
Test suite ........... ${URI_TEST_YESNO}
Documentation ........ ${URI_DOC_YESNO}
-CONFIG
-
-cat <<"INFO"
Continue with
make
make check
diff --git a/doc/Mainpage.txt b/doc/Mainpage.txt
index 173511b..bb5723c 100644
--- a/doc/Mainpage.txt
+++ b/doc/Mainpage.txt
@@ -27,50 +27,24 @@
* Parsing a URI with uriparser looks like this:
*
* @code
- * UriParserStateA state;
* UriUriA uri;
+ * const char * const uriString = "file:///home/user/song.mp3";
+ * const char * errorPos;
*
- * state.uri = &uri;
- * if (uriParseUriA(&state, "file:///home/user/song.mp3") != URI_SUCCESS) {
- * /COMMENT_HACK* Failure *COMMENT_HACK/
- * uriFreeUriMembersA(&uri);
+ * if (uriParseSingleUriA(&uri, uriString, &errorPos) != URI_SUCCESS) {
+ * /COMMENT_HACK* Failure (no need to call uriFreeUriMembersA) *COMMENT_HACK/
* ...
+ * return ...;
* }
+ *
+ * /COMMENT_HACK* Success *COMMENT_HACK/
* ...
* uriFreeUriMembersA(&uri);
* @endcode
*
* While the URI object (::UriUriA) holds information about the recognized
- * parts of the given URI string, the parser state object (::UriParserStateA)
- * keeps error code and position. This information does not belong to
- * the URI itself, which is why there are two separate objects.
- *
- * You can reuse parser state objects for parsing several URIs like this:
- *
- * @code
- * UriParserStateA state;
- * UriUriA uriOne;
- * UriUriA uriTwo;
- *
- * state.uri = &uriOne;
- * if (uriParseUriA(&state, "file:///home/user/one") != URI_SUCCESS) {
- * /COMMENT_HACK* Failure *COMMENT_HACK/
- * uriFreeUriMembersA(&uriOne);
- * ...
- * }
- * ...
- * state.uri = &uriTwo;
- * if (uriParseUriA(&state, "file:///home/user/two") != URI_SUCCESS) {
- * /COMMENT_HACK* Failure *COMMENT_HACK/
- * uriFreeUriMembersA(&uriOne);
- * uriFreeUriMembersA(&uriTwo);
- * ...
- * }
- * ...
- * uriFreeUriMembersA(&uriOne);
- * uriFreeUriMembersA(&uriTwo);
- * @endcode
- *
+ * parts of the given URI string, in case of <c>URI_ERROR_SYNTAX</c>,
+ * <c>errorPos</c> points to the first character starting invalid syntax.
*
* @subsection recomposition Recomposing URIs (from object back to string)
* According to <a href="http://tools.ietf.org/html/rfc3986#section-5.3" target="_blank">RFC 3986</a>
@@ -311,8 +285,8 @@
* uriparser comes with two versions of every structure and function:
* one handling Ansi text (char *) and one working with Unicode text (wchar_t *),
* for instance
- * - uriParseUriA() for Ansi and
- * - uriParseUriW() for Unicode.
+ * - uriParseSingleUriA() for Ansi and
+ * - uriParseSingleUriW() for Unicode.
*
* This tutorial only shows the usage of the Ansi editions but
* their Unicode counterparts work in the very same way.
@@ -322,18 +296,18 @@
* You can use the code below to make <c>./configure</c> test for presence
* of uriparser 0.6.4 or later.
*
- *<div class="fragment"><pre class="fragment">URIPARSER_MISSING=<span class="stringliteral">"Please install uriparser 0.6.4 or later.
+ *<div class="fragment"><pre class="fragment">URIPARSER_MISSING=<span class="stringliteral">"Please install uriparser 0.9.0 or later.
* On a Debian-based system enter 'sudo apt-get install liburiparser-dev'."</span>
- *AC_CHECK_LIB(uriparser, uriParseUriA,, AC_MSG_ERROR(${URIPARSER_MISSING}))
+ *AC_CHECK_LIB(uriparser, uriParseSingleUriA,, AC_MSG_ERROR(${URIPARSER_MISSING}))
*AC_CHECK_HEADER(uriparser/Uri.h,, AC_MSG_ERROR(${URIPARSER_MISSING}))
*<b></b>
- *URIPARSER_TOO_OLD=<span class="stringliteral">"uriparser 0.6.4 or later is required, your copy is too old."</span>
+ *URIPARSER_TOO_OLD=<span class="stringliteral">"uriparser 0.9.0 or later is required, your copy is too old."</span>
*AC_COMPILE_IFELSE([
*<span class="preprocessor">\#include <uriparser/Uri.h>
*\#if (defined(URI_VER_MAJOR) && defined(URI_VER_MINOR) && defined(URI_VER_RELEASE) \\<b></b>
*&& ((URI_VER_MAJOR > 0) \\<b></b>
- *|| ((URI_VER_MAJOR == 0) && (URI_VER_MINOR > 6)) \\<b></b>
- *|| ((URI_VER_MAJOR == 0) && (URI_VER_MINOR == 6) && (URI_VER_RELEASE >= 4)) \\<b></b>
+ *|| ((URI_VER_MAJOR == 0) && (URI_VER_MINOR > 9)) \\<b></b>
+ *|| ((URI_VER_MAJOR == 0) && (URI_VER_MINOR == 9) && (URI_VER_RELEASE >= 0)) \\<b></b>
*))</span>
*<span class="comment"><b></b>/<b></b>* FINE *<b></b>/</span>
*<span class="preprocessor">\#else
diff --git a/doc/Makefile.in b/doc/Makefile.in
index b8bbff5..801fbe3 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -97,7 +97,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/test/config.h
+CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = Doxyfile release.sh
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
@@ -136,8 +136,6 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
-CPPTEST_CFLAGS = @CPPTEST_CFLAGS@
-CPPTEST_LIBS = @CPPTEST_LIBS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
@@ -158,6 +156,8 @@ FGREP = @FGREP@
GENERATE_HTMLHELP = @GENERATE_HTMLHELP@
GRAPHVIZ_CHECK = @GRAPHVIZ_CHECK@
GREP = @GREP@
+GTEST_CFLAGS = @GTEST_CFLAGS@
+GTEST_LIBS = @GTEST_LIBS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
diff --git a/include/uriparser/Uri.h b/include/uriparser/Uri.h
index f4600fb..43fa206 100644
--- a/include/uriparser/Uri.h
+++ b/include/uriparser/Uri.h
@@ -1,4 +1,4 @@
-/* 5afca6d8abb5d1a22b4e28c912538e6729692afc98f089d9e538ca01c43ab805 (0.8.6+)
+/* c071c0bd2264218705abd9e6b19250adb67d6fefa4866d705b9d2f2672281001 (0.9.0+)
*
* uriparser - RFC 3986 URI parsing library
*
@@ -143,8 +143,8 @@ typedef struct URI_TYPE(HostDataStruct) {
* Represents an RFC 3986 %URI.
* Missing components can be {NULL, NULL} ranges.
*
- * @see uriParseUriA
* @see uriFreeUriMembersA
+ * @see uriFreeUriMembersMmA
* @see UriParserStateA
* @since 0.3.0
*/
@@ -173,6 +173,7 @@ typedef struct URI_TYPE(UriStruct) {
* a components absence.
*
* @see uriFreeUriMembersA
+ * @see uriFreeUriMembersMmA
* @since 0.3.0
*/
typedef struct URI_TYPE(ParserStateStruct) {
@@ -202,7 +203,8 @@ typedef struct URI_TYPE(QueryListStruct) {
/**
- * Parses a RFC 3986 URI.
+ * Parses a RFC 3986 %URI.
+ * Uses default libc-based memory manager.
*
* @param state <b>INOUT</b>: Parser state with set output %URI, must not be NULL
* @param first <b>IN</b>: Pointer to the first character to parse, must not be NULL
@@ -210,8 +212,11 @@ typedef struct URI_TYPE(QueryListStruct) {
* @return 0 on success, error code otherwise
*
* @see uriParseUriA
+ * @see uriParseSingleUriA
+ * @see uriParseSingleUriExA
* @see uriToStringA
* @since 0.3.0
+ * @deprecated Deprecated since 0.9.0, please migrate to uriParseSingleUriExA (with "Single").
*/
int URI_FUNC(ParseUriEx)(URI_TYPE(ParserState) * state,
const URI_CHAR * first, const URI_CHAR * afterLast);
@@ -220,14 +225,18 @@ int URI_FUNC(ParseUriEx)(URI_TYPE(ParserState) * state,
/**
* Parses a RFC 3986 %URI.
+ * Uses default libc-based memory manager.
*
* @param state <b>INOUT</b>: Parser state with set output %URI, must not be NULL
* @param text <b>IN</b>: Text to parse, must not be NULL
* @return 0 on success, error code otherwise
*
* @see uriParseUriExA
+ * @see uriParseSingleUriA
+ * @see uriParseSingleUriExA
* @see uriToStringA
* @since 0.3.0
+ * @deprecated Deprecated since 0.9.0, please migrate to uriParseSingleUriA (with "Single").
*/
int URI_FUNC(ParseUri)(URI_TYPE(ParserState) * state,
const URI_CHAR * text);
@@ -235,12 +244,88 @@ int URI_FUNC(ParseUri)(URI_TYPE(ParserState) * state,
/**
+ * Parses a single RFC 3986 %URI.
+ * Uses default libc-based memory manager.
+ *
+ * @param uri <b>OUT</b>: Output %URI, must not be NULL
+ * @param text <b>IN</b>: Pointer to the first character to parse,
+ * must not be NULL
+ * @param errorPos <b>OUT</b>: Pointer to a pointer to the first character
+ * causing a syntax error, can be NULL;
+ * only set when URI_ERROR_SYNTAX was returned
+ * @return 0 on success, error code otherwise
+ *
+ * @see uriParseSingleUriExA
+ * @see uriParseSingleUriExMmA
+ * @see uriToStringA
+ * @since 0.9.0
+ */
+int URI_FUNC(ParseSingleUri)(URI_TYPE(Uri) * uri, const URI_CHAR * text,
+ const URI_CHAR ** errorPos);
+
+
+
+/**
+ * Parses a single RFC 3986 %URI.
+ * Uses default libc-based memory manager.
+ *
+ * @param uri <b>OUT</b>: Output %URI, must not be NULL
+ * @param first <b>IN</b>: Pointer to the first character to parse,
+ * must not be NULL
+ * @param afterLast <b>IN</b>: Pointer to the character after the last to
+ * parse, can be NULL
+ * (to use first + strlen(first))
+ * @param errorPos <b>OUT</b>: Pointer to a pointer to the first character
+ * causing a syntax error, can be NULL;
+ * only set when URI_ERROR_SYNTAX was returned
+ * @return 0 on success, error code otherwise
+ *
+ * @see uriParseSingleUriA
+ * @see uriParseSingleUriExMmA
+ * @see uriToStringA
+ * @since 0.9.0
+ */
+int URI_FUNC(ParseSingleUriEx)(URI_TYPE(Uri) * uri,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ const URI_CHAR ** errorPos);
+
+
+
+/**
+ * Parses a single RFC 3986 %URI.
+ *
+ * @param uri <b>OUT</b>: Output %URI, must not be NULL
+ * @param first <b>IN</b>: Pointer to the first character to parse,
+ * must not be NULL
+ * @param afterLast <b>IN</b>: Pointer to the character after the last to
+ * parse, can be NULL
+ * (to use first + strlen(first))
+ * @param errorPos <b>OUT</b>: Pointer to a pointer to the first character
+ * causing a syntax error, can be NULL;
+ * only set when URI_ERROR_SYNTAX was returned
+ * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
+ * @return 0 on success, error code otherwise
+ *
+ * @see uriParseSingleUriA
+ * @see uriParseSingleUriExA
+ * @see uriToStringA
+ * @since 0.9.0
+ */
+int URI_FUNC(ParseSingleUriExMm)(URI_TYPE(Uri) * uri,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ const URI_CHAR ** errorPos, UriMemoryManager * memory);
+
+
+
+/**
* Frees all memory associated with the members
* of the %URI structure. Note that the structure
* itself is not freed, only its members.
+ * Uses default libc-based memory manager.
*
* @param uri <b>INOUT</b>: %URI structure whose members should be freed
*
+ * @see uriFreeUriMembersMmA
* @since 0.3.0
*/
void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri);
@@ -248,6 +333,23 @@ void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri);
/**
+ * Frees all memory associated with the members
+ * of the %URI structure. Note that the structure
+ * itself is not freed, only its members.
+ *
+ * @param uri <b>INOUT</b>: %URI structure whose members should be freed
+ * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
+ * @return 0 on success, error code otherwise
+ *
+ * @see uriFreeUriMembersA
+ * @since 0.9.0
+ */
+int URI_FUNC(FreeUriMembersMm)(URI_TYPE(Uri) * uri,
+ UriMemoryManager * memory);
+
+
+
+/**
* Percent-encodes all unreserved characters from the input string and
* writes the encoded version to the output string.
* Be sure to allocate <b>3 times</b> the space of the input buffer for
@@ -342,6 +444,7 @@ const URI_CHAR * URI_FUNC(UnescapeInPlace)(URI_CHAR * inout);
/**
* Performs reference resolution as described in
* <a href="http://tools.ietf.org/html/rfc3986#section-5.2.2">section 5.2.2 of RFC 3986</a>.
+ * Uses default libc-based memory manager.
* NOTE: On success you have to call uriFreeUriMembersA on \p absoluteDest manually later.
*
* @param absoluteDest <b>OUT</b>: Result %URI
@@ -349,7 +452,10 @@ const URI_CHAR * URI_FUNC(UnescapeInPlace)(URI_CHAR * inout);
* @param absoluteBase <b>IN</b>: Base %URI to apply
* @return Error code or 0 on success
*
- * @see uriRemoveBaseUriA, uriAddBaseUriExA
+ * @see uriRemoveBaseUriA
+ * @see uriRemoveBaseUriMmA
+ * @see uriAddBaseUriExA
+ * @see uriAddBaseUriExMmA
* @since 0.4.0
*/
int URI_FUNC(AddBaseUri)(URI_TYPE(Uri) * absoluteDest,
@@ -361,6 +467,7 @@ int URI_FUNC(AddBaseUri)(URI_TYPE(Uri) * absoluteDest,
/**
* Performs reference resolution as described in
* <a href="http://tools.ietf.org/html/rfc3986#section-5.2.2">section 5.2.2 of RFC 3986</a>.
+ * Uses default libc-based memory manager.
* NOTE: On success you have to call uriFreeUriMembersA on \p absoluteDest manually later.
*
* @param absoluteDest <b>OUT</b>: Result %URI
@@ -369,7 +476,9 @@ int URI_FUNC(AddBaseUri)(URI_TYPE(Uri) * absoluteDest,
* @param options <b>IN</b>: Configuration to apply
* @return Error code or 0 on success
*
- * @see uriRemoveBaseUriA, uriAddBaseUriA
+ * @see uriRemoveBaseUriA
+ * @see uriAddBaseUriA
+ * @see uriAddBaseUriExMmA
* @since 0.8.1
*/
int URI_FUNC(AddBaseUriEx)(URI_TYPE(Uri) * absoluteDest,
@@ -380,11 +489,37 @@ int URI_FUNC(AddBaseUriEx)(URI_TYPE(Uri) * absoluteDest,
/**
+ * Performs reference resolution as described in
+ * <a href="http://tools.ietf.org/html/rfc3986#section-5.2.2">section 5.2.2 of RFC 3986</a>.
+ * NOTE: On success you have to call uriFreeUriMembersMmA on \p absoluteDest manually later.
+ *
+ * @param absoluteDest <b>OUT</b>: Result %URI
+ * @param relativeSource <b>IN</b>: Reference to resolve
+ * @param absoluteBase <b>IN</b>: Base %URI to apply
+ * @param options <b>IN</b>: Configuration to apply
+ * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
+ * @return Error code or 0 on success
+ *
+ * @see uriRemoveBaseUriA
+ * @see uriRemoveBaseUriMmA
+ * @see uriAddBaseUriA
+ * @see uriAddBaseUriExA
+ * @since 0.9.0
+ */
+int URI_FUNC(AddBaseUriExMm)(URI_TYPE(Uri) * absoluteDest,
+ const URI_TYPE(Uri) * relativeSource,
+ const URI_TYPE(Uri) * absoluteBase,
+ UriResolutionOptions options, UriMemoryManager * memory);
+
+
+
+/**
* Tries to make a relative %URI (a reference) from an
* absolute %URI and a given base %URI. The resulting %URI is going to be
* relative if the absolute %URI and base %UI share both scheme and authority.
* If that is not the case, the result will still be
* an absolute URI (with scheme part if necessary).
+ * Uses default libc-based memory manager.
* NOTE: On success you have to call uriFreeUriMembersA on
* \p dest manually later.
*
@@ -394,7 +529,10 @@ int URI_FUNC(AddBaseUriEx)(URI_TYPE(Uri) * absoluteDest,
* @param domainRootMode <b>IN</b>: Create %URI with path relative to domain root
* @return Error code or 0 on success
*
- * @see uriAddBaseUriA, uriAddBaseUriExA
+ * @see uriRemoveBaseUriMmA
+ * @see uriAddBaseUriA
+ * @see uriAddBaseUriExA
+ * @see uriAddBaseUriExMmA
* @since 0.5.2
*/
int URI_FUNC(RemoveBaseUri)(URI_TYPE(Uri) * dest,
@@ -405,6 +543,35 @@ int URI_FUNC(RemoveBaseUri)(URI_TYPE(Uri) * dest,
/**
+ * Tries to make a relative %URI (a reference) from an
+ * absolute %URI and a given base %URI. The resulting %URI is going to be
+ * relative if the absolute %URI and base %UI share both scheme and authority.
+ * If that is not the case, the result will still be
+ * an absolute URI (with scheme part if necessary).
+ * NOTE: On success you have to call uriFreeUriMembersMmA on
+ * \p dest manually later.
+ *
+ * @param dest <b>OUT</b>: Result %URI
+ * @param absoluteSource <b>IN</b>: Absolute %URI to make relative
+ * @param absoluteBase <b>IN</b>: Base %URI
+ * @param domainRootMode <b>IN</b>: Create %URI with path relative to domain root
+ * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
+ * @return Error code or 0 on success
+ *
+ * @see uriRemoveBaseUriA
+ * @see uriAddBaseUriA
+ * @see uriAddBaseUriExA
+ * @see uriAddBaseUriExMmA
+ * @since 0.9.0
+ */
+int URI_FUNC(RemoveBaseUriMm)(URI_TYPE(Uri) * dest,
+ const URI_TYPE(Uri) * absoluteSource,
+ const URI_TYPE(Uri) * absoluteBase,
+ UriBool domainRootMode, UriMemoryManager * memory);
+
+
+
+/**
* Checks two URIs for equivalence. Comparison is done
* the naive way, without prior normalization.
* NOTE: Two <c>NULL</c> URIs are equal as well.
@@ -460,24 +627,48 @@ int URI_FUNC(ToString)(URI_CHAR * dest, const URI_TYPE(Uri) * uri, int maxChars,
* @return Normalization job mask
*
* @see uriNormalizeSyntaxA
+ * @see uriNormalizeSyntaxExA
+ * @see uriNormalizeSyntaxExMmA
+ * @see uriNormalizeSyntaxMaskRequiredExA
* @since 0.5.0
+ * @deprecated Deprecated since 0.9.0, please migrate to uriNormalizeSyntaxMaskRequiredExA (with "Ex").
*/
unsigned int URI_FUNC(NormalizeSyntaxMaskRequired)(const URI_TYPE(Uri) * uri);
/**
+ * Determines the components of a %URI that are not normalized.
+ *
+ * @param uri <b>IN</b>: %URI to check
+ * @param outMask <b>OUT</b>: Normalization job mask
+ * @return Error code or 0 on success
+ *
+ * @see uriNormalizeSyntaxA
+ * @see uriNormalizeSyntaxExA
+ * @see uriNormalizeSyntaxExMmA
+ * @see uriNormalizeSyntaxMaskRequiredA
+ * @since 0.9.0
+ */
+int URI_FUNC(NormalizeSyntaxMaskRequiredEx)(const URI_TYPE(Uri) * uri,
+ unsigned int * outMask);
+
+
+
+/**
* Normalizes a %URI using a normalization mask.
* The normalization mask decides what components are normalized.
*
* NOTE: If necessary the %URI becomes owner of all memory
* behind the text pointed to. Text is duplicated in that case.
+ * Uses default libc-based memory manager.
*
* @param uri <b>INOUT</b>: %URI to normalize
* @param mask <b>IN</b>: Normalization mask
* @return Error code or 0 on success
*
* @see uriNormalizeSyntaxA
+ * @see uriNormalizeSyntaxExMmA
* @see uriNormalizeSyntaxMaskRequiredA
* @since 0.5.0
*/
@@ -486,15 +677,39 @@ int URI_FUNC(NormalizeSyntaxEx)(URI_TYPE(Uri) * uri, unsigned int mask);
/**
+ * Normalizes a %URI using a normalization mask.
+ * The normalization mask decides what components are normalized.
+ *
+ * NOTE: If necessary the %URI becomes owner of all memory
+ * behind the text pointed to. Text is duplicated in that case.
+ *
+ * @param uri <b>INOUT</b>: %URI to normalize
+ * @param mask <b>IN</b>: Normalization mask
+ * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
+ * @return Error code or 0 on success
+ *
+ * @see uriNormalizeSyntaxA
+ * @see uriNormalizeSyntaxExA
+ * @see uriNormalizeSyntaxMaskRequiredA
+ * @since 0.9.0
+ */
+int URI_FUNC(NormalizeSyntaxExMm)(URI_TYPE(Uri) * uri, unsigned int mask,
+ UriMemoryManager * memory);
+
+
+
+/**
* Normalizes all components of a %URI.
*
* NOTE: If necessary the %URI becomes owner of all memory
* behind the text pointed to. Text is duplicated in that case.
+ * Uses default libc-based memory manager.
*
* @param uri <b>INOUT</b>: %URI to normalize
* @return Error code or 0 on success
*
* @see uriNormalizeSyntaxExA
+ * @see uriNormalizeSyntaxExMmA
* @see uriNormalizeSyntaxMaskRequiredA
* @since 0.5.0
*/
@@ -639,8 +854,12 @@ int URI_FUNC(ComposeQueryCharsRequiredEx)(const URI_TYPE(QueryList) * queryList,
*
* @see uriComposeQueryExA
* @see uriComposeQueryMallocA
+ * @see uriComposeQueryMallocExA
+ * @see uriComposeQueryMallocExMmA
* @see uriComposeQueryCharsRequiredA
* @see uriDissectQueryMallocA
+ * @see uriDissectQueryMallocExA
+ * @see uriDissectQueryMallocExMmA
* @since 0.7.0
*/
int URI_FUNC(ComposeQuery)(URI_CHAR * dest,
@@ -661,9 +880,13 @@ int URI_FUNC(ComposeQuery)(URI_CHAR * dest,
* @return Error code or 0 on success
*
* @see uriComposeQueryA
+ * @see uriComposeQueryMallocA
* @see uriComposeQueryMallocExA
+ * @see uriComposeQueryMallocExMmA
* @see uriComposeQueryCharsRequiredExA
+ * @see uriDissectQueryMallocA
* @see uriDissectQueryMallocExA
+ * @see uriDissectQueryMallocExMmA
* @since 0.7.0
*/
int URI_FUNC(ComposeQueryEx)(URI_CHAR * dest,
@@ -678,14 +901,18 @@ int URI_FUNC(ComposeQueryEx)(URI_CHAR * dest,
* The composed string does not start with '?',
* on the way ' ' is converted to '+' and line breaks are
* normalized to "%0D%0A".
+ * Uses default libc-based memory manager.
*
* @param dest <b>OUT</b>: Output destination
* @param queryList <b>IN</b>: Query list to convert
* @return Error code or 0 on success
*
* @see uriComposeQueryMallocExA
+ * @see uriComposeQueryMallocExMmA
* @see uriComposeQueryA
* @see uriDissectQueryMallocA
+ * @see uriDissectQueryMallocExA
+ * @see uriDissectQueryMallocExMmA
* @since 0.7.0
*/
int URI_FUNC(ComposeQueryMalloc)(URI_CHAR ** dest,
@@ -697,6 +924,7 @@ int URI_FUNC(ComposeQueryMalloc)(URI_CHAR ** dest,
* Converts a query list structure back to a query string.
* Memory for this string is allocated internally.
* The composed string does not start with '?'.
+ * Uses default libc-based memory manager.
*
* @param dest <b>OUT</b>: Output destination
* @param queryList <b>IN</b>: Query list to convert
@@ -705,8 +933,11 @@ int URI_FUNC(ComposeQueryMalloc)(URI_CHAR ** dest,
* @return Error code or 0 on success
*
* @see uriComposeQueryMallocA
+ * @see uriComposeQueryMallocExMmA
* @see uriComposeQueryExA
+ * @see uriDissectQueryMallocA
* @see uriDissectQueryMallocExA
+ * @see uriDissectQueryMallocExMmA
* @since 0.7.0
*/
int URI_FUNC(ComposeQueryMallocEx)(URI_CHAR ** dest,
@@ -716,8 +947,36 @@ int URI_FUNC(ComposeQueryMallocEx)(URI_CHAR ** dest,
/**
+ * Converts a query list structure back to a query string.
+ * Memory for this string is allocated internally.
+ * The composed string does not start with '?'.
+ *
+ * @param dest <b>OUT</b>: Output destination
+ * @param queryList <b>IN</b>: Query list to convert
+ * @param spaceToPlus <b>IN</b>: Whether to convert ' ' to '+' or not
+ * @param normalizeBreaks <b>IN</b>: Whether to convert CR and LF to CR-LF or not.
+ * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
+ * @return Error code or 0 on success
+ *
+ * @see uriComposeQueryMallocA
+ * @see uriComposeQueryMallocExA
+ * @see uriComposeQueryExA
+ * @see uriDissectQueryMallocA
+ * @see uriDissectQueryMallocExA
+ * @see uriDissectQueryMallocExMmA
+ * @since 0.9.0
+ */
+int URI_FUNC(ComposeQueryMallocExMm)(URI_CHAR ** dest,
+ const URI_TYPE(QueryList) * queryList,
+ UriBool spaceToPlus, UriBool normalizeBreaks,
+ UriMemoryManager * memory);
+
+
+
+/**
* Constructs a query list from the raw query string of a given URI.
* On the way '+' is converted back to ' ', line breaks are not modified.
+ * Uses default libc-based memory manager.
*
* @param dest <b>OUT</b>: Output destination
* @param itemCount <b>OUT</b>: Number of items found, can be NULL
@@ -726,8 +985,10 @@ int URI_FUNC(ComposeQueryMallocEx)(URI_CHAR ** dest,
* @return Error code or 0 on success
*
* @see uriDissectQueryMallocExA
+ * @see uriDissectQueryMallocExMmA
* @see uriComposeQueryA
* @see uriFreeQueryListA
+ * @see uriFreeQueryListMmA
* @since 0.7.0
*/
int URI_FUNC(DissectQueryMalloc)(URI_TYPE(QueryList) ** dest, int * itemCount,
@@ -737,6 +998,7 @@ int URI_FUNC(DissectQueryMalloc)(URI_TYPE(QueryList) ** dest, int * itemCount,
/**
* Constructs a query list from the raw query string of a given URI.
+ * Uses default libc-based memory manager.
*
* @param dest <b>OUT</b>: Output destination
* @param itemCount <b>OUT</b>: Number of items found, can be NULL
@@ -747,6 +1009,7 @@ int URI_FUNC(DissectQueryMalloc)(URI_TYPE(QueryList) ** dest, int * itemCount,
* @return Error code or 0 on success
*
* @see uriDissectQueryMallocA
+ * @see uriDissectQueryMallocExMmA
* @see uriComposeQueryExA
* @see uriFreeQueryListA
* @since 0.7.0
@@ -758,17 +1021,60 @@ int URI_FUNC(DissectQueryMallocEx)(URI_TYPE(QueryList) ** dest, int * itemCount,
/**
+ * Constructs a query list from the raw query string of a given URI.
+ *
+ * @param dest <b>OUT</b>: Output destination
+ * @param itemCount <b>OUT</b>: Number of items found, can be NULL
+ * @param first <b>IN</b>: Pointer to first character <b>after</b> '?'
+ * @param afterLast <b>IN</b>: Pointer to character after the last one still in
+ * @param plusToSpace <b>IN</b>: Whether to convert '+' to ' ' or not
+ * @param breakConversion <b>IN</b>: Line break conversion mode
+ * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
+ * @return Error code or 0 on success
+ *
+ * @see uriDissectQueryMallocA
+ * @see uriDissectQueryMallocExA
+ * @see uriComposeQueryExA
+ * @see uriFreeQueryListA
+ * @see uriFreeQueryListMmA
+ * @since 0.9.0
+ */
+int URI_FUNC(DissectQueryMallocExMm)(URI_TYPE(QueryList) ** dest, int * itemCount,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriBool plusToSpace, UriBreakConversion breakConversion,
+ UriMemoryManager * memory);
+
+
+
+/**
* Frees all memory associated with the given query list.
* The structure itself is freed as well.
*
* @param queryList <b>INOUT</b>: Query list to free
*
+ * @see uriFreeQueryListMmA
* @since 0.7.0
*/
void URI_FUNC(FreeQueryList)(URI_TYPE(QueryList) * queryList);
+/**
+ * Frees all memory associated with the given query list.
+ * The structure itself is freed as well.
+ *
+ * @param queryList <b>INOUT</b>: Query list to free
+ * @param memory <b>IN</b>: Memory manager to use, NULL for default libc
+ * @return Error code or 0 on success
+ *
+ * @see uriFreeQueryListA
+ * @since 0.9.0
+ */
+int URI_FUNC(FreeQueryListMm)(URI_TYPE(QueryList) * queryList,
+ UriMemoryManager * memory);
+
+
+
#ifdef __cplusplus
}
#endif
diff --git a/include/uriparser/UriBase.h b/include/uriparser/UriBase.h
index 0c2a5e7..f396235 100644
--- a/include/uriparser/UriBase.h
+++ b/include/uriparser/UriBase.h
@@ -54,8 +54,8 @@
/* Version */
#define URI_VER_MAJOR 0
-#define URI_VER_MINOR 8
-#define URI_VER_RELEASE 6
+#define URI_VER_MINOR 9
+#define URI_VER_RELEASE 0
#define URI_VER_SUFFIX_ANSI ""
#define URI_VER_SUFFIX_UNICODE URI_ANSI_TO_UNICODE(URI_VER_SUFFIX_ANSI)
@@ -113,6 +113,7 @@ typedef int UriBool; /**< Boolean type */
#define URI_ERROR_OUTPUT_TOO_LARGE 4 /* Some output is to large for the receiving buffer */
#define URI_ERROR_NOT_IMPLEMENTED 8 /* The called function is not implemented yet */
#define URI_ERROR_RANGE_INVALID 9 /* The parameters passed contained invalid ranges */
+#define URI_ERROR_MEMORY_MANAGER_INCOMPLETE 10 /* [>=0.9.0] The UriMemoryManager passed does not implement all needed functions */
/* Errors specific to ToString */
@@ -125,6 +126,8 @@ typedef int UriBool; /**< Boolean type */
#define URI_ERROR_REMOVEBASE_REL_BASE 6 /* Given base is not absolute */
#define URI_ERROR_REMOVEBASE_REL_SOURCE 7 /* Given base is not absolute */
+/* Error specific to uriTestMemoryManager */
+#define URI_ERROR_MEMORY_MANAGER_FAULTY 11 /* [>=0.9.0] The UriMemoryManager given did not pass the test suite */
#ifndef URI_DOXYGEN
@@ -153,6 +156,63 @@ typedef struct UriIp6Struct {
} UriIp6; /**< @copydoc UriIp6Struct */
+struct UriMemoryManagerStruct; /* foward declaration to break loop */
+
+
+/**
+ * Function signature that custom malloc(3) functions must conform to
+ *
+ * @since 0.9.0
+ */
+typedef void * (*UriFuncMalloc)(struct UriMemoryManagerStruct *, size_t);
+
+/**
+ * Function signature that custom calloc(3) functions must conform to
+ *
+ * @since 0.9.0
+ */
+typedef void * (*UriFuncCalloc)(struct UriMemoryManagerStruct *, size_t, size_t);
+
+/**
+ * Function signature that custom realloc(3) functions must conform to
+ *
+ * @since 0.9.0
+ */
+typedef void * (*UriFuncRealloc)(struct UriMemoryManagerStruct *, void *, size_t);
+
+/**
+ * Function signature that custom reallocarray(3) functions must conform to
+ *
+ * @since 0.9.0
+ */
+typedef void * (*UriFuncReallocarray)(struct UriMemoryManagerStruct *, void *, size_t, size_t);
+
+/**
+ * Function signature that custom free(3) functions must conform to
+ *
+ * @since 0.9.0
+ */
+typedef void (*UriFuncFree)(struct UriMemoryManagerStruct *, void *);
+
+
+/**
+ * Class-like interface of custom memory managers
+ *
+ * @see uriCompleteMemoryManager
+ * @see uriEmulateCalloc
+ * @see uriEmulateReallocarray
+ * @see uriTestMemoryManager
+ * @since 0.9.0
+ */
+typedef struct UriMemoryManagerStruct {
+ UriFuncMalloc malloc; /**< Pointer to custom malloc(3) */
+ UriFuncCalloc calloc; /**< Pointer to custom calloc(3); to emulate using malloc and memset see uriEmulateCalloc */
+ UriFuncRealloc realloc; /**< Pointer to custom realloc(3) */
+ UriFuncReallocarray reallocarray; /**< Pointer to custom reallocarray(3); to emulate using realloc see uriEmulateReallocarray */
+ UriFuncFree free; /**< Pointer to custom free(3) */
+ void * userData; /**< Pointer to data that the other function members need access to */
+} UriMemoryManager; /**< @copydoc UriMemoryManagerStruct */
+
/**
* Specifies a line break conversion mode.
@@ -194,4 +254,101 @@ typedef enum UriResolutionOptionsEnum {
+/**
+ * Wraps a memory manager backend that only provides malloc and free
+ * to make a complete memory manager ready to be used.
+ *
+ * The core feature of this wrapper is that you don't need to implement
+ * realloc if you don't want to. The wrapped memory manager uses
+ * backend->malloc, memcpy, and backend->free and soieof(size_t) extra
+ * bytes per allocation to emulate fallback realloc for you.
+ *
+ * memory->calloc is uriEmulateCalloc.
+ * memory->free uses backend->free and handles the size header.
+ * memory->malloc uses backend->malloc and adds a size header.
+ * memory->realloc uses memory->malloc, memcpy, and memory->free and reads
+ * the size header.
+ * memory->reallocarray is uriEmulateReallocarray.
+ *
+ * The internal workings behind memory->free, memory->malloc, and
+ * memory->realloc may change so the functions exposed by these function
+ * pointer sshould be consided internal and not public API.
+ *
+ * @param memory <b>OUT</b>: Where to write the wrapped memory manager to
+ * @param backend <b>IN</b>: Memory manager to use as a backend
+ * @return Error code or 0 on success
+ *
+ * @see uriEmulateCalloc
+ * @see uriEmulateReallocarray
+ * @see UriMemoryManager
+ * @since 0.9.0
+ */
+int uriCompleteMemoryManager(UriMemoryManager * memory,
+ UriMemoryManager * backend);
+
+
+
+/**
+ * Offers emulation of calloc(3) based on memory->malloc and memset.
+ * See "man 3 calloc" as well.
+ *
+ * @param memory <b>IN</b>: Memory manager to use, should not be NULL
+ * @param nmemb <b>IN</b>: Number of elements to allocate
+ * @param size <b>IN</b>: Size in bytes per element
+ * @return Pointer to allocated memory or NULL
+ *
+ * @see uriCompleteMemoryManager
+ * @see uriEmulateReallocarray
+ * @see UriMemoryManager
+ * @since 0.9.0
+ */
+void * uriEmulateCalloc(UriMemoryManager * memory,
+ size_t nmemb, size_t size);
+
+
+
+/**
+ * Offers emulation of reallocarray(3) based on memory->realloc.
+ * See "man 3 reallocarray" as well.
+ *
+ * @param memory <b>IN</b>: Memory manager to use, should not be NULL
+ * @param ptr <b>IN</b>: Pointer allocated using memory->malloc/... or NULL
+ * @param nmemb <b>IN</b>: Number of elements to allocate
+ * @param size <b>IN</b>: Size in bytes per element
+ * @return Pointer to allocated memory or NULL
+ *
+ * @see uriCompleteMemoryManager
+ * @see uriEmulateCalloc
+ * @see UriMemoryManager
+ * @since 0.9.0
+ */
+void * uriEmulateReallocarray(UriMemoryManager * memory,
+ void * ptr, size_t nmemb, size_t size);
+
+
+
+/**
+ * Run multiple tests against a given memory manager.
+ * For example, one test
+ * 1. allocates a small amount of memory,
+ * 2. writes some magic bytes to it,
+ * 3. reallocates it,
+ * 4. checks that previous values are still present,
+ * 5. and frees that memory.
+ *
+ * It is recommended to compile with AddressSanitizer enabled
+ * to take full advantage of uriTestMemoryManager.
+ *
+ * @param memory <b>IN</b>: Memory manager to use, should not be NULL
+ * @return Error code or 0 on success
+ *
+ * @see uriEmulateCalloc
+ * @see uriEmulateReallocarray
+ * @see UriMemoryManager
+ * @since 0.9.0
+ */
+int uriTestMemoryManager(UriMemoryManager * memory);
+
+
+
#endif /* URI_BASE_H */
diff --git a/include/uriparser/UriDefsConfig.h b/include/uriparser/UriDefsConfig.h
index 9f7ac65..9af4968 100644
--- a/include/uriparser/UriDefsConfig.h
+++ b/include/uriparser/UriDefsConfig.h
@@ -76,7 +76,7 @@
/* Function inlining, not ANSI/ISO C! */
-#if (defined(URI_DOXYGEN) || defined(URI_SIZEDOWN))
+#if defined(URI_DOXYGEN)
# define URI_INLINE
#elif defined(__INTEL_COMPILER)
/* Intel C/C++ */
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index da4a4f6..ae7c906 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -1417,10 +1417,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- powerpcle-*linux*)
+ powerpcle-*linux*|powerpc64le-*linux*)
LD="${LD-ld} -m elf64lppc"
;;
- powerpc-*linux*)
+ powerpc-*linux*|powerpc64-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
@@ -1708,6 +1708,11 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
lt_cv_sys_max_cmd_len=8192;
;;
+ mint*)
+ # On MiNT this can take a long time and run out of memory.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
amigaos*)
# On AmigaOS with pdksh, this test takes hours, literally.
# So we just punt and use a minimum line length of 8192.
@@ -2636,11 +2641,11 @@ darwin* | rhapsody*)
version_type=darwin
need_lib_prefix=no
need_version=no
- library_names_spec='$libname$release$major$shared_ext $libname$shared_ext'
+ library_names_spec='$libname$release$versuffix$shared_ext $libname$release$major$shared_ext $libname$shared_ext'
soname_spec='$libname$release$major$shared_ext'
shlibpath_overrides_runpath=yes
shlibpath_var=DYLD_LIBRARY_PATH
- shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+ shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`'
m4_if([$1], [],[
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
diff --git a/src/UriCommon.c b/src/UriCommon.c
index 571d6d4..039beda 100644
--- a/src/UriCommon.c
+++ b/src/UriCommon.c
@@ -75,6 +75,9 @@
void URI_FUNC(ResetUri)(URI_TYPE(Uri) * uri) {
+ if (uri == NULL) {
+ return;
+ }
memset(uri, 0, sizeof(URI_TYPE(Uri)));
}
@@ -118,17 +121,17 @@ int URI_FUNC(CompareRange)(
/* Properly removes "." and ".." path segments */
UriBool URI_FUNC(RemoveDotSegments)(URI_TYPE(Uri) * uri,
- UriBool relative) {
+ UriBool relative, UriMemoryManager * memory) {
if (uri == NULL) {
return URI_TRUE;
}
- return URI_FUNC(RemoveDotSegmentsEx)(uri, relative, uri->owner);
+ return URI_FUNC(RemoveDotSegmentsEx)(uri, relative, uri->owner, memory);
}
UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri,
- UriBool relative, UriBool pathOwned) {
+ UriBool relative, UriBool pathOwned, UriMemoryManager * memory) {
URI_TYPE(PathSegment) * walker;
if ((uri == NULL) || (uri->pathHead == NULL)) {
return URI_TRUE;
@@ -173,13 +176,13 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri,
}
if (pathOwned && (walker->text.first != walker->text.afterLast)) {
- free((URI_CHAR *)walker->text.first);
+ memory->free(memory, (URI_CHAR *)walker->text.first);
}
- free(walker);
+ memory->free(memory, walker);
} else {
/* Last segment */
if (pathOwned && (walker->text.first != walker->text.afterLast)) {
- free((URI_CHAR *)walker->text.first);
+ memory->free(memory, (URI_CHAR *)walker->text.first);
}
if (prev == NULL) {
@@ -189,7 +192,7 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri,
walker->text.first = URI_FUNC(SafeToPointTo);
walker->text.afterLast = URI_FUNC(SafeToPointTo);
} else {
- free(walker);
+ memory->free(memory, walker);
uri->pathHead = NULL;
uri->pathTail = NULL;
@@ -237,21 +240,20 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri,
walker->next->reserved = prevPrev;
} else {
/* Last segment -> insert "" segment to represent trailing slash, update tail */
- URI_TYPE(PathSegment) * const segment = malloc(1 * sizeof(URI_TYPE(PathSegment)));
+ URI_TYPE(PathSegment) * const segment = memory->calloc(memory, 1, sizeof(URI_TYPE(PathSegment)));
if (segment == NULL) {
if (pathOwned && (walker->text.first != walker->text.afterLast)) {
- free((URI_CHAR *)walker->text.first);
+ memory->free(memory, (URI_CHAR *)walker->text.first);
}
- free(walker);
+ memory->free(memory, walker);
if (pathOwned && (prev->text.first != prev->text.afterLast)) {
- free((URI_CHAR *)prev->text.first);
+ memory->free(memory, (URI_CHAR *)prev->text.first);
}
- free(prev);
+ memory->free(memory, prev);
return URI_FALSE; /* Raises malloc error */
}
- memset(segment, 0, sizeof(URI_TYPE(PathSegment)));
segment->text.first = URI_FUNC(SafeToPointTo);
segment->text.afterLast = URI_FUNC(SafeToPointTo);
prevPrev->next = segment;
@@ -259,14 +261,14 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri,
}
if (pathOwned && (walker->text.first != walker->text.afterLast)) {
- free((URI_CHAR *)walker->text.first);
+ memory->free(memory, (URI_CHAR *)walker->text.first);
}
- free(walker);
+ memory->free(memory, walker);
if (pathOwned && (prev->text.first != prev->text.afterLast)) {
- free((URI_CHAR *)prev->text.first);
+ memory->free(memory, (URI_CHAR *)prev->text.first);
}
- free(prev);
+ memory->free(memory, prev);
walker = nextBackup;
} else {
@@ -276,14 +278,14 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri,
walker->next->reserved = NULL;
if (pathOwned && (walker->text.first != walker->text.afterLast)) {
- free((URI_CHAR *)walker->text.first);
+ memory->free(memory, (URI_CHAR *)walker->text.first);
}
- free(walker);
+ memory->free(memory, walker);
} else {
/* Re-use segment for "" path segment to represent trailing slash, update tail */
URI_TYPE(PathSegment) * const segment = walker;
if (pathOwned && (segment->text.first != segment->text.afterLast)) {
- free((URI_CHAR *)segment->text.first);
+ memory->free(memory, (URI_CHAR *)segment->text.first);
}
segment->text.first = URI_FUNC(SafeToPointTo);
segment->text.afterLast = URI_FUNC(SafeToPointTo);
@@ -292,9 +294,9 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri,
}
if (pathOwned && (prev->text.first != prev->text.afterLast)) {
- free((URI_CHAR *)prev->text.first);
+ memory->free(memory, (URI_CHAR *)prev->text.first);
}
- free(prev);
+ memory->free(memory, prev);
walker = nextBackup;
}
@@ -310,9 +312,9 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri,
}
if (pathOwned && (walker->text.first != walker->text.afterLast)) {
- free((URI_CHAR *)walker->text.first);
+ memory->free(memory, (URI_CHAR *)walker->text.first);
}
- free(walker);
+ memory->free(memory, walker);
walker = anotherNextBackup;
}
@@ -339,9 +341,10 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri,
/* Properly removes "." and ".." path segments */
-UriBool URI_FUNC(RemoveDotSegmentsAbsolute)(URI_TYPE(Uri) * uri) {
+UriBool URI_FUNC(RemoveDotSegmentsAbsolute)(URI_TYPE(Uri) * uri,
+ UriMemoryManager * memory) {
const UriBool ABSOLUTE = URI_FALSE;
- return URI_FUNC(RemoveDotSegments)(uri, ABSOLUTE);
+ return URI_FUNC(RemoveDotSegments)(uri, ABSOLUTE, memory);
}
@@ -429,7 +432,7 @@ UriBool URI_FUNC(IsHostSet)(const URI_TYPE(Uri) * uri) {
/* Copies the path segment list from one URI to another. */
UriBool URI_FUNC(CopyPath)(URI_TYPE(Uri) * dest,
- const URI_TYPE(Uri) * source) {
+ const URI_TYPE(Uri) * source, UriMemoryManager * memory) {
if (source->pathHead == NULL) {
/* No path component */
dest->pathHead = NULL;
@@ -439,7 +442,7 @@ UriBool URI_FUNC(CopyPath)(URI_TYPE(Uri) * dest,
URI_TYPE(PathSegment) * sourceWalker = source->pathHead;
URI_TYPE(PathSegment) * destPrev = NULL;
do {
- URI_TYPE(PathSegment) * cur = malloc(sizeof(URI_TYPE(PathSegment)));
+ URI_TYPE(PathSegment) * cur = memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
if (cur == NULL) {
/* Fix broken list */
if (destPrev != NULL) {
@@ -472,10 +475,10 @@ UriBool URI_FUNC(CopyPath)(URI_TYPE(Uri) * dest,
/* Copies the authority part of an URI over to another. */
UriBool URI_FUNC(CopyAuthority)(URI_TYPE(Uri) * dest,
- const URI_TYPE(Uri) * source) {
+ const URI_TYPE(Uri) * source, UriMemoryManager * memory) {
/* From this functions usage we know that *
* the dest URI cannot be uri->owner */
-
+
/* Copy userInfo */
dest->userInfo = source->userInfo;
@@ -484,7 +487,7 @@ UriBool URI_FUNC(CopyAuthority)(URI_TYPE(Uri) * dest,
/* Copy hostData */
if (source->hostData.ip4 != NULL) {
- dest->hostData.ip4 = malloc(sizeof(UriIp4));
+ dest->hostData.ip4 = memory->malloc(memory, sizeof(UriIp4));
if (dest->hostData.ip4 == NULL) {
return URI_FALSE; /* Raises malloc error */
}
@@ -494,7 +497,7 @@ UriBool URI_FUNC(CopyAuthority)(URI_TYPE(Uri) * dest,
dest->hostData.ipFuture.afterLast = NULL;
} else if (source->hostData.ip6 != NULL) {
dest->hostData.ip4 = NULL;
- dest->hostData.ip6 = malloc(sizeof(UriIp6));
+ dest->hostData.ip6 = memory->malloc(memory, sizeof(UriIp6));
if (dest->hostData.ip6 == NULL) {
return URI_FALSE; /* Raises malloc error */
}
@@ -515,7 +518,8 @@ UriBool URI_FUNC(CopyAuthority)(URI_TYPE(Uri) * dest,
-UriBool URI_FUNC(FixAmbiguity)(URI_TYPE(Uri) * uri) {
+UriBool URI_FUNC(FixAmbiguity)(URI_TYPE(Uri) * uri,
+ UriMemoryManager * memory) {
URI_TYPE(PathSegment) * segment;
if ( /* Case 1: absolute path, empty first segment */
@@ -534,7 +538,7 @@ UriBool URI_FUNC(FixAmbiguity)(URI_TYPE(Uri) * uri) {
return URI_TRUE;
}
- segment = malloc(1 * sizeof(URI_TYPE(PathSegment)));
+ segment = memory->malloc(memory, 1 * sizeof(URI_TYPE(PathSegment)));
if (segment == NULL) {
return URI_FALSE; /* Raises malloc error */
}
@@ -549,14 +553,15 @@ UriBool URI_FUNC(FixAmbiguity)(URI_TYPE(Uri) * uri) {
-void URI_FUNC(FixEmptyTrailSegment)(URI_TYPE(Uri) * uri) {
+void URI_FUNC(FixEmptyTrailSegment)(URI_TYPE(Uri) * uri,
+ UriMemoryManager * memory) {
/* Fix path if only one empty segment */
if (!uri->absolutePath
&& !URI_FUNC(IsHostSet)(uri)
&& (uri->pathHead != NULL)
&& (uri->pathHead->next == NULL)
&& (uri->pathHead->text.first == uri->pathHead->text.afterLast)) {
- free(uri->pathHead);
+ memory->free(memory, uri->pathHead);
uri->pathHead = NULL;
uri->pathTail = NULL;
}
diff --git a/src/UriCommon.h b/src/UriCommon.h
index b062fcc..916055c 100644
--- a/src/UriCommon.h
+++ b/src/UriCommon.h
@@ -82,10 +82,12 @@ int URI_FUNC(CompareRange)(
const URI_TYPE(TextRange) * a,
const URI_TYPE(TextRange) * b);
-UriBool URI_FUNC(RemoveDotSegmentsAbsolute)(URI_TYPE(Uri) * uri);
-UriBool URI_FUNC(RemoveDotSegments)(URI_TYPE(Uri) * uri, UriBool relative);
+UriBool URI_FUNC(RemoveDotSegmentsAbsolute)(URI_TYPE(Uri) * uri,
+ UriMemoryManager * memory);
+UriBool URI_FUNC(RemoveDotSegments)(URI_TYPE(Uri) * uri, UriBool relative,
+ UriMemoryManager * memory);
UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri,
- UriBool relative, UriBool pathOwned);
+ UriBool relative, UriBool pathOwned, UriMemoryManager * memory);
unsigned char URI_FUNC(HexdigToInt)(URI_CHAR hexdig);
URI_CHAR URI_FUNC(HexToLetter)(unsigned int value);
@@ -93,11 +95,14 @@ URI_CHAR URI_FUNC(HexToLetterEx)(unsigned int value, UriBool uppercase);
UriBool URI_FUNC(IsHostSet)(const URI_TYPE(Uri) * uri);
-UriBool URI_FUNC(CopyPath)(URI_TYPE(Uri) * dest, const URI_TYPE(Uri) * source);
-UriBool URI_FUNC(CopyAuthority)(URI_TYPE(Uri) * dest, const URI_TYPE(Uri) * source);
+UriBool URI_FUNC(CopyPath)(URI_TYPE(Uri) * dest, const URI_TYPE(Uri) * source,
+ UriMemoryManager * memory);
+UriBool URI_FUNC(CopyAuthority)(URI_TYPE(Uri) * dest,
+ const URI_TYPE(Uri) * source, UriMemoryManager * memory);
-UriBool URI_FUNC(FixAmbiguity)(URI_TYPE(Uri) * uri);
-void URI_FUNC(FixEmptyTrailSegment)(URI_TYPE(Uri) * uri);
+UriBool URI_FUNC(FixAmbiguity)(URI_TYPE(Uri) * uri, UriMemoryManager * memory);
+void URI_FUNC(FixEmptyTrailSegment)(URI_TYPE(Uri) * uri,
+ UriMemoryManager * memory);
#endif
diff --git a/src/UriMemory.c b/src/UriMemory.c
new file mode 100644
index 0000000..5e6bcc4
--- /dev/null
+++ b/src/UriMemory.c
@@ -0,0 +1,470 @@
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2018, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2018, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * * Neither the name of the <ORGANIZATION> nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file UriMemory.c
+ * Holds memory manager implementation.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if HAVE_REALLOCARRAY
+# ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+# endif
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+
+
+
+#ifndef URI_DOXYGEN
+# include "UriMemory.h"
+#endif
+
+
+
+#define URI_CHECK_ALLOC_OVERFLOW(total_size, nmemb, size) \
+ do { \
+ /* check for unsigned overflow */ \
+ if ((nmemb != 0) && (total_size / nmemb != size)) { \
+ errno = ENOMEM; \
+ return NULL; \
+ } \
+ } while (0)
+
+
+
+static void * uriDefaultMalloc(UriMemoryManager * URI_UNUSED(memory),
+ size_t size) {
+ return malloc(size);
+}
+
+
+
+static void * uriDefaultCalloc(UriMemoryManager * URI_UNUSED(memory),
+ size_t nmemb, size_t size) {
+ return calloc(nmemb, size);
+}
+
+
+
+static void * uriDefaultRealloc(UriMemoryManager * URI_UNUSED(memory),
+ void * ptr, size_t size) {
+ return realloc(ptr, size);
+}
+
+
+
+static void * uriDefaultReallocarray(UriMemoryManager * URI_UNUSED(memory),
+ void * ptr, size_t nmemb, size_t size) {
+#if HAVE_REALLOCARRAY
+ return reallocarray(ptr, nmemb, size);
+#else
+ const size_t total_size = nmemb * size;
+
+ URI_CHECK_ALLOC_OVERFLOW(total_size, nmemb, size); /* may return */
+
+ return realloc(ptr, total_size);
+#endif
+}
+
+
+
+static void uriDefaultFree(UriMemoryManager * URI_UNUSED(memory),
+ void * ptr) {
+ free(ptr);
+}
+
+
+
+UriBool uriMemoryManagerIsComplete(const UriMemoryManager * memory) {
+ return (memory
+ && memory->malloc
+ && memory->calloc
+ && memory->realloc
+ && memory->reallocarray
+ && memory->free) ? URI_TRUE : URI_FALSE;
+}
+
+
+
+void * uriEmulateCalloc(UriMemoryManager * memory, size_t nmemb, size_t size) {
+ void * buffer;
+ const size_t total_size = nmemb * size;
+
+ if (memory == NULL) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ URI_CHECK_ALLOC_OVERFLOW(total_size, nmemb, size); /* may return */
+
+ buffer = memory->malloc(memory, total_size);
+ if (buffer == NULL) {
+ /* errno set by malloc */
+ return NULL;
+ }
+ memset(buffer, 0, total_size);
+ return buffer;
+}
+
+
+
+void * uriEmulateReallocarray(UriMemoryManager * memory,
+ void * ptr, size_t nmemb, size_t size) {
+ const size_t total_size = nmemb * size;
+
+ if (memory == NULL) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ URI_CHECK_ALLOC_OVERFLOW(total_size, nmemb, size); /* may return */
+
+ return memory->realloc(memory, ptr, total_size);
+}
+
+
+
+static void * uriDecorateMalloc(UriMemoryManager * memory,
+ size_t size) {
+ UriMemoryManager * backend;
+ const size_t extraBytes = sizeof(size_t);
+ void * buffer;
+
+ if (memory == NULL) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ /* check for unsigned overflow */
+ if (size > ((size_t)-1) - extraBytes) {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ backend = (UriMemoryManager *)memory->userData;
+ if (backend == NULL) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ buffer = backend->malloc(backend, extraBytes + size);
+ if (buffer == NULL) {
+ return NULL;
+ }
+
+ *(size_t *)buffer = size;
+
+ return (char *)buffer + extraBytes;
+}
+
+
+
+static void * uriDecorateRealloc(UriMemoryManager * memory,
+ void * ptr, size_t size) {
+ void * newBuffer;
+ size_t prevSize;
+
+ if (memory == NULL) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ /* man realloc: "If ptr is NULL, then the call is equivalent to
+ * malloc(size), for *all* values of size" */
+ if (ptr == NULL) {
+ return memory->malloc(memory, size);
+ }
+
+ /* man realloc: "If size is equal to zero, and ptr is *not* NULL,
+ * then the call is equivalent to free(ptr)." */
+ if (size == 0) {
+ memory->free(memory, ptr);
+ return NULL;
+ }
+
+ prevSize = *((size_t *)((char *)ptr - sizeof(size_t)));
+
+ /* Anything to do? */
+ if (size <= prevSize) {
+ return ptr;
+ }
+
+ newBuffer = memory->malloc(memory, size);
+ if (newBuffer == NULL) {
+ /* errno set by malloc */
+ return NULL;
+ }
+
+ memcpy(newBuffer, ptr, prevSize);
+
+ memory->free(memory, ptr);
+
+ return newBuffer;
+}
+
+
+
+static void uriDecorateFree(UriMemoryManager * memory, void * ptr) {
+ UriMemoryManager * backend;
+
+ if ((ptr == NULL) || (memory == NULL)) {
+ return;
+ }
+
+ backend = (UriMemoryManager *)memory->userData;
+ if (backend == NULL) {
+ return;
+ }
+
+ backend->free(backend, (char *)ptr - sizeof(size_t));
+}
+
+
+
+int uriCompleteMemoryManager(UriMemoryManager * memory,
+ UriMemoryManager * backend) {
+ if ((memory == NULL) || (backend == NULL)) {
+ return URI_ERROR_NULL;
+ }
+
+ if ((backend->malloc == NULL) || (backend->free == NULL)) {
+ return URI_ERROR_MEMORY_MANAGER_INCOMPLETE;
+ }
+
+ memory->calloc = uriEmulateCalloc;
+ memory->reallocarray = uriEmulateReallocarray;
+
+ memory->malloc = uriDecorateMalloc;
+ memory->realloc = uriDecorateRealloc;
+ memory->free = uriDecorateFree;
+
+ memory->userData = backend;
+
+ return URI_SUCCESS;
+}
+
+
+
+int uriTestMemoryManager(UriMemoryManager * memory) {
+ const size_t mallocSize = 7;
+ const size_t callocNmemb = 3;
+ const size_t callocSize = 5;
+ const size_t callocTotalSize = callocNmemb * callocSize;
+ const size_t reallocSize = 11;
+ const size_t reallocarrayNmemb = 5;
+ const size_t reallocarraySize = 7;
+ const size_t reallocarrayTotal = reallocarrayNmemb * reallocarraySize;
+ size_t index;
+ char * buffer;
+
+ if (memory == NULL) {
+ return URI_ERROR_NULL;
+ }
+
+ if (uriMemoryManagerIsComplete(memory) != URI_TRUE) {
+ return URI_ERROR_MEMORY_MANAGER_INCOMPLETE;
+ }
+
+ /* malloc + free*/
+ buffer = memory->malloc(memory, mallocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ buffer[mallocSize - 1] = '\xF1';
+ memory->free(memory, buffer);
+ buffer = NULL;
+
+ /* calloc + free */
+ buffer = memory->calloc(memory, callocNmemb, callocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ for (index = 0; index < callocTotalSize; index++) { /* all zeros? */
+ if (buffer[index] != '\0') {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ }
+ buffer[callocTotalSize - 1] = '\xF2';
+ memory->free(memory, buffer);
+ buffer = NULL;
+
+ /* malloc + realloc + free */
+ buffer = memory->malloc(memory, mallocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ for (index = 0; index < mallocSize; index++) {
+ buffer[index] = '\xF3';
+ }
+ buffer = memory->realloc(memory, buffer, reallocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ for (index = 0; index < mallocSize; index++) { /* previous content? */
+ if (buffer[index] != '\xF3') {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ }
+ buffer[reallocSize - 1] = '\xF4';
+ memory->free(memory, buffer);
+ buffer = NULL;
+
+ /* malloc + realloc ptr!=NULL size==0 (equals free) */
+ buffer = memory->malloc(memory, mallocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ buffer[mallocSize - 1] = '\xF5';
+ memory->realloc(memory, buffer, 0);
+ buffer = NULL;
+
+ /* realloc ptr==NULL size!=0 (equals malloc) + free */
+ buffer = memory->realloc(memory, NULL, mallocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ buffer[mallocSize - 1] = '\xF6';
+ memory->free(memory, buffer);
+ buffer = NULL;
+
+ /* realloc ptr==NULL size==0 (equals malloc) + free */
+ buffer = memory->realloc(memory, NULL, 0);
+ if (buffer != NULL) {
+ memory->free(memory, buffer);
+ buffer = NULL;
+ }
+
+ /* malloc + reallocarray + free */
+ buffer = memory->malloc(memory, mallocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ for (index = 0; index < mallocSize; index++) {
+ buffer[index] = '\xF7';
+ }
+ buffer = memory->reallocarray(memory, buffer, reallocarrayNmemb,
+ reallocarraySize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ for (index = 0; index < mallocSize; index++) { /* previous content? */
+ if (buffer[index] != '\xF7') {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ }
+ buffer[reallocarrayTotal - 1] = '\xF8';
+ memory->free(memory, buffer);
+ buffer = NULL;
+
+ /* malloc + reallocarray ptr!=NULL nmemb==0 size!=0 (equals free) */
+ buffer = memory->malloc(memory, mallocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ buffer[mallocSize - 1] = '\xF9';
+ memory->reallocarray(memory, buffer, 0, reallocarraySize);
+ buffer = NULL;
+
+ /* malloc + reallocarray ptr!=NULL nmemb!=0 size==0 (equals free) */
+ buffer = memory->malloc(memory, mallocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ buffer[mallocSize - 1] = '\xFA';
+ memory->reallocarray(memory, buffer, reallocarrayNmemb, 0);
+ buffer = NULL;
+
+ /* malloc + reallocarray ptr!=NULL nmemb==0 size==0 (equals free) */
+ buffer = memory->malloc(memory, mallocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ buffer[mallocSize - 1] = '\xFB';
+ memory->reallocarray(memory, buffer, 0, 0);
+ buffer = NULL;
+
+ /* reallocarray ptr==NULL nmemb!=0 size!=0 (equals malloc) + free */
+ buffer = memory->reallocarray(memory, NULL, callocNmemb, callocSize);
+ if (buffer == NULL) {
+ return URI_ERROR_MEMORY_MANAGER_FAULTY;
+ }
+ buffer[callocTotalSize - 1] = '\xFC';
+ memory->free(memory, buffer);
+ buffer = NULL;
+
+ /* reallocarray ptr==NULL nmemb==0 size!=0 (equals malloc) + free */
+ buffer = memory->reallocarray(memory, NULL, 0, callocSize);
+ if (buffer != NULL) {
+ memory->free(memory, buffer);
+ buffer = NULL;
+ }
+
+ /* reallocarray ptr==NULL nmemb!=0 size==0 (equals malloc) + free */
+ buffer = memory->reallocarray(memory, NULL, callocNmemb, 0);
+ if (buffer != NULL) {
+ memory->free(memory, buffer);
+ buffer = NULL;
+ }
+
+ /* reallocarray ptr==NULL nmemb==0 size==0 (equals malloc) + free */
+ buffer = memory->reallocarray(memory, NULL, 0, 0);
+ if (buffer != NULL) {
+ memory->free(memory, buffer);
+ buffer = NULL;
+ }
+
+ return URI_SUCCESS;
+}
+
+
+
+/*extern*/ UriMemoryManager defaultMemoryManager = {
+ uriDefaultMalloc,
+ uriDefaultCalloc,
+ uriDefaultRealloc,
+ uriDefaultReallocarray,
+ uriDefaultFree,
+ NULL /* userData */
+};
diff --git a/src/UriMemory.h b/src/UriMemory.h
new file mode 100644
index 0000000..c40c072
--- /dev/null
+++ b/src/UriMemory.h
@@ -0,0 +1,59 @@
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2018, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2018, Sebastian Pipping <sebastian@pipping.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * * Neither the name of the <ORGANIZATION> nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef URI_DOXYGEN
+# include <uriparser/Uri.h>
+#endif
+
+
+
+#define URI_CHECK_MEMORY_MANAGER(memory) \
+ do { \
+ if (memory == NULL) { \
+ memory = &defaultMemoryManager; \
+ } else if (uriMemoryManagerIsComplete(memory) != URI_TRUE) { \
+ return URI_ERROR_MEMORY_MANAGER_INCOMPLETE; \
+ } \
+ } while (0)
+
+
+
+extern UriMemoryManager defaultMemoryManager;
+
+UriBool uriMemoryManagerIsComplete(const UriMemoryManager * memory);
diff --git a/src/UriNormalize.c b/src/UriNormalize.c
index d68c371..0e798c0 100644
--- a/src/UriNormalize.c
+++ b/src/UriNormalize.c
@@ -71,22 +71,28 @@
# include <uriparser/Uri.h>
# include "UriNormalizeBase.h"
# include "UriCommon.h"
+# include "UriMemory.h"
#endif
+#include <assert.h>
+
+
+
static int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri, unsigned int inMask,
- unsigned int * outMask);
+ unsigned int * outMask, UriMemoryManager * memory);
static UriBool URI_FUNC(MakeRangeOwner)(unsigned int * doneMask,
- unsigned int maskTest, URI_TYPE(TextRange) * range);
+ unsigned int maskTest, URI_TYPE(TextRange) * range,
+ UriMemoryManager * memory);
static UriBool URI_FUNC(MakeOwner)(URI_TYPE(Uri) * uri,
- unsigned int * doneMask);
+ unsigned int * doneMask, UriMemoryManager * memory);
static void URI_FUNC(FixPercentEncodingInplace)(const URI_CHAR * first,
const URI_CHAR ** afterLast);
static UriBool URI_FUNC(FixPercentEncodingMalloc)(const URI_CHAR ** first,
- const URI_CHAR ** afterLast);
+ const URI_CHAR ** afterLast, UriMemoryManager * memory);
static void URI_FUNC(FixPercentEncodingEngine)(
const URI_CHAR * inFirst, const URI_CHAR * inAfterLast,
const URI_CHAR * outFirst, const URI_CHAR ** outAfterLast);
@@ -99,23 +105,23 @@ static UriBool URI_FUNC(ContainsUglyPercentEncoding)(const URI_CHAR * first,
static void URI_FUNC(LowercaseInplace)(const URI_CHAR * first,
const URI_CHAR * afterLast);
static UriBool URI_FUNC(LowercaseMalloc)(const URI_CHAR ** first,
- const URI_CHAR ** afterLast);
+ const URI_CHAR ** afterLast, UriMemoryManager * memory);
static void URI_FUNC(PreventLeakage)(URI_TYPE(Uri) * uri,
- unsigned int revertMask);
+ unsigned int revertMask, UriMemoryManager * memory);
static URI_INLINE void URI_FUNC(PreventLeakage)(URI_TYPE(Uri) * uri,
- unsigned int revertMask) {
+ unsigned int revertMask, UriMemoryManager * memory) {
if (revertMask & URI_NORMALIZE_SCHEME) {
- free((URI_CHAR *)uri->scheme.first);
+ memory->free(memory, (URI_CHAR *)uri->scheme.first);
uri->scheme.first = NULL;
uri->scheme.afterLast = NULL;
}
if (revertMask & URI_NORMALIZE_USER_INFO) {
- free((URI_CHAR *)uri->userInfo.first);
+ memory->free(memory, (URI_CHAR *)uri->userInfo.first);
uri->userInfo.first = NULL;
uri->userInfo.afterLast = NULL;
}
@@ -123,7 +129,7 @@ static URI_INLINE void URI_FUNC(PreventLeakage)(URI_TYPE(Uri) * uri,
if (revertMask & URI_NORMALIZE_HOST) {
if (uri->hostData.ipFuture.first != NULL) {
/* IPvFuture */
- free((URI_CHAR *)uri->hostData.ipFuture.first);
+ memory->free(memory, (URI_CHAR *)uri->hostData.ipFuture.first);
uri->hostData.ipFuture.first = NULL;
uri->hostData.ipFuture.afterLast = NULL;
uri->hostText.first = NULL;
@@ -132,7 +138,7 @@ static URI_INLINE void URI_FUNC(PreventLeakage)(URI_TYPE(Uri) * uri,
&& (uri->hostData.ip4 == NULL)
&& (uri->hostData.ip6 == NULL)) {
/* Regname */
- free((URI_CHAR *)uri->hostText.first);
+ memory->free(memory, (URI_CHAR *)uri->hostText.first);
uri->hostText.first = NULL;
uri->hostText.afterLast = NULL;
}
@@ -145,9 +151,9 @@ static URI_INLINE void URI_FUNC(PreventLeakage)(URI_TYPE(Uri) * uri,
while (walker != NULL) {
URI_TYPE(PathSegment) * const next = walker->next;
if (walker->text.afterLast > walker->text.first) {
- free((URI_CHAR *)walker->text.first);
+ memory->free(memory, (URI_CHAR *)walker->text.first);
}
- free(walker);
+ memory->free(memory, walker);
walker = next;
}
uri->pathHead = NULL;
@@ -155,13 +161,13 @@ static URI_INLINE void URI_FUNC(PreventLeakage)(URI_TYPE(Uri) * uri,
}
if (revertMask & URI_NORMALIZE_QUERY) {
- free((URI_CHAR *)uri->query.first);
+ memory->free(memory, (URI_CHAR *)uri->query.first);
uri->query.first = NULL;
uri->query.afterLast = NULL;
}
if (revertMask & URI_NORMALIZE_FRAGMENT) {
- free((URI_CHAR *)uri->fragment.first);
+ memory->free(memory, (URI_CHAR *)uri->fragment.first);
uri->fragment.first = NULL;
uri->fragment.afterLast = NULL;
}
@@ -230,7 +236,7 @@ static URI_INLINE void URI_FUNC(LowercaseInplace)(const URI_CHAR * first,
static URI_INLINE UriBool URI_FUNC(LowercaseMalloc)(const URI_CHAR ** first,
- const URI_CHAR ** afterLast) {
+ const URI_CHAR ** afterLast, UriMemoryManager * memory) {
int lenInChars;
const int lowerUpperDiff = (_UT('a') - _UT('A'));
URI_CHAR * buffer;
@@ -248,7 +254,7 @@ static URI_INLINE UriBool URI_FUNC(LowercaseMalloc)(const URI_CHAR ** first,
return URI_FALSE;
}
- buffer = malloc(lenInChars * sizeof(URI_CHAR));
+ buffer = memory->malloc(memory, lenInChars * sizeof(URI_CHAR));
if (buffer == NULL) {
return URI_FALSE;
}
@@ -330,7 +336,7 @@ static URI_INLINE void URI_FUNC(FixPercentEncodingInplace)(const URI_CHAR * firs
static URI_INLINE UriBool URI_FUNC(FixPercentEncodingMalloc)(const URI_CHAR ** first,
- const URI_CHAR ** afterLast) {
+ const URI_CHAR ** afterLast, UriMemoryManager * memory) {
int lenInChars;
URI_CHAR * buffer;
@@ -349,7 +355,7 @@ static URI_INLINE UriBool URI_FUNC(FixPercentEncodingMalloc)(const URI_CHAR ** f
}
/* New buffer */
- buffer = malloc(lenInChars * sizeof(URI_CHAR));
+ buffer = memory->malloc(memory, lenInChars * sizeof(URI_CHAR));
if (buffer == NULL) {
return URI_FALSE;
}
@@ -363,14 +369,15 @@ static URI_INLINE UriBool URI_FUNC(FixPercentEncodingMalloc)(const URI_CHAR ** f
static URI_INLINE UriBool URI_FUNC(MakeRangeOwner)(unsigned int * doneMask,
- unsigned int maskTest, URI_TYPE(TextRange) * range) {
+ unsigned int maskTest, URI_TYPE(TextRange) * range,
+ UriMemoryManager * memory) {
if (((*doneMask & maskTest) == 0)
&& (range->first != NULL)
&& (range->afterLast != NULL)
&& (range->afterLast > range->first)) {
const int lenInChars = (int)(range->afterLast - range->first);
const int lenInBytes = lenInChars * sizeof(URI_CHAR);
- URI_CHAR * dup = malloc(lenInBytes);
+ URI_CHAR * dup = memory->malloc(memory, lenInBytes);
if (dup == NULL) {
return URI_FALSE; /* Raises malloc error */
}
@@ -385,16 +392,16 @@ static URI_INLINE UriBool URI_FUNC(MakeRangeOwner)(unsigned int * doneMask,
static URI_INLINE UriBool URI_FUNC(MakeOwner)(URI_TYPE(Uri) * uri,
- unsigned int * doneMask) {
+ unsigned int * doneMask, UriMemoryManager * memory) {
URI_TYPE(PathSegment) * walker = uri->pathHead;
if (!URI_FUNC(MakeRangeOwner)(doneMask, URI_NORMALIZE_SCHEME,
- &(uri->scheme))
+ &(uri->scheme), memory)
|| !URI_FUNC(MakeRangeOwner)(doneMask, URI_NORMALIZE_USER_INFO,
- &(uri->userInfo))
+ &(uri->userInfo), memory)
|| !URI_FUNC(MakeRangeOwner)(doneMask, URI_NORMALIZE_QUERY,
- &(uri->query))
+ &(uri->query), memory)
|| !URI_FUNC(MakeRangeOwner)(doneMask, URI_NORMALIZE_FRAGMENT,
- &(uri->fragment))) {
+ &(uri->fragment), memory)) {
return URI_FALSE; /* Raises malloc error */
}
@@ -405,7 +412,7 @@ static URI_INLINE UriBool URI_FUNC(MakeOwner)(URI_TYPE(Uri) * uri,
if (uri->hostData.ipFuture.first != NULL) {
/* IPvFuture */
if (!URI_FUNC(MakeRangeOwner)(doneMask, URI_NORMALIZE_HOST,
- &(uri->hostData.ipFuture))) {
+ &(uri->hostData.ipFuture), memory)) {
return URI_FALSE; /* Raises malloc error */
}
uri->hostText.first = uri->hostData.ipFuture.first;
@@ -413,7 +420,7 @@ static URI_INLINE UriBool URI_FUNC(MakeOwner)(URI_TYPE(Uri) * uri,
} else if (uri->hostText.first != NULL) {
/* Regname */
if (!URI_FUNC(MakeRangeOwner)(doneMask, URI_NORMALIZE_HOST,
- &(uri->hostText))) {
+ &(uri->hostText), memory)) {
return URI_FALSE; /* Raises malloc error */
}
}
@@ -423,7 +430,7 @@ static URI_INLINE UriBool URI_FUNC(MakeOwner)(URI_TYPE(Uri) * uri,
/* Path */
if ((*doneMask & URI_NORMALIZE_PATH) == 0) {
while (walker != NULL) {
- if (!URI_FUNC(MakeRangeOwner)(doneMask, 0, &(walker->text))) {
+ if (!URI_FUNC(MakeRangeOwner)(doneMask, 0, &(walker->text), memory)) {
/* Free allocations done so far and kill path */
/* Kill path to one before walker (if any) */
@@ -433,16 +440,16 @@ static URI_INLINE UriBool URI_FUNC(MakeOwner)(URI_TYPE(Uri) * uri,
if ((ranger->text.first != NULL)
&& (ranger->text.afterLast != NULL)
&& (ranger->text.afterLast > ranger->text.first)) {
- free((URI_CHAR *)ranger->text.first);
+ memory->free(memory, (URI_CHAR *)ranger->text.first);
}
- free(ranger);
+ memory->free(memory, ranger);
ranger = next;
}
/* Kill path from walker */
while (walker != NULL) {
URI_TYPE(PathSegment) * const next = walker->next;
- free(walker);
+ memory->free(memory, walker);
walker = next;
}
@@ -458,7 +465,7 @@ static URI_INLINE UriBool URI_FUNC(MakeOwner)(URI_TYPE(Uri) * uri,
/* Port text, must come last so we don't have to undo that one if it fails. *
* Otherwise we would need and extra enum flag for it although the port *
* cannot go unnormalized... */
- if (!URI_FUNC(MakeRangeOwner)(doneMask, 0, &(uri->portText))) {
+ if (!URI_FUNC(MakeRangeOwner)(doneMask, 0, &(uri->portText), memory)) {
return URI_FALSE; /* Raises malloc error */
}
@@ -468,23 +475,50 @@ static URI_INLINE UriBool URI_FUNC(MakeOwner)(URI_TYPE(Uri) * uri,
unsigned int URI_FUNC(NormalizeSyntaxMaskRequired)(const URI_TYPE(Uri) * uri) {
- unsigned int res;
+ unsigned int outMask = URI_NORMALIZED; /* for NULL uri */
+ URI_FUNC(NormalizeSyntaxMaskRequiredEx)(uri, &outMask);
+ return outMask;
+}
+
+
+
+int URI_FUNC(NormalizeSyntaxMaskRequiredEx)(const URI_TYPE(Uri) * uri,
+ unsigned int * outMask) {
+ UriMemoryManager * const memory = NULL; /* no use of memory manager */
+
#if defined(__GNUC__) && ((__GNUC__ > 4) \
- || ((__GNUC__ == 4) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 2)))
- /* Slower code that fixes a warning, not sure if this is a smart idea */
+ || ((__GNUC__ == 4) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 2)))
+ /* Slower code that fixes a warning, not sure if this is a smart idea */
URI_TYPE(Uri) writeableClone;
+#endif
+
+ if ((uri == NULL) || (outMask == NULL)) {
+ return URI_ERROR_NULL;
+ }
+
+#if defined(__GNUC__) && ((__GNUC__ > 4) \
+ || ((__GNUC__ == 4) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 2)))
+ /* Slower code that fixes a warning, not sure if this is a smart idea */
memcpy(&writeableClone, uri, 1 * sizeof(URI_TYPE(Uri)));
- URI_FUNC(NormalizeSyntaxEngine)(&writeableClone, 0, &res);
+ URI_FUNC(NormalizeSyntaxEngine)(&writeableClone, 0, outMask, memory);
#else
- URI_FUNC(NormalizeSyntaxEngine)((URI_TYPE(Uri) *)uri, 0, &res);
+ URI_FUNC(NormalizeSyntaxEngine)((URI_TYPE(Uri) *)uri, 0, outMask, memory);
#endif
- return res;
+ return URI_SUCCESS;
}
int URI_FUNC(NormalizeSyntaxEx)(URI_TYPE(Uri) * uri, unsigned int mask) {
- return URI_FUNC(NormalizeSyntaxEngine)(uri, mask, NULL);
+ return URI_FUNC(NormalizeSyntaxExMm)(uri, mask, NULL);
+}
+
+
+
+int URI_FUNC(NormalizeSyntaxExMm)(URI_TYPE(Uri) * uri, unsigned int mask,
+ UriMemoryManager * memory) {
+ URI_CHECK_MEMORY_MANAGER(memory); /* may return */
+ return URI_FUNC(NormalizeSyntaxEngine)(uri, mask, NULL, memory);
}
@@ -495,8 +529,16 @@ int URI_FUNC(NormalizeSyntax)(URI_TYPE(Uri) * uri) {
-static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri, unsigned int inMask, unsigned int * outMask) {
+static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,
+ unsigned int inMask, unsigned int * outMask,
+ UriMemoryManager * memory) {
unsigned int doneMask = URI_NORMALIZED;
+
+ /* Not just doing inspection? -> memory manager required! */
+ if (outMask == NULL) {
+ assert(memory != NULL);
+ }
+
if (uri == NULL) {
if (outMask != NULL) {
*outMask = URI_NORMALIZED;
@@ -539,8 +581,8 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri, unsig
if (uri->owner) {
URI_FUNC(LowercaseInplace)(uri->scheme.first, uri->scheme.afterLast);
} else {
- if (!URI_FUNC(LowercaseMalloc)(&(uri->scheme.first), &(uri->scheme.afterLast))) {
- URI_FUNC(PreventLeakage)(uri, doneMask);
+ if (!URI_FUNC(LowercaseMalloc)(&(uri->scheme.first), &(uri->scheme.afterLast), memory)) {
+ URI_FUNC(PreventLeakage)(uri, doneMask, memory);
return URI_ERROR_MALLOC;
}
doneMask |= URI_NORMALIZE_SCHEME;
@@ -556,8 +598,8 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri, unsig
uri->hostData.ipFuture.afterLast);
} else {
if (!URI_FUNC(LowercaseMalloc)(&(uri->hostData.ipFuture.first),
- &(uri->hostData.ipFuture.afterLast))) {
- URI_FUNC(PreventLeakage)(uri, doneMask);
+ &(uri->hostData.ipFuture.afterLast), memory)) {
+ URI_FUNC(PreventLeakage)(uri, doneMask, memory);
return URI_ERROR_MALLOC;
}
doneMask |= URI_NORMALIZE_HOST;
@@ -574,8 +616,9 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri, unsig
} else {
if (!URI_FUNC(FixPercentEncodingMalloc)(
&(uri->hostText.first),
- &(uri->hostText.afterLast))) {
- URI_FUNC(PreventLeakage)(uri, doneMask);
+ &(uri->hostText.afterLast),
+ memory)) {
+ URI_FUNC(PreventLeakage)(uri, doneMask, memory);
return URI_ERROR_MALLOC;
}
doneMask |= URI_NORMALIZE_HOST;
@@ -600,8 +643,8 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri, unsig
URI_FUNC(FixPercentEncodingInplace)(uri->userInfo.first, &(uri->userInfo.afterLast));
} else {
if (!URI_FUNC(FixPercentEncodingMalloc)(&(uri->userInfo.first),
- &(uri->userInfo.afterLast))) {
- URI_FUNC(PreventLeakage)(uri, doneMask);
+ &(uri->userInfo.afterLast), memory)) {
+ URI_FUNC(PreventLeakage)(uri, doneMask, memory);
return URI_ERROR_MALLOC;
}
doneMask |= URI_NORMALIZE_USER_INFO;
@@ -648,8 +691,8 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri, unsig
} else {
while (walker != NULL) {
if (!URI_FUNC(FixPercentEncodingMalloc)(&(walker->text.first),
- &(walker->text.afterLast))) {
- URI_FUNC(PreventLeakage)(uri, doneMask);
+ &(walker->text.afterLast), memory)) {
+ URI_FUNC(PreventLeakage)(uri, doneMask, memory);
return URI_ERROR_MALLOC;
}
walker = walker->next;
@@ -660,12 +703,12 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri, unsig
/* 6.2.2.3 Path Segment Normalization */
if (!URI_FUNC(RemoveDotSegmentsEx)(uri, relative,
(uri->owner == URI_TRUE)
- || ((doneMask & URI_NORMALIZE_PATH) != 0)
- )) {
- URI_FUNC(PreventLeakage)(uri, doneMask);
+ || ((doneMask & URI_NORMALIZE_PATH) != 0),
+ memory)) {
+ URI_FUNC(PreventLeakage)(uri, doneMask, memory);
return URI_ERROR_MALLOC;
}
- URI_FUNC(FixEmptyTrailSegment)(uri);
+ URI_FUNC(FixEmptyTrailSegment)(uri, memory);
}
/* Query, fragment */
@@ -688,8 +731,8 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri, unsig
URI_FUNC(FixPercentEncodingInplace)(uri->query.first, &(uri->query.afterLast));
} else {
if (!URI_FUNC(FixPercentEncodingMalloc)(&(uri->query.first),
- &(uri->query.afterLast))) {
- URI_FUNC(PreventLeakage)(uri, doneMask);
+ &(uri->query.afterLast), memory)) {
+ URI_FUNC(PreventLeakage)(uri, doneMask, memory);
return URI_ERROR_MALLOC;
}
doneMask |= URI_NORMALIZE_QUERY;
@@ -702,8 +745,8 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri, unsig
URI_FUNC(FixPercentEncodingInplace)(uri->fragment.first, &(uri->fragment.afterLast));
} else {
if (!URI_FUNC(FixPercentEncodingMalloc)(&(uri->fragment.first),
- &(uri->fragment.afterLast))) {
- URI_FUNC(PreventLeakage)(uri, doneMask);
+ &(uri->fragment.afterLast), memory)) {
+ URI_FUNC(PreventLeakage)(uri, doneMask, memory);
return URI_ERROR_MALLOC;
}
doneMask |= URI_NORMALIZE_FRAGMENT;
@@ -713,8 +756,8 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri, unsig
/* Dup all not duped yet */
if ((outMask == NULL) && !uri->owner) {
- if (!URI_FUNC(MakeOwner)(uri, &doneMask)) {
- URI_FUNC(PreventLeakage)(uri, doneMask);
+ if (!URI_FUNC(MakeOwner)(uri, &doneMask, memory)) {
+ URI_FUNC(PreventLeakage)(uri, doneMask, memory);
return URI_ERROR_MALLOC;
}
uri->owner = URI_TRUE;
diff --git a/src/UriParse.c b/src/UriParse.c
index e087753..f4bdda9 100644
--- a/src/UriParse.c
+++ b/src/UriParse.c
@@ -71,6 +71,7 @@
# include <uriparser/Uri.h>
# include <uriparser/UriIp4.h>
# include "UriCommon.h"
+# include "UriMemory.h"
# include "UriParseBase.h"
#endif
@@ -155,64 +156,70 @@
-static const URI_CHAR * URI_FUNC(ParseAuthority)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
+static const URI_CHAR * URI_FUNC(ParseAuthority)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
static const URI_CHAR * URI_FUNC(ParseAuthorityTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
static const URI_CHAR * URI_FUNC(ParseHexZero)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseHierPart)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseIpFutLoop)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseIpFutStopGo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseIpLit2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseMustBeSegmentNzNc)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseOwnHost)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseOwnHost2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseOwnHostUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseOwnHostUserInfoNz)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseOwnPortUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseOwnUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParsePartHelperTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParsePathAbsEmpty)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParsePathAbsNoLeadSlash)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParsePathRootless)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParsePchar)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParsePctEncoded)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParsePctSubUnres)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
+static const URI_CHAR * URI_FUNC(ParseHierPart)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseIpFutLoop)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseIpFutStopGo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseIpLit2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseMustBeSegmentNzNc)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseOwnHost)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseOwnHost2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseOwnHostUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseOwnHostUserInfoNz)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseOwnPortUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseOwnUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParsePartHelperTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParsePathAbsEmpty)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParsePathAbsNoLeadSlash)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParsePathRootless)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParsePchar)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParsePctEncoded)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParsePctSubUnres)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
static const URI_CHAR * URI_FUNC(ParsePort)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseQueryFrag)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseSegment)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseSegmentNz)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseSegmentNzNcOrScheme2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseUriReference)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseUriTail)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseUriTailTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseZeroMoreSlashSegs)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
-
-static UriBool URI_FUNC(OnExitOwnHost2)(URI_TYPE(ParserState) * state, const URI_CHAR * first);
-static UriBool URI_FUNC(OnExitOwnHostUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first);
-static UriBool URI_FUNC(OnExitOwnPortUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first);
-static UriBool URI_FUNC(OnExitSegmentNzNcOrScheme2)(URI_TYPE(ParserState) * state, const URI_CHAR * first);
+static const URI_CHAR * URI_FUNC(ParseQueryFrag)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseSegment)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseSegmentNz)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseSegmentNzNcOrScheme2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseUriReference)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseUriTail)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseUriTailTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParseZeroMoreSlashSegs)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+
+static UriBool URI_FUNC(OnExitOwnHost2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, UriMemoryManager * memory);
+static UriBool URI_FUNC(OnExitOwnHostUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, UriMemoryManager * memory);
+static UriBool URI_FUNC(OnExitOwnPortUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, UriMemoryManager * memory);
+static UriBool URI_FUNC(OnExitSegmentNzNcOrScheme2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, UriMemoryManager * memory);
static void URI_FUNC(OnExitPartHelperTwo)(URI_TYPE(ParserState) * state);
static void URI_FUNC(ResetParserStateExceptUri)(URI_TYPE(ParserState) * state);
-static UriBool URI_FUNC(PushPathSegment)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast);
+static UriBool URI_FUNC(PushPathSegment)(URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory);
-static void URI_FUNC(StopSyntax)(URI_TYPE(ParserState) * state, const URI_CHAR * errorPos);
-static void URI_FUNC(StopMalloc)(URI_TYPE(ParserState) * state);
+static void URI_FUNC(StopSyntax)(URI_TYPE(ParserState) * state, const URI_CHAR * errorPos, UriMemoryManager * memory);
+static void URI_FUNC(StopMalloc)(URI_TYPE(ParserState) * state, UriMemoryManager * memory);
+
+static int URI_FUNC(ParseUriExMm)(URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory);
static URI_INLINE void URI_FUNC(StopSyntax)(URI_TYPE(ParserState) * state,
- const URI_CHAR * errorPos) {
- URI_FUNC(FreeUriMembers)(state->uri);
+ const URI_CHAR * errorPos, UriMemoryManager * memory) {
+ URI_FUNC(FreeUriMembersMm)(state->uri, memory);
state->errorPos = errorPos;
state->errorCode = URI_ERROR_SYNTAX;
}
-static URI_INLINE void URI_FUNC(StopMalloc)(URI_TYPE(ParserState) * state) {
- URI_FUNC(FreeUriMembers)(state->uri);
+static URI_INLINE void URI_FUNC(StopMalloc)(URI_TYPE(ParserState) * state, UriMemoryManager * memory) {
+ URI_FUNC(FreeUriMembersMm)(state->uri, memory);
state->errorPos = NULL;
state->errorCode = URI_ERROR_MALLOC;
}
@@ -224,7 +231,9 @@ static URI_INLINE void URI_FUNC(StopMalloc)(URI_TYPE(ParserState) * state) {
* [authority]->[ownHostUserInfoNz]
* [authority]-><NULL>
*/
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseAuthority)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseAuthority)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
if (first >= afterLast) {
/* "" regname host */
state->uri->hostText.first = URI_FUNC(SafeToPointTo);
@@ -236,7 +245,7 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseAuthority)(URI_TYPE(ParserState
case _UT('['):
{
const URI_CHAR * const afterIpLit2
- = URI_FUNC(ParseIpLit2)(state, first + 1, afterLast);
+ = URI_FUNC(ParseIpLit2)(state, first + 1, afterLast, memory);
if (afterIpLit2 == NULL) {
return NULL;
}
@@ -265,7 +274,7 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseAuthority)(URI_TYPE(ParserState
case URI_SET_DIGIT:
case URI_SET_ALPHA:
state->uri->userInfo.first = first; /* USERINFO BEGIN */
- return URI_FUNC(ParseOwnHostUserInfoNz)(state, first, afterLast);
+ return URI_FUNC(ParseOwnHostUserInfoNz)(state, first, afterLast, memory);
default:
/* "" regname host */
@@ -330,7 +339,9 @@ static const URI_CHAR * URI_FUNC(ParseHexZero)(URI_TYPE(ParserState) * state, co
* [hierPart]-></>[partHelperTwo]
* [hierPart]-><NULL>
*/
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseHierPart)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseHierPart)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
if (first >= afterLast) {
return afterLast;
}
@@ -356,10 +367,10 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseHierPart)(URI_TYPE(ParserState)
case _UT('='):
case URI_SET_DIGIT:
case URI_SET_ALPHA:
- return URI_FUNC(ParsePathRootless)(state, first, afterLast);
+ return URI_FUNC(ParsePathRootless)(state, first, afterLast, memory);
case _UT('/'):
- return URI_FUNC(ParsePartHelperTwo)(state, first + 1, afterLast);
+ return URI_FUNC(ParsePartHelperTwo)(state, first + 1, afterLast, memory);
default:
return first;
@@ -373,9 +384,11 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseHierPart)(URI_TYPE(ParserState)
* [ipFutLoop]->[unreserved][ipFutStopGo]
* [ipFutLoop]-><:>[ipFutStopGo]
*/
-static const URI_CHAR * URI_FUNC(ParseIpFutLoop)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParseIpFutLoop)(URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
@@ -398,10 +411,10 @@ static const URI_CHAR * URI_FUNC(ParseIpFutLoop)(URI_TYPE(ParserState) * state,
case _UT('='):
case URI_SET_DIGIT:
case URI_SET_ALPHA:
- return URI_FUNC(ParseIpFutStopGo)(state, first + 1, afterLast);
+ return URI_FUNC(ParseIpFutStopGo)(state, first + 1, afterLast, memory);
default:
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
}
@@ -412,7 +425,10 @@ static const URI_CHAR * URI_FUNC(ParseIpFutLoop)(URI_TYPE(ParserState) * state,
* [ipFutStopGo]->[ipFutLoop]
* [ipFutStopGo]-><NULL>
*/
-static const URI_CHAR * URI_FUNC(ParseIpFutStopGo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParseIpFutStopGo)(
+ URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
if (first >= afterLast) {
return afterLast;
}
@@ -436,7 +452,7 @@ static const URI_CHAR * URI_FUNC(ParseIpFutStopGo)(URI_TYPE(ParserState) * state
case _UT('='):
case URI_SET_DIGIT:
case URI_SET_ALPHA:
- return URI_FUNC(ParseIpFutLoop)(state, first, afterLast);
+ return URI_FUNC(ParseIpFutLoop)(state, first, afterLast, memory);
default:
return first;
@@ -448,9 +464,11 @@ static const URI_CHAR * URI_FUNC(ParseIpFutStopGo)(URI_TYPE(ParserState) * state
/*
* [ipFuture]-><v>[HEXDIG][hexZero]<.>[ipFutLoop]
*/
-static const URI_CHAR * URI_FUNC(ParseIpFuture)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParseIpFuture)(URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
@@ -462,7 +480,7 @@ static const URI_CHAR * URI_FUNC(ParseIpFuture)(URI_TYPE(ParserState) * state, c
case _UT('v'):
*/
if (first + 1 >= afterLast) {
- URI_FUNC(StopSyntax)(state, first + 1);
+ URI_FUNC(StopSyntax)(state, first + 1, memory);
return NULL;
}
@@ -477,12 +495,12 @@ static const URI_CHAR * URI_FUNC(ParseIpFuture)(URI_TYPE(ParserState) * state, c
}
if ((afterHexZero >= afterLast)
|| (*afterHexZero != _UT('.'))) {
- URI_FUNC(StopSyntax)(state, afterHexZero);
+ URI_FUNC(StopSyntax)(state, afterHexZero, memory);
return NULL;
}
state->uri->hostText.first = first; /* HOST BEGIN */
state->uri->hostData.ipFuture.first = first; /* IPFUTURE BEGIN */
- afterIpFutLoop = URI_FUNC(ParseIpFutLoop)(state, afterHexZero + 1, afterLast);
+ afterIpFutLoop = URI_FUNC(ParseIpFutLoop)(state, afterHexZero + 1, afterLast, memory);
if (afterIpFutLoop == NULL) {
return NULL;
}
@@ -492,13 +510,13 @@ static const URI_CHAR * URI_FUNC(ParseIpFuture)(URI_TYPE(ParserState) * state, c
}
default:
- URI_FUNC(StopSyntax)(state, first + 1);
+ URI_FUNC(StopSyntax)(state, first + 1, memory);
return NULL;
}
/*
default:
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
*/
@@ -510,9 +528,11 @@ static const URI_CHAR * URI_FUNC(ParseIpFuture)(URI_TYPE(ParserState) * state, c
* [ipLit2]->[ipFuture]<]>
* [ipLit2]->[IPv6address2]
*/
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseIpLit2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseIpLit2)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
@@ -520,13 +540,13 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseIpLit2)(URI_TYPE(ParserState) *
case _UT('v'):
{
const URI_CHAR * const afterIpFuture
- = URI_FUNC(ParseIpFuture)(state, first, afterLast);
+ = URI_FUNC(ParseIpFuture)(state, first, afterLast, memory);
if (afterIpFuture == NULL) {
return NULL;
}
if ((afterIpFuture >= afterLast)
|| (*afterIpFuture != _UT(']'))) {
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
return afterIpFuture + 1;
@@ -535,15 +555,15 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseIpLit2)(URI_TYPE(ParserState) *
case _UT(':'):
case _UT(']'):
case URI_SET_HEXDIG:
- state->uri->hostData.ip6 = malloc(1 * sizeof(UriIp6)); /* Freed when stopping on parse error */
+ state->uri->hostData.ip6 = memory->malloc(memory, 1 * sizeof(UriIp6)); /* Freed when stopping on parse error */
if (state->uri->hostData.ip6 == NULL) {
- URI_FUNC(StopMalloc)(state);
+ URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
- return URI_FUNC(ParseIPv6address2)(state, first, afterLast);
+ return URI_FUNC(ParseIPv6address2)(state, first, afterLast, memory);
default:
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
}
@@ -553,7 +573,10 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseIpLit2)(URI_TYPE(ParserState) *
/*
* [IPv6address2]->..<]>
*/
-static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParseIPv6address2)(
+ URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
int zipperEver = 0;
int quadsDone = 0;
int digitCount = 0;
@@ -566,7 +589,7 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
for (;;) {
if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
@@ -577,7 +600,7 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
switch (*first) {
case URI_SET_DIGIT:
if (digitCount == 4) {
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
digitHistory[digitCount++] = (unsigned char)(9 + *first - _UT('9'));
@@ -588,17 +611,17 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
|| (digitCount == 0)
|| (digitCount == 4)) {
/* Invalid digit or octet count */
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
} else if ((digitCount > 1)
&& (digitHistory[0] == 0)) {
/* Leading zero */
- URI_FUNC(StopSyntax)(state, first - digitCount);
+ URI_FUNC(StopSyntax)(state, first - digitCount, memory);
return NULL;
} else if ((digitCount > 2)
&& (digitHistory[1] == 0)) {
/* Leading zero */
- URI_FUNC(StopSyntax)(state, first - digitCount + 1);
+ URI_FUNC(StopSyntax)(state, first - digitCount + 1, memory);
return NULL;
} else if ((digitCount == 3)
&& (100 * digitHistory[0]
@@ -606,11 +629,11 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
+ digitHistory[2] > 255)) {
/* Octet value too large */
if (digitHistory[0] > 2) {
- URI_FUNC(StopSyntax)(state, first - 3);
+ URI_FUNC(StopSyntax)(state, first - 3, memory);
} else if (digitHistory[1] > 5) {
- URI_FUNC(StopSyntax)(state, first - 2);
+ URI_FUNC(StopSyntax)(state, first - 2, memory);
} else {
- URI_FUNC(StopSyntax)(state, first - 1);
+ URI_FUNC(StopSyntax)(state, first - 1, memory);
}
return NULL;
}
@@ -626,17 +649,17 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
|| (digitCount == 0)
|| (digitCount == 4)) {
/* Invalid digit or octet count */
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
} else if ((digitCount > 1)
&& (digitHistory[0] == 0)) {
/* Leading zero */
- URI_FUNC(StopSyntax)(state, first - digitCount);
+ URI_FUNC(StopSyntax)(state, first - digitCount, memory);
return NULL;
} else if ((digitCount > 2)
&& (digitHistory[1] == 0)) {
/* Leading zero */
- URI_FUNC(StopSyntax)(state, first - digitCount + 1);
+ URI_FUNC(StopSyntax)(state, first - digitCount + 1, memory);
return NULL;
} else if ((digitCount == 3)
&& (100 * digitHistory[0]
@@ -644,11 +667,11 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
+ digitHistory[2] > 255)) {
/* Octet value too large */
if (digitHistory[0] > 2) {
- URI_FUNC(StopSyntax)(state, first - 3);
+ URI_FUNC(StopSyntax)(state, first - 3, memory);
} else if (digitHistory[1] > 5) {
- URI_FUNC(StopSyntax)(state, first - 2);
+ URI_FUNC(StopSyntax)(state, first - 2, memory);
} else {
- URI_FUNC(StopSyntax)(state, first - 1);
+ URI_FUNC(StopSyntax)(state, first - 1, memory);
}
return NULL;
}
@@ -665,7 +688,7 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
return first + 1;
default:
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
first++;
@@ -679,7 +702,7 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
case URI_SET_HEX_LETTER_LOWER:
letterAmong = 1;
if (digitCount == 4) {
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
digitHistory[digitCount] = (unsigned char)(15 + *first - _UT('f'));
@@ -689,7 +712,7 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
case URI_SET_HEX_LETTER_UPPER:
letterAmong = 1;
if (digitCount == 4) {
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
digitHistory[digitCount] = (unsigned char)(15 + *first - _UT('F'));
@@ -698,7 +721,7 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
case URI_SET_DIGIT:
if (digitCount == 4) {
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
digitHistory[digitCount] = (unsigned char)(9 + *first - _UT('9'));
@@ -723,13 +746,13 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
/* Too many quads? */
if (quadsDone >= 8 - zipperEver) {
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
/* "::"? */
if (first + 1 >= afterLast) {
- URI_FUNC(StopSyntax)(state, first + 1);
+ URI_FUNC(StopSyntax)(state, first + 1, memory);
return NULL;
}
if (first[1] == _UT(':')) {
@@ -737,7 +760,7 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
first++;
if (zipperEver) {
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL; /* "::.+::" */
}
@@ -747,11 +770,11 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
/* ":::+"? */
if (first + 1 >= afterLast) {
- URI_FUNC(StopSyntax)(state, first + 1);
+ URI_FUNC(StopSyntax)(state, first + 1, memory);
return NULL; /* No ']' yet */
}
if (first[1] == _UT(':')) {
- URI_FUNC(StopSyntax)(state, first + 1);
+ URI_FUNC(StopSyntax)(state, first + 1, memory);
return NULL; /* ":::+ "*/
}
}
@@ -769,17 +792,17 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
|| (digitCount == 0)
|| (digitCount == 4)) {
/* Invalid octet before */
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
} else if ((digitCount > 1)
&& (digitHistory[0] == 0)) {
/* Leading zero */
- URI_FUNC(StopSyntax)(state, first - digitCount);
+ URI_FUNC(StopSyntax)(state, first - digitCount, memory);
return NULL;
} else if ((digitCount > 2)
&& (digitHistory[1] == 0)) {
/* Leading zero */
- URI_FUNC(StopSyntax)(state, first - digitCount + 1);
+ URI_FUNC(StopSyntax)(state, first - digitCount + 1, memory);
return NULL;
} else if ((digitCount == 3)
&& (100 * digitHistory[0]
@@ -787,11 +810,11 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
+ digitHistory[2] > 255)) {
/* Octet value too large */
if (digitHistory[0] > 2) {
- URI_FUNC(StopSyntax)(state, first - 3);
+ URI_FUNC(StopSyntax)(state, first - 3, memory);
} else if (digitHistory[1] > 5) {
- URI_FUNC(StopSyntax)(state, first - 2);
+ URI_FUNC(StopSyntax)(state, first - 2, memory);
} else {
- URI_FUNC(StopSyntax)(state, first - 1);
+ URI_FUNC(StopSyntax)(state, first - 1, memory);
}
return NULL;
}
@@ -808,7 +831,7 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
case _UT(']'):
/* Too little quads? */
if (!zipperEver && !((quadsDone == 7) && (digitCount > 0))) {
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
@@ -833,13 +856,13 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
return first + 1; /* Fine */
default:
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
first++;
if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL; /* No ']' yet */
}
} while (walking);
@@ -857,10 +880,12 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
* [mustBeSegmentNzNc]-></>[segment][zeroMoreSlashSegs][uriTail]
* [mustBeSegmentNzNc]-><@>[mustBeSegmentNzNc]
*/
-static const URI_CHAR * URI_FUNC(ParseMustBeSegmentNzNc)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParseMustBeSegmentNzNc)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
if (first >= afterLast) {
- if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state);
+ if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
state->uri->scheme.first = NULL; /* Not a scheme, reset */
@@ -871,11 +896,11 @@ static const URI_CHAR * URI_FUNC(ParseMustBeSegmentNzNc)(URI_TYPE(ParserState) *
case _UT('%'):
{
const URI_CHAR * const afterPctEncoded
- = URI_FUNC(ParsePctEncoded)(state, first, afterLast);
+ = URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
if (afterPctEncoded == NULL) {
return NULL;
}
- return URI_FUNC(ParseMustBeSegmentNzNc)(state, afterPctEncoded, afterLast);
+ return URI_FUNC(ParseMustBeSegmentNzNc)(state, afterPctEncoded, afterLast, memory);
}
case _UT('@'):
@@ -896,40 +921,40 @@ static const URI_CHAR * URI_FUNC(ParseMustBeSegmentNzNc)(URI_TYPE(ParserState) *
case _UT('~'):
case URI_SET_DIGIT:
case URI_SET_ALPHA:
- return URI_FUNC(ParseMustBeSegmentNzNc)(state, first + 1, afterLast);
+ return URI_FUNC(ParseMustBeSegmentNzNc)(state, first + 1, afterLast, memory);
case _UT('/'):
{
const URI_CHAR * afterZeroMoreSlashSegs;
const URI_CHAR * afterSegment;
- if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state);
+ if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
state->uri->scheme.first = NULL; /* Not a scheme, reset */
- afterSegment = URI_FUNC(ParseSegment)(state, first + 1, afterLast);
+ afterSegment = URI_FUNC(ParseSegment)(state, first + 1, afterLast, memory);
if (afterSegment == NULL) {
return NULL;
}
- if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state);
+ if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
afterZeroMoreSlashSegs
- = URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegment, afterLast);
+ = URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegment, afterLast, memory);
if (afterZeroMoreSlashSegs == NULL) {
return NULL;
}
- return URI_FUNC(ParseUriTail)(state, afterZeroMoreSlashSegs, afterLast);
+ return URI_FUNC(ParseUriTail)(state, afterZeroMoreSlashSegs, afterLast, memory);
}
default:
- if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state);
+ if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
state->uri->scheme.first = NULL; /* Not a scheme, reset */
- return URI_FUNC(ParseUriTail)(state, first, afterLast);
+ return URI_FUNC(ParseUriTail)(state, first, afterLast, memory);
}
}
@@ -939,7 +964,9 @@ static const URI_CHAR * URI_FUNC(ParseMustBeSegmentNzNc)(URI_TYPE(ParserState) *
* [ownHost]-><[>[ipLit2][authorityTwo]
* [ownHost]->[ownHost2] // can take <NULL>
*/
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseOwnHost)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseOwnHost)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
if (first >= afterLast) {
state->uri->hostText.afterLast = afterLast; /* HOST END */
return afterLast;
@@ -949,7 +976,7 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseOwnHost)(URI_TYPE(ParserState)
case _UT('['):
{
const URI_CHAR * const afterIpLit2
- = URI_FUNC(ParseIpLit2)(state, first + 1, afterLast);
+ = URI_FUNC(ParseIpLit2)(state, first + 1, afterLast, memory);
if (afterIpLit2 == NULL) {
return NULL;
}
@@ -958,24 +985,26 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseOwnHost)(URI_TYPE(ParserState)
}
default:
- return URI_FUNC(ParseOwnHost2)(state, first, afterLast);
+ return URI_FUNC(ParseOwnHost2)(state, first, afterLast, memory);
}
}
-static URI_INLINE UriBool URI_FUNC(OnExitOwnHost2)(URI_TYPE(ParserState) * state, const URI_CHAR * first) {
+static URI_INLINE UriBool URI_FUNC(OnExitOwnHost2)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ UriMemoryManager * memory) {
state->uri->hostText.afterLast = first; /* HOST END */
/* Valid IPv4 or just a regname? */
- state->uri->hostData.ip4 = malloc(1 * sizeof(UriIp4)); /* Freed when stopping on parse error */
+ state->uri->hostData.ip4 = memory->malloc(memory, 1 * sizeof(UriIp4)); /* Freed when stopping on parse error */
if (state->uri->hostData.ip4 == NULL) {
return URI_FALSE; /* Raises malloc error */
}
if (URI_FUNC(ParseIpFourAddress)(state->uri->hostData.ip4->data,
state->uri->hostText.first, state->uri->hostText.afterLast)) {
/* Not IPv4 */
- free(state->uri->hostData.ip4);
+ memory->free(memory, state->uri->hostData.ip4);
state->uri->hostData.ip4 = NULL;
}
return URI_TRUE; /* Success */
@@ -987,10 +1016,12 @@ static URI_INLINE UriBool URI_FUNC(OnExitOwnHost2)(URI_TYPE(ParserState) * state
* [ownHost2]->[authorityTwo] // can take <NULL>
* [ownHost2]->[pctSubUnres][ownHost2]
*/
-static const URI_CHAR * URI_FUNC(ParseOwnHost2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParseOwnHost2)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
if (first >= afterLast) {
- if (!URI_FUNC(OnExitOwnHost2)(state, first)) {
- URI_FUNC(StopMalloc)(state);
+ if (!URI_FUNC(OnExitOwnHost2)(state, first, memory)) {
+ URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
return afterLast;
@@ -1017,16 +1048,16 @@ static const URI_CHAR * URI_FUNC(ParseOwnHost2)(URI_TYPE(ParserState) * state, c
case URI_SET_ALPHA:
{
const URI_CHAR * const afterPctSubUnres
- = URI_FUNC(ParsePctSubUnres)(state, first, afterLast);
+ = URI_FUNC(ParsePctSubUnres)(state, first, afterLast, memory);
if (afterPctSubUnres == NULL) {
return NULL;
}
- return URI_FUNC(ParseOwnHost2)(state, afterPctSubUnres, afterLast);
+ return URI_FUNC(ParseOwnHost2)(state, afterPctSubUnres, afterLast, memory);
}
default:
- if (!URI_FUNC(OnExitOwnHost2)(state, first)) {
- URI_FUNC(StopMalloc)(state);
+ if (!URI_FUNC(OnExitOwnHost2)(state, first, memory)) {
+ URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
return URI_FUNC(ParseAuthorityTwo)(state, first, afterLast);
@@ -1035,20 +1066,22 @@ static const URI_CHAR * URI_FUNC(ParseOwnHost2)(URI_TYPE(ParserState) * state, c
-static URI_INLINE UriBool URI_FUNC(OnExitOwnHostUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first) {
+static URI_INLINE UriBool URI_FUNC(OnExitOwnHostUserInfo)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ UriMemoryManager * memory) {
state->uri->hostText.first = state->uri->userInfo.first; /* Host instead of userInfo, update */
state->uri->userInfo.first = NULL; /* Not a userInfo, reset */
state->uri->hostText.afterLast = first; /* HOST END */
/* Valid IPv4 or just a regname? */
- state->uri->hostData.ip4 = malloc(1 * sizeof(UriIp4)); /* Freed when stopping on parse error */
+ state->uri->hostData.ip4 = memory->malloc(memory, 1 * sizeof(UriIp4)); /* Freed when stopping on parse error */
if (state->uri->hostData.ip4 == NULL) {
return URI_FALSE; /* Raises malloc error */
}
if (URI_FUNC(ParseIpFourAddress)(state->uri->hostData.ip4->data,
state->uri->hostText.first, state->uri->hostText.afterLast)) {
/* Not IPv4 */
- free(state->uri->hostData.ip4);
+ memory->free(memory, state->uri->hostData.ip4);
state->uri->hostData.ip4 = NULL;
}
return URI_TRUE; /* Success */
@@ -1060,10 +1093,12 @@ static URI_INLINE UriBool URI_FUNC(OnExitOwnHostUserInfo)(URI_TYPE(ParserState)
* [ownHostUserInfo]->[ownHostUserInfoNz]
* [ownHostUserInfo]-><NULL>
*/
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseOwnHostUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseOwnHostUserInfo)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
if (first >= afterLast) {
- if (!URI_FUNC(OnExitOwnHostUserInfo)(state, first)) {
- URI_FUNC(StopMalloc)(state);
+ if (!URI_FUNC(OnExitOwnHostUserInfo)(state, first, memory)) {
+ URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
return afterLast;
@@ -1090,11 +1125,11 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseOwnHostUserInfo)(URI_TYPE(Parse
case _UT('='):
case URI_SET_DIGIT:
case URI_SET_ALPHA:
- return URI_FUNC(ParseOwnHostUserInfoNz)(state, first, afterLast);
+ return URI_FUNC(ParseOwnHostUserInfoNz)(state, first, afterLast, memory);
default:
- if (!URI_FUNC(OnExitOwnHostUserInfo)(state, first)) {
- URI_FUNC(StopMalloc)(state);
+ if (!URI_FUNC(OnExitOwnHostUserInfo)(state, first, memory)) {
+ URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
return first;
@@ -1108,9 +1143,11 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseOwnHostUserInfo)(URI_TYPE(Parse
* [ownHostUserInfoNz]-><:>[ownPortUserInfo]
* [ownHostUserInfoNz]-><@>[ownHost]
*/
-static const URI_CHAR * URI_FUNC(ParseOwnHostUserInfoNz)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParseOwnHostUserInfoNz)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
@@ -1135,45 +1172,47 @@ static const URI_CHAR * URI_FUNC(ParseOwnHostUserInfoNz)(URI_TYPE(ParserState) *
case URI_SET_ALPHA:
{
const URI_CHAR * const afterPctSubUnres
- = URI_FUNC(ParsePctSubUnres)(state, first, afterLast);
+ = URI_FUNC(ParsePctSubUnres)(state, first, afterLast, memory);
if (afterPctSubUnres == NULL) {
return NULL;
}
- return URI_FUNC(ParseOwnHostUserInfo)(state, afterPctSubUnres, afterLast);
+ return URI_FUNC(ParseOwnHostUserInfo)(state, afterPctSubUnres, afterLast, memory);
}
case _UT(':'):
state->uri->hostText.afterLast = first; /* HOST END */
state->uri->portText.first = first + 1; /* PORT BEGIN */
- return URI_FUNC(ParseOwnPortUserInfo)(state, first + 1, afterLast);
+ return URI_FUNC(ParseOwnPortUserInfo)(state, first + 1, afterLast, memory);
case _UT('@'):
state->uri->userInfo.afterLast = first; /* USERINFO END */
state->uri->hostText.first = first + 1; /* HOST BEGIN */
- return URI_FUNC(ParseOwnHost)(state, first + 1, afterLast);
+ return URI_FUNC(ParseOwnHost)(state, first + 1, afterLast, memory);
default:
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
}
-static URI_INLINE UriBool URI_FUNC(OnExitOwnPortUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first) {
+static URI_INLINE UriBool URI_FUNC(OnExitOwnPortUserInfo)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ UriMemoryManager * memory) {
state->uri->hostText.first = state->uri->userInfo.first; /* Host instead of userInfo, update */
state->uri->userInfo.first = NULL; /* Not a userInfo, reset */
state->uri->portText.afterLast = first; /* PORT END */
/* Valid IPv4 or just a regname? */
- state->uri->hostData.ip4 = malloc(1 * sizeof(UriIp4)); /* Freed when stopping on parse error */
+ state->uri->hostData.ip4 = memory->malloc(memory, 1 * sizeof(UriIp4)); /* Freed when stopping on parse error */
if (state->uri->hostData.ip4 == NULL) {
return URI_FALSE; /* Raises malloc error */
}
if (URI_FUNC(ParseIpFourAddress)(state->uri->hostData.ip4->data,
state->uri->hostText.first, state->uri->hostText.afterLast)) {
/* Not IPv4 */
- free(state->uri->hostData.ip4);
+ memory->free(memory, state->uri->hostData.ip4);
state->uri->hostData.ip4 = NULL;
}
return URI_TRUE; /* Success */
@@ -1194,10 +1233,12 @@ static URI_INLINE UriBool URI_FUNC(OnExitOwnPortUserInfo)(URI_TYPE(ParserState)
* [ownPortUserInfo]-><@>[ownHost]
* [ownPortUserInfo]-><NULL>
*/
-static const URI_CHAR * URI_FUNC(ParseOwnPortUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParseOwnPortUserInfo)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
if (first >= afterLast) {
- if (!URI_FUNC(OnExitOwnPortUserInfo)(state, first)) {
- URI_FUNC(StopMalloc)(state);
+ if (!URI_FUNC(OnExitOwnPortUserInfo)(state, first, memory)) {
+ URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
return afterLast;
@@ -1227,20 +1268,20 @@ static const URI_CHAR * URI_FUNC(ParseOwnPortUserInfo)(URI_TYPE(ParserState) * s
case URI_SET_ALPHA:
state->uri->hostText.afterLast = NULL; /* Not a host, reset */
state->uri->portText.first = NULL; /* Not a port, reset */
- return URI_FUNC(ParseOwnUserInfo)(state, first + 1, afterLast);
+ return URI_FUNC(ParseOwnUserInfo)(state, first + 1, afterLast, memory);
case URI_SET_DIGIT:
- return URI_FUNC(ParseOwnPortUserInfo)(state, first + 1, afterLast);
+ return URI_FUNC(ParseOwnPortUserInfo)(state, first + 1, afterLast, memory);
case _UT('%'):
state->uri->portText.first = NULL; /* Not a port, reset */
{
const URI_CHAR * const afterPct
- = URI_FUNC(ParsePctEncoded)(state, first, afterLast);
+ = URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
if (afterPct == NULL) {
return NULL;
}
- return URI_FUNC(ParseOwnUserInfo)(state, afterPct, afterLast);
+ return URI_FUNC(ParseOwnUserInfo)(state, afterPct, afterLast, memory);
}
case _UT('@'):
@@ -1248,11 +1289,11 @@ static const URI_CHAR * URI_FUNC(ParseOwnPortUserInfo)(URI_TYPE(ParserState) * s
state->uri->portText.first = NULL; /* Not a port, reset */
state->uri->userInfo.afterLast = first; /* USERINFO END */
state->uri->hostText.first = first + 1; /* HOST BEGIN */
- return URI_FUNC(ParseOwnHost)(state, first + 1, afterLast);
+ return URI_FUNC(ParseOwnHost)(state, first + 1, afterLast, memory);
default:
- if (!URI_FUNC(OnExitOwnPortUserInfo)(state, first)) {
- URI_FUNC(StopMalloc)(state);
+ if (!URI_FUNC(OnExitOwnPortUserInfo)(state, first, memory)) {
+ URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
return first;
@@ -1266,9 +1307,11 @@ static const URI_CHAR * URI_FUNC(ParseOwnPortUserInfo)(URI_TYPE(ParserState) * s
* [ownUserInfo]-><:>[ownUserInfo]
* [ownUserInfo]-><@>[ownHost]
*/
-static const URI_CHAR * URI_FUNC(ParseOwnUserInfo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParseOwnUserInfo)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
@@ -1293,24 +1336,24 @@ static const URI_CHAR * URI_FUNC(ParseOwnUserInfo)(URI_TYPE(ParserState) * state
case URI_SET_ALPHA:
{
const URI_CHAR * const afterPctSubUnres
- = URI_FUNC(ParsePctSubUnres)(state, first, afterLast);
+ = URI_FUNC(ParsePctSubUnres)(state, first, afterLast, memory);
if (afterPctSubUnres == NULL) {
return NULL;
}
- return URI_FUNC(ParseOwnUserInfo)(state, afterPctSubUnres, afterLast);
+ return URI_FUNC(ParseOwnUserInfo)(state, afterPctSubUnres, afterLast, memory);
}
case _UT(':'):
- return URI_FUNC(ParseOwnUserInfo)(state, first + 1, afterLast);
+ return URI_FUNC(ParseOwnUserInfo)(state, first + 1, afterLast, memory);
case _UT('@'):
/* SURE */
state->uri->userInfo.afterLast = first; /* USERINFO END */
state->uri->hostText.first = first + 1; /* HOST BEGIN */
- return URI_FUNC(ParseOwnHost)(state, first + 1, afterLast);
+ return URI_FUNC(ParseOwnHost)(state, first + 1, afterLast, memory);
default:
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
}
@@ -1327,7 +1370,9 @@ static URI_INLINE void URI_FUNC(OnExitPartHelperTwo)(URI_TYPE(ParserState) * sta
* [partHelperTwo]->[pathAbsNoLeadSlash] // can take <NULL>
* [partHelperTwo]-></>[authority][pathAbsEmpty]
*/
-static URI_INLINE const URI_CHAR * URI_FUNC(ParsePartHelperTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParsePartHelperTwo)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
if (first >= afterLast) {
URI_FUNC(OnExitPartHelperTwo)(state);
return afterLast;
@@ -1337,21 +1382,21 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParsePartHelperTwo)(URI_TYPE(ParserS
case _UT('/'):
{
const URI_CHAR * const afterAuthority
- = URI_FUNC(ParseAuthority)(state, first + 1, afterLast);
+ = URI_FUNC(ParseAuthority)(state, first + 1, afterLast, memory);
const URI_CHAR * afterPathAbsEmpty;
if (afterAuthority == NULL) {
return NULL;
}
- afterPathAbsEmpty = URI_FUNC(ParsePathAbsEmpty)(state, afterAuthority, afterLast);
+ afterPathAbsEmpty = URI_FUNC(ParsePathAbsEmpty)(state, afterAuthority, afterLast, memory);
- URI_FUNC(FixEmptyTrailSegment)(state->uri);
+ URI_FUNC(FixEmptyTrailSegment)(state->uri, memory);
return afterPathAbsEmpty;
}
default:
URI_FUNC(OnExitPartHelperTwo)(state);
- return URI_FUNC(ParsePathAbsNoLeadSlash)(state, first, afterLast);
+ return URI_FUNC(ParsePathAbsNoLeadSlash)(state, first, afterLast, memory);
}
}
@@ -1361,7 +1406,9 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParsePartHelperTwo)(URI_TYPE(ParserS
* [pathAbsEmpty]-></>[segment][pathAbsEmpty]
* [pathAbsEmpty]-><NULL>
*/
-static const URI_CHAR * URI_FUNC(ParsePathAbsEmpty)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParsePathAbsEmpty)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
if (first >= afterLast) {
return afterLast;
}
@@ -1370,15 +1417,15 @@ static const URI_CHAR * URI_FUNC(ParsePathAbsEmpty)(URI_TYPE(ParserState) * stat
case _UT('/'):
{
const URI_CHAR * const afterSegment
- = URI_FUNC(ParseSegment)(state, first + 1, afterLast);
+ = URI_FUNC(ParseSegment)(state, first + 1, afterLast, memory);
if (afterSegment == NULL) {
return NULL;
}
- if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state);
+ if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
- return URI_FUNC(ParsePathAbsEmpty)(state, afterSegment, afterLast);
+ return URI_FUNC(ParsePathAbsEmpty)(state, afterSegment, afterLast, memory);
}
default:
@@ -1392,7 +1439,9 @@ static const URI_CHAR * URI_FUNC(ParsePathAbsEmpty)(URI_TYPE(ParserState) * stat
* [pathAbsNoLeadSlash]->[segmentNz][zeroMoreSlashSegs]
* [pathAbsNoLeadSlash]-><NULL>
*/
-static URI_INLINE const URI_CHAR * URI_FUNC(ParsePathAbsNoLeadSlash)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParsePathAbsNoLeadSlash)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
if (first >= afterLast) {
return afterLast;
}
@@ -1420,15 +1469,15 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParsePathAbsNoLeadSlash)(URI_TYPE(Pa
case URI_SET_ALPHA:
{
const URI_CHAR * const afterSegmentNz
- = URI_FUNC(ParseSegmentNz)(state, first, afterLast);
+ = URI_FUNC(ParseSegmentNz)(state, first, afterLast, memory);
if (afterSegmentNz == NULL) {
return NULL;
}
- if (!URI_FUNC(PushPathSegment)(state, first, afterSegmentNz)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state);
+ if (!URI_FUNC(PushPathSegment)(state, first, afterSegmentNz, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
- return URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegmentNz, afterLast);
+ return URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegmentNz, afterLast, memory);
}
default:
@@ -1441,18 +1490,20 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParsePathAbsNoLeadSlash)(URI_TYPE(Pa
/*
* [pathRootless]->[segmentNz][zeroMoreSlashSegs]
*/
-static URI_INLINE const URI_CHAR * URI_FUNC(ParsePathRootless)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParsePathRootless)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
const URI_CHAR * const afterSegmentNz
- = URI_FUNC(ParseSegmentNz)(state, first, afterLast);
+ = URI_FUNC(ParseSegmentNz)(state, first, afterLast, memory);
if (afterSegmentNz == NULL) {
return NULL;
} else {
- if (!URI_FUNC(PushPathSegment)(state, first, afterSegmentNz)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state);
+ if (!URI_FUNC(PushPathSegment)(state, first, afterSegmentNz, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
}
- return URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegmentNz, afterLast);
+ return URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegmentNz, afterLast, memory);
}
@@ -1464,15 +1515,17 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParsePathRootless)(URI_TYPE(ParserSt
* [pchar]-><:>
* [pchar]-><@>
*/
-static const URI_CHAR * URI_FUNC(ParsePchar)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParsePchar)(URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
switch (*first) {
case _UT('%'):
- return URI_FUNC(ParsePctEncoded)(state, first, afterLast);
+ return URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
case _UT(':'):
case _UT('@'):
@@ -1496,7 +1549,7 @@ static const URI_CHAR * URI_FUNC(ParsePchar)(URI_TYPE(ParserState) * state, cons
return first + 1;
default:
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
}
@@ -1506,9 +1559,12 @@ static const URI_CHAR * URI_FUNC(ParsePchar)(URI_TYPE(ParserState) * state, cons
/*
* [pctEncoded]-><%>[HEXDIG][HEXDIG]
*/
-static const URI_CHAR * URI_FUNC(ParsePctEncoded)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParsePctEncoded)(
+ URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
@@ -1520,14 +1576,14 @@ static const URI_CHAR * URI_FUNC(ParsePctEncoded)(URI_TYPE(ParserState) * state,
case _UT('%'):
*/
if (first + 1 >= afterLast) {
- URI_FUNC(StopSyntax)(state, first + 1);
+ URI_FUNC(StopSyntax)(state, first + 1, memory);
return NULL;
}
switch (first[1]) {
case URI_SET_HEXDIG:
if (first + 2 >= afterLast) {
- URI_FUNC(StopSyntax)(state, first + 2);
+ URI_FUNC(StopSyntax)(state, first + 2, memory);
return NULL;
}
@@ -1536,18 +1592,18 @@ static const URI_CHAR * URI_FUNC(ParsePctEncoded)(URI_TYPE(ParserState) * state,
return first + 3;
default:
- URI_FUNC(StopSyntax)(state, first + 2);
+ URI_FUNC(StopSyntax)(state, first + 2, memory);
return NULL;
}
default:
- URI_FUNC(StopSyntax)(state, first + 1);
+ URI_FUNC(StopSyntax)(state, first + 1, memory);
return NULL;
}
/*
default:
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
*/
@@ -1560,15 +1616,18 @@ static const URI_CHAR * URI_FUNC(ParsePctEncoded)(URI_TYPE(ParserState) * state,
* [pctSubUnres]->[subDelims]
* [pctSubUnres]->[unreserved]
*/
-static const URI_CHAR * URI_FUNC(ParsePctSubUnres)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParsePctSubUnres)(
+ URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
if (first >= afterLast) {
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
switch (*first) {
case _UT('%'):
- return URI_FUNC(ParsePctEncoded)(state, first, afterLast);
+ return URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
case _UT('!'):
case _UT('$'):
@@ -1590,7 +1649,7 @@ static const URI_CHAR * URI_FUNC(ParsePctSubUnres)(URI_TYPE(ParserState) * state
return first + 1;
default:
- URI_FUNC(StopSyntax)(state, first);
+ URI_FUNC(StopSyntax)(state, first, memory);
return NULL;
}
}
@@ -1623,7 +1682,9 @@ static const URI_CHAR * URI_FUNC(ParsePort)(URI_TYPE(ParserState) * state, const
* [queryFrag]-><?>[queryFrag]
* [queryFrag]-><NULL>
*/
-static const URI_CHAR * URI_FUNC(ParseQueryFrag)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParseQueryFrag)(URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
if (first >= afterLast) {
return afterLast;
}
@@ -1651,16 +1712,16 @@ static const URI_CHAR * URI_FUNC(ParseQueryFrag)(URI_TYPE(ParserState) * state,
case URI_SET_ALPHA:
{
const URI_CHAR * const afterPchar
- = URI_FUNC(ParsePchar)(state, first, afterLast);
+ = URI_FUNC(ParsePchar)(state, first, afterLast, memory);
if (afterPchar == NULL) {
return NULL;
}
- return URI_FUNC(ParseQueryFrag)(state, afterPchar, afterLast);
+ return URI_FUNC(ParseQueryFrag)(state, afterPchar, afterLast, memory);
}
case _UT('/'):
case _UT('?'):
- return URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast);
+ return URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast, memory);
default:
return first;
@@ -1673,7 +1734,9 @@ static const URI_CHAR * URI_FUNC(ParseQueryFrag)(URI_TYPE(ParserState) * state,
* [segment]->[pchar][segment]
* [segment]-><NULL>
*/
-static const URI_CHAR * URI_FUNC(ParseSegment)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParseSegment)(URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
if (first >= afterLast) {
return afterLast;
}
@@ -1701,11 +1764,11 @@ static const URI_CHAR * URI_FUNC(ParseSegment)(URI_TYPE(ParserState) * state, co
case URI_SET_ALPHA:
{
const URI_CHAR * const afterPchar
- = URI_FUNC(ParsePchar)(state, first, afterLast);
+ = URI_FUNC(ParsePchar)(state, first, afterLast, memory);
if (afterPchar == NULL) {
return NULL;
}
- return URI_FUNC(ParseSegment)(state, afterPchar, afterLast);
+ return URI_FUNC(ParseSegment)(state, afterPchar, afterLast, memory);
}
default:
@@ -1718,19 +1781,24 @@ static const URI_CHAR * URI_FUNC(ParseSegment)(URI_TYPE(ParserState) * state, co
/*
* [segmentNz]->[pchar][segment]
*/
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseSegmentNz)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseSegmentNz)(
+ URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
const URI_CHAR * const afterPchar
- = URI_FUNC(ParsePchar)(state, first, afterLast);
+ = URI_FUNC(ParsePchar)(state, first, afterLast, memory);
if (afterPchar == NULL) {
return NULL;
}
- return URI_FUNC(ParseSegment)(state, afterPchar, afterLast);
+ return URI_FUNC(ParseSegment)(state, afterPchar, afterLast, memory);
}
-static URI_INLINE UriBool URI_FUNC(OnExitSegmentNzNcOrScheme2)(URI_TYPE(ParserState) * state, const URI_CHAR * first) {
- if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first)) { /* SEGMENT BOTH */
+static URI_INLINE UriBool URI_FUNC(OnExitSegmentNzNcOrScheme2)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ UriMemoryManager * memory) {
+ if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
return URI_FALSE; /* Raises malloc error*/
}
state->uri->scheme.first = NULL; /* Not a scheme, reset */
@@ -1763,10 +1831,12 @@ static URI_INLINE UriBool URI_FUNC(OnExitSegmentNzNcOrScheme2)(URI_TYPE(ParserSt
* [segmentNzNcOrScheme2]-><'>[mustBeSegmentNzNc]
* [segmentNzNcOrScheme2]-><->[segmentNzNcOrScheme2]
*/
-static const URI_CHAR * URI_FUNC(ParseSegmentNzNcOrScheme2)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParseSegmentNzNcOrScheme2)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
if (first >= afterLast) {
- if (!URI_FUNC(OnExitSegmentNzNcOrScheme2)(state, first)) {
- URI_FUNC(StopMalloc)(state);
+ if (!URI_FUNC(OnExitSegmentNzNcOrScheme2)(state, first, memory)) {
+ URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
return afterLast;
@@ -1778,16 +1848,16 @@ static const URI_CHAR * URI_FUNC(ParseSegmentNzNcOrScheme2)(URI_TYPE(ParserState
case _UT('-'):
case URI_SET_ALPHA:
case URI_SET_DIGIT:
- return URI_FUNC(ParseSegmentNzNcOrScheme2)(state, first + 1, afterLast);
+ return URI_FUNC(ParseSegmentNzNcOrScheme2)(state, first + 1, afterLast, memory);
case _UT('%'):
{
const URI_CHAR * const afterPctEncoded
- = URI_FUNC(ParsePctEncoded)(state, first, afterLast);
+ = URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
if (afterPctEncoded == NULL) {
return NULL;
}
- return URI_FUNC(ParseMustBeSegmentNzNc)(state, afterPctEncoded, afterLast);
+ return URI_FUNC(ParseMustBeSegmentNzNc)(state, afterPctEncoded, afterLast, memory);
}
case _UT('!'):
@@ -1803,50 +1873,50 @@ static const URI_CHAR * URI_FUNC(ParseSegmentNzNcOrScheme2)(URI_TYPE(ParserState
case _UT('~'):
case _UT('='):
case _UT('\''):
- return URI_FUNC(ParseMustBeSegmentNzNc)(state, first + 1, afterLast);
+ return URI_FUNC(ParseMustBeSegmentNzNc)(state, first + 1, afterLast, memory);
case _UT('/'):
{
const URI_CHAR * afterZeroMoreSlashSegs;
const URI_CHAR * const afterSegment
- = URI_FUNC(ParseSegment)(state, first + 1, afterLast);
+ = URI_FUNC(ParseSegment)(state, first + 1, afterLast, memory);
if (afterSegment == NULL) {
return NULL;
}
- if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state);
+ if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
state->uri->scheme.first = NULL; /* Not a scheme, reset */
- if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state);
+ if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
afterZeroMoreSlashSegs
- = URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegment, afterLast);
+ = URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegment, afterLast, memory);
if (afterZeroMoreSlashSegs == NULL) {
return NULL;
}
- return URI_FUNC(ParseUriTail)(state, afterZeroMoreSlashSegs, afterLast);
+ return URI_FUNC(ParseUriTail)(state, afterZeroMoreSlashSegs, afterLast, memory);
}
case _UT(':'):
{
const URI_CHAR * const afterHierPart
- = URI_FUNC(ParseHierPart)(state, first + 1, afterLast);
+ = URI_FUNC(ParseHierPart)(state, first + 1, afterLast, memory);
state->uri->scheme.afterLast = first; /* SCHEME END */
if (afterHierPart == NULL) {
return NULL;
}
- return URI_FUNC(ParseUriTail)(state, afterHierPart, afterLast);
+ return URI_FUNC(ParseUriTail)(state, afterHierPart, afterLast, memory);
}
default:
- if (!URI_FUNC(OnExitSegmentNzNcOrScheme2)(state, first)) {
- URI_FUNC(StopMalloc)(state);
+ if (!URI_FUNC(OnExitSegmentNzNcOrScheme2)(state, first, memory)) {
+ URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
- return URI_FUNC(ParseUriTail)(state, first, afterLast);
+ return URI_FUNC(ParseUriTail)(state, first, afterLast, memory);
}
}
@@ -1865,7 +1935,9 @@ static const URI_CHAR * URI_FUNC(ParseSegmentNzNcOrScheme2)(URI_TYPE(ParserState
* [uriReference]-><~>[mustBeSegmentNzNc]
* [uriReference]-><->[mustBeSegmentNzNc]
*/
-static const URI_CHAR * URI_FUNC(ParseUriReference)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParseUriReference)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
if (first >= afterLast) {
return afterLast;
}
@@ -1873,7 +1945,7 @@ static const URI_CHAR * URI_FUNC(ParseUriReference)(URI_TYPE(ParserState) * stat
switch (*first) {
case URI_SET_ALPHA:
state->uri->scheme.first = first; /* SCHEME BEGIN */
- return URI_FUNC(ParseSegmentNzNcOrScheme2)(state, first + 1, afterLast);
+ return URI_FUNC(ParseSegmentNzNcOrScheme2)(state, first + 1, afterLast, memory);
case URI_SET_DIGIT:
case _UT('!'):
@@ -1893,31 +1965,31 @@ static const URI_CHAR * URI_FUNC(ParseUriReference)(URI_TYPE(ParserState) * stat
case _UT('-'):
case _UT('@'):
state->uri->scheme.first = first; /* SEGMENT BEGIN, ABUSE SCHEME POINTER */
- return URI_FUNC(ParseMustBeSegmentNzNc)(state, first + 1, afterLast);
+ return URI_FUNC(ParseMustBeSegmentNzNc)(state, first + 1, afterLast, memory);
case _UT('%'):
{
const URI_CHAR * const afterPctEncoded
- = URI_FUNC(ParsePctEncoded)(state, first, afterLast);
+ = URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
if (afterPctEncoded == NULL) {
return NULL;
}
state->uri->scheme.first = first; /* SEGMENT BEGIN, ABUSE SCHEME POINTER */
- return URI_FUNC(ParseMustBeSegmentNzNc)(state, afterPctEncoded, afterLast);
+ return URI_FUNC(ParseMustBeSegmentNzNc)(state, afterPctEncoded, afterLast, memory);
}
case _UT('/'):
{
const URI_CHAR * const afterPartHelperTwo
- = URI_FUNC(ParsePartHelperTwo)(state, first + 1, afterLast);
+ = URI_FUNC(ParsePartHelperTwo)(state, first + 1, afterLast, memory);
if (afterPartHelperTwo == NULL) {
return NULL;
}
- return URI_FUNC(ParseUriTail)(state, afterPartHelperTwo, afterLast);
+ return URI_FUNC(ParseUriTail)(state, afterPartHelperTwo, afterLast, memory);
}
default:
- return URI_FUNC(ParseUriTail)(state, first, afterLast);
+ return URI_FUNC(ParseUriTail)(state, first, afterLast, memory);
}
}
@@ -1928,7 +2000,10 @@ static const URI_CHAR * URI_FUNC(ParseUriReference)(URI_TYPE(ParserState) * stat
* [uriTail]-><?>[queryFrag][uriTailTwo]
* [uriTail]-><NULL>
*/
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseUriTail)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseUriTail)(
+ URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
if (first >= afterLast) {
return afterLast;
}
@@ -1936,7 +2011,7 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseUriTail)(URI_TYPE(ParserState)
switch (*first) {
case _UT('#'):
{
- const URI_CHAR * const afterQueryFrag = URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast);
+ const URI_CHAR * const afterQueryFrag = URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast, memory);
if (afterQueryFrag == NULL) {
return NULL;
}
@@ -1948,13 +2023,13 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseUriTail)(URI_TYPE(ParserState)
case _UT('?'):
{
const URI_CHAR * const afterQueryFrag
- = URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast);
+ = URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast, memory);
if (afterQueryFrag == NULL) {
return NULL;
}
state->uri->query.first = first + 1; /* QUERY BEGIN */
state->uri->query.afterLast = afterQueryFrag; /* QUERY END */
- return URI_FUNC(ParseUriTailTwo)(state, afterQueryFrag, afterLast);
+ return URI_FUNC(ParseUriTailTwo)(state, afterQueryFrag, afterLast, memory);
}
default:
@@ -1968,7 +2043,10 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseUriTail)(URI_TYPE(ParserState)
* [uriTailTwo]-><#>[queryFrag]
* [uriTailTwo]-><NULL>
*/
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseUriTailTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseUriTailTwo)(
+ URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
if (first >= afterLast) {
return afterLast;
}
@@ -1976,7 +2054,7 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseUriTailTwo)(URI_TYPE(ParserStat
switch (*first) {
case _UT('#'):
{
- const URI_CHAR * const afterQueryFrag = URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast);
+ const URI_CHAR * const afterQueryFrag = URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast, memory);
if (afterQueryFrag == NULL) {
return NULL;
}
@@ -1996,7 +2074,9 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseUriTailTwo)(URI_TYPE(ParserStat
* [zeroMoreSlashSegs]-></>[segment][zeroMoreSlashSegs]
* [zeroMoreSlashSegs]-><NULL>
*/
-static const URI_CHAR * URI_FUNC(ParseZeroMoreSlashSegs)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParseZeroMoreSlashSegs)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
if (first >= afterLast) {
return afterLast;
}
@@ -2005,15 +2085,15 @@ static const URI_CHAR * URI_FUNC(ParseZeroMoreSlashSegs)(URI_TYPE(ParserState) *
case _UT('/'):
{
const URI_CHAR * const afterSegment
- = URI_FUNC(ParseSegment)(state, first + 1, afterLast);
+ = URI_FUNC(ParseSegment)(state, first + 1, afterLast, memory);
if (afterSegment == NULL) {
return NULL;
}
- if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment)) { /* SEGMENT BOTH */
- URI_FUNC(StopMalloc)(state);
+ if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment, memory)) { /* SEGMENT BOTH */
+ URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
- return URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegment, afterLast);
+ return URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegment, afterLast, memory);
}
default:
@@ -2031,12 +2111,13 @@ static URI_INLINE void URI_FUNC(ResetParserStateExceptUri)(URI_TYPE(ParserState)
-static URI_INLINE UriBool URI_FUNC(PushPathSegment)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
- URI_TYPE(PathSegment) * segment = malloc(1 * sizeof(URI_TYPE(PathSegment)));
+static URI_INLINE UriBool URI_FUNC(PushPathSegment)(
+ URI_TYPE(ParserState) * state, const URI_CHAR * first,
+ const URI_CHAR * afterLast, UriMemoryManager * memory) {
+ URI_TYPE(PathSegment) * segment = memory->calloc(memory, 1, sizeof(URI_TYPE(PathSegment)));
if (segment == NULL) {
return URI_FALSE; /* Raises malloc error */
}
- memset(segment, 0, sizeof(URI_TYPE(PathSegment)));
if (first == afterLast) {
segment->text.first = URI_FUNC(SafeToPointTo);
segment->text.afterLast = URI_FUNC(SafeToPointTo);
@@ -2061,7 +2142,16 @@ static URI_INLINE UriBool URI_FUNC(PushPathSegment)(URI_TYPE(ParserState) * stat
-int URI_FUNC(ParseUriEx)(URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast) {
+int URI_FUNC(ParseUriEx)(URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast) {
+ return URI_FUNC(ParseUriExMm)(state, first, afterLast, NULL);
+}
+
+
+
+static int URI_FUNC(ParseUriExMm)(URI_TYPE(ParserState) * state,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
const URI_CHAR * afterUriReference;
URI_TYPE(Uri) * uri;
@@ -2069,6 +2159,8 @@ int URI_FUNC(ParseUriEx)(URI_TYPE(ParserState) * state, const URI_CHAR * first,
if ((state == NULL) || (first == NULL) || (afterLast == NULL)) {
return URI_ERROR_NULL;
}
+ URI_CHECK_MEMORY_MANAGER(memory); /* may return */
+
uri = state->uri;
/* Init parser */
@@ -2076,12 +2168,12 @@ int URI_FUNC(ParseUriEx)(URI_TYPE(ParserState) * state, const URI_CHAR * first,
URI_FUNC(ResetUri)(uri);
/* Parse */
- afterUriReference = URI_FUNC(ParseUriReference)(state, first, afterLast);
+ afterUriReference = URI_FUNC(ParseUriReference)(state, first, afterLast, memory);
if (afterUriReference == NULL) {
return state->errorCode;
}
if (afterUriReference != afterLast) {
- URI_FUNC(StopSyntax)(state, afterUriReference);
+ URI_FUNC(StopSyntax)(state, afterUriReference, memory);
return state->errorCode;
}
return URI_SUCCESS;
@@ -2098,16 +2190,70 @@ int URI_FUNC(ParseUri)(URI_TYPE(ParserState) * state, const URI_CHAR * text) {
+int URI_FUNC(ParseSingleUri)(URI_TYPE(Uri) * uri, const URI_CHAR * text,
+ const URI_CHAR ** errorPos) {
+ return URI_FUNC(ParseSingleUriEx)(uri, text, NULL, errorPos);
+}
+
+
+
+int URI_FUNC(ParseSingleUriEx)(URI_TYPE(Uri) * uri,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ const URI_CHAR ** errorPos) {
+ if ((afterLast == NULL) && (first != NULL)) {
+ afterLast = first + URI_STRLEN(first);
+ }
+ return URI_FUNC(ParseSingleUriExMm)(uri, first, afterLast, errorPos, NULL);
+}
+
+
+
+int URI_FUNC(ParseSingleUriExMm)(URI_TYPE(Uri) * uri,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ const URI_CHAR ** errorPos, UriMemoryManager * memory) {
+ URI_TYPE(ParserState) state;
+ int res;
+
+ /* Check params */
+ if ((uri == NULL) || (first == NULL) || (afterLast == NULL)) {
+ return URI_ERROR_NULL;
+ }
+ URI_CHECK_MEMORY_MANAGER(memory); /* may return */
+
+ state.uri = uri;
+
+ res = URI_FUNC(ParseUriExMm)(&state, first, afterLast, memory);
+
+ if (res != URI_SUCCESS) {
+ if (errorPos != NULL) {
+ *errorPos = state.errorPos;
+ }
+ URI_FUNC(FreeUriMembersMm)(uri, memory);
+ }
+
+ return res;
+}
+
+
+
void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri) {
+ URI_FUNC(FreeUriMembersMm)(uri, NULL);
+}
+
+
+
+int URI_FUNC(FreeUriMembersMm)(URI_TYPE(Uri) * uri, UriMemoryManager * memory) {
if (uri == NULL) {
- return;
+ return URI_ERROR_NULL;
}
+ URI_CHECK_MEMORY_MANAGER(memory); /* may return */
+
if (uri->owner) {
/* Scheme */
if (uri->scheme.first != NULL) {
if (uri->scheme.first != uri->scheme.afterLast) {
- free((URI_CHAR *)uri->scheme.first);
+ memory->free(memory, (URI_CHAR *)uri->scheme.first);
}
uri->scheme.first = NULL;
uri->scheme.afterLast = NULL;
@@ -2116,7 +2262,7 @@ void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri) {
/* User info */
if (uri->userInfo.first != NULL) {
if (uri->userInfo.first != uri->userInfo.afterLast) {
- free((URI_CHAR *)uri->userInfo.first);
+ memory->free(memory, (URI_CHAR *)uri->userInfo.first);
}
uri->userInfo.first = NULL;
uri->userInfo.afterLast = NULL;
@@ -2125,7 +2271,7 @@ void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri) {
/* Host data - IPvFuture */
if (uri->hostData.ipFuture.first != NULL) {
if (uri->hostData.ipFuture.first != uri->hostData.ipFuture.afterLast) {
- free((URI_CHAR *)uri->hostData.ipFuture.first);
+ memory->free(memory, (URI_CHAR *)uri->hostData.ipFuture.first);
}
uri->hostData.ipFuture.first = NULL;
uri->hostData.ipFuture.afterLast = NULL;
@@ -2139,7 +2285,7 @@ void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri) {
&& (uri->hostData.ip6 == NULL)) {
/* Real regname */
if (uri->hostText.first != uri->hostText.afterLast) {
- free((URI_CHAR *)uri->hostText.first);
+ memory->free(memory, (URI_CHAR *)uri->hostText.first);
}
uri->hostText.first = NULL;
uri->hostText.afterLast = NULL;
@@ -2148,20 +2294,20 @@ void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri) {
/* Host data - IPv4 */
if (uri->hostData.ip4 != NULL) {
- free(uri->hostData.ip4);
+ memory->free(memory, uri->hostData.ip4);
uri->hostData.ip4 = NULL;
}
/* Host data - IPv6 */
if (uri->hostData.ip6 != NULL) {
- free(uri->hostData.ip6);
+ memory->free(memory, uri->hostData.ip6);
uri->hostData.ip6 = NULL;
}
/* Port text */
if (uri->owner && (uri->portText.first != NULL)) {
if (uri->portText.first != uri->portText.afterLast) {
- free((URI_CHAR *)uri->portText.first);
+ memory->free(memory, (URI_CHAR *)uri->portText.first);
}
uri->portText.first = NULL;
uri->portText.afterLast = NULL;
@@ -2174,9 +2320,9 @@ void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri) {
URI_TYPE(PathSegment) * const next = segWalk->next;
if (uri->owner && (segWalk->text.first != NULL)
&& (segWalk->text.first < segWalk->text.afterLast)) {
- free((URI_CHAR *)segWalk->text.first);
+ memory->free(memory, (URI_CHAR *)segWalk->text.first);
}
- free(segWalk);
+ memory->free(memory, segWalk);
segWalk = next;
}
uri->pathHead = NULL;
@@ -2187,7 +2333,7 @@ void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri) {
/* Query */
if (uri->query.first != NULL) {
if (uri->query.first != uri->query.afterLast) {
- free((URI_CHAR *)uri->query.first);
+ memory->free(memory, (URI_CHAR *)uri->query.first);
}
uri->query.first = NULL;
uri->query.afterLast = NULL;
@@ -2196,17 +2342,20 @@ void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri) {
/* Fragment */
if (uri->fragment.first != NULL) {
if (uri->fragment.first != uri->fragment.afterLast) {
- free((URI_CHAR *)uri->fragment.first);
+ memory->free(memory, (URI_CHAR *)uri->fragment.first);
}
uri->fragment.first = NULL;
uri->fragment.afterLast = NULL;
}
}
+
+ return URI_SUCCESS;
}
UriBool URI_FUNC(_TESTING_ONLY_ParseIpSix)(const URI_CHAR * text) {
+ UriMemoryManager * const memory = &defaultMemoryManager;
URI_TYPE(Uri) uri;
URI_TYPE(ParserState) parser;
const URI_CHAR * const afterIpSix = text + URI_STRLEN(text);
@@ -2215,9 +2364,9 @@ UriBool URI_FUNC(_TESTING_ONLY_ParseIpSix)(const URI_CHAR * text) {
URI_FUNC(ResetUri)(&uri);
parser.uri = &uri;
URI_FUNC(ResetParserStateExceptUri)(&parser);
- parser.uri->hostData.ip6 = malloc(1 * sizeof(UriIp6));
- res = URI_FUNC(ParseIPv6address2)(&parser, text, afterIpSix);
- URI_FUNC(FreeUriMembers)(&uri);
+ parser.uri->hostData.ip6 = memory->malloc(memory, 1 * sizeof(UriIp6));
+ res = URI_FUNC(ParseIPv6address2)(&parser, text, afterIpSix, memory);
+ URI_FUNC(FreeUriMembersMm)(&uri, memory);
return res == afterIpSix ? URI_TRUE : URI_FALSE;
}
diff --git a/src/UriQuery.c b/src/UriQuery.c
index f0cd4f8..326e963 100644
--- a/src/UriQuery.c
+++ b/src/UriQuery.c
@@ -64,10 +64,15 @@
#ifndef URI_DOXYGEN
# include <uriparser/Uri.h>
# include "UriCommon.h"
+# include "UriMemory.h"
#endif
+#include <limits.h>
+
+
+
static int URI_FUNC(ComposeQueryEngine)(URI_CHAR * dest,
const URI_TYPE(QueryList) * queryList,
int maxChars, int * charsWritten, int * charsRequired,
@@ -76,7 +81,8 @@ static int URI_FUNC(ComposeQueryEngine)(URI_CHAR * dest,
static UriBool URI_FUNC(AppendQueryItem)(URI_TYPE(QueryList) ** prevNext,
int * itemCount, const URI_CHAR * keyFirst, const URI_CHAR * keyAfter,
const URI_CHAR * valueFirst, const URI_CHAR * valueAfter,
- UriBool plusToSpace, UriBreakConversion breakConversion);
+ UriBool plusToSpace, UriBreakConversion breakConversion,
+ UriMemoryManager * memory);
@@ -145,6 +151,16 @@ int URI_FUNC(ComposeQueryMalloc)(URI_CHAR ** dest,
int URI_FUNC(ComposeQueryMallocEx)(URI_CHAR ** dest,
const URI_TYPE(QueryList) * queryList,
UriBool spaceToPlus, UriBool normalizeBreaks) {
+ return URI_FUNC(ComposeQueryMallocExMm)(dest, queryList, spaceToPlus,
+ normalizeBreaks, NULL);
+}
+
+
+
+int URI_FUNC(ComposeQueryMallocExMm)(URI_CHAR ** dest,
+ const URI_TYPE(QueryList) * queryList,
+ UriBool spaceToPlus, UriBool normalizeBreaks,
+ UriMemoryManager * memory) {
int charsRequired;
int res;
URI_CHAR * queryString;
@@ -153,6 +169,8 @@ int URI_FUNC(ComposeQueryMallocEx)(URI_CHAR ** dest,
return URI_ERROR_NULL;
}
+ URI_CHECK_MEMORY_MANAGER(memory); /* may return */
+
/* Calculate space */
res = URI_FUNC(ComposeQueryCharsRequiredEx)(queryList, &charsRequired,
spaceToPlus, normalizeBreaks);
@@ -162,7 +180,7 @@ int URI_FUNC(ComposeQueryMallocEx)(URI_CHAR ** dest,
charsRequired++;
/* Allocate space */
- queryString = malloc(charsRequired * sizeof(URI_CHAR));
+ queryString = memory->malloc(memory, charsRequired * sizeof(URI_CHAR));
if (queryString == NULL) {
return URI_ERROR_MALLOC;
}
@@ -171,7 +189,7 @@ int URI_FUNC(ComposeQueryMallocEx)(URI_CHAR ** dest,
res = URI_FUNC(ComposeQueryEx)(queryString, queryList, charsRequired,
NULL, spaceToPlus, normalizeBreaks);
if (res != URI_SUCCESS) {
- free(queryString);
+ memory->free(memory, queryString);
return res;
}
@@ -186,7 +204,7 @@ int URI_FUNC(ComposeQueryEngine)(URI_CHAR * dest,
int maxChars, int * charsWritten, int * charsRequired,
UriBool spaceToPlus, UriBool normalizeBreaks) {
UriBool firstItem = URI_TRUE;
- int ampersandLen = 0;
+ int ampersandLen = 0; /* increased to 1 from second item on */
URI_CHAR * write = dest;
/* Subtract terminator */
@@ -195,46 +213,48 @@ int URI_FUNC(ComposeQueryEngine)(URI_CHAR * dest,
} else {
maxChars--;
}
-
+
while (queryList != NULL) {
const URI_CHAR * const key = queryList->key;
const URI_CHAR * const value = queryList->value;
const int worstCase = (normalizeBreaks == URI_TRUE ? 6 : 3);
const int keyLen = (key == NULL) ? 0 : (int)URI_STRLEN(key);
- const int keyRequiredChars = worstCase * keyLen;
+ int keyRequiredChars;
const int valueLen = (value == NULL) ? 0 : (int)URI_STRLEN(value);
- const int valueRequiredChars = worstCase * valueLen;
+ int valueRequiredChars;
+
+ if ((keyLen >= INT_MAX / worstCase) || (valueLen >= INT_MAX / worstCase)) {
+ return URI_ERROR_OUTPUT_TOO_LARGE;
+ }
+ keyRequiredChars = worstCase * keyLen;
+ valueRequiredChars = worstCase * valueLen;
if (dest == NULL) {
+ (*charsRequired) += ampersandLen + keyRequiredChars + ((value == NULL)
+ ? 0
+ : 1 + valueRequiredChars);
+
if (firstItem == URI_TRUE) {
ampersandLen = 1;
firstItem = URI_FALSE;
}
-
- (*charsRequired) += ampersandLen + keyRequiredChars + ((value == NULL)
- ? 0
- : 1 + valueRequiredChars);
} else {
- URI_CHAR * afterKey;
-
if ((write - dest) + ampersandLen + keyRequiredChars > maxChars) {
return URI_ERROR_OUTPUT_TOO_LARGE;
}
/* Copy key */
if (firstItem == URI_TRUE) {
+ ampersandLen = 1;
firstItem = URI_FALSE;
} else {
write[0] = _UT('&');
write++;
}
- afterKey = URI_FUNC(EscapeEx)(key, key + keyLen,
+ write = URI_FUNC(EscapeEx)(key, key + keyLen,
write, spaceToPlus, normalizeBreaks);
- write += (afterKey - write);
if (value != NULL) {
- URI_CHAR * afterValue;
-
if ((write - dest) + 1 + valueRequiredChars > maxChars) {
return URI_ERROR_OUTPUT_TOO_LARGE;
}
@@ -242,9 +262,8 @@ int URI_FUNC(ComposeQueryEngine)(URI_CHAR * dest,
/* Copy value */
write[0] = _UT('=');
write++;
- afterValue = URI_FUNC(EscapeEx)(value, value + valueLen,
+ write = URI_FUNC(EscapeEx)(value, value + valueLen,
write, spaceToPlus, normalizeBreaks);
- write += (afterValue - write);
}
}
@@ -266,7 +285,8 @@ int URI_FUNC(ComposeQueryEngine)(URI_CHAR * dest,
UriBool URI_FUNC(AppendQueryItem)(URI_TYPE(QueryList) ** prevNext,
int * itemCount, const URI_CHAR * keyFirst, const URI_CHAR * keyAfter,
const URI_CHAR * valueFirst, const URI_CHAR * valueAfter,
- UriBool plusToSpace, UriBreakConversion breakConversion) {
+ UriBool plusToSpace, UriBreakConversion breakConversion,
+ UriMemoryManager * memory) {
const int keyLen = (int)(keyAfter - keyFirst);
const int valueLen = (int)(valueAfter - valueFirst);
URI_CHAR * key;
@@ -281,7 +301,7 @@ UriBool URI_FUNC(AppendQueryItem)(URI_TYPE(QueryList) ** prevNext,
}
/* Append new empty item */
- *prevNext = malloc(1 * sizeof(URI_TYPE(QueryList)));
+ *prevNext = memory->malloc(memory, 1 * sizeof(URI_TYPE(QueryList)));
if (*prevNext == NULL) {
return URI_FALSE; /* Raises malloc error */
}
@@ -289,9 +309,9 @@ UriBool URI_FUNC(AppendQueryItem)(URI_TYPE(QueryList) ** prevNext,
/* Fill key */
- key = malloc((keyLen + 1) * sizeof(URI_CHAR));
+ key = memory->malloc(memory, (keyLen + 1) * sizeof(URI_CHAR));
if (key == NULL) {
- free(*prevNext);
+ memory->free(memory, *prevNext);
*prevNext = NULL;
return URI_FALSE; /* Raises malloc error */
}
@@ -309,10 +329,10 @@ UriBool URI_FUNC(AppendQueryItem)(URI_TYPE(QueryList) ** prevNext,
/* Fill value */
if (valueFirst != NULL) {
- value = malloc((valueLen + 1) * sizeof(URI_CHAR));
+ value = memory->malloc(memory, (valueLen + 1) * sizeof(URI_CHAR));
if (value == NULL) {
- free(key);
- free(*prevNext);
+ memory->free(memory, key);
+ memory->free(memory, *prevNext);
*prevNext = NULL;
return URI_FALSE; /* Raises malloc error */
}
@@ -338,13 +358,22 @@ UriBool URI_FUNC(AppendQueryItem)(URI_TYPE(QueryList) ** prevNext,
void URI_FUNC(FreeQueryList)(URI_TYPE(QueryList) * queryList) {
+ URI_FUNC(FreeQueryListMm)(queryList, NULL);
+}
+
+
+
+int URI_FUNC(FreeQueryListMm)(URI_TYPE(QueryList) * queryList,
+ UriMemoryManager * memory) {
+ URI_CHECK_MEMORY_MANAGER(memory); /* may return */
while (queryList != NULL) {
URI_TYPE(QueryList) * nextBackup = queryList->next;
- free((URI_CHAR *)queryList->key); /* const cast */
- free((URI_CHAR *)queryList->value); /* const cast */
- free(queryList);
+ memory->free(memory, (URI_CHAR *)queryList->key); /* const cast */
+ memory->free(memory, (URI_CHAR *)queryList->value); /* const cast */
+ memory->free(memory, queryList);
queryList = nextBackup;
}
+ return URI_SUCCESS;
}
@@ -363,6 +392,16 @@ int URI_FUNC(DissectQueryMalloc)(URI_TYPE(QueryList) ** dest, int * itemCount,
int URI_FUNC(DissectQueryMallocEx)(URI_TYPE(QueryList) ** dest, int * itemCount,
const URI_CHAR * first, const URI_CHAR * afterLast,
UriBool plusToSpace, UriBreakConversion breakConversion) {
+ return URI_FUNC(DissectQueryMallocExMm)(dest, itemCount, first, afterLast,
+ plusToSpace, breakConversion, NULL);
+}
+
+
+
+int URI_FUNC(DissectQueryMallocExMm)(URI_TYPE(QueryList) ** dest, int * itemCount,
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriBool plusToSpace, UriBreakConversion breakConversion,
+ UriMemoryManager * memory) {
const URI_CHAR * walk = first;
const URI_CHAR * keyFirst = first;
const URI_CHAR * keyAfter = NULL;
@@ -380,6 +419,8 @@ int URI_FUNC(DissectQueryMallocEx)(URI_TYPE(QueryList) ** dest, int * itemCount,
return URI_ERROR_RANGE_INVALID;
}
+ URI_CHECK_MEMORY_MANAGER(memory); /* may return */
+
*dest = NULL;
*itemsAppended = 0;
@@ -395,11 +436,11 @@ int URI_FUNC(DissectQueryMallocEx)(URI_TYPE(QueryList) ** dest, int * itemCount,
if (URI_FUNC(AppendQueryItem)(prevNext, itemsAppended,
keyFirst, keyAfter, valueFirst, valueAfter,
- plusToSpace, breakConversion)
+ plusToSpace, breakConversion, memory)
== URI_FALSE) {
/* Free list we built */
*itemsAppended = 0;
- URI_FUNC(FreeQueryList)(*dest);
+ URI_FUNC(FreeQueryListMm)(*dest, memory);
return URI_ERROR_MALLOC;
}
@@ -444,11 +485,11 @@ int URI_FUNC(DissectQueryMallocEx)(URI_TYPE(QueryList) ** dest, int * itemCount,
}
if (URI_FUNC(AppendQueryItem)(prevNext, itemsAppended, keyFirst, keyAfter,
- valueFirst, valueAfter, plusToSpace, breakConversion)
+ valueFirst, valueAfter, plusToSpace, breakConversion, memory)
== URI_FALSE) {
/* Free list we built */
*itemsAppended = 0;
- URI_FUNC(FreeQueryList)(*dest);
+ URI_FUNC(FreeQueryListMm)(*dest, memory);
return URI_ERROR_MALLOC;
}
diff --git a/src/UriResolve.c b/src/UriResolve.c
index bb1d21a..6569819 100644
--- a/src/UriResolve.c
+++ b/src/UriResolve.c
@@ -64,6 +64,7 @@
#ifndef URI_DOXYGEN
# include <uriparser/Uri.h>
# include "UriCommon.h"
+# include "UriMemory.h"
#endif
@@ -71,7 +72,7 @@
/* Appends a relative URI to an absolute. The last path segment of
* the absolute URI is replaced. */
static URI_INLINE UriBool URI_FUNC(MergePath)(URI_TYPE(Uri) * absWork,
- const URI_TYPE(Uri) * relAppend) {
+ const URI_TYPE(Uri) * relAppend, UriMemoryManager * memory) {
URI_TYPE(PathSegment) * sourceWalker;
URI_TYPE(PathSegment) * destPrev;
if (relAppend->pathHead == NULL) {
@@ -80,7 +81,7 @@ static URI_INLINE UriBool URI_FUNC(MergePath)(URI_TYPE(Uri) * absWork,
/* Replace last segment ("" if trailing slash) with first of append chain */
if (absWork->pathHead == NULL) {
- URI_TYPE(PathSegment) * const dup = malloc(sizeof(URI_TYPE(PathSegment)));
+ URI_TYPE(PathSegment) * const dup = memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
if (dup == NULL) {
return URI_FALSE; /* Raises malloc error */
}
@@ -99,7 +100,7 @@ static URI_INLINE UriBool URI_FUNC(MergePath)(URI_TYPE(Uri) * absWork,
destPrev = absWork->pathTail;
for (;;) {
- URI_TYPE(PathSegment) * const dup = malloc(sizeof(URI_TYPE(PathSegment)));
+ URI_TYPE(PathSegment) * const dup = memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
if (dup == NULL) {
destPrev->next = NULL;
absWork->pathTail = destPrev;
@@ -121,7 +122,8 @@ static URI_INLINE UriBool URI_FUNC(MergePath)(URI_TYPE(Uri) * absWork,
}
-static int URI_FUNC(ResolveAbsolutePathFlag)(URI_TYPE(Uri) * absWork) {
+static int URI_FUNC(ResolveAbsolutePathFlag)(URI_TYPE(Uri) * absWork,
+ UriMemoryManager * memory) {
if (absWork == NULL) {
return URI_ERROR_NULL;
}
@@ -129,7 +131,7 @@ static int URI_FUNC(ResolveAbsolutePathFlag)(URI_TYPE(Uri) * absWork) {
if (URI_FUNC(IsHostSet)(absWork) && absWork->absolutePath) {
/* Empty segment needed, instead? */
if (absWork->pathHead == NULL) {
- URI_TYPE(PathSegment) * const segment = malloc(sizeof(URI_TYPE(PathSegment)));
+ URI_TYPE(PathSegment) * const segment = memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
if (segment == NULL) {
return URI_ERROR_MALLOC;
}
@@ -151,7 +153,7 @@ static int URI_FUNC(ResolveAbsolutePathFlag)(URI_TYPE(Uri) * absWork) {
static int URI_FUNC(AddBaseUriImpl)(URI_TYPE(Uri) * absDest,
const URI_TYPE(Uri) * relSource,
const URI_TYPE(Uri) * absBase,
- UriResolutionOptions options) {
+ UriResolutionOptions options, UriMemoryManager * memory) {
UriBool relSourceHasScheme;
if (absDest == NULL) {
@@ -186,14 +188,14 @@ static int URI_FUNC(AddBaseUriImpl)(URI_TYPE(Uri) * absDest,
/* [02/32] T.scheme = R.scheme; */
absDest->scheme = relSource->scheme;
/* [03/32] T.authority = R.authority; */
- if (!URI_FUNC(CopyAuthority)(absDest, relSource)) {
+ if (!URI_FUNC(CopyAuthority)(absDest, relSource, memory)) {
return URI_ERROR_MALLOC;
}
/* [04/32] T.path = remove_dot_segments(R.path); */
- if (!URI_FUNC(CopyPath)(absDest, relSource)) {
+ if (!URI_FUNC(CopyPath)(absDest, relSource, memory)) {
return URI_ERROR_MALLOC;
}
- if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest)) {
+ if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest, memory)) {
return URI_ERROR_MALLOC;
}
/* [05/32] T.query = R.query; */
@@ -203,14 +205,14 @@ static int URI_FUNC(AddBaseUriImpl)(URI_TYPE(Uri) * absDest,
/* [07/32] if defined(R.authority) then */
if (URI_FUNC(IsHostSet)(relSource)) {
/* [08/32] T.authority = R.authority; */
- if (!URI_FUNC(CopyAuthority)(absDest, relSource)) {
+ if (!URI_FUNC(CopyAuthority)(absDest, relSource, memory)) {
return URI_ERROR_MALLOC;
}
/* [09/32] T.path = remove_dot_segments(R.path); */
- if (!URI_FUNC(CopyPath)(absDest, relSource)) {
+ if (!URI_FUNC(CopyPath)(absDest, relSource, memory)) {
return URI_ERROR_MALLOC;
}
- if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest)) {
+ if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest, memory)) {
return URI_ERROR_MALLOC;
}
/* [10/32] T.query = R.query; */
@@ -218,13 +220,13 @@ static int URI_FUNC(AddBaseUriImpl)(URI_TYPE(Uri) * absDest,
/* [11/32] else */
} else {
/* [28/32] T.authority = Base.authority; */
- if (!URI_FUNC(CopyAuthority)(absDest, absBase)) {
+ if (!URI_FUNC(CopyAuthority)(absDest, absBase, memory)) {
return URI_ERROR_MALLOC;
}
/* [12/32] if (R.path == "") then */
if (relSource->pathHead == NULL && !relSource->absolutePath) {
/* [13/32] T.path = Base.path; */
- if (!URI_FUNC(CopyPath)(absDest, absBase)) {
+ if (!URI_FUNC(CopyPath)(absDest, absBase, memory)) {
return URI_ERROR_MALLOC;
}
/* [14/32] if defined(R.query) then */
@@ -243,31 +245,31 @@ static int URI_FUNC(AddBaseUriImpl)(URI_TYPE(Uri) * absDest,
if (relSource->absolutePath) {
int res;
/* [21/32] T.path = remove_dot_segments(R.path); */
- if (!URI_FUNC(CopyPath)(absDest, relSource)) {
+ if (!URI_FUNC(CopyPath)(absDest, relSource, memory)) {
return URI_ERROR_MALLOC;
}
- res = URI_FUNC(ResolveAbsolutePathFlag)(absDest);
+ res = URI_FUNC(ResolveAbsolutePathFlag)(absDest, memory);
if (res != URI_SUCCESS) {
return res;
}
- if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest)) {
+ if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest, memory)) {
return URI_ERROR_MALLOC;
}
/* [22/32] else */
} else {
/* [23/32] T.path = merge(Base.path, R.path); */
- if (!URI_FUNC(CopyPath)(absDest, absBase)) {
+ if (!URI_FUNC(CopyPath)(absDest, absBase, memory)) {
return URI_ERROR_MALLOC;
}
- if (!URI_FUNC(MergePath)(absDest, relSource)) {
+ if (!URI_FUNC(MergePath)(absDest, relSource, memory)) {
return URI_ERROR_MALLOC;
}
/* [24/32] T.path = remove_dot_segments(T.path); */
- if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest)) {
+ if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest, memory)) {
return URI_ERROR_MALLOC;
}
- if (!URI_FUNC(FixAmbiguity)(absDest)) {
+ if (!URI_FUNC(FixAmbiguity)(absDest, memory)) {
return URI_ERROR_MALLOC;
}
/* [25/32] endif; */
@@ -276,7 +278,7 @@ static int URI_FUNC(AddBaseUriImpl)(URI_TYPE(Uri) * absDest,
absDest->query = relSource->query;
/* [27/32] endif; */
}
- URI_FUNC(FixEmptyTrailSegment)(absDest);
+ URI_FUNC(FixEmptyTrailSegment)(absDest, memory);
/* [29/32] endif; */
}
/* [30/32] T.scheme = Base.scheme; */
@@ -294,11 +296,8 @@ static int URI_FUNC(AddBaseUriImpl)(URI_TYPE(Uri) * absDest,
int URI_FUNC(AddBaseUri)(URI_TYPE(Uri) * absDest,
const URI_TYPE(Uri) * relSource, const URI_TYPE(Uri) * absBase) {
- const int res = URI_FUNC(AddBaseUriImpl)(absDest, relSource, absBase, URI_RESOLVE_STRICTLY);
- if ((res != URI_SUCCESS) && (absDest != NULL)) {
- URI_FUNC(FreeUriMembers)(absDest);
- }
- return res;
+ const UriResolutionOptions options = URI_RESOLVE_STRICTLY;
+ return URI_FUNC(AddBaseUriEx)(absDest, relSource, absBase, options);
}
@@ -306,9 +305,21 @@ int URI_FUNC(AddBaseUri)(URI_TYPE(Uri) * absDest,
int URI_FUNC(AddBaseUriEx)(URI_TYPE(Uri) * absDest,
const URI_TYPE(Uri) * relSource, const URI_TYPE(Uri) * absBase,
UriResolutionOptions options) {
- const int res = URI_FUNC(AddBaseUriImpl)(absDest, relSource, absBase, options);
+ return URI_FUNC(AddBaseUriExMm)(absDest, relSource, absBase, options, NULL);
+}
+
+
+
+int URI_FUNC(AddBaseUriExMm)(URI_TYPE(Uri) * absDest,
+ const URI_TYPE(Uri) * relSource, const URI_TYPE(Uri) * absBase,
+ UriResolutionOptions options, UriMemoryManager * memory) {
+ int res;
+
+ URI_CHECK_MEMORY_MANAGER(memory); /* may return */
+
+ res = URI_FUNC(AddBaseUriImpl)(absDest, relSource, absBase, options, memory);
if ((res != URI_SUCCESS) && (absDest != NULL)) {
- URI_FUNC(FreeUriMembers)(absDest);
+ URI_FUNC(FreeUriMembersMm)(absDest, memory);
}
return res;
}
diff --git a/src/UriShorten.c b/src/UriShorten.c
index e7f6df4..7b0bc97 100644
--- a/src/UriShorten.c
+++ b/src/UriShorten.c
@@ -64,14 +64,16 @@
#ifndef URI_DOXYGEN
# include <uriparser/Uri.h>
# include "UriCommon.h"
+# include "UriMemory.h"
#endif
static URI_INLINE UriBool URI_FUNC(AppendSegment)(URI_TYPE(Uri) * uri,
- const URI_CHAR * first, const URI_CHAR * afterLast) {
+ const URI_CHAR * first, const URI_CHAR * afterLast,
+ UriMemoryManager * memory) {
/* Create segment */
- URI_TYPE(PathSegment) * segment = malloc(1 * sizeof(URI_TYPE(PathSegment)));
+ URI_TYPE(PathSegment) * segment = memory->malloc(memory, 1 * sizeof(URI_TYPE(PathSegment)));
if (segment == NULL) {
return URI_FALSE; /* Raises malloc error */
}
@@ -124,7 +126,7 @@ static URI_INLINE UriBool URI_FUNC(EqualsAuthority)(const URI_TYPE(Uri) * first,
static int URI_FUNC(RemoveBaseUriImpl)(URI_TYPE(Uri) * dest,
const URI_TYPE(Uri) * absSource,
const URI_TYPE(Uri) * absBase,
- UriBool domainRootMode) {
+ UriBool domainRootMode, UriMemoryManager * memory) {
if (dest == NULL) {
return URI_ERROR_NULL;
}
@@ -149,11 +151,11 @@ static int URI_FUNC(RemoveBaseUriImpl)(URI_TYPE(Uri) * dest,
/* [02/50] T.scheme = A.scheme; */
dest->scheme = absSource->scheme;
/* [03/50] T.authority = A.authority; */
- if (!URI_FUNC(CopyAuthority)(dest, absSource)) {
+ if (!URI_FUNC(CopyAuthority)(dest, absSource, memory)) {
return URI_ERROR_MALLOC;
}
/* [04/50] T.path = A.path; */
- if (!URI_FUNC(CopyPath)(dest, absSource)) {
+ if (!URI_FUNC(CopyPath)(dest, absSource, memory)) {
return URI_ERROR_MALLOC;
}
/* [05/50] else */
@@ -163,11 +165,11 @@ static int URI_FUNC(RemoveBaseUriImpl)(URI_TYPE(Uri) * dest,
/* [07/50] if (A.authority != Base.authority) then */
if (!URI_FUNC(EqualsAuthority)(absSource, absBase)) {
/* [08/50] T.authority = A.authority; */
- if (!URI_FUNC(CopyAuthority)(dest, absSource)) {
+ if (!URI_FUNC(CopyAuthority)(dest, absSource, memory)) {
return URI_ERROR_MALLOC;
}
/* [09/50] T.path = A.path; */
- if (!URI_FUNC(CopyPath)(dest, absSource)) {
+ if (!URI_FUNC(CopyPath)(dest, absSource, memory)) {
return URI_ERROR_MALLOC;
}
/* [10/50] else */
@@ -185,12 +187,12 @@ static int URI_FUNC(RemoveBaseUriImpl)(URI_TYPE(Uri) * dest,
/* [16/50] T.path = A.path; */
/* GROUPED */
/* [17/50] endif; */
- if (!URI_FUNC(CopyPath)(dest, absSource)) {
+ if (!URI_FUNC(CopyPath)(dest, absSource, memory)) {
return URI_ERROR_MALLOC;
}
dest->absolutePath = URI_TRUE;
- if (!URI_FUNC(FixAmbiguity)(dest)) {
+ if (!URI_FUNC(FixAmbiguity)(dest, memory)) {
return URI_ERROR_MALLOC;
}
/* [18/50] else */
@@ -220,7 +222,7 @@ static int URI_FUNC(RemoveBaseUriImpl)(URI_TYPE(Uri) * dest,
baseSeg = baseSeg->next;
/* [28/50] T.path += "../"; */
if (!URI_FUNC(AppendSegment)(dest, URI_FUNC(ConstParent),
- URI_FUNC(ConstParent) + 2)) {
+ URI_FUNC(ConstParent) + 2, memory)) {
return URI_ERROR_MALLOC;
}
/* [29/50] pathNaked = false; */
@@ -244,14 +246,14 @@ static int URI_FUNC(RemoveBaseUriImpl)(URI_TYPE(Uri) * dest,
if (containsColon) {
/* [34/50] T.path += "./"; */
if (!URI_FUNC(AppendSegment)(dest, URI_FUNC(ConstPwd),
- URI_FUNC(ConstPwd) + 1)) {
+ URI_FUNC(ConstPwd) + 1, memory)) {
return URI_ERROR_MALLOC;
}
/* [35/50] elseif (first(A.path) == "") then */
} else if (sourceSeg->text.first == sourceSeg->text.afterLast) {
/* [36/50] T.path += "/."; */
if (!URI_FUNC(AppendSegment)(dest, URI_FUNC(ConstPwd),
- URI_FUNC(ConstPwd) + 1)) {
+ URI_FUNC(ConstPwd) + 1, memory)) {
return URI_ERROR_MALLOC;
}
/* [37/50] endif; */
@@ -260,7 +262,7 @@ static int URI_FUNC(RemoveBaseUriImpl)(URI_TYPE(Uri) * dest,
}
/* [39/50] T.path += first(A.path); */
if (!URI_FUNC(AppendSegment)(dest, sourceSeg->text.first,
- sourceSeg->text.afterLast)) {
+ sourceSeg->text.afterLast, memory)) {
return URI_ERROR_MALLOC;
}
/* [40/50] pathNaked = false; */
@@ -295,10 +297,24 @@ int URI_FUNC(RemoveBaseUri)(URI_TYPE(Uri) * dest,
const URI_TYPE(Uri) * absSource,
const URI_TYPE(Uri) * absBase,
UriBool domainRootMode) {
- const int res = URI_FUNC(RemoveBaseUriImpl)(dest, absSource,
- absBase, domainRootMode);
+ return URI_FUNC(RemoveBaseUriMm)(dest, absSource, absBase,
+ domainRootMode, NULL);
+}
+
+
+
+int URI_FUNC(RemoveBaseUriMm)(URI_TYPE(Uri) * dest,
+ const URI_TYPE(Uri) * absSource,
+ const URI_TYPE(Uri) * absBase,
+ UriBool domainRootMode, UriMemoryManager * memory) {
+ int res;
+
+ URI_CHECK_MEMORY_MANAGER(memory); /* may return */
+
+ res = URI_FUNC(RemoveBaseUriImpl)(dest, absSource,
+ absBase, domainRootMode, memory);
if ((res != URI_SUCCESS) && (dest != NULL)) {
- URI_FUNC(FreeUriMembers)(dest);
+ URI_FUNC(FreeUriMembersMm)(dest, memory);
}
return res;
}
diff --git a/test/FourSuite.cpp b/test/FourSuite.cpp
index 5ecdcb4..466a94c 100644
--- a/test/FourSuite.cpp
+++ b/test/FourSuite.cpp
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "FourSuite.h"
+#include <gtest/gtest.h>
#include <uriparser/Uri.h>
@@ -29,9 +29,10 @@
// http://cvs.4suite.org/viewcvs/4Suite/test/Lib/test_uri.py
+namespace {
-bool FourSuite::testAddOrRemoveBaseHelper(const char * ref, const char * base,
- const char * expected, bool add, bool domainRootMode) {
+bool testAddOrRemoveBaseHelper(const char * ref, const char * base,
+ const char * expected, bool add = true, bool domainRootMode = false) {
UriParserStateA stateA;
// Base
@@ -94,9 +95,10 @@ bool FourSuite::testAddOrRemoveBaseHelper(const char * ref, const char * base,
return equal;
}
+} // namespace
-void FourSuite::absolutize_test_cases() {
+TEST(FourSuite, AbsolutizeTestCases) {
const char * const BASE_URI[] = {
"http://a/b/c/d;p?q",
"http://a/b/c/d;p?q=1/2",
@@ -107,288 +109,289 @@ void FourSuite::absolutize_test_cases() {
// ref, base, exptected
// http://lists.w3.org/Archives/Public/uri/2004Feb/0114.html
- TEST_ASSERT(testAddOrRemoveBaseHelper("../c", "foo:a/b", "foo:c"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("foo:.", "foo:a", "foo:"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("/foo/../../../bar", "zz:abc", "zz:/bar"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("/foo/../bar", "zz:abc", "zz:/bar"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("foo/../../../bar", "zz:abc", "zz:bar"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("foo/../bar", "zz:abc", "zz:bar"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("zz:.", "zz:abc", "zz:"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("/.", BASE_URI[0], "http://a/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("/.foo", BASE_URI[0], "http://a/.foo"));
- TEST_ASSERT(testAddOrRemoveBaseHelper(".foo", BASE_URI[0], "http://a/b/c/.foo"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../c", "foo:a/b", "foo:c"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("foo:.", "foo:a", "foo:"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("/foo/../../../bar", "zz:abc", "zz:/bar"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("/foo/../bar", "zz:abc", "zz:/bar"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("foo/../../../bar", "zz:abc", "zz:bar"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("foo/../bar", "zz:abc", "zz:bar"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("zz:.", "zz:abc", "zz:"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("/.", BASE_URI[0], "http://a/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("/.foo", BASE_URI[0], "http://a/.foo"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper(".foo", BASE_URI[0], "http://a/b/c/.foo"));
// http://gbiv.com/protocols/uri/test/rel_examples1.html
// examples from RFC 2396
- TEST_ASSERT(testAddOrRemoveBaseHelper("g:h", BASE_URI[0], "g:h"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g", BASE_URI[0], "http://a/b/c/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("./g", BASE_URI[0], "http://a/b/c/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g/", BASE_URI[0], "http://a/b/c/g/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("/g", BASE_URI[0], "http://a/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("//g", BASE_URI[0], "http://g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g:h", BASE_URI[0], "g:h"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g", BASE_URI[0], "http://a/b/c/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("./g", BASE_URI[0], "http://a/b/c/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g/", BASE_URI[0], "http://a/b/c/g/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("/g", BASE_URI[0], "http://a/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("//g", BASE_URI[0], "http://g"));
// changed with RFC 2396bis
- TEST_ASSERT(testAddOrRemoveBaseHelper("?y", BASE_URI[0], "http://a/b/c/d;p?y"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g?y", BASE_URI[0], "http://a/b/c/g?y"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("?y", BASE_URI[0], "http://a/b/c/d;p?y"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g?y", BASE_URI[0], "http://a/b/c/g?y"));
// changed with RFC 2396bis
- TEST_ASSERT(testAddOrRemoveBaseHelper("#s", BASE_URI[0], "http://a/b/c/d;p?q#s"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g#s", BASE_URI[0], "http://a/b/c/g#s"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g?y#s", BASE_URI[0], "http://a/b/c/g?y#s"));
- TEST_ASSERT(testAddOrRemoveBaseHelper(";x", BASE_URI[0], "http://a/b/c/;x"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g;x", BASE_URI[0], "http://a/b/c/g;x"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g;x?y#s", BASE_URI[0], "http://a/b/c/g;x?y#s"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("#s", BASE_URI[0], "http://a/b/c/d;p?q#s"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g#s", BASE_URI[0], "http://a/b/c/g#s"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g?y#s", BASE_URI[0], "http://a/b/c/g?y#s"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper(";x", BASE_URI[0], "http://a/b/c/;x"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g;x", BASE_URI[0], "http://a/b/c/g;x"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g;x?y#s", BASE_URI[0], "http://a/b/c/g;x?y#s"));
// changed with RFC 2396bis
- TEST_ASSERT(testAddOrRemoveBaseHelper("", BASE_URI[0], "http://a/b/c/d;p?q"));
- TEST_ASSERT(testAddOrRemoveBaseHelper(".", BASE_URI[0], "http://a/b/c/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("./", BASE_URI[0], "http://a/b/c/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("..", BASE_URI[0], "http://a/b/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../", BASE_URI[0], "http://a/b/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../g", BASE_URI[0], "http://a/b/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../..", BASE_URI[0], "http://a/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../../", BASE_URI[0], "http://a/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../../g", BASE_URI[0], "http://a/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../../../g", BASE_URI[0], "http://a/g")); // http://a/../g
- TEST_ASSERT(testAddOrRemoveBaseHelper("../../../../g", BASE_URI[0], "http://a/g")); // http://a/../../g
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("", BASE_URI[0], "http://a/b/c/d;p?q"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper(".", BASE_URI[0], "http://a/b/c/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("./", BASE_URI[0], "http://a/b/c/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("..", BASE_URI[0], "http://a/b/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../", BASE_URI[0], "http://a/b/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../g", BASE_URI[0], "http://a/b/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../..", BASE_URI[0], "http://a/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../../", BASE_URI[0], "http://a/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../../g", BASE_URI[0], "http://a/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../../../g", BASE_URI[0], "http://a/g")); // http://a/../g
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../../../../g", BASE_URI[0], "http://a/g")); // http://a/../../g
// changed with RFC 2396bis
- TEST_ASSERT(testAddOrRemoveBaseHelper("/./g", BASE_URI[0], "http://a/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("/./g", BASE_URI[0], "http://a/g"));
// changed with RFC 2396bis
- TEST_ASSERT(testAddOrRemoveBaseHelper("/../g", BASE_URI[0], "http://a/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g.", BASE_URI[0], "http://a/b/c/g."));
- TEST_ASSERT(testAddOrRemoveBaseHelper(".g", BASE_URI[0], "http://a/b/c/.g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g..", BASE_URI[0], "http://a/b/c/g.."));
- TEST_ASSERT(testAddOrRemoveBaseHelper("..g", BASE_URI[0], "http://a/b/c/..g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("./../g", BASE_URI[0], "http://a/b/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("./g/.", BASE_URI[0], "http://a/b/c/g/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g/./h", BASE_URI[0], "http://a/b/c/g/h"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g/../h", BASE_URI[0], "http://a/b/c/h"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g;x=1/./y", BASE_URI[0], "http://a/b/c/g;x=1/y"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g;x=1/../y", BASE_URI[0], "http://a/b/c/y"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g?y/./x", BASE_URI[0], "http://a/b/c/g?y/./x"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g?y/../x", BASE_URI[0], "http://a/b/c/g?y/../x"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g#s/./x", BASE_URI[0], "http://a/b/c/g#s/./x"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g#s/../x", BASE_URI[0], "http://a/b/c/g#s/../x"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("http:g", BASE_URI[0], "http:g")); // http://a/b/c/g
- TEST_ASSERT(testAddOrRemoveBaseHelper("http:", BASE_URI[0], "http:")); // BASE_URI[0]
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("/../g", BASE_URI[0], "http://a/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g.", BASE_URI[0], "http://a/b/c/g."));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper(".g", BASE_URI[0], "http://a/b/c/.g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g..", BASE_URI[0], "http://a/b/c/g.."));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("..g", BASE_URI[0], "http://a/b/c/..g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("./../g", BASE_URI[0], "http://a/b/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("./g/.", BASE_URI[0], "http://a/b/c/g/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g/./h", BASE_URI[0], "http://a/b/c/g/h"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g/../h", BASE_URI[0], "http://a/b/c/h"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g;x=1/./y", BASE_URI[0], "http://a/b/c/g;x=1/y"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g;x=1/../y", BASE_URI[0], "http://a/b/c/y"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g?y/./x", BASE_URI[0], "http://a/b/c/g?y/./x"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g?y/../x", BASE_URI[0], "http://a/b/c/g?y/../x"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g#s/./x", BASE_URI[0], "http://a/b/c/g#s/./x"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g#s/../x", BASE_URI[0], "http://a/b/c/g#s/../x"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("http:g", BASE_URI[0], "http:g")); // http://a/b/c/g
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("http:", BASE_URI[0], "http:")); // BASE_URI[0]
// not sure where this one originated
- TEST_ASSERT(testAddOrRemoveBaseHelper("/a/b/c/./../../g", BASE_URI[0], "http://a/a/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("/a/b/c/./../../g", BASE_URI[0], "http://a/a/g"));
// http://gbiv.com/protocols/uri/test/rel_examples2.html
// slashes in base URI's query args
- TEST_ASSERT(testAddOrRemoveBaseHelper("g", BASE_URI[1], "http://a/b/c/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("./g", BASE_URI[1], "http://a/b/c/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g/", BASE_URI[1], "http://a/b/c/g/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("/g", BASE_URI[1], "http://a/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("//g", BASE_URI[1], "http://g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g", BASE_URI[1], "http://a/b/c/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("./g", BASE_URI[1], "http://a/b/c/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g/", BASE_URI[1], "http://a/b/c/g/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("/g", BASE_URI[1], "http://a/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("//g", BASE_URI[1], "http://g"));
// changed in RFC 2396bis
- // TEST_ASSERT(testAddOrRemoveBaseHelper("?y", BASE_URI[1], "http://a/b/c/?y"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("?y", BASE_URI[1], "http://a/b/c/d;p?y"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g?y", BASE_URI[1], "http://a/b/c/g?y"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g?y/./x", BASE_URI[1], "http://a/b/c/g?y/./x"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g?y/../x", BASE_URI[1], "http://a/b/c/g?y/../x"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g#s", BASE_URI[1], "http://a/b/c/g#s"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g#s/./x", BASE_URI[1], "http://a/b/c/g#s/./x"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g#s/../x", BASE_URI[1], "http://a/b/c/g#s/../x"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("./", BASE_URI[1], "http://a/b/c/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../", BASE_URI[1], "http://a/b/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../g", BASE_URI[1], "http://a/b/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../../", BASE_URI[1], "http://a/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../../g", BASE_URI[1], "http://a/g"));
+ // ASSERT_TRUE(testAddOrRemoveBaseHelper("?y", BASE_URI[1], "http://a/b/c/?y"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("?y", BASE_URI[1], "http://a/b/c/d;p?y"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g?y", BASE_URI[1], "http://a/b/c/g?y"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g?y/./x", BASE_URI[1], "http://a/b/c/g?y/./x"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g?y/../x", BASE_URI[1], "http://a/b/c/g?y/../x"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g#s", BASE_URI[1], "http://a/b/c/g#s"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g#s/./x", BASE_URI[1], "http://a/b/c/g#s/./x"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g#s/../x", BASE_URI[1], "http://a/b/c/g#s/../x"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("./", BASE_URI[1], "http://a/b/c/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../", BASE_URI[1], "http://a/b/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../g", BASE_URI[1], "http://a/b/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../../", BASE_URI[1], "http://a/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../../g", BASE_URI[1], "http://a/g"));
// http://gbiv.com/protocols/uri/test/rel_examples3.html
// slashes in path params
// all of these changed in RFC 2396bis
- TEST_ASSERT(testAddOrRemoveBaseHelper("g", BASE_URI[2], "http://a/b/c/d;p=1/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("./g", BASE_URI[2], "http://a/b/c/d;p=1/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g/", BASE_URI[2], "http://a/b/c/d;p=1/g/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g?y", BASE_URI[2], "http://a/b/c/d;p=1/g?y"));
- TEST_ASSERT(testAddOrRemoveBaseHelper(";x", BASE_URI[2], "http://a/b/c/d;p=1/;x"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g;x", BASE_URI[2], "http://a/b/c/d;p=1/g;x"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g;x=1/./y", BASE_URI[2], "http://a/b/c/d;p=1/g;x=1/y"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g;x=1/../y", BASE_URI[2], "http://a/b/c/d;p=1/y"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("./", BASE_URI[2], "http://a/b/c/d;p=1/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../", BASE_URI[2], "http://a/b/c/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../g", BASE_URI[2], "http://a/b/c/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../../", BASE_URI[2], "http://a/b/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../../g", BASE_URI[2], "http://a/b/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g", BASE_URI[2], "http://a/b/c/d;p=1/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("./g", BASE_URI[2], "http://a/b/c/d;p=1/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g/", BASE_URI[2], "http://a/b/c/d;p=1/g/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g?y", BASE_URI[2], "http://a/b/c/d;p=1/g?y"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper(";x", BASE_URI[2], "http://a/b/c/d;p=1/;x"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g;x", BASE_URI[2], "http://a/b/c/d;p=1/g;x"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g;x=1/./y", BASE_URI[2], "http://a/b/c/d;p=1/g;x=1/y"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g;x=1/../y", BASE_URI[2], "http://a/b/c/d;p=1/y"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("./", BASE_URI[2], "http://a/b/c/d;p=1/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../", BASE_URI[2], "http://a/b/c/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../g", BASE_URI[2], "http://a/b/c/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../../", BASE_URI[2], "http://a/b/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../../g", BASE_URI[2], "http://a/b/g"));
// http://gbiv.com/protocols/uri/test/rel_examples4.html
// double and triple slash, unknown scheme
- TEST_ASSERT(testAddOrRemoveBaseHelper("g:h", BASE_URI[3], "g:h"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g", BASE_URI[3], "fred:///s//a/b/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("./g", BASE_URI[3], "fred:///s//a/b/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g/", BASE_URI[3], "fred:///s//a/b/g/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("/g", BASE_URI[3], "fred:///g")); // may change to fred:///s//a/g
- TEST_ASSERT(testAddOrRemoveBaseHelper("//g", BASE_URI[3], "fred://g")); // may change to fred:///s//g
- TEST_ASSERT(testAddOrRemoveBaseHelper("//g/x", BASE_URI[3], "fred://g/x")); // may change to fred:///s//g/x
- TEST_ASSERT(testAddOrRemoveBaseHelper("///g", BASE_URI[3], "fred:///g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("./", BASE_URI[3], "fred:///s//a/b/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../", BASE_URI[3], "fred:///s//a/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../g", BASE_URI[3], "fred:///s//a/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../../", BASE_URI[3], "fred:///s//")); // may change to fred:///s//a/../
- TEST_ASSERT(testAddOrRemoveBaseHelper("../../g", BASE_URI[3], "fred:///s//g")); // may change to fred:///s//a/../g
- TEST_ASSERT(testAddOrRemoveBaseHelper("../../../g", BASE_URI[3], "fred:///s/g")); // may change to fred:///s//a/../../g
- TEST_ASSERT(testAddOrRemoveBaseHelper("../../../../g", BASE_URI[3], "fred:///g")); // may change to fred:///s//a/../../../g
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g:h", BASE_URI[3], "g:h"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g", BASE_URI[3], "fred:///s//a/b/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("./g", BASE_URI[3], "fred:///s//a/b/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g/", BASE_URI[3], "fred:///s//a/b/g/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("/g", BASE_URI[3], "fred:///g")); // may change to fred:///s//a/g
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("//g", BASE_URI[3], "fred://g")); // may change to fred:///s//g
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("//g/x", BASE_URI[3], "fred://g/x")); // may change to fred:///s//g/x
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("///g", BASE_URI[3], "fred:///g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("./", BASE_URI[3], "fred:///s//a/b/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../", BASE_URI[3], "fred:///s//a/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../g", BASE_URI[3], "fred:///s//a/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../../", BASE_URI[3], "fred:///s//")); // may change to fred:///s//a/../
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../../g", BASE_URI[3], "fred:///s//g")); // may change to fred:///s//a/../g
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../../../g", BASE_URI[3], "fred:///s/g")); // may change to fred:///s//a/../../g
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../../../../g", BASE_URI[3], "fred:///g")); // may change to fred:///s//a/../../../g
// http://gbiv.com/protocols/uri/test/rel_examples5.html
// double and triple slash, well-known scheme
- TEST_ASSERT(testAddOrRemoveBaseHelper("g:h", BASE_URI[4], "g:h"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g", BASE_URI[4], "http:///s//a/b/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("./g", BASE_URI[4], "http:///s//a/b/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("g/", BASE_URI[4], "http:///s//a/b/g/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("/g", BASE_URI[4], "http:///g")); // may change to http:///s//a/g
- TEST_ASSERT(testAddOrRemoveBaseHelper("//g", BASE_URI[4], "http://g")); // may change to http:///s//g
- TEST_ASSERT(testAddOrRemoveBaseHelper("//g/x", BASE_URI[4], "http://g/x")); // may change to http:///s//g/x
- TEST_ASSERT(testAddOrRemoveBaseHelper("///g", BASE_URI[4], "http:///g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("./", BASE_URI[4], "http:///s//a/b/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../", BASE_URI[4], "http:///s//a/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../g", BASE_URI[4], "http:///s//a/g"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../../", BASE_URI[4], "http:///s//")); // may change to http:///s//a/../
- TEST_ASSERT(testAddOrRemoveBaseHelper("../../g", BASE_URI[4], "http:///s//g")); // may change to http:///s//a/../g
- TEST_ASSERT(testAddOrRemoveBaseHelper("../../../g", BASE_URI[4], "http:///s/g")); // may change to http:///s//a/../../g
- TEST_ASSERT(testAddOrRemoveBaseHelper("../../../../g", BASE_URI[4], "http:///g")); // may change to http:///s//a/../../../g
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g:h", BASE_URI[4], "g:h"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g", BASE_URI[4], "http:///s//a/b/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("./g", BASE_URI[4], "http:///s//a/b/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("g/", BASE_URI[4], "http:///s//a/b/g/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("/g", BASE_URI[4], "http:///g")); // may change to http:///s//a/g
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("//g", BASE_URI[4], "http://g")); // may change to http:///s//g
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("//g/x", BASE_URI[4], "http://g/x")); // may change to http:///s//g/x
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("///g", BASE_URI[4], "http:///g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("./", BASE_URI[4], "http:///s//a/b/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../", BASE_URI[4], "http:///s//a/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../g", BASE_URI[4], "http:///s//a/g"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../../", BASE_URI[4], "http:///s//")); // may change to http:///s//a/../
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../../g", BASE_URI[4], "http:///s//g")); // may change to http:///s//a/../g
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../../../g", BASE_URI[4], "http:///s/g")); // may change to http:///s//a/../../g
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../../../../g", BASE_URI[4], "http:///g")); // may change to http:///s//a/../../../g
// from Dan Connelly's tests in http://www.w3.org/2000/10/swap/uripath.py
- TEST_ASSERT(testAddOrRemoveBaseHelper("bar:abc", "foo:xyz", "bar:abc"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../abc", "http://example/x/y/z", "http://example/x/abc"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("http://example/x/abc", "http://example2/x/y/z", "http://example/x/abc"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../r", "http://ex/x/y/z", "http://ex/x/r"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("q/r", "http://ex/x/y", "http://ex/x/q/r"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("q/r#s", "http://ex/x/y", "http://ex/x/q/r#s"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("q/r#s/t", "http://ex/x/y", "http://ex/x/q/r#s/t"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("ftp://ex/x/q/r", "http://ex/x/y", "ftp://ex/x/q/r"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("", "http://ex/x/y", "http://ex/x/y"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("", "http://ex/x/y/", "http://ex/x/y/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("", "http://ex/x/y/pdq", "http://ex/x/y/pdq"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("z/", "http://ex/x/y/", "http://ex/x/y/z/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("#Animal", "file:/swap/test/animal.rdf", "file:/swap/test/animal.rdf#Animal"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../abc", "file:/e/x/y/z", "file:/e/x/abc"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("/example/x/abc", "file:/example2/x/y/z", "file:/example/x/abc"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../r", "file:/ex/x/y/z", "file:/ex/x/r"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("/r", "file:/ex/x/y/z", "file:/r"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("q/r", "file:/ex/x/y", "file:/ex/x/q/r"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("q/r#s", "file:/ex/x/y", "file:/ex/x/q/r#s"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("q/r#", "file:/ex/x/y", "file:/ex/x/q/r#"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("q/r#s/t", "file:/ex/x/y", "file:/ex/x/q/r#s/t"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("ftp://ex/x/q/r", "file:/ex/x/y", "ftp://ex/x/q/r"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("", "file:/ex/x/y", "file:/ex/x/y"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("", "file:/ex/x/y/", "file:/ex/x/y/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("", "file:/ex/x/y/pdq", "file:/ex/x/y/pdq"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("z/", "file:/ex/x/y/", "file:/ex/x/y/z/"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("file://meetings.example.com/cal#m1", "file:/devel/WWW/2000/10/swap/test/reluri-1.n3", "file://meetings.example.com/cal#m1"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("file://meetings.example.com/cal#m1", "file:/home/connolly/w3ccvs/WWW/2000/10/swap/test/reluri-1.n3", "file://meetings.example.com/cal#m1"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("./#blort", "file:/some/dir/foo", "file:/some/dir/#blort"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("./#", "file:/some/dir/foo", "file:/some/dir/#"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("bar:abc", "foo:xyz", "bar:abc"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../abc", "http://example/x/y/z", "http://example/x/abc"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("http://example/x/abc", "http://example2/x/y/z", "http://example/x/abc"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../r", "http://ex/x/y/z", "http://ex/x/r"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("q/r", "http://ex/x/y", "http://ex/x/q/r"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("q/r#s", "http://ex/x/y", "http://ex/x/q/r#s"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("q/r#s/t", "http://ex/x/y", "http://ex/x/q/r#s/t"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("ftp://ex/x/q/r", "http://ex/x/y", "ftp://ex/x/q/r"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("", "http://ex/x/y", "http://ex/x/y"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("", "http://ex/x/y/", "http://ex/x/y/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("", "http://ex/x/y/pdq", "http://ex/x/y/pdq"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("z/", "http://ex/x/y/", "http://ex/x/y/z/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("#Animal", "file:/swap/test/animal.rdf", "file:/swap/test/animal.rdf#Animal"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../abc", "file:/e/x/y/z", "file:/e/x/abc"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("/example/x/abc", "file:/example2/x/y/z", "file:/example/x/abc"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../r", "file:/ex/x/y/z", "file:/ex/x/r"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("/r", "file:/ex/x/y/z", "file:/r"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("q/r", "file:/ex/x/y", "file:/ex/x/q/r"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("q/r#s", "file:/ex/x/y", "file:/ex/x/q/r#s"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("q/r#", "file:/ex/x/y", "file:/ex/x/q/r#"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("q/r#s/t", "file:/ex/x/y", "file:/ex/x/q/r#s/t"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("ftp://ex/x/q/r", "file:/ex/x/y", "ftp://ex/x/q/r"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("", "file:/ex/x/y", "file:/ex/x/y"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("", "file:/ex/x/y/", "file:/ex/x/y/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("", "file:/ex/x/y/pdq", "file:/ex/x/y/pdq"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("z/", "file:/ex/x/y/", "file:/ex/x/y/z/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("file://meetings.example.com/cal#m1", "file:/devel/WWW/2000/10/swap/test/reluri-1.n3", "file://meetings.example.com/cal#m1"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("file://meetings.example.com/cal#m1", "file:/home/connolly/w3ccvs/WWW/2000/10/swap/test/reluri-1.n3", "file://meetings.example.com/cal#m1"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("./#blort", "file:/some/dir/foo", "file:/some/dir/#blort"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("./#", "file:/some/dir/foo", "file:/some/dir/#"));
// Ryan Lee
- TEST_ASSERT(testAddOrRemoveBaseHelper("./", "http://example/x/abc.efg", "http://example/x/"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("./", "http://example/x/abc.efg", "http://example/x/"));
// Graham Klyne's tests
// http://www.ninebynine.org/Software/HaskellUtils/Network/UriTest.xls
// 01-31 are from Connelly's cases
// 32-49
- TEST_ASSERT(testAddOrRemoveBaseHelper("./q:r", "http://ex/x/y", "http://ex/x/q:r"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("./p=q:r", "http://ex/x/y", "http://ex/x/p=q:r"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("?pp/rr", "http://ex/x/y?pp/qq", "http://ex/x/y?pp/rr"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("y/z", "http://ex/x/y?pp/qq", "http://ex/x/y/z"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("local/qual@domain.org#frag", "mailto:local", "mailto:local/qual@domain.org#frag"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("more/qual2@domain2.org#frag", "mailto:local/qual1@domain1.org", "mailto:local/more/qual2@domain2.org#frag"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("y?q", "http://ex/x/y?q", "http://ex/x/y?q"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("/x/y?q", "http://ex?p", "http://ex/x/y?q"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("c/d", "foo:a/b", "foo:a/c/d"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("/c/d", "foo:a/b", "foo:/c/d"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("", "foo:a/b?c#d", "foo:a/b?c"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("b/c", "foo:a", "foo:b/c"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../b/c", "foo:/a/y/z", "foo:/a/b/c"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("./b/c", "foo:a", "foo:b/c"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("/./b/c", "foo:a", "foo:/b/c"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../../d", "foo://a//b/c", "foo://a/d"));
- TEST_ASSERT(testAddOrRemoveBaseHelper(".", "foo:a", "foo:"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("..", "foo:a", "foo:"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("./q:r", "http://ex/x/y", "http://ex/x/q:r"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("./p=q:r", "http://ex/x/y", "http://ex/x/p=q:r"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("?pp/rr", "http://ex/x/y?pp/qq", "http://ex/x/y?pp/rr"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("y/z", "http://ex/x/y?pp/qq", "http://ex/x/y/z"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("local/qual@domain.org#frag", "mailto:local", "mailto:local/qual@domain.org#frag"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("more/qual2@domain2.org#frag", "mailto:local/qual1@domain1.org", "mailto:local/more/qual2@domain2.org#frag"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("y?q", "http://ex/x/y?q", "http://ex/x/y?q"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("/x/y?q", "http://ex?p", "http://ex/x/y?q"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("c/d", "foo:a/b", "foo:a/c/d"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("/c/d", "foo:a/b", "foo:/c/d"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("", "foo:a/b?c#d", "foo:a/b?c"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("b/c", "foo:a", "foo:b/c"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../b/c", "foo:/a/y/z", "foo:/a/b/c"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("./b/c", "foo:a", "foo:b/c"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("/./b/c", "foo:a", "foo:/b/c"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../../d", "foo://a//b/c", "foo://a/d"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper(".", "foo:a", "foo:"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("..", "foo:a", "foo:"));
// 50-57 (cf. TimBL comments --
// http://lists.w3.org/Archives/Public/uri/2003Feb/0028.html,
// http://lists.w3.org/Archives/Public/uri/2003Jan/0008.html)
- TEST_ASSERT(testAddOrRemoveBaseHelper("abc", "http://example/x/y%2Fz", "http://example/x/abc"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../../x%2Fabc", "http://example/a/x/y/z", "http://example/a/x%2Fabc"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../x%2Fabc", "http://example/a/x/y%2Fz", "http://example/a/x%2Fabc"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("abc", "http://example/x%2Fy/z", "http://example/x%2Fy/abc"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("q%3Ar", "http://ex/x/y", "http://ex/x/q%3Ar"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("/x%2Fabc", "http://example/x/y%2Fz", "http://example/x%2Fabc"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("/x%2Fabc", "http://example/x/y/z", "http://example/x%2Fabc"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("/x%2Fabc", "http://example/x/y%2Fz", "http://example/x%2Fabc"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("abc", "http://example/x/y%2Fz", "http://example/x/abc"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../../x%2Fabc", "http://example/a/x/y/z", "http://example/a/x%2Fabc"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../x%2Fabc", "http://example/a/x/y%2Fz", "http://example/a/x%2Fabc"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("abc", "http://example/x%2Fy/z", "http://example/x%2Fy/abc"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("q%3Ar", "http://ex/x/y", "http://ex/x/q%3Ar"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("/x%2Fabc", "http://example/x/y%2Fz", "http://example/x%2Fabc"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("/x%2Fabc", "http://example/x/y/z", "http://example/x%2Fabc"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("/x%2Fabc", "http://example/x/y%2Fz", "http://example/x%2Fabc"));
// 70-77
- TEST_ASSERT(testAddOrRemoveBaseHelper("local2@domain2", "mailto:local1@domain1?query1", "mailto:local2@domain2"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("local2@domain2?query2", "mailto:local1@domain1", "mailto:local2@domain2?query2"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("local2@domain2?query2", "mailto:local1@domain1?query1", "mailto:local2@domain2?query2"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("?query2", "mailto:local@domain?query1", "mailto:local@domain?query2"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("local@domain?query2", "mailto:?query1", "mailto:local@domain?query2"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("?query2", "mailto:local@domain?query1", "mailto:local@domain?query2"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("http://example/a/b?c/../d", "foo:bar", "http://example/a/b?c/../d"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("http://example/a/b#c/../d", "foo:bar", "http://example/a/b#c/../d"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("local2@domain2", "mailto:local1@domain1?query1", "mailto:local2@domain2"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("local2@domain2?query2", "mailto:local1@domain1", "mailto:local2@domain2?query2"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("local2@domain2?query2", "mailto:local1@domain1?query1", "mailto:local2@domain2?query2"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("?query2", "mailto:local@domain?query1", "mailto:local@domain?query2"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("local@domain?query2", "mailto:?query1", "mailto:local@domain?query2"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("?query2", "mailto:local@domain?query1", "mailto:local@domain?query2"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("http://example/a/b?c/../d", "foo:bar", "http://example/a/b?c/../d"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("http://example/a/b#c/../d", "foo:bar", "http://example/a/b#c/../d"));
// 82-88
- TEST_ASSERT(testAddOrRemoveBaseHelper("http:this", "http://example.org/base/uri", "http:this"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("http:this", "http:base", "http:this"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("http:this", "http://example.org/base/uri", "http:this"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("http:this", "http:base", "http:this"));
// Whole in the URI spec, see http://lists.w3.org/Archives/Public/uri/2007Aug/0003.html
- // TEST_ASSERT(testAddOrRemoveBaseHelper(".//g", "f:/a", "f://g")); // ORIGINAL
- TEST_ASSERT(testAddOrRemoveBaseHelper(".//g", "f:/a", "f:/.//g")); // FIXED ONE
- TEST_ASSERT(testAddOrRemoveBaseHelper("b/c//d/e", "f://example.org/base/a", "f://example.org/base/b/c//d/e"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("m2@example.ord/c2@example.org", "mid:m@example.ord/c@example.org", "mid:m@example.ord/m2@example.ord/c2@example.org"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("mini1.xml", "file:///C:/DEV/Haskell/lib/HXmlToolbox-3.01/examples/", "file:///C:/DEV/Haskell/lib/HXmlToolbox-3.01/examples/mini1.xml"));
- TEST_ASSERT(testAddOrRemoveBaseHelper("../b/c", "foo:a/y/z", "foo:a/b/c"));
+ // ASSERT_TRUE(testAddOrRemoveBaseHelper(".//g", "f:/a", "f://g")); // ORIGINAL
+ ASSERT_TRUE(testAddOrRemoveBaseHelper(".//g", "f:/a", "f:/.//g")); // FIXED ONE
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("b/c//d/e", "f://example.org/base/a", "f://example.org/base/b/c//d/e"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("m2@example.ord/c2@example.org", "mid:m@example.ord/c@example.org", "mid:m@example.ord/m2@example.ord/c2@example.org"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("mini1.xml", "file:///C:/DEV/Haskell/lib/HXmlToolbox-3.01/examples/", "file:///C:/DEV/Haskell/lib/HXmlToolbox-3.01/examples/mini1.xml"));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("../b/c", "foo:a/y/z", "foo:a/b/c"));
}
-void FourSuite::relativize_test_cases() {
+TEST(FourSuite, RelativizeTestCases) {
const bool REMOVE_MODE = false;
const bool DOMAIN_ROOT_MODE = true;
// to convert, base, exptected
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a/b/c", "s://ex/a/d", "b/c", REMOVE_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/b/b/c", "s://ex/a/d", "/b/b/c", REMOVE_MODE, DOMAIN_ROOT_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a/b/c", "s://ex/a/b/", "c", REMOVE_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://other.ex/a/b/", "s://ex/a/d", "//other.ex/a/b/", REMOVE_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a/b/c", "s://other.ex/a/d", "//ex/a/b/c", REMOVE_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("t://ex/a/b/c", "s://ex/a/d", "t://ex/a/b/c", REMOVE_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a/b/c", "t://ex/a/d", "s://ex/a/b/c", REMOVE_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a", "s://ex/b/c/d", "/a", REMOVE_MODE, DOMAIN_ROOT_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/b/c/d", "s://ex/a", "b/c/d", REMOVE_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a/b/c?h", "s://ex/a/d?w", "b/c?h", REMOVE_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a/b/c#h", "s://ex/a/d#w", "b/c#h", REMOVE_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a/b/c?h#i", "s://ex/a/d?w#j", "b/c?h#i", REMOVE_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a#i", "s://ex/a", "#i", REMOVE_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a?i", "s://ex/a", "?i", REMOVE_MODE));
-
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a/b/", "s://ex/a/b/", "", REMOVE_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a/b", "s://ex/a/b", "", REMOVE_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/", "s://ex/", "", REMOVE_MODE));
-
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a/b/c", "s://ex/a/d/c", "../b/c", REMOVE_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a/b/c/", "s://ex/a/d/c", "../b/c/", REMOVE_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a/b/c/d", "s://ex/a/d/c/d", "../../b/c/d", REMOVE_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a/b/c", "s://ex/d/e/f", "/a/b/c", REMOVE_MODE, DOMAIN_ROOT_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a/b/", "s://ex/a/c/d/e", "../../b/", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a/b/c", "s://ex/a/d", "b/c", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/b/b/c", "s://ex/a/d", "/b/b/c", REMOVE_MODE, DOMAIN_ROOT_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a/b/c", "s://ex/a/b/", "c", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://other.ex/a/b/", "s://ex/a/d", "//other.ex/a/b/", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a/b/c", "s://other.ex/a/d", "//ex/a/b/c", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("t://ex/a/b/c", "s://ex/a/d", "t://ex/a/b/c", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a/b/c", "t://ex/a/d", "s://ex/a/b/c", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a", "s://ex/b/c/d", "/a", REMOVE_MODE, DOMAIN_ROOT_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/b/c/d", "s://ex/a", "b/c/d", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a/b/c?h", "s://ex/a/d?w", "b/c?h", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a/b/c#h", "s://ex/a/d#w", "b/c#h", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a/b/c?h#i", "s://ex/a/d?w#j", "b/c?h#i", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a#i", "s://ex/a", "#i", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a?i", "s://ex/a", "?i", REMOVE_MODE));
+
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a/b/", "s://ex/a/b/", "", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a/b", "s://ex/a/b", "", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/", "s://ex/", "", REMOVE_MODE));
+
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a/b/c", "s://ex/a/d/c", "../b/c", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a/b/c/", "s://ex/a/d/c", "../b/c/", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a/b/c/d", "s://ex/a/d/c/d", "../../b/c/d", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a/b/c", "s://ex/d/e/f", "/a/b/c", REMOVE_MODE, DOMAIN_ROOT_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a/b/", "s://ex/a/c/d/e", "../../b/", REMOVE_MODE));
// Some tests to ensure that empty path segments don't cause problems.
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a/b", "s://ex/a//b/c", "../../b", REMOVE_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a///b", "s://ex/a/", ".///b", REMOVE_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a/", "s://ex/a///b", "../../", REMOVE_MODE));
- TEST_ASSERT(testAddOrRemoveBaseHelper("s://ex/a//b/c", "s://ex/a/b", ".//b/c", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a/b", "s://ex/a//b/c", "../../b", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a///b", "s://ex/a/", ".///b", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a/", "s://ex/a///b", "../../", REMOVE_MODE));
+ ASSERT_TRUE(testAddOrRemoveBaseHelper("s://ex/a//b/c", "s://ex/a/b", ".//b/c", REMOVE_MODE));
}
+namespace {
-int FourSuite::testParseUri(const char * uriText, const char ** expectedErrorPos) {
+int testParseUri(const char * uriText, const char ** expectedErrorPos = NULL) {
UriParserStateA state;
UriUriA uri;
state.uri = &uri;
@@ -402,13 +405,13 @@ int FourSuite::testParseUri(const char * uriText, const char ** expectedErrorPos
-bool FourSuite::testGoodUri(const char * uriText) {
+bool testGoodUri(const char * uriText) {
return (testParseUri(uriText) == 0);
}
-bool FourSuite::testBadUri(const char * uriText, int expectedErrorOffset) {
+bool testBadUri(const char * uriText, int expectedErrorOffset = -1) {
const char * errorPos = NULL;
const int ret = testParseUri(uriText, &errorPos);
return ((ret == URI_ERROR_SYNTAX)
@@ -419,143 +422,147 @@ bool FourSuite::testBadUri(const char * uriText, int expectedErrorOffset) {
));
}
+} // namespace
-void FourSuite::good_URI_references() {
- TEST_ASSERT(testGoodUri("file:///foo/bar"));
- TEST_ASSERT(testGoodUri("mailto:user@host?subject=blah"));
- TEST_ASSERT(testGoodUri("dav:")); // empty opaque part / rel-path allowed by RFC 2396bis
- TEST_ASSERT(testGoodUri("about:")); // empty opaque part / rel-path allowed by RFC 2396bis
+
+TEST(FourSuite, GoodUriReferences) {
+ ASSERT_TRUE(testGoodUri("file:///foo/bar"));
+ ASSERT_TRUE(testGoodUri("mailto:user@host?subject=blah"));
+ ASSERT_TRUE(testGoodUri("dav:")); // empty opaque part / rel-path allowed by RFC 2396bis
+ ASSERT_TRUE(testGoodUri("about:")); // empty opaque part / rel-path allowed by RFC 2396bis
// the following test cases are from a Perl script by David A. Wheeler
// at http://www.dwheeler.com/secure-programs/url.pl
- TEST_ASSERT(testGoodUri("http://www.yahoo.com"));
- TEST_ASSERT(testGoodUri("http://www.yahoo.com/"));
- TEST_ASSERT(testGoodUri("http://1.2.3.4/"));
- TEST_ASSERT(testGoodUri("http://www.yahoo.com/stuff"));
- TEST_ASSERT(testGoodUri("http://www.yahoo.com/stuff/"));
- TEST_ASSERT(testGoodUri("http://www.yahoo.com/hello%20world/"));
- TEST_ASSERT(testGoodUri("http://www.yahoo.com?name=obi"));
- TEST_ASSERT(testGoodUri("http://www.yahoo.com?name=obi+wan&status=jedi"));
- TEST_ASSERT(testGoodUri("http://www.yahoo.com?onery"));
- TEST_ASSERT(testGoodUri("http://www.yahoo.com#bottom"));
- TEST_ASSERT(testGoodUri("http://www.yahoo.com/yelp.html#bottom"));
- TEST_ASSERT(testGoodUri("https://www.yahoo.com/"));
- TEST_ASSERT(testGoodUri("ftp://www.yahoo.com/"));
- TEST_ASSERT(testGoodUri("ftp://www.yahoo.com/hello"));
- TEST_ASSERT(testGoodUri("demo.txt"));
- TEST_ASSERT(testGoodUri("demo/hello.txt"));
- TEST_ASSERT(testGoodUri("demo/hello.txt?query=hello#fragment"));
- TEST_ASSERT(testGoodUri("/cgi-bin/query?query=hello#fragment"));
- TEST_ASSERT(testGoodUri("/demo.txt"));
- TEST_ASSERT(testGoodUri("/hello/demo.txt"));
- TEST_ASSERT(testGoodUri("hello/demo.txt"));
- TEST_ASSERT(testGoodUri("/"));
- TEST_ASSERT(testGoodUri(""));
- TEST_ASSERT(testGoodUri("#"));
- TEST_ASSERT(testGoodUri("#here"));
+ ASSERT_TRUE(testGoodUri("http://www.yahoo.com"));
+ ASSERT_TRUE(testGoodUri("http://www.yahoo.com/"));
+ ASSERT_TRUE(testGoodUri("http://1.2.3.4/"));
+ ASSERT_TRUE(testGoodUri("http://www.yahoo.com/stuff"));
+ ASSERT_TRUE(testGoodUri("http://www.yahoo.com/stuff/"));
+ ASSERT_TRUE(testGoodUri("http://www.yahoo.com/hello%20world/"));
+ ASSERT_TRUE(testGoodUri("http://www.yahoo.com?name=obi"));
+ ASSERT_TRUE(testGoodUri("http://www.yahoo.com?name=obi+wan&status=jedi"));
+ ASSERT_TRUE(testGoodUri("http://www.yahoo.com?onery"));
+ ASSERT_TRUE(testGoodUri("http://www.yahoo.com#bottom"));
+ ASSERT_TRUE(testGoodUri("http://www.yahoo.com/yelp.html#bottom"));
+ ASSERT_TRUE(testGoodUri("https://www.yahoo.com/"));
+ ASSERT_TRUE(testGoodUri("ftp://www.yahoo.com/"));
+ ASSERT_TRUE(testGoodUri("ftp://www.yahoo.com/hello"));
+ ASSERT_TRUE(testGoodUri("demo.txt"));
+ ASSERT_TRUE(testGoodUri("demo/hello.txt"));
+ ASSERT_TRUE(testGoodUri("demo/hello.txt?query=hello#fragment"));
+ ASSERT_TRUE(testGoodUri("/cgi-bin/query?query=hello#fragment"));
+ ASSERT_TRUE(testGoodUri("/demo.txt"));
+ ASSERT_TRUE(testGoodUri("/hello/demo.txt"));
+ ASSERT_TRUE(testGoodUri("hello/demo.txt"));
+ ASSERT_TRUE(testGoodUri("/"));
+ ASSERT_TRUE(testGoodUri(""));
+ ASSERT_TRUE(testGoodUri("#"));
+ ASSERT_TRUE(testGoodUri("#here"));
// Wheeler's script says these are invalid, but they aren't
- TEST_ASSERT(testGoodUri("http://www.yahoo.com?name=%00%01"));
- TEST_ASSERT(testGoodUri("http://www.yaho%6f.com"));
- TEST_ASSERT(testGoodUri("http://www.yahoo.com/hello%00world/"));
- TEST_ASSERT(testGoodUri("http://www.yahoo.com/hello+world/"));
- TEST_ASSERT(testGoodUri("http://www.yahoo.com?name=obi&"));
- TEST_ASSERT(testGoodUri("http://www.yahoo.com?name=obi&type="));
- TEST_ASSERT(testGoodUri("http://www.yahoo.com/yelp.html#"));
- TEST_ASSERT(testGoodUri("//"));
+ ASSERT_TRUE(testGoodUri("http://www.yahoo.com?name=%00%01"));
+ ASSERT_TRUE(testGoodUri("http://www.yaho%6f.com"));
+ ASSERT_TRUE(testGoodUri("http://www.yahoo.com/hello%00world/"));
+ ASSERT_TRUE(testGoodUri("http://www.yahoo.com/hello+world/"));
+ ASSERT_TRUE(testGoodUri("http://www.yahoo.com?name=obi&"));
+ ASSERT_TRUE(testGoodUri("http://www.yahoo.com?name=obi&type="));
+ ASSERT_TRUE(testGoodUri("http://www.yahoo.com/yelp.html#"));
+ ASSERT_TRUE(testGoodUri("//"));
// the following test cases are from a Haskell program by Graham Klyne
// at http://www.ninebynine.org/Software/HaskellUtils/Network/URITest.hs
- TEST_ASSERT(testGoodUri("http://example.org/aaa/bbb#ccc"));
- TEST_ASSERT(testGoodUri("mailto:local@domain.org"));
- TEST_ASSERT(testGoodUri("mailto:local@domain.org#frag"));
- TEST_ASSERT(testGoodUri("HTTP://EXAMPLE.ORG/AAA/BBB#CCC"));
- TEST_ASSERT(testGoodUri("//example.org/aaa/bbb#ccc"));
- TEST_ASSERT(testGoodUri("/aaa/bbb#ccc"));
- TEST_ASSERT(testGoodUri("bbb#ccc"));
- TEST_ASSERT(testGoodUri("#ccc"));
- TEST_ASSERT(testGoodUri("#"));
- TEST_ASSERT(testGoodUri("A'C"));
+ ASSERT_TRUE(testGoodUri("http://example.org/aaa/bbb#ccc"));
+ ASSERT_TRUE(testGoodUri("mailto:local@domain.org"));
+ ASSERT_TRUE(testGoodUri("mailto:local@domain.org#frag"));
+ ASSERT_TRUE(testGoodUri("HTTP://EXAMPLE.ORG/AAA/BBB#CCC"));
+ ASSERT_TRUE(testGoodUri("//example.org/aaa/bbb#ccc"));
+ ASSERT_TRUE(testGoodUri("/aaa/bbb#ccc"));
+ ASSERT_TRUE(testGoodUri("bbb#ccc"));
+ ASSERT_TRUE(testGoodUri("#ccc"));
+ ASSERT_TRUE(testGoodUri("#"));
+ ASSERT_TRUE(testGoodUri("A'C"));
// escapes
- TEST_ASSERT(testGoodUri("http://example.org/aaa%2fbbb#ccc"));
- TEST_ASSERT(testGoodUri("http://example.org/aaa%2Fbbb#ccc"));
- TEST_ASSERT(testGoodUri("%2F"));
- TEST_ASSERT(testGoodUri("aaa%2Fbbb"));
+ ASSERT_TRUE(testGoodUri("http://example.org/aaa%2fbbb#ccc"));
+ ASSERT_TRUE(testGoodUri("http://example.org/aaa%2Fbbb#ccc"));
+ ASSERT_TRUE(testGoodUri("%2F"));
+ ASSERT_TRUE(testGoodUri("aaa%2Fbbb"));
// ports
- TEST_ASSERT(testGoodUri("http://example.org:80/aaa/bbb#ccc"));
- TEST_ASSERT(testGoodUri("http://example.org:/aaa/bbb#ccc"));
- TEST_ASSERT(testGoodUri("http://example.org./aaa/bbb#ccc"));
- TEST_ASSERT(testGoodUri("http://example.123./aaa/bbb#ccc"));
+ ASSERT_TRUE(testGoodUri("http://example.org:80/aaa/bbb#ccc"));
+ ASSERT_TRUE(testGoodUri("http://example.org:/aaa/bbb#ccc"));
+ ASSERT_TRUE(testGoodUri("http://example.org./aaa/bbb#ccc"));
+ ASSERT_TRUE(testGoodUri("http://example.123./aaa/bbb#ccc"));
// bare authority
- TEST_ASSERT(testGoodUri("http://example.org"));
+ ASSERT_TRUE(testGoodUri("http://example.org"));
// IPv6 literals (from RFC2732):
- TEST_ASSERT(testGoodUri("http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html"));
- TEST_ASSERT(testGoodUri("http://[1080:0:0:0:8:800:200C:417A]/index.html"));
- TEST_ASSERT(testGoodUri("http://[3ffe:2a00:100:7031::1]"));
- TEST_ASSERT(testGoodUri("http://[1080::8:800:200C:417A]/foo"));
- TEST_ASSERT(testGoodUri("http://[::192.9.5.5]/ipng"));
- TEST_ASSERT(testGoodUri("http://[::FFFF:129.144.52.38]:80/index.html"));
- TEST_ASSERT(testGoodUri("http://[2010:836B:4179::836B:4179]"));
- TEST_ASSERT(testGoodUri("//[2010:836B:4179::836B:4179]"));
+ ASSERT_TRUE(testGoodUri("http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html"));
+ ASSERT_TRUE(testGoodUri("http://[1080:0:0:0:8:800:200C:417A]/index.html"));
+ ASSERT_TRUE(testGoodUri("http://[3ffe:2a00:100:7031::1]"));
+ ASSERT_TRUE(testGoodUri("http://[1080::8:800:200C:417A]/foo"));
+ ASSERT_TRUE(testGoodUri("http://[::192.9.5.5]/ipng"));
+ ASSERT_TRUE(testGoodUri("http://[::FFFF:129.144.52.38]:80/index.html"));
+ ASSERT_TRUE(testGoodUri("http://[2010:836B:4179::836B:4179]"));
+ ASSERT_TRUE(testGoodUri("//[2010:836B:4179::836B:4179]"));
// Random other things that crop up
- TEST_ASSERT(testGoodUri("http://example/Andr&#567;"));
- TEST_ASSERT(testGoodUri("file:///C:/DEV/Haskell/lib/HXmlToolbox-3.01/examples/"));
+ ASSERT_TRUE(testGoodUri("http://example/Andr&#567;"));
+ ASSERT_TRUE(testGoodUri("file:///C:/DEV/Haskell/lib/HXmlToolbox-3.01/examples/"));
}
-void FourSuite::bad_URI_references() {
- TEST_ASSERT(testBadUri("beepbeep\x07\x07", 8));
- TEST_ASSERT(testBadUri("\n", 0));
- TEST_ASSERT(testBadUri("::", 0)); // not OK, per Roy Fielding on the W3C uri list on 2004-04-01
+TEST(FourSuite, BadUriReferences) {
+ ASSERT_TRUE(testBadUri("beepbeep\x07\x07", 8));
+ ASSERT_TRUE(testBadUri("\n", 0));
+ ASSERT_TRUE(testBadUri("::", 0)); // not OK, per Roy Fielding on the W3C uri list on 2004-04-01
// the following test cases are from a Perl script by David A. Wheeler
// at http://www.dwheeler.com/secure-programs/url.pl
- TEST_ASSERT(testBadUri("http://www yahoo.com", 10));
- TEST_ASSERT(testBadUri("http://www.yahoo.com/hello world/", 26));
- TEST_ASSERT(testBadUri("http://www.yahoo.com/yelp.html#\"", 31));
+ ASSERT_TRUE(testBadUri("http://www yahoo.com", 10));
+ ASSERT_TRUE(testBadUri("http://www.yahoo.com/hello world/", 26));
+ ASSERT_TRUE(testBadUri("http://www.yahoo.com/yelp.html#\"", 31));
// the following test cases are from a Haskell program by Graham Klyne
// at http://www.ninebynine.org/Software/HaskellUtils/Network/URITest.hs
- TEST_ASSERT(testBadUri("[2010:836B:4179::836B:4179]", 0));
- TEST_ASSERT(testBadUri(" ", 0));
- TEST_ASSERT(testBadUri("%", 1));
- TEST_ASSERT(testBadUri("A%Z", 2));
- TEST_ASSERT(testBadUri("%ZZ", 1));
- TEST_ASSERT(testBadUri("%AZ", 2));
- TEST_ASSERT(testBadUri("A C", 1));
- TEST_ASSERT(testBadUri("A\\'C", 1)); // r"A\'C"
- TEST_ASSERT(testBadUri("A`C", 1));
- TEST_ASSERT(testBadUri("A<C", 1));
- TEST_ASSERT(testBadUri("A>C", 1));
- TEST_ASSERT(testBadUri("A^C", 1));
- TEST_ASSERT(testBadUri("A\\\\C", 1)); // r'A\\C'
- TEST_ASSERT(testBadUri("A{C", 1));
- TEST_ASSERT(testBadUri("A|C", 1));
- TEST_ASSERT(testBadUri("A}C", 1));
- TEST_ASSERT(testBadUri("A[C", 1));
- TEST_ASSERT(testBadUri("A]C", 1));
- TEST_ASSERT(testBadUri("A[**]C", 1));
- TEST_ASSERT(testBadUri("http://[xyz]/", 8));
- TEST_ASSERT(testBadUri("http://]/", 7));
- TEST_ASSERT(testBadUri("http://example.org/[2010:836B:4179::836B:4179]", 19));
- TEST_ASSERT(testBadUri("http://example.org/abc#[2010:836B:4179::836B:4179]", 23));
- TEST_ASSERT(testBadUri("http://example.org/xxx/[qwerty]#a[b]", 23));
+ ASSERT_TRUE(testBadUri("[2010:836B:4179::836B:4179]", 0));
+ ASSERT_TRUE(testBadUri(" ", 0));
+ ASSERT_TRUE(testBadUri("%", 1));
+ ASSERT_TRUE(testBadUri("A%Z", 2));
+ ASSERT_TRUE(testBadUri("%ZZ", 1));
+ ASSERT_TRUE(testBadUri("%AZ", 2));
+ ASSERT_TRUE(testBadUri("A C", 1));
+ ASSERT_TRUE(testBadUri("A\\'C", 1)); // r"A\'C"
+ ASSERT_TRUE(testBadUri("A`C", 1));
+ ASSERT_TRUE(testBadUri("A<C", 1));
+ ASSERT_TRUE(testBadUri("A>C", 1));
+ ASSERT_TRUE(testBadUri("A^C", 1));
+ ASSERT_TRUE(testBadUri("A\\\\C", 1)); // r'A\\C'
+ ASSERT_TRUE(testBadUri("A{C", 1));
+ ASSERT_TRUE(testBadUri("A|C", 1));
+ ASSERT_TRUE(testBadUri("A}C", 1));
+ ASSERT_TRUE(testBadUri("A[C", 1));
+ ASSERT_TRUE(testBadUri("A]C", 1));
+ ASSERT_TRUE(testBadUri("A[**]C", 1));
+ ASSERT_TRUE(testBadUri("http://[xyz]/", 8));
+ ASSERT_TRUE(testBadUri("http://]/", 7));
+ ASSERT_TRUE(testBadUri("http://example.org/[2010:836B:4179::836B:4179]", 19));
+ ASSERT_TRUE(testBadUri("http://example.org/abc#[2010:836B:4179::836B:4179]", 23));
+ ASSERT_TRUE(testBadUri("http://example.org/xxx/[qwerty]#a[b]", 23));
// from a post to the W3C uri list on 2004-02-17
// breaks at 22 instead of 17 because everything up to that point is a valid userinfo
- TEST_ASSERT(testBadUri("http://w3c.org:80path1/path2", 22));
+ ASSERT_TRUE(testBadUri("http://w3c.org:80path1/path2", 22));
}
-bool FourSuite::normalizeAndCompare(const char * uriText,
+namespace {
+
+bool normalizeAndCompare(const char * uriText,
const char * expectedNormalized) {
UriParserStateA stateA;
int res;
@@ -591,33 +598,35 @@ bool FourSuite::normalizeAndCompare(const char * uriText,
return equalAfter;
}
+} // namespace
+
-void FourSuite::caseNormalizationTests() {
- TEST_ASSERT(normalizeAndCompare("HTTP://www.EXAMPLE.com/", "http://www.example.com/"));
- TEST_ASSERT(normalizeAndCompare("example://A/b/c/%7bfoo%7d", "example://a/b/c/%7Bfoo%7D"));
+TEST(FourSuite, CaseNormalizationTests) {
+ ASSERT_TRUE(normalizeAndCompare("HTTP://www.EXAMPLE.com/", "http://www.example.com/"));
+ ASSERT_TRUE(normalizeAndCompare("example://A/b/c/%7bfoo%7d", "example://a/b/c/%7Bfoo%7D"));
}
-void FourSuite::pctEncNormalizationTests() {
- TEST_ASSERT(normalizeAndCompare("http://host/%7Euser/x/y/z", "http://host/~user/x/y/z"));
- TEST_ASSERT(normalizeAndCompare("http://host/%7euser/x/y/z", "http://host/~user/x/y/z"));
+TEST(FourSuite, PctEncNormalizationTests) {
+ ASSERT_TRUE(normalizeAndCompare("http://host/%7Euser/x/y/z", "http://host/~user/x/y/z"));
+ ASSERT_TRUE(normalizeAndCompare("http://host/%7euser/x/y/z", "http://host/~user/x/y/z"));
}
-void FourSuite::pathSegmentNormalizationTests() {
- TEST_ASSERT(normalizeAndCompare("/a/b/../../c", "/c"));
- // TEST_ASSERT(normalizeAndCompare("a/b/../../c", "a/b/../../c"));
+TEST(FourSuite, PathSegmentNormalizationTests) {
+ ASSERT_TRUE(normalizeAndCompare("/a/b/../../c", "/c"));
+ // ASSERT_TRUE(normalizeAndCompare("a/b/../../c", "a/b/../../c"));
// Fixed:
- TEST_ASSERT(normalizeAndCompare("a/b/../../c", "c"));
- TEST_ASSERT(normalizeAndCompare("/a/b/././c", "/a/b/c"));
- // TEST_ASSERT(normalizeAndCompare("a/b/././c", "a/b/././c"));
+ ASSERT_TRUE(normalizeAndCompare("a/b/../../c", "c"));
+ ASSERT_TRUE(normalizeAndCompare("/a/b/././c", "/a/b/c"));
+ // ASSERT_TRUE(normalizeAndCompare("a/b/././c", "a/b/././c"));
// Fixed:
- TEST_ASSERT(normalizeAndCompare("a/b/././c", "a/b/c"));
- TEST_ASSERT(normalizeAndCompare("/a/b/../c/././d", "/a/c/d"));
- // TEST_ASSERT(normalizeAndCompare("a/b/../c/././d", "a/b/../c/././d"));
+ ASSERT_TRUE(normalizeAndCompare("a/b/././c", "a/b/c"));
+ ASSERT_TRUE(normalizeAndCompare("/a/b/../c/././d", "/a/c/d"));
+ // ASSERT_TRUE(normalizeAndCompare("a/b/../c/././d", "a/b/../c/././d"));
// Fixed:
- TEST_ASSERT(normalizeAndCompare("a/b/../c/././d", "a/c/d"));
+ ASSERT_TRUE(normalizeAndCompare("a/b/../c/././d", "a/c/d"));
}
diff --git a/test/FourSuite.h b/test/FourSuite.h
deleted file mode 100644
index 9a33c16..0000000
--- a/test/FourSuite.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
- * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
- *
- * This library 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 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef TEST_FOUR_SUITE_H
-#define TEST_FOUR_SUITE_H 1
-
-
-
-#include <cpptest.h>
-
-using namespace Test;
-
-
-
-class FourSuite : public Suite {
-
-public:
- FourSuite() {
- TEST_ADD(FourSuite::absolutize_test_cases)
- TEST_ADD(FourSuite::relativize_test_cases)
- TEST_ADD(FourSuite::good_URI_references)
- TEST_ADD(FourSuite::bad_URI_references)
- TEST_ADD(FourSuite::caseNormalizationTests)
- TEST_ADD(FourSuite::pctEncNormalizationTests)
- TEST_ADD(FourSuite::pathSegmentNormalizationTests)
- }
-
-private:
- bool testAddOrRemoveBaseHelper(const char * ref,
- const char * base, const char * expected, bool add = true,
- bool domainRootMode = false);
-
- void absolutize_test_cases();
- void relativize_test_cases();
-
- int testParseUri(const char * uriText, const char ** expectedErrorPos = NULL);
- bool testGoodUri(const char * uriText);
- bool testBadUri(const char * uriText, int expectedErrorOffset = -1);
- void good_URI_references();
- void bad_URI_references();
-
- bool normalizeAndCompare(const char * uriText,
- const char * expectedNormalized);
- void caseNormalizationTests();
- void pctEncNormalizationTests();
- void pathSegmentNormalizationTests();
-
-};
-
-
-
-#endif // TEST_FOUR_SUITE_H
diff --git a/test/MemoryManagerSuite.cpp b/test/MemoryManagerSuite.cpp
new file mode 100644
index 0000000..85f498b
--- /dev/null
+++ b/test/MemoryManagerSuite.cpp
@@ -0,0 +1,376 @@
+/*
+ * uriparser - RFC 3986 URI parsing library
+ *
+ * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
+ * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
+ *
+ * This library 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 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <cassert>
+#include <cerrno>
+#include <cstring> // memcpy
+#include <gtest/gtest.h>
+
+#include <uriparser/Uri.h>
+#include "../src/UriMemory.h"
+
+
+namespace {
+
+class CallCountLog {
+public:
+ unsigned int callCountFree;
+
+ CallCountLog() : callCountFree(0) {
+ // no-op
+ }
+};
+
+
+
+static void * failingMalloc(UriMemoryManager * URI_UNUSED(memory),
+ size_t URI_UNUSED(size)) {
+ return NULL;
+}
+
+
+
+static void * failingCalloc(UriMemoryManager * URI_UNUSED(memory),
+ size_t URI_UNUSED(nmemb), size_t URI_UNUSED(size)) {
+ return NULL;
+}
+
+
+
+static void * failingRealloc(UriMemoryManager * URI_UNUSED(memory),
+ void * URI_UNUSED(ptr), size_t URI_UNUSED(size)) {
+ return NULL;
+}
+
+
+
+static void * failingReallocarray(UriMemoryManager * URI_UNUSED(memory),
+ void * URI_UNUSED(ptr), size_t URI_UNUSED(nmemb),
+ size_t URI_UNUSED(size)) {
+ return NULL;
+}
+
+
+
+static void countingFree(UriMemoryManager * memory, void * ptr) {
+ static_cast<CallCountLog *>(memory->userData)->callCountFree++;
+ free(ptr);
+}
+
+
+
+class FailingMemoryManager {
+private:
+ UriMemoryManager memoryManager;
+ CallCountLog callCountLog;
+
+public:
+ FailingMemoryManager() {
+ this->memoryManager.malloc = failingMalloc;
+ this->memoryManager.calloc = failingCalloc;
+ this->memoryManager.realloc = failingRealloc;
+ this->memoryManager.reallocarray = failingReallocarray;
+ this->memoryManager.free = countingFree;
+ this->memoryManager.userData = &(this->callCountLog);
+ }
+
+ UriMemoryManager * operator&() {
+ return &(this->memoryManager);
+ }
+
+ unsigned int getCallCountFree() const {
+ return this->callCountLog.callCountFree;
+ }
+};
+
+
+
+static UriUriA parse(const char * sourceUriString) {
+ UriParserStateA state;
+ UriUriA uri;
+ state.uri = &uri;
+ assert(uriParseUriA(&state, sourceUriString) == URI_SUCCESS);
+ return uri;
+}
+
+
+
+static UriQueryListA * parseQueryList(const char * queryString) {
+ UriQueryListA * queryList;
+ const char * const first = queryString;
+ const char * const afterLast = first + strlen(first);
+ assert(uriDissectQueryMallocA(&queryList, NULL, first, afterLast)
+ == URI_SUCCESS);
+ return queryList;
+}
+
+} // namespace
+
+
+
+TEST(MemoryManagerCompletenessSuite, AllFunctionMembersRequired) {
+ UriUriA uri = parse("whatever");
+ UriMemoryManager memory;
+
+ memcpy(&memory, &defaultMemoryManager, sizeof(UriMemoryManager));
+ memory.malloc = NULL;
+ ASSERT_EQ(uriFreeUriMembersMmA(&uri, &memory),
+ URI_ERROR_MEMORY_MANAGER_INCOMPLETE);
+
+ memcpy(&memory, &defaultMemoryManager, sizeof(UriMemoryManager));
+ memory.calloc = NULL;
+ ASSERT_EQ(uriFreeUriMembersMmA(&uri, &memory),
+ URI_ERROR_MEMORY_MANAGER_INCOMPLETE);
+
+ memcpy(&memory, &defaultMemoryManager, sizeof(UriMemoryManager));
+ memory.realloc = NULL;
+ ASSERT_EQ(uriFreeUriMembersMmA(&uri, &memory),
+ URI_ERROR_MEMORY_MANAGER_INCOMPLETE);
+
+ memcpy(&memory, &defaultMemoryManager, sizeof(UriMemoryManager));
+ memory.reallocarray = NULL;
+ ASSERT_EQ(uriFreeUriMembersMmA(&uri, &memory),
+ URI_ERROR_MEMORY_MANAGER_INCOMPLETE);
+
+ memcpy(&memory, &defaultMemoryManager, sizeof(UriMemoryManager));
+ memory.free = NULL;
+ ASSERT_EQ(uriFreeUriMembersMmA(&uri, &memory),
+ URI_ERROR_MEMORY_MANAGER_INCOMPLETE);
+
+ memcpy(&memory, &defaultMemoryManager, sizeof(UriMemoryManager));
+ ASSERT_EQ(uriFreeUriMembersMmA(&uri, &memory), URI_SUCCESS);
+}
+
+
+
+TEST(MemoryManagerCompletenessSuite, MallocAndFreeRequiredOnly) {
+ UriMemoryManager memory;
+ UriMemoryManager backend;
+
+ memcpy(&backend, &defaultMemoryManager, sizeof(UriMemoryManager));
+ backend.malloc = NULL;
+ ASSERT_EQ(uriCompleteMemoryManager(&memory, &backend),
+ URI_ERROR_MEMORY_MANAGER_INCOMPLETE);
+
+ memcpy(&backend, &defaultMemoryManager, sizeof(UriMemoryManager));
+ backend.free = NULL;
+ ASSERT_EQ(uriCompleteMemoryManager(&memory, &backend),
+ URI_ERROR_MEMORY_MANAGER_INCOMPLETE);
+}
+
+
+
+TEST(MemoryManagerTestingSuite, DefaultMemoryManager) {
+ ASSERT_EQ(uriTestMemoryManager(&defaultMemoryManager), URI_SUCCESS);
+}
+
+
+
+TEST(MemoryManagerTestingSuite, CompleteMemoryManager) {
+ UriMemoryManager memory;
+ UriMemoryManager backend;
+
+ memset(&backend, 0, sizeof(UriMemoryManager));
+ backend.malloc = defaultMemoryManager.malloc;
+ backend.free = defaultMemoryManager.free;
+
+ ASSERT_EQ(uriCompleteMemoryManager(&memory, &backend),
+ URI_SUCCESS);
+
+ ASSERT_EQ(uriTestMemoryManager(&memory), URI_SUCCESS);
+}
+
+
+
+TEST(MemoryManagerTestingSuite, EmulateCalloc) {
+ UriMemoryManager partialEmulationMemoryManager;
+ memcpy(&partialEmulationMemoryManager, &defaultMemoryManager,
+ sizeof(UriMemoryManager));
+ partialEmulationMemoryManager.calloc = uriEmulateCalloc;
+
+ ASSERT_EQ(uriTestMemoryManager(&partialEmulationMemoryManager),
+ URI_SUCCESS);
+}
+
+
+
+TEST(MemoryManagerTestingSuite, EmulateReallocarray) {
+ UriMemoryManager partialEmulationMemoryManager;
+ memcpy(&partialEmulationMemoryManager, &defaultMemoryManager,
+ sizeof(UriMemoryManager));
+ partialEmulationMemoryManager.reallocarray = uriEmulateReallocarray;
+
+ ASSERT_EQ(uriTestMemoryManager(&partialEmulationMemoryManager),
+ URI_SUCCESS);
+}
+
+
+
+TEST(MemoryManagerTestingOverflowDetectionSuite, EmulateCalloc) {
+ EXPECT_GT(2 * sizeof(size_t), sizeof(void *));
+
+ errno = 0;
+ ASSERT_EQ(NULL, uriEmulateCalloc(
+ &defaultMemoryManager, (size_t)-1, (size_t)-1));
+ ASSERT_EQ(errno, ENOMEM);
+}
+
+
+
+TEST(MemoryManagerTestingOverflowDetectionSuite, EmulateReallocarray) {
+ EXPECT_GT(2 * sizeof(size_t), sizeof(void *));
+
+ errno = 0;
+ ASSERT_EQ(NULL, uriEmulateReallocarray(
+ &defaultMemoryManager, NULL, (size_t)-1, (size_t)-1));
+ ASSERT_EQ(errno, ENOMEM);
+}
+
+
+
+TEST(MemoryManagerTestingSuite, EmulateCallocAndReallocarray) {
+ UriMemoryManager partialEmulationMemoryManager;
+ memcpy(&partialEmulationMemoryManager, &defaultMemoryManager,
+ sizeof(UriMemoryManager));
+ partialEmulationMemoryManager.calloc = uriEmulateCalloc;
+ partialEmulationMemoryManager.reallocarray = uriEmulateReallocarray;
+
+ ASSERT_EQ(uriTestMemoryManager(&partialEmulationMemoryManager),
+ URI_SUCCESS);
+}
+
+
+
+TEST(FailingMemoryManagerSuite, AddBaseUriExMm) {
+ UriUriA absoluteDest;
+ UriUriA relativeSource = parse("foo");
+ UriUriA absoluteBase = parse("http://example.org/bar");
+ const UriResolutionOptions options = URI_RESOLVE_STRICTLY;
+ FailingMemoryManager failingMemoryManager;
+
+ ASSERT_EQ(uriAddBaseUriExMmA(&absoluteDest, &relativeSource,
+ &absoluteBase, options, &failingMemoryManager),
+ URI_ERROR_MALLOC);
+
+ uriFreeUriMembersA(&relativeSource);
+ uriFreeUriMembersA(&absoluteBase);
+}
+
+
+
+TEST(FailingMemoryManagerSuite, ComposeQueryMallocExMm) {
+ char * dest = NULL;
+ UriQueryListA * const queryList = parseQueryList("k1=v1");
+ UriBool spaceToPlus = URI_TRUE; // not of interest
+ UriBool normalizeBreaks = URI_TRUE; // not of interest
+ FailingMemoryManager failingMemoryManager;
+
+ ASSERT_EQ(uriComposeQueryMallocExMmA(&dest, queryList,
+ spaceToPlus, normalizeBreaks, &failingMemoryManager),
+ URI_ERROR_MALLOC);
+
+ uriFreeQueryListA(queryList);
+}
+
+
+
+TEST(FailingMemoryManagerSuite, DissectQueryMallocExMm) {
+ UriQueryListA * queryList;
+ int itemCount;
+ const char * const first = "k1=v1&k2=v2";
+ const char * const afterLast = first + strlen(first);
+ const UriBool plusToSpace = URI_TRUE; // not of interest
+ const UriBreakConversion breakConversion = URI_BR_DONT_TOUCH; // not o. i.
+ FailingMemoryManager failingMemoryManager;
+
+ ASSERT_EQ(uriDissectQueryMallocExMmA(&queryList, &itemCount,
+ first, afterLast, plusToSpace, breakConversion,
+ &failingMemoryManager),
+ URI_ERROR_MALLOC);
+}
+
+
+
+TEST(FailingMemoryManagerSuite, FreeQueryListMm) {
+ UriQueryListA * const queryList = parseQueryList("k1=v1");
+ FailingMemoryManager failingMemoryManager;
+ ASSERT_EQ(failingMemoryManager.getCallCountFree(), 0);
+
+ uriFreeQueryListMmA(queryList, &failingMemoryManager);
+
+ ASSERT_GE(failingMemoryManager.getCallCountFree(), 1);
+}
+
+
+
+TEST(FailingMemoryManagerSuite, FreeUriMembersMm) {
+ UriUriA uri = parse("http://example.org/");
+ FailingMemoryManager failingMemoryManager;
+ ASSERT_EQ(failingMemoryManager.getCallCountFree(), 0);
+
+ uriFreeUriMembersMmA(&uri, &failingMemoryManager);
+
+ ASSERT_GE(failingMemoryManager.getCallCountFree(), 1);
+ uriFreeUriMembersA(&uri);
+}
+
+
+
+TEST(FailingMemoryManagerSuite, NormalizeSyntaxExMm) {
+ UriUriA uri = parse("hTTp://example.org/path");
+ const unsigned int mask = URI_NORMALIZE_SCHEME; // anything but URI_NORMALIZED
+ FailingMemoryManager failingMemoryManager;
+
+ ASSERT_EQ(uriNormalizeSyntaxExMmA(&uri, mask, &failingMemoryManager),
+ URI_ERROR_MALLOC);
+
+ uriFreeUriMembersA(&uri);
+}
+
+
+
+TEST(FailingMemoryManagerSuite, ParseSingleUriExMm) {
+ UriUriA uri;
+ const char * const first = "k1=v1&k2=v2";
+ const char * const afterLast = first + strlen(first);
+ FailingMemoryManager failingMemoryManager;
+
+ ASSERT_EQ(uriParseSingleUriExMmA(&uri, first, afterLast, NULL,
+ &failingMemoryManager),
+ URI_ERROR_MALLOC);
+}
+
+
+
+TEST(FailingMemoryManagerSuite, RemoveBaseUriMm) {
+ UriUriA dest;
+ UriUriA absoluteSource = parse("http://example.org/a/b/c/");
+ UriUriA absoluteBase = parse("http://example.org/a/");
+ const UriBool domainRootMode = URI_TRUE; // not of interest
+ FailingMemoryManager failingMemoryManager;
+
+ ASSERT_EQ(uriRemoveBaseUriMmA(&dest, &absoluteSource, &absoluteBase,
+ domainRootMode, &failingMemoryManager),
+ URI_ERROR_MALLOC);
+
+ uriFreeUriMembersA(&absoluteSource);
+ uriFreeUriMembersA(&absoluteBase);
+}
diff --git a/test/VersionSuite.cpp b/test/VersionSuite.cpp
index 1c2d072..fb28c15 100644
--- a/test/VersionSuite.cpp
+++ b/test/VersionSuite.cpp
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "VersionSuite.h"
+#include <gtest/gtest.h>
#ifndef _GNU_SOURCE
# define _GNU_SOURCE // for asprintf
@@ -30,12 +30,11 @@
#include <uriparser/UriBase.h>
-void VersionSuite::ensure_version_defines_in_sync() {
+TEST(VersionSuite, EnsureVersionDefinesInSync) {
char * INSIDE_VERSION = NULL;
const int bytes_printed = asprintf(&INSIDE_VERSION, "%d.%d.%d%s",
URI_VER_MAJOR, URI_VER_MINOR, URI_VER_RELEASE, URI_VER_SUFFIX_ANSI);
- TEST_ASSERT(bytes_printed != -1);
- printf("bytes_printed: %d\n", bytes_printed);
+ ASSERT_TRUE(bytes_printed != -1);
const bool equal = !strcmp(INSIDE_VERSION, PACKAGE_VERSION);
if (! equal) {
@@ -44,5 +43,5 @@ void VersionSuite::ensure_version_defines_in_sync() {
printf(" Header defines version: <%s>\n", INSIDE_VERSION);
}
free(INSIDE_VERSION);
- TEST_ASSERT(equal);
+ ASSERT_TRUE(equal);
}
diff --git a/test/VersionSuite.h b/test/VersionSuite.h
deleted file mode 100644
index f0276c5..0000000
--- a/test/VersionSuite.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * uriparser - RFC 3986 URI parsing library
- *
- * Copyright (C) 2014, Sebastian Pipping <sebastian@pipping.org>
- *
- * This library 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 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef TEST_VERSION_TEST_H
-#define TEST_VERSION_TEST_H 1
-
-
-
-#include <cpptest.h>
-
-using namespace Test;
-
-
-
-class VersionSuite : public Suite {
-
-public:
- VersionSuite() {
- TEST_ADD(VersionSuite::ensure_version_defines_in_sync)
- }
-
-private:
- void ensure_version_defines_in_sync();
-
-};
-
-
-
-#endif // TEST_VERSION_TEST_H
diff --git a/test/test.cpp b/test/test.cpp
index 41e3912..78fd980 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -20,16 +20,12 @@
*/
#include <uriparser/Uri.h>
-#include <cpptest.h>
+#include <gtest/gtest.h>
#include <memory>
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
-#include "FourSuite.h"
-#include "VersionSuite.h"
-
-using namespace Test;
using namespace std;
@@ -42,77 +38,15 @@ int uriCompareRangeA(const UriTextRangeA * a, const UriTextRangeA * b);
-#define URI_TEST_IP_FOUR_FAIL(x) TEST_ASSERT(URI_FALSE == uri_TESTING_ONLY_ParseIpFourA(x))
-#define URI_TEST_IP_FOUR_PASS(x) TEST_ASSERT(URI_TRUE == uri_TESTING_ONLY_ParseIpFourA(x))
+#define URI_TEST_IP_FOUR_FAIL(x) ASSERT_TRUE(URI_FALSE == uri_TESTING_ONLY_ParseIpFourA(x))
+#define URI_TEST_IP_FOUR_PASS(x) ASSERT_TRUE(URI_TRUE == uri_TESTING_ONLY_ParseIpFourA(x))
// Note the closing brackets! TODO
-#define URI_TEST_IP_SIX_FAIL(x) TEST_ASSERT(URI_FALSE == uri_TESTING_ONLY_ParseIpSixA(x "]"))
-#define URI_TEST_IP_SIX_PASS(x) TEST_ASSERT(URI_TRUE == uri_TESTING_ONLY_ParseIpSixA(x "]"))
-
-
-
-class UriSuite : public Suite {
-
-public:
- UriSuite() {
- TEST_ADD(UriSuite::testDistinction)
- TEST_ADD(UriSuite::testIpFour)
- TEST_ADD(UriSuite::testIpSixPass)
- TEST_ADD(UriSuite::testIpSixFail)
- TEST_ADD(UriSuite::testUri)
- TEST_ADD(UriSuite::testUriUserInfoHostPort1)
- TEST_ADD(UriSuite::testUriUserInfoHostPort2)
- TEST_ADD(UriSuite::testUriUserInfoHostPort22_Bug1948038)
- TEST_ADD(UriSuite::testUriUserInfoHostPort23_Bug3510198_1)
- TEST_ADD(UriSuite::testUriUserInfoHostPort23_Bug3510198_2)
- TEST_ADD(UriSuite::testUriUserInfoHostPort23_Bug3510198_3)
- TEST_ADD(UriSuite::testUriUserInfoHostPort23_Bug3510198_4)
- TEST_ADD(UriSuite::testUriUserInfoHostPort23_Bug3510198_related_1)
- TEST_ADD(UriSuite::testUriUserInfoHostPort23_Bug3510198_related_12)
- TEST_ADD(UriSuite::testUriUserInfoHostPort23_Bug3510198_related_2)
- TEST_ADD(UriSuite::testUriUserInfoHostPort3)
- TEST_ADD(UriSuite::testUriUserInfoHostPort4)
- TEST_ADD(UriSuite::testUriUserInfoHostPort5)
- TEST_ADD(UriSuite::testUriUserInfoHostPort6)
- TEST_ADD(UriSuite::testUriHostRegname)
- TEST_ADD(UriSuite::testUriHostIpFour1)
- TEST_ADD(UriSuite::testUriHostIpFour2)
- TEST_ADD(UriSuite::testUriHostIpSix1)
- TEST_ADD(UriSuite::testUriHostIpSix2)
- TEST_ADD(UriSuite::testUriHostIpFuture)
- TEST_ADD(UriSuite::testUriHostEmpty)
- TEST_ADD(UriSuite::testUriComponents)
- TEST_ADD(UriSuite::testUriComponents_Bug20070701)
- TEST_ADD(UriSuite::testEscaping)
- TEST_ADD(UriSuite::testUnescaping)
- TEST_ADD(UriSuite::testTrailingSlash)
- TEST_ADD(UriSuite::testAddBase)
- TEST_ADD(UriSuite::testToString)
- TEST_ADD(UriSuite::testToString_Bug1950126)
- TEST_ADD(UriSuite::testToStringCharsRequired)
- TEST_ADD(UriSuite::testToStringCharsRequired)
- TEST_ADD(UriSuite::testNormalizeSyntaxMaskRequired)
- TEST_ADD(UriSuite::testNormalizeSyntax)
- TEST_ADD(UriSuite::testNormalizeSyntaxComponents)
- TEST_ADD(UriSuite::testNormalizeCrash_Bug20080224)
- TEST_ADD(UriSuite::testFilenameUriConversion)
- TEST_ADD(UriSuite::testCrash_FreeUriMembers_Bug20080116)
- TEST_ADD(UriSuite::testCrash_Report2418192)
- TEST_ADD(UriSuite::testPervertedQueryString);
- TEST_ADD(UriSuite::testQueryStringEndingInEqualSign_NonBug32);
- TEST_ADD(UriSuite::testCrash_MakeOwner_Bug20080207)
- TEST_ADD(UriSuite::testQueryList)
- TEST_ADD(UriSuite::testQueryListPair)
- TEST_ADD(UriSuite::testQueryDissection_Bug3590761)
- TEST_ADD(UriSuite::testFreeCrash_Bug20080827)
- TEST_ADD(UriSuite::testParseInvalid_Bug16)
- TEST_ADD(UriSuite::testRangeComparison)
- TEST_ADD(UriSuite::testRangeComparison_RemoveBaseUri_Issue19)
- TEST_ADD(UriSuite::testEquals)
- TEST_ADD(UriSuite::testHostTextTermination_Issue15)
- }
+#define URI_TEST_IP_SIX_FAIL(x) ASSERT_TRUE(URI_FALSE == uri_TESTING_ONLY_ParseIpSixA(x "]"))
+#define URI_TEST_IP_SIX_PASS(x) ASSERT_TRUE(URI_TRUE == uri_TESTING_ONLY_ParseIpSixA(x "]"))
+
-private:
+namespace {
bool testDistinctionHelper(const char * uriText, bool expectedHostSet,
bool expectedAbsPath, bool expectedEmptyTailSegment) {
UriParserStateA state;
@@ -144,8 +78,10 @@ private:
uriFreeUriMembersA(&uri);
return true;
}
+} // namespace
- void testDistinction() {
+
+TEST(UriSuite, TestDistinction) {
/*
============================================================================
Rule | Example | hostSet | absPath | emptySeg
@@ -169,24 +105,24 @@ Rule | Example | hostSet | absPath | emptySeg
4) path-empty | "" | false | false | false
============================================================================
*/
- TEST_ASSERT(testDistinctionHelper("s://", true, false, false));
- TEST_ASSERT(testDistinctionHelper("s:///", true, false, true));
- TEST_ASSERT(testDistinctionHelper("s://a", true, false, false));
- TEST_ASSERT(testDistinctionHelper("s://a/", true, false, true));
- TEST_ASSERT(testDistinctionHelper("s:/", false, true, false));
- TEST_ASSERT(testDistinctionHelper("s:a", false, false, false));
- TEST_ASSERT(testDistinctionHelper("s:a/", false, false, true));
- TEST_ASSERT(testDistinctionHelper("s:", false, false, false));
-
- TEST_ASSERT(testDistinctionHelper("//", true, false, false));
- TEST_ASSERT(testDistinctionHelper("///", true, false, true));
- TEST_ASSERT(testDistinctionHelper("/", false, true, false));
- TEST_ASSERT(testDistinctionHelper("a", false, false, false));
- TEST_ASSERT(testDistinctionHelper("a/", false, false, true));
- TEST_ASSERT(testDistinctionHelper("", false, false, false));
- }
+ ASSERT_TRUE(testDistinctionHelper("s://", true, false, false));
+ ASSERT_TRUE(testDistinctionHelper("s:///", true, false, true));
+ ASSERT_TRUE(testDistinctionHelper("s://a", true, false, false));
+ ASSERT_TRUE(testDistinctionHelper("s://a/", true, false, true));
+ ASSERT_TRUE(testDistinctionHelper("s:/", false, true, false));
+ ASSERT_TRUE(testDistinctionHelper("s:a", false, false, false));
+ ASSERT_TRUE(testDistinctionHelper("s:a/", false, false, true));
+ ASSERT_TRUE(testDistinctionHelper("s:", false, false, false));
+
+ ASSERT_TRUE(testDistinctionHelper("//", true, false, false));
+ ASSERT_TRUE(testDistinctionHelper("///", true, false, true));
+ ASSERT_TRUE(testDistinctionHelper("/", false, true, false));
+ ASSERT_TRUE(testDistinctionHelper("a", false, false, false));
+ ASSERT_TRUE(testDistinctionHelper("a/", false, false, true));
+ ASSERT_TRUE(testDistinctionHelper("", false, false, false));
+}
- void testIpFour() {
+TEST(UriSuite, TestIpFour) {
URI_TEST_IP_FOUR_FAIL("01.0.0.0");
URI_TEST_IP_FOUR_FAIL("001.0.0.0");
URI_TEST_IP_FOUR_FAIL("00.0.0.0");
@@ -208,9 +144,9 @@ Rule | Example | hostSet | absPath | emptySeg
URI_TEST_IP_FOUR_PASS("2.0.0.0");
URI_TEST_IP_FOUR_PASS("3.0.0.0");
URI_TEST_IP_FOUR_PASS("30.0.0.0");
- }
+}
- void testIpSixPass() {
+TEST(UriSuite, TestIpSixPass) {
// Quad length
URI_TEST_IP_SIX_PASS("abcd::");
@@ -258,9 +194,9 @@ Rule | Example | hostSet | absPath | emptySeg
URI_TEST_IP_SIX_PASS("2001:db8:100:f101::1");
URI_TEST_IP_SIX_PASS("a:b:c::12:1");
URI_TEST_IP_SIX_PASS("a:b::0:1:2:3");
- }
+}
- void testIpSixFail() {
+TEST(UriSuite, TestIpSixFail) {
// 5 char quad
URI_TEST_IP_SIX_FAIL("::12345");
@@ -304,9 +240,9 @@ Rule | Example | hostSet | absPath | emptySeg
// Nonhex
URI_TEST_IP_SIX_FAIL("g:0:0:0:0:0:0");
- }
+}
- void testUri() {
+TEST(UriSuite, TestUri) {
UriParserStateA stateA;
UriParserStateW stateW;
UriUriA uriA;
@@ -316,65 +252,65 @@ Rule | Example | hostSet | absPath | emptySeg
stateW.uri = &uriW;
// On/off for each
- TEST_ASSERT(0 == uriParseUriA(&stateA, "//user:pass@[::1]:80/segment/index.html?query#frag"));
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "//user:pass@[::1]:80/segment/index.html?query#frag"));
uriFreeUriMembersA(&uriA);
- TEST_ASSERT(0 == uriParseUriA(&stateA, "http://[::1]:80/segment/index.html?query#frag"));
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "http://[::1]:80/segment/index.html?query#frag"));
uriFreeUriMembersA(&uriA);
- TEST_ASSERT(0 == uriParseUriA(&stateA, "http://user:pass@[::1]/segment/index.html?query#frag"));
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "http://user:pass@[::1]/segment/index.html?query#frag"));
uriFreeUriMembersA(&uriA);
- TEST_ASSERT(0 == uriParseUriA(&stateA, "http://user:pass@[::1]:80?query#frag"));
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "http://user:pass@[::1]:80?query#frag"));
uriFreeUriMembersA(&uriA);
- TEST_ASSERT(0 == uriParseUriA(&stateA, "http://user:pass@[::1]:80/segment/index.html#frag"));
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "http://user:pass@[::1]:80/segment/index.html#frag"));
uriFreeUriMembersA(&uriA);
- TEST_ASSERT(0 == uriParseUriA(&stateA, "http://user:pass@[::1]:80/segment/index.html?query"));
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "http://user:pass@[::1]:80/segment/index.html?query"));
uriFreeUriMembersA(&uriA);
// Schema, port, one segment
- TEST_ASSERT(0 == uriParseUriA(&stateA, "ftp://host:21/gnu/"));
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "ftp://host:21/gnu/"));
uriFreeUriMembersA(&uriA);
// Relative
- TEST_ASSERT(0 == uriParseUriA(&stateA, "one/two/three"));
- TEST_ASSERT(!uriA.absolutePath);
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "one/two/three"));
+ ASSERT_TRUE(!uriA.absolutePath);
uriFreeUriMembersA(&uriA);
- TEST_ASSERT(0 == uriParseUriA(&stateA, "/one/two/three"));
- TEST_ASSERT(uriA.absolutePath);
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "/one/two/three"));
+ ASSERT_TRUE(uriA.absolutePath);
uriFreeUriMembersA(&uriA);
- TEST_ASSERT(0 == uriParseUriA(&stateA, "//user:pass@localhost/one/two/three"));
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "//user:pass@localhost/one/two/three"));
uriFreeUriMembersA(&uriA);
// ANSI and Unicode
- TEST_ASSERT(0 == uriParseUriA(&stateA, "http://www.example.com/"));
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "http://www.example.com/"));
uriFreeUriMembersA(&uriA);
- TEST_ASSERT(0 == uriParseUriW(&stateW, L"http://www.example.com/"));
+ ASSERT_TRUE(0 == uriParseUriW(&stateW, L"http://www.example.com/"));
uriFreeUriMembersW(&uriW);
// Real life examples
- TEST_ASSERT(0 == uriParseUriA(&stateA, "http://sourceforge.net/projects/uriparser/"));
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "http://sourceforge.net/projects/uriparser/"));
uriFreeUriMembersA(&uriA);
- TEST_ASSERT(0 == uriParseUriA(&stateA, "http://sourceforge.net/project/platformdownload.php?group_id=182840"));
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "http://sourceforge.net/project/platformdownload.php?group_id=182840"));
uriFreeUriMembersA(&uriA);
- TEST_ASSERT(0 == uriParseUriA(&stateA, "mailto:test@example.com"));
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "mailto:test@example.com"));
uriFreeUriMembersA(&uriA);
- TEST_ASSERT(0 == uriParseUriA(&stateA, "../../"));
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "../../"));
uriFreeUriMembersA(&uriA);
- TEST_ASSERT(0 == uriParseUriA(&stateA, "/"));
- TEST_ASSERT(uriA.absolutePath)
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "/"));
+ ASSERT_TRUE(uriA.absolutePath);
uriFreeUriMembersA(&uriA);
- TEST_ASSERT(0 == uriParseUriA(&stateA, ""));
- TEST_ASSERT(!uriA.absolutePath)
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, ""));
+ ASSERT_TRUE(!uriA.absolutePath);
uriFreeUriMembersA(&uriA);
- TEST_ASSERT(0 == uriParseUriA(&stateA, "file:///bin/bash"));
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "file:///bin/bash"));
uriFreeUriMembersA(&uriA);
// Percent encoding
- TEST_ASSERT(0 == uriParseUriA(&stateA, "http://www.example.com/name%20with%20spaces/"));
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "http://www.example.com/name%20with%20spaces/"));
uriFreeUriMembersA(&uriA);
- TEST_ASSERT(0 != uriParseUriA(&stateA, "http://www.example.com/name with spaces/"));
+ ASSERT_TRUE(0 != uriParseUriA(&stateA, "http://www.example.com/name with spaces/"));
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriComponents() {
+TEST(UriSuite, TestUriComponents) {
UriParserStateA stateA;
UriUriA uriA;
stateA.uri = &uriA;
@@ -382,85 +318,85 @@ Rule | Example | hostSet | absPath | emptySeg
const char * const input = "http" "://" "sourceforge.net" "/" "project" "/"
// 0 20 01 0 15
"platformdownload.php" "?" "group_id=182840";
- TEST_ASSERT(0 == uriParseUriA(&stateA, input));
-
- TEST_ASSERT(uriA.scheme.first == input);
- TEST_ASSERT(uriA.scheme.afterLast == input + 4);
- TEST_ASSERT(uriA.userInfo.first == NULL);
- TEST_ASSERT(uriA.userInfo.afterLast == NULL);
- TEST_ASSERT(uriA.hostText.first == input + 4 + 3);
- TEST_ASSERT(uriA.hostText.afterLast == input + 4 + 3 + 15);
- TEST_ASSERT(uriA.hostData.ipFuture.first == NULL);
- TEST_ASSERT(uriA.hostData.ipFuture.afterLast == NULL);
- TEST_ASSERT(uriA.portText.first == NULL);
- TEST_ASSERT(uriA.portText.afterLast == NULL);
-
- TEST_ASSERT(uriA.pathHead->text.first == input + 4 + 3 + 15 + 1);
- TEST_ASSERT(uriA.pathHead->text.afterLast == input + 4 + 3 + 15 + 1 + 7);
- TEST_ASSERT(uriA.pathHead->next->text.first == input + 4 + 3 + 15 + 1 + 7 + 1);
- TEST_ASSERT(uriA.pathHead->next->text.afterLast == input + 4 + 3 + 15 + 1 + 7 + 1 + 20);
- TEST_ASSERT(uriA.pathHead->next->next == NULL);
- TEST_ASSERT(uriA.pathTail == uriA.pathHead->next);
-
- TEST_ASSERT(uriA.query.first == input + 4 + 3 + 15 + 1 + 7 + 1 + 20 + 1);
- TEST_ASSERT(uriA.query.afterLast == input + 4 + 3 + 15 + 1 + 7 + 1 + 20 + 1 + 15);
- TEST_ASSERT(uriA.fragment.first == NULL);
- TEST_ASSERT(uriA.fragment.afterLast == NULL);
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, input));
+
+ ASSERT_TRUE(uriA.scheme.first == input);
+ ASSERT_TRUE(uriA.scheme.afterLast == input + 4);
+ ASSERT_TRUE(uriA.userInfo.first == NULL);
+ ASSERT_TRUE(uriA.userInfo.afterLast == NULL);
+ ASSERT_TRUE(uriA.hostText.first == input + 4 + 3);
+ ASSERT_TRUE(uriA.hostText.afterLast == input + 4 + 3 + 15);
+ ASSERT_TRUE(uriA.hostData.ipFuture.first == NULL);
+ ASSERT_TRUE(uriA.hostData.ipFuture.afterLast == NULL);
+ ASSERT_TRUE(uriA.portText.first == NULL);
+ ASSERT_TRUE(uriA.portText.afterLast == NULL);
+
+ ASSERT_TRUE(uriA.pathHead->text.first == input + 4 + 3 + 15 + 1);
+ ASSERT_TRUE(uriA.pathHead->text.afterLast == input + 4 + 3 + 15 + 1 + 7);
+ ASSERT_TRUE(uriA.pathHead->next->text.first == input + 4 + 3 + 15 + 1 + 7 + 1);
+ ASSERT_TRUE(uriA.pathHead->next->text.afterLast == input + 4 + 3 + 15 + 1 + 7 + 1 + 20);
+ ASSERT_TRUE(uriA.pathHead->next->next == NULL);
+ ASSERT_TRUE(uriA.pathTail == uriA.pathHead->next);
+
+ ASSERT_TRUE(uriA.query.first == input + 4 + 3 + 15 + 1 + 7 + 1 + 20 + 1);
+ ASSERT_TRUE(uriA.query.afterLast == input + 4 + 3 + 15 + 1 + 7 + 1 + 20 + 1 + 15);
+ ASSERT_TRUE(uriA.fragment.first == NULL);
+ ASSERT_TRUE(uriA.fragment.afterLast == NULL);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriComponents_Bug20070701() {
+TEST(UriSuite, TestUriComponentsBug20070701) {
UriParserStateA stateA;
UriUriA uriA;
stateA.uri = &uriA;
// 01 01 01
const char * const input = "a" ":" "b";
- TEST_ASSERT(0 == uriParseUriA(&stateA, input));
-
- TEST_ASSERT(uriA.scheme.first == input);
- TEST_ASSERT(uriA.scheme.afterLast == input + 1);
- TEST_ASSERT(uriA.userInfo.first == NULL);
- TEST_ASSERT(uriA.userInfo.afterLast == NULL);
- TEST_ASSERT(uriA.hostText.first == NULL);
- TEST_ASSERT(uriA.hostText.afterLast == NULL);
- TEST_ASSERT(uriA.hostData.ipFuture.first == NULL);
- TEST_ASSERT(uriA.hostData.ipFuture.afterLast == NULL);
- TEST_ASSERT(uriA.portText.first == NULL);
- TEST_ASSERT(uriA.portText.afterLast == NULL);
-
- TEST_ASSERT(uriA.pathHead->text.first == input + 1 + 1);
- TEST_ASSERT(uriA.pathHead->text.afterLast == input + 1 + 1 + 1);
- TEST_ASSERT(uriA.pathHead->next == NULL);
- TEST_ASSERT(uriA.pathTail == uriA.pathHead);
-
- TEST_ASSERT(uriA.query.first == NULL);
- TEST_ASSERT(uriA.query.afterLast == NULL);
- TEST_ASSERT(uriA.fragment.first == NULL);
- TEST_ASSERT(uriA.fragment.afterLast == NULL);
-
- TEST_ASSERT(!uriA.absolutePath);
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, input));
+
+ ASSERT_TRUE(uriA.scheme.first == input);
+ ASSERT_TRUE(uriA.scheme.afterLast == input + 1);
+ ASSERT_TRUE(uriA.userInfo.first == NULL);
+ ASSERT_TRUE(uriA.userInfo.afterLast == NULL);
+ ASSERT_TRUE(uriA.hostText.first == NULL);
+ ASSERT_TRUE(uriA.hostText.afterLast == NULL);
+ ASSERT_TRUE(uriA.hostData.ipFuture.first == NULL);
+ ASSERT_TRUE(uriA.hostData.ipFuture.afterLast == NULL);
+ ASSERT_TRUE(uriA.portText.first == NULL);
+ ASSERT_TRUE(uriA.portText.afterLast == NULL);
+
+ ASSERT_TRUE(uriA.pathHead->text.first == input + 1 + 1);
+ ASSERT_TRUE(uriA.pathHead->text.afterLast == input + 1 + 1 + 1);
+ ASSERT_TRUE(uriA.pathHead->next == NULL);
+ ASSERT_TRUE(uriA.pathTail == uriA.pathHead);
+
+ ASSERT_TRUE(uriA.query.first == NULL);
+ ASSERT_TRUE(uriA.query.afterLast == NULL);
+ ASSERT_TRUE(uriA.fragment.first == NULL);
+ ASSERT_TRUE(uriA.fragment.afterLast == NULL);
+
+ ASSERT_TRUE(!uriA.absolutePath);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriUserInfoHostPort1() {
+TEST(UriSuite, TestUriUserInfoHostPort1) {
// User info with ":", no port
UriParserStateA stateA;
UriUriA uriA;
stateA.uri = &uriA;
// 0 4 0 3 0 7 01 0 9
const char * const input = "http" "://" "abc:def" "@" "localhost";
- TEST_ASSERT(0 == uriParseUriA(&stateA, input));
-
- TEST_ASSERT(uriA.userInfo.first == input + 4 + 3);
- TEST_ASSERT(uriA.userInfo.afterLast == input + 4 + 3 + 7);
- TEST_ASSERT(uriA.hostText.first == input + 4 + 3 + 7 + 1);
- TEST_ASSERT(uriA.hostText.afterLast == input + 4 + 3 + 7 + 1 + 9);
- TEST_ASSERT(uriA.portText.first == NULL);
- TEST_ASSERT(uriA.portText.afterLast == NULL);
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, input));
+
+ ASSERT_TRUE(uriA.userInfo.first == input + 4 + 3);
+ ASSERT_TRUE(uriA.userInfo.afterLast == input + 4 + 3 + 7);
+ ASSERT_TRUE(uriA.hostText.first == input + 4 + 3 + 7 + 1);
+ ASSERT_TRUE(uriA.hostText.afterLast == input + 4 + 3 + 7 + 1 + 9);
+ ASSERT_TRUE(uriA.portText.first == NULL);
+ ASSERT_TRUE(uriA.portText.afterLast == NULL);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriUserInfoHostPort2() {
+TEST(UriSuite, TestUriUserInfoHostPort2) {
// User info with ":", with port
UriParserStateA stateA;
UriUriA uriA;
@@ -469,18 +405,18 @@ Rule | Example | hostSet | absPath | emptySeg
const char * const input = "http" "://" "abc:def" "@" "localhost"
// 01 0 3
":" "123";
- TEST_ASSERT(0 == uriParseUriA(&stateA, input));
-
- TEST_ASSERT(uriA.userInfo.first == input + 4 + 3);
- TEST_ASSERT(uriA.userInfo.afterLast == input + 4 + 3 + 7);
- TEST_ASSERT(uriA.hostText.first == input + 4 + 3 + 7 + 1);
- TEST_ASSERT(uriA.hostText.afterLast == input + 4 + 3 + 7 + 1 + 9);
- TEST_ASSERT(uriA.portText.first == input + 4 + 3 + 7 + 1 + 9 + 1);
- TEST_ASSERT(uriA.portText.afterLast == input + 4 + 3 + 7 + 1 + 9 + 1 + 3);
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, input));
+
+ ASSERT_TRUE(uriA.userInfo.first == input + 4 + 3);
+ ASSERT_TRUE(uriA.userInfo.afterLast == input + 4 + 3 + 7);
+ ASSERT_TRUE(uriA.hostText.first == input + 4 + 3 + 7 + 1);
+ ASSERT_TRUE(uriA.hostText.afterLast == input + 4 + 3 + 7 + 1 + 9);
+ ASSERT_TRUE(uriA.portText.first == input + 4 + 3 + 7 + 1 + 9 + 1);
+ ASSERT_TRUE(uriA.portText.afterLast == input + 4 + 3 + 7 + 1 + 9 + 1 + 3);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriUserInfoHostPort22_Bug1948038() {
+TEST(UriSuite, TestUriUserInfoHostPort22Bug1948038) {
UriParserStateA stateA;
UriUriA uriA;
stateA.uri = &uriA;
@@ -488,29 +424,29 @@ Rule | Example | hostSet | absPath | emptySeg
int res;
res = uriParseUriA(&stateA, "http://user:21@host/");
- TEST_ASSERT(URI_SUCCESS == res);
- TEST_ASSERT(!memcmp(uriA.userInfo.first, "user:21", 7 * sizeof(char)));
- TEST_ASSERT(uriA.userInfo.afterLast - uriA.userInfo.first == 7);
- TEST_ASSERT(!memcmp(uriA.hostText.first, "host", 4 * sizeof(char)));
- TEST_ASSERT(uriA.hostText.afterLast - uriA.hostText.first == 4);
- TEST_ASSERT(uriA.portText.first == NULL);
- TEST_ASSERT(uriA.portText.afterLast == NULL);
+ ASSERT_TRUE(URI_SUCCESS == res);
+ ASSERT_TRUE(!memcmp(uriA.userInfo.first, "user:21", 7 * sizeof(char)));
+ ASSERT_TRUE(uriA.userInfo.afterLast - uriA.userInfo.first == 7);
+ ASSERT_TRUE(!memcmp(uriA.hostText.first, "host", 4 * sizeof(char)));
+ ASSERT_TRUE(uriA.hostText.afterLast - uriA.hostText.first == 4);
+ ASSERT_TRUE(uriA.portText.first == NULL);
+ ASSERT_TRUE(uriA.portText.afterLast == NULL);
uriFreeUriMembersA(&uriA);
res = uriParseUriA(&stateA, "http://user:1234@192.168.0.1:1234/foo.com");
- TEST_ASSERT(URI_SUCCESS == res);
+ ASSERT_TRUE(URI_SUCCESS == res);
uriFreeUriMembersA(&uriA);
res = uriParseUriA(&stateA, "http://moo:21@moo:21@moo/");
- TEST_ASSERT(URI_ERROR_SYNTAX == res);
+ ASSERT_TRUE(URI_ERROR_SYNTAX == res);
uriFreeUriMembersA(&uriA);
res = uriParseUriA(&stateA, "http://moo:21@moo:21@moo:21/");
- TEST_ASSERT(URI_ERROR_SYNTAX == res);
+ ASSERT_TRUE(URI_ERROR_SYNTAX == res);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriUserInfoHostPort23_Bug3510198_1() {
+TEST(UriSuite, TestUriUserInfoHostPort23Bug3510198One) {
// User info with ":", with port, with escaped chars in password
UriParserStateA stateA;
UriUriA uriA;
@@ -519,18 +455,17 @@ Rule | Example | hostSet | absPath | emptySeg
int res;
// 0 4 0 3 0 10 01 0 4 01
res = uriParseUriA(&stateA, "http" "://" "user:%2F21" "@" "host" "/");
- TEST_ASSERT(URI_SUCCESS == res);
- TEST_ASSERT(!memcmp(uriA.userInfo.first, "user:%2F21", 10 * sizeof(char)));
- TEST_ASSERT(uriA.userInfo.afterLast - uriA.userInfo.first == 10);
- TEST_ASSERT(!memcmp(uriA.hostText.first, "host", 4 * sizeof(char)));
- TEST_ASSERT(uriA.hostText.afterLast - uriA.hostText.first == 4);
- TEST_ASSERT(uriA.portText.first == NULL);
- TEST_ASSERT(uriA.portText.afterLast == NULL);
+ ASSERT_TRUE(URI_SUCCESS == res);
+ ASSERT_TRUE(!memcmp(uriA.userInfo.first, "user:%2F21", 10 * sizeof(char)));
+ ASSERT_TRUE(uriA.userInfo.afterLast - uriA.userInfo.first == 10);
+ ASSERT_TRUE(!memcmp(uriA.hostText.first, "host", 4 * sizeof(char)));
+ ASSERT_TRUE(uriA.hostText.afterLast - uriA.hostText.first == 4);
+ ASSERT_TRUE(uriA.portText.first == NULL);
+ ASSERT_TRUE(uriA.portText.afterLast == NULL);
uriFreeUriMembersA(&uriA);
+}
- }
-
- void testUriUserInfoHostPort23_Bug3510198_2() {
+TEST(UriSuite, TestUriUserInfoHostPort23Bug3510198Two) {
// User info with ":", with port, with escaped chars in user name and password
UriParserStateA stateA;
UriUriA uriA;
@@ -539,17 +474,17 @@ Rule | Example | hostSet | absPath | emptySeg
int res;
// 0 4 0 3 0 13 01 0 4 01
res = uriParseUriA(&stateA, "http" "://" "%2Fuser:%2F21" "@" "host" "/");
- TEST_ASSERT(URI_SUCCESS == res);
- TEST_ASSERT(!memcmp(uriA.userInfo.first, "%2Fuser:%2F21", 13 * sizeof(char)));
- TEST_ASSERT(uriA.userInfo.afterLast - uriA.userInfo.first == 13);
- TEST_ASSERT(!memcmp(uriA.hostText.first, "host", 4 * sizeof(char)));
- TEST_ASSERT(uriA.hostText.afterLast - uriA.hostText.first == 4);
- TEST_ASSERT(uriA.portText.first == NULL);
- TEST_ASSERT(uriA.portText.afterLast == NULL);
+ ASSERT_TRUE(URI_SUCCESS == res);
+ ASSERT_TRUE(!memcmp(uriA.userInfo.first, "%2Fuser:%2F21", 13 * sizeof(char)));
+ ASSERT_TRUE(uriA.userInfo.afterLast - uriA.userInfo.first == 13);
+ ASSERT_TRUE(!memcmp(uriA.hostText.first, "host", 4 * sizeof(char)));
+ ASSERT_TRUE(uriA.hostText.afterLast - uriA.hostText.first == 4);
+ ASSERT_TRUE(uriA.portText.first == NULL);
+ ASSERT_TRUE(uriA.portText.afterLast == NULL);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriUserInfoHostPort23_Bug3510198_3() {
+TEST(UriSuite, TestUriUserInfoHostPort23Bug3510198Three) {
// User info with ":", with port, with escaped chars in password
UriParserStateA stateA;
UriUriA uriA;
@@ -558,18 +493,17 @@ Rule | Example | hostSet | absPath | emptySeg
int res;
// 0 4 0 3 0 16 01 0 4 01
res = uriParseUriA(&stateA, "http" "://" "user:!$&'()*+,;=" "@" "host" "/");
- TEST_ASSERT(URI_SUCCESS == res);
- TEST_ASSERT(!memcmp(uriA.userInfo.first, "user:!$&'()*+,;=", 16 * sizeof(char)));
- TEST_ASSERT(uriA.userInfo.afterLast - uriA.userInfo.first == 16);
- TEST_ASSERT(!memcmp(uriA.hostText.first, "host", 4 * sizeof(char)));
- TEST_ASSERT(uriA.hostText.afterLast - uriA.hostText.first == 4);
- TEST_ASSERT(uriA.portText.first == NULL);
- TEST_ASSERT(uriA.portText.afterLast == NULL);
+ ASSERT_TRUE(URI_SUCCESS == res);
+ ASSERT_TRUE(!memcmp(uriA.userInfo.first, "user:!$&'()*+,;=", 16 * sizeof(char)));
+ ASSERT_TRUE(uriA.userInfo.afterLast - uriA.userInfo.first == 16);
+ ASSERT_TRUE(!memcmp(uriA.hostText.first, "host", 4 * sizeof(char)));
+ ASSERT_TRUE(uriA.hostText.afterLast - uriA.hostText.first == 4);
+ ASSERT_TRUE(uriA.portText.first == NULL);
+ ASSERT_TRUE(uriA.portText.afterLast == NULL);
uriFreeUriMembersA(&uriA);
+}
- }
-
- void testUriUserInfoHostPort23_Bug3510198_4() {
+TEST(UriSuite, TestUriUserInfoHostPort23Bug3510198Four) {
// User info with ":", with port, with escaped chars in user name and password
UriParserStateA stateA;
UriUriA uriA;
@@ -578,17 +512,17 @@ Rule | Example | hostSet | absPath | emptySeg
int res;
// 0 4 0 3 0 20 01 0 4 01
res = uriParseUriA(&stateA, "http" "://" "!$&'()*+,;=:password" "@" "host" "/");
- TEST_ASSERT(URI_SUCCESS == res);
- TEST_ASSERT(!memcmp(uriA.userInfo.first, "!$&'()*+,;=:password", 20 * sizeof(char)));
- TEST_ASSERT(uriA.userInfo.afterLast - uriA.userInfo.first == 20);
- TEST_ASSERT(!memcmp(uriA.hostText.first, "host", 4 * sizeof(char)));
- TEST_ASSERT(uriA.hostText.afterLast - uriA.hostText.first == 4);
- TEST_ASSERT(uriA.portText.first == NULL);
- TEST_ASSERT(uriA.portText.afterLast == NULL);
+ ASSERT_TRUE(URI_SUCCESS == res);
+ ASSERT_TRUE(!memcmp(uriA.userInfo.first, "!$&'()*+,;=:password", 20 * sizeof(char)));
+ ASSERT_TRUE(uriA.userInfo.afterLast - uriA.userInfo.first == 20);
+ ASSERT_TRUE(!memcmp(uriA.hostText.first, "host", 4 * sizeof(char)));
+ ASSERT_TRUE(uriA.hostText.afterLast - uriA.hostText.first == 4);
+ ASSERT_TRUE(uriA.portText.first == NULL);
+ ASSERT_TRUE(uriA.portText.afterLast == NULL);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriUserInfoHostPort23_Bug3510198_related_1() {
+TEST(UriSuite, TestUriUserInfoHostPort23Bug3510198RelatedOne) {
// Empty user info
UriParserStateA stateA;
UriUriA uriA;
@@ -597,18 +531,18 @@ Rule | Example | hostSet | absPath | emptySeg
int res;
// 0 4 0 3 01 0 4 01
res = uriParseUriA(&stateA, "http" "://" "@" "host" "/");
- TEST_ASSERT(URI_SUCCESS == res);
- TEST_ASSERT(uriA.userInfo.afterLast != NULL);
- TEST_ASSERT(uriA.userInfo.first != NULL);
- TEST_ASSERT(uriA.userInfo.afterLast - uriA.userInfo.first == 0);
- TEST_ASSERT(!memcmp(uriA.hostText.first, "host", 4 * sizeof(char)));
- TEST_ASSERT(uriA.hostText.afterLast - uriA.hostText.first == 4);
- TEST_ASSERT(uriA.portText.first == NULL);
- TEST_ASSERT(uriA.portText.afterLast == NULL);
+ ASSERT_TRUE(URI_SUCCESS == res);
+ ASSERT_TRUE(uriA.userInfo.afterLast != NULL);
+ ASSERT_TRUE(uriA.userInfo.first != NULL);
+ ASSERT_TRUE(uriA.userInfo.afterLast - uriA.userInfo.first == 0);
+ ASSERT_TRUE(!memcmp(uriA.hostText.first, "host", 4 * sizeof(char)));
+ ASSERT_TRUE(uriA.hostText.afterLast - uriA.hostText.first == 4);
+ ASSERT_TRUE(uriA.portText.first == NULL);
+ ASSERT_TRUE(uriA.portText.afterLast == NULL);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriUserInfoHostPort23_Bug3510198_related_12() {
+TEST(UriSuite, TestUriUserInfoHostPort23Bug3510198RelatedOneTwo) {
// Empty user info
UriParserStateA stateA;
UriUriA uriA;
@@ -617,17 +551,17 @@ Rule | Example | hostSet | absPath | emptySeg
int res;
// 0 4 0 3 0 7 01
res = uriParseUriA(&stateA, "http" "://" "%2Fhost" "/");
- TEST_ASSERT(URI_SUCCESS == res);
- TEST_ASSERT(uriA.userInfo.afterLast == NULL);
- TEST_ASSERT(uriA.userInfo.first == NULL);
- TEST_ASSERT(!memcmp(uriA.hostText.first, "%2Fhost", 7 * sizeof(char)));
- TEST_ASSERT(uriA.hostText.afterLast - uriA.hostText.first == 7);
- TEST_ASSERT(uriA.portText.first == NULL);
- TEST_ASSERT(uriA.portText.afterLast == NULL);
+ ASSERT_TRUE(URI_SUCCESS == res);
+ ASSERT_TRUE(uriA.userInfo.afterLast == NULL);
+ ASSERT_TRUE(uriA.userInfo.first == NULL);
+ ASSERT_TRUE(!memcmp(uriA.hostText.first, "%2Fhost", 7 * sizeof(char)));
+ ASSERT_TRUE(uriA.hostText.afterLast - uriA.hostText.first == 7);
+ ASSERT_TRUE(uriA.portText.first == NULL);
+ ASSERT_TRUE(uriA.portText.afterLast == NULL);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriUserInfoHostPort23_Bug3510198_related_2() {
+TEST(UriSuite, TestUriUserInfoHostPort23Bug3510198RelatedTwo) {
// Several colons in userinfo
UriParserStateA stateA;
UriUriA uriA;
@@ -636,35 +570,35 @@ Rule | Example | hostSet | absPath | emptySeg
int res;
// 0 4 0 3 0 2 01 0 4 01
res = uriParseUriA(&stateA, "http" "://" "::" "@" "host" "/");
- TEST_ASSERT(URI_SUCCESS == res);
- TEST_ASSERT(!memcmp(uriA.userInfo.first, "::", 2 * sizeof(char)));
- TEST_ASSERT(uriA.userInfo.afterLast - uriA.userInfo.first == 2);
- TEST_ASSERT(!memcmp(uriA.hostText.first, "host", 4 * sizeof(char)));
- TEST_ASSERT(uriA.hostText.afterLast - uriA.hostText.first == 4);
- TEST_ASSERT(uriA.portText.first == NULL);
- TEST_ASSERT(uriA.portText.afterLast == NULL);
+ ASSERT_TRUE(URI_SUCCESS == res);
+ ASSERT_TRUE(!memcmp(uriA.userInfo.first, "::", 2 * sizeof(char)));
+ ASSERT_TRUE(uriA.userInfo.afterLast - uriA.userInfo.first == 2);
+ ASSERT_TRUE(!memcmp(uriA.hostText.first, "host", 4 * sizeof(char)));
+ ASSERT_TRUE(uriA.hostText.afterLast - uriA.hostText.first == 4);
+ ASSERT_TRUE(uriA.portText.first == NULL);
+ ASSERT_TRUE(uriA.portText.afterLast == NULL);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriUserInfoHostPort3() {
+TEST(UriSuite, TestUriUserInfoHostPort3) {
// User info without ":", no port
UriParserStateA stateA;
UriUriA uriA;
stateA.uri = &uriA;
// 0 4 0 3 0 7 01 0 9
const char * const input = "http" "://" "abcdefg" "@" "localhost";
- TEST_ASSERT(0 == uriParseUriA(&stateA, input));
-
- TEST_ASSERT(uriA.userInfo.first == input + 4 + 3);
- TEST_ASSERT(uriA.userInfo.afterLast == input + 4 + 3 + 7);
- TEST_ASSERT(uriA.hostText.first == input + 4 + 3 + 7 + 1);
- TEST_ASSERT(uriA.hostText.afterLast == input + 4 + 3 + 7 + 1 + 9);
- TEST_ASSERT(uriA.portText.first == NULL);
- TEST_ASSERT(uriA.portText.afterLast == NULL);
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, input));
+
+ ASSERT_TRUE(uriA.userInfo.first == input + 4 + 3);
+ ASSERT_TRUE(uriA.userInfo.afterLast == input + 4 + 3 + 7);
+ ASSERT_TRUE(uriA.hostText.first == input + 4 + 3 + 7 + 1);
+ ASSERT_TRUE(uriA.hostText.afterLast == input + 4 + 3 + 7 + 1 + 9);
+ ASSERT_TRUE(uriA.portText.first == NULL);
+ ASSERT_TRUE(uriA.portText.afterLast == NULL);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriUserInfoHostPort4() {
+TEST(UriSuite, TestUriUserInfoHostPort4) {
// User info without ":", with port
UriParserStateA stateA;
UriUriA uriA;
@@ -673,160 +607,161 @@ Rule | Example | hostSet | absPath | emptySeg
const char * const input = "http" "://" "abcdefg" "@" "localhost"
// 01 0 3
":" "123";
- TEST_ASSERT(0 == uriParseUriA(&stateA, input));
-
- TEST_ASSERT(uriA.userInfo.first == input + 4 + 3);
- TEST_ASSERT(uriA.userInfo.afterLast == input + 4 + 3 + 7);
- TEST_ASSERT(uriA.hostText.first == input + 4 + 3 + 7 + 1);
- TEST_ASSERT(uriA.hostText.afterLast == input + 4 + 3 + 7 + 1 + 9);
- TEST_ASSERT(uriA.portText.first == input + 4 + 3 + 7 + 1 + 9 + 1);
- TEST_ASSERT(uriA.portText.afterLast == input + 4 + 3 + 7 + 1 + 9 + 1 + 3);
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, input));
+
+ ASSERT_TRUE(uriA.userInfo.first == input + 4 + 3);
+ ASSERT_TRUE(uriA.userInfo.afterLast == input + 4 + 3 + 7);
+ ASSERT_TRUE(uriA.hostText.first == input + 4 + 3 + 7 + 1);
+ ASSERT_TRUE(uriA.hostText.afterLast == input + 4 + 3 + 7 + 1 + 9);
+ ASSERT_TRUE(uriA.portText.first == input + 4 + 3 + 7 + 1 + 9 + 1);
+ ASSERT_TRUE(uriA.portText.afterLast == input + 4 + 3 + 7 + 1 + 9 + 1 + 3);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriUserInfoHostPort5() {
+TEST(UriSuite, TestUriUserInfoHostPort5) {
// No user info, no port
UriParserStateA stateA;
UriUriA uriA;
stateA.uri = &uriA;
// 0 4 0 3 0 9
const char * const input = "http" "://" "localhost";
- TEST_ASSERT(0 == uriParseUriA(&stateA, input));
-
- TEST_ASSERT(uriA.userInfo.first == NULL);
- TEST_ASSERT(uriA.userInfo.afterLast == NULL);
- TEST_ASSERT(uriA.hostText.first == input + 4 + 3);
- TEST_ASSERT(uriA.hostText.afterLast == input + 4 + 3 + 9);
- TEST_ASSERT(uriA.portText.first == NULL);
- TEST_ASSERT(uriA.portText.afterLast == NULL);
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, input));
+
+ ASSERT_TRUE(uriA.userInfo.first == NULL);
+ ASSERT_TRUE(uriA.userInfo.afterLast == NULL);
+ ASSERT_TRUE(uriA.hostText.first == input + 4 + 3);
+ ASSERT_TRUE(uriA.hostText.afterLast == input + 4 + 3 + 9);
+ ASSERT_TRUE(uriA.portText.first == NULL);
+ ASSERT_TRUE(uriA.portText.afterLast == NULL);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriUserInfoHostPort6() {
+TEST(UriSuite, TestUriUserInfoHostPort6) {
// No user info, with port
UriParserStateA stateA;
UriUriA uriA;
stateA.uri = &uriA;
// 0 4 0 3 0 9 01 0 3
const char * const input = "http" "://" "localhost" ":" "123";
- TEST_ASSERT(0 == uriParseUriA(&stateA, input));
-
- TEST_ASSERT(uriA.userInfo.first == NULL);
- TEST_ASSERT(uriA.userInfo.afterLast == NULL);
- TEST_ASSERT(uriA.hostText.first == input + 4 + 3);
- TEST_ASSERT(uriA.hostText.afterLast == input + 4 + 3 + 9);
- TEST_ASSERT(uriA.portText.first == input + 4 + 3 + 9 + 1);
- TEST_ASSERT(uriA.portText.afterLast == input + 4 + 3 + 9 + 1 + 3);
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, input));
+
+ ASSERT_TRUE(uriA.userInfo.first == NULL);
+ ASSERT_TRUE(uriA.userInfo.afterLast == NULL);
+ ASSERT_TRUE(uriA.hostText.first == input + 4 + 3);
+ ASSERT_TRUE(uriA.hostText.afterLast == input + 4 + 3 + 9);
+ ASSERT_TRUE(uriA.portText.first == input + 4 + 3 + 9 + 1);
+ ASSERT_TRUE(uriA.portText.afterLast == input + 4 + 3 + 9 + 1 + 3);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriHostRegname() {
+TEST(UriSuite, TestUriHostRegname) {
UriParserStateA stateA;
UriUriA uriA;
stateA.uri = &uriA;
// 0 4 0 3 0 11
const char * const input = "http" "://" "example.com";
- TEST_ASSERT(0 == uriParseUriA(&stateA, input));
-
- TEST_ASSERT(uriA.hostText.first == input + 4 + 3);
- TEST_ASSERT(uriA.hostText.afterLast == input + 4 + 3 + 11);
- TEST_ASSERT(uriA.hostData.ip4 == NULL);
- TEST_ASSERT(uriA.hostData.ip6 == NULL);
- TEST_ASSERT(uriA.hostData.ipFuture.first == NULL);
- TEST_ASSERT(uriA.hostData.ipFuture.afterLast == NULL);
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, input));
+
+ ASSERT_TRUE(uriA.hostText.first == input + 4 + 3);
+ ASSERT_TRUE(uriA.hostText.afterLast == input + 4 + 3 + 11);
+ ASSERT_TRUE(uriA.hostData.ip4 == NULL);
+ ASSERT_TRUE(uriA.hostData.ip6 == NULL);
+ ASSERT_TRUE(uriA.hostData.ipFuture.first == NULL);
+ ASSERT_TRUE(uriA.hostData.ipFuture.afterLast == NULL);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriHostIpFour1() {
+TEST(UriSuite, TestUriHostIpFour1) {
UriParserStateA stateA;
UriUriA uriA;
stateA.uri = &uriA;
// 0 4 0 3 0 7 01 0 2
const char * const input = "http" "://" "1.2.3.4" ":" "80";
- TEST_ASSERT(0 == uriParseUriA(&stateA, input));
-
- TEST_ASSERT(uriA.hostText.first == input + 4 + 3);
- TEST_ASSERT(uriA.hostText.afterLast == input + 4 + 3 + 7);
- TEST_ASSERT(uriA.hostData.ip4 != NULL);
- TEST_ASSERT(uriA.hostData.ip6 == NULL);
- TEST_ASSERT(uriA.hostData.ipFuture.first == NULL);
- TEST_ASSERT(uriA.hostData.ipFuture.afterLast == NULL);
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, input));
+
+ ASSERT_TRUE(uriA.hostText.first == input + 4 + 3);
+ ASSERT_TRUE(uriA.hostText.afterLast == input + 4 + 3 + 7);
+ ASSERT_TRUE(uriA.hostData.ip4 != NULL);
+ ASSERT_TRUE(uriA.hostData.ip6 == NULL);
+ ASSERT_TRUE(uriA.hostData.ipFuture.first == NULL);
+ ASSERT_TRUE(uriA.hostData.ipFuture.afterLast == NULL);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriHostIpFour2() {
+TEST(UriSuite, TestUriHostIpFour2) {
UriParserStateA stateA;
UriUriA uriA;
stateA.uri = &uriA;
// 0 4 0 3 0 7
const char * const input = "http" "://" "1.2.3.4";
- TEST_ASSERT(0 == uriParseUriA(&stateA, input));
-
- TEST_ASSERT(uriA.hostText.first == input + 4 + 3);
- TEST_ASSERT(uriA.hostText.afterLast == input + 4 + 3 + 7);
- TEST_ASSERT(uriA.hostData.ip4 != NULL);
- TEST_ASSERT(uriA.hostData.ip6 == NULL);
- TEST_ASSERT(uriA.hostData.ipFuture.first == NULL);
- TEST_ASSERT(uriA.hostData.ipFuture.afterLast == NULL);
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, input));
+
+ ASSERT_TRUE(uriA.hostText.first == input + 4 + 3);
+ ASSERT_TRUE(uriA.hostText.afterLast == input + 4 + 3 + 7);
+ ASSERT_TRUE(uriA.hostData.ip4 != NULL);
+ ASSERT_TRUE(uriA.hostData.ip6 == NULL);
+ ASSERT_TRUE(uriA.hostData.ipFuture.first == NULL);
+ ASSERT_TRUE(uriA.hostData.ipFuture.afterLast == NULL);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriHostIpSix1() {
+TEST(UriSuite, TestUriHostIpSix1) {
UriParserStateA stateA;
UriUriA uriA;
stateA.uri = &uriA;
// 0 4 0 3 01 45 01 0 2
const char * const input = "http" "://" "[::1]" ":" "80";
- TEST_ASSERT(0 == uriParseUriA(&stateA, input));
-
- TEST_ASSERT(uriA.hostText.first == input + 4 + 3 + 1);
- TEST_ASSERT(uriA.hostText.afterLast == input + 4 + 3 + 4);
- TEST_ASSERT(uriA.hostData.ip4 == NULL);
- TEST_ASSERT(uriA.hostData.ip6 != NULL);
- TEST_ASSERT(uriA.hostData.ipFuture.first == NULL);
- TEST_ASSERT(uriA.hostData.ipFuture.afterLast == NULL);
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, input));
+
+ ASSERT_TRUE(uriA.hostText.first == input + 4 + 3 + 1);
+ ASSERT_TRUE(uriA.hostText.afterLast == input + 4 + 3 + 4);
+ ASSERT_TRUE(uriA.hostData.ip4 == NULL);
+ ASSERT_TRUE(uriA.hostData.ip6 != NULL);
+ ASSERT_TRUE(uriA.hostData.ipFuture.first == NULL);
+ ASSERT_TRUE(uriA.hostData.ipFuture.afterLast == NULL);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriHostIpSix2() {
+TEST(UriSuite, TestUriHostIpSix2) {
UriParserStateA stateA;
UriUriA uriA;
stateA.uri = &uriA;
// 0 4 0 3 01 45
const char * const input = "http" "://" "[::1]";
- TEST_ASSERT(0 == uriParseUriA(&stateA, input));
-
- TEST_ASSERT(uriA.hostText.first == input + 4 + 3 + 1);
- TEST_ASSERT(uriA.hostText.afterLast == input + 4 + 3 + 4);
- TEST_ASSERT(uriA.hostData.ip4 == NULL);
- TEST_ASSERT(uriA.hostData.ip6 != NULL);
- TEST_ASSERT(uriA.hostData.ipFuture.first == NULL);
- TEST_ASSERT(uriA.hostData.ipFuture.afterLast == NULL);
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, input));
+
+ ASSERT_TRUE(uriA.hostText.first == input + 4 + 3 + 1);
+ ASSERT_TRUE(uriA.hostText.afterLast == input + 4 + 3 + 4);
+ ASSERT_TRUE(uriA.hostData.ip4 == NULL);
+ ASSERT_TRUE(uriA.hostData.ip6 != NULL);
+ ASSERT_TRUE(uriA.hostData.ipFuture.first == NULL);
+ ASSERT_TRUE(uriA.hostData.ipFuture.afterLast == NULL);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriHostEmpty() {
+TEST(UriSuite, TestUriHostEmpty) {
UriParserStateA stateA;
UriUriA uriA;
stateA.uri = &uriA;
// 0 4 0 3 01 0 3
const char * const input = "http" "://" ":" "123";
const int res = uriParseUriA(&stateA, input);
- TEST_ASSERT(URI_SUCCESS == res);
- TEST_ASSERT(uriA.userInfo.first == NULL);
- TEST_ASSERT(uriA.userInfo.afterLast == NULL);
- TEST_ASSERT(uriA.hostText.first != NULL);
- TEST_ASSERT(uriA.hostText.afterLast != NULL);
- TEST_ASSERT(uriA.hostText.afterLast - uriA.hostText.first == 0);
- TEST_ASSERT(uriA.portText.first == input + 4 + 3 + 1);
- TEST_ASSERT(uriA.portText.afterLast == input + 4 + 3 + 1 + 3);
+ ASSERT_TRUE(URI_SUCCESS == res);
+ ASSERT_TRUE(uriA.userInfo.first == NULL);
+ ASSERT_TRUE(uriA.userInfo.afterLast == NULL);
+ ASSERT_TRUE(uriA.hostText.first != NULL);
+ ASSERT_TRUE(uriA.hostText.afterLast != NULL);
+ ASSERT_TRUE(uriA.hostText.afterLast - uriA.hostText.first == 0);
+ ASSERT_TRUE(uriA.portText.first == input + 4 + 3 + 1);
+ ASSERT_TRUE(uriA.portText.afterLast == input + 4 + 3 + 1 + 3);
uriFreeUriMembersA(&uriA);
- }
+}
- void testUriHostIpFuture() {
+TEST(UriSuite, TestUriHostIpFuture) {
// TODO
- }
+}
+namespace {
bool testEscapingHelper(const wchar_t * in, const wchar_t * expectedOut,
bool spaceToPlus = false, bool normalizeBreaks = false) {
wchar_t * const buffer = new wchar_t[(normalizeBreaks ? 6 : 3)
@@ -841,52 +776,54 @@ Rule | Example | hostSet | absPath | emptySeg
delete [] buffer;
return equal;
}
+} // namespace
- void testEscaping() {
+TEST(UriSuite, TestEscaping) {
const bool SPACE_TO_PLUS = true;
const bool SPACE_TO_PERCENT = false;
const bool KEEP_UNMODIFIED = false;
const bool NORMALIZE = true;
// '+' to ' '
- TEST_ASSERT(testEscapingHelper(L"abc def", L"abc+def", SPACE_TO_PLUS));
- TEST_ASSERT(testEscapingHelper(L"abc def", L"abc%20def", SPACE_TO_PERCENT));
+ ASSERT_TRUE(testEscapingHelper(L"abc def", L"abc+def", SPACE_TO_PLUS));
+ ASSERT_TRUE(testEscapingHelper(L"abc def", L"abc%20def", SPACE_TO_PERCENT));
// Percent encoding
- TEST_ASSERT(testEscapingHelper(L"\x00", L"\0"));
- TEST_ASSERT(testEscapingHelper(L"\x01", L"%01"));
- TEST_ASSERT(testEscapingHelper(L"\xff", L"%FF"));
+ ASSERT_TRUE(testEscapingHelper(L"\x00", L"\0"));
+ ASSERT_TRUE(testEscapingHelper(L"\x01", L"%01"));
+ ASSERT_TRUE(testEscapingHelper(L"\xff", L"%FF"));
// Linebreak normalization
- TEST_ASSERT(testEscapingHelper(L"\x0d", L"%0D%0A", SPACE_TO_PLUS, NORMALIZE));
- TEST_ASSERT(testEscapingHelper(L"g\x0d", L"g%0D%0A", SPACE_TO_PLUS, NORMALIZE));
- TEST_ASSERT(testEscapingHelper(L"\x0dg", L"%0D%0Ag", SPACE_TO_PLUS, NORMALIZE));
- TEST_ASSERT(testEscapingHelper(L"\x0d", L"%0D", SPACE_TO_PLUS, KEEP_UNMODIFIED));
- TEST_ASSERT(testEscapingHelper(L"g\x0d", L"g%0D", SPACE_TO_PLUS, KEEP_UNMODIFIED));
- TEST_ASSERT(testEscapingHelper(L"\x0dg", L"%0Dg", SPACE_TO_PLUS, KEEP_UNMODIFIED));
-
- TEST_ASSERT(testEscapingHelper(L"\x0a", L"%0D%0A", SPACE_TO_PLUS, NORMALIZE));
- TEST_ASSERT(testEscapingHelper(L"g\x0a", L"g%0D%0A", SPACE_TO_PLUS, NORMALIZE));
- TEST_ASSERT(testEscapingHelper(L"\x0ag", L"%0D%0Ag", SPACE_TO_PLUS, NORMALIZE));
- TEST_ASSERT(testEscapingHelper(L"\x0a", L"%0A", SPACE_TO_PLUS, KEEP_UNMODIFIED));
- TEST_ASSERT(testEscapingHelper(L"g\x0a", L"g%0A", SPACE_TO_PLUS, KEEP_UNMODIFIED));
- TEST_ASSERT(testEscapingHelper(L"\x0ag", L"%0Ag", SPACE_TO_PLUS, KEEP_UNMODIFIED));
-
- TEST_ASSERT(testEscapingHelper(L"\x0d\x0a", L"%0D%0A", SPACE_TO_PLUS, NORMALIZE));
- TEST_ASSERT(testEscapingHelper(L"g\x0d\x0a", L"g%0D%0A", SPACE_TO_PLUS, NORMALIZE));
- TEST_ASSERT(testEscapingHelper(L"\x0d\x0ag", L"%0D%0Ag", SPACE_TO_PLUS, NORMALIZE));
- TEST_ASSERT(testEscapingHelper(L"\x0d\x0a", L"%0D%0A", SPACE_TO_PLUS, KEEP_UNMODIFIED));
- TEST_ASSERT(testEscapingHelper(L"g\x0d\x0a", L"g%0D%0A", SPACE_TO_PLUS, KEEP_UNMODIFIED));
- TEST_ASSERT(testEscapingHelper(L"\x0d\x0ag", L"%0D%0Ag", SPACE_TO_PLUS, KEEP_UNMODIFIED));
-
- TEST_ASSERT(testEscapingHelper(L"\x0a\x0d", L"%0D%0A%0D%0A", SPACE_TO_PLUS, NORMALIZE));
- TEST_ASSERT(testEscapingHelper(L"g\x0a\x0d", L"g%0D%0A%0D%0A", SPACE_TO_PLUS, NORMALIZE));
- TEST_ASSERT(testEscapingHelper(L"\x0a\x0dg", L"%0D%0A%0D%0Ag", SPACE_TO_PLUS, NORMALIZE));
- TEST_ASSERT(testEscapingHelper(L"\x0a\x0d", L"%0A%0D", SPACE_TO_PLUS, KEEP_UNMODIFIED));
- TEST_ASSERT(testEscapingHelper(L"g\x0a\x0d", L"g%0A%0D", SPACE_TO_PLUS, KEEP_UNMODIFIED));
- TEST_ASSERT(testEscapingHelper(L"\x0a\x0dg", L"%0A%0Dg", SPACE_TO_PLUS, KEEP_UNMODIFIED));
- }
+ ASSERT_TRUE(testEscapingHelper(L"\x0d", L"%0D%0A", SPACE_TO_PLUS, NORMALIZE));
+ ASSERT_TRUE(testEscapingHelper(L"g\x0d", L"g%0D%0A", SPACE_TO_PLUS, NORMALIZE));
+ ASSERT_TRUE(testEscapingHelper(L"\x0dg", L"%0D%0Ag", SPACE_TO_PLUS, NORMALIZE));
+ ASSERT_TRUE(testEscapingHelper(L"\x0d", L"%0D", SPACE_TO_PLUS, KEEP_UNMODIFIED));
+ ASSERT_TRUE(testEscapingHelper(L"g\x0d", L"g%0D", SPACE_TO_PLUS, KEEP_UNMODIFIED));
+ ASSERT_TRUE(testEscapingHelper(L"\x0dg", L"%0Dg", SPACE_TO_PLUS, KEEP_UNMODIFIED));
+
+ ASSERT_TRUE(testEscapingHelper(L"\x0a", L"%0D%0A", SPACE_TO_PLUS, NORMALIZE));
+ ASSERT_TRUE(testEscapingHelper(L"g\x0a", L"g%0D%0A", SPACE_TO_PLUS, NORMALIZE));
+ ASSERT_TRUE(testEscapingHelper(L"\x0ag", L"%0D%0Ag", SPACE_TO_PLUS, NORMALIZE));
+ ASSERT_TRUE(testEscapingHelper(L"\x0a", L"%0A", SPACE_TO_PLUS, KEEP_UNMODIFIED));
+ ASSERT_TRUE(testEscapingHelper(L"g\x0a", L"g%0A", SPACE_TO_PLUS, KEEP_UNMODIFIED));
+ ASSERT_TRUE(testEscapingHelper(L"\x0ag", L"%0Ag", SPACE_TO_PLUS, KEEP_UNMODIFIED));
+
+ ASSERT_TRUE(testEscapingHelper(L"\x0d\x0a", L"%0D%0A", SPACE_TO_PLUS, NORMALIZE));
+ ASSERT_TRUE(testEscapingHelper(L"g\x0d\x0a", L"g%0D%0A", SPACE_TO_PLUS, NORMALIZE));
+ ASSERT_TRUE(testEscapingHelper(L"\x0d\x0ag", L"%0D%0Ag", SPACE_TO_PLUS, NORMALIZE));
+ ASSERT_TRUE(testEscapingHelper(L"\x0d\x0a", L"%0D%0A", SPACE_TO_PLUS, KEEP_UNMODIFIED));
+ ASSERT_TRUE(testEscapingHelper(L"g\x0d\x0a", L"g%0D%0A", SPACE_TO_PLUS, KEEP_UNMODIFIED));
+ ASSERT_TRUE(testEscapingHelper(L"\x0d\x0ag", L"%0D%0Ag", SPACE_TO_PLUS, KEEP_UNMODIFIED));
+
+ ASSERT_TRUE(testEscapingHelper(L"\x0a\x0d", L"%0D%0A%0D%0A", SPACE_TO_PLUS, NORMALIZE));
+ ASSERT_TRUE(testEscapingHelper(L"g\x0a\x0d", L"g%0D%0A%0D%0A", SPACE_TO_PLUS, NORMALIZE));
+ ASSERT_TRUE(testEscapingHelper(L"\x0a\x0dg", L"%0D%0A%0D%0Ag", SPACE_TO_PLUS, NORMALIZE));
+ ASSERT_TRUE(testEscapingHelper(L"\x0a\x0d", L"%0A%0D", SPACE_TO_PLUS, KEEP_UNMODIFIED));
+ ASSERT_TRUE(testEscapingHelper(L"g\x0a\x0d", L"g%0A%0D", SPACE_TO_PLUS, KEEP_UNMODIFIED));
+ ASSERT_TRUE(testEscapingHelper(L"\x0a\x0dg", L"%0A%0Dg", SPACE_TO_PLUS, KEEP_UNMODIFIED));
+}
+namespace {
bool testUnescapingHelper(const wchar_t * input, const wchar_t * output,
bool plusToSpace = false, UriBreakConversion breakConversion = URI_BR_DONT_TOUCH) {
wchar_t * working = new wchar_t[URI_STRLEN(input) + 1];
@@ -898,95 +835,97 @@ Rule | Example | hostSet | absPath | emptySeg
delete[] working;
return success;
}
+} // namespace
- void testUnescaping() {
+TEST(UriSuite, TestUnescaping) {
const bool PLUS_TO_SPACE = true;
const bool PLUS_DONT_TOUCH = false;
// Proper
- TEST_ASSERT(testUnescapingHelper(L"abc%20%41BC", L"abc ABC"));
- TEST_ASSERT(testUnescapingHelper(L"%20", L" "));
+ ASSERT_TRUE(testUnescapingHelper(L"abc%20%41BC", L"abc ABC"));
+ ASSERT_TRUE(testUnescapingHelper(L"%20", L" "));
// Incomplete
- TEST_ASSERT(testUnescapingHelper(L"%0", L"%0"));
+ ASSERT_TRUE(testUnescapingHelper(L"%0", L"%0"));
// Nonhex
- TEST_ASSERT(testUnescapingHelper(L"%0g", L"%0g"));
- TEST_ASSERT(testUnescapingHelper(L"%G0", L"%G0"));
+ ASSERT_TRUE(testUnescapingHelper(L"%0g", L"%0g"));
+ ASSERT_TRUE(testUnescapingHelper(L"%G0", L"%G0"));
// No double decoding
- TEST_ASSERT(testUnescapingHelper(L"%2520", L"%20"));
+ ASSERT_TRUE(testUnescapingHelper(L"%2520", L"%20"));
// Decoding of '+'
- TEST_ASSERT(testUnescapingHelper(L"abc+def", L"abc+def", PLUS_DONT_TOUCH));
- TEST_ASSERT(testUnescapingHelper(L"abc+def", L"abc def", PLUS_TO_SPACE));
+ ASSERT_TRUE(testUnescapingHelper(L"abc+def", L"abc+def", PLUS_DONT_TOUCH));
+ ASSERT_TRUE(testUnescapingHelper(L"abc+def", L"abc def", PLUS_TO_SPACE));
// Line break conversion
- TEST_ASSERT(testUnescapingHelper(L"%0d", L"\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
- TEST_ASSERT(testUnescapingHelper(L"%0d", L"\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
- TEST_ASSERT(testUnescapingHelper(L"%0d", L"\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
- TEST_ASSERT(testUnescapingHelper(L"%0d", L"\x0d", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
-
- TEST_ASSERT(testUnescapingHelper(L"%0d%0d", L"\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
- TEST_ASSERT(testUnescapingHelper(L"%0d%0d", L"\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
- TEST_ASSERT(testUnescapingHelper(L"%0d%0d", L"\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
- TEST_ASSERT(testUnescapingHelper(L"%0d%0d", L"\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
-
-
- TEST_ASSERT(testUnescapingHelper(L"%0a", L"\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
- TEST_ASSERT(testUnescapingHelper(L"%0a", L"\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
- TEST_ASSERT(testUnescapingHelper(L"%0a", L"\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
- TEST_ASSERT(testUnescapingHelper(L"%0a", L"\x0a", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
-
- TEST_ASSERT(testUnescapingHelper(L"%0a%0a", L"\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
- TEST_ASSERT(testUnescapingHelper(L"%0a%0a", L"\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
- TEST_ASSERT(testUnescapingHelper(L"%0a%0a", L"\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
- TEST_ASSERT(testUnescapingHelper(L"%0a%0a", L"\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
-
-
- TEST_ASSERT(testUnescapingHelper(L"%0d%0a", L"\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
- TEST_ASSERT(testUnescapingHelper(L"%0d%0a", L"\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
- TEST_ASSERT(testUnescapingHelper(L"%0d%0a", L"\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
- TEST_ASSERT(testUnescapingHelper(L"%0d%0a", L"\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
-
- TEST_ASSERT(testUnescapingHelper(L"%0d%0a%0a", L"\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
- TEST_ASSERT(testUnescapingHelper(L"%0d%0a%0a", L"\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
- TEST_ASSERT(testUnescapingHelper(L"%0d%0a%0a", L"\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
- TEST_ASSERT(testUnescapingHelper(L"%0d%0a%0a", L"\x0d\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
-
- TEST_ASSERT(testUnescapingHelper(L"%0d%0a%0d", L"\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
- TEST_ASSERT(testUnescapingHelper(L"%0d%0a%0d", L"\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
- TEST_ASSERT(testUnescapingHelper(L"%0d%0a%0d", L"\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
- TEST_ASSERT(testUnescapingHelper(L"%0d%0a%0d", L"\x0d\x0a\x0d", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
-
- TEST_ASSERT(testUnescapingHelper(L"%0d%0a%0d%0a", L"\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
- TEST_ASSERT(testUnescapingHelper(L"%0d%0a%0d%0a", L"\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
- TEST_ASSERT(testUnescapingHelper(L"%0d%0a%0d%0a", L"\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
- TEST_ASSERT(testUnescapingHelper(L"%0d%0a%0d%0a", L"\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
-
-
- TEST_ASSERT(testUnescapingHelper(L"%0a%0d", L"\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
- TEST_ASSERT(testUnescapingHelper(L"%0a%0d", L"\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
- TEST_ASSERT(testUnescapingHelper(L"%0a%0d", L"\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
- TEST_ASSERT(testUnescapingHelper(L"%0a%0d", L"\x0a\x0d", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
-
- TEST_ASSERT(testUnescapingHelper(L"%0a%0d%0a", L"\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
- TEST_ASSERT(testUnescapingHelper(L"%0a%0d%0a", L"\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
- TEST_ASSERT(testUnescapingHelper(L"%0a%0d%0a", L"\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
- TEST_ASSERT(testUnescapingHelper(L"%0a%0d%0a", L"\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
-
- TEST_ASSERT(testUnescapingHelper(L"%0a%0d%0d", L"\x0a\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
- TEST_ASSERT(testUnescapingHelper(L"%0a%0d%0d", L"\x0d\x0a\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
- TEST_ASSERT(testUnescapingHelper(L"%0a%0d%0d", L"\x0d\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
- TEST_ASSERT(testUnescapingHelper(L"%0a%0d%0d", L"\x0a\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
-
- TEST_ASSERT(testUnescapingHelper(L"%0a%0d%0a%0d", L"\x0a\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
- TEST_ASSERT(testUnescapingHelper(L"%0a%0d%0a%0d", L"\x0d\x0a\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
- TEST_ASSERT(testUnescapingHelper(L"%0a%0d%0a%0d", L"\x0d\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
- TEST_ASSERT(testUnescapingHelper(L"%0a%0d%0a%0d", L"\x0a\x0d\x0a\x0d", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
- }
+ ASSERT_TRUE(testUnescapingHelper(L"%0d", L"\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
+ ASSERT_TRUE(testUnescapingHelper(L"%0d", L"\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
+ ASSERT_TRUE(testUnescapingHelper(L"%0d", L"\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
+ ASSERT_TRUE(testUnescapingHelper(L"%0d", L"\x0d", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
+
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0d", L"\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0d", L"\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0d", L"\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0d", L"\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
+
+
+ ASSERT_TRUE(testUnescapingHelper(L"%0a", L"\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
+ ASSERT_TRUE(testUnescapingHelper(L"%0a", L"\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
+ ASSERT_TRUE(testUnescapingHelper(L"%0a", L"\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
+ ASSERT_TRUE(testUnescapingHelper(L"%0a", L"\x0a", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
+
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0a", L"\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0a", L"\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0a", L"\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0a", L"\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
+
+
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0a", L"\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0a", L"\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0a", L"\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0a", L"\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
+
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0a%0a", L"\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0a%0a", L"\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0a%0a", L"\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0a%0a", L"\x0d\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
+
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0a%0d", L"\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0a%0d", L"\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0a%0d", L"\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0a%0d", L"\x0d\x0a\x0d", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
+
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0a%0d%0a", L"\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0a%0d%0a", L"\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0a%0d%0a", L"\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
+ ASSERT_TRUE(testUnescapingHelper(L"%0d%0a%0d%0a", L"\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
+
+
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0d", L"\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0d", L"\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0d", L"\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0d", L"\x0a\x0d", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
+
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0d%0a", L"\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0d%0a", L"\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0d%0a", L"\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0d%0a", L"\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
+
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0d%0d", L"\x0a\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0d%0d", L"\x0d\x0a\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0d%0d", L"\x0d\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0d%0d", L"\x0a\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
+
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0d%0a%0d", L"\x0a\x0a\x0a", PLUS_DONT_TOUCH, URI_BR_TO_UNIX));
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0d%0a%0d", L"\x0d\x0a\x0d\x0a\x0d\x0a", PLUS_DONT_TOUCH, URI_BR_TO_WINDOWS));
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0d%0a%0d", L"\x0d\x0d\x0d", PLUS_DONT_TOUCH, URI_BR_TO_MAC));
+ ASSERT_TRUE(testUnescapingHelper(L"%0a%0d%0a%0d", L"\x0a\x0d\x0a\x0d", PLUS_DONT_TOUCH, URI_BR_DONT_TOUCH));
+}
+namespace {
bool testAddBaseHelper(const wchar_t * base, const wchar_t * rel, const wchar_t * expectedResult, bool backward_compatibility = false) {
UriParserStateW stateW;
@@ -1053,81 +992,83 @@ Rule | Example | hostSet | absPath | emptySeg
uriFreeUriMembersW(&transformedUri);
return equal;
}
+} // namespace
- void testTrailingSlash() {
+TEST(UriSuite, TestTrailingSlash) {
UriParserStateA stateA;
UriUriA uriA;
stateA.uri = &uriA;
// 0 3 01
const char * const input = "abc" "/";
- TEST_ASSERT(0 == uriParseUriA(&stateA, input));
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, input));
- TEST_ASSERT(uriA.pathHead->text.first == input);
- TEST_ASSERT(uriA.pathHead->text.afterLast == input + 3);
- TEST_ASSERT(uriA.pathHead->next->text.first == uriA.pathHead->next->text.afterLast);
- TEST_ASSERT(uriA.pathHead->next->next == NULL);
- TEST_ASSERT(uriA.pathTail == uriA.pathHead->next);
+ ASSERT_TRUE(uriA.pathHead->text.first == input);
+ ASSERT_TRUE(uriA.pathHead->text.afterLast == input + 3);
+ ASSERT_TRUE(uriA.pathHead->next->text.first == uriA.pathHead->next->text.afterLast);
+ ASSERT_TRUE(uriA.pathHead->next->next == NULL);
+ ASSERT_TRUE(uriA.pathTail == uriA.pathHead->next);
uriFreeUriMembersA(&uriA);
- }
+}
- void testAddBase() {
+TEST(UriSuite, TestAddBase) {
// 5.4.1. Normal Examples
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g:h", L"g:h"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g", L"http://a/b/c/g"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"./g", L"http://a/b/c/g"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g/", L"http://a/b/c/g/"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"/g", L"http://a/g"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"//g", L"http://g"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"?y", L"http://a/b/c/d;p?y"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g?y", L"http://a/b/c/g?y"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"#s", L"http://a/b/c/d;p?q#s"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g#s", L"http://a/b/c/g#s"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g?y#s", L"http://a/b/c/g?y#s"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L";x", L"http://a/b/c/;x"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g;x", L"http://a/b/c/g;x"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g;x?y#s", L"http://a/b/c/g;x?y#s"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"", L"http://a/b/c/d;p?q"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L".", L"http://a/b/c/"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"./", L"http://a/b/c/"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"..", L"http://a/b/"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"../", L"http://a/b/"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"../g", L"http://a/b/g"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"../..", L"http://a/"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"../../", L"http://a/"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"../../g", L"http://a/g"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g:h", L"g:h"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g", L"http://a/b/c/g"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"./g", L"http://a/b/c/g"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g/", L"http://a/b/c/g/"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"/g", L"http://a/g"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"//g", L"http://g"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"?y", L"http://a/b/c/d;p?y"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g?y", L"http://a/b/c/g?y"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"#s", L"http://a/b/c/d;p?q#s"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g#s", L"http://a/b/c/g#s"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g?y#s", L"http://a/b/c/g?y#s"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L";x", L"http://a/b/c/;x"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g;x", L"http://a/b/c/g;x"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g;x?y#s", L"http://a/b/c/g;x?y#s"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"", L"http://a/b/c/d;p?q"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L".", L"http://a/b/c/"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"./", L"http://a/b/c/"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"..", L"http://a/b/"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"../", L"http://a/b/"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"../g", L"http://a/b/g"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"../..", L"http://a/"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"../../", L"http://a/"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"../../g", L"http://a/g"));
// 5.4.2. Abnormal Examples
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"../../../g", L"http://a/g"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"../../../../g", L"http://a/g"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"/./g", L"http://a/g"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"/../g", L"http://a/g"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g.", L"http://a/b/c/g."));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L".g", L"http://a/b/c/.g"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g..", L"http://a/b/c/g.."));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"..g", L"http://a/b/c/..g"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"./../g", L"http://a/b/g"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"./g/.", L"http://a/b/c/g/"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g/./h", L"http://a/b/c/g/h"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g/../h", L"http://a/b/c/h"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g;x=1/./y", L"http://a/b/c/g;x=1/y"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g;x=1/../y", L"http://a/b/c/y"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g?y/./x", L"http://a/b/c/g?y/./x"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g?y/../x", L"http://a/b/c/g?y/../x"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g#s/./x", L"http://a/b/c/g#s/./x"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g#s/../x", L"http://a/b/c/g#s/../x"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"http:g", L"http:g"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"../../../g", L"http://a/g"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"../../../../g", L"http://a/g"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"/./g", L"http://a/g"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"/../g", L"http://a/g"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g.", L"http://a/b/c/g."));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L".g", L"http://a/b/c/.g"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g..", L"http://a/b/c/g.."));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"..g", L"http://a/b/c/..g"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"./../g", L"http://a/b/g"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"./g/.", L"http://a/b/c/g/"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g/./h", L"http://a/b/c/g/h"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g/../h", L"http://a/b/c/h"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g;x=1/./y", L"http://a/b/c/g;x=1/y"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g;x=1/../y", L"http://a/b/c/y"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g?y/./x", L"http://a/b/c/g?y/./x"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g?y/../x", L"http://a/b/c/g?y/../x"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g#s/./x", L"http://a/b/c/g#s/./x"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"g#s/../x", L"http://a/b/c/g#s/../x"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"http:g", L"http:g"));
// Backward compatibility (feature request #4, RFC3986 5.4.2)
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"http:g", L"http:g", false));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"http:g", L"http://a/b/c/g", true));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"http:g?q#f", L"http://a/b/c/g?q#f", true));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"other:g?q#f", L"other:g?q#f", true));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"http:g", L"http:g", false));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"http:g", L"http://a/b/c/g", true));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"http:g?q#f", L"http://a/b/c/g?q#f", true));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"other:g?q#f", L"other:g?q#f", true));
// Bug related to absolutePath flag set despite presence of host
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"/", L"http://a/"));
- TEST_ASSERT(testAddBaseHelper(L"http://a/b/c/d;p?q", L"/g/", L"http://a/g/"));
- }
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"/", L"http://a/"));
+ ASSERT_TRUE(testAddBaseHelper(L"http://a/b/c/d;p?q", L"/g/", L"http://a/g/"));
+}
+namespace {
bool testToStringHelper(const wchar_t * text) {
// Parse
UriParserStateW state;
@@ -1174,85 +1115,87 @@ Rule | Example | hostSet | absPath | emptySeg
uriFreeUriMembersW(&uri);
return equals;
}
+} // namespace
- void testToString() {
+TEST(UriSuite, TestToString) {
// Scheme
- TEST_ASSERT(testToStringHelper(L"ftp://localhost/"));
+ ASSERT_TRUE(testToStringHelper(L"ftp://localhost/"));
// UserInfo
- TEST_ASSERT(testToStringHelper(L"http://user:pass@localhost/"));
+ ASSERT_TRUE(testToStringHelper(L"http://user:pass@localhost/"));
// IPv4
- TEST_ASSERT(testToStringHelper(L"http://123.0.1.255/"));
+ ASSERT_TRUE(testToStringHelper(L"http://123.0.1.255/"));
// IPv6
- TEST_ASSERT(testToStringHelper(L"http://[abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd]/"));
+ ASSERT_TRUE(testToStringHelper(L"http://[abcd:abcd:abcd:abcd:abcd:abcd:abcd:abcd]/"));
// IPvFuture
- TEST_ASSERT(testToStringHelper(L"http://[vA.123456]/"));
+ ASSERT_TRUE(testToStringHelper(L"http://[vA.123456]/"));
// Port
- TEST_ASSERT(testToStringHelper(L"http://example.com:123/"));
+ ASSERT_TRUE(testToStringHelper(L"http://example.com:123/"));
// Path
- TEST_ASSERT(testToStringHelper(L"http://example.com"));
- TEST_ASSERT(testToStringHelper(L"http://example.com/"));
- TEST_ASSERT(testToStringHelper(L"http://example.com/abc/"));
- TEST_ASSERT(testToStringHelper(L"http://example.com/abc/def"));
- TEST_ASSERT(testToStringHelper(L"http://example.com/abc/def/"));
- TEST_ASSERT(testToStringHelper(L"http://example.com//"));
- TEST_ASSERT(testToStringHelper(L"http://example.com/./.."));
+ ASSERT_TRUE(testToStringHelper(L"http://example.com"));
+ ASSERT_TRUE(testToStringHelper(L"http://example.com/"));
+ ASSERT_TRUE(testToStringHelper(L"http://example.com/abc/"));
+ ASSERT_TRUE(testToStringHelper(L"http://example.com/abc/def"));
+ ASSERT_TRUE(testToStringHelper(L"http://example.com/abc/def/"));
+ ASSERT_TRUE(testToStringHelper(L"http://example.com//"));
+ ASSERT_TRUE(testToStringHelper(L"http://example.com/./.."));
// Query
- TEST_ASSERT(testToStringHelper(L"http://example.com/?abc"));
+ ASSERT_TRUE(testToStringHelper(L"http://example.com/?abc"));
// Fragment
- TEST_ASSERT(testToStringHelper(L"http://example.com/#abc"));
- TEST_ASSERT(testToStringHelper(L"http://example.com/?def#abc"));
+ ASSERT_TRUE(testToStringHelper(L"http://example.com/#abc"));
+ ASSERT_TRUE(testToStringHelper(L"http://example.com/?def#abc"));
// Relative
- TEST_ASSERT(testToStringHelper(L"a"));
- TEST_ASSERT(testToStringHelper(L"a/"));
- TEST_ASSERT(testToStringHelper(L"/a"));
- TEST_ASSERT(testToStringHelper(L"/a/"));
- TEST_ASSERT(testToStringHelper(L"abc"));
- TEST_ASSERT(testToStringHelper(L"abc/"));
- TEST_ASSERT(testToStringHelper(L"/abc"));
- TEST_ASSERT(testToStringHelper(L"/abc/"));
- TEST_ASSERT(testToStringHelper(L"a/def"));
- TEST_ASSERT(testToStringHelper(L"a/def/"));
- TEST_ASSERT(testToStringHelper(L"/a/def"));
- TEST_ASSERT(testToStringHelper(L"/a/def/"));
- TEST_ASSERT(testToStringHelper(L"abc/def"));
- TEST_ASSERT(testToStringHelper(L"abc/def/"));
- TEST_ASSERT(testToStringHelper(L"/abc/def"));
- TEST_ASSERT(testToStringHelper(L"/abc/def/"));
- TEST_ASSERT(testToStringHelper(L"/"));
- TEST_ASSERT(testToStringHelper(L"//a/"));
- TEST_ASSERT(testToStringHelper(L"."));
- TEST_ASSERT(testToStringHelper(L"./"));
- TEST_ASSERT(testToStringHelper(L"/."));
- TEST_ASSERT(testToStringHelper(L"/./"));
- TEST_ASSERT(testToStringHelper(L""));
- TEST_ASSERT(testToStringHelper(L"./abc/def"));
- TEST_ASSERT(testToStringHelper(L"?query"));
- TEST_ASSERT(testToStringHelper(L"#fragment"));
- TEST_ASSERT(testToStringHelper(L"?query#fragment"));
+ ASSERT_TRUE(testToStringHelper(L"a"));
+ ASSERT_TRUE(testToStringHelper(L"a/"));
+ ASSERT_TRUE(testToStringHelper(L"/a"));
+ ASSERT_TRUE(testToStringHelper(L"/a/"));
+ ASSERT_TRUE(testToStringHelper(L"abc"));
+ ASSERT_TRUE(testToStringHelper(L"abc/"));
+ ASSERT_TRUE(testToStringHelper(L"/abc"));
+ ASSERT_TRUE(testToStringHelper(L"/abc/"));
+ ASSERT_TRUE(testToStringHelper(L"a/def"));
+ ASSERT_TRUE(testToStringHelper(L"a/def/"));
+ ASSERT_TRUE(testToStringHelper(L"/a/def"));
+ ASSERT_TRUE(testToStringHelper(L"/a/def/"));
+ ASSERT_TRUE(testToStringHelper(L"abc/def"));
+ ASSERT_TRUE(testToStringHelper(L"abc/def/"));
+ ASSERT_TRUE(testToStringHelper(L"/abc/def"));
+ ASSERT_TRUE(testToStringHelper(L"/abc/def/"));
+ ASSERT_TRUE(testToStringHelper(L"/"));
+ ASSERT_TRUE(testToStringHelper(L"//a/"));
+ ASSERT_TRUE(testToStringHelper(L"."));
+ ASSERT_TRUE(testToStringHelper(L"./"));
+ ASSERT_TRUE(testToStringHelper(L"/."));
+ ASSERT_TRUE(testToStringHelper(L"/./"));
+ ASSERT_TRUE(testToStringHelper(L""));
+ ASSERT_TRUE(testToStringHelper(L"./abc/def"));
+ ASSERT_TRUE(testToStringHelper(L"?query"));
+ ASSERT_TRUE(testToStringHelper(L"#fragment"));
+ ASSERT_TRUE(testToStringHelper(L"?query#fragment"));
// Tests for bugs from the past
- TEST_ASSERT(testToStringHelper(L"f:/.//g"));
- }
+ ASSERT_TRUE(testToStringHelper(L"f:/.//g"));
+}
- void testToString_Bug1950126() {
+TEST(UriSuite, TestToStringBug1950126) {
UriParserStateW state;
UriUriW uriOne;
UriUriW uriTwo;
const wchar_t * const uriOneString = L"http://e.com/";
const wchar_t * const uriTwoString = L"http://e.com";
state.uri = &uriOne;
- TEST_ASSERT(URI_SUCCESS == uriParseUriW(&state, uriOneString));
+ ASSERT_TRUE(URI_SUCCESS == uriParseUriW(&state, uriOneString));
state.uri = &uriTwo;
- TEST_ASSERT(URI_SUCCESS == uriParseUriW(&state, uriTwoString));
- TEST_ASSERT(URI_FALSE == uriEqualsUriW(&uriOne, &uriTwo));
+ ASSERT_TRUE(URI_SUCCESS == uriParseUriW(&state, uriTwoString));
+ ASSERT_TRUE(URI_FALSE == uriEqualsUriW(&uriOne, &uriTwo));
uriFreeUriMembersW(&uriOne);
uriFreeUriMembersW(&uriTwo);
- TEST_ASSERT(testToStringHelper(uriOneString));
- TEST_ASSERT(testToStringHelper(uriTwoString));
- }
+ ASSERT_TRUE(testToStringHelper(uriOneString));
+ ASSERT_TRUE(testToStringHelper(uriTwoString));
+}
+namespace {
bool testToStringCharsRequiredHelper(const wchar_t * text) {
// Parse
UriParserStateW state;
@@ -1290,19 +1233,21 @@ Rule | Example | hostSet | absPath | emptySeg
delete [] buffer;
return true;
}
+} // namespace
+
+TEST(UriSuite, TestToStringCharsRequired) {
+ ASSERT_TRUE(testToStringCharsRequiredHelper(L"http://www.example.com/"));
+ ASSERT_TRUE(testToStringCharsRequiredHelper(L"http://www.example.com:80/"));
+ ASSERT_TRUE(testToStringCharsRequiredHelper(L"http://user:pass@www.example.com/"));
+ ASSERT_TRUE(testToStringCharsRequiredHelper(L"http://www.example.com/index.html"));
+ ASSERT_TRUE(testToStringCharsRequiredHelper(L"http://www.example.com/?abc"));
+ ASSERT_TRUE(testToStringCharsRequiredHelper(L"http://www.example.com/#def"));
+ ASSERT_TRUE(testToStringCharsRequiredHelper(L"http://www.example.com/?abc#def"));
+ ASSERT_TRUE(testToStringCharsRequiredHelper(L"/test"));
+ ASSERT_TRUE(testToStringCharsRequiredHelper(L"test"));
+}
- void testToStringCharsRequired() {
- TEST_ASSERT(testToStringCharsRequiredHelper(L"http://www.example.com/"));
- TEST_ASSERT(testToStringCharsRequiredHelper(L"http://www.example.com:80/"));
- TEST_ASSERT(testToStringCharsRequiredHelper(L"http://user:pass@www.example.com/"));
- TEST_ASSERT(testToStringCharsRequiredHelper(L"http://www.example.com/index.html"));
- TEST_ASSERT(testToStringCharsRequiredHelper(L"http://www.example.com/?abc"));
- TEST_ASSERT(testToStringCharsRequiredHelper(L"http://www.example.com/#def"));
- TEST_ASSERT(testToStringCharsRequiredHelper(L"http://www.example.com/?abc#def"));
- TEST_ASSERT(testToStringCharsRequiredHelper(L"/test"));
- TEST_ASSERT(testToStringCharsRequiredHelper(L"test"));
- }
-
+namespace {
bool testNormalizeMaskHelper(const wchar_t * uriText, unsigned int expectedMask) {
UriParserStateW state;
UriUriW uri;
@@ -1333,17 +1278,19 @@ Rule | Example | hostSet | absPath | emptySeg
return (maskAfter == URI_NORMALIZED);
}
+} // namespace
- void testNormalizeSyntaxMaskRequired() {
- TEST_ASSERT(testNormalizeMaskHelper(L"http://localhost/", URI_NORMALIZED));
- TEST_ASSERT(testNormalizeMaskHelper(L"httP://localhost/", URI_NORMALIZE_SCHEME));
- TEST_ASSERT(testNormalizeMaskHelper(L"http://%0d@localhost/", URI_NORMALIZE_USER_INFO));
- TEST_ASSERT(testNormalizeMaskHelper(L"http://localhosT/", URI_NORMALIZE_HOST));
- TEST_ASSERT(testNormalizeMaskHelper(L"http://localhost/./abc", URI_NORMALIZE_PATH));
- TEST_ASSERT(testNormalizeMaskHelper(L"http://localhost/?AB%43", URI_NORMALIZE_QUERY));
- TEST_ASSERT(testNormalizeMaskHelper(L"http://localhost/#AB%43", URI_NORMALIZE_FRAGMENT));
- }
+TEST(UriSuite, TestNormalizeSyntaxMaskRequired) {
+ ASSERT_TRUE(testNormalizeMaskHelper(L"http://localhost/", URI_NORMALIZED));
+ ASSERT_TRUE(testNormalizeMaskHelper(L"httP://localhost/", URI_NORMALIZE_SCHEME));
+ ASSERT_TRUE(testNormalizeMaskHelper(L"http://%0d@localhost/", URI_NORMALIZE_USER_INFO));
+ ASSERT_TRUE(testNormalizeMaskHelper(L"http://localhosT/", URI_NORMALIZE_HOST));
+ ASSERT_TRUE(testNormalizeMaskHelper(L"http://localhost/./abc", URI_NORMALIZE_PATH));
+ ASSERT_TRUE(testNormalizeMaskHelper(L"http://localhost/?AB%43", URI_NORMALIZE_QUERY));
+ ASSERT_TRUE(testNormalizeMaskHelper(L"http://localhost/#AB%43", URI_NORMALIZE_FRAGMENT));
+}
+namespace {
bool testNormalizeSyntaxHelper(const wchar_t * uriText, const wchar_t * expectedNormalized,
unsigned int mask = static_cast<unsigned int>(-1)) {
UriParserStateW stateW;
@@ -1392,122 +1339,124 @@ Rule | Example | hostSet | absPath | emptySeg
uriFreeUriMembersW(&expectedUri);
return equalAfter;
}
+} // namespace
- void testNormalizeSyntax() {
- TEST_ASSERT(testNormalizeSyntaxHelper(
+TEST(UriSuite, TestNormalizeSyntax) {
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"eXAMPLE://a/./b/../b/%63/%7bfoo%7d",
L"example://a/b/c/%7Bfoo%7D"));
// Testcase by Adrian Manrique
- TEST_ASSERT(testNormalizeSyntaxHelper(
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"http://examp%4Ce.com/",
L"http://example.com/"));
// Testcase by Adrian Manrique
- TEST_ASSERT(testNormalizeSyntaxHelper(
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"http://example.com/a/b/%2E%2E/",
L"http://example.com/a/"));
// Reported by Adrian Manrique
- TEST_ASSERT(testNormalizeSyntaxHelper(
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"http://user:pass@SOMEHOST.COM:123",
L"http://user:pass@somehost.com:123"));
- TEST_ASSERT(testNormalizeSyntaxHelper(
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"HTTP://a:b@HOST:123/./1/2/../%41?abc#def",
L"http://a:b@host:123/1/A?abc#def"));
- TEST_ASSERT(testNormalizeSyntaxHelper(
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"../../abc",
L"../../abc"));
- TEST_ASSERT(testNormalizeSyntaxHelper(
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"../../abc/..",
L"../../"));
- TEST_ASSERT(testNormalizeSyntaxHelper(
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"../../abc/../def",
L"../../def"));
- TEST_ASSERT(testNormalizeSyntaxHelper(
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"abc/..",
L""));
- TEST_ASSERT(testNormalizeSyntaxHelper(
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"abc/../",
L""));
- TEST_ASSERT(testNormalizeSyntaxHelper(
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"../../abc/./def",
L"../../abc/def"));
- TEST_ASSERT(testNormalizeSyntaxHelper(
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"./def",
L"def"));
- TEST_ASSERT(testNormalizeSyntaxHelper(
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"def/.",
L"def/"));
- TEST_ASSERT(testNormalizeSyntaxHelper(
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"./abc:def",
L"./abc:def"));
- }
+}
- void testNormalizeSyntaxComponents() {
- TEST_ASSERT(testNormalizeSyntaxHelper(
+TEST(UriSuite, TestNormalizeSyntaxComponents) {
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"HTTP://%41@EXAMPLE.ORG/../a?%41#%41",
L"http://%41@EXAMPLE.ORG/../a?%41#%41",
URI_NORMALIZE_SCHEME));
- TEST_ASSERT(testNormalizeSyntaxHelper(
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"HTTP://%41@EXAMPLE.ORG/../a?%41#%41",
L"HTTP://A@EXAMPLE.ORG/../a?%41#%41",
URI_NORMALIZE_USER_INFO));
- TEST_ASSERT(testNormalizeSyntaxHelper(
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"HTTP://%41@EXAMPLE.ORG/../a?%41#%41",
L"HTTP://%41@example.org/../a?%41#%41",
URI_NORMALIZE_HOST));
- TEST_ASSERT(testNormalizeSyntaxHelper(
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"HTTP://%41@EXAMPLE.ORG/../a?%41#%41",
L"HTTP://%41@EXAMPLE.ORG/a?%41#%41",
URI_NORMALIZE_PATH));
- TEST_ASSERT(testNormalizeSyntaxHelper(
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"HTTP://%41@EXAMPLE.ORG/../a?%41#%41",
L"HTTP://%41@EXAMPLE.ORG/../a?A#%41",
URI_NORMALIZE_QUERY));
- TEST_ASSERT(testNormalizeSyntaxHelper(
+ ASSERT_TRUE(testNormalizeSyntaxHelper(
L"HTTP://%41@EXAMPLE.ORG/../a?%41#%41",
L"HTTP://%41@EXAMPLE.ORG/../a?%41#A",
URI_NORMALIZE_FRAGMENT));
- }
+}
- void testNormalizeCrash_Bug20080224() {
+TEST(UriSuite, TestNormalizeCrashBug20080224) {
UriParserStateW stateW;
int res;
UriUriW testUri;
stateW.uri = &testUri;
res = uriParseUriW(&stateW, L"http://example.org/abc//../def");
- TEST_ASSERT(res == 0);
+ ASSERT_TRUE(res == 0);
// First call will make us owner of copied memory
res = uriNormalizeSyntaxExW(&testUri, URI_NORMALIZE_SCHEME);
- TEST_ASSERT(res == 0);
+ ASSERT_TRUE(res == 0);
res = uriNormalizeSyntaxExW(&testUri, URI_NORMALIZE_HOST);
- TEST_ASSERT(res == 0);
+ ASSERT_TRUE(res == 0);
// Frees empty path segment -> crash
res = uriNormalizeSyntaxW(&testUri);
- TEST_ASSERT(res == 0);
+ ASSERT_TRUE(res == 0);
uriFreeUriMembersW(&testUri);
- }
+}
+namespace {
void testFilenameUriConversionHelper(const wchar_t * filename,
const wchar_t * uriString, bool forUnix,
const wchar_t * expectedUriString = NULL) {
@@ -1527,7 +1476,7 @@ Rule | Example | hostSet | absPath | emptySeg
#ifdef HAVE_WPRINTF
// wprintf(L"1 [%s][%s]\n", uriBuffer, expectedUriString);
#endif
- TEST_ASSERT(!wcscmp(uriBuffer, expectedUriString));
+ ASSERT_TRUE(!wcscmp(uriBuffer, expectedUriString));
delete [] uriBuffer;
// URI string to filename
@@ -1541,11 +1490,12 @@ Rule | Example | hostSet | absPath | emptySeg
#ifdef HAVE_WPRINTF
// wprintf(L"2 [%s][%s]\n", filenameBuffer, filename);
#endif
- TEST_ASSERT(!wcscmp(filenameBuffer, filename));
+ ASSERT_TRUE(!wcscmp(filenameBuffer, filename));
delete [] filenameBuffer;
}
+} // namespace
- void testFilenameUriConversion() {
+TEST(UriSuite, TestFilenameUriConversion) {
const bool FOR_UNIX = true;
const bool FOR_WINDOWS = false;
testFilenameUriConversionHelper(L"/bin/bash", L"file:///bin/bash", FOR_UNIX);
@@ -1564,9 +1514,9 @@ Rule | Example | hostSet | absPath | emptySeg
testFilenameUriConversionHelper(L"abc def", L"abc%20def", FOR_UNIX);
testFilenameUriConversionHelper(L"\\\\Server01\\user\\docs\\Letter.txt", L"file://Server01/user/docs/Letter.txt", FOR_WINDOWS);
- }
+}
- void testCrash_FreeUriMembers_Bug20080116() {
+TEST(UriSuite, TestCrashFreeUriMembersBug20080116) {
// Testcase by Adrian Manrique
UriParserStateA state;
UriUriA uri;
@@ -1575,19 +1525,23 @@ Rule | Example | hostSet | absPath | emptySeg
uriNormalizeSyntaxA(&uri);
uriFreeUriMembersA(&uri);
- TEST_ASSERT(true);
- }
+ ASSERT_TRUE(true);
+}
+
+namespace {
+ void helperTestQueryString(char const * uriString, int pairsExpected);
+}
- void testCrash_Report2418192() {
+TEST(UriSuite, TestCrashReport2418192) {
// Testcase by Harvey Vrsalovic
helperTestQueryString("http://svcs.cnn.com/weather/wrapper.jsp?&csiID=csi1", 1);
- }
+}
- void testPervertedQueryString() {
+TEST(UriSuite, TestPervertedQueryString) {
helperTestQueryString("http://example.org/?&&=&&&=&&&&==&===&====", 5);
- }
+}
- void testQueryStringEndingInEqualSign_NonBug32() {
+TEST(UriSuite, TestQueryStringEndingInEqualSignNonBug32) {
const char * queryString = "firstname=sdsd&lastname=";
UriQueryListA * queryList = NULL;
@@ -1595,53 +1549,56 @@ Rule | Example | hostSet | absPath | emptySeg
const int res = uriDissectQueryMallocA(&queryList, &itemCount,
queryString, queryString + strlen(queryString));
- TEST_ASSERT(res == URI_SUCCESS);
- TEST_ASSERT(itemCount == 2);
- TEST_ASSERT(queryList != NULL);
- TEST_ASSERT(strcmp(queryList->key, "firstname") == 0);
- TEST_ASSERT(strcmp(queryList->value, "sdsd") == 0);
- TEST_ASSERT(strcmp(queryList->next->key, "lastname") == 0);
- TEST_ASSERT(strcmp(queryList->next->value, "") == 0);
- TEST_ASSERT(queryList->next->next == NULL);
+ ASSERT_TRUE(res == URI_SUCCESS);
+ ASSERT_TRUE(itemCount == 2);
+ ASSERT_TRUE(queryList != NULL);
+ ASSERT_TRUE(strcmp(queryList->key, "firstname") == 0);
+ ASSERT_TRUE(strcmp(queryList->value, "sdsd") == 0);
+ ASSERT_TRUE(strcmp(queryList->next->key, "lastname") == 0);
+ ASSERT_TRUE(strcmp(queryList->next->value, "") == 0);
+ ASSERT_TRUE(queryList->next->next == NULL);
uriFreeQueryListA(queryList);
- }
+}
+namespace {
void helperTestQueryString(char const * uriString, int pairsExpected) {
UriParserStateA state;
UriUriA uri;
state.uri = &uri;
int res = uriParseUriA(&state, uriString);
- TEST_ASSERT(res == URI_SUCCESS);
+ ASSERT_TRUE(res == URI_SUCCESS);
UriQueryListA * queryList = NULL;
int itemCount = 0;
res = uriDissectQueryMallocA(&queryList, &itemCount,
uri.query.first, uri.query.afterLast);
- TEST_ASSERT(res == URI_SUCCESS);
- TEST_ASSERT(queryList != NULL);
- TEST_ASSERT(itemCount == pairsExpected);
+ ASSERT_TRUE(res == URI_SUCCESS);
+ ASSERT_TRUE(queryList != NULL);
+ ASSERT_TRUE(itemCount == pairsExpected);
uriFreeQueryListA(queryList);
uriFreeUriMembersA(&uri);
}
+} // namespace
- void testCrash_MakeOwner_Bug20080207() {
+TEST(UriSuite, TestCrashMakeOwnerBug20080207) {
// Testcase by Adrian Manrique
UriParserStateA state;
UriUriA sourceUri;
state.uri = &sourceUri;
const char * const sourceUriString = "http://user:pass@somehost.com:80/";
if (uriParseUriA(&state, sourceUriString) != 0) {
- TEST_ASSERT(false);
+ ASSERT_TRUE(false);
}
if (uriNormalizeSyntaxA(&sourceUri) != 0) {
- TEST_ASSERT(false);
+ ASSERT_TRUE(false);
}
uriFreeUriMembersA(&sourceUri);
- TEST_ASSERT(true);
- }
+ ASSERT_TRUE(true);
+}
+namespace {
void testQueryListHelper(const wchar_t * input, int expectedItemCount) {
int res;
@@ -1653,49 +1610,51 @@ Rule | Example | hostSet | absPath | emptySeg
UriQueryListW * queryList;
res = uriDissectQueryMallocExW(&queryList, &itemCount,
input, input + wcslen(input), spacePlusConversion, breakConversion);
- TEST_ASSERT(res == URI_SUCCESS);
- TEST_ASSERT(itemCount == expectedItemCount);
- TEST_ASSERT((queryList == NULL) == (expectedItemCount == 0));
+ ASSERT_TRUE(res == URI_SUCCESS);
+ ASSERT_TRUE(itemCount == expectedItemCount);
+ ASSERT_TRUE((queryList == NULL) == (expectedItemCount == 0));
if (expectedItemCount != 0) {
// First
int charsRequired;
res = uriComposeQueryCharsRequiredExW(queryList, &charsRequired, spacePlusConversion,
normalizeBreaks);
- TEST_ASSERT(res == URI_SUCCESS);
- TEST_ASSERT(charsRequired >= (int)wcslen(input));
+ ASSERT_TRUE(res == URI_SUCCESS);
+ ASSERT_TRUE(charsRequired >= (int)wcslen(input));
wchar_t * recomposed = new wchar_t[charsRequired + 1];
int charsWritten;
res = uriComposeQueryExW(recomposed, queryList, charsRequired + 1,
&charsWritten, spacePlusConversion, normalizeBreaks);
- TEST_ASSERT(res == URI_SUCCESS);
- TEST_ASSERT(charsWritten <= charsRequired);
- TEST_ASSERT(charsWritten == (int)wcslen(input) + 1);
- TEST_ASSERT(!wcscmp(input, recomposed));
+ ASSERT_TRUE(res == URI_SUCCESS);
+ ASSERT_TRUE(charsWritten <= charsRequired);
+ ASSERT_TRUE(charsWritten == (int)wcslen(input) + 1);
+ ASSERT_TRUE(!wcscmp(input, recomposed));
delete [] recomposed;
recomposed = NULL;
res = uriComposeQueryMallocW(&recomposed, queryList);
- TEST_ASSERT(res == URI_SUCCESS);
- TEST_ASSERT(recomposed != NULL);
- TEST_ASSERT(charsWritten == (int)wcslen(input) + 1);
- TEST_ASSERT(!wcscmp(input, recomposed));
+ ASSERT_TRUE(res == URI_SUCCESS);
+ ASSERT_TRUE(recomposed != NULL);
+ ASSERT_TRUE(charsWritten == (int)wcslen(input) + 1);
+ ASSERT_TRUE(!wcscmp(input, recomposed));
free(recomposed);
}
uriFreeQueryListW(queryList);
}
+} // namespace
- void testQueryList() {
+TEST(UriSuite, QueryList) {
testQueryListHelper(L"one=ONE&two=TWO", 2);
testQueryListHelper(L"one=ONE&two=&three=THREE", 3);
testQueryListHelper(L"one=ONE&two&three=THREE", 3);
testQueryListHelper(L"one=ONE", 1);
testQueryListHelper(L"one", 1);
testQueryListHelper(L"", 0);
- }
+}
+namespace {
void testQueryListPairHelper(const char * pair, const char * unescapedKey,
const char * unescapedValue, const char * fixed = NULL) {
int res;
@@ -1703,53 +1662,101 @@ Rule | Example | hostSet | absPath | emptySeg
int itemCount;
res = uriDissectQueryMallocA(&queryList, &itemCount, pair, pair + strlen(pair));
- TEST_ASSERT(res == URI_SUCCESS);
- TEST_ASSERT(queryList != NULL);
- TEST_ASSERT(itemCount == 1);
- TEST_ASSERT(!strcmp(queryList->key, unescapedKey));
- TEST_ASSERT(!strcmp(queryList->value, unescapedValue));
+ ASSERT_TRUE(res == URI_SUCCESS);
+ ASSERT_TRUE(queryList != NULL);
+ ASSERT_TRUE(itemCount == 1);
+ ASSERT_TRUE(!strcmp(queryList->key, unescapedKey));
+ ASSERT_TRUE(!strcmp(queryList->value, unescapedValue));
char * recomposed;
res = uriComposeQueryMallocA(&recomposed, queryList);
- TEST_ASSERT(res == URI_SUCCESS);
- TEST_ASSERT(recomposed != NULL);
- TEST_ASSERT(!strcmp(recomposed, (fixed != NULL) ? fixed : pair));
+ ASSERT_TRUE(res == URI_SUCCESS);
+ ASSERT_TRUE(recomposed != NULL);
+ ASSERT_TRUE(!strcmp(recomposed, (fixed != NULL) ? fixed : pair));
free(recomposed);
uriFreeQueryListA(queryList);
}
+} // namespace
- void testQueryListPair() {
+TEST(UriSuite, TestQueryListPair) {
testQueryListPairHelper("one+two+%26+three=%2B", "one two & three", "+");
testQueryListPairHelper("one=two=three", "one", "two=three", "one=two%3Dthree");
testQueryListPairHelper("one=two=three=four", "one", "two=three=four", "one=two%3Dthree%3Dfour");
- }
+}
- void testQueryDissection_Bug3590761() {
+TEST(UriSuite, TestQueryDissectionBug3590761) {
int res;
UriQueryListA * queryList;
int itemCount;
const char * const pair = "q=hello&x=&y=";
res = uriDissectQueryMallocA(&queryList, &itemCount, pair, pair + strlen(pair));
- TEST_ASSERT(res == URI_SUCCESS);
- TEST_ASSERT(queryList != NULL);
- TEST_ASSERT(itemCount == 3);
+ ASSERT_TRUE(res == URI_SUCCESS);
+ ASSERT_TRUE(queryList != NULL);
+ ASSERT_TRUE(itemCount == 3);
- TEST_ASSERT(!strcmp(queryList->key, "q"));
- TEST_ASSERT(!strcmp(queryList->value, "hello"));
+ ASSERT_TRUE(!strcmp(queryList->key, "q"));
+ ASSERT_TRUE(!strcmp(queryList->value, "hello"));
- TEST_ASSERT(!strcmp(queryList->next->key, "x"));
- TEST_ASSERT(!strcmp(queryList->next->value, ""));
+ ASSERT_TRUE(!strcmp(queryList->next->key, "x"));
+ ASSERT_TRUE(!strcmp(queryList->next->value, ""));
- TEST_ASSERT(!strcmp(queryList->next->next->key, "y"));
- TEST_ASSERT(!strcmp(queryList->next->next->value, ""));
+ ASSERT_TRUE(!strcmp(queryList->next->next->key, "y"));
+ ASSERT_TRUE(!strcmp(queryList->next->next->value, ""));
- TEST_ASSERT(! queryList->next->next->next);
+ ASSERT_TRUE(! queryList->next->next->next);
uriFreeQueryListA(queryList);
- }
+}
+
+TEST(UriSuite, TestQueryCompositionMathCalc) {
+ UriQueryListA second = { /*.key =*/ "k2", /*.value =*/ "v2", /*.next =*/ NULL };
+ UriQueryListA first = { /*.key =*/ "k1", /*.value =*/ "v1", /*.next =*/ &second };
+
+ int charsRequired;
+ ASSERT_TRUE(uriComposeQueryCharsRequiredA(&first, &charsRequired)
+ == URI_SUCCESS);
+
+ const int FACTOR = 6; /* due to escaping with normalizeBreaks */
+ ASSERT_TRUE((unsigned)charsRequired ==
+ FACTOR * strlen(first.key) + 1 + FACTOR * strlen(first.value)
+ + 1
+ + FACTOR * strlen(second.key) + 1 + FACTOR * strlen(second.value)
+ );
+}
+
+TEST(UriSuite, TestQueryCompositionMathWriteGoogleAutofuzz113244572) {
+ UriQueryListA second = { /*.key =*/ "\x11", /*.value =*/ NULL, /*.next =*/ NULL };
+ UriQueryListA first = { /*.key =*/ "\x01", /*.value =*/ "\x02", /*.next =*/ &second };
+
+ const UriBool spaceToPlus = URI_TRUE;
+ const UriBool normalizeBreaks = URI_FALSE; /* for factor 3 but 6 */
+
+ const int charsRequired = (3 + 1 + 3) + 1 + (3);
+
+ {
+ // Minimum space to hold everything fine
+ const char * const expected = "%01=%02" "&" "%11";
+ char dest[charsRequired + 1];
+ int charsWritten;
+ ASSERT_TRUE(uriComposeQueryExA(dest, &first, sizeof(dest),
+ &charsWritten, spaceToPlus, normalizeBreaks)
+ == URI_SUCCESS);
+ ASSERT_TRUE(! strcmp(dest, expected));
+ ASSERT_TRUE(charsWritten == strlen(expected) + 1);
+ }
+
+ {
+ // Previous math failed to take ampersand into account
+ char dest[charsRequired + 1 - 1];
+ int charsWritten;
+ ASSERT_TRUE(uriComposeQueryExA(dest, &first, sizeof(dest),
+ &charsWritten, spaceToPlus, normalizeBreaks)
+ == URI_ERROR_OUTPUT_TOO_LARGE);
+ }
+}
- void testFreeCrash_Bug20080827() {
+TEST(UriSuite, TestFreeCrashBug20080827) {
char const * const sourceUri = "abc";
char const * const baseUri = "http://www.example.org/";
@@ -1761,21 +1768,21 @@ Rule | Example | hostSet | absPath | emptySeg
state.uri = &relativeSource;
res = uriParseUriA(&state, sourceUri);
- TEST_ASSERT(res == URI_SUCCESS);
+ ASSERT_TRUE(res == URI_SUCCESS);
state.uri = &absoluteBase;
res = uriParseUriA(&state, baseUri);
- TEST_ASSERT(res == URI_SUCCESS);
+ ASSERT_TRUE(res == URI_SUCCESS);
res = uriRemoveBaseUriA(&absoluteDest, &relativeSource, &absoluteBase, URI_FALSE);
- TEST_ASSERT(res == URI_ERROR_REMOVEBASE_REL_SOURCE);
+ ASSERT_TRUE(res == URI_ERROR_REMOVEBASE_REL_SOURCE);
uriFreeUriMembersA(&relativeSource);
uriFreeUriMembersA(&absoluteBase);
uriFreeUriMembersA(&absoluteDest); // Crashed here
- }
+}
- void testParseInvalid_Bug16() {
+TEST(UriSuite, TestInvalidInputBug16) {
UriParserStateA stateA;
UriUriA uriA;
stateA.uri = &uriA;
@@ -1783,27 +1790,29 @@ Rule | Example | hostSet | absPath | emptySeg
const int res = uriParseUriA(&stateA, input);
- TEST_ASSERT(res == URI_ERROR_SYNTAX);
- TEST_ASSERT(stateA.errorPos == input + 1);
- TEST_ASSERT(stateA.errorCode == URI_ERROR_SYNTAX); /* failed previously */
+ ASSERT_TRUE(res == URI_ERROR_SYNTAX);
+ ASSERT_TRUE(stateA.errorPos == input + 1);
+ ASSERT_TRUE(stateA.errorCode == URI_ERROR_SYNTAX); /* failed previously */
uriFreeUriMembersA(&uriA);
- }
+}
+namespace {
void testEqualsHelper(const char * uri_to_test) {
UriParserStateA state;
UriUriA uriOne;
UriUriA uriTwo;
state.uri = &uriOne;
- TEST_ASSERT(URI_SUCCESS == uriParseUriA(&state, uri_to_test));
+ ASSERT_TRUE(URI_SUCCESS == uriParseUriA(&state, uri_to_test));
state.uri = &uriTwo;
- TEST_ASSERT(URI_SUCCESS == uriParseUriA(&state, uri_to_test));
- TEST_ASSERT(URI_TRUE == uriEqualsUriA(&uriOne, &uriTwo));
+ ASSERT_TRUE(URI_SUCCESS == uriParseUriA(&state, uri_to_test));
+ ASSERT_TRUE(URI_TRUE == uriEqualsUriA(&uriOne, &uriTwo));
uriFreeUriMembersA(&uriOne);
uriFreeUriMembersA(&uriTwo);
}
+} // namespace
- void testEquals() {
+TEST(UriSuite, TestEquals) {
testEqualsHelper("http://host");
testEqualsHelper("http://host:123");
testEqualsHelper("http://foo:bar@host:123");
@@ -1818,81 +1827,82 @@ Rule | Example | hostSet | absPath | emptySeg
testEqualsHelper("//path/");
testEqualsHelper("//host");
testEqualsHelper("//host:123");
- }
+}
- void testHostTextTermination_Issue15() {
+TEST(UriSuite, TestHostTextTerminationIssue15) {
UriParserStateA state;
UriUriA uri;
state.uri = &uri;
// Empty host and port
const char * const emptyHostWithPortUri = "//:123";
- TEST_ASSERT(URI_SUCCESS == uriParseUriA(&state, emptyHostWithPortUri));
- TEST_ASSERT(uri.hostText.first == emptyHostWithPortUri + strlen("//"));
- TEST_ASSERT(uri.hostText.afterLast == uri.hostText.first + 0);
- TEST_ASSERT(uri.portText.first == emptyHostWithPortUri
+ ASSERT_TRUE(URI_SUCCESS == uriParseUriA(&state, emptyHostWithPortUri));
+ ASSERT_TRUE(uri.hostText.first == emptyHostWithPortUri + strlen("//"));
+ ASSERT_TRUE(uri.hostText.afterLast == uri.hostText.first + 0);
+ ASSERT_TRUE(uri.portText.first == emptyHostWithPortUri
+ strlen("//:"));
- TEST_ASSERT(uri.portText.afterLast == uri.portText.first
+ ASSERT_TRUE(uri.portText.afterLast == uri.portText.first
+ strlen("123"));
uriFreeUriMembersA(&uri);
// Non-empty host and port
const char * const hostWithPortUri = "//h:123";
- TEST_ASSERT(URI_SUCCESS == uriParseUriA(&state, hostWithPortUri));
- TEST_ASSERT(uri.hostText.first == hostWithPortUri + strlen("//"));
- TEST_ASSERT(uri.hostText.afterLast == uri.hostText.first
+ ASSERT_TRUE(URI_SUCCESS == uriParseUriA(&state, hostWithPortUri));
+ ASSERT_TRUE(uri.hostText.first == hostWithPortUri + strlen("//"));
+ ASSERT_TRUE(uri.hostText.afterLast == uri.hostText.first
+ strlen("h"));
- TEST_ASSERT(uri.portText.first == hostWithPortUri + strlen("//h:"));
- TEST_ASSERT(uri.portText.afterLast == uri.portText.first
+ ASSERT_TRUE(uri.portText.first == hostWithPortUri + strlen("//h:"));
+ ASSERT_TRUE(uri.portText.afterLast == uri.portText.first
+ strlen("123"));
uriFreeUriMembersA(&uri);
// Empty host, empty user info
const char * const emptyHostEmptyUserInfoUri = "//@";
- TEST_ASSERT(URI_SUCCESS == uriParseUriA(&state,
+ ASSERT_TRUE(URI_SUCCESS == uriParseUriA(&state,
emptyHostEmptyUserInfoUri));
- TEST_ASSERT(uri.userInfo.first == emptyHostEmptyUserInfoUri
+ ASSERT_TRUE(uri.userInfo.first == emptyHostEmptyUserInfoUri
+ strlen("//"));
- TEST_ASSERT(uri.userInfo.afterLast == uri.userInfo.first + 0);
- TEST_ASSERT(uri.hostText.first == emptyHostEmptyUserInfoUri
+ ASSERT_TRUE(uri.userInfo.afterLast == uri.userInfo.first + 0);
+ ASSERT_TRUE(uri.hostText.first == emptyHostEmptyUserInfoUri
+ strlen("//@"));
- TEST_ASSERT(uri.hostText.afterLast == uri.hostText.first + 0);
+ ASSERT_TRUE(uri.hostText.afterLast == uri.hostText.first + 0);
uriFreeUriMembersA(&uri);
// Non-empty host, empty user info
const char * const hostEmptyUserInfoUri = "//@h";
- TEST_ASSERT(URI_SUCCESS == uriParseUriA(&state, hostEmptyUserInfoUri));
- TEST_ASSERT(uri.userInfo.first == hostEmptyUserInfoUri + strlen("//"));
- TEST_ASSERT(uri.userInfo.afterLast == uri.userInfo.first + 0);
- TEST_ASSERT(uri.hostText.first == hostEmptyUserInfoUri
+ ASSERT_TRUE(URI_SUCCESS == uriParseUriA(&state, hostEmptyUserInfoUri));
+ ASSERT_TRUE(uri.userInfo.first == hostEmptyUserInfoUri + strlen("//"));
+ ASSERT_TRUE(uri.userInfo.afterLast == uri.userInfo.first + 0);
+ ASSERT_TRUE(uri.hostText.first == hostEmptyUserInfoUri
+ strlen("//@"));
- TEST_ASSERT(uri.hostText.afterLast == uri.hostText.first
+ ASSERT_TRUE(uri.hostText.afterLast == uri.hostText.first
+ strlen("h"));
uriFreeUriMembersA(&uri);
// Empty host, non-empty user info
const char * const emptyHostWithUserInfoUri = "//:@";
- TEST_ASSERT(URI_SUCCESS == uriParseUriA(&state,
+ ASSERT_TRUE(URI_SUCCESS == uriParseUriA(&state,
emptyHostWithUserInfoUri));
- TEST_ASSERT(uri.userInfo.first == emptyHostWithUserInfoUri
+ ASSERT_TRUE(uri.userInfo.first == emptyHostWithUserInfoUri
+ strlen("//"));
- TEST_ASSERT(uri.userInfo.afterLast == uri.userInfo.first + 1);
- TEST_ASSERT(uri.hostText.first == emptyHostWithUserInfoUri
+ ASSERT_TRUE(uri.userInfo.afterLast == uri.userInfo.first + 1);
+ ASSERT_TRUE(uri.hostText.first == emptyHostWithUserInfoUri
+ strlen("//:@"));
- TEST_ASSERT(uri.hostText.afterLast == uri.hostText.first + 0);
+ ASSERT_TRUE(uri.hostText.afterLast == uri.hostText.first + 0);
uriFreeUriMembersA(&uri);
// Exact case from issue #15
const char * const issue15Uri = "//:%aa@";
- TEST_ASSERT(URI_SUCCESS == uriParseUriA(&state, issue15Uri));
- TEST_ASSERT(uri.userInfo.first == issue15Uri + strlen("//"));
- TEST_ASSERT(uri.userInfo.afterLast == uri.userInfo.first
+ ASSERT_TRUE(URI_SUCCESS == uriParseUriA(&state, issue15Uri));
+ ASSERT_TRUE(uri.userInfo.first == issue15Uri + strlen("//"));
+ ASSERT_TRUE(uri.userInfo.afterLast == uri.userInfo.first
+ strlen(":%aa"));
- TEST_ASSERT(uri.hostText.first == issue15Uri + strlen("//:%aa@"));
- TEST_ASSERT(uri.hostText.afterLast == uri.hostText.first + 0);
+ ASSERT_TRUE(uri.hostText.first == issue15Uri + strlen("//:%aa@"));
+ ASSERT_TRUE(uri.hostText.afterLast == uri.hostText.first + 0);
uriFreeUriMembersA(&uri);
- }
+}
+namespace {
void testCompareRangeHelper(const char * a, const char * b, int expected, bool avoidNullRange = true) {
UriTextRangeA ra;
UriTextRangeA rb;
@@ -1920,10 +1930,11 @@ Rule | Example | hostSet | absPath | emptySeg
printf("Comparing <%s> to <%s> yields %d, expected %d.\n",
a, b, received, expected);
}
- TEST_ASSERT(received == expected);
+ ASSERT_TRUE(received == expected);
}
+} // namespace
- void testRangeComparison() {
+TEST(UriSuite, TestRangeComparison) {
testCompareRangeHelper("", "", 0);
testCompareRangeHelper("a", "", 1);
testCompareRangeHelper("", "a", -1);
@@ -1947,8 +1958,9 @@ Rule | Example | hostSet | absPath | emptySeg
testCompareRangeHelper(NULL, "", -1, KEEP_NULL_RANGE);
testCompareRangeHelper("", NULL, 1, AVOID_NULL_RANGE);
testCompareRangeHelper("", NULL, 1, KEEP_NULL_RANGE);
- }
+}
+namespace {
void testRemoveBaseUriHelper(const char * expected,
const char * absSourceStr,
const char * absBaseStr) {
@@ -1958,28 +1970,33 @@ Rule | Example | hostSet | absPath | emptySeg
UriUriA dest;
state.uri = &absSource;
- TEST_ASSERT(uriParseUriA(&state, absSourceStr) == URI_SUCCESS);
+ ASSERT_TRUE(uriParseUriA(&state, absSourceStr) == URI_SUCCESS);
state.uri = &absBase;
- TEST_ASSERT(uriParseUriA(&state, absBaseStr) == URI_SUCCESS);
+ ASSERT_TRUE(uriParseUriA(&state, absBaseStr) == URI_SUCCESS);
- TEST_ASSERT(uriRemoveBaseUriA(&dest, &absSource, &absBase, URI_FALSE)
+ ASSERT_TRUE(uriRemoveBaseUriA(&dest, &absSource, &absBase, URI_FALSE)
== URI_SUCCESS);
int size = 0;
- TEST_ASSERT(uriToStringCharsRequiredA(&dest, &size) == URI_SUCCESS);
+ ASSERT_TRUE(uriToStringCharsRequiredA(&dest, &size) == URI_SUCCESS);
char * const buffer = (char *)malloc(size + 1);
- TEST_ASSERT(buffer);
- TEST_ASSERT(uriToStringA(buffer, &dest, size + 1, &size)
+ ASSERT_TRUE(buffer);
+ ASSERT_TRUE(uriToStringA(buffer, &dest, size + 1, &size)
== URI_SUCCESS);
if (strcmp(buffer, expected)) {
printf("Expected \"%s\" but got \"%s\"\n", expected, buffer);
- TEST_ASSERT(0);
+ ASSERT_TRUE(0);
}
free(buffer);
+
+ uriFreeUriMembersA(&absSource);
+ uriFreeUriMembersA(&absBase);
+ uriFreeUriMembersA(&dest);
}
+} // namespace
- void testRangeComparison_RemoveBaseUri_Issue19() {
+TEST(UriSuite, TestRangeComparisonRemoveBaseUriIssue19) {
// scheme
testRemoveBaseUriHelper("scheme://host/source",
"scheme://host/source",
@@ -2022,15 +2039,77 @@ Rule | Example | hostSet | absPath | emptySeg
testRemoveBaseUriHelper("//example/x/abc",
"http://example/x/abc",
"http://example2/x/y/z");
- }
-};
+}
+
+TEST(UriParseSingleSuite, Success) {
+ UriUriA uri;
+
+ EXPECT_EQ(uriParseSingleUriA(&uri, "file:///home/user/song.mp3", NULL),
+ URI_SUCCESS);
+
+ uriFreeUriMembersA(&uri);
+}
+
+TEST(UriParseSingleSuite, ErrorSyntaxParseErrorSetsErrorPos) {
+ UriUriA uri;
+ const char * errorPos;
+ const char * const uriString = "abc{}def";
+
+ EXPECT_EQ(uriParseSingleUriA(&uri, uriString, &errorPos),
+ URI_ERROR_SYNTAX);
+ EXPECT_EQ(errorPos, uriString + strlen("abc"));
+
+ uriFreeUriMembersA(&uri);
+}
+
+TEST(UriParseSingleSuite, ErrorNullFirstDetected) {
+ UriUriA uri;
+ const char * errorPos;
+
+ EXPECT_EQ(uriParseSingleUriExA(&uri, NULL, "notnull", &errorPos),
+ URI_ERROR_NULL);
+}
+
+TEST(UriParseSingleSuite, ErrorNullAfterLastDetected) {
+ UriUriA uri;
+
+ EXPECT_EQ(uriParseSingleUriExA(&uri, "foo", NULL, NULL), URI_SUCCESS);
+
+ uriFreeUriMembersA(&uri);
+}
+
+TEST(UriParseSingleSuite, ErrorNullMemoryManagerDetected) {
+ UriUriA uri;
+ const char * errorPos;
+ const char * const uriString = "somethingwellformed";
+
+ EXPECT_EQ(uriParseSingleUriExMmA(&uri,
+ uriString,
+ uriString + strlen(uriString),
+ &errorPos, NULL), URI_SUCCESS);
+
+ EXPECT_EQ(uriFreeUriMembersMmA(&uri, NULL), URI_SUCCESS);
+}
+
+TEST(FreeUriMembersSuite, MultiFreeWorksFine) {
+ UriUriA uri;
+
+ EXPECT_EQ(uriParseSingleUriA(&uri, "file:///home/user/song.mp3", NULL),
+ URI_SUCCESS);
+
+ UriUriA uriBackup = uri;
+ EXPECT_EQ(memcmp(&uriBackup, &uri, sizeof(UriUriA)), 0);
+
+ uriFreeUriMembersA(&uri);
+
+ // Did some pointers change (to NULL)?
+ EXPECT_NE(memcmp(&uriBackup, &uri, sizeof(UriUriA)), 0);
+
+ uriFreeUriMembersA(&uri); // second time
+}
-int main() {
- Suite suite;
- suite.add(auto_ptr<Suite>(new UriSuite()));
- suite.add(auto_ptr<Suite>(new FourSuite()));
- suite.add(auto_ptr<Suite>(new VersionSuite()));
- TextOutput output(TextOutput::Verbose);
- return suite.run(output, false) ? 0 : 1;
+int main(int argc, char ** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
}
diff --git a/win32/Code_Blocks/test.cbp b/win32/Code_Blocks/test.cbp
index 85c7ca4..ec3cb5c 100644
--- a/win32/Code_Blocks/test.cbp
+++ b/win32/Code_Blocks/test.cbp
@@ -32,30 +32,7 @@
<Unit filename="..\..\include\uriparser\UriDefsConfig.h" />
<Unit filename="..\..\include\uriparser\UriDefsUnicode.h" />
<Unit filename="..\..\include\uriparser\UriIp4.h" />
- <Unit filename="..\CppTest\collectoroutput.cpp" />
- <Unit filename="..\CppTest\compileroutput.cpp" />
- <Unit filename="..\CppTest\cpptest-assert.h" />
- <Unit filename="..\CppTest\cpptest-collectoroutput.h" />
- <Unit filename="..\CppTest\cpptest-compileroutput.h" />
- <Unit filename="..\CppTest\cpptest-htmloutput.h" />
- <Unit filename="..\CppTest\cpptest-output.h" />
- <Unit filename="..\CppTest\cpptest-source.h" />
- <Unit filename="..\CppTest\cpptest-suite.h" />
- <Unit filename="..\CppTest\cpptest-textoutput.h" />
- <Unit filename="..\CppTest\cpptest-time.h" />
- <Unit filename="..\CppTest\cpptest.h" />
- <Unit filename="..\CppTest\htmloutput.cpp" />
- <Unit filename="..\CppTest\missing.cpp" />
- <Unit filename="..\CppTest\missing.h" />
- <Unit filename="..\CppTest\source.cpp" />
- <Unit filename="..\CppTest\suite.cpp" />
- <Unit filename="..\CppTest\textoutput.cpp" />
- <Unit filename="..\CppTest\time.cpp" />
- <Unit filename="..\CppTest\utils.cpp" />
- <Unit filename="..\CppTest\utils.h" />
- <Unit filename="..\CppTest\winconfig.h" />
<Unit filename="..\..\test\FourSuite.cpp" />
- <Unit filename="..\..\test\FourSuite.h" />
<Unit filename="..\..\test\test.cpp" />
<Extensions>
<code_completion />
diff --git a/win32/MinGW/Makefile b/win32/MinGW/Makefile
index 16e361d..09d929c 100644
--- a/win32/MinGW/Makefile
+++ b/win32/MinGW/Makefile
@@ -40,7 +40,6 @@
CFLAGS = -Wall -Wextra -O3 -s
TEST_DIR = ../../test
-CPP_TEST_DIR = ../CppTest
LIB_DIR = ../../src
INCLUDE_DIR = ../../include
WIN32_DIR = ..
@@ -49,8 +48,7 @@ CXX = g++
dos = $(subst /,\,$(1))
URIPARSER_OBJECTS := $(patsubst %.c,%.o,$(wildcard $(LIB_DIR)/*.c))
-TEST_OBJECTS := $(patsubst %.cpp,%.o,$(wildcard $(CPP_TEST_DIR)/*.cpp)) \
- $(patsubst %.cpp,%.o,$(wildcard $(TEST_DIR)/*.cpp))
+TEST_OBJECTS := $(patsubst %.cpp,%.o,$(wildcard $(TEST_DIR)/*.cpp))
LIBRARY = $(WIN32_DIR)/liburiparser.a
TEST_SUITE = $(WIN32_DIR)/test.exe
diff --git a/win32/Visual_Studio_2005/test.vcproj b/win32/Visual_Studio_2005/test.vcproj
index 26086a2..4971e13 100644
--- a/win32/Visual_Studio_2005/test.vcproj
+++ b/win32/Visual_Studio_2005/test.vcproj
@@ -217,109 +217,9 @@
>
</File>
<File
- RelativePath="..\..\test\FourSuite.h"
- >
- </File>
- <File
RelativePath="..\..\test\test.cpp"
>
</File>
- <Filter
- Name="CppTest"
- >
- <File
- RelativePath="..\CppTest\collectoroutput.cpp"
- >
- </File>
- <File
- RelativePath="..\CppTest\compileroutput.cpp"
- >
- </File>
- <File
- RelativePath="..\CppTest\config.h"
- >
- </File>
- <File
- RelativePath="..\CppTest\cpptest-assert.h"
- >
- </File>
- <File
- RelativePath="..\CppTest\cpptest-collectoroutput.h"
- >
- </File>
- <File
- RelativePath="..\CppTest\cpptest-compileroutput.h"
- >
- </File>
- <File
- RelativePath="..\CppTest\cpptest-htmloutput.h"
- >
- </File>
- <File
- RelativePath="..\CppTest\cpptest-output.h"
- >
- </File>
- <File
- RelativePath="..\CppTest\cpptest-source.h"
- >
- </File>
- <File
- RelativePath="..\CppTest\cpptest-suite.h"
- >
- </File>
- <File
- RelativePath="..\CppTest\cpptest-textoutput.h"
- >
- </File>
- <File
- RelativePath="..\CppTest\cpptest-time.h"
- >
- </File>
- <File
- RelativePath="..\CppTest\cpptest.h"
- >
- </File>
- <File
- RelativePath="..\CppTest\htmloutput.cpp"
- >
- </File>
- <File
- RelativePath="..\CppTest\missing.cpp"
- >
- </File>
- <File
- RelativePath="..\CppTest\missing.h"
- >
- </File>
- <File
- RelativePath="..\CppTest\source.cpp"
- >
- </File>
- <File
- RelativePath="..\CppTest\suite.cpp"
- >
- </File>
- <File
- RelativePath="..\CppTest\textoutput.cpp"
- >
- </File>
- <File
- RelativePath="..\CppTest\time.cpp"
- >
- </File>
- <File
- RelativePath="..\CppTest\utils.cpp"
- >
- </File>
- <File
- RelativePath="..\CppTest\utils.h"
- >
- </File>
- <File
- RelativePath="..\CppTest\winconfig.h"
- >
- </File>
- </Filter>
</Filter>
</Files>
<Globals>