summaryrefslogtreecommitdiff
path: root/plugins/Variables/src/parse_math.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Variables/src/parse_math.cpp')
-rw-r--r--plugins/Variables/src/parse_math.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/plugins/Variables/src/parse_math.cpp b/plugins/Variables/src/parse_math.cpp
index c6aedf013b..182b89b754 100644
--- a/plugins/Variables/src/parse_math.cpp
+++ b/plugins/Variables/src/parse_math.cpp
@@ -26,9 +26,9 @@ static wchar_t* parseAdd(ARGUMENTSINFO *ai)
int result = 0;
for (unsigned int i = 1; i < ai->argc; i++)
- result += ttoi(ai->argv.w[i]);
+ result += _wtoi(ai->argv.w[i]);
- return itot(result);
+ return _itow(result);
}
static wchar_t* parseDiv(ARGUMENTSINFO *ai)
@@ -36,12 +36,12 @@ static wchar_t* parseDiv(ARGUMENTSINFO *ai)
if (ai->argc != 3)
return nullptr;
- int val1 = ttoi(ai->argv.w[1]);
- int val2 = ttoi(ai->argv.w[2]);
+ int val1 = _wtoi(ai->argv.w[1]);
+ int val2 = _wtoi(ai->argv.w[2]);
if (val2 == 0)
return nullptr;
- return itot(val1 / val2);
+ return _itow(val1 / val2);
}
static wchar_t* parseHex(ARGUMENTSINFO *ai)
@@ -52,8 +52,8 @@ static wchar_t* parseHex(ARGUMENTSINFO *ai)
if (ai->argc != 3)
return nullptr;
- int val = ttoi(ai->argv.w[1]);
- int padding = ttoi(ai->argv.w[2]);
+ int val = _wtoi(ai->argv.w[1]);
+ int padding = _wtoi(ai->argv.w[2]);
mir_snwprintf(szVal, L"%x", val);
unsigned int zeros = max(padding - (signed int)mir_wstrlen(szVal), 0);
wchar_t *res = (wchar_t*)mir_alloc((zeros + mir_wstrlen(szVal) + 3)*sizeof(wchar_t));
@@ -74,12 +74,12 @@ static wchar_t* parseMod(ARGUMENTSINFO *ai)
if (ai->argc != 3)
return nullptr;
- int val1 = ttoi(ai->argv.w[1]);
- int val2 = ttoi(ai->argv.w[2]);
+ int val1 = _wtoi(ai->argv.w[1]);
+ int val2 = _wtoi(ai->argv.w[2]);
if (val2 == 0)
return nullptr;
- return itot(val1 % val2);
+ return _itow(val1 % val2);
}
static wchar_t* parseMul(ARGUMENTSINFO *ai)
@@ -87,11 +87,11 @@ static wchar_t* parseMul(ARGUMENTSINFO *ai)
if (ai->argc < 3)
return nullptr;
- int result = ttoi(ai->argv.w[1]);
+ int result = _wtoi(ai->argv.w[1]);
for (unsigned i = 2; i < ai->argc; i++)
- result *= ttoi(ai->argv.w[i]);
+ result *= _wtoi(ai->argv.w[i]);
- return itot(result);
+ return _itow(result);
}
static wchar_t* parseMuldiv(ARGUMENTSINFO *ai)
@@ -99,10 +99,10 @@ static wchar_t* parseMuldiv(ARGUMENTSINFO *ai)
if (ai->argc != 4)
return nullptr;
- if (ttoi(ai->argv.w[3]) == 0)
+ if (_wtoi(ai->argv.w[3]) == 0)
return nullptr;
- return itot((ttoi(ai->argv.w[1])*ttoi(ai->argv.w[2])) / ttoi(ai->argv.w[3]));
+ return _itow((_wtoi(ai->argv.w[1])*_wtoi(ai->argv.w[2])) / _wtoi(ai->argv.w[3]));
}
static wchar_t* parseMin(ARGUMENTSINFO *ai)
@@ -110,11 +110,11 @@ static wchar_t* parseMin(ARGUMENTSINFO *ai)
if (ai->argc < 2)
return nullptr;
- int minVal = ttoi(ai->argv.w[1]);
+ int minVal = _wtoi(ai->argv.w[1]);
for (unsigned i = 2; i < ai->argc; i++)
- minVal = min(ttoi(ai->argv.w[i]), minVal);
+ minVal = min(_wtoi(ai->argv.w[i]), minVal);
- return itot(minVal);
+ return _itow(minVal);
}
static wchar_t* parseMax(ARGUMENTSINFO *ai)
@@ -122,11 +122,11 @@ static wchar_t* parseMax(ARGUMENTSINFO *ai)
if (ai->argc < 2)
return nullptr;
- int maxVal = ttoi(ai->argv.w[1]);
+ int maxVal = _wtoi(ai->argv.w[1]);
for (unsigned i = 2; i < ai->argc; i++)
- maxVal = max(ttoi(ai->argv.w[i]), maxVal);
+ maxVal = max(_wtoi(ai->argv.w[i]), maxVal);
- return itot(maxVal);
+ return _itow(maxVal);
}
static wchar_t* parseNum(ARGUMENTSINFO *ai)
@@ -134,9 +134,9 @@ static wchar_t* parseNum(ARGUMENTSINFO *ai)
if (ai->argc != 3)
return nullptr;
- int val = ttoi(ai->argv.w[1]);
- int padding = ttoi(ai->argv.w[2]);
- wchar_t *szVal = itot(val);
+ int val = _wtoi(ai->argv.w[1]);
+ int padding = _wtoi(ai->argv.w[2]);
+ wchar_t *szVal = _itow(val);
if (szVal == nullptr)
return nullptr;
@@ -160,7 +160,7 @@ static wchar_t* parseNum(ARGUMENTSINFO *ai)
static wchar_t* parseRand(ARGUMENTSINFO *)
{
- return itot(rand());
+ return _itow(rand());
}
static wchar_t* parseSub(ARGUMENTSINFO *ai)
@@ -168,11 +168,11 @@ static wchar_t* parseSub(ARGUMENTSINFO *ai)
if (ai->argc < 3)
return nullptr;
- int result = ttoi(ai->argv.w[1]);
+ int result = _wtoi(ai->argv.w[1]);
for (unsigned i = 2; i < ai->argc; i++)
- result -= ttoi(ai->argv.w[i]);
+ result -= _wtoi(ai->argv.w[i]);
- return itot(result);
+ return _itow(result);
}
void registerMathTokens()