From: Sylvestre Ledru Date: Wed, 13 Mar 2013 12:39:06 +0000 (+0100) Subject: Remove deadcode: latintoutf X-Git-Tag: 5.4.1~232 X-Git-Url: http://gitweb.scilab.org/?p=scilab.git;a=commitdiff_plain;h=92cc044f6beafdaf29e0064adf59ca72deb66343;hp=e8049c4ff51f7621cce51f9e415eba9d219054bd Remove deadcode: latintoutf Found thanks to the code coverage: http://scan-build.scilab.org/code-coverage-c/spreadsheet/src/c/index.html Change-Id: I228b4f0f4114f926135a7410e0eb860690fbd4a2 --- diff --git a/scilab/modules/spreadsheet/Makefile.am b/scilab/modules/spreadsheet/Makefile.am index e299a16..e61364f 100644 --- a/scilab/modules/spreadsheet/Makefile.am +++ b/scilab/modules/spreadsheet/Makefile.am @@ -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 diff --git a/scilab/modules/spreadsheet/spreadsheet.vcxproj b/scilab/modules/spreadsheet/spreadsheet.vcxproj index 3028015..e72d345 100644 --- a/scilab/modules/spreadsheet/spreadsheet.vcxproj +++ b/scilab/modules/spreadsheet/spreadsheet.vcxproj @@ -236,7 +236,6 @@ - @@ -269,7 +268,6 @@ - @@ -285,4 +283,4 @@ - \ No newline at end of file + diff --git a/scilab/modules/spreadsheet/spreadsheet.vcxproj.filters b/scilab/modules/spreadsheet/spreadsheet.vcxproj.filters index 4dd730b..4c70b9a 100644 --- a/scilab/modules/spreadsheet/spreadsheet.vcxproj.filters +++ b/scilab/modules/spreadsheet/spreadsheet.vcxproj.filters @@ -1,4 +1,4 @@ - + @@ -79,9 +79,6 @@ Header Files - - Header Files - Header Files diff --git a/scilab/modules/spreadsheet/src/c/latintoutf.c b/scilab/modules/spreadsheet/src/c/latintoutf.c deleted file mode 100644 index 806ecc3..0000000 --- a/scilab/modules/spreadsheet/src/c/latintoutf.c +++ /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 -#ifdef _MSC_VER -#include -#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 index b645d93..0000000 --- a/scilab/modules/spreadsheet/src/c/latintoutf.h +++ /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__ */ -// =============================================================================