/*
/ freexl.c
/
/ FreeXL implementation
/
/ version 1.0, 2011 July 26
/
/ Author: Sandro Furieri a.furieri@lqt.it
/
/ ------------------------------------------------------------------------------
/
/ Version: MPL 1.1/GPL 2.0/LGPL 2.1
/
/ The contents of this file are subject to the Mozilla Public License Version
/ 1.1 (the "License"); you may not use this file except in compliance with
/ the License. You may obtain a copy of the License at
/ http://www.mozilla.org/MPL/
/
/ Software distributed under the License is distributed on an "AS IS" basis,
/ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
/ for the specific language governing rights and limitations under the
/ License.
/
/ The Original Code is the FreeXL library
/
/ The Initial Developer of the Original Code is Alessandro Furieri
/
/ Portions created by the Initial Developer are Copyright (C) 2011
/ the Initial Developer. All Rights Reserved.
/
/ Contributor(s):
/ Brad Hards
/
/ Alternatively, the contents of this file may be used under the terms of
/ either the GNU General Public License Version 2 or later (the "GPL"), or
/ the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
/ in which case the provisions of the GPL or the LGPL are applicable instead
/ of those above. If you wish to allow use of your version of this file only
/ under the terms of either the GPL or the LGPL, and not to allow others to
/ use your version of this file under the terms of the MPL, indicate your
/ decision by deleting the provisions above and replace them with the notice
/ and other provisions required by the GPL or the LGPL. If you do not delete
/ the provisions above, a recipient may use your version of this file under
/ the terms of any one of the MPL, the GPL or the LGPL.
/
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#if defined(__MINGW32__) || defined(_WIN32)
#define LIBICONV_STATIC
#include <iconv.h>
#define LIBCHARSET_STATIC
#ifdef _MSC_VER
/* <localcharset.h> isn't supported on OSGeo4W */
/* applying a tricky workaround to fix this issue */
extern const char *locale_charset (void);
#else /* sane Windows - not OSGeo4W */
#include <localcharset.h>
#endif /* end localcharset */
#else /* not WINDOWS */
#if defined(__APPLE__) || defined(__ANDROID__)
#include <iconv.h>
#include <localcharset.h>
#else /* neither Mac OsX nor Android */
#include <iconv.h>
#include <langinfo.h>
#endif
#endif
#if defined(_WIN32) && !defined(__MINGW32__)
#include "config-msvc.h"
#else
#include "config.h"
#endif
#include "freexl.h"
#include "freexl_internals.h"
const char *freexlversion = VERSION;
FREEXL_DECLARE const char *
freexl_version (void)
{
/* return the library version number */
return freexlversion;
}
#if defined(_WIN32) && !defined(__MINGW32__) && _MSC_VER < 1800
/* obsolete MSVC compiler doesn't support lround() at all */
static double
round (double num)
{
double integer = ceil (num);
if (num > 0)
return integer - num > 0.5 ? integer - 1.0 : integer;
return integer - num >= 0.5 ? integer - 1.0 : integer;
}
static long
lround (double num)
{
long integer = (long) round (num);
return integer;
}
#endif
static void
swap16 (biff_word16 * word)
{
/* Endianness: swapping a 16 bit word */
unsigned char save = word->bytes[0];
word->bytes[0] = word->bytes[1];
word->bytes[1] = save;
}
static void
swap32 (biff_word32 * word)
{
/* Endianness: swapping a 32 bit word */
unsigned char save0 = word->bytes[0];
unsigned char save1 = word->bytes[1];
unsigned char save2 = word->bytes[2];
word->bytes[0] = word->bytes[3];
word->bytes[1] = save2;
word->bytes[2] = save1;
word->bytes[3] = save0;
}
static void
swap_float (biff_float * word)
{
/* Endianness: swapping a 64 bit float */
unsigned char save0 = word->bytes[0];
unsigned char save1 = word->bytes[1];
unsigned char save2 = word->bytes[2];
unsigned char save3 = word->bytes[3];
unsigned char save4 = word->bytes[4];
unsigned char save5 = word->bytes[5];
unsigned char save6 = word->bytes[6];
word->bytes[0] = word->bytes[7];
word->bytes[1] = save6;
word->bytes[2] = save5;
word->bytes[3] = save4;
word->bytes[4] = save3;
word->bytes[5] = save2;
word->bytes[6] = save1;
word->bytes[7] = save0;
}
static int
biff_set_utf8_converter (biff_workbook * workbook)
{
/* attempting to set up a charset converter to UTF-8 */
iconv_t cvt = (iconv_t) (-1);
if (workbook->utf8_converter)
iconv_close (workbook->utf8_converter);
workbook->utf8_converter = NULL;
switch (workbook->biff_code_page)
{
case 0x016F:
cvt = iconv_open ("UTF-8", "ASCII");
break;
case 0x01B5:
cvt = iconv_open ("UTF-8", "CP437");
break;
case 0x02D0:
cvt = iconv_open ("UTF-8", "CP720");
break;
case 0x02E1:
cvt = iconv_open ("UTF-8", "CP737");
break;
case 0x0307:
cvt = iconv_open ("UTF-8", "CP775");
break;
case 0x0352:
cvt = iconv_open ("UTF-8", "CP850");
break;
case 0x0354:
cvt = iconv_open ("UTF-8", "CP852");
break;
case 0x0357:
cvt = iconv_open ("UTF-8", "CP855");
break;
case 0x0359:
cvt = iconv_open ("UTF-8", "CP857");
break;
case 0x035A:
cvt = iconv_open ("UTF-8", "CP858");
break;
case 0x035C:
cvt = iconv_open ("UTF-8", "CP860");
break;
case 0x035D:
cvt = iconv_open ("UTF-8", "CP861");
break;
case 0x035E:
cvt = iconv_open ("UTF-8", "CP862");
break;
case 0x035F:
cvt = iconv_open ("UTF-8", "CP863");
break;
case 0x0360:
cvt = iconv_open ("UTF-8", "CP864");
break;
case 0x0361:
cvt = iconv_open ("UTF-8", "CP865");
break;
case 0x0362:
cvt = iconv_open ("UTF-8", "CP866");
break;
case 0x0365:
cvt = iconv_open ("UTF-8", "CP869");
break;
case 0x036A:
cvt = iconv_open ("UTF-8", "CP874");
break;
case 0x03A4:
cvt = iconv_open ("UTF-8", "CP932");
break;
case 0x03A8:
cvt = iconv_open ("UTF-8", "CP936");
break;
case 0x03B5:
cvt = iconv_open ("UTF-8", "CP949");
break;
case 0x03B6:
cvt = iconv_open ("UTF-8", "CP950");
break;
case 0x04B0:
cvt = iconv_open ("UTF-8", "UTF-16LE");
break;
case 0x04E2:
cvt = iconv_open ("UTF-8", "CP1250");
break;
case 0x04E3:
cvt = iconv_open ("UTF-8", "CP1251");
break;
case 0x04E4:
case 0x8001:
cvt = iconv_open ("UTF-8", "CP1252");
break;
case 0x04E5:
cvt = iconv_open ("UTF-8", "CP1253");
break;
case 0x04E6:
cvt = iconv_open ("UTF-8", "CP1254");
break;
case 0x04E7:
cvt = iconv_open ("UTF-8", "CP1255");
break;
case 0x04E8:
cvt = iconv_open ("UTF-8", "CP1256");
break;
case 0x04E9:
cvt = iconv_open ("UTF-8", "CP1257");
break;
case 0x04EA:
cvt = iconv_open ("UTF-8", "CP1258");
break;
case 0x0551:
cvt = iconv_open ("UTF-8", "CP1361");
break;
case 0x2710:
case 0x8000:
cvt = iconv_open ("UTF-8", "MacRoman");
break;
};
if (cvt == (iconv_t) (-1))
return 0;
workbook->utf8_converter = cvt;
return 1;
}
static char *
convert_to_utf8 (iconv_t converter, const char *buf, int buflen, int *err)
{
/* converting a string to UTF8 */
char *utf8buf = 0;
#if !defined(__MINGW32__) && defined(_WIN32)
const char *pBuf;
#else
char *pBuf;
#endif
size_t len;
size_t utf8len;
int maxlen = (buflen * 4) + 1;
char *pUtf8buf;
*err = FREEXL_OK;
if (!converter)
{
*err = FREEXL_UNSUPPORTED_CHARSET;
return NULL;
}
utf8buf = malloc (maxlen);
len = buflen;
utf8len = maxlen;
pBuf = (char *) buf;
pUtf8buf = utf8buf;
if (iconv (converter, &pBuf, &len, &pUtf8buf, &utf8len) == (size_t) (-1))
{
free (utf8buf);
*err = FREEXL_INVALID_CHARACTER;
return NULL;
}
utf8buf[maxlen - utf8len] = '\0';
没有合适的资源?快使用搜索试试~ 我知道了~
【QGIS跨平台编译】之【FreeXL跨平台编译】:源码及跨平台编译工程(支撑QGIS跨平台编译,以及二次研发)
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共90个文件
c:22个
xls:14个
in:8个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
2 下载量 83 浏览量
2024-02-07
19:25:55
上传
评论
收藏 944KB ZIP 举报
温馨提示
一、内容概况 QGIS是一个开源的、跨平台的地理信息系统(GIS)软件,用于浏览、编辑和分析地理空间数据,提供了一套丰富的功能,包括地图制作、空间分析、数据管理等。QGIS可以在Windows、Mac OS和Linux等操作系统上运行。 QGIS的跨平台编译需要一系列开源库的支持,本系列提供QGIS相关的编译成果。 本资源的内容为:基于Qt的prot跨平台编译源码(含qt pro文件)。 二、使用人群 QGIS编译、QGIS跨平台编译的人员或研究者。 三、使用场景及目标 在Windows、Linux、MacOS环境下编译使用。 既可以支撑QGIS的跨平台编译工作,也可以进行FreeXL的二次研发。 四、其他说明 基于Qt Creator进行跨平台编译的FreeXL工程源码。包含有各类源码,以及配置好的Qt工程文件。 只需用Qt Creator程序打开pro文件,即可完成在Windows、Linux、MacOS等多环境下的跨平台编译。编译后会自动生成头文件、库文件、动态库等。 当前采用的版本为FreeXL-1.0.6,如果下载者,需要其他版本的FreeXL,请在评论区留言。
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/XLS.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/XLS.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/XLS.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/XLS.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/XLS.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/XLS.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/XLS.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/XLS.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/XLS.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/XLS.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/XLS.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/XLS.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/XLS.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/XLS.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 90 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/b98aeb98173f45faa638d9639d8f6113_luckyhanmo.jpg!1)
翰墨之道
- 粉丝: 3187
- 资源: 182
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)