Commit 441c8dcc authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

combase: Implement WindowsTrimStringEnd.

parent 211b8b5f
......@@ -23,5 +23,5 @@
@ stdcall WindowsStringHasEmbeddedNull(ptr ptr) combase.WindowsStringHasEmbeddedNull
@ stdcall WindowsSubstring(ptr long ptr) combase.WindowsSubstring
@ stdcall WindowsSubstringWithSpecifiedLength(ptr long long ptr) combase.WindowsSubstringWithSpecifiedLength
@ stub WindowsTrimStringEnd
@ stdcall WindowsTrimStringEnd(ptr ptr ptr) combase.WindowsTrimStringEnd
@ stdcall WindowsTrimStringStart(ptr ptr ptr) combase.WindowsTrimStringStart
......@@ -304,5 +304,5 @@
@ stdcall WindowsStringHasEmbeddedNull(ptr ptr)
@ stdcall WindowsSubstring(ptr long ptr)
@ stdcall WindowsSubstringWithSpecifiedLength(ptr long long ptr)
@ stub WindowsTrimStringEnd
@ stdcall WindowsTrimStringEnd(ptr ptr ptr)
@ stdcall WindowsTrimStringStart(ptr ptr ptr)
......@@ -433,3 +433,30 @@ HRESULT WINAPI WindowsTrimStringStart(HSTRING str1, HSTRING str2, HSTRING *out)
return start ? WindowsCreateString(&priv1->buffer[start], priv1->length - start, out) :
WindowsDuplicateString(str1, out);
}
/***********************************************************************
* WindowsTrimStringEnd (combase.@)
*/
HRESULT WINAPI WindowsTrimStringEnd(HSTRING str1, HSTRING str2, HSTRING *out)
{
struct hstring_private *priv1 = impl_from_HSTRING(str1);
struct hstring_private *priv2 = impl_from_HSTRING(str2);
UINT32 len;
TRACE("(%p, %p, %p)\n", str1, str2, out);
if (!out || !str2 || !priv2->length)
return E_INVALIDARG;
if (!str1)
{
*out = NULL;
return S_OK;
}
for (len = priv1->length; len > 0; len--)
{
if (!memchrW(priv2->buffer, priv1->buffer[len - 1], priv2->length))
break;
}
return (len < priv1->length) ? WindowsCreateString(priv1->buffer, len, out) :
WindowsDuplicateString(str1, out);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment