libobs/util: Also remove CR/LF from dstr_depad
Prevents newline characters from being included in things like stream keys
This commit is contained in:
@@ -197,6 +197,11 @@ wchar_t *wstrstri(const wchar_t *str, const wchar_t *find)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline bool is_padding(char ch)
|
||||
{
|
||||
return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r';
|
||||
}
|
||||
|
||||
char *strdepad(char *str)
|
||||
{
|
||||
char *temp;
|
||||
@@ -210,7 +215,7 @@ char *strdepad(char *str)
|
||||
temp = str;
|
||||
|
||||
/* remove preceding spaces/tabs */
|
||||
while (*temp == ' ' || *temp == '\t')
|
||||
while (is_padding(*temp))
|
||||
++temp;
|
||||
|
||||
len = strlen(str);
|
||||
@@ -219,7 +224,7 @@ char *strdepad(char *str)
|
||||
|
||||
if (len) {
|
||||
temp = str + (len-1);
|
||||
while (*temp == ' ' || *temp == '\t')
|
||||
while (is_padding(*temp))
|
||||
*(temp--) = 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user