Merge remote-tracking branch 'origin/master' into windows
[scilab.git] / scilab / modules / ast / src / cpp / types / types_tools.cpp
index ce6458b..8a275ee 100644 (file)
@@ -286,7 +286,7 @@ bool getImplicitIndex(GenericType* _pRef, typed_list* _pArgsIn, std::vector<int>
 
                 //printf("%.2f : %.2f : %.2f\n", start, step, end);
 
-                int size = (end - start) / step + 1;
+                int size = (int)((end - start) / step) + 1;
                 if (size <= 0)
                 {
                     //manage implicit that return []
@@ -296,10 +296,10 @@ bool getImplicitIndex(GenericType* _pRef, typed_list* _pArgsIn, std::vector<int>
 
                 std::vector<int> idx(size);
                 int* pi = idx.data();
-                pi[0] = start - 1; //0-indexed
+                pi[0] = (int)start - 1; //0-indexed
                 for (int j = 1; j < size; ++j)
                 {
-                    pi[j] = pi[j - 1] + step;
+                    pi[j] = pi[j - 1] + (int)step;
                 }
 
                 lstIdx.push_back(idx);
@@ -525,7 +525,7 @@ int checkIndexesArguments(InternalType* _pRef, typed_list* _pArgsIn, typed_list*
                     continue;
                 }
 
-                wchar_t* pFieldName = pStr->get(0);
+                char* pFieldName = pStr->get(0);
 
                 // pCurrent arg is indexed to 1 unlike the return of "getFieldIndex"
                 int iIndex = pStruct->get(0)->getFieldIndex(pFieldName) + 1;
@@ -545,7 +545,7 @@ int checkIndexesArguments(InternalType* _pRef, typed_list* _pArgsIn, typed_list*
                 double* pdbl = pCurrentArg->get();
                 for (int i = 0; i < pStr->getSize(); i++)
                 {
-                    wchar_t* pFieldName = pStr->get(i);
+                    char* pFieldName = pStr->get(i);
                     int iIndex = pTL->getIndexFromString(pFieldName);
                     if (iIndex == -1)
                     {
@@ -676,8 +676,8 @@ int checkIndexesArguments(InternalType* _pRef, typed_list* _pArgsIn, typed_list*
                 //checks if size < size(int)
                 if (pCurrentArg->get(j) >= INT_MAX)
                 {
-                    wchar_t szError[bsiz];
-                    os_swprintf(szError, bsiz, _W("variable size exceeded : less than %d expected.\n").c_str(), INT_MAX);
+                    char szError[bsiz];
+                    os_sprintf(szError, bsiz, _("variable size exceeded : less than %d expected.\n"), INT_MAX);
                     throw ast::InternalError(szError);
                 }
 
@@ -696,8 +696,8 @@ int checkIndexesArguments(InternalType* _pRef, typed_list* _pArgsIn, typed_list*
         }
         else
         {
-            wchar_t szError[bsiz];
-            os_swprintf(szError, bsiz, _W("Invalid index.\n").c_str());
+            char szError[bsiz];
+            os_sprintf(szError, bsiz, _("Invalid index.\n"));
 
             delete[] _piMaxDim;
             delete[] _piCountDim;
@@ -792,7 +792,7 @@ int getIndexWithDims(int* _piIndexes, const int* _piDims, int _iDims)
     return idx;
 }
 
-types::Function::ReturnValue VariableToString(types::InternalType* pIT, const wchar_t* wcsVarName)
+types::Function::ReturnValue VariableToString(types::InternalType* pIT, const char* varName)
 {
     if (pIT->hasToString() == false)
     {
@@ -806,7 +806,7 @@ types::Function::ReturnValue VariableToString(types::InternalType* pIT, const wc
 
         try
         {
-            ret = Overload::generateNameAndCall(L"p", in, 1, out);
+            ret = Overload::generateNameAndCall("p", in, 1, out);
             pIT->DecreaseRef();
             return ret;
         }
@@ -818,14 +818,14 @@ types::Function::ReturnValue VariableToString(types::InternalType* pIT, const wc
     }
     else
     {
-        std::wostringstream ostr;
+        std::ostringstream ostr;
         if (pIT->isFunction())
         {
             pIT->getAs<types::Function>()->toString(ostr);
         }
         else if (pIT->isList() || pIT->isCallable())
         {
-            ostr << wcsVarName;
+            ostr << varName;
         }
 
         //to manage lines information
@@ -839,7 +839,7 @@ types::Function::ReturnValue VariableToString(types::InternalType* pIT, const wc
             if (ConfigVariable::isError())
             {
                 ConfigVariable::resetError();
-                ostr.str(L"");
+                ostr.str("");
                 ConfigVariable::resetExecutionBreak();
                 return types::Function::Error;
             }
@@ -855,8 +855,8 @@ types::Function::ReturnValue VariableToString(types::InternalType* pIT, const wc
                 ostr << std::endl;
             }
 
-            scilabForcedWriteW(ostr.str().c_str());
-            ostr.str(L"");
+            scilabForcedWrite(ostr.str().c_str());
+            ostr.str("");
         }
         while (bFinish == false && ConfigVariable::isExecutionBreak() == false);