From 61dc2ca65959f92bec3a646c3fb81c23aaf4947f Mon Sep 17 00:00:00 2001
From: open-license-manager <rillf@maildrop.cc>
Date: 周一, 13 10月 2014 06:35:23 +0800
Subject: [PATCH] resolved warnings

---
 src/library/os/win/os-win.c                    |    7 ++++---
 src/tools/base_lib/win/CryptoHelperWindows.cpp |    8 +++-----
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/library/os/win/os-win.c b/src/library/os/win/os-win.c
index 10072f8..729f275 100644
--- a/src/library/os/win/os-win.c
+++ b/src/library/os/win/os-win.c
@@ -2,6 +2,7 @@
 #include <iphlpapi.h>
 //definition of size_t
 #include <stdlib.h>
+#include <stdio.h>
 //#include "../../base/base64.h"
 #include "../../base/logger.h"
 #include"../os.h"
@@ -182,7 +183,7 @@
 	DWORD dwHashLen;
 	DWORD dwHashLenSize = sizeof(DWORD);
 	char* hashStr;
-	int i;
+	unsigned int i;
 
 	if (CryptGetHashParam(*hHash, HP_HASHSIZE, (BYTE *) &dwHashLen,
 			&dwHashLenSize, 0)) {
@@ -257,7 +258,7 @@
 		return FUNC_RET_ERROR;
 	}
 
-	if (!CryptHashData(hHash, stringToVerify, strlen(stringToVerify), 0)) {
+	if (!CryptHashData(hHash, stringToVerify, (DWORD) strlen(stringToVerify), 0)) {
 		LOG_ERROR("Error in hashing data 0x%08x ", GetLastError());
 		CryptDestroyHash(hHash);
 		CryptReleaseContext(hProv, 0);
@@ -267,7 +268,7 @@
 	LOG_DEBUG("Lenght %d, hashed Data: [%s]", strlen(stringToVerify), stringToVerify);
 	printHash(&hHash);
 #endif
-	sigBlob = unbase64(signatureB64, strlen(signatureB64), &dwSigLen);
+	sigBlob = unbase64(signatureB64, (int) strlen(signatureB64), &dwSigLen);
 	LOG_DEBUG("raw signature lenght %d", dwSigLen);
 	if (!CryptVerifySignature(hHash, sigBlob, dwSigLen, hKey, NULL, 0)) {
 		LOG_ERROR("Signature not validated!  0x%08x ", GetLastError());
diff --git a/src/tools/base_lib/win/CryptoHelperWindows.cpp b/src/tools/base_lib/win/CryptoHelperWindows.cpp
index 8669926..cdef638 100644
--- a/src/tools/base_lib/win/CryptoHelperWindows.cpp
+++ b/src/tools/base_lib/win/CryptoHelperWindows.cpp
@@ -181,7 +181,7 @@
 	DWORD dwHashLen;
 	DWORD dwHashLenSize = sizeof(DWORD);
 	char* hashStr;
-	int i;
+	unsigned int i;
 
 	if (CryptGetHashParam(*hHash, HP_HASHSIZE, (BYTE *) &dwHashLen,
 			&dwHashLenSize, 0)) {
@@ -201,20 +201,18 @@
 const string CryptoHelperWindows::signString(const void* privateKey,
 		size_t pklen, const string& license) const {
 	BYTE *pbBuffer = (BYTE *) license.c_str();
-	DWORD dwBufferLen = strlen((char *) pbBuffer);
+	DWORD dwBufferLen = (DWORD)strlen((char *)pbBuffer);
 	HCRYPTHASH hHash;
 
 	HCRYPTKEY hKey;
-	BYTE *pbKeyBlob;
 	BYTE *pbSignature;
 	DWORD dwSigLen;
-	DWORD dwBlobLen;
 	DWORD strLen;
 
 	//-------------------------------------------------------------------
 	// Acquire a cryptographic provider context handle.
 
-	if (!CryptImportKey(m_hCryptProv, (const BYTE *) privateKey, pklen, 0, 0,
+	if (!CryptImportKey(m_hCryptProv, (const BYTE *) privateKey, (DWORD) pklen, 0, 0,
 			&hKey)) {
 		throw logic_error(
 				string("Error in importing the PrivateKey ")

--
Gitblit v1.9.1