Differential_equations src: indentation + FREE fixes 64/18764/3
Paul Bignier [Wed, 7 Dec 2016 16:59:33 +0000 (17:59 +0100)]
 * CID 1366847, 1366846, 1366845, 1366844 & 1366843

Change-Id: I96baf14563f1bf53a6b0628e5836784601d4a52a

scilab/modules/differential_equations/sci_gateway/cpp/sci_daskr.cpp
scilab/modules/differential_equations/sci_gateway/cpp/sci_dasrt.cpp
scilab/modules/differential_equations/sci_gateway/cpp/sci_dassl.cpp
scilab/modules/differential_equations/sci_gateway/cpp/sci_intg.cpp
scilab/modules/differential_equations/sci_gateway/cpp/sci_ode.cpp

index a81720f..0d29277 100644 (file)
@@ -1108,12 +1108,10 @@ types::Function::ReturnValue sci_daskr(types::typed_list &in, int _iRetCount, ty
 
             if (bCatch)
             {
-                               char sError[bsiz];
-                               os_sprintf(sError, "%ls: An error occured in '%ls' subroutine.\n", L"daskr", L"ddaskr");
-                               wchar_t* szError = to_wide_string(sError);
+                wchar_t szError[bsiz];
+                os_swprintf(szError, bsiz, _W("%ls: An error occured in '%ls' subroutine.\n").c_str(), L"daskr", L"ddaskr");
                 os << szError;
                 throw ast::InternalError(os.str());
-                               FREE(szError);
             }
 
             return types::Function::Error;
index 2d6058f..bf8a00f 100644 (file)
@@ -786,12 +786,10 @@ types::Function::ReturnValue sci_dasrt(types::typed_list &in, int _iRetCount, ty
 
             if (bCatch)
             {
-                               char sError[bsiz];
-                               os_sprintf(sError, "%ls: An error occured in '%ls' subroutine.\n", L"dasrt", L"ddasrt");
-                               wchar_t* szError = to_wide_string(sError);
+                wchar_t szError[bsiz];
+                os_swprintf(szError, bsiz, _W("%ls: An error occured in '%ls' subroutine.\n").c_str(), L"dasrt", L"ddasrt");
                 os << szError;
                 throw ast::InternalError(os.str());
-                               FREE(szError);
             }
 
             return types::Function::Error;
index 17b72c6..496bb5f 100644 (file)
@@ -720,12 +720,10 @@ types::Function::ReturnValue sci_dassl(types::typed_list &in, int _iRetCount, ty
 
             if (bCatch)
             {
-                               char sError[bsiz];
-                               os_sprintf(sError, "%ls: An error occured in '%ls' subroutine.\n", L"dassl", L"dassl");
-                               wchar_t* szError = to_wide_string(sError);
+                wchar_t szError[bsiz];
+                os_swprintf(szError, bsiz, _W("%ls: An error occured in '%ls' subroutine.\n").c_str(), L"dassl", L"dassl");
                 os << szError;
                 throw ast::InternalError(os.str());
-                               FREE(szError);
             }
 
             return types::Function::Error;
index a6e7be5..ed6d749 100644 (file)
@@ -253,12 +253,10 @@ types::Function::ReturnValue sci_intg(types::typed_list &in, int _iRetCount, typ
 
     if (bCatch)
     {
-               char sError[bsiz];
-               os_sprintf(sError, "%ls: An error occured in '%ls' subroutine.\n", L"intg", L"dqags");
-               wchar_t* szError = to_wide_string(sError);
+        wchar_t szError[bsiz];
+        os_swprintf(szError, bsiz, _W("%ls: An error occured in '%ls' subroutine.\n").c_str(), L"intg", L"dqags");
         os << szError;
         throw ast::InternalError(os.str());
-               FREE(szError);
     }
 
     if (ier)
index d7234c9..0fcbca7 100644 (file)
@@ -1140,12 +1140,12 @@ types::Function::ReturnValue sci_ode(types::typed_list &in, int _iRetCount, type
 
                 if (bCatch)
                 {
-                                       char sError[bsiz];
-                                       os_sprintf(sError, "%ls: An error occured in '%s' subroutine.\n", L"ode", strMeth.c_str());
-                                       wchar_t* szError = to_wide_string(sError);
+                    wchar_t szError[bsiz];
+                    wchar_t* tmp = to_wide_string(strMeth.c_str());
+                    os_swprintf(szError, bsiz, _W("%ls: An error occured in '%ls' subroutine.\n").c_str(), L"ode", tmp);
                     os << szError;
+                    FREE(tmp);
                     throw ast::InternalError(os.str());
-                                       FREE(szError);
                 }
 
                 return types::Function::Error;
@@ -1362,12 +1362,12 @@ types::Function::ReturnValue sci_ode(types::typed_list &in, int _iRetCount, type
 
                 if (bCatch)
                 {
-                                       char sError[bsiz];
-                                       os_sprintf(sError, "%ls: An error occured in '%s' subroutine.\n", L"ode", strMeth.c_str());
-                                       wchar_t* szError = to_wide_string(sError);
+                    char sError[bsiz];
+                    os_sprintf(sError, "%ls: An error occured in '%s' subroutine.\n", L"ode", strMeth.c_str());
+                    wchar_t* szError = to_wide_string(sError);
                     os << szError;
+                    FREE(szError);
                     throw ast::InternalError(os.str());
-                                       FREE(szError);
                 }
 
                 return types::Function::Error;