diff --git a/src/Lexer.cpp b/src/Lexer.cpp index fa9ffc71e8..25d337a079 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -320,12 +320,11 @@ bool Lexer::Pimpl::next(bool esc /* = false */) } - unsigned char c = 0; // getc() returns an int char cc = 0; status = 0; while (is && !status) { is.get(cc); - c = cc; + unsigned char c = cc; if (c == commentChar) { // Read rest of line (fast :-) @@ -348,9 +347,8 @@ bool Lexer::Pimpl::next(bool esc /* = false */) if (esc) { - bool escaped = false; do { - escaped = false; + bool escaped = false; is.get(cc); c = cc; if (c == '\r') continue; diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 7053004256..84e609bb60 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -2041,14 +2041,12 @@ void Paragraph::setBeginOfBody() pos_type end = size(); if (i < end && !(isNewline(i) || isEnvSeparator(i))) { ++i; - char_type previous_char = 0; - char_type temp = 0; if (i < end) { - previous_char = d->text_[i]; + char_type previous_char = d->text_[i]; if (!(isNewline(i) || isEnvSeparator(i))) { ++i; while (i < end && previous_char != ' ') { - temp = d->text_[i]; + char_type temp = d->text_[i]; if (isNewline(i) || isEnvSeparator(i)) break; ++i; diff --git a/src/ServerSocket.cpp b/src/ServerSocket.cpp index 3535ee4560..fb6e3bf75c 100644 --- a/src/ServerSocket.cpp +++ b/src/ServerSocket.cpp @@ -129,11 +129,11 @@ void ServerSocket::dataCallback(int fd) return; shared_ptr client = it->second; string line; - size_t pos; bool saidbye = false; while (!saidbye && client->readln(line)) { // The protocol must be programmed here // Split the key and the data + size_t pos; if ((pos = line.find(':')) == string::npos) { client->writeln("ERROR:" + line + ":malformed message"); continue; diff --git a/src/Text.cpp b/src/Text.cpp index e30cd7446d..bedf228b33 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -1186,7 +1186,6 @@ bool Text::cursorVisLeftOneWord(Cursor & cur) LBUFERR(this == cur.text()); pos_type left_pos, right_pos; - bool left_is_letter, right_is_letter; Cursor temp_cur = cur; @@ -1195,9 +1194,9 @@ bool Text::cursorVisLeftOneWord(Cursor & cur) // collect some information about current cursor position temp_cur.getSurroundingPos(left_pos, right_pos); - left_is_letter = + bool left_is_letter = (left_pos > -1 ? !temp_cur.paragraph().isWordSeparator(left_pos) : false); - right_is_letter = + bool right_is_letter = (right_pos > -1 ? !temp_cur.paragraph().isWordSeparator(right_pos) : false); // if we're not at a letter/non-letter boundary, continue moving @@ -1223,7 +1222,6 @@ bool Text::cursorVisRightOneWord(Cursor & cur) LBUFERR(this == cur.text()); pos_type left_pos, right_pos; - bool left_is_letter, right_is_letter; Cursor temp_cur = cur; @@ -1232,9 +1230,9 @@ bool Text::cursorVisRightOneWord(Cursor & cur) // collect some information about current cursor position temp_cur.getSurroundingPos(left_pos, right_pos); - left_is_letter = + bool left_is_letter = (left_pos > -1 ? !temp_cur.paragraph().isWordSeparator(left_pos) : false); - right_is_letter = + bool right_is_letter = (right_pos > -1 ? !temp_cur.paragraph().isWordSeparator(right_pos) : false); // if we're not at a letter/non-letter boundary, continue moving diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index 7671d59650..e5e0806074 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -2473,13 +2473,12 @@ QAbstractItemModel * GuiApplication::languageModel() QStandardItemModel * lang_model = new QStandardItemModel(this); lang_model->insertColumns(0, 3); - int current_row; QIcon speller(getPixmap("images/", "dialog-show_spellchecker", "svgz,png")); QIcon saurus(getPixmap("images/", "thesaurus-entry", "svgz,png")); Languages::const_iterator it = lyx::languages.begin(); Languages::const_iterator end = lyx::languages.end(); for (; it != end; ++it) { - current_row = lang_model->rowCount(); + int current_row = lang_model->rowCount(); lang_model->insertRows(current_row, 1); QModelIndex pl_item = lang_model->index(current_row, 0); QModelIndex sp_item = lang_model->index(current_row, 1); diff --git a/src/frontends/qt4/GuiBranches.cpp b/src/frontends/qt4/GuiBranches.cpp index 9445a16567..6910c5cadd 100644 --- a/src/frontends/qt4/GuiBranches.cpp +++ b/src/frontends/qt4/GuiBranches.cpp @@ -206,10 +206,10 @@ void GuiBranches::on_renamePB_pressed() if (!sel_branch.isEmpty()) { docstring newname; docstring const oldname = qstring_to_ucs4(sel_branch); - bool success = false; if (Alert::askForText(newname, _("Enter new branch name"), oldname)) { if (newname.empty() || oldname == newname) return; + bool success = false; if (branchlist_.find(newname)) { docstring text = support::bformat( _("A branch with the name \"%1$s\" already exists.\n" diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index 96ea215f08..e9d0f41871 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -3506,14 +3506,13 @@ void GuiDocument::updateIncludeonlys() masterChildModule->childrenTW->setEnabled(true); masterChildModule->maintainAuxCB->setEnabled(true); } - QTreeWidgetItem * item = 0; ListOfBuffers children = buffer().getChildren(); ListOfBuffers::const_iterator it = children.begin(); ListOfBuffers::const_iterator end = children.end(); bool has_unincluded = false; bool all_unincluded = true; for (; it != end; ++it) { - item = new QTreeWidgetItem(masterChildModule->childrenTW); + QTreeWidgetItem * item = new QTreeWidgetItem(masterChildModule->childrenTW); // FIXME Unicode string const name = to_utf8(makeRelPath(from_utf8((*it)->fileName().absFileName()), diff --git a/src/frontends/qt4/GuiIndices.cpp b/src/frontends/qt4/GuiIndices.cpp index ff0639b81d..7e166cc581 100644 --- a/src/frontends/qt4/GuiIndices.cpp +++ b/src/frontends/qt4/GuiIndices.cpp @@ -233,11 +233,10 @@ void GuiIndices::on_renamePB_clicked() if (!sel_index.isEmpty()) { docstring newname; docstring const oldname = qstring_to_ucs4(sel_index); - bool success = false; if (Alert::askForText(newname, _("Enter new index name"), oldname)) { if (newname.empty() || oldname == newname) return; - success = indiceslist_.rename(qstring_to_ucs4(sel_index), newname); + bool success = indiceslist_.rename(qstring_to_ucs4(sel_index), newname); newIndexLE->clear(); updateView(); if (!success) diff --git a/src/frontends/qt4/GuiProgressView.cpp b/src/frontends/qt4/GuiProgressView.cpp index d6c9caf11a..fa157865e7 100644 --- a/src/frontends/qt4/GuiProgressView.cpp +++ b/src/frontends/qt4/GuiProgressView.cpp @@ -96,7 +96,6 @@ GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area, } sort(dmap.begin(), dmap.end(), DebugSorter); - QTreeWidgetItem * item = 0; widget_->debugMessagesTW->setColumnCount(2); widget_->debugMessagesTW->headerItem()->setText(0, qt_("Debug Level")); widget_->debugMessagesTW->headerItem()->setText(1, qt_("Set")); @@ -104,7 +103,7 @@ GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area, DebugVector::const_iterator dit = dmap.begin(); DebugVector::const_iterator const den = dmap.end(); for (; dit != den; ++dit) { - item = new QTreeWidgetItem(widget_->debugMessagesTW); + QTreeWidgetItem * item = new QTreeWidgetItem(widget_->debugMessagesTW); item->setText(0, dit->second); item->setData(0, Qt::UserRole, int(dit->first)); item->setText(1, qt_("No")); diff --git a/src/frontends/qt4/GuiSymbols.cpp b/src/frontends/qt4/GuiSymbols.cpp index 6ccecf5241..dad0211772 100644 --- a/src/frontends/qt4/GuiSymbols.cpp +++ b/src/frontends/qt4/GuiSymbols.cpp @@ -227,9 +227,6 @@ public: static QString const strCharacter = qt_("Character: "); static QString const strCodePoint = qt_("Code Point: "); - // FIXME THREAD - static char codeName[10]; - char_type c = symbols_.at(index.row()); if (role == Qt::TextAlignmentRole) @@ -239,6 +236,9 @@ public: return toqstr(c); if (role == Qt::ToolTipRole) { + // FIXME THREAD + static char codeName[10]; + sprintf(codeName, "0x%04x", c); return strCharacter + toqstr(c) + '\n' + strCodePoint + QLatin1String(codeName); diff --git a/src/frontends/qt4/TocModel.cpp b/src/frontends/qt4/TocModel.cpp index c2cda38c49..8f0e3178b2 100644 --- a/src/frontends/qt4/TocModel.cpp +++ b/src/frontends/qt4/TocModel.cpp @@ -208,7 +208,6 @@ void TocModel::populate(unsigned int & index, QModelIndex const & parent) { int curdepth = (*toc_)[index].depth() + 1; - int current_row; QModelIndex child_item; model_->insertColumns(0, 1, parent); @@ -222,7 +221,7 @@ void TocModel::populate(unsigned int & index, QModelIndex const & parent) } maxdepth_ = max(maxdepth_, item.depth()); mindepth_ = min(mindepth_, item.depth()); - current_row = model_->rowCount(parent); + int current_row = model_->rowCount(parent); model_->insertRows(current_row, 1, parent); child_item = model_->index(current_row, 0, parent); model_->setData(child_item, toqstr(item.str()), Qt::DisplayRole); diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 674dc1fdc4..11aebd2c94 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -348,10 +348,10 @@ bool lyxreplace(BufferView * bv, bool forward = parse_bool(howto); bool findnext = howto.empty() ? true : parse_bool(howto); - int replace_count = 0; bool update = false; if (!has_deleted) { + int replace_count = 0; if (all) { replace_count = replaceAll(bv, search, rplc, casesensitive, matchword); update = replace_count > 0; diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp index 9378783f89..959262d9cd 100644 --- a/src/output_xhtml.cpp +++ b/src/output_xhtml.cpp @@ -980,9 +980,6 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf, ) cnts.step(cntr, OutputUpdate); ParagraphList::const_iterator send; - // this will be positive, if we want to skip the initial word - // (if it's been taken for the label). - pos_type sep = 0; switch (style.latextype) { case LATEX_ENVIRONMENT: @@ -998,6 +995,9 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf, lastlay = 0; } + // this will be positive, if we want to skip the + // initial word (if it's been taken for the label). + pos_type sep = 0; bool const labelfirst = style.htmllabelfirst(); if (!labelfirst) openItemTag(xs, style, par->params()); @@ -1018,7 +1018,7 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf, } xs << html::CR(); } - } else { // some kind of list + } else { // some kind of list if (style.labeltype == LABEL_MANUAL) { openLabelTag(xs, style); sep = par->firstWordLyXHTML(xs, runparams); diff --git a/src/sgml.cpp b/src/sgml.cpp index b193593fab..75802c2bd4 100644 --- a/src/sgml.cpp +++ b/src/sgml.cpp @@ -141,7 +141,6 @@ docstring sgml::cleanID(Buffer const & buf, OutputParams const & runparams, static QThreadStorage tMangleID; MangledMap & mangledNames = tMangledNames.localData(); - int & mangleID = tMangleID.localData(); MangledMap::const_iterator const known = mangledNames.find(orig); if (known != mangledNames.end()) @@ -170,9 +169,10 @@ docstring sgml::cleanID(Buffer const & buf, OutputParams const & runparams, } } - if (mangle) + if (mangle) { + int & mangleID = tMangleID.localData(); content += "-" + convert(mangleID++); - else if (isDigitASCII(content[content.size() - 1])) + } else if (isDigitASCII(content[content.size() - 1])) content += "."; mangledNames[orig] = content; diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp index 4c37fa1573..db07d56e61 100644 --- a/src/support/filetools.cpp +++ b/src/support/filetools.cpp @@ -1007,7 +1007,6 @@ cmd_ret const runCommand(string const & cmd) // variants ipstream, opstream #if defined (_WIN32) - int fno; STARTUPINFO startup; PROCESS_INFORMATION process; SECURITY_ATTRIBUTES security; @@ -1049,7 +1048,7 @@ cmd_ret const runCommand(string const & cmd) 0, 0, &startup, &process)) { CloseHandle(process.hThread); - fno = _open_osfhandle((long)in, _O_RDONLY); + int fno = _open_osfhandle((long)in, _O_RDONLY); CloseHandle(out); inf = _fdopen(fno, "r"); } diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index ffeac41df3..961d51d322 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -2934,7 +2934,6 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, // the syntax is \subfloat[list entry][sub caption]{content} // if it is a table of figure depends on the surrounding float // FIXME: second optional argument is not parsed - bool has_caption = false; p.skip_spaces(); // do nothing if there is no outer float if (!float_type.empty()) { @@ -2946,6 +2945,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, << "\nstatus collapsed\n\n"; // test for caption string caption; + bool has_caption = false; if (p.next_token().cat() != catEscape && p.next_token().character() == '[') { p.get_token(); // eat '['