summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--Makefile.am2
-rw-r--r--Makefile.in2
-rw-r--r--THANKS5
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac2
-rw-r--r--doc/Makefile.am5
-rw-r--r--doc/Makefile.in5
-rwxr-xr-xdoc/release.sh.in6
-rw-r--r--include/uriparser/UriBase.h2
-rw-r--r--include/uriparser/UriDefsConfig.h4
-rw-r--r--src/UriCommon.c10
-rw-r--r--src/UriFile.c66
-rw-r--r--test/test.cpp2
-rw-r--r--win32/MinGW/Makefile14
15 files changed, 119 insertions, 41 deletions
diff --git a/ChangeLog b/ChangeLog
index cbb7320..364b223 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2015-04-27 -- 0.8.2
+
+ * Fixed: Broken conversion from/to Windows network shares (bug #21)
+ Thanks to Adam Gross and Dmitry Repkin!
+ * Fixed: Limit uriCompareRange return values to -1/0/1 (bug #24)
+ As a side effect, this fixes the test suite for AArch64.
+ Thanks to Marcin Juszkiewicz for the patch!
+ * Fixed: MinGW Makefile:
+ LIB_DIR fixed from ../../lib leftover to ../../src (bug #27)
+ Thanks to Dmytro Zagashev for the report!
+ * Fixed: Add missing NULL checks to UriStringToFilename (bug #25)
+ Thanks to Jerome Custodio for the report!
+ * Changed: Leave inlining decisions to GCC
+ * Soname: 1:18:0
+
2014-10-20 -- 0.8.1
* Fixed: Sync URI_VER_* preprocessor defines (were at 0.7.6, bug #23)
diff --git a/Makefile.am b/Makefile.am
index cf76386..40228de 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,7 +34,7 @@ pkginclude_HEADERS = \
include/uriparser/UriIp4.h
-liburiparser_la_LDFLAGS = -version-info 1:17:0
+liburiparser_la_LDFLAGS = -version-info 1:18:0
if WIN32
liburiparser_la_LDFLAGS += -no-undefined
endif
diff --git a/Makefile.in b/Makefile.in
index f0fec0f..630d769 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -374,7 +374,7 @@ pkginclude_HEADERS = \
include/uriparser/UriDefsUnicode.h \
include/uriparser/UriIp4.h
-liburiparser_la_LDFLAGS = -version-info 1:17:0 $(am__append_1)
+liburiparser_la_LDFLAGS = -version-info 1:18:0 $(am__append_1)
liburiparser_la_SOURCES = \
src/UriCommon.c \
src/UriCommon.h \
diff --git a/THANKS b/THANKS
index 4f4b2d2..83c5063 100644
--- a/THANKS
+++ b/THANKS
@@ -1,3 +1,4 @@
+Adam Gross
Adeodato Simó
Adrian Manrique
Arkadiusz Miskiewicz
@@ -6,6 +7,8 @@ Cristian Rodriguez
Daniel Chapiesky
Daniel Solano GĂłmez
Dennis Veatch
+Dmitry Repkin
+Dmytro Zagashev
Dr. Michael Lauer
Ed Schouten
Edward Z. Yang
@@ -13,8 +16,10 @@ Eren Türkay
Friedrich Delgado Friedrichs
Gary Mazzaferro
Harvey Vrsalovic
+Jerome Custodio
Juan Pablo González Tognarelli
Marc Novakowski
+Marcin Juszkiewicz
Martin Michlmayr
Michael Anthony Puls II
Michelino Chionchio
diff --git a/configure b/configure
index 2f2ee84..ad670fb 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for uriparser 0.8.1.
+# Generated by GNU Autoconf 2.69 for uriparser 0.8.2.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='uriparser'
PACKAGE_TARNAME='uriparser'
-PACKAGE_VERSION='0.8.1'
-PACKAGE_STRING='uriparser 0.8.1'
+PACKAGE_VERSION='0.8.2'
+PACKAGE_STRING='uriparser 0.8.2'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1338,7 +1338,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.1 to adapt to many kinds of systems.
+\`configure' configures uriparser 0.8.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1408,7 +1408,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of uriparser 0.8.1:";;
+ short | recursive ) echo "Configuration of uriparser 0.8.2:";;
esac
cat <<\_ACEOF
@@ -1531,7 +1531,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-uriparser configure 0.8.1
+uriparser configure 0.8.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1930,7 +1930,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.1, which was
+It was created by uriparser $as_me 0.8.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2745,7 +2745,7 @@ fi
# Define the identity of the package.
PACKAGE='uriparser'
- VERSION='0.8.1'
+ VERSION='0.8.2'
cat >>confdefs.h <<_ACEOF
@@ -16095,7 +16095,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.1, which was
+This file was extended by uriparser $as_me 0.8.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -16161,7 +16161,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-uriparser config.status 0.8.1
+uriparser config.status 0.8.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 49dde7a..a5a5ab6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_PREREQ(2.61)
-AC_INIT([uriparser], [0.8.1])
+AC_INIT([uriparser], [0.8.2])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([1.10.1 foreign dist-zip dist-bzip2 no-dist-gzip subdir-objects])
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 5814a0c..fb9e035 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -23,8 +23,9 @@ distclean-local:
## Install doc files
install-data-local:
- $(MKDIR_P) "$(DESTDIR)$(docdir)/html" ## Didn't work with installdirs-local
- $(INSTALL_DATA) html/*.{css,html,png} "$(DESTDIR)$(docdir)/html/"
+ $(MKDIR_P) "$(DESTDIR)$(docdir)/html/search" ## Didn't work with installdirs-local
+ $(INSTALL_DATA) html/*.css html/*.html html/*.js html/*.map html/*.md5 html/*.png "$(DESTDIR)$(docdir)/html/"
+ $(INSTALL_DATA) html/search/* "$(DESTDIR)$(docdir)/html/search/"
-$(INSTALL_DATA) *.qch "$(DESTDIR)$(docdir)/"
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 004da21..28ce99f 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -413,8 +413,9 @@ distclean-local:
rm -f config.{log,status} release.sh Doxyfile
install-data-local:
- $(MKDIR_P) "$(DESTDIR)$(docdir)/html" ## Didn't work with installdirs-local
- $(INSTALL_DATA) html/*.{css,html,png} "$(DESTDIR)$(docdir)/html/"
+ $(MKDIR_P) "$(DESTDIR)$(docdir)/html/search" ## Didn't work with installdirs-local
+ $(INSTALL_DATA) html/*.css html/*.html html/*.js html/*.map html/*.md5 html/*.png "$(DESTDIR)$(docdir)/html/"
+ $(INSTALL_DATA) html/search/* "$(DESTDIR)$(docdir)/html/search/"
-$(INSTALL_DATA) *.qch "$(DESTDIR)$(docdir)/"
uninstall-local:
diff --git a/doc/release.sh.in b/doc/release.sh.in
index e344b6b..d970773 100755
--- a/doc/release.sh.in
+++ b/doc/release.sh.in
@@ -12,13 +12,17 @@ rm -Rf "${distdir}" "${distdir}.zip"
"${MAKE}" || exit 1
# Copy
-mkdir -p "${distdir}/html"
+mkdir -p "${distdir}/html/search"
cp \
html/*.css \
html/*.html \
+ html/*.js \
+ html/*.map \
+ html/*.md5 \
html/*.png \
\
"${distdir}/html/" || exit 1
+cp -R html/search/ "${distdir}/html/" || exit 1
# Package
zip -r "${distdir}.zip" "${distdir}" || exit 1
diff --git a/include/uriparser/UriBase.h b/include/uriparser/UriBase.h
index 3c6615f..f98f6f0 100644
--- a/include/uriparser/UriBase.h
+++ b/include/uriparser/UriBase.h
@@ -55,7 +55,7 @@
/* Version */
#define URI_VER_MAJOR 0
#define URI_VER_MINOR 8
-#define URI_VER_RELEASE 1
+#define URI_VER_RELEASE 2
#define URI_VER_SUFFIX_ANSI ""
#define URI_VER_SUFFIX_UNICODE URI_ANSI_TO_UNICODE(URI_VER_SUFFIX_ANSI)
diff --git a/include/uriparser/UriDefsConfig.h b/include/uriparser/UriDefsConfig.h
index 5ca9989..d87ccb6 100644
--- a/include/uriparser/UriDefsConfig.h
+++ b/include/uriparser/UriDefsConfig.h
@@ -88,10 +88,6 @@
/* http://predef.sourceforge.net/precomp.html#sec32 */
/* http://msdn2.microsoft.com/en-us/library/ms882281.aspx */
# define URI_INLINE __forceinline
-#elif (__GNUC__ >= 4)
-/* GCC C/C++ 4.x.x */
-/* http://predef.sourceforge.net/precomp.html#sec13 */
-# define URI_INLINE __attribute__((always_inline))
#elif (__STDC_VERSION__ >= 199901L)
/* C99, "inline" is a keyword */
# define URI_INLINE inline
diff --git a/src/UriCommon.c b/src/UriCommon.c
index c50d89b..8b043f4 100644
--- a/src/UriCommon.c
+++ b/src/UriCommon.c
@@ -98,7 +98,15 @@ int URI_FUNC(CompareRange)(
return -1;
}
- return URI_STRNCMP(a->first, b->first, (a->afterLast - a->first));
+ diff = URI_STRNCMP(a->first, b->first, (a->afterLast - a->first));
+
+ if (diff > 0) {
+ return 1;
+ } else if (diff < 0) {
+ return -1;
+ }
+
+ return diff;
}
diff --git a/src/UriFile.c b/src/UriFile.c
index 0e57eea..9cf788f 100644
--- a/src/UriFile.c
+++ b/src/UriFile.c
@@ -73,16 +73,26 @@ static URI_INLINE int URI_FUNC(FilenameToUriString)(const URI_CHAR * filename,
const URI_CHAR * lastSep = input - 1;
UriBool firstSegment = URI_TRUE;
URI_CHAR * output = uriString;
- const UriBool absolute = (filename != NULL) && ((fromUnix && (filename[0] == _UT('/')))
- || (!fromUnix && (filename[0] != _UT('\0')) && (filename[1] == _UT(':'))));
+ UriBool absolute;
+ UriBool is_windows_network;
if ((filename == NULL) || (uriString == NULL)) {
return URI_ERROR_NULL;
}
+ is_windows_network = (filename[0] == _UT('\\')) && (filename[1] == _UT('\\'));
+ absolute = fromUnix
+ ? (filename[0] == _UT('/'))
+ : ((filename[0] != _UT('\0')) && (filename[1] == _UT(':'))
+ || is_windows_network);
+
if (absolute) {
- const URI_CHAR * const prefix = fromUnix ? _UT("file://") : _UT("file:///");
- const int prefixLen = fromUnix ? 7 : 8;
+ const URI_CHAR * const prefix = fromUnix
+ ? _UT("file://")
+ : is_windows_network
+ ? _UT("file:")
+ : _UT("file:///");
+ const int prefixLen = URI_STRLEN(prefix);
/* Copy prefix */
memcpy(uriString, prefix, prefixLen * sizeof(URI_CHAR));
@@ -133,19 +143,49 @@ static URI_INLINE int URI_FUNC(FilenameToUriString)(const URI_CHAR * filename,
static URI_INLINE int URI_FUNC(UriStringToFilename)(const URI_CHAR * uriString,
URI_CHAR * filename, UriBool toUnix) {
- const URI_CHAR * const prefix = toUnix ? _UT("file://") : _UT("file:///");
- const int prefixLen = toUnix ? 7 : 8;
- URI_CHAR * walker = filename;
- size_t charsToCopy;
- const UriBool absolute = (URI_STRNCMP(uriString, prefix, prefixLen) == 0);
- const int charsToSkip = (absolute ? prefixLen : 0);
+ if ((uriString == NULL) || (filename == NULL)) {
+ return URI_ERROR_NULL;
+ }
- charsToCopy = URI_STRLEN(uriString + charsToSkip) + 1;
- memcpy(filename, uriString + charsToSkip, charsToCopy * sizeof(URI_CHAR));
- URI_FUNC(UnescapeInPlaceEx)(filename, URI_FALSE, URI_BR_DONT_TOUCH);
+ {
+ const UriBool file_two_slashes =
+ URI_STRNCMP(uriString, _UT("file://"), URI_STRLEN(_UT("file://"))) == 0;
+ const UriBool file_three_slashes = file_two_slashes
+ && (URI_STRNCMP(uriString, _UT("file:///"), URI_STRLEN(_UT("file:///"))) == 0);
+
+ const size_t charsToSkip = file_two_slashes
+ ? file_three_slashes
+ ? toUnix
+ /* file:///bin/bash */
+ ? URI_STRLEN(_UT("file://"))
+ /* file:///E:/Documents%20and%20Settings */
+ : URI_STRLEN(_UT("file:///"))
+ /* file://Server01/Letter.txt */
+ : URI_STRLEN(_UT("file://"))
+ : 0;
+ const size_t charsToCopy = URI_STRLEN(uriString + charsToSkip) + 1;
+
+ const UriBool is_windows_network_with_authority =
+ (toUnix == URI_FALSE)
+ && file_two_slashes
+ && ! file_three_slashes;
+
+ URI_CHAR * const unescape_target = is_windows_network_with_authority
+ ? (filename + 2)
+ : filename;
+
+ if (is_windows_network_with_authority) {
+ filename[0] = '\\';
+ filename[1] = '\\';
+ }
+
+ memcpy(unescape_target, uriString + charsToSkip, charsToCopy * sizeof(URI_CHAR));
+ URI_FUNC(UnescapeInPlaceEx)(filename, URI_FALSE, URI_BR_DONT_TOUCH);
+ }
/* Convert forward slashes to backslashes */
if (!toUnix) {
+ URI_CHAR * walker = filename;
while (walker[0] != _UT('\0')) {
if (walker[0] == _UT('/')) {
walker[0] = _UT('\\');
diff --git a/test/test.cpp b/test/test.cpp
index 915532f..777f233 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -1548,6 +1548,8 @@ Rule | Example | hostSet | absPath | emptySeg
testFilenameUriConversionHelper(L"abc def", L"abc%20def", FOR_WINDOWS);
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() {
diff --git a/win32/MinGW/Makefile b/win32/MinGW/Makefile
index f570e7d..9dfd13f 100644
--- a/win32/MinGW/Makefile
+++ b/win32/MinGW/Makefile
@@ -41,7 +41,7 @@ CFLAGS = -Wall -Wextra -O3 -s
TEST_DIR = ../../test
CPP_TEST_DIR = ../CppTest
-LIB_DIR = ../../lib
+LIB_DIR = ../../src
INCLUDE_DIR = ../../include
WIN32_DIR = ..
CC = gcc
@@ -54,6 +54,8 @@ TEST_OBJECTS := $(patsubst %.cpp,%.o,$(wildcard $(CPP_TEST_DIR)/*.cpp)) \
LIBRARY = $(WIN32_DIR)/liburiparser.a
TEST_SUITE = $(WIN32_DIR)/test.exe
+all: $(LIBRARY)
+
$(LIBRARY): $(URIPARSER_OBJECTS)
ar rcs $(LIBRARY) $(URIPARSER_OBJECTS)
@@ -65,13 +67,17 @@ $(TEST_SUITE): $(LIBRARY) $(TEST_OBJECTS)
-L$(WIN32_DIR) -luriparser -o $(TEST_SUITE)
$(TEST_OBJECTS): %.o : %.cpp
- $(CXX) $(CFLAGS) -I$(INCLUDE_DIR) -c "$<" -o "$@"
-
-all: $(LIBRARY)
+ $(CXX) $(CFLAGS) -I$(INCLUDE_DIR) -c "$<" -o "$@"
clean:
del $(call dos,$(URIPARSER_OBJECTS)) $(call dos,$(LIBRARY)) \
$(call dos,$(TEST_OBJECTS)) $(call dos,$(TEST_SUITE))
+clean-unix:
+ $(RM) $(URIPARSER_OBJECTS) $(LIBRARY) \
+ $(TEST_OBJECTS) $(TEST_SUITE)
+
check: $(TEST_SUITE)
$(TEST_SUITE)
+
+.PHONY: all check clean clean-unix