Skip to content

Commit f82f6c2

Browse files
committed
Some fixes found by resharper c++
1 parent 7ed5c18 commit f82f6c2

File tree

6 files changed

+15
-16
lines changed

6 files changed

+15
-16
lines changed

include/chaiscript/dispatchkit/dispatchkit.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -596,13 +596,13 @@ namespace chaiscript
596596

597597

598598
/// Pushes a new stack on to the list of stacks
599-
void new_stack(Stack_Holder &t_holder)
599+
static void new_stack(Stack_Holder &t_holder)
600600
{
601601
// add a new Stack with 1 element
602602
t_holder.stacks.emplace_back(1);
603603
}
604604

605-
void pop_stack(Stack_Holder &t_holder)
605+
static void pop_stack(Stack_Holder &t_holder)
606606
{
607607
t_holder.stacks.pop_back();
608608
}
@@ -1082,7 +1082,7 @@ namespace chaiscript
10821082

10831083
/// Returns true if a call can be made that consists of the first parameter
10841084
/// (the function) with the remaining parameters as its arguments.
1085-
Boxed_Value call_exists(const std::vector<Boxed_Value> &params)
1085+
Boxed_Value call_exists(const std::vector<Boxed_Value> &params) const
10861086
{
10871087
if (params.empty())
10881088
{
@@ -1160,20 +1160,20 @@ namespace chaiscript
11601160
m_state = t_state;
11611161
}
11621162

1163-
void save_function_params(Stack_Holder &t_s, std::initializer_list<Boxed_Value> t_params)
1163+
static void save_function_params(Stack_Holder &t_s, std::initializer_list<Boxed_Value> t_params)
11641164
{
11651165
t_s.call_params.back().insert(t_s.call_params.back().begin(), std::move(t_params));
11661166
}
11671167

1168-
void save_function_params(Stack_Holder &t_s, std::vector<Boxed_Value> &&t_params)
1168+
static void save_function_params(Stack_Holder &t_s, std::vector<Boxed_Value> &&t_params)
11691169
{
11701170
for (auto &&param : t_params)
11711171
{
11721172
t_s.call_params.back().insert(t_s.call_params.back().begin(), std::move(param));
11731173
}
11741174
}
11751175

1176-
void save_function_params(Stack_Holder &t_s, const std::vector<Boxed_Value> &t_params)
1176+
static void save_function_params(Stack_Holder &t_s, const std::vector<Boxed_Value> &t_params)
11771177
{
11781178
t_s.call_params.back().insert(t_s.call_params.back().begin(), t_params.begin(), t_params.end());
11791179
}
@@ -1240,7 +1240,7 @@ namespace chaiscript
12401240
return m_stack_holder->stacks.back();
12411241
}
12421242

1243-
StackData &get_stack_data(Stack_Holder &t_holder)
1243+
static StackData &get_stack_data(Stack_Holder &t_holder)
12441244
{
12451245
return t_holder.stacks.back();
12461246
}

include/chaiscript/dispatchkit/exception_specification.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace chaiscript
3232

3333
protected:
3434
template<typename T>
35-
void throw_type(const Boxed_Value &bv, const Dispatch_Engine &t_engine)
35+
static void throw_type(const Boxed_Value &bv, const Dispatch_Engine &t_engine)
3636
{
3737
try { T t = t_engine.boxed_cast<T>(bv); throw t; } catch (const chaiscript::exception::bad_boxed_cast &) {}
3838
}

include/chaiscript/language/chaiscript_engine.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,11 @@ namespace chaiscript
177177
FORMAT_MESSAGE_ALLOCATE_BUFFER |
178178
FORMAT_MESSAGE_FROM_SYSTEM |
179179
FORMAT_MESSAGE_IGNORE_INSERTS,
180-
NULL,
180+
nullptr,
181181
t_err,
182182
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
183183
reinterpret_cast<StringType>(&lpMsgBuf),
184-
0, NULL ) != 0 && lpMsgBuf)
184+
0, nullptr ) != 0 && lpMsgBuf)
185185
{
186186
retval = lpMsgBuf;
187187
LocalFree(lpMsgBuf);

include/chaiscript/language/chaiscript_parser.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ namespace chaiscript
278278
bool char_in_alphabet(char c, detail::Alphabet a) const { return m_alphabet[a][static_cast<uint8_t>(c)]; }
279279

280280
/// Prints the parsed ast_nodes as a tree
281-
void debug_print(AST_NodePtr t, std::string prepend = "") {
281+
void debug_print(AST_NodePtr t, std::string prepend = "") const {
282282
std::cout << prepend << "(" << ast_node_type_to_string(t->identifier) << ") " << t->text << " : " << t->start().line << ", " << t->start().column << '\n';
283283
for (unsigned int j = 0; j < t->children.size(); ++j) {
284284
debug_print(t->children[j], prepend + " ");

src/main.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ std::vector<std::string> default_search_paths()
6666

6767
#ifdef CHAISCRIPT_WINDOWS // force no unicode
6868
CHAR path[4096];
69-
int size = GetModuleFileNameA(0, path, sizeof(path)-1);
69+
int size = GetModuleFileNameA(nullptr, path, sizeof(path)-1);
7070

7171
std::string exepath(path, size);
7272

@@ -344,17 +344,16 @@ int main(int argc, char *argv[])
344344
mode = eFile;
345345
}
346346

347-
chaiscript::Boxed_Value val ;
348347
try {
349348
switch ( mode ) {
350349
case eInteractive:
351350
interactive(chai);
352351
break;
353352
case eCommand:
354-
val = chai.eval(arg);
353+
chai.eval(arg);
355354
break;
356355
case eFile:
357-
val = chai.eval_file(arg);
356+
chai.eval_file(arg);
358357
}
359358
}
360359
catch (const chaiscript::exception::eval_error &ee) {

unittests/compiled_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ class Short_Comparison_Test {
397397
public:
398398
Short_Comparison_Test() : value_(5) {}
399399

400-
short get_value() { return value_; }
400+
short get_value() const { return value_; }
401401

402402
short value_;
403403
};

0 commit comments

Comments
 (0)