| Uri.h | | Uri.h | |
| | | | |
| skipping to change at line 46 | | skipping to change at line 46 | |
| * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | |
| * OF THE POSSIBILITY OF SUCH DAMAGE. | | * OF THE POSSIBILITY OF SUCH DAMAGE. | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @file Uri.h | | * @file Uri.h | |
| * Holds the RFC 3986 %URI parser interface. | | * Holds the RFC 3986 %URI parser interface. | |
| * NOTE: This header includes itself twice. | | * NOTE: This header includes itself twice. | |
| */ | | */ | |
| | | | |
|
| #if (defined(URI_PASS_ANSI) && !defined(URI_TWICE_H_ANSI)) \ | | #if (defined(URI_PASS_ANSI) && !defined(URI_H_ANSI)) \ | |
| || (defined(URI_PASS_UNICODE) && !defined(URI_TWICE_H_UNICODE)) \ | | || (defined(URI_PASS_UNICODE) && !defined(URI_H_UNICODE)) \ | |
| || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE)) | | || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE)) | |
| /* What encodings are enabled? */ | | /* What encodings are enabled? */ | |
| #include "UriDefsConfig.h" | | #include "UriDefsConfig.h" | |
| #if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE)) | | #if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE)) | |
| /* Include SELF twice */ | | /* Include SELF twice */ | |
| # define URI_PASS_ANSI 1 | | # define URI_PASS_ANSI 1 | |
| # include "Uri.h" | | # include "Uri.h" | |
| # undef URI_PASS_ANSI | | # undef URI_PASS_ANSI | |
| # define URI_PASS_UNICODE 1 | | # define URI_PASS_UNICODE 1 | |
| # include "Uri.h" | | # include "Uri.h" | |
| # undef URI_PASS_UNICODE | | # undef URI_PASS_UNICODE | |
| /* Only one pass for each encoding */ | | /* Only one pass for each encoding */ | |
|
| #elif (defined(URI_PASS_ANSI) && !defined(URI_TWICE_H_ANSI) \ | | #elif (defined(URI_PASS_ANSI) && !defined(URI_H_ANSI) \ | |
| && defined(URI_ENABLE_ANSI)) || (defined(URI_PASS_UNICODE) \ | | && defined(URI_ENABLE_ANSI)) || (defined(URI_PASS_UNICODE) \ | |
|
| && !defined(URI_TWICE_H_UNICODE) && defined(URI_ENABLE_UNICODE)) | | && !defined(URI_H_UNICODE) && defined(URI_ENABLE_UNICODE)) | |
| # ifdef URI_PASS_ANSI | | # ifdef URI_PASS_ANSI | |
|
| # define URI_TWICE_H_ANSI 1 | | # define URI_H_ANSI 1 | |
| # include "UriDefsAnsi.h" | | # include "UriDefsAnsi.h" | |
| # else | | # else | |
|
| # define URI_TWICE_H_UNICODE 1 | | # define URI_H_UNICODE 1 | |
| # include "UriDefsUnicode.h" | | # include "UriDefsUnicode.h" | |
| # endif | | # endif | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| #ifndef URI_DOXYGEN | | #ifndef URI_DOXYGEN | |
| # include "UriBase.h" | | # include "UriBase.h" | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 129 | | skipping to change at line 129 | |
| URI_TYPE(TextRange) scheme; /**< Scheme (e.g. "http") */ | | URI_TYPE(TextRange) scheme; /**< Scheme (e.g. "http") */ | |
| URI_TYPE(TextRange) userInfo; /**< User info (e.g. "user:pass") */ | | URI_TYPE(TextRange) userInfo; /**< User info (e.g. "user:pass") */ | |
| URI_TYPE(TextRange) hostText; /**< Host text (set for all hosts, exc
luding square brackets) */ | | URI_TYPE(TextRange) hostText; /**< Host text (set for all hosts, exc
luding square brackets) */ | |
| URI_TYPE(HostData) hostData; /**< Structured host type specific data
*/ | | URI_TYPE(HostData) hostData; /**< Structured host type specific data
*/ | |
| URI_TYPE(TextRange) portText; /**< Port (e.g. "80") */ | | URI_TYPE(TextRange) portText; /**< Port (e.g. "80") */ | |
| URI_TYPE(PathSegment) * pathHead; /**< Head of a linked list of path
segments */ | | URI_TYPE(PathSegment) * pathHead; /**< Head of a linked list of path
segments */ | |
| URI_TYPE(PathSegment) * pathTail; /**< Tail of the list behind pathH
ead */ | | URI_TYPE(PathSegment) * pathTail; /**< Tail of the list behind pathH
ead */ | |
| URI_TYPE(TextRange) query; /**< Query without leading "?" */ | | URI_TYPE(TextRange) query; /**< Query without leading "?" */ | |
| URI_TYPE(TextRange) fragment; /**< Query without leading "#" */ | | URI_TYPE(TextRange) fragment; /**< Query without leading "#" */ | |
| UriBool absolutePath; /**< Absolute path flag, meaningless if %URI i
s absolute */ | | UriBool absolutePath; /**< Absolute path flag, meaningless if %URI i
s absolute */ | |
|
| | | UriBool owner; /**< Memory owner flag */ | |
| | | | |
|
| /* TODO reserved deep copy flag? */ | | void * reserved; /**< Reserved to the parser */ | |
| } URI_TYPE(Uri); | | } URI_TYPE(Uri); | |
| | | | |
| /** | | /** | |
| * Represents a state of the %URI parser. | | * Represents a state of the %URI parser. | |
| * Missing components can be NULL to reflect | | * Missing components can be NULL to reflect | |
| * a components absence. | | * a components absence. | |
| */ | | */ | |
| typedef struct URI_TYPE(ParserStateStruct) { | | typedef struct URI_TYPE(ParserStateStruct) { | |
| URI_TYPE(Uri) * uri; /**< Plug in the %URI structure to be filled wh
ile parsing here */ | | URI_TYPE(Uri) * uri; /**< Plug in the %URI structure to be filled wh
ile parsing here */ | |
| int errorCode; /**< Code identifying the occured error */ | | int errorCode; /**< Code identifying the occured error */ | |
| const URI_CHAR * errorPos; /**< Pointer to position in case of a syn
tax error */ | | const URI_CHAR * errorPos; /**< Pointer to position in case of a syn
tax error */ | |
| | | | |
| void * reserved; /**< Reserved to the parser */ | | void * reserved; /**< Reserved to the parser */ | |
| } URI_TYPE(ParserState); | | } URI_TYPE(ParserState); | |
| | | | |
| /** | | /** | |
| * Parses a RFC 3986 URI. | | * Parses a RFC 3986 URI. | |
| * | | * | |
|
| * @param state Parser state with set output %URI, must not | | * @param state Parser state with set output %URI, must not be NULL | |
| be NULL | | * @param first Pointer to the first character to parse, must not be | |
| * @param first Pointer to the first character to parse, mus | | NULL | |
| t not be NULL | | * @param afterLast Pointer to the character after the last to parse, mus | |
| * @param afterLast Pointer to the character after the last to parse, mu | | t not be NULL | |
| st not be NULL | | * @return 0 on success, error code otherwise | |
| * @return 0 on success, error code otherwise | | | |
| */ | | */ | |
| int URI_FUNC(ParseUriEx)(URI_TYPE(ParserState) * state, | | int URI_FUNC(ParseUriEx)(URI_TYPE(ParserState) * state, | |
| const URI_CHAR * first, const URI_CHAR * afterLast); | | const URI_CHAR * first, const URI_CHAR * afterLast); | |
| | | | |
| /** | | /** | |
| * Parses a RFC 3986 %URI. | | * Parses a RFC 3986 %URI. | |
| * | | * | |
|
| * @param state Parser state with set output %URI, must not | | * @param state Parser state with set output %URI, must not be NULL | |
| be NULL | | * @param text Text to parse, must not be NULL | |
| * @param text Text to parse, must not be NULL | | * @return 0 on success, error code otherwise | |
| * @return 0 on success, error code otherwise | | | |
| */ | | */ | |
| int URI_FUNC(ParseUri)(URI_TYPE(ParserState) * state, | | int URI_FUNC(ParseUri)(URI_TYPE(ParserState) * state, | |
| const URI_CHAR * text); | | const URI_CHAR * text); | |
| | | | |
| /** | | /** | |
| * Frees all memory associated with the members | | * Frees all memory associated with the members | |
| * of the %URI structure. Note that the structure | | * of the %URI structure. Note that the structure | |
| * itself is not freed, only its members. | | * itself is not freed, only its members. | |
| * | | * | |
|
| * @param uri %URI structure whose members should be freed | | * @param uri %URI structure whose members should be freed | |
| */ | | */ | |
| void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri); | | void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri); | |
| | | | |
| /** | | /** | |
|
| | | * 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 | |
| | | * the output buffer for <c>normalizeBreaks == URI_FALSE</c> and <b>6 times | |
| | | </b> | |
| | | * the space for <c>normalizeBreaks == URI_FALSE</c> | |
| | | * (since e.g. "\x0d" becomes "%0D%0A" in that case) | |
| | | * | |
| | | * @param in Text source | |
| | | * @param out Encoded text destination | |
| | | * @param spaceToPlus Wether to convert ' ' to '+' or not | |
| | | * @param normalizeBreaks Wether to convert CR and LF to CR-LF or not. | |
| | | * @return Position of terminator in output string | |
| | | */ | |
| | | const URI_CHAR * URI_FUNC(Escape)(const URI_CHAR * in, URI_CHAR * out, | |
| | | UriBool spaceToPlus, UriBool normalizeBreaks); | |
| | | | |
| | | /** | |
| * Unescapes percent-encoded groups in a given string. | | * Unescapes percent-encoded groups in a given string. | |
| * E.g. "%20" will become " ". Unescaping is done in place. | | * E.g. "%20" will become " ". Unescaping is done in place. | |
| * The return value will be point to the new position | | * The return value will be point to the new position | |
| * of the terminating zero. Use this value to get the new | | * of the terminating zero. Use this value to get the new | |
| * length of the string. NULL is only returned if <code>inout</code> | | * length of the string. NULL is only returned if <code>inout</code> | |
| * is NULL. | | * is NULL. | |
| * | | * | |
|
| * @param inout Text to unescape | | * @param inout Text to unescape/decode | |
| * @return Pointer to new position of the terminating zero | | * @param plusToSpace Whether to convert '+' to ' ' or not | |
| | | * @param breakConversion Line break conversion mode | |
| | | * @return Pointer to new position of the terminating zero | |
| | | */ | |
| | | const URI_CHAR * URI_FUNC(UnescapeInPlaceEx)(URI_CHAR * inout, | |
| | | UriBool plusToSpace, UriBreakConversion breakConversion); | |
| | | | |
| | | /** | |
| | | * Unescapes percent-encoded groups in a given string. | |
| | | * E.g. "%20" will become " ". Unescaping is done in place. | |
| | | * The return value will be point to the new position | |
| | | * of the terminating zero. Use this value to get the new | |
| | | * length of the string. NULL is only returned if <code>inout</code> | |
| | | * is NULL. | |
| | | * | |
| | | * NOTE: '+' is not decoded to ' ' and line breaks are not converted. | |
| | | * Use the more advanced UnescapeInPlaceEx for that features instead. | |
| | | * | |
| | | * @param inout Text to unescape/decode | |
| | | * @return Pointer to new position of the terminating zero | |
| */ | | */ | |
| const URI_CHAR * URI_FUNC(UnescapeInPlace)(URI_CHAR * inout); | | const URI_CHAR * URI_FUNC(UnescapeInPlace)(URI_CHAR * inout); | |
| | | | |
| /** | | /** | |
| * Performs reference resolution as described in | | * 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>. | | * <a href="http://tools.ietf.org/html/rfc3986#section-5.2.2">section 5.2.2
of RFC 3986</a>. | |
| * | | * | |
|
| * @param absoluteDest Result %URI | | * @param absoluteDest Result %URI | |
| * @param relativeSource Reference to resolve | | * @param relativeSource Reference to resolve | |
| * @param absoluteBase Base %URI to apply | | * @param absoluteBase Base %URI to apply | |
| * @return Error code or 0 on success | | * @return Error code or 0 on success | |
| */ | | */ | |
| int URI_FUNC(AddBaseUri)(URI_TYPE(Uri) * absoluteDest, | | int URI_FUNC(AddBaseUri)(URI_TYPE(Uri) * absoluteDest, | |
| const URI_TYPE(Uri) * relativeSource, | | const URI_TYPE(Uri) * relativeSource, | |
| const URI_TYPE(Uri) * absoluteBase); | | const URI_TYPE(Uri) * absoluteBase); | |
| | | | |
| /** | | /** | |
| * Checks two URIs for equivalence. Comparison is done | | * Checks two URIs for equivalence. Comparison is done | |
| * the naive way, without prior normalization. | | * the naive way, without prior normalization. | |
| * NOTE: Two <code>NULL</code> URIs are equal as well. | | * NOTE: Two <code>NULL</code> URIs are equal as well. | |
| * | | * | |
|
| * @param a First %URI | | * @param a First %URI | |
| * @param b Second %URI | | * @param b Second %URI | |
| * @return <code>URI_TRUE</code> when equal, <code>URI_FAlSE</c | | * @return <code>URI_TRUE</code> when equal, <code>URI_FAlSE</code> else | |
| ode> else | | | |
| */ | | */ | |
| UriBool URI_FUNC(EqualsUri)(const URI_TYPE(Uri) * a, const URI_TYPE(Uri) *
b); | | UriBool URI_FUNC(EqualsUri)(const URI_TYPE(Uri) * a, const URI_TYPE(Uri) *
b); | |
| | | | |
| /** | | /** | |
|
| | | * Calculates the number of characters needed to store the | |
| | | * string representation of the given %URI excluding the | |
| | | * terminator. | |
| | | * | |
| | | * @param uri %URI to measure | |
| | | * @param charsRequired Length of the string representation in characters | |
| | | <b>excluding</b> terminator | |
| | | * @return Error code or 0 on success | |
| | | */ | |
| | | int URI_FUNC(ToStringCharsRequired)(const URI_TYPE(Uri) * uri, | |
| | | int * charsRequired); | |
| | | | |
| | | /** | |
| * Converts a %URI structure back to text as described in | | * Converts a %URI structure back to text as described in | |
| * <a href="http://tools.ietf.org/html/rfc3986#section-5.3">section 5.3 of
RFC 3986</a>. | | * <a href="http://tools.ietf.org/html/rfc3986#section-5.3">section 5.3 of
RFC 3986</a>. | |
| * | | * | |
|
| * @param dest Output destination | | * @param dest Output destination | |
| * @param uri %URI to convert | | * @param uri %URI to convert | |
| * @param maxChars Maximum number of characters to copy includi | | * @param maxChars Maximum number of characters to copy <b>including< | |
| ng terminator | | /b> terminator | |
| * @param charsWritten Number of characters written, can be lower than maxC | | * @param charsWritten Number of characters written, can be lower than ma | |
| hars even if the %URI is too long! | | xChars even if the %URI is too long! | |
| * @return Error code or 0 on success | | * @return Error code or 0 on success | |
| */ | | */ | |
| int URI_FUNC(ToString)(URI_CHAR * dest, const URI_TYPE(Uri) * uri, int maxC
hars, int * charsWritten); | | int URI_FUNC(ToString)(URI_CHAR * dest, const URI_TYPE(Uri) * uri, int maxC
hars, int * charsWritten); | |
| | | | |
|
| | | /** | |
| | | * Determines the components of a %URI that are not normalized. | |
| | | * | |
| | | * @param uri %URI to check | |
| | | * @return Normalization job mask | |
| | | */ | |
| | | unsigned int URI_FUNC(NormalizeSyntaxMaskRequired)(const URI_TYPE(Uri) * ur | |
| | | i); | |
| | | | |
| | | /** | |
| | | * 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 %URI to normalize | |
| | | * @param mask Normalization mask | |
| | | * @return Error code or 0 on success | |
| | | */ | |
| | | int URI_FUNC(NormalizeSyntaxEx)(URI_TYPE(Uri) * uri, unsigned int mask); | |
| | | | |
| | | /** | |
| | | * 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. | |
| | | * | |
| | | * @param uri %URI to normalize | |
| | | * @return Error code or 0 on success | |
| | | */ | |
| | | int URI_FUNC(NormalizeSyntax)(URI_TYPE(Uri) * uri); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
End of changes. 17 change blocks. |
| 36 lines changed or deleted | | 117 lines changed or added | |
|
| UriBase.h | | UriBase.h | |
| | | | |
| skipping to change at line 53 | | skipping to change at line 53 | |
| */ | | */ | |
| | | | |
| #ifndef URI_BASE_H | | #ifndef URI_BASE_H | |
| #define URI_BASE_H 1 | | #define URI_BASE_H 1 | |
| | | | |
| /* Version helper macro */ | | /* Version helper macro */ | |
| #define URI_ANSI_TO_UNICODE(x) L##x | | #define URI_ANSI_TO_UNICODE(x) L##x | |
| | | | |
| /* Version */ | | /* Version */ | |
| #define URI_VER_MAJOR 0 | | #define URI_VER_MAJOR 0 | |
|
| #define URI_VER_MINOR 4 | | #define URI_VER_MINOR 5 | |
| #define URI_VER_RELEASE 1 | | #define URI_VER_RELEASE 0 | |
| #define URI_VER_SUFFIX_ANSI "" | | #define URI_VER_SUFFIX_ANSI "" | |
| #define URI_VER_SUFFIX_UNICODE URI_ANSI_TO_UNICODE(URI_VER_SUFFIX_ANSI) | | #define URI_VER_SUFFIX_UNICODE URI_ANSI_TO_UNICODE(URI_VER_SUFFIX_ANSI) | |
| | | | |
| /* More version helper macros */ | | /* More version helper macros */ | |
| #define URI_INT_TO_ANSI_HELPER(x) #x | | #define URI_INT_TO_ANSI_HELPER(x) #x | |
| #define URI_INT_TO_ANSI(x) URI_INT_TO_ANSI_HELPER(x) | | #define URI_INT_TO_ANSI(x) URI_INT_TO_ANSI_HELPER(x) | |
| | | | |
| #define URI_INT_TO_UNICODE_HELPER(x) URI_ANSI_TO_UNICODE(#x) | | #define URI_INT_TO_UNICODE_HELPER(x) URI_ANSI_TO_UNICODE(#x) | |
| #define URI_INT_TO_UNICODE(x) URI_INT_TO_UNICODE_HELPER(x) | | #define URI_INT_TO_UNICODE(x) URI_INT_TO_UNICODE_HELPER(x) | |
| | | | |
| | | | |
| skipping to change at line 88 | | skipping to change at line 88 | |
| #define URI_VER_ANSI URI_VER_ANSI_HELPER(URI_VER_MAJOR, URI_VER_MINOR,
URI_VER_RELEASE, URI_VER_SUFFIX_ANSI) | | #define URI_VER_ANSI URI_VER_ANSI_HELPER(URI_VER_MAJOR, URI_VER_MINOR,
URI_VER_RELEASE, URI_VER_SUFFIX_ANSI) | |
| #define URI_VER_UNICODE URI_VER_UNICODE_HELPER(URI_VER_MAJOR, URI_VER_MINO
R, URI_VER_RELEASE, URI_VER_SUFFIX_UNICODE) | | #define URI_VER_UNICODE URI_VER_UNICODE_HELPER(URI_VER_MAJOR, URI_VER_MINO
R, URI_VER_RELEASE, URI_VER_SUFFIX_UNICODE) | |
| | | | |
| /* Unused parameter macro */ | | /* Unused parameter macro */ | |
| #ifdef __GNUC__ | | #ifdef __GNUC__ | |
| # define URI_UNUSED(x) unused_##x __attribute__((unused)) | | # define URI_UNUSED(x) unused_##x __attribute__((unused)) | |
| #else | | #else | |
| # define URI_UNUSED(x) x | | # define URI_UNUSED(x) x | |
| #endif | | #endif | |
| | | | |
|
| typedef int UriBool; | | typedef int UriBool; /**< Boolean type */ | |
| | | | |
| #define URI_TRUE 1 | | #define URI_TRUE 1 | |
| #define URI_FALSE 0 | | #define URI_FALSE 0 | |
| | | | |
|
| /* Error codes */ | | /* Shared errors */ | |
| #define URI_SUCCESS 0 | | #define URI_SUCCESS 0 | |
| #define URI_ERROR_SYNTAX 1 | | #define URI_ERROR_SYNTAX 1 /* Parsed text violates expected for | |
| #define URI_ERROR_NULL 2 /* One of the params passed was NULL although | | mat */ | |
| it mustn't be */ | | #define URI_ERROR_NULL 2 /* One of the params passed was NULL | |
| #define URI_ERROR_MALLOC 3 /* Not used yet, TODO */ | | although it mustn't be */ | |
| | | #define URI_ERROR_MALLOC 3 /* Requested memory could not be all | |
| | | ocated */ | |
| | | | |
|
| #define URI_ERROR_TOSTRING_TOO_LONG 4 /* URI too long for target buffer | | /* Errors specific to ToSting */ | |
| */ | | #define URI_ERROR_TOSTRING_TOO_LONG 4 /* URI too long for target buffer */ | |
| | | | |
| | | /* Errors specific to AddBaseUri */ | |
| | | #define URI_ERROR_ADDBASE_REL_BASE 5 /* Given base is not absolute */ | |
| | | | |
| #ifndef URI_DOXYGEN | | #ifndef URI_DOXYGEN | |
|
| # include <stdio.h> /* For NULL, fprintf */ | | # include <stdio.h> /* For NULL, snprintf */ | |
| # include <ctype.h> /* For wchar_t */ | | # include <ctype.h> /* For wchar_t */ | |
| # include <string.h> /* For strlen, memset, memcpy */ | | # include <string.h> /* For strlen, memset, memcpy */ | |
| # include <stdlib.h> /* For malloc */ | | # include <stdlib.h> /* For malloc */ | |
| #endif /* URI_DOXYGEN */ | | #endif /* URI_DOXYGEN */ | |
| | | | |
| /** | | /** | |
| * Holds an IPv4 address. | | * Holds an IPv4 address. | |
| */ | | */ | |
| typedef struct UriIp4Struct { | | typedef struct UriIp4Struct { | |
| unsigned char data[4]; /**< Each octet in one byte */ | | unsigned char data[4]; /**< Each octet in one byte */ | |
| } UriIp4; | | } UriIp4; | |
| | | | |
| /** | | /** | |
| * Holds an IPv6 address. | | * Holds an IPv6 address. | |
| */ | | */ | |
| typedef struct UriIp6Struct { | | typedef struct UriIp6Struct { | |
| unsigned char data[16]; /**< Each quad in two bytes */ | | unsigned char data[16]; /**< Each quad in two bytes */ | |
| } UriIp6; | | } UriIp6; | |
| | | | |
|
| void uriWriteQuadToDoubleByte(const unsigned char * hexDigits, int digitCou | | /** | |
| nt, | | * Specifies a line break conversion mode | |
| unsigned char * output); | | */ | |
| unsigned char uriGetOctetValue(const unsigned char * digits, int digitCount | | typedef enum UriBreakConversionEnum { | |
| ); | | URI_BR_TO_LF, | |
| | | URI_BR_TO_CRLF, | |
| | | URI_BR_TO_CR, | |
| | | URI_BR_TO_UNIX = URI_BR_TO_LF, | |
| | | URI_BR_TO_WINDOWS = URI_BR_TO_CRLF, | |
| | | URI_BR_TO_MAC = URI_BR_TO_CR, | |
| | | URI_BR_DONT_TOUCH | |
| | | } UriBreakConversion; | |
| | | | |
| | | /** | |
| | | * Specifies which component of a %URI has to be normalized. | |
| | | */ | |
| | | typedef enum UriNormalizationMaskEnum { | |
| | | URI_NORMALIZED = 0, | |
| | | URI_NORMALIZE_SCHEME = 1 << 0, /* Because of uppercase letters */ | |
| | | URI_NORMALIZE_USER_INFO = 1 << 1, /* .. uppercase percent-encodings | |
| | | */ | |
| | | URI_NORMALIZE_HOST = 1 << 2, /* .. uppercase letters */ | |
| | | URI_NORMALIZE_PATH = 1 << 3, /* .. uppercase percent-encodings or do | |
| | | t segments */ | |
| | | URI_NORMALIZE_QUERY = 1 << 4, /* .. uppercase percent-encodings */ | |
| | | URI_NORMALIZE_FRAGMENT = 1 << 5 /* .. uppercase percent-encodings */ | |
| | | } UriNormalizationMask; | |
| | | | |
| #endif /* URI_BASE_H */ | | #endif /* URI_BASE_H */ | |
| | | | |
End of changes. 6 change blocks. |
| 17 lines changed or deleted | | 44 lines changed or added | |
|
| UriDefsConfig.h | | UriDefsConfig.h | |
| | | | |
| skipping to change at line 45 | | skipping to change at line 45 | |
| * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | |
| * OF THE POSSIBILITY OF SUCH DAMAGE. | | * OF THE POSSIBILITY OF SUCH DAMAGE. | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @file UriDefsConfig.h | | * @file UriDefsConfig.h | |
| * Adjusts the internal configuration after processing external definitions
. | | * Adjusts the internal configuration after processing external definitions
. | |
| */ | | */ | |
| | | | |
|
| #ifndef URI_CONFIG_H | | #ifndef URI_DEFS_CONFIG_H | |
| #define URI_CONFIG_H 1 | | #define URI_DEFS_CONFIG_H 1 | |
| | | | |
| /* Deny external overriding */ | | /* Deny external overriding */ | |
| #undef URI_ENABLE_ANSI /* Internal for !URI_NO_ANSI */ | | #undef URI_ENABLE_ANSI /* Internal for !URI_NO_ANSI */ | |
| #undef URI_ENABLE_UNICODE /* Internal for !URI_NO_UNICODE */ | | #undef URI_ENABLE_UNICODE /* Internal for !URI_NO_UNICODE */ | |
|
| #undef URI_ENABLE_LEGACY /* Internal for !URI_NO_LEGACY */ | | | |
| | | | |
| /* Encoding */ | | /* Encoding */ | |
| #ifdef URI_NO_ANSI | | #ifdef URI_NO_ANSI | |
|
| # ifndef URI_NO_LEGACY | | # ifdef URI_NO_UNICODE | |
| /* Deny legacy without ANSI */ | | | |
| # error URI_NO_ANSI cannot go without URI_NO_LEGACY. | | | |
| # else | | | |
| # ifdef URI_NO_UNICODE | | | |
| /* No encoding at all */ | | /* No encoding at all */ | |
|
| # error URI_NO_ANSI and URI_NO_UNICODE cannot go together. | | # error URI_NO_ANSI and URI_NO_UNICODE cannot go together. | |
| # else | | # else | |
| /* Unicode only */ | | /* Unicode only */ | |
|
| # define URI_ENABLE_UNICODE 1 | | # define URI_ENABLE_UNICODE 1 | |
| # endif | | | |
| # endif | | # endif | |
| #else | | #else | |
| # ifdef URI_NO_UNICODE | | # ifdef URI_NO_UNICODE | |
| /* ANSI only */ | | /* ANSI only */ | |
| # define URI_ENABLE_ANSI 1 | | # define URI_ENABLE_ANSI 1 | |
| # else | | # else | |
| /* Both ANSI and Unicode */ | | /* Both ANSI and Unicode */ | |
| # define URI_ENABLE_ANSI 1 | | # define URI_ENABLE_ANSI 1 | |
| # define URI_ENABLE_UNICODE 1 | | # define URI_ENABLE_UNICODE 1 | |
| # endif | | # endif | |
| #endif | | #endif | |
| | | | |
|
| /* Legacy */ | | | |
| #ifndef URI_NO_LEGACY | | | |
| # define URI_ENABLE_LEGACY 1 | | | |
| #endif | | | |
| | | | |
| /* Function inlining, not ANSI/ISO C! */ | | /* Function inlining, not ANSI/ISO C! */ | |
|
| #ifdef URI_DOXYGEN | | #if (defined(URI_DOXYGEN) || defined(URI_SIZEDOWN)) | |
| # define URI_INLINE | | # define URI_INLINE | |
| #elif defined(__INTEL_COMPILER) | | #elif defined(__INTEL_COMPILER) | |
| /* Intel C/C++ */ | | /* Intel C/C++ */ | |
| /* http://predef.sourceforge.net/precomp.html#sec20 */ | | /* http://predef.sourceforge.net/precomp.html#sec20 */ | |
| /* http://www.intel.com/support/performancetools/c/windows/sb/CS-007751.htm
#2 */ | | /* http://www.intel.com/support/performancetools/c/windows/sb/CS-007751.htm
#2 */ | |
| # define URI_INLINE __force_inline | | # define URI_INLINE __force_inline | |
| #elif defined(_MSC_VER) | | #elif defined(_MSC_VER) | |
| /* Microsoft Visual C++ */ | | /* Microsoft Visual C++ */ | |
| /* http://predef.sourceforge.net/precomp.html#sec32 */ | | /* http://predef.sourceforge.net/precomp.html#sec32 */ | |
| /* http://msdn2.microsoft.com/en-us/library/ms882281.aspx */ | | /* http://msdn2.microsoft.com/en-us/library/ms882281.aspx */ | |
| | | | |
| skipping to change at line 108 | | skipping to change at line 97 | |
| /* http://predef.sourceforge.net/precomp.html#sec13 */ | | /* http://predef.sourceforge.net/precomp.html#sec13 */ | |
| # define URI_INLINE __attribute__((always_inline)) | | # define URI_INLINE __attribute__((always_inline)) | |
| #elif (__STDC_VERSION__ >= 199901L) | | #elif (__STDC_VERSION__ >= 199901L) | |
| /* C99, "inline" is a keyword */ | | /* C99, "inline" is a keyword */ | |
| # define URI_INLINE inline | | # define URI_INLINE inline | |
| #else | | #else | |
| /* No inlining */ | | /* No inlining */ | |
| # define URI_INLINE | | # define URI_INLINE | |
| #endif | | #endif | |
| | | | |
|
| #endif /* URI_CONFIG_H */ | | #endif /* URI_DEFS_CONFIG_H */ | |
| | | | |
End of changes. 8 change blocks. |
| 18 lines changed or deleted | | 7 lines changed or added | |
|