Remove some dead code in switch statements

Following the Code Style described in
http://qt-project.org/wiki/Qt_Coding_Style#e289ee44592e9c32d4212069f0806daf

There is no need for a 'break' after a 'return'.

Change-Id: I1eca350391a7e4e14e504d60b24b69982cc5ac47
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Sergio Ahumada 2012-10-27 16:45:32 +02:00 committed by The Qt Project
parent e880ff9cae
commit 914e1f3608
13 changed files with 0 additions and 46 deletions

View File

@ -192,13 +192,10 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
case QVariant::ByteArray: case QVariant::ByteArray:
case QVariant::Color: case QVariant::Color:
return data.toByteArray(); return data.toByteArray();
break;
case QVariant::String: case QVariant::String:
return data.toString().toUtf8(); return data.toString().toUtf8();
break;
case QVariant::Url: case QVariant::Url:
return data.toUrl().toEncoded(); return data.toUrl().toEncoded();
break;
case QVariant::List: { case QVariant::List: {
// has to be list of URLs // has to be list of URLs
QByteArray result; QByteArray result;

View File

@ -1324,14 +1324,11 @@ Q_CORE_EXPORT QString qt_regexp_toCanonical(const QString &pattern, QRegExp::Pat
#ifndef QT_NO_REGEXP_WILDCARD #ifndef QT_NO_REGEXP_WILDCARD
case QRegExp::Wildcard: case QRegExp::Wildcard:
return wc2rx(pattern, false); return wc2rx(pattern, false);
break;
case QRegExp::WildcardUnix: case QRegExp::WildcardUnix:
return wc2rx(pattern, true); return wc2rx(pattern, true);
break;
#endif #endif
case QRegExp::FixedString: case QRegExp::FixedString:
return QRegExp::escape(pattern); return QRegExp::escape(pattern);
break;
case QRegExp::W3CXmlSchema11: case QRegExp::W3CXmlSchema11:
default: default:
return pattern; return pattern;

View File

@ -300,7 +300,6 @@ QVariant QDBusDemarshaller::toVariantInternal()
// I hope you never dereference this pointer! // I hope you never dereference this pointer!
return QVariant::fromValue<void *>(ptr); return QVariant::fromValue<void *>(ptr);
break;
}; };
} }

View File

