Author: cwittich
Date: Mon Apr 5 11:29:01 2010
New Revision: 46727
URL:
http://svn.reactos.org/svn/reactos?rev=46727&view=rev
Log:
[crypt32]
sync crypt32 to wine 1.1.42
Modified:
trunk/reactos/dll/win32/crypt32/base64.c
Modified: trunk/reactos/dll/win32/crypt32/base64.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/crypt32/base64.c…
==============================================================================
--- trunk/reactos/dll/win32/crypt32/base64.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/crypt32/base64.c [iso-8859-1] Mon Apr 5 11:29:01 2010
@@ -99,8 +99,7 @@
TRACE("bytes is %d, pad bytes is %d\n", bytes, pad_bytes);
needed = bytes + pad_bytes + 1;
- if (sep)
- needed += (needed / 64 + 1) * strlen(sep);
+ needed += (needed / 64 + 1) * strlen(sep);
if (needed > *out_len)
{
@@ -117,7 +116,7 @@
i = 0;
while (div > 0)
{
- if (sep && i && i % 64 == 0)
+ if (i && i % 64 == 0)
{
strcpy(ptr, sep);
ptr += strlen(sep);
@@ -163,8 +162,7 @@
*ptr++ = '=';
break;
}
- if (sep)
- strcpy(ptr, sep);
+ strcpy(ptr, sep);
return ERROR_SUCCESS;
}
@@ -180,7 +178,7 @@
if (dwFlags & CRYPT_STRING_NOCR)
sep = lf;
else if (dwFlags & CRYPT_STRING_NOCRLF)
- sep = NULL;
+ sep = "";
else
sep = crlf;
switch (dwFlags & 0x0fffffff)
@@ -204,8 +202,6 @@
charsNeeded = 0;
encodeBase64A(pbBinary, cbBinary, sep, NULL, &charsNeeded);
- if (sep)
- charsNeeded += strlen(sep);
if (header)
charsNeeded += strlen(header) + strlen(sep);
if (trailer)
@@ -219,11 +215,8 @@
{
strcpy(ptr, header);
ptr += strlen(ptr);
- if (sep)
- {
- strcpy(ptr, sep);
- ptr += strlen(sep);
- }
+ strcpy(ptr, sep);
+ ptr += strlen(sep);
}
encodeBase64A(pbBinary, cbBinary, sep, ptr, &size);
ptr += size - 1;
@@ -231,11 +224,8 @@
{
strcpy(ptr, trailer);
ptr += strlen(ptr);
- if (sep)
- {
- strcpy(ptr, sep);
- ptr += strlen(sep);
- }
+ strcpy(ptr, sep);
+ ptr += strlen(sep);
}
*pcchString = charsNeeded - 1;
}
@@ -304,8 +294,7 @@
TRACE("bytes is %d, pad bytes is %d\n", bytes, pad_bytes);
needed = bytes + pad_bytes + 1;
- if (sep)
- needed += (needed / 64 + 1) * strlenW(sep);
+ needed += (needed / 64 + 1) * strlenW(sep);
if (needed > *out_len)
{
@@ -322,7 +311,7 @@
i = 0;
while (div > 0)
{
- if (sep && i && i % 64 == 0)
+ if (i && i % 64 == 0)
{
strcpyW(ptr, sep);
ptr += strlenW(sep);
@@ -368,8 +357,7 @@
*ptr++ = '=';
break;
}
- if (sep)
- strcpyW(ptr, sep);
+ strcpyW(ptr, sep);
return ERROR_SUCCESS;
}
@@ -377,7 +365,7 @@
static BOOL BinaryToBase64W(const BYTE *pbBinary,
DWORD cbBinary, DWORD dwFlags, LPWSTR pszString, DWORD *pcchString)
{
- static const WCHAR crlf[] = { '\r','\n',0 }, lf[] = { '\n',0
};
+ static const WCHAR crlf[] = { '\r','\n',0 }, lf[] = { '\n',0
}, empty[] = {0};
BOOL ret = TRUE;
LPCWSTR header = NULL, trailer = NULL, sep;
DWORD charsNeeded;
@@ -385,7 +373,7 @@
if (dwFlags & CRYPT_STRING_NOCR)
sep = lf;
else if (dwFlags & CRYPT_STRING_NOCRLF)
- sep = NULL;
+ sep = empty;
else
sep = crlf;
switch (dwFlags & 0x0fffffff)
@@ -409,8 +397,6 @@
charsNeeded = 0;
encodeBase64W(pbBinary, cbBinary, sep, NULL, &charsNeeded);
- if (sep)
- charsNeeded += strlenW(sep);
if (header)
charsNeeded += strlenW(header) + strlenW(sep);
if (trailer)
@@ -424,11 +410,8 @@
{
strcpyW(ptr, header);
ptr += strlenW(ptr);
- if (sep)
- {
- strcpyW(ptr, sep);
- ptr += strlenW(sep);
- }
+ strcpyW(ptr, sep);
+ ptr += strlenW(sep);
}
encodeBase64W(pbBinary, cbBinary, sep, ptr, &size);
ptr += size - 1;
@@ -436,11 +419,8 @@
{
strcpyW(ptr, trailer);
ptr += strlenW(ptr);
- if (sep)
- {
- strcpyW(ptr, sep);
- ptr += strlenW(sep);
- }
+ strcpyW(ptr, sep);
+ ptr += strlenW(sep);
}
*pcchString = charsNeeded - 1;
}