From 1a9f50fcbc79413ccc669349b682aa6a6ebb398b Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 13 Oct 2012 18:34:25 +0000 Subject: Twitter: folders restructurization git-svn-id: http://svn.miranda-ng.org/main/trunk@1909 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Twitter/StringConv.cpp | 87 ---------------------------------------- 1 file changed, 87 deletions(-) delete mode 100644 protocols/Twitter/StringConv.cpp (limited to 'protocols/Twitter/StringConv.cpp') diff --git a/protocols/Twitter/StringConv.cpp b/protocols/Twitter/StringConv.cpp deleted file mode 100644 index c0e4f9221c..0000000000 --- a/protocols/Twitter/StringConv.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - -Copyright (c) 2010 Brook Miles - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -*/ - -#include -#include -#include "StringConv.h" - -std::string WideToMB(const std::wstring& str, UINT codePage) -{ - std::string ret; - if(str.length() > 0) - { - DWORD mbChars = WideCharToMultiByte(codePage, 0, str.c_str(), -1, NULL, 0, NULL, NULL); - _ASSERTE(mbChars > 0); - if(mbChars > 0) - { - char* buf = new char[mbChars]; - _ASSERTE( buf != NULL ); - if( buf != NULL ) - { - ZeroMemory(buf, mbChars); - - DWORD charsConverted = WideCharToMultiByte(codePage, 0, str.c_str(), -1, buf, mbChars, NULL, NULL); - _ASSERTE( charsConverted > 0 ); - _ASSERTE( charsConverted <= mbChars ); - - buf[mbChars - 1] = 0; - ret = buf; - - delete[] buf; - } - } - } - return ret; -} - -std::wstring MBToWide(const std::string& str, UINT codePage) -{ - std::wstring ret; - if(str.length() > 0) - { - DWORD wChars = MultiByteToWideChar(codePage, 0, str.c_str(), -1, NULL, 0); - _ASSERTE(wChars > 0); - if(wChars > 0) - { - wchar_t* buf = new wchar_t[wChars]; - _ASSERTE( buf != NULL ); - if( buf != NULL ) - { - size_t bytesNeeded = sizeof(wchar_t)*wChars; - ZeroMemory(buf, bytesNeeded); - - DWORD charsConverted = MultiByteToWideChar(codePage, 0, str.c_str(), -1, buf, wChars); - _ASSERTE( charsConverted > 0 ); - _ASSERTE( charsConverted <= wChars ); - - buf[wChars - 1] = 0; - ret = buf; - - delete[] buf; - } - } - } - return ret; -} - -- cgit v1.2.3