2
ITmages upload client for Windows
3
Copyright (C) 2011 Dmitriy Simbiriatin <slpiv@itmages.ru>
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License
7
as published by the Free Software Foundation; either version 2
8
of the License, or (at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
#include "errorshandler.h"
23
wchar_t *AcpToWide(char *string)
25
int len = MultiByteToWideChar(CP_ACP, 0, string, -1, NULL, 0);
26
wchar_t *buffer = (wchar_t*) malloc(len * sizeof(wchar_t));
28
ErrorsHandler(ERROR_MEMALLOC);
31
MultiByteToWideChar(CP_ACP, 0, string, -1, buffer, len);
35
char *WideToAcp(wchar_t *string)
37
int len = WideCharToMultiByte(CP_ACP, 0, string, -1, NULL, 0, 0, 0);
38
char *buffer = (char*) malloc(len * sizeof(char));
40
ErrorsHandler(ERROR_MEMALLOC);
43
WideCharToMultiByte(CP_ACP, 0, string, -1, buffer, len, 0, 0);
47
wchar_t *Utf8ToWide(char *string)
49
int len = MultiByteToWideChar(CP_UTF8, 0, string, -1, NULL, 0);
50
wchar_t *buffer = (wchar_t*) malloc(len * sizeof(wchar_t));
52
ErrorsHandler(ERROR_MEMALLOC);
55
MultiByteToWideChar(CP_UTF8, 0, string, -1, buffer, len);
59
char *WideToUtf8(wchar_t *string)
61
int len = WideCharToMultiByte(CP_UTF8, 0, string, -1, NULL, 0, 0, 0);
62
char *buffer = (char*) malloc(len * sizeof(char));
64
ErrorsHandler(ERROR_MEMALLOC);
67
WideCharToMultiByte(CP_UTF8, 0, string, -1, buffer, len, 0, 0);