add widgets to periodic table
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
Nishi 2026-04-24 02:23:25 +09:00
commit d225f7cb72
Signed by: nishi
GPG key ID: 27EF69B208EB9343
9 changed files with 158 additions and 160 deletions

View file

@ -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
}