some small fixes for #456

This commit is contained in:
BADIM-PC\Vadim 2017-12-11 12:46:52 +03:00
parent 67e6dc281f
commit 2c8b10a0c2
2 changed files with 16 additions and 23 deletions

View File

@ -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;
int len = strlen(str);
s32 i = 0;
s32 len = strlen(str);
for (int j = 0; j < len; j++) {
if (!isspace(str[j])) {
str[i] = str[j];
i++;
}
}
for (s32 j = 0; j < len; j++)
if(!SDL_isspace(str[j]))
str[i++] = str[j];
if (i < len - 1) {
str[i] = '\0';
}
}
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)
removeWhiteSpaces(clipboard);
bool valid = strlen(clipboard) == size * 2;
if(valid) str2buf(clipboard, strlen(clipboard), data, flip);

View File

@ -154,7 +154,6 @@ void exitStudio();
u32 unzip(u8** dest, const u8* source, size_t size);
void str2buf(const char* str, s32 size, void* buf, bool flip);
void removeWhiteSpaces(char* str);
void toClipboard(const void* data, s32 size, bool flip);
bool fromClipboard(void* data, s32 size, bool flip, bool remove_white_spaces);