Browse Source

libobs/util: Use is_padding() for wcsdepad as well

Fix wcsdepad so that it checks for padding in the same way strdepad
does.
jp9000 5 years ago
parent
commit
18b915a47b
1 changed files with 3 additions and 3 deletions
  1. 3 3
      libobs/util/dstr.c

+ 3 - 3
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;
 	}