From 1920f1b489a54e8ab97a3e24b1bab64831e32b53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Fri, 26 Apr 2019 17:57:49 +0200 Subject: New upstream version 0.9.2 --- src/UriConfig.h.in | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/UriFile.c | 6 +++++- src/UriMemory.c | 8 +++----- src/UriMemory.h | 21 ++++++++++++++++++++- src/UriQuery.c | 2 +- 5 files changed, 80 insertions(+), 8 deletions(-) create mode 100644 src/UriConfig.h.in (limited to 'src') diff --git a/src/UriConfig.h.in b/src/UriConfig.h.in new file mode 100644 index 0000000..5d9742d --- /dev/null +++ b/src/UriConfig.h.in @@ -0,0 +1,51 @@ +/* + * uriparser - RFC 3986 URI parsing library + * + * Copyright (C) 2018, Sebastian Pipping + * 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 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. + */ + +#if !defined(URI_CONFIG_H) +# define URI_CONFIG_H 1 + + + +#define PACKAGE_VERSION "@PROJECT_VERSION@" + +#cmakedefine HAVE_WPRINTF +#cmakedefine HAVE_REALLOCARRAY + + + +#endif /* !defined(URI_CONFIG_H) */ diff --git a/src/UriFile.c b/src/UriFile.c index 303ee49..f69c5d8 100644 --- a/src/UriFile.c +++ b/src/UriFile.c @@ -67,6 +67,10 @@ +#include /* for size_t, avoiding stddef.h for older MSVCs */ + + + static URI_INLINE int URI_FUNC(FilenameToUriString)(const URI_CHAR * filename, URI_CHAR * uriString, UriBool fromUnix) { const URI_CHAR * input = filename; @@ -92,7 +96,7 @@ static URI_INLINE int URI_FUNC(FilenameToUriString)(const URI_CHAR * filename, : is_windows_network ? _UT("file:") : _UT("file:///"); - const int prefixLen = URI_STRLEN(prefix); + const size_t prefixLen = URI_STRLEN(prefix); /* Copy prefix */ memcpy(uriString, prefix, prefixLen * sizeof(URI_CHAR)); diff --git a/src/UriMemory.c b/src/UriMemory.c index 5e6bcc4..d942186 100644 --- a/src/UriMemory.c +++ b/src/UriMemory.c @@ -42,11 +42,9 @@ * Holds memory manager implementation. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include -#if HAVE_REALLOCARRAY +#ifdef HAVE_REALLOCARRAY # ifndef _GNU_SOURCE # define _GNU_SOURCE 1 # endif @@ -97,7 +95,7 @@ static void * uriDefaultRealloc(UriMemoryManager * URI_UNUSED(memory), static void * uriDefaultReallocarray(UriMemoryManager * URI_UNUSED(memory), void * ptr, size_t nmemb, size_t size) { -#if HAVE_REALLOCARRAY +#ifdef HAVE_REALLOCARRAY return reallocarray(ptr, nmemb, size); #else const size_t total_size = nmemb * size; diff --git a/src/UriMemory.h b/src/UriMemory.h index c40c072..86bf405 100644 --- a/src/UriMemory.h +++ b/src/UriMemory.h @@ -37,6 +37,11 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef URI_MEMORY_H +#define URI_MEMORY_H 1 + + + #ifndef URI_DOXYGEN # include #endif @@ -54,6 +59,20 @@ -extern UriMemoryManager defaultMemoryManager; +#ifdef __cplusplus +# define URIPARSER_EXTERN extern "C" +#else +# define URIPARSER_EXTERN extern +#endif + +URIPARSER_EXTERN UriMemoryManager defaultMemoryManager; + +#undef URIPARSER_EXTERN + + UriBool uriMemoryManagerIsComplete(const UriMemoryManager * memory); + + + +#endif /* URI_MEMORY_H */ diff --git a/src/UriQuery.c b/src/UriQuery.c index 326e963..58a9eac 100644 --- a/src/UriQuery.c +++ b/src/UriQuery.c @@ -110,7 +110,7 @@ int URI_FUNC(ComposeQueryCharsRequiredEx)(const URI_TYPE(QueryList) * queryList, int URI_FUNC(ComposeQuery)(URI_CHAR * dest, - const URI_TYPE(QueryList) * queryList, int maxChars, int * charsWritten) { + const URI_TYPE(QueryList) * queryList, int maxChars, int * charsWritten) { const UriBool spaceToPlus = URI_TRUE; const UriBool normalizeBreaks = URI_TRUE; -- cgit v1.2.3