#ifndef URI_DOXYGEN # include <uriparser/Uri.h> # include "UriCommon.h" #endif /*extern*/ const URI_CHAR * const URI_FUNC(SafeToPointTo) = _UT("X"); /*extern*/ const URI_CHAR * const URI_FUNC(ConstPwd) = _UT("."); /*extern*/ const URI_CHAR * const URI_FUNC(ConstParent) = _UT(".."); void URI_FUNC(ResetUri)(URI_TYPE(Uri) * uri) { memset(uri, 0, sizeof(URI_TYPE(Uri))); } /* Compares two text ranges for equal text content */ int URI_FUNC(CompareRange)( const URI_TYPE(TextRange) * a, const URI_TYPE(TextRange) * b) { int diff; /* NOTE: Both NULL means equal! */ if ((a == NULL) || (b == NULL)) { return ((a == NULL) ? 0 : 1) - ((b == NULL) ? 0 : 1); }
#ifndef URI_DOXYGEN # include <uriparser/Uri.h> # include "UriCommon.h" #endif static int URI_FUNC(ComposeQueryEngine)(URI_CHAR * dest, const URI_TYPE(QueryList) * queryList, int maxChars, int * charsWritten, int * charsRequired, UriBool spaceToPlus, UriBool normalizeBreaks); 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); int URI_FUNC(ComposeQueryCharsRequired)(const URI_TYPE(QueryList) * queryList, int * charsRequired) { const UriBool spaceToPlus = URI_TRUE; const UriBool normalizeBreaks = URI_TRUE; return URI_FUNC(ComposeQueryCharsRequiredEx)(queryList, charsRequired, spaceToPlus, normalizeBreaks); }
# include <uriparser/UriDefsUnicode.h> # include <wchar.h> # endif #ifndef URI_DOXYGEN # include <uriparser/Uri.h> # include "UriCommon.h" #endif /* 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) { URI_TYPE(PathSegment) * sourceWalker; URI_TYPE(PathSegment) * destPrev; if (relAppend->pathHead == NULL) { return URI_TRUE; } /* 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))); if (dup == NULL) { return URI_FALSE; /* Raises malloc error */ } dup->next = NULL; absWork->pathHead = dup;
# include <uriparser/UriDefsAnsi.h> # else # include <uriparser/UriDefsUnicode.h> # include <wchar.h> # endif #ifndef URI_DOXYGEN # include <uriparser/Uri.h> # include "UriCommon.h" #endif static UriBool URI_FUNC(MergePath)(URI_TYPE(Uri) * absWork, const URI_TYPE(Uri) * relAppend); /* Appends a relative URI to an absolute. The last path segement of * the absolute URI is replaced. */ static URI_INLINE UriBool URI_FUNC(MergePath)(URI_TYPE(Uri) * absWork, const URI_TYPE(Uri) * relAppend) { URI_TYPE(PathSegment) * sourceWalker; URI_TYPE(PathSegment) * destPrev; if (relAppend->pathHead == NULL) { return URI_TRUE; } /* Replace last segment ("" if trailing slash) with first of append chain */ if (absWork->pathHead == NULL) {
# else # include <uriparser/UriDefsUnicode.h> # include <wchar.h> # endif #ifndef URI_DOXYGEN # include <uriparser/Uri.h> # include "UriNormalizeBase.h" # include "UriCommon.h" #endif static int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri, unsigned int inMask, unsigned int * outMask); static UriBool URI_FUNC(MakeRangeOwner)(unsigned int * doneMask, unsigned int maskTest, URI_TYPE(TextRange) * range); static UriBool URI_FUNC(MakeOwner)(URI_TYPE(Uri) * uri, unsigned int * doneMask); 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); static void URI_FUNC(FixPercentEncodingEngine)( const URI_CHAR * inFirst, const URI_CHAR * inAfterLast, const URI_CHAR * outFirst, const URI_CHAR ** outAfterLast);