Remove deadcode: latintoutf 05/10805/3
Sylvestre Ledru [Wed, 13 Mar 2013 12:39:06 +0000 (13:39 +0100)]
Found thanks to the code coverage:
http://scan-build.scilab.org/code-coverage-c/spreadsheet/src/c/index.html

Change-Id: I228b4f0f4114f926135a7410e0eb860690fbd4a2

scilab/modules/spreadsheet/Makefile.am
scilab/modules/spreadsheet/spreadsheet.vcxproj
scilab/modules/spreadsheet/spreadsheet.vcxproj.filters
scilab/modules/spreadsheet/src/c/latintoutf.c [deleted file]
scilab/modules/spreadsheet/src/c/latintoutf.h [deleted file]

index e299a16..e61364f 100644 (file)
@@ -14,7 +14,6 @@ src/c/csvRead.c \
 src/c/csv_strsubst.c \
 src/c/csvWrite.c \
 src/c/getRange.c \
-src/c/latintoutf.c \
 src/c/splitLine.c \
 src/c/stringToComplex.c \
 src/c/utftolatin.c
index 3028015..e72d345 100644 (file)
     <ClInclude Include="src\c\csv_complex.h" />
     <ClInclude Include="src\c\csv_strsubst.h" />
     <ClInclude Include="src\c\getRange.h" />
-    <ClInclude Include="src\c\latintoutf.h" />
     <ClInclude Include="src\c\ripole\bt-int.h" />
     <ClInclude Include="src\c\ripole\bytedecoders.h" />
     <ClInclude Include="src\c\ripole\logger.h" />
     <ClCompile Include="src\c\csv_strsubst.c" />
     <ClCompile Include="src\c\DllmainSpreadsheet.c" />
     <ClCompile Include="src\c\getRange.c" />
-    <ClCompile Include="src\c\latintoutf.c" />
     <ClCompile Include="src\c\ripole\bt-int.c" />
     <ClCompile Include="src\c\ripole\bytedecoders.c" />
     <ClCompile Include="src\c\ripole\logger.c" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
\ No newline at end of file
+</Project>
index 4dd730b..4c70b9a 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup>
     <Filter Include="Source Files">
@@ -79,9 +79,6 @@
     <ClInclude Include="src\c\getRange.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="src\c\latintoutf.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="src\c\splitLine.h">
       <Filter>Header Files</Filter>
     </ClInclude>
diff --git a/scilab/modules/spreadsheet/src/c/latintoutf.c b/scilab/modules/spreadsheet/src/c/latintoutf.c
deleted file mode 100644 (file)
index 806ecc3..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2010-2011 - DIGITEO - Allan CORNET
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-#include <string.h>
-#ifdef _MSC_VER
-#include <windows.h>
-#include "strdup_windows.h"
-#endif
-#include "latintoutf.h"
-#include "charEncoding.h"
-#include "MALLOC.h"
-// =============================================================================
-#ifdef _MSC_VER
-#pragma comment(lib,"oleaut32.lib")
-#endif
-// =============================================================================
-#define LINE_MAX 4096
-#define EMPTYSTR ""
-// =============================================================================
-char *latintoutf(char *_inString)
-{
-    char *outString = NULL;
-    if (_inString)
-    {
-#ifdef _MSC_VER
-        if (IsValidUTF8(_inString))
-        {
-            outString = strdup(_inString);
-        }
-        else
-        {
-            /* conversion ANSI to UTF */
-            int Len = 0;
-            int newLen = 0;
-            BSTR bstrCode = NULL;
-
-            Len = MultiByteToWideChar(CP_ACP, 0, _inString, lstrlen(_inString), NULL, NULL);
-            bstrCode = SysAllocStringLen(NULL, Len);
-            if (bstrCode)
-            {
-                if (MultiByteToWideChar(CP_ACP, 0, _inString, lstrlen(_inString), bstrCode, Len) == 0)
-                {
-                    return strdup(_inString);
-                }
-
-                newLen = WideCharToMultiByte(CP_UTF8, 0, bstrCode, -1, outString, 0, NULL, NULL);
-                outString = (char*) MALLOC(newLen + 1);
-                if (outString)
-                {
-                    if (WideCharToMultiByte(CP_UTF8, 0, bstrCode, -1, outString, newLen, NULL, NULL) == 0)
-                    {
-                        SysFreeString(bstrCode);
-                        FREE(outString);
-                        return strdup(_inString);
-                    }
-                }
-                else
-                {
-                    outString = strdup(_inString);
-                }
-                SysFreeString(bstrCode);
-                bstrCode = NULL;
-            }
-            else
-            {
-                outString = strdup(_inString);
-            }
-        }
-#else
-        if (IsValidUTF8(_inString))
-        {
-            outString = strdup(_inString);
-        }
-        else
-        {
-            int len = (int)strlen(_inString);
-            int i = 0;
-
-            outString = (char*)MALLOC(((len * 3) + 1) * sizeof(char));
-            if (outString == NULL)
-            {
-                return NULL;
-            }
-            strcpy(outString, EMPTYSTR);
-
-            for (i = 0; i < len; i++)
-            {
-                unsigned char *outUtfChar = NULL;
-                unsigned char inAnsiChar = 0;
-
-                if (_inString[i] < 0)
-                {
-                    inAnsiChar = 256 + _inString[i];
-                }
-                else
-                {
-                    inAnsiChar = _inString[i];
-                }
-
-                if (inAnsiChar < 128)
-                {
-                    outUtfChar = (unsigned char *)CALLOC(2, sizeof(unsigned char));
-                    if (outUtfChar)
-                    {
-                        outUtfChar[0] = inAnsiChar;
-                        outUtfChar[1] = 0;
-                    }
-                }
-                else
-                {
-                    outUtfChar = (unsigned char *)CALLOC(3, sizeof(unsigned char));
-                    if (outUtfChar)
-                    {
-                        outUtfChar[0] = (inAnsiChar >> 6) | 0xC0;
-                        outUtfChar[1] = (inAnsiChar & 0x3F) | 0x80;
-                        outUtfChar[2] = 0;
-                    }
-                }
-
-                if (outUtfChar)
-                {
-                    strcat(outString, (char*)outUtfChar);
-                    FREE(outUtfChar);
-                    outUtfChar = NULL;
-                }
-            }
-        }
-#endif
-    }
-    return outString;
-}
-/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/spreadsheet/src/c/latintoutf.h b/scilab/modules/spreadsheet/src/c/latintoutf.h
deleted file mode 100644 (file)
index b645d93..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2010-2011 - DIGITEO - Allan CORNET
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
- *
- */
-#ifndef __LATINTOUTF_H__
-#define __LATINTOUTF_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-    char *latintoutf(char *_inString);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* __LATINTOUTF_H__ */
-// =============================================================================