intl/icu/source/common/uinvchar.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /*
michael@0 2 *******************************************************************************
michael@0 3 *
michael@0 4 * Copyright (C) 1999-2010, International Business Machines
michael@0 5 * Corporation and others. All Rights Reserved.
michael@0 6 *
michael@0 7 *******************************************************************************
michael@0 8 * file name: uinvchar.h
michael@0 9 * encoding: US-ASCII
michael@0 10 * tab size: 8 (not used)
michael@0 11 * indentation:2
michael@0 12 *
michael@0 13 * created on: 2004sep14
michael@0 14 * created by: Markus W. Scherer
michael@0 15 *
michael@0 16 * Definitions for handling invariant characters, moved here from putil.c
michael@0 17 * for better modularization.
michael@0 18 */
michael@0 19
michael@0 20 #ifndef __UINVCHAR_H__
michael@0 21 #define __UINVCHAR_H__
michael@0 22
michael@0 23 #include "unicode/utypes.h"
michael@0 24
michael@0 25 /**
michael@0 26 * Check if a char string only contains invariant characters.
michael@0 27 * See utypes.h for details.
michael@0 28 *
michael@0 29 * @param s Input string pointer.
michael@0 30 * @param length Length of the string, can be -1 if NUL-terminated.
michael@0 31 * @return TRUE if s contains only invariant characters.
michael@0 32 *
michael@0 33 * @internal (ICU 2.8)
michael@0 34 */
michael@0 35 U_INTERNAL UBool U_EXPORT2
michael@0 36 uprv_isInvariantString(const char *s, int32_t length);
michael@0 37
michael@0 38 /**
michael@0 39 * Check if a Unicode string only contains invariant characters.
michael@0 40 * See utypes.h for details.
michael@0 41 *
michael@0 42 * @param s Input string pointer.
michael@0 43 * @param length Length of the string, can be -1 if NUL-terminated.
michael@0 44 * @return TRUE if s contains only invariant characters.
michael@0 45 *
michael@0 46 * @internal (ICU 2.8)
michael@0 47 */
michael@0 48 U_INTERNAL UBool U_EXPORT2
michael@0 49 uprv_isInvariantUString(const UChar *s, int32_t length);
michael@0 50
michael@0 51 /**
michael@0 52 * \def U_UPPER_ORDINAL
michael@0 53 * Get the ordinal number of an uppercase invariant character
michael@0 54 * @internal
michael@0 55 */
michael@0 56 #if U_CHARSET_FAMILY==U_ASCII_FAMILY
michael@0 57 # define U_UPPER_ORDINAL(x) ((x)-'A')
michael@0 58 #elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
michael@0 59 # define U_UPPER_ORDINAL(x) (((x) < 'J') ? ((x)-'A') : \
michael@0 60 (((x) < 'S') ? ((x)-'J'+9) : \
michael@0 61 ((x)-'S'+18)))
michael@0 62 #else
michael@0 63 # error Unknown charset family!
michael@0 64 #endif
michael@0 65
michael@0 66 /**
michael@0 67 * Compare two EBCDIC invariant-character strings in ASCII order.
michael@0 68 * @internal
michael@0 69 */
michael@0 70 U_INTERNAL int32_t U_EXPORT2
michael@0 71 uprv_compareInvEbcdicAsAscii(const char *s1, const char *s2);
michael@0 72
michael@0 73 /**
michael@0 74 * \def uprv_compareInvCharsAsAscii
michael@0 75 * Compare two invariant-character strings in ASCII order.
michael@0 76 * @internal
michael@0 77 */
michael@0 78 #if U_CHARSET_FAMILY==U_ASCII_FAMILY
michael@0 79 # define uprv_compareInvCharsAsAscii(s1, s2) uprv_strcmp(s1, s2)
michael@0 80 #elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
michael@0 81 # define uprv_compareInvCharsAsAscii(s1, s2) uprv_compareInvEbcdicAsAscii(s1, s2)
michael@0 82 #else
michael@0 83 # error Unknown charset family!
michael@0 84 #endif
michael@0 85
michael@0 86 /**
michael@0 87 * Converts an EBCDIC invariant character to lowercase ASCII.
michael@0 88 * @internal
michael@0 89 */
michael@0 90 U_INTERNAL char U_EXPORT2
michael@0 91 uprv_ebcdicToLowercaseAscii(char c);
michael@0 92
michael@0 93 /**
michael@0 94 * \def uprv_invCharToLowercaseAscii
michael@0 95 * Converts an invariant character to lowercase ASCII.
michael@0 96 * @internal
michael@0 97 */
michael@0 98 #if U_CHARSET_FAMILY==U_ASCII_FAMILY
michael@0 99 # define uprv_invCharToLowercaseAscii uprv_asciitolower
michael@0 100 #elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
michael@0 101 # define uprv_invCharToLowercaseAscii uprv_ebcdicToLowercaseAscii
michael@0 102 #else
michael@0 103 # error Unknown charset family!
michael@0 104 #endif
michael@0 105
michael@0 106 /**
michael@0 107 * Copy EBCDIC to ASCII
michael@0 108 * @internal
michael@0 109 * @see uprv_strncpy
michael@0 110 */
michael@0 111 U_INTERNAL uint8_t* U_EXPORT2
michael@0 112 uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n);
michael@0 113
michael@0 114
michael@0 115 /**
michael@0 116 * Copy ASCII to EBCDIC
michael@0 117 * @internal
michael@0 118 * @see uprv_strncpy
michael@0 119 */
michael@0 120 U_INTERNAL uint8_t* U_EXPORT2
michael@0 121 uprv_eastrncpy(uint8_t *dst, const uint8_t *src, int32_t n);
michael@0 122
michael@0 123
michael@0 124
michael@0 125 #endif

mercurial