some small fixes for #456
This commit is contained in:
parent
67e6dc281f
commit
2c8b10a0c2
18
src/studio.c
18
src/studio.c
|
@ -373,22 +373,17 @@ void str2buf(const char* str, s32 size, void* buf, bool flip)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeWhiteSpaces(char* str)
|
static void removeWhiteSpaces(char* str)
|
||||||
{
|
{
|
||||||
int i = 0;
|
s32 i = 0;
|
||||||
int len = strlen(str);
|
s32 len = strlen(str);
|
||||||
|
|
||||||
for (int j = 0; j < len; j++) {
|
for (s32 j = 0; j < len; j++)
|
||||||
if (!isspace(str[j])) {
|
if(!SDL_isspace(str[j]))
|
||||||
str[i] = str[j];
|
str[i++] = str[j];
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i < len - 1) {
|
|
||||||
str[i] = '\0';
|
str[i] = '\0';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool fromClipboard(void* data, s32 size, bool flip, bool remove_white_spaces)
|
bool fromClipboard(void* data, s32 size, bool flip, bool remove_white_spaces)
|
||||||
{
|
{
|
||||||
|
@ -403,7 +398,6 @@ bool fromClipboard(void* data, s32 size, bool flip, bool remove_white_spaces)
|
||||||
if (remove_white_spaces)
|
if (remove_white_spaces)
|
||||||
removeWhiteSpaces(clipboard);
|
removeWhiteSpaces(clipboard);
|
||||||
|
|
||||||
|
|
||||||
bool valid = strlen(clipboard) == size * 2;
|
bool valid = strlen(clipboard) == size * 2;
|
||||||
|
|
||||||
if(valid) str2buf(clipboard, strlen(clipboard), data, flip);
|
if(valid) str2buf(clipboard, strlen(clipboard), data, flip);
|
||||||
|
|
|
@ -154,7 +154,6 @@ void exitStudio();
|
||||||
u32 unzip(u8** dest, const u8* source, size_t size);
|
u32 unzip(u8** dest, const u8* source, size_t size);
|
||||||
|
|
||||||
void str2buf(const char* str, s32 size, void* buf, bool flip);
|
void str2buf(const char* str, s32 size, void* buf, bool flip);
|
||||||
void removeWhiteSpaces(char* str);
|
|
||||||
void toClipboard(const void* data, s32 size, bool flip);
|
void toClipboard(const void* data, s32 size, bool flip);
|
||||||
bool fromClipboard(void* data, s32 size, bool flip, bool remove_white_spaces);
|
bool fromClipboard(void* data, s32 size, bool flip, bool remove_white_spaces);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue