build/stlport/src/string.cpp

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial