1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2026-01-27 13:50:13 +03:00

v4.10-9505-beta

This commit is contained in:
dnobori
2014-10-04 00:09:23 +09:00
parent 16b713b98d
commit 10d4b2c43d
349 changed files with 2640 additions and 898 deletions

View File

@ -3025,6 +3025,83 @@ wchar_t *UniReplaceFormatStringFor64(wchar_t *fmt)
return ret;
}
// Get lines from a string
UNI_TOKEN_LIST *UniGetLines(wchar_t *str)
{
UINT i, len;
BUF *b = NULL;
LIST *o;
UNI_TOKEN_LIST *ret;
// Validate arguments
if (str == NULL)
{
return UniNullToken();
}
o = NewListFast(NULL);
len = UniStrLen(str);
b = NewBuf();
for (i = 0;i < len;i++)
{
wchar_t c = str[i];
bool f = false;
if (c == L'\r')
{
if (str[i + 1] == L'\n')
{
i++;
}
f = true;
}
else if (c == L'\n')
{
f = true;
}
if (f)
{
wchar_t zero = 0;
wchar_t *s;
WriteBuf(b, &zero, sizeof(wchar_t));
s = (wchar_t *)b->Buf;
Add(o, UniCopyStr(s));
ClearBuf(b);
}
else
{
WriteBuf(b, &c, sizeof(wchar_t));
}
}
if (true)
{
wchar_t zero = 0;
wchar_t *s;
WriteBuf(b, &zero, sizeof(wchar_t));
s = (wchar_t *)b->Buf;
Add(o, UniCopyStr(s));
ClearBuf(b);
}
FreeBuf(b);
ret = UniListToTokenList(o);
UniFreeStrList(o);
return ret;
}
// Display the string on the screen
void UniPrintStr(wchar_t *string)
{