1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor: fix some warnings reported with "-Wall"

This commit is contained in:
sudden6 2017-10-27 13:52:06 +02:00
parent 2a15927a16
commit d2adfe4ca7
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
7 changed files with 21 additions and 20 deletions

View File

@ -308,7 +308,7 @@ void OpenAL2::doOutput()
alSourceUnqueueBuffers(alProxySource, processed, bufids);
// delete all but the first buffer, reuse first for new data
alDeleteBuffers(processed - 1, bufids + 1);
} else if (queued < PROXY_BUFFER_COUNT) {
} else if (queued < static_cast<ALint>(PROXY_BUFFER_COUNT)) {
// create new buffer until the maximum is reached
alGenBuffers(1, bufids);
} else {
@ -357,16 +357,15 @@ void OpenAL2::doInput()
{
ALint curSamples = 0;
alcGetIntegerv(alInDev, ALC_CAPTURE_SAMPLES, sizeof(curSamples), &curSamples);
if (curSamples < AUDIO_FRAME_SAMPLE_COUNT) {
if (curSamples < static_cast<ALint>(AUDIO_FRAME_SAMPLE_COUNT)) {
return;
}
int16_t buf[AUDIO_FRAME_SAMPLE_COUNT];
alcCaptureSamples(alInDev, buf, AUDIO_FRAME_SAMPLE_COUNT);
int retVal = 0;
if (echoCancelSupported && filterer) {
retVal = filter_audio(filterer, buf, AUDIO_FRAME_SAMPLE_COUNT);
filter_audio(filterer, buf, AUDIO_FRAME_SAMPLE_COUNT);
}
// gain amplification with clipping to 16-bit boundaries

View File

@ -24,10 +24,10 @@
#include <QHash>
#include <QMenu>
QHash<int, Friend*> FriendList::friendList;
QHash<QByteArray, int> FriendList::key2id;
QHash<uint32_t, Friend*> FriendList::friendList;
QHash<QByteArray, uint32_t> FriendList::key2id;
Friend* FriendList::addFriend(int friendId, const ToxPk& friendPk)
Friend* FriendList::addFriend(uint32_t friendId, const ToxPk& friendPk)
{
auto friendChecker = friendList.find(friendId);
if (friendChecker != friendList.end())
@ -41,7 +41,7 @@ Friend* FriendList::addFriend(int friendId, const ToxPk& friendPk)
return newfriend;
}
Friend* FriendList::findFriend(int friendId)
Friend* FriendList::findFriend(uint32_t friendId)
{
auto f_it = friendList.find(friendId);
if (f_it != friendList.end())
@ -50,7 +50,7 @@ Friend* FriendList::findFriend(int friendId)
return nullptr;
}
void FriendList::removeFriend(int friendId, bool fake)
void FriendList::removeFriend(uint32_t friendId, bool fake)
{
auto f_it = friendList.find(friendId);
if (f_it != friendList.end()) {

View File

@ -20,6 +20,8 @@
#ifndef FRIENDLIST_H
#define FRIENDLIST_H
#include <cstdint>
template <class T>
class QList;
template <class A, class B>
@ -31,16 +33,16 @@ class ToxPk;
class FriendList
{
public:
static Friend* addFriend(int friendId, const ToxPk& friendPk);
static Friend* findFriend(int friendId);
static Friend* addFriend(uint32_t friendId, const ToxPk& friendPk);
static Friend* findFriend(uint32_t friendId);
static Friend* findFriend(const ToxPk& friendPk);
static QList<Friend*> getAllFriends();
static void removeFriend(int friendId, bool fake = false);
static void removeFriend(uint32_t friendId, bool fake = false);
static void clear();
private:
static QHash<int, Friend*> friendList;
static QHash<QByteArray, int> key2id;
static QHash<uint32_t, Friend*> friendList;
static QHash<QByteArray, uint32_t> key2id;
};
#endif // FRIENDLIST_H

View File

@ -374,7 +374,7 @@ void FriendWidget::resetEventFlags()
f->setEventFlag(false);
}
void FriendWidget::onAvatarChange(int friendId, const QPixmap& pic)
void FriendWidget::onAvatarChange(uint32_t friendId, const QPixmap& pic)
{
if (friendId != frnd->getId()) {
return;
@ -384,7 +384,7 @@ void FriendWidget::onAvatarChange(int friendId, const QPixmap& pic)
avatar->setPixmap(pic);
}
void FriendWidget::onAvatarRemoved(int friendId)
void FriendWidget::onAvatarRemoved(uint32_t friendId)
{
if (friendId != frnd->getId()) {
return;

View File

@ -46,8 +46,8 @@ signals:
void contextMenuCalled(QContextMenuEvent* event);
public slots:
void onAvatarChange(int friendId, const QPixmap& pic);
void onAvatarRemoved(int friendId);
void onAvatarChange(uint32_t friendId, const QPixmap& pic);
void onAvatarRemoved(uint32_t friendId);
void setAlias(const QString& alias);
void onContextMenuCalled(QContextMenuEvent* event);

View File

@ -968,7 +968,7 @@ void Widget::onCallEnd(uint32_t friendId)
Audio::getInstance().stopLoop();
}
void Widget::addFriend(int friendId, const ToxPk& friendPk)
void Widget::addFriend(uint32_t friendId, const ToxPk& friendPk)
{
Settings& s = Settings::getInstance();
s.updateFriendAddress(friendPk.toString());

View File

@ -151,7 +151,7 @@ public slots:
void onSelfAvatarLoaded(const QPixmap& pic);
void setUsername(const QString& username);
void setStatusMessage(const QString& statusMessage);
void addFriend(int friendId, const ToxPk& friendPk);
void addFriend(uint32_t friendId, const ToxPk& friendPk);
void addFriendFailed(const ToxPk& userId, const QString& errorInfo = QString());
void onFriendStatusChanged(int friendId, Status status);
void onFriendStatusMessageChanged(int friendId, const QString& message);