Cast the long to int. Since the value is never greater than 2 bytes this is safe.

This commit is contained in:
Micke Prag 2012-12-05 13:59:31 +01:00
parent 5933cf104e
commit 630db4f483

View file

@ -98,8 +98,8 @@ DWORD WINAPI TelldusWinService::deviceNotificationHandler( DWORD controlCode, DW
}
std::wstring strPID = name.substr(posStart, posEnd-posStart);
long int vid = strtol(std::string(strVID.begin(), strVID.end()).c_str(), NULL, 16);
long int pid = strtol(std::string(strPID.begin(), strPID.end()).c_str(), NULL, 16);
int vid = static_cast<int>(strtol(std::string(strVID.begin(), strVID.end()).c_str(), NULL, 16));
int pid = static_cast<int>(strtol(std::string(strPID.begin(), strPID.end()).c_str(), NULL, 16));
if (dwEventType == DBT_DEVICEARRIVAL) {
tm->deviceInsertedOrRemoved(vid, pid, true);