Skip to content

Commit 38c58a7

Browse files
More work on warnings
1 parent 141bc35 commit 38c58a7

7 files changed

+75
-73
lines changed

.coverity/coverity.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ set -e
1414
[ -z "$COVERITY_SCAN_BUILD_COMMAND" ] && echo "ERROR: COVERITY_SCAN_BUILD_COMMAND must be set" && exit 1
1515
[ -z "$COVERITY_SCAN_TOKEN" ] && echo "ERROR: COVERITY_SCAN_TOKEN must be set" && exit 1
1616

17-
PLATFORM=`uname`
17+
PLATFORM=$(uname)
1818
TOOL_ARCHIVE=/tmp/cov-analysis-${PLATFORM}.tgz
1919
TOOL_URL=https://scan.coverity.com/download/${PLATFORM}
2020
TOOL_BASE=/tmp/coverity-scan-analysis
@@ -31,7 +31,7 @@ if [ "${TRAVIS_PULL_REQUEST}" = "true" ]; then
3131
fi
3232

3333
# Verify this branch should run
34-
IS_COVERITY_SCAN_BRANCH=`ruby -e "puts '${TRAVIS_BRANCH}' =~ /\\A$COVERITY_SCAN_BRANCH_PATTERN\\z/ ? 1 : 0"`
34+
IS_COVERITY_SCAN_BRANCH=$(ruby -e "puts '${TRAVIS_BRANCH}' =~ /\\A$COVERITY_SCAN_BRANCH_PATTERN\\z/ ? 1 : 0")
3535
if [ "$IS_COVERITY_SCAN_BRANCH" = "1" ]; then
3636
echo -e "\033[33;1mCoverity Scan configured to run on branch ${TRAVIS_BRANCH}\033[0m"
3737
else
@@ -40,16 +40,16 @@ else
4040
fi
4141

4242
# Verify upload is permitted
43-
AUTH_RES=`curl -s --form project="$COVERITY_SCAN_PROJECT_NAME" --form token="$COVERITY_SCAN_TOKEN" $SCAN_URL/api/upload_permitted`
43+
AUTH_RES=$(curl -s --form project="$COVERITY_SCAN_PROJECT_NAME" --form token="$COVERITY_SCAN_TOKEN" $SCAN_URL/api/upload_permitted)
4444
if [ "$AUTH_RES" = "Access denied" ]; then
4545
echo -e "\033[33;1mCoverity Scan API access denied. Check COVERITY_SCAN_PROJECT_NAME and COVERITY_SCAN_TOKEN.\033[0m"
4646
exit 1
4747
else
48-
AUTH=`echo $AUTH_RES | ruby -e "require 'rubygems'; require 'json'; puts JSON[STDIN.read]['upload_permitted']"`
48+
AUTH=$(echo $AUTH_RES | ruby -e "require 'rubygems'; require 'json'; puts JSON[STDIN.read]['upload_permitted']")
4949
if [ "$AUTH" = "true" ]; then
5050
echo -e "\033[33;1mCoverity Scan analysis authorized per quota.\033[0m"
5151
else
52-
WHEN=`echo $AUTH_RES | ruby -e "require 'rubygems'; require 'json'; puts JSON[STDIN.read]['next_upload_permitted_at']"`
52+
WHEN=$(echo $AUTH_RES | ruby -e "require 'rubygems'; require 'json'; puts JSON[STDIN.read]['next_upload_permitted_at']")
5353
echo -e "\033[33;1mCoverity Scan analysis NOT authorized until $WHEN.\033[0m"
5454
exit 0
5555
fi
@@ -64,7 +64,7 @@ echo -e "\033[33;1mExtracting Coverity Scan Analysis Tool...\033[0m"
6464
tar xzf coverity_tool.tgz
6565

6666

67-
TOOL_DIR=`find -type d -name 'cov-analysis*'`
67+
TOOL_DIR=$(find -type d -name 'cov-analysis*')
6868
export PATH=$TOOL_DIR/bin:$PATH
6969

