1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-18 04:19:55 +01:00

Define QT_STRICT_ITERATORS and fix the associated bugs.

This commit is contained in:
John Maguire 2011-06-20 15:08:06 +00:00
parent 9023aafdef
commit 6e86caae2c
5 changed files with 11 additions and 9 deletions

View File

@ -534,7 +534,7 @@ PythonQtObjectPtr PythonQt::lookupObject(PyObject* module, const QString& name)
PythonQtObjectPtr prev; PythonQtObjectPtr prev;
QString s; QString s;
QByteArray b; QByteArray b;
for (QStringList::ConstIterator i = l.begin(); i!=l.end() && p; ++i) { for (QStringList::ConstIterator i = l.constBegin(); i!=l.constEnd() && p; ++i) {
prev = p; prev = p;
b = (*i).toLatin1(); b = (*i).toLatin1();
if (PyDict_Check(p)) { if (PyDict_Check(p)) {

View File

@ -244,8 +244,8 @@ int PythonQtMethodInfo::nameToType(const char* name)
_parameterTypeDict.insert("QVariant", PythonQtMethodInfo::Variant); _parameterTypeDict.insert("QVariant", PythonQtMethodInfo::Variant);
// own special types... (none so far, could be e.g. ObjectList // own special types... (none so far, could be e.g. ObjectList
} }
QHash<QByteArray, int>::const_iterator it = _parameterTypeDict.find(name); QHash<QByteArray, int>::const_iterator it = _parameterTypeDict.constFind(name);
if (it!=_parameterTypeDict.end()) { if (it!=_parameterTypeDict.constEnd()) {
return it.value(); return it.value();
} else { } else {
return PythonQtMethodInfo::Unknown; return PythonQtMethodInfo::Unknown;

View File

@ -176,7 +176,7 @@ if (WIN32)
SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -o <OBJECT> <SOURCE> -I../../dist/windows") SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -o <OBJECT> <SOURCE> -I../../dist/windows")
endif(WIN32) endif(WIN32)
add_definitions(-DQT_NO_CAST_TO_ASCII) add_definitions(-DQT_NO_CAST_TO_ASCII -DQT_STRICT_ITERATORS)
# Translations stuff # Translations stuff
find_program(GETTEXT_XGETTEXT_EXECUTABLE xgettext) find_program(GETTEXT_XGETTEXT_EXECUTABLE xgettext)

View File

@ -134,7 +134,8 @@ QTextCodec* UniversalEncodingHandler::Guess(const TagLib::FileRef& fileref) {
return NULL; return NULL;
} }
QHash<QTextCodec*, int>::const_iterator max = std::max_element(usages.begin(), usages.end()); QHash<QTextCodec*, int>::const_iterator max =
std::max_element(usages.constBegin(), usages.constEnd());
return max.key(); return max.key();
} }
@ -174,8 +175,9 @@ QTextCodec* UniversalEncodingHandler::Guess(const Engine::SimpleMetaBundle& bund
++usages[Guess(bundle, &Engine::SimpleMetaBundle::genre)]; ++usages[Guess(bundle, &Engine::SimpleMetaBundle::genre)];
usages.remove(NULL); // Remove votes for ASCII. usages.remove(NULL); // Remove votes for ASCII.
QHash<QTextCodec*, int>::const_iterator max = std::max_element(usages.begin(), usages.end()); QHash<QTextCodec*, int>::const_iterator max =
if (max != usages.end()) { std::max_element(usages.constBegin(), usages.constEnd());
if (max != usages.constEnd()) {
return max.key(); return max.key();
} }
return NULL; return NULL;

View File

@ -568,9 +568,9 @@ void SpotifyService::SyncPlaylistProgress(
task_id = starred_sync_id_; task_id = starred_sync_id_;
break; break;
case protobuf::UserPlaylist: { case protobuf::UserPlaylist: {
QMap<int, int>::const_iterator it = playlist_sync_ids_.find( QMap<int, int>::const_iterator it = playlist_sync_ids_.constFind(
progress.request().user_playlist_index()); progress.request().user_playlist_index());
if (it != playlist_sync_ids_.end()) { if (it != playlist_sync_ids_.constEnd()) {
task_id = it.value(); task_id = it.value();
} }
break; break;