[cig-commits] commit: Fix compiler warnings for muparserx
Mercurial
hg at geodynamics.org
Wed Nov 9 00:47:49 PST 2011
changeset: 389:8ecf53e02278
user: Walter Landry <wlandry at caltech.edu>
date: Tue Nov 08 10:42:45 2011 -0800
files: muparserx/parser/mpIValue.cpp muparserx/parser/mpMatrix.h muparserx/parser/mpPackageNonCmplx.cpp muparserx/parser/mpParserBase.cpp muparserx/parser/mpRPN.cpp muparserx/parser/mpTest.cpp muparserx/parser/mpValReader.cpp
description:
Fix compiler warnings for muparserx
diff -r 5a4d909d9533 -r 8ecf53e02278 muparserx/parser/mpIValue.cpp
--- a/muparserx/parser/mpIValue.cpp Tue Nov 08 10:39:59 2011 -0800
+++ b/muparserx/parser/mpIValue.cpp Tue Nov 08 10:42:45 2011 -0800
@@ -182,7 +182,7 @@ MUP_NAMESPACE_START
char_type type1 = GetType(),
type2 = a_Val.GetType();
- if (type1==type2 || IsScalar() && a_Val.IsScalar())
+ if (type1==type2 || (IsScalar() && a_Val.IsScalar()))
{
switch(GetType())
{
@@ -227,7 +227,7 @@ MUP_NAMESPACE_START
char_type type1 = GetType(),
type2 = a_Val.GetType();
- if (type1==type2 || IsScalar() && a_Val.IsScalar())
+ if (type1==type2 || (IsScalar() && a_Val.IsScalar()))
{
switch(GetType())
{
@@ -272,7 +272,7 @@ MUP_NAMESPACE_START
char_type type1 = GetType(),
type2 = a_Val.GetType();
- if (type1==type2 || IsScalar() && a_Val.IsScalar())
+ if (type1==type2 || (IsScalar() && a_Val.IsScalar()))
{
switch(GetType())
{
@@ -308,7 +308,7 @@ MUP_NAMESPACE_START
char_type type1 = GetType(),
type2 = a_Val.GetType();
- if (type1==type2 || IsScalar() && a_Val.IsScalar())
+ if (type1==type2 || (IsScalar() && a_Val.IsScalar()))
{
switch(GetType())
{
@@ -344,7 +344,7 @@ MUP_NAMESPACE_START
char_type type1 = GetType(),
type2 = a_Val.GetType();
- if (type1==type2 || IsScalar() && a_Val.IsScalar())
+ if (type1==type2 || (IsScalar() && a_Val.IsScalar()))
{
switch(GetType())
{
@@ -380,7 +380,7 @@ MUP_NAMESPACE_START
char_type type1 = GetType(),
type2 = a_Val.GetType();
- if (type1==type2 || IsScalar() && a_Val.IsScalar())
+ if (type1==type2 || (IsScalar() && a_Val.IsScalar()))
{
switch(GetType())
{
diff -r 5a4d909d9533 -r 8ecf53e02278 muparserx/parser/mpMatrix.h
--- a/muparserx/parser/mpMatrix.h Tue Nov 08 10:39:59 2011 -0800
+++ b/muparserx/parser/mpMatrix.h Tue Nov 08 10:42:45 2011 -0800
@@ -7,6 +7,7 @@
#include <stdexcept>
#include <sstream>
#include "mpMatrixError.h"
+#include <algorithm>
MUP_NAMESPACE_START
@@ -32,38 +33,38 @@ MUP_NAMESPACE_START
//---------------------------------------------------------------------------------------------
Matrix()
- :m_nRows(1)
- ,m_nCols(1)
+ :m_nCols(1)
+ ,m_nRows(1)
+ ,m_vData(1)
,m_eStorageScheme(mssROWS_FIRST)
- ,m_vData(1)
{}
//---------------------------------------------------------------------------------------------
Matrix(int nRows, const T &value = T())
- :m_nRows(nRows)
- ,m_nCols(1)
+ :m_nCols(1)
+ ,m_nRows(nRows)
+ ,m_vData(m_nRows, value)
,m_eStorageScheme(mssROWS_FIRST)
- ,m_vData(m_nRows, value)
{}
//---------------------------------------------------------------------------------------------
/* \brief Constructs a Matrix object representing a scalar value
*/
Matrix(const T &v)
- :m_nRows(1)
- ,m_nCols(1)
+ :m_nCols(1)
+ ,m_nRows(1)
+ ,m_vData(1, v)
,m_eStorageScheme(mssROWS_FIRST)
- ,m_vData(1, v)
{}
//---------------------------------------------------------------------------------------------
/* \brief Constructs a Matrix object representing a vector
*/
Matrix(const std::vector<T> &v)
- :m_nRows(v.size())
- ,m_nCols(1)
+ :m_nCols(1)
+ ,m_nRows(v.size())
+ ,m_vData(v)
,m_eStorageScheme(mssROWS_FIRST)
- ,m_vData(v)
{}
//---------------------------------------------------------------------------------------------
@@ -71,19 +72,19 @@ MUP_NAMESPACE_START
*/
template<size_t TSize>
Matrix(T (&v)[TSize])
- :m_nRows(TSize)
- ,m_nCols(1)
+ :m_nCols(1)
+ ,m_nRows(TSize)
+ ,m_vData(v, v + TSize)
,m_eStorageScheme(mssROWS_FIRST)
- ,m_vData(v, v + TSize)
{}
//---------------------------------------------------------------------------------------------
template<size_t TRows, size_t TCols>
Matrix(T (&v)[TRows][TCols])
- :m_nRows(TRows)
- ,m_nCols(TCols)
+ :m_nCols(TCols)
+ ,m_nRows(TRows)
+ ,m_vData(TRows*TCols, 0)
,m_eStorageScheme(mssROWS_FIRST)
- ,m_vData(TRows*TCols, 0)
{
for (int m=0; m<TRows; ++m)
{
@@ -96,10 +97,10 @@ MUP_NAMESPACE_START
//---------------------------------------------------------------------------------------------
Matrix(int nRows, int nCols, const T &value = T())
- :m_nRows(nRows)
- ,m_nCols(nCols)
+ :m_nCols(nCols)
+ ,m_nRows(nRows)
+ ,m_vData(m_nRows*m_nCols, value)
,m_eStorageScheme(mssROWS_FIRST)
- ,m_vData(m_nRows*m_nCols, value)
{}
//---------------------------------------------------------------------------------------------
@@ -357,7 +358,7 @@ MUP_NAMESPACE_START
return *this;
m_eStorageScheme = (m_eStorageScheme==mssROWS_FIRST) ? mssCOLS_FIRST : mssROWS_FIRST;
- m_nRows ^= m_nCols ^= m_nRows ^= m_nCols;
+ std::swap(m_nRows,m_nCols);
return *this;
}
@@ -414,4 +415,4 @@ MUP_NAMESPACE_START
MUP_NAMESPACE_END
-#endif
\ No newline at end of file
+#endif
diff -r 5a4d909d9533 -r 8ecf53e02278 muparserx/parser/mpPackageNonCmplx.cpp
--- a/muparserx/parser/mpPackageNonCmplx.cpp Tue Nov 08 10:39:59 2011 -0800
+++ b/muparserx/parser/mpPackageNonCmplx.cpp Tue Nov 08 10:42:45 2011 -0800
@@ -66,4 +66,4 @@ string_type PackageNonCmplx::GetPrefix()
return _T("");
}
-MUP_NAMESPACE_END
\ No newline at end of file
+MUP_NAMESPACE_END
diff -r 5a4d909d9533 -r 8ecf53e02278 muparserx/parser/mpParserBase.cpp
--- a/muparserx/parser/mpParserBase.cpp Tue Nov 08 10:39:59 2011 -0800
+++ b/muparserx/parser/mpParserBase.cpp Tue Nov 08 10:42:45 2011 -0800
@@ -637,8 +637,6 @@ MUP_NAMESPACE_START
MUP_ASSERT(a_stOpt.size()>0);
MUP_ASSERT(a_stVal.size()>=3);
MUP_ASSERT(a_stOpt.top()->GetCode()==cmELSE);
-
- IToken &tokElse = *(a_stOpt.top().Get());
// it then else is a ternary operator Pop all three values from the value
// stack and just return the right value
@@ -906,7 +904,6 @@ MUP_NAMESPACE_START
//
case cmOPRT_POSTFIX:
{
- ICallback *pOprt = pTok->AsICallback();
MUP_ASSERT(stVal.size());
ptr_val_type &pVal(stVal.top());
diff -r 5a4d909d9533 -r 8ecf53e02278 muparserx/parser/mpRPN.cpp
--- a/muparserx/parser/mpRPN.cpp Tue Nov 08 10:39:59 2011 -0800
+++ b/muparserx/parser/mpRPN.cpp Tue Nov 08 10:42:45 2011 -0800
@@ -129,6 +129,8 @@ MUP_NAMESPACE_START
idx = stElse.pop();
static_cast<TokenIfThenElse*>(m_vRPN[idx].Get())->SetOffset(i - idx);
break;
+ default:
+ break;
}
}
}
diff -r 5a4d909d9533 -r 8ecf53e02278 muparserx/parser/mpTest.cpp
--- a/muparserx/parser/mpTest.cpp Tue Nov 08 10:39:59 2011 -0800
+++ b/muparserx/parser/mpTest.cpp Tue Nov 08 10:42:45 2011 -0800
@@ -52,7 +52,6 @@ MUP_NAMESPACE_START
virtual void Eval(ptr_val_type &ret, const ptr_val_type *a_pArg, int a_iArgc)
{
- ParserXBase &parser = *GetParent();
*ret = 0;
}
@@ -1280,7 +1279,6 @@ MUP_NAMESPACE_START
//---------------------------------------------------------------------------
int ParserTester::ThrowTest(const string_type &a_sExpr, int a_nErrc, int a_nPos)
{
- bool a_bFail = true;
ParserTester::c_iCount++;
try
@@ -1558,7 +1556,6 @@ MUP_NAMESPACE_START
if (v1.IsMatrix())
{
- bool bCheck = true;
for (int i=0; i<v1.GetRows(); ++i)
{
if (!Check(v1.At(i), v2.At(i)))
diff -r 5a4d909d9533 -r 8ecf53e02278 muparserx/parser/mpValReader.cpp
--- a/muparserx/parser/mpValReader.cpp Tue Nov 08 10:39:59 2011 -0800
+++ b/muparserx/parser/mpValReader.cpp Tue Nov 08 10:42:45 2011 -0800
@@ -51,9 +51,8 @@ MUP_NAMESPACE_START
{
stringstream_type stream(a_szExpr + a_iPos);
float_type fVal(0);
- std::streamoff iStart(0), iEnd(0);
+ std::streamoff iEnd(0);
- iStart = stream.tellg(); // Record position before reading
stream >> fVal;
iEnd = stream.tellg(); // Position after reading
More information about the CIG-COMMITS
mailing list