@ -4915,43 +4915,33 @@ int QImage::metric(PaintDeviceMetric metric) const
switch (metric) { switch (metric) {
case PdmWidth: case PdmWidth:
return d->width; return d->width;
break;
case PdmHeight: case PdmHeight:
return d->height; return d->height;
break;
case PdmWidthMM: case PdmWidthMM:
return qRound(d->width * 1000 / d->dpmx); return qRound(d->width * 1000 / d->dpmx);
break;
case PdmHeightMM: case PdmHeightMM:
return qRound(d->height * 1000 / d->dpmy); return qRound(d->height * 1000 / d->dpmy);
break;
case PdmNumColors: case PdmNumColors:
return d->colortable.size(); return d->colortable.size();
break;
case PdmDepth: case PdmDepth:
return d->depth; return d->depth;
break;
case PdmDpiX: case PdmDpiX:
return qRound(d->dpmx * 0.0254); return qRound(d->dpmx * 0.0254);
break;
case PdmDpiY: case PdmDpiY:
return qRound(d->dpmy * 0.0254); return qRound(d->dpmy * 0.0254);
break;
case PdmPhysicalDpiX: case PdmPhysicalDpiX:
return qRound(d->dpmx * 0.0254); return qRound(d->dpmx * 0.0254);
break;
case PdmPhysicalDpiY: case PdmPhysicalDpiY:
return qRound(d->dpmy * 0.0254); return qRound(d->dpmy * 0.0254);
break;
default: default:
qWarning("QImage::metric(): Unhandled metric type %d", metric); qWarning("QImage::metric(): Unhandled metric type %d", metric);

View File

@ -349,7 +349,6 @@ bool QOpenGLFramebufferObjectPrivate::checkFramebufferStatus(QOpenGLContext *ctx
case GL_NO_ERROR: case GL_NO_ERROR:
case GL_FRAMEBUFFER_COMPLETE: case GL_FRAMEBUFFER_COMPLETE:
return true; return true;
break;
case GL_FRAMEBUFFER_UNSUPPORTED: case GL_FRAMEBUFFER_UNSUPPORTED:
qDebug("QOpenGLFramebufferObject: Unsupported framebuffer format."); qDebug("QOpenGLFramebufferObject: Unsupported framebuffer format.");
break; break;

View File

@ -1630,7 +1630,6 @@ QPainterPath QPathClipper::clip(Operation operation)
result.addRect(subjectBounds); result.addRect(subjectBounds);
return result; return result;
} }
break;
case BoolAnd: case BoolAnd:
return clipPath; return clipPath;
case BoolOr: case BoolOr:

View File

@ -296,7 +296,6 @@ bool QHttpNetworkConnectionChannel::sendRequest()
// premature eof happened // premature eof happened
connection->d_func()->emitReplyError(socket, reply, QNetworkReply::UnknownNetworkError); connection->d_func()->emitReplyError(socket, reply, QNetworkReply::UnknownNetworkError);
return false; return false;
break;
} else if (readPointer == 0 || currentReadSize == 0) { } else if (readPointer == 0 || currentReadSize == 0) {
// nothing to read currently, break the loop // nothing to read currently, break the loop
break; break;

View File

@ -83,31 +83,22 @@ QByteArray QHttpNetworkRequestPrivate::methodName() const
switch (operation) { switch (operation) {
case QHttpNetworkRequest::Get: case QHttpNetworkRequest::Get:
return "GET"; return "GET";
break;
case QHttpNetworkRequest::Head: case QHttpNetworkRequest::Head:
return "HEAD"; return "HEAD";
break;
case QHttpNetworkRequest::Post: case QHttpNetworkRequest::Post:
return "POST"; return "POST";
break;
case QHttpNetworkRequest::Options: case QHttpNetworkRequest::Options:
return "OPTIONS"; return "OPTIONS";
break;
case QHttpNetworkRequest::Put: case QHttpNetworkRequest::Put:
return "PUT"; return "PUT";
break;
case QHttpNetworkRequest::Delete: case QHttpNetworkRequest::Delete:
return "DELETE"; return "DELETE";
break;
case QHttpNetworkRequest::Trace: case QHttpNetworkRequest::Trace:
return "TRACE"; return "TRACE";
break;
case QHttpNetworkRequest::Connect: case QHttpNetworkRequest::Connect:
return "CONNECT"; return "CONNECT";
break;
case QHttpNetworkRequest::Custom: case QHttpNetworkRequest::Custom:
return customVerb; return customVerb;
break;
default: default:
break; break;
} }

View File

@ -979,53 +979,41 @@ static int name_to_month(const char* month_str)
switch (month_str[1]) { switch (month_str[1]) {
case 'a': case 'a':
return 1; return 1;
break;
case 'u': case 'u':
switch (month_str[2] ) { switch (month_str[2] ) {
case 'n': case 'n':
return 6; return 6;
break;
case 'l': case 'l':
return 7; return 7;
break;
} }
} }
break; break;
case 'F': case 'F':
return 2; return 2;
break;
case 'M': case 'M':
switch (month_str[2] ) { switch (month_str[2] ) {
case 'r': case 'r':
return 3; return 3;
break;
case 'y': case 'y':
return 5; return 5;
break;
} }
break; break;
case 'A': case 'A':
switch (month_str[1]) { switch (month_str[1]) {
case 'p': case 'p':
return 4; return 4;
break;
case 'u': case 'u':
return 8; return 8;
break;
} }
break; break;
case 'O': case 'O':
return 10; return 10;
break;
case 'S': case 'S':
return 9; return 9;
break;
case 'N': case 'N':
return 11; return 11;
break;
case 'D': case 'D':
return 12; return 12;
break;
} }
return 0; return 0;

View File

@ -393,7 +393,6 @@ bool QGLFramebufferObjectPrivate::checkFramebufferStatus() const
case GL_NO_ERROR: case GL_NO_ERROR:
case GL_FRAMEBUFFER_COMPLETE: case GL_FRAMEBUFFER_COMPLETE:
return true; return true;
break;
case GL_FRAMEBUFFER_UNSUPPORTED: case GL_FRAMEBUFFER_UNSUPPORTED:
qDebug("QGLFramebufferObject: Unsupported framebuffer format."); qDebug("QGLFramebufferObject: Unsupported framebuffer format.");
break; break;

View File

@ -365,14 +365,12 @@ QModelIndex QColumnView::moveCursor(CursorAction cursorAction, Qt::KeyboardModif
return (current.parent()); return (current.parent());
else else
return current; return current;
break;
case MoveRight: case MoveRight:
if (model()->hasChildren(current)) if (model()->hasChildren(current))
return model()->index(0, 0, current); return model()->index(0, 0, current);
else else
return current.sibling(current.row() + 1, current.column()); return current.sibling(current.row() + 1, current.column());
break;
default: default:
break; break;

View File

@ -69,7 +69,6 @@ static QEvent *cloneEvent(QEvent *e)
return new QEvent(*e); return new QEvent(*e);
case QEvent::Leave: case QEvent::Leave:
return new QEvent(*e); return new QEvent(*e);
break;
case QEvent::Paint: case QEvent::Paint:
Q_ASSERT_X(false, "cloneEvent()", "not implemented"); Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break; break;

View File

@ -2777,7 +2777,6 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
return widget->style()->subElementRect(QStyle::SE_FrameContents, opt, widget); return widget->style()->subElementRect(QStyle::SE_FrameContents, opt, widget);
else else
return subElementRect(QStyle::SE_FrameContents, opt, widget); return subElementRect(QStyle::SE_FrameContents, opt, widget);
break;
case QFrame::WinPanel: case QFrame::WinPanel:
frameWidth = 2; frameWidth = 2;