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;
QString s;
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;
b = (*i).toLatin1();
if (PyDict_Check(p)) {

View File

@ -244,8 +244,8 @@ int PythonQtMethodInfo::nameToType(const char* name)
_parameterTypeDict.insert("QVariant", PythonQtMethodInfo::Variant);
// own special types... (none so far, could be e.g. ObjectList
}
QHash<QByteArray, int>::const_iterator it = _parameterTypeDict.find(name);
if (it!=_parameterTypeDict.end()) {
QHash<QByteArray, int>::const_iterator it = _parameterTypeDict.constFind(name);
if (it!=_parameterTypeDict.constEnd()) {
return it.value();
} else {
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")
endif(WIN32)
add_definitions(-DQT_NO_CAST_TO_ASCII)
add_definitions(-DQT_NO_CAST_TO_ASCII -DQT_STRICT_ITERATORS)
# Translations stuff
find_program(GETTEXT_XGETTEXT_EXECUTABLE xgettext)

View File

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

View File

@ -568,9 +568,9 @@ void SpotifyService::SyncPlaylistProgress(
task_id = starred_sync_id_;
break;
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());
if (it != playlist_sync_ids_.end()) {
if (it != playlist_sync_ids_.constEnd()) {
task_id = it.value();
}
break;