QNX: Fix compiler warnings by using correct format specifiers

Also change qt_safe_read to use correct return value.

warning: format '%d' expects argument of type 'int',
but argument 3 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]

warning: format '%u' expects argument of type 'unsigned int',
but argument 3 has type 'ssize_t' {aka 'long int'} [-Wformat=]

Pick-to: 6.2 6.3
Task-number: QTBUG-101382
Change-Id: I1ee42b84a477451a98838c8cea3cca7c73f7cbaa
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
This commit is contained in:
Pasi Petäjäjärvi 2022-03-04 11:05:14 +02:00
parent 2edc0025fa
commit b680ae3442

View File

@ -134,7 +134,7 @@ bool QQnxVirtualKeyboardPps::connect()
m_buffer = new char[ms_bufferSize]; m_buffer = new char[ms_bufferSize];
if (Q_UNLIKELY(!m_buffer)) { if (Q_UNLIKELY(!m_buffer)) {
qCritical("QQnxVirtualKeyboard: Unable to allocate buffer of %d bytes. " qCritical("QQnxVirtualKeyboard: Unable to allocate buffer of %zu bytes. "
"Size is unavailable.", ms_bufferSize); "Size is unavailable.", ms_bufferSize);
return false; return false;
} }
@ -162,9 +162,9 @@ bool QQnxVirtualKeyboardPps::queryPPSInfo()
void QQnxVirtualKeyboardPps::ppsDataReady() void QQnxVirtualKeyboardPps::ppsDataReady()
{ {
ssize_t nread = qt_safe_read(m_fd, m_buffer, ms_bufferSize - 1); qint64 nread = qt_safe_read(m_fd, m_buffer, ms_bufferSize - 1);
qVirtualKeyboardDebug("keyboardMessage size: %zd", nread); qVirtualKeyboardDebug("keyboardMessage size: %lld", nread);
if (nread < 0){ if (nread < 0){
connect(); // reconnect connect(); // reconnect
return; return;
@ -177,7 +177,7 @@ void QQnxVirtualKeyboardPps::ppsDataReady()
// nread is the real space necessary, not the amount read. // nread is the real space necessary, not the amount read.
if (Q_UNLIKELY(static_cast<size_t>(nread) > ms_bufferSize - 1)) { if (Q_UNLIKELY(static_cast<size_t>(nread) > ms_bufferSize - 1)) {
qCritical("QQnxVirtualKeyboard: Keyboard buffer size too short; need %u.", nread + 1); qCritical("QQnxVirtualKeyboard: Keyboard buffer size too short; need %lld.", nread + 1);
connect(); // reconnect connect(); // reconnect
return; return;
} }