Skip to content

Commit 9b1ff4e

Browse files
More warnings
1 parent bbef9d9 commit 9b1ff4e

14 files changed

+32
-35
lines changed

src/Autocomplete.cpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ bool AutoComplete::HasDemofile(const wxString &commandname)
9696
const std::lock_guard<std::mutex> lock(m_keywordsLock);
9797
return std::any_of(m_wordList.at(demofile).begin(),
9898
m_wordList.at(demofile).end(),
99-
[commandname](wxString file){return file == "\"" + commandname + "\"";});
99+
[commandname](const wxString &file){return file == "\"" + commandname + "\"";});
100100
}
101101

102102

@@ -389,7 +389,7 @@ void AutoComplete::LoadableFiles_BackgroundTask(wxString sharedir) {
389389
QueueEvent(event);
390390
}
391391

392-
void AutoComplete::UpdateDemoFiles(wxString partial, wxString maximaDir) {
392+
void AutoComplete::UpdateDemoFiles(wxString partial, const wxString &maximaDir) {
393393
// Remove the opening quote from the partial.
394394
if (partial.at(0) == wxS('\"'))
395395
partial = partial.Right(partial.Length() - 1);
@@ -425,7 +425,7 @@ void AutoComplete::UpdateDemoFiles(wxString partial, wxString maximaDir) {
425425
}
426426
}
427427

428-
void AutoComplete::UpdateGeneralFiles(wxString partial, wxString maximaDir) {
428+
void AutoComplete::UpdateGeneralFiles(wxString partial, const wxString &maximaDir) {
429429
// Remove the opening quote from the partial.
430430
if (partial.at(0) == wxS('\"'))
431431
partial = partial.Right(partial.Length() - 1);
@@ -458,7 +458,7 @@ void AutoComplete::UpdateGeneralFiles(wxString partial, wxString maximaDir) {
458458
}
459459
}
460460

461-
void AutoComplete::UpdateLoadFiles(wxString partial, wxString maximaDir) {
461+
void AutoComplete::UpdateLoadFiles(wxString partial, const wxString &maximaDir) {
462462
wxLogMessage(_("Scheduling a background task that scans for autocompletable "
463463
"file names."));
464464
// Remove the opening quote from the partial.
@@ -515,7 +515,6 @@ std::vector<wxString> AutoComplete::CompleteSymbol(wxString partial,
515515
if ((type != tmplte) && (type >=0 ) && (type < numberOfTypes )) {
516516
const std::lock_guard<std::mutex> lock(m_keywordsLock);
517517
for (const auto &i : m_wordList.at(type)) {
518-
//cppcheck-suppress useStlAlgorithm
519518
if (i.StartsWith(partial) &&
520519
(std::find(completions.begin(), completions.end(), i) == completions.end()))
521520
completions.push_back(i);

src/Autocomplete.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ class AutoComplete : public wxEvtHandler
103103

104104

105105
//! Replace the list of files in the directory the worksheet file is in to the demo files list
106-
void UpdateDemoFiles(wxString partial, wxString maximaDir);
106+
void UpdateDemoFiles(wxString partial, const wxString &maximaDir);
107107
//! Replace the list of files in the directory the worksheet file is in to the load files list
108-
void UpdateLoadFiles(wxString partial, wxString maximaDir);
108+
void UpdateLoadFiles(wxString partial, const wxString &maximaDir);
109109
//! Assemble a list of files
110-
void UpdateGeneralFiles(wxString partial, wxString maximaDir);
110+
void UpdateGeneralFiles(wxString partial, const wxString &maximaDir);
111111

112112
//! Add words to the list of words that appear in the workSheet's code cells
113113
void AddWorksheetWords(const WordList &words);

src/Image.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ void Image::LoadCompressedGnuplotSource_Backgroundtask(
397397
}
398398
}
399399

400-
Image::WxmxStream::WxmxStream(wxInputStream &wxmxFile, wxString fileInWxmx):
400+
Image::WxmxStream::WxmxStream(wxInputStream &wxmxFile, const wxString &fileInWxmx):
401401
wxZipInputStream(wxmxFile, wxConvLocal)
402402
{
403403
while(!Eof())
@@ -688,7 +688,7 @@ wxBitmap Image::GetBitmap(double scale) {
688688
return m_scaledBitmap;
689689
}
690690

691-
void Image::InvalidBitmap(wxString message) {
691+
void Image::InvalidBitmap(const wxString &message) {
692692
m_originalWidth = m_width = 1200 * m_ppi / 96;
693693
m_originalHeight = m_height = 900 * m_ppi / 96;
694694
// Create a "image not loaded" bitmap.

src/Image.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class Image final
120120
m_ppi = ppi;}
121121

122122
//! Creates a bitmap showing an error message
123-
void InvalidBitmap(wxString message = wxEmptyString);
123+
void InvalidBitmap(const wxString &message = wxEmptyString);
124124

125125
/*! Sets the name of the gnuplot source and data file of this image
126126
@@ -248,7 +248,7 @@ class Image final
248248
class WxmxStream: public wxZipInputStream
249249
{
250250
public:
251-
WxmxStream(wxInputStream &wxmxFile, wxString fileInWxmx);
251+
WxmxStream(wxInputStream &wxmxFile, const wxString &fileInWxmx);
252252
};
253253

254254
bool HasGnuplotSource() const {return m_gnuplotSource_Compressed.GetDataLen() > 20;}

src/MarkDown.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ wxString MarkDownParser::MarkDown(wxString str) {
138138
}
139139

140140
// End lists if we are at an old indentation level.
141-
// cppcheck-suppress knownConditionTrueFalse
142141
while (!indentationLevels.empty() &&
143142
(indentationLevels.back() > index)) {
144143
if (indentationTypes.back() == wxS('*')) {

src/MaximaManual.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ wxString MaximaManual::GetHelpfileAnchorName(wxString keyword) {
6767
return anchor->second;
6868
}
6969

70-
wxString MaximaManual::GetHelpfileUrl_Singlepage(wxString keyword) {
70+
wxString MaximaManual::GetHelpfileUrl_Singlepage(const wxString &keyword) {
7171
const std::lock_guard<std::mutex> lock(m_helpFileAnchorsLock);
7272
auto anchor = m_helpFileURLs_singlePage.find(keyword);
7373
if (anchor == m_helpFileURLs_singlePage.end())
7474
return wxEmptyString;
7575
else
7676
return anchor->second;
7777
}
78-
wxString MaximaManual::GetHelpfileUrl_FilePerChapter(wxString keyword) {
78+
wxString MaximaManual::GetHelpfileUrl_FilePerChapter(const wxString &keyword) {
7979
const std::lock_guard<std::mutex> lock(m_helpFileAnchorsLock);
8080

8181
auto anchor = m_helpFileURLs_filePerChapter.find(keyword);
@@ -460,7 +460,7 @@ bool MaximaManual::LoadManualAnchorsFromXML(const wxXmlDocument &xmlDocument,
460460
return !m_helpFileURLs_singlePage.empty();
461461
}
462462

463-
wxString MaximaManual::GetHelpfileURL(wxString keyword) {
463+
wxString MaximaManual::GetHelpfileURL(const wxString &keyword) {
464464
wxString anchor;
465465
if (m_configuration->SinglePageManual()) {
466466
anchor = GetHelpfileUrl_Singlepage(keyword);
@@ -475,7 +475,7 @@ wxString MaximaManual::GetHelpfileURL(wxString keyword) {
475475
return anchor;
476476
}
477477

478-
void MaximaManual::FindMaximaHtmlDir(wxString docDir) {
478+
void MaximaManual::FindMaximaHtmlDir(const wxString &docDir) {
479479
// One may set the help file location in the wxMaxima configuration (on Unix:
480480
// ~/.wxMaxima), e.g.
481481
// helpFile=/usr/local/share/maxima/5.44.0/doc/html/maxima_singlepage.html
@@ -521,8 +521,8 @@ void MaximaManual::FindMaximaHtmlDir(wxString docDir) {
521521
}
522522
}
523523

524-
void MaximaManual::LoadHelpFileAnchors(wxString docdir,
525-
wxString maximaVersion) {
524+
void MaximaManual::LoadHelpFileAnchors(const wxString &docdir,
525+
const wxString &maximaVersion) {
526526
FindMaximaHtmlDir(docdir);
527527
m_maximaVersion = maximaVersion;
528528
{

src/MaximaManual.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ class MaximaManual
6161
explicit MaximaManual(Configuration *configuration);
6262
typedef std::unordered_map <wxString, wxString, wxStringHash> HelpFileAnchors;
6363
HelpFileAnchors GetHelpfileAnchors();
64-
void FindMaximaHtmlDir(wxString docDir);
64+
void FindMaximaHtmlDir(const wxString &docDir);
6565
wxString GetHelpfileAnchorName(wxString keyword);
66-
wxString GetHelpfileUrl_Singlepage(wxString keyword);
67-
wxString GetHelpfileUrl_FilePerChapter(wxString keyword);
68-
wxString GetHelpfileURL(wxString keyword);
66+
wxString GetHelpfileUrl_Singlepage(const wxString &keyword);
67+
wxString GetHelpfileUrl_FilePerChapter(const wxString &keyword);
68+
wxString GetHelpfileURL(const wxString &keyword);
6969
//! Search maxima's help file for command and variable names
70-
void LoadHelpFileAnchors(wxString docdir, wxString maximaVersion);
70+
void LoadHelpFileAnchors(const wxString &docdir, const wxString &maximaVersion);
7171
//! Collect all keyword anchors in the help file
7272
void CompileHelpFileAnchors(const wxString &maximaHtmlDir,
7373
const wxString &maximaVersion,

src/MaximaTokenizer.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,6 @@ bool MaximaTokenizer::IsAlphaNum(wxChar ch) { return IsAlpha(ch) || IsNum(ch); }
388388

389389
const wxString MaximaTokenizer::m_additional_alphas = wxS("\\_%µ");
390390
const wxString MaximaTokenizer::m_not_alphas =
391-
// cppcheck-suppress unknownMacro
392391
L"\u00B7\u2212\u2260\u2264\u2265\u2265\u2212\u00B2\u00B3\u00BD\u221E"
393392
"\u22C0\u22C1\u22BB\u22BC\u22BD\u00AC\u2264\u2265\u2212" wxS("\uFE62")
394393
wxS("\uFF0B") wxS("\uFB29") wxS("\u2795") wxS("\u2064") wxS("\u2796")

src/RegexSearch.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include <string>
3232
#include <wx/log.h>
3333

34-
RegexSearch::RegexSearch(wxString regex)
34+
RegexSearch::RegexSearch(const wxString &regex)
3535
: wxRegEx(regex) {}
3636

3737
RegexSearch::~RegexSearch()

src/RegexSearch.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class RegexSearch : public wxRegEx
5454
std::size_t m_length = 0;
5555
bool m_found = false;
5656
};
57-
explicit RegexSearch(wxString regex);
57+
explicit RegexSearch(const wxString &regex);
5858
virtual ~RegexSearch();
5959
Match FindNext(const wxString &string, std::size_t start);
6060
Match FindNext_Reverse(const wxString &string, std::size_t start);

src/WXMXformat.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace Format {
5555
*/
5656
bool ExportToWXMX(GroupCell *cells, const wxString &file,
5757
Configuration *configuration, CellPointers *cellPointers,
58-
const std::vector<wxString> &variables, GroupCell * const cursorCell) {
58+
const std::vector<wxString> &variables, const GroupCell * const cursorCell) {
5959
// Show a busy cursor as long as we export a file.
6060
wxBusyCursor crs;
6161
// Clear the list of files we need to embed
@@ -191,10 +191,8 @@ namespace Format {
191191
ActiveCellNumber++;
192192
}
193193

194-
// Paranoia: What happens if we didn't find the cursor?
195-
if (!cells || !found)
196-
ActiveCellNumber = 0;
197-
else
194+
// Paranoia: Test if we did find the cursor
195+
if (cells && found)
198196
// If we know where the cursor was we save this piece of information.
199197
// If not we omit it.
200198
xmlText << wxString::Format(wxS(" activecell=\"%li\""),

src/WXMXformat.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ namespace Format
5353
{
5454
bool ExportToWXMX(GroupCell *cells, const wxString &file,
5555
Configuration *configuration, CellPointers *cellPointers,
56-
const std::vector<wxString> &variables, GroupCell * const cursorCell = NULL);
56+
const std::vector<wxString> &variables, const GroupCell * const cursorCell = NULL);
5757

5858
}
5959

src/wxMaxima.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class wxMaxima : public wxMaximaFrame
140140
{ return m_fileSaved; }
141141

142142
//! Load an image from a file into the worksheet.
143-
void LoadImage(wxString file)
143+
void LoadImage(const wxString &file)
144144
{ GetWorksheet()->OpenHCaret(file, GC_TYPE_IMAGE); }
145145

146146
//! Query the value of a new maxima variable
@@ -163,7 +163,8 @@ class wxMaxima : public wxMaximaFrame
163163
};
164164

165165
//! Use this maxima command (from a command line option) instead of the configured path
166-
static void Set_Maxima_Commandline_Filename(wxString filename) {maxima_command_line_filename = filename;}
166+
static void Set_Maxima_Commandline_Filename(const wxString &filename)
167+
{maxima_command_line_filename = filename;}
167168
//! The maxima command, if we use the --maxima=<str> command. If empty we use the configured path, not a command line option --maxima=<str>.
168169
static const wxString Get_Maxima_Commandline_Filename() {return maxima_command_line_filename;}
169170

wxMaxima.cppcheck

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<define name="WXK_NEXT=3"/>
3434
<define name="__WXGTK__=3"/>
3535
<define name="wxHAS_POWER_EVENTS=1"/>
36+
<define name="wxUSE_UNICODE=1"/>
3637
</defines>
3738
<undefines>
3839
<undefine>wxABORT_ON_CONFIG_ERROR</undefine>

0 commit comments

Comments
 (0)