Commit graph

17 commits

Author SHA1 Message Date
Ahmed Charles
cd3c166963 Remove dead code. 2017-04-21 20:00:42 -07:00
Ahmed Charles
70718167fa Fix uninitialized members. 2017-04-15 02:29:13 -07:00
Ahmed Charles
9b4f547e46 Revert "Formatting: applied anti-ClangFormat guards around pre/post_guard.h includes"
This reverts commit 272970e62f.
2017-04-14 03:45:58 -07:00
Ahmed Charles
726ff25882 If either value is null, do nothing. 2017-04-14 03:44:15 -07:00
Stephen Lyons
272970e62f
Formatting: applied anti-ClangFormat guards around pre/post_guard.h includes
clang-format has an option to sort header #include lines in source code
files - however the `#include "pre_guard.h"` and `#include "post_guard.h"`
includes are position sensitive - they must wrap around Qt's own classes'
includes in our files and they must not be tidied-up/rearranged.

This commit adds the necessary comments that commands clang tools to not
touch these lines.

We had previously done this on the XMLimport class as a test case but
during recent major branch merging operations one of these comments was
lost from the XMLimport.cpp file!

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2017-04-13 14:00:23 +01:00
Vadim Peretokin
f66e6f23ef Applied auto to variable declaration
Improved readability of code, less text to look at while all of the information is still there
2017-04-09 20:24:34 +02:00
Stephen Lyons
f94e44d655 BugFix: fix crash on profile auto-load (bug 1624720) (#318)
* BugFix: fix crash on profile auto-load (bug 1624720)

The uninitialised TVar::parent member in the default constructor is used
in the profile auto-load (but not the normal one apparently) and was the
cause for segment violations.  In fixing THIS I noted that several other
members of that Class {and worryingly, quite a few *other* classes
throughout the Mudlet application!!!) were not being initialised to
sensible defaults either.  This commit addresses the TVar class, but ONLY
that Class...!

In checking also found that (void) TVar::setNewName( QString ) is not used
{only the two argument (void) TVar::setNewName( QString, int ) that takes
a Lua Type number as a second argument IS used} so commented it out.  Also
found that (int) TVar::nvType and (QString) TVar::nValue members are not
used so removed them as well.

Also fixed a (subtle ?) bug in local functor TVarLessThan(TVar *, TVar *) which
tested the number value of the "name" of each argument when converted to a
number without checking that the "name" could be converted to a number.
Consequently, when a non-number name was encountered it would convert to
zero and THAT zero value would be compared to the other one.  If BOTH
arguments were not numbers then the caller would ALWAYS be told the first
argument was less than the second argument whereas the wanted result was
a String comparison of "lessnessness".

Refactor TVar class methods that return a "bool" type to actually return
such a thing rather than (int)(0) for false or, more suspiciously, (int)(1)
for true - though subsequent research revealed that that is how C++ does
it, (as a C ex-pat I just think of anything that isn't zero is true)! This
affects:
* (bool) TVar::setValue( const QString )
* (bool) TVar::setValue( const QString, const int )
* (bool) TVar::setValueType( const int )

Similarly, where an argument was an int type but was being used in a
binary/boolean manner I've changed it to the latter type.  This affected:
* (QList<TVar *>) TVar::getChildren( const bool )

This affects what are now:
* (void) VarUnit::buildVarTree( QTreeWidgetItem *, TVar *, bool )
* (bool) XMLexport::writeHost( Host * )
* (bool) XMLexport::writeVariable( TVar *, LuaInterface *, VarUnit * )
* (void) dlgTriggerEditor::slot_search_triggers( const QString )
* (int) dlgTriggerEditor::canRecast( QTreeWidgetItem *, int, int )
* (void) dlgTriggerEditor::recurseVariablesDown( TVar *, QList<TVar *> &,
                                                                      bool)
* (void) LuaInterface::getAllChildren( TVar *, QList<TVar *> *)

Tidies up code layout of TVar implementation to current coding style.

Adds const where possible to TVar class method parameters.

__This commit is a squashed down one as some later ones of the original commits were reverted directly on GitHub in the reverse of their application - this comment contains the text for the remaining parts and hopefully still make sense!__

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2016-10-04 03:15:27 +01:00
Ahmed Charles
b0daf6f86c Merge branch 'release_31' into development
Fix memory leaks.
2014-10-07 06:44:49 -07:00
Ahmed Charles
d747dfa22a Fix memory leaks. 2014-10-03 19:32:06 -07:00
Ahmed Charles
8d591dbd40 Dead code removal. 2014-09-30 04:58:13 -07:00
Chris Mitchell
0cdb1a07bd Fix crash in LuaInterface.
Fix for loading lua values where an empty stack could be accessed and
cause a seg fault.
2014-09-15 16:38:26 -07:00
Ahmed Charles
3989340fcd Rearrange includes to improve compile times.
This also allows for memory leak checking on MSVC by having include
surrounding Qt headers, which break if you have a macro define new
to be something which tracks line information.
2014-08-17 14:46:54 -07:00
Stephen Lyons
127d095ad9 Permissions Fix: Remove Executable bit(s) from non-executable files.
Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2014-08-15 00:55:39 -07:00
Chris Mitchell
36d3dc2ea0 Cleaned up debug messages 2014-01-10 21:41:20 -05:00
Chris Mitchell
90713e0ce5 Variable search made more efficient 2013-10-16 18:14:19 -04:00
Heiko Koehn
f30a55f176 misc 2013-08-19 12:25:26 +02:00
Heiko Koehn
43e73a6af2 added proper copyright notices for Chris' files 2013-08-14 14:17:44 +02:00