add widgets to periodic table
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
This commit is contained in:
parent
183e2b0e04
commit
d225f7cb72
9 changed files with 158 additions and 160 deletions
|
|
@ -4,36 +4,36 @@
|
|||
#define CP_UTF8 65001
|
||||
#endif
|
||||
|
||||
char* MwACPToUTF8(const char* input){
|
||||
char* MwACPToUTF8(const char* input) {
|
||||
#if defined(_WIN32) && defined(MW_HAS_WCHAR)
|
||||
int mbbytes = (strlen(input) + 1) * 4;
|
||||
int wbytes = 0;
|
||||
int wbytes = 0;
|
||||
int len;
|
||||
|
||||
wchar_t* wout;
|
||||
char* mbout = malloc(mbbytes);
|
||||
char* mbout = malloc(mbbytes);
|
||||
|
||||
wbytes = MultiByteToWideChar(CP_ACP, 0, input, strlen(input), NULL, 0) * sizeof(wchar_t);
|
||||
if(wbytes == 0){
|
||||
if(wbytes == 0) {
|
||||
free(mbout);
|
||||
return MwStringDuplicate(input);
|
||||
}
|
||||
|
||||
wout = malloc(wbytes);
|
||||
len = wbytes / sizeof(wchar_t);
|
||||
len = wbytes / sizeof(wchar_t);
|
||||
|
||||
memset(wout, 0, wbytes);
|
||||
memset(mbout, 0, mbbytes);
|
||||
|
||||
len = MultiByteToWideChar(CP_ACP, 0, input, strlen(input), wout, len);
|
||||
if(len == 0){
|
||||
if(len == 0) {
|
||||
free(mbout);
|
||||
free(wout);
|
||||
return MwStringDuplicate(input);
|
||||
}
|
||||
|
||||
|
||||
len = WideCharToMultiByte(CP_UTF8, 0, wout, len, mbout, mbbytes, 0, 0);
|
||||
if(len == 0){
|
||||
if(len == 0) {
|
||||
free(mbout);
|
||||
free(wout);
|
||||
return MwStringDuplicate(input);
|
||||
|
|
@ -46,39 +46,39 @@ char* MwACPToUTF8(const char* input){
|
|||
return mbout;
|
||||
#else
|
||||
return MwStringDuplicate(input);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
char* MwUTF8ToACP(const char* input){
|
||||
char* MwUTF8ToACP(const char* input) {
|
||||
#if defined(_WIN32) && defined(MW_HAS_WCHAR)
|
||||
int mbbytes = (strlen(input) + 1) * 4;
|
||||
int wbytes = 0;
|
||||
int wbytes = 0;
|
||||
int len;
|
||||
|
||||
wchar_t* wout;
|
||||
char* mbout = malloc(mbbytes);
|
||||
char* mbout = malloc(mbbytes);
|
||||
|
||||
wbytes = MultiByteToWideChar(CP_UTF8, 0, input, strlen(input), NULL, 0) * sizeof(wchar_t);
|
||||
if(wbytes == 0){
|
||||
if(wbytes == 0) {
|
||||
free(mbout);
|
||||
return MwStringDuplicate(input);
|
||||
}
|
||||
|
||||
wout = malloc(wbytes);
|
||||
len = wbytes / sizeof(wchar_t);
|
||||
len = wbytes / sizeof(wchar_t);
|
||||
|
||||
memset(wout, 0, wbytes);
|
||||
memset(mbout, 0, mbbytes);
|
||||
|
||||
len = MultiByteToWideChar(CP_UTF8, 0, input, strlen(input), wout, len);
|
||||
if(len == 0){
|
||||
if(len == 0) {
|
||||
free(mbout);
|
||||
free(wout);
|
||||
return MwStringDuplicate(input);
|
||||
}
|
||||
|
||||
|
||||
len = WideCharToMultiByte(CP_ACP, 0, wout, len, mbout, mbbytes, 0, 0);
|
||||
if(len == 0){
|
||||
if(len == 0) {
|
||||
free(mbout);
|
||||
free(wout);
|
||||
return MwStringDuplicate(input);
|
||||
|
|
@ -91,5 +91,5 @@ char* MwUTF8ToACP(const char* input){
|
|||
return mbout;
|
||||
#else
|
||||
return MwStringDuplicate(input);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue