From 18b915a47b259a36169a653a89250ba4eb02d6ce Mon Sep 17 00:00:00 2001 From: jp9000 Date: Sat, 11 Jul 2020 16:14:42 -0700 Subject: [PATCH] libobs/util: Use is_padding() for wcsdepad as well Fix wcsdepad so that it checks for padding in the same way strdepad does. --- libobs/util/dstr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libobs/util/dstr.c b/libobs/util/dstr.c index d1ee98233..c7890039a 100644 --- a/libobs/util/dstr.c +++ b/libobs/util/dstr.c @@ -197,7 +197,7 @@ wchar_t *wstrstri(const wchar_t *str, const wchar_t *find) return NULL; } -static inline bool is_padding(char ch) +static inline bool is_padding(int ch) { return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r'; } @@ -244,7 +244,7 @@ wchar_t *wcsdepad(wchar_t *str) temp = str; /* remove preceding spaces/tabs */ - while (*temp == ' ' || *temp == '\t') + while (is_padding(*temp)) ++temp; len = wcslen(temp); @@ -253,7 +253,7 @@ wchar_t *wcsdepad(wchar_t *str) if (len) { temp = str + (len - 1); - while (*temp == ' ' || *temp == '\t') + while (is_padding(*temp)) *(temp--) = 0; }