combase: Implement WindowsTrimStringStart.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Sebastian Lackner 2016-02-10 23:27:15 +01:00 committed by Alexandre Julliard
parent f3827dab8f
commit 211b8b5f61
3 changed files with 30 additions and 2 deletions

View File

@ -24,4 +24,4 @@
@ stdcall WindowsSubstring(ptr long ptr) combase.WindowsSubstring
@ stdcall WindowsSubstringWithSpecifiedLength(ptr long long ptr) combase.WindowsSubstringWithSpecifiedLength
@ stub WindowsTrimStringEnd
@ stub WindowsTrimStringStart
@ stdcall WindowsTrimStringStart(ptr ptr ptr) combase.WindowsTrimStringStart

View File

@ -305,4 +305,4 @@
@ stdcall WindowsSubstring(ptr long ptr)
@ stdcall WindowsSubstringWithSpecifiedLength(ptr long long ptr)
@ stub WindowsTrimStringEnd
@ stub WindowsTrimStringStart
@ stdcall WindowsTrimStringStart(ptr ptr ptr)

View File

@ -21,6 +21,7 @@
#include "windows.h"
#include "winerror.h"
#include "hstring.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(winstring);
@ -405,3 +406,30 @@ HRESULT WINAPI WindowsCompareStringOrdinal(HSTRING str1, HSTRING str2, INT32 *re
*res = CompareStringOrdinal(buf1, len1, buf2, len2, FALSE) - CSTR_EQUAL;
return S_OK;
}
/***********************************************************************
* WindowsTrimStringStart (combase.@)
*/
HRESULT WINAPI WindowsTrimStringStart(HSTRING str1, HSTRING str2, HSTRING *out)
{
struct hstring_private *priv1 = impl_from_HSTRING(str1);
struct hstring_private *priv2 = impl_from_HSTRING(str2);
UINT32 start;
TRACE("(%p, %p, %p)\n", str1, str2, out);
if (!out || !str2 || !priv2->length)
return E_INVALIDARG;
if (!str1)
{
*out = NULL;
return S_OK;
}
for (start = 0; start < priv1->length; start++)
{
if (!memchrW(priv2->buffer, priv1->buffer[start], priv2->length))
break;
}
return start ? WindowsCreateString(&priv1->buffer[start], priv1->length - start, out) :
WindowsDuplicateString(str1, out);
}