Alexandre Goujon <ale.goujon(a)gmail.com> writes:
@@ -181,6 +181,30 @@ static inline BSTR bstr_from_xmlChar(const xmlChar *str) return ret; }
+static inline BSTR bstr_trim(const BSTR str) +{ + UINT i, j, len = SysStringLen(str); + BSTR new_str = NULL; + + /* str empty or NULL */ + if(!len) + goto err; + + for(i=0; isspaceW(str[i]) && i<len; i++); + for(j=len-1; isspaceW(str[j]) && j>=i; j--); + + new_str = SysAllocStringLen(str+i, j-i+1); + if(!new_str) + goto err; + + SysFreeString(str); + return new_str; + + err: + SysFreeString(str); + return SysAllocStringLen(NULL, 0); +}
That's ugly and inefficient, especially since the common case is to not modify it. -- Alexandre Julliard julliard(a)winehq.org