summaryrefslogtreecommitdiff
path: root/cpp/src/IceUtil/SHA1.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2014-08-21 14:06:19 -0230
committerDwayne Boone <dwayne@zeroc.com>2014-08-21 14:06:19 -0230
commit3748eebcad51c8dded194fdc9d998ca0c33218c3 (patch)
tree3e7c4cbbbe24549af2302016c2549181e28f9d96 /cpp/src/IceUtil/SHA1.cpp
parentRemoved some unecessary initialization of class members (diff)
downloadice-3748eebcad51c8dded194fdc9d998ca0c33218c3.tar.bz2
ice-3748eebcad51c8dded194fdc9d998ca0c33218c3.tar.xz
ice-3748eebcad51c8dded194fdc9d998ca0c33218c3.zip
Fixed WINRT build
Diffstat (limited to 'cpp/src/IceUtil/SHA1.cpp')
-rw-r--r--cpp/src/IceUtil/SHA1.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/cpp/src/IceUtil/SHA1.cpp b/cpp/src/IceUtil/SHA1.cpp
index 31a5e459fad..cfa9d70040b 100644
--- a/cpp/src/IceUtil/SHA1.cpp
+++ b/cpp/src/IceUtil/SHA1.cpp
@@ -32,8 +32,8 @@ IceUtil::SHA1::SHA1() :
{
throw IceUtil::SyscallException(__FILE__, __LINE__, GetLastError());
}
-
- if(!CryptCreateHash(_ctx, CALG_SHA1, 0, 0, &_hash))
+
+ if(!CryptCreateHash(_ctx, CALG_SHA1, 0, 0, &_hash))
{
throw IceUtil::SyscallException(__FILE__, __LINE__, GetLastError());
}
@@ -45,7 +45,7 @@ IceUtil::SHA1::~SHA1()
{
CryptDestroyHash(_hash);
}
-
+
if(_ctx)
{
CryptReleaseContext(_ctx, 0);
@@ -67,7 +67,7 @@ void
IceUtil::SHA1::update(const unsigned char* data, size_t length)
{
# if defined(_WIN32)
- if(!CryptHashData(_hash, data, static_cast<DWORD>(length), 0))
+ if(!CryptHashData(_hash, data, static_cast<DWORD>(length), 0))
{
throw IceUtil::SyscallException(__FILE__, __LINE__, GetLastError());
}
@@ -102,7 +102,8 @@ void
IceUtil::sha1(const unsigned char* data, size_t length, vector<unsigned char>& md)
{
#if defined(ICE_OS_WINRT)
- auto dataA = ref new Platform::Array<unsigned char>(const_cast<unsigned char*>(data), length);
+ auto dataA =
+ ref new Platform::Array<unsigned char>(const_cast<unsigned char*>(data), static_cast<unsigned int>(length));
auto hasher = Windows::Security::Cryptography::Core::HashAlgorithmProvider::OpenAlgorithm("SHA1");
auto hashed = hasher->HashData(Windows::Security::Cryptography::CryptographicBuffer::CreateFromByteArray(dataA));
auto reader = ::Windows::Storage::Streams::DataReader::FromBuffer(hashed);