mirror of
https://github.com/DarkMatterCore/nxdumptool.git
synced 2024-11-10 04:31:44 +00:00
Tweaks to utilsReplaceIllegalCharacters.
We won't need to replace characters outside of the ASCII range for USB transfers.
This commit is contained in:
parent
298676ae46
commit
253e72786b
2 changed files with 3 additions and 14 deletions
|
@ -245,18 +245,7 @@ out:
|
|||
mutexUnlock(&g_logfileMutex);
|
||||
}
|
||||
|
||||
void removeIllegalCharacters(char *name)
|
||||
{
|
||||
if (!name || !strlen(name)) return;
|
||||
|
||||
u32 i, len = strlen(name);
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (memchr("?[]/\\=+<>:;\",*|^", name[i], sizeof("?[]/\\=+<>:;\",*|^") - 1) || name[i] < 0x20 || name[i] > 0x7E) name[i] = '_';
|
||||
}
|
||||
}
|
||||
|
||||
void utilsReplaceIllegalCharacters(char *str)
|
||||
void utilsReplaceIllegalCharacters(char *str, bool ascii_only)
|
||||
{
|
||||
size_t strsize = 0;
|
||||
|
||||
|
@ -264,7 +253,7 @@ void utilsReplaceIllegalCharacters(char *str)
|
|||
|
||||
for(size_t i = 0; i < strsize; i++)
|
||||
{
|
||||
if (memchr("?[]/\\=+<>:;\",*|^", str[i], sizeof("?[]/\\=+<>:;\",*|^") - 1) || str[i] < 0x20 || str[i] > 0x7E) str[i] = '_';
|
||||
if (memchr("?[]/\\=+<>:;\",*|^", str[i], sizeof("?[]/\\=+<>:;\",*|^") - 1) || str[i] < 0x20 || (!ascii_only && str[i] == 0x7F) || (ascii_only && str[i] >= 0x7F)) str[i] = '_';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ void utilsWaitForButtonPress(void);
|
|||
|
||||
void utilsWriteLogMessage(const char *func_name, const char *fmt, ...);
|
||||
|
||||
void utilsReplaceIllegalCharacters(char *str);
|
||||
void utilsReplaceIllegalCharacters(char *str, bool ascii_only);
|
||||
|
||||
void utilsTrimString(char *str);
|
||||
|
||||
|
|
Loading…
Reference in a new issue