/*
* qrencode - QR Code encoder
*
* Input data chunk class
* Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@fukuchi.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "qrencode.h"
#include "qrspec.h"
#include "mqrspec.h"
#include "bitstream.h"
#include "qrinput.h"
/******************************************************************************
* Utilities
*****************************************************************************/
int QRinput_isSplittableMode(QRencodeMode mode)
{
return (mode >= QR_MODE_NUM && mode <= QR_MODE_KANJI);
}
/******************************************************************************
* Entry of input data
*****************************************************************************/
static QRinput_List *QRinput_List_newEntry(QRencodeMode mode, int size, const unsigned char *data)
{
QRinput_List *entry;
if(QRinput_check(mode, size, data)) {
errno = EINVAL;
return NULL;
}
entry = (QRinput_List *)malloc(sizeof(QRinput_List));
if(entry == NULL) return NULL;
entry->mode = mode;
entry->size = size;
if(size > 0) {
entry->data = (unsigned char *)malloc(size);
if(entry->data == NULL) {
free(entry);
return NULL;
}
memcpy(entry->data, data, size);
}
entry->bstream = NULL;
entry->next = NULL;
return entry;
}
static void QRinput_List_freeEntry(QRinput_List *entry)
{
if(entry != NULL) {
free(entry->data);
BitStream_free(entry->bstream);
free(entry);
}
}
static QRinput_List *QRinput_List_dup(QRinput_List *entry)
{
QRinput_List *n;
n = (QRinput_List *)malloc(sizeof(QRinput_List));
if(n == NULL) return NULL;
n->mode = entry->mode;
n->size = entry->size;
n->data = (unsigned char *)malloc(n->size);
if(n->data == NULL) {
free(n);
return NULL;
}
memcpy(n->data, entry->data, entry->size);
n->bstream = NULL;
n->next = NULL;
return n;
}
/******************************************************************************
* Input Data
*****************************************************************************/
QRinput *QRinput_new(void)
{
return QRinput_new2(0, QR_ECLEVEL_L);
}
QRinput *QRinput_new2(int version, QRecLevel level)
{
QRinput *input;
if(version < 0 || version > QRSPEC_VERSION_MAX || level > QR_ECLEVEL_H) {
errno = EINVAL;
return NULL;
}
input = (QRinput *)malloc(sizeof(QRinput));
if(input == NULL) return NULL;
input->head = NULL;
input->tail = NULL;
input->version = version;
input->level = level;
input->mqr = 0;
input->fnc1 = 0;
return input;
}
QRinput *QRinput_newMQR(int version, QRecLevel level)
{
QRinput *input;
if(version <= 0 || version > MQRSPEC_VERSION_MAX) goto INVALID;
if((MQRspec_getECCLength(version, level) == 0)) goto INVALID;
input = QRinput_new2(version, level);
if(input == NULL) return NULL;
input->mqr = 1;
return input;
INVALID:
errno = EINVAL;
return NULL;
}
int QRinput_getVersion(QRinput *input)
{
return input->version;
}
int QRinput_setVersion(QRinput *input, int version)
{
if(input->mqr || version < 0 || version > QRSPEC_VERSION_MAX) {
errno = EINVAL;
return -1;
}
input->version = version;
return 0;
}
QRecLevel QRinput_getErrorCorrectionLevel(QRinput *input)
{
return input->level;
}
int QRinput_setErrorCorrectionLevel(QRinput *input, QRecLevel level)
{
if(input->mqr || level > QR_ECLEVEL_H) {
errno = EINVAL;
return -1;
}
input->level = level;
return 0;
}
int QRinput_setVersionAndErrorCorrectionLevel(QRinput *input, int version, QRecLevel level)
{
if(input->mqr) {
if(version <= 0 || version > MQRSPEC_VERSION_MAX) goto INVALID;
if((MQRspec_getECCLength(version, level) == 0)) goto INVALID;
} else {
if(version < 0 || version > QRSPEC_VERSION_MAX) goto INVALID;
if(level > QR_ECLEVEL_H) goto INVALID;
}
input->version = version;
input->level = level;
return 0;
INVALID:
errno = EINVAL;
return -1;
}
static void QRinput_appendEntry(QRinput *input, QRinput_List *entry)
{
if(input->tail == NULL) {
input->head = entry;
input->tail = entry;
} else {
input->tail->next = entry;
input->tail = entry;
}
entry->next = NULL;
}
int QRinput_append(QRinput *input, QRencodeMode mode, int size, const unsigned char *data)
{
QRinput_List *entry;
entry = QRinput_List_newEntry(mode, size, data);
if(entry == NULL) {
return -1;
}
QRinput_appendEntry(input, entry);
return 0;
}
/**
* Insert a structured-append header to the head of the input data.
* @param input input data.
* @param size number of structured symbols.
* @param number index number of the symbol. (1 <= number <= size)
* @param parity parity among input data. (NOTE: each symbol of a set of structured symbols has the same parity data)
* @retval 0 success.
* @retval -1 error occurred and errno is set to indeicate the error. See Execptions for the details.
* @throw EINVAL invalid parameter.
* @throw ENOMEM unable to allocate memory.
*/
__STATIC int QRinput_insertStructuredAppendHeader(QRinput *input, int size, int number, unsigned char parity)
{
QRinput_List *entry;
unsigned char buf[3];
if(size > MAX_STRUCTURED_SYMBOLS) {
errno = EINVAL;
return -1;
}
if(number <= 0 || number > size) {
errno = EINVAL;
return -1;
}
buf[0] = (unsigned char)size;
buf[1] = (unsigned char)number;
buf[2] = parity;
entry = QRinput_List_newEntry(QR_MODE_STRUCTURE, 3, buf);
if(entry == NULL) {
return -1;
}
entry->next = input->head;
input->head = entry;
return 0;
}
int QRinput_appendECIheader(QRinput *input, unsigned int ecinum)
{
unsigned char data[4];
if(ecinum > 999999) {
errno = EINVAL;
return -1;
}
/* We manually create byte array of ecinum because
(unsigned char *)&ecinum may cause bus error on some architectures, */
data[0] = ecinum & 0xff;
data[1] = (ecinum >> 8) & 0xff;
data[2] = (ecinum >> 16) & 0xff;
data[3] = (ecinum >> 24) & 0xff;
return QRinput_append(input, QR_MODE_ECI, 4, data);
}
void QRinput_free(QRinput *input)
{
QRinput_List *list, *next;
if(input != NULL) {
list = input->head;
while(list != NULL) {
next = list->next;
QRinput_List_freeEntry(list);
list = next;
}
free(input);
}
}
static unsigned char QRinput_calcParity(QRinput *input)
{
unsigned char parity = 0;
QRinput_List *list;
int i;
list = input->head;
while(list != NULL) {
if(list->mode != QR_MODE_STRUCTURE) {
for(i=list->size-1; i>=0; i--) {
parity ^= list->data[i];
}
}
list = list->next;
}
return parity;
}
QRinput *QRinput_dup(QRinput *input)
{
QRinput *n;
QRinput_List *list, *e;
if(input->mqr) {
n = QRinput_newMQR(input->version, input->level);
} else {
n = QRinput_new2(input->version, input->level);
}
if(n == NULL) return NULL;
list = input->head;
while(list != NULL) {
e = QRinput_List_dup(list);
if(e == NULL) {
QRinput_free(n);
return NULL;
}
QRinput_appendEntry(n, e);
list = list->next;
}
return n;
}
/******************************************************************************
* Numeric data
*****************************************************************************/
/**
* Check the input data.
* @param size
* @param data
* @return result
*/
static int QRinput_checkModeNum(int size, const char *dat
没有合适的资源?快使用搜索试试~ 我知道了~
基于QT的小型OA-ERP系统(源码1)
共523个文件
png:328个
h:62个
cpp:52个
4星 · 超过85%的资源 需积分: 46 160 下载量 136 浏览量
2019-11-08
15:39:42
上传
评论 16
收藏 11.14MB RAR 举报
温馨提示
展示链接:https://blog.csdn.net/weixin_39852922/article/details/88723037 Windows环境:Qt5.10(MinGW)、Mysql5.6. 该软件基于C/S架构以及MySql数据库, 采用Qt(C++)开发,设计多线程以及网络通信。实现自动登录、开机自启动、一键自动更新、考勤电子流(加班、请假、忘打卡、外出、出差)、考勤汇总、硬件PCB导出的BOM单处理(导出电装明细表Word,导出采购清单Excel,一键生成采购电子流申请表),库存管理、员工信息管理、图/文编号、上班打卡记录、个人周报提交、邮件、留言板等功能。不同功能操作间设置权限限制
资源推荐
资源详情
资源评论
收起资源包目录
基于QT的小型OA-ERP系统(源码1) (523个子文件)
ZYERP.pro.user.959139b 23KB
min_press.bmp 3KB
min_hover.bmp 3KB
qrinput.c 38KB
qrencode.c 20KB
qrspec.c 15KB
rscode.c 9KB
split.c 8KB
mqrspec.c 7KB
mask.c 7KB
bitstream.c 4KB
mmask.c 4KB
widget.cpp 185KB
emailframe.cpp 67KB
tybh.cpp 35KB
mimegame.cpp 32KB
cgsq.cpp 31KB
qingjia.cpp 29KB
weekreport.cpp 27KB
wangdaka.cpp 27KB
kqhz.cpp 24KB
KeyBoard.cpp 23KB
chuchai.cpp 22KB
bom.cpp 21KB
kcgl.cpp 20KB
waichu.cpp 20KB
jiaban.cpp 19KB
loginwindow.cpp 18KB
ygsz.cpp 14KB
kqhz_sub.cpp 13KB
weekreportmainframe.cpp 12KB
uporloadfiledialog.cpp 11KB
kcgl_subitem.cpp 11KB
dakarecord.cpp 10KB
ygsz_auth_change.cpp 10KB
ygsz_new.cpp 9KB
mytitlebar.cpp 9KB
qexcel.cpp 9KB
tybhmainframe.cpp 8KB
leavemsg.cpp 7KB
tybh_sub.cpp 6KB
wlbh.cpp 6KB
ygsz_authority.cpp 6KB
oasettingform.cpp 5KB
wlbh_sub.cpp 5KB
mymimebtn.cpp 5KB
tcpdealthread.cpp 5KB
changepassword.cpp 4KB
choosetype.cpp 4KB
writemsgform.cpp 4KB
basewindow.cpp 3KB
showudptipmsgdialog.cpp 3KB
signin.cpp 3KB
qrcode.cpp 3KB
chukuform.cpp 2KB
mypushbtn.cpp 1KB
showdontupdatedialog.cpp 804B
aboutoadialog.cpp 752B
main.cpp 693B
maxbutton.cpp 683B
mylineedit.cpp 545B
closebutton.cpp 399B
minbutton.cpp 381B
mytoolbtn.cpp 228B
LoginWindow.css 4KB
MyTitle.css 1KB
back.gif 1.09MB
qrencode.h 20KB
emailframe.h 6KB
qrspec.h 6KB
widget.h 5KB
mqrspec.h 5KB
qrinput.h 4KB
qexcel.h 3KB
mytitlebar.h 3KB
mimegame.h 3KB
qrencode_inner.h 3KB
config.h 2KB
kcgl.h 2KB
split.h 2KB
ygsz.h 2KB
bom.h 2KB
cgsq.h 2KB
qingjia.h 2KB
uporloadfiledialog.h 2KB
tybh.h 2KB
mask.h 2KB
ygsz_auth_change.h 1KB
wangdaka.h 1KB
weekreportmainframe.h 1KB
loginwindow.h 1KB
rscode.h 1KB
jiaban.h 1KB
mymimebtn.h 1KB
bitstream.h 1KB
mmask.h 1KB
chuchai.h 1KB
weekreport.h 1KB
dakarecord.h 1KB
mypushbtn.h 1KB
共 523 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
- 黄河一条鱼2022-04-01图片要全部改成英文吗
- 十启树2021-02-22适合初学者
- imsuperstarest2020-07-28:-1: error: No rule to make target '../ZYERP/images/??3.jpg', needed by 'debug/qrc_images.o'. Stop.Steve1072020-08-17图片中文名导致
- 机器视觉0012020-05-26非常好用,谢谢
Steve107
- 粉丝: 25
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 【岗位说明】机修车间岗位职责.docx
- 【岗位说明】汽车4S店各岗位职责.doc
- 【岗位说明】4S店品牌项目部服务员岗位说明书.doc
- 【岗位说明】汽车保养店店长岗位职责.docx
- 【岗位说明】汽车4S店岗位职责说明书.xls
- 【岗位说明】汽车修理工岗位职责.doc
- 【岗位说明】汽车4S店展厅经理岗位职责.doc
- 【岗位说明】艾蒂诺珠宝市场督导岗位职责.doc
- 【岗位说明】杭州十一郎珠宝公司企划部人员岗位职责.doc
- 【岗位说明】珠宝顾问岗位职责.doc
- 【岗位说明】珠宝店长岗位职责01.doc
- 【岗位说明】珠宝行业组织架构及岗位职责01.doc
- 【岗位说明】珠宝零售门店各岗位财务管理职责.doc
- 【岗位说明】珠宝专卖店店长工作职责.doc
- 【岗位说明】珠宝行业组织架构及职责.doc
- 【岗位说明】珠宝销售员岗位职责.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功