diff options
author | Sérgio Martins <sergio.martins@kdab.com> | 2014-09-25 20:49:43 +0100 |
---|---|---|
committer | Sérgio Martins <sergio.martins@kdab.com> | 2014-09-29 18:24:01 +0200 |
commit | e297d72fa6722173abf6f1c3096440fb0bffe2a7 (patch) | |
tree | a1e059a69ff76c122341885cdb65473d8053c10b /src/gui/accessible | |
parent | cc50651cceda35fa1a2ae89236a926ddfa3c7b32 (diff) |
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>
Diffstat (limited to 'src/gui/accessible')
-rw-r--r-- | src/gui/accessible/qaccessible.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 524fc3a511..d3afed604f 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -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; |