7070
# Build
@@ -77,7 +77,7 @@ COVERITY_UNSUPPORTED=1 cov-build --dir cov-int $COV_BUILD_OPTIONS make
7777
echo -e "\033[33;1mTarring Coverity Scan Analysis results...\033[0m"
7878
RESULTS_ARCHIVE=analysis-results.tgz
7979
tar czf $RESULTS_ARCHIVE cov-int
80-
SHA=`git rev-parse --short HEAD`
80+
SHA=$(git rev-parse --short HEAD)
8181

8282
echo -e "\033[33;1mUploading Coverity Scan Analysis results...\033[0m"
8383
response=$(curl \

CPPLINT.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
filter=-build/include_subdir,-whitespace/parens,-whitespace/line_length,-whitespace/forcolon,-whitespace/braces,-readability/braces,-whitespace/comments,-build/include_order,-src/stc,-src/nanoSVG,-src/levenshtein,-readability/todo,-whitespace/newline,-readability/multiline_comment,-runtime/indentation_namespace,-whitespace/indent
1+
filter=-build/include_subdir,-whitespace/parens,-whitespace/line_length,-whitespace/forcolon,-whitespace/braces,-readability/braces,-whitespace/comments,-build/include_order,-src/stc,-src/nanoSVG,-src/levenshtein,-readability/todo,-whitespace/newline,-readability/multiline_comment,-runtime/indentation_namespace,-whitespace/indent,-readability/fn_size

src/Autocomplete.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -478,13 +478,13 @@ void AutoComplete::AddSymbol_nowait(wxString fun, autoCompletionType type) {
478478
/// only add one template. We count the arguments by counting '<'
479479
if (type == tmplte) {
480480
fun = FixTemplate(fun);
481-
long openpos = fun.Find(wxS("("));
481+
auto openpos = fun.Find(wxS("("));
482482
if(openpos < 0)
483483
wxLogMessage(_("Cannot interpret template %s"), fun.mb_str());
484484
else
485485
{
486486
wxString funName = fun.SubString(0, openpos);
487-
long count = fun.Freq('<');
487+
auto count = fun.Freq('<');
488488
size_t i = 0;
489489
for (const auto &o: m_wordList.at(type)) {
490490
if (o.StartsWith(funName) && (o.Freq('<') == count))

src/AutocompletePopup.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,12 @@ void AutocompletePopup::OnKeyDown(wxKeyEvent &event) {
188188
}
189189
case WXK_DOWN:
190190
case WXK_NUMPAD_DOWN: {
191-
long selection = GetNextItem(0, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
192-
if (selection < 0)
193-
selection = 0;
191+
auto sel = GetNextItem(0, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
192+
if (sel < 0)
193+
sel = 0;
194+
size_t selection = sel;
194195
selection++;
195-
if (selection >= (long)m_completions.size())
196+
if (selection >= m_completions.size())
196197
selection--;
197198
if (m_completions.size() > 0) {
198199
Select(selection);

src/Worksheet.cpp

+22-18
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include "levenshtein/levenshtein.h"
4848
#include "wxMaxima.h"
4949
#include "wxMaximaFrame.h"
50+
#include <algorithm>
5051
#include <memory>
5152
#include <vector>
5253
#include <utility>
@@ -821,7 +822,6 @@ GroupCell *Worksheet::UpdateMLast(GroupCell *gc)
821822
if (GetLastCellInWorksheet())
822823
m_adjustWorksheetSizeNeeded = true;
823824
return GetLastCellInWorksheet();
824-
825825
}
826826

827827
void Worksheet::ScrollToError() {
@@ -1674,7 +1674,6 @@ void Worksheet::OnMouseRightDown(wxMouseEvent &event) {
16741674
labelWidthMenu->AppendRadioItem(EventIDs::popid_labelwidth1 + i, wxString::Format(wxS("%li em"), (long) i));
16751675
if(i == m_configuration->LabelWidth())
16761676
labelWidthMenu->Check(EventIDs::popid_labelwidth1 + i, true);
1677-
16781677
}
16791678
popupMenu.Append(EventIDs::popid_labelwidth, _("Label width"), labelWidthMenu);
16801679
}
@@ -2382,7 +2381,6 @@ void Worksheet::OnMouseWheel(wxMouseEvent &event) {
23822381
}
23832382
wxRect rect = animation->GetRect();
23842383
RequestRedraw(rect);
2385-
23862384
}
23872385
else
23882386
event.Skip();
@@ -3936,7 +3934,9 @@ void Worksheet::OnCharNoActive(wxKeyEvent &event) {
39363934
m_cellPointers.m_selectionStart.CastAs<GroupCell *>();
39373935
if (tmp->GetPrevious()) {
39383936
do
3937+
{
39393938
tmp = tmp->GetPrevious();
3939+
}
39403940
while ((tmp->GetPrevious()) &&
39413941
((tmp->GetGroupType() != GC_TYPE_TITLE) &&
39423942
(tmp->GetGroupType() != GC_TYPE_SECTION) &&
@@ -3954,13 +3954,15 @@ void Worksheet::OnCharNoActive(wxKeyEvent &event) {
39543954
if (event.CmdDown()) {
39553955
GroupCell *tmp = m_hCaretPosition;
39563956
if (tmp->GetPrevious()) {
3957-
do
3958-
tmp = tmp->GetPrevious();
3959-
while ((tmp->GetPrevious()) &&
3960-
((tmp->GetGroupType() != GC_TYPE_TITLE) &&
3961-
(tmp->GetGroupType() != GC_TYPE_SECTION) &&
3962-
(tmp->GetGroupType() != GC_TYPE_SUBSECTION)));
3963-
SetHCaret(tmp);
3957+
do
3958+
{
3959+
tmp = tmp->GetPrevious();
3960+
}
3961+
while ((tmp->GetPrevious()) &&
3962+
((tmp->GetGroupType() != GC_TYPE_TITLE) &&
3963+
(tmp->GetGroupType() != GC_TYPE_SECTION) &&
3964+
(tmp->GetGroupType() != GC_TYPE_SUBSECTION)));
3965+
SetHCaret(tmp);
39643966
} else if (tmp->GetEditable())
39653967
SelectEditable(tmp->GetEditable(), false);
39663968
} else {
@@ -3994,14 +3996,16 @@ void Worksheet::OnCharNoActive(wxKeyEvent &event) {
39943996
if (event.CmdDown()) {
39953997
GroupCell *tmp = m_cellPointers.m_selectionEnd.CastAs<GroupCell *>();
39963998
if (tmp->GetNext()) {
3997-
do
3998-
tmp = tmp->GetNext();
3999-
while (tmp->GetNext() &&
4000-
(((tmp->GetGroupType() != GC_TYPE_TITLE) &&
4001-
(tmp->GetGroupType() != GC_TYPE_SECTION) &&
4002-
(tmp->GetGroupType() != GC_TYPE_SUBSECTION)) ||
4003-
(tmp->GetNext()->GetMaxDrop() == 0)));
4004-
SetHCaret(tmp);
3999+
do
4000+
{
4001+
tmp = tmp->GetNext();
4002+
}
4003+
while (tmp->GetNext() &&
4004+
(((tmp->GetGroupType() != GC_TYPE_TITLE) &&
4005+
(tmp->GetGroupType() != GC_TYPE_SECTION) &&
4006+
(tmp->GetGroupType() != GC_TYPE_SUBSECTION)) ||
4007+
(tmp->GetNext()->GetMaxDrop() == 0)));
4008+
SetHCaret(tmp);
40054009
} else {
40064010
SelectEditable(tmp->GetEditable(), false);
40074011
}

src/main.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include <wx/tipdlg.h>
4444
#include <wx/utils.h>
4545
#include <wx/wx.h>
46+
#include <vector>
4647
#ifdef __WXMSW__
4748
#include <windows.h>
4849
#endif

0 commit comments

Comments
 (0)