Browse Source

refactor: fix some warnings reported with "-Wall"

pull/4770/head
sudden6 8 years ago
parent
commit
d2adfe4ca7
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
  1. 7
      src/audio/backend/openal2.cpp
  2. 10
      src/friendlist.cpp
  3. 12
      src/friendlist.h
  4. 4
      src/widget/friendwidget.cpp
  5. 4
      src/widget/friendwidget.h
  6. 2
      src/widget/widget.cpp
  7. 2
      src/widget/widget.h

7
src/audio/backend/openal2.cpp

@ -308,7 +308,7 @@ void OpenAL2::doOutput() @@ -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() @@ -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

10
src/friendlist.cpp

@ -24,10 +24,10 @@ @@ -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) @@ -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) @@ -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()) {

12
src/friendlist.h

@ -20,6 +20,8 @@ @@ -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; @@ -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

4
src/widget/friendwidget.cpp

@ -374,7 +374,7 @@ void FriendWidget::resetEventFlags() @@ -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) @@ -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;

4
src/widget/friendwidget.h

@ -46,8 +46,8 @@ signals: @@ -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);

2
src/widget/widget.cpp

@ -968,7 +968,7 @@ void Widget::onCallEnd(uint32_t friendId) @@ -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());

2
src/widget/widget.h

@ -151,7 +151,7 @@ public slots: @@ -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);

Loading…
Cancel
Save