diff options
author | Jörg Frings-Fürst <debian@jff-webhsoting.net> | 2019-07-20 08:53:35 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhsoting.net> | 2019-07-20 08:53:35 +0200 |
commit | 63e6ffd8dd8412282e1beccb9a01e33aa57c13f0 (patch) | |
tree | f489a0246d74ed4b63c39eff4e6c72f9d5bd862a /src | |
parent | d289e0569e0317ffd228d8d0bf9f4a7a7a4fc41c (diff) | |
parent | 1bd65df2de001b173a8d6a08397043225ad115ad (diff) |
Merge branch 'release/debian/0.9.3-1'debian/0.9.3-1
Diffstat (limited to 'src')
-rw-r--r-- | src/UriConfig.h.in | 51 | ||||
-rw-r--r-- | src/UriFile.c | 6 | ||||
-rw-r--r-- | src/UriMemory.c | 8 | ||||
-rw-r--r-- | src/UriMemory.h | 21 | ||||
-rw-r--r-- | src/UriQuery.c | 2 |
5 files changed, 80 insertions, 8 deletions
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 <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. + */ + +#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 <stdlib.h> /* 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 <config.h> -#endif +#include <config.h> -#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 <uriparser/Uri.h> #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; |