Fix negative values on pin

This commit is contained in:
codestation
2013-09-24 18:27:00 -04:30
parent 269243d04d
commit 5582c5f047

View File

@@ -150,7 +150,7 @@ int CmaClient::generatePin(wireless_vita_info_t *info, int *p_err)
{ {
qDebug("Registration request from %s (MAC: %s)", info->name, info->mac_addr); qDebug("Registration request from %s (MAC: %s)", info->name, info->mac_addr);
// generate correct values on 32bit // generate correct values on 32bit
int pin = RAND_MAX * qrand() + qrand() % 100000000; int pin = ((qrand() << 16) | qrand()) % 100000000;
qDebug("Your registration PIN for %s is: %08d", info->name, pin); qDebug("Your registration PIN for %s is: %08d", info->name, pin);
*p_err = 0; *p_err = 0;
emit this_object->receivedPin(info->name, pin); emit this_object->receivedPin(info->name, pin);