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.

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

mercurial