From 5582c5f047c57caff5c1f6fc5b16a8b99e636b5e Mon Sep 17 00:00:00 2001 From: codestation Date: Tue, 24 Sep 2013 18:27:00 -0430 Subject: [PATCH] Fix negative values on pin --- cmaclient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmaclient.cpp b/cmaclient.cpp index 4401f64..35129cb 100644 --- a/cmaclient.cpp +++ b/cmaclient.cpp @@ -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); // 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); *p_err = 0; emit this_object->receivedPin(info->name, pin);