Fix build when using -Werror

"accessible/qaccessible.cpp:2154:43: error: 'type' may be used uninitialized in this function [-Werror=maybe-uninitialized]"
Compiler doesn't seem very smart, all enumerators are handled in the switch already.

Observed on android's gcc and gcc-4.7 on GNU/Linux

Change-Id: I30b4660c18992158457cada01b5916aa4feae4ff
Reviewed-by: BogDan Vatra <bogdan@kde.org>
bb10
Sérgio Martins 2014-09-25 20:49:43 +01:00
parent cc50651cce
commit e297d72fa6
1 changed files with 6 additions and 3 deletions

View File

@ -1972,7 +1972,8 @@ QString QAccessibleTextInterface::textBeforeOffset(int offset, QAccessible::Text
if (txt.isEmpty() || offset <= 0 || offset > txt.length())
return QString();
QTextBoundaryFinder::BoundaryType type;
// type initialized just to silence a compiler warning [-Werror=maybe-uninitialized]
QTextBoundaryFinder::BoundaryType type = QTextBoundaryFinder::Grapheme;
switch (boundaryType) {
case QAccessible::CharBoundary:
type = QTextBoundaryFinder::Grapheme;
@ -2043,7 +2044,8 @@ QString QAccessibleTextInterface::textAfterOffset(int offset, QAccessible::TextB
if (txt.isEmpty() || offset < 0 || offset >= txt.length())
return QString();
QTextBoundaryFinder::BoundaryType type;
// type initialized just to silence a compiler warning [-Werror=maybe-uninitialized]
QTextBoundaryFinder::BoundaryType type = QTextBoundaryFinder::Grapheme;
switch (boundaryType) {
case QAccessible::CharBoundary:
type = QTextBoundaryFinder::Grapheme;
@ -2128,7 +2130,8 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoun
if (offset == txt.length() && boundaryType == QAccessible::CharBoundary)
return QString();
QTextBoundaryFinder::BoundaryType type;
// type initialized just to silence a compiler warning [-Werror=maybe-uninitialized]
QTextBoundaryFinder::BoundaryType type = QTextBoundaryFinder::Grapheme;
switch (boundaryType) {
case QAccessible::CharBoundary:
type = QTextBoundaryFinder::Grapheme;