build/stlport/src/string.cpp

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 #include "stlport_prefix.h"
     3 #include <string>
     5 _STLP_BEGIN_NAMESPACE
     7 #if defined(_STLP_USE_WIDE_INTERFACE)
     8 _STLP_MOVE_TO_PRIV_NAMESPACE
    10 wstring __ASCIIToWide(const char *ascii) {
    11     size_t size = strlen(ascii);
    12     wchar_t* buff = new wchar_t[size+1];
    13     mbstowcs(buff, ascii, size);
    14     buff[size] = 0x00;
    15     wstring ret(buff);
    16     delete[] buff;
    17     return ret;
    18 }
    19 string __WideToASCII(const wchar_t *wide) {
    20     size_t size = wcslen(wide);
    21     char* buff = new char[size+1];
    22     wcstombs(buff, wide, size);
    23     buff[size] = 0;
    24     string ret(buff);
    25     delete[] buff;
    26     return ret;
    27 }
    28 _STLP_MOVE_TO_STD_NAMESPACE
    29 #endif
    31 #if !defined (_STLP_NO_FORCE_INSTANTIATE)
    33 template class _STLP_CLASS_DECLSPEC allocator<char>;
    35 _STLP_MOVE_TO_PRIV_NAMESPACE
    37 template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<char*, char, allocator<char> >;
    38 template class _STLP_CLASS_DECLSPEC _String_base<char, allocator<char> >;
    40 #  if defined (_STLP_DEBUG) && !defined (__SUNPRO_CC) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
    41 #    define basic_string _STLP_NON_DBG_NAME(str)
    43 template class _STLP_CLASS_DECLSPEC basic_string<char, char_traits<char>, allocator<char> >;
    44 template class _STLP_CLASS_DECLSPEC __construct_checker<basic_string<char, char_traits<char>, allocator<char> > >;
    46 #    undef basic_string
    47 #  endif
    49 #  if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
    50 #    define basic_string _STLP_NO_MEM_T_NAME(str)
    51 #  else
    52 _STLP_MOVE_TO_STD_NAMESPACE
    53 #  endif
    55 template class _STLP_CLASS_DECLSPEC basic_string<char, char_traits<char>, allocator<char> >;
    57 #  if defined (basic_string)
    58 _STLP_MOVE_TO_STD_NAMESPACE
    59 #    undef basic_string
    60 #  endif
    62 #  if !defined (_STLP_NO_WCHAR_T)
    63 template class _STLP_CLASS_DECLSPEC allocator<wchar_t>;
    65 _STLP_MOVE_TO_PRIV_NAMESPACE
    67 template class _STLP_CLASS_DECLSPEC _String_base<wchar_t, allocator<wchar_t> >;
    69 #    if defined (_STLP_DEBUG) && !defined (__SUNPRO_CC) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
    70 #      define basic_string _STLP_NON_DBG_NAME(str)
    72 template class _STLP_CLASS_DECLSPEC basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
    73 template class _STLP_CLASS_DECLSPEC __construct_checker<basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > >;
    75 #      undef basic_string
    76 #    endif
    78 #    if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
    79 #      define basic_string _STLP_NO_MEM_T_NAME(str)
    80 #    else
    81 _STLP_MOVE_TO_STD_NAMESPACE
    82 #    endif
    84 template class _STLP_CLASS_DECLSPEC basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >;
    86 #    if defined (basic_string)
    87 _STLP_MOVE_TO_STD_NAMESPACE
    88 #      undef basic_string
    89 #    endif
    90 #  endif
    91 #endif
    93 _STLP_END_NAMESPACE

mercurial