mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 06:20:56 +00:00
combase: Implement WindowsTrimStringStart.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f3827dab8f
commit
211b8b5f61
|
@ -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
|
||||
|
|
|
@ -305,4 +305,4 @@
|
|||
@ stdcall WindowsSubstring(ptr long ptr)
|
||||
@ stdcall WindowsSubstringWithSpecifiedLength(ptr long long ptr)
|
||||
@ stub WindowsTrimStringEnd
|
||||
@ stub WindowsTrimStringStart
|
||||
@ stdcall WindowsTrimStringStart(ptr ptr ptr)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue