资源简介
qrencode库,包含源码,32位库,64位库。qrencode库主要用于二维码的生成。
代码片段和文件信息
/*
* qrencode - QR Code encoder
*
* Binary sequence class.
* Copyright (C) 2006-2017 Kentaro Fukuchi
*
* 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
#include
#include
#include “bitstream.h“
#define DEFAULT_BUFSIZE (128)
BitStream *BitStream_new(void)
{
BitStream *bstream;
bstream = (BitStream *)malloc(sizeof(BitStream));
if(bstream == NULL) return NULL;
bstream->length = 0;
bstream->data = (unsigned char *)malloc(DEFAULT_BUFSIZE);
if(bstream->data == NULL) {
free(bstream);
return NULL;
}
bstream->datasize = DEFAULT_BUFSIZE;
return bstream;
}
#ifdef WITH_TESTS
BitStream *BitStream_newWithBits(int size unsigned char *bits)
{
BitStream *bstream;
if(size < 0) return NULL;
if(size == 0) return BitStream_new();
bstream = (BitStream *)malloc(sizeof(BitStream));
if(bstream == NULL) return NULL;
bstream->data = (unsigned char *)malloc(size);
if(bstream->data == NULL) {
free(bstream);
return NULL;
}
bstream->length = size;
bstream->datasize = size;
memcpy(bstream->data bits size);
return bstream;
}
#endif
static int BitStream_expand(BitStream *bstream)
{
unsigned char *data;
data = (unsigned char *)realloc(bstream->data bstream->datasize * 2);
if(data == NULL) {
return -1;
}
bstream->data = data;
bstream->datasize *= 2;
return 0;
}
static void BitStream_writeNum(unsigned char *dest int bits unsigned int num)
{
unsigned int mask;
int i;
unsigned char *p;
p = dest;
mask = 1 << (bits - 1);
for(i = 0; i < bits; i++) {
if(num & mask) {
*p = 1;
} else {
*p = 0;
}
p++;
mask = mask >> 1;
}
}
static void BitStream_writeBytes(unsigned char *dest int size unsigned char *data)
{
unsigned char mask;
int i j;
unsigned char *p;
p = dest;
for(i = 0; i < size; i++) {
mask = 0x80;
for(j = 0; j < 8; j++) {
if(data[i] & mask) {
*p = 1;
} else {
*p = 0;
}
p++;
mask = mask >> 1;
}
}
}
int BitStream_append(BitStream *bstream BitStream *arg)
{
int ret;
if(arg == NULL) {
return -1;
}
if(arg->length == 0) {
return 0;
}
while(bstream->length + arg->length > bstream->datasize) {
ret = BitStream_expand(bstream);
if(ret < 0) return ret;
}
memcpy(bstream->data + bstrea
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-01-03 15:59 libqrencode库\
目录 0 2018-01-03 15:58 libqrencode库\libqrencode-32\
目录 0 2018-01-03 15:58 libqrencode库\libqrencode-32\include\
文件 1595 2017-09-07 11:37 libqrencode库\libqrencode-32\include\bitstream.h
文件 1621 2017-09-07 11:37 libqrencode库\libqrencode-32\include\mask.h
文件 1392 2017-09-07 11:37 libqrencode库\libqrencode-32\include\mmask.h
文件 4943 2017-09-06 21:15 libqrencode库\libqrencode-32\include\mqrspec.h
文件 20787 2017-12-28 22:30 libqrencode库\libqrencode-32\include\qrencode.h
文件 2766 2017-09-07 11:38 libqrencode库\libqrencode-32\include\qrencode_inner.h
文件 3665 2017-09-07 11:38 libqrencode库\libqrencode-32\include\qrinput.h
文件 5992 2017-09-07 11:38 libqrencode库\libqrencode-32\include\qrspec.h
文件 1225 2017-09-07 11:39 libqrencode库\libqrencode-32\include\rsecc.h
文件 1900 2017-09-07 11:39 libqrencode库\libqrencode-32\include\split.h
目录 0 2018-01-03 15:58 libqrencode库\libqrencode-32\lib\
文件 66090 2018-01-03 15:37 libqrencode库\libqrencode-32\lib\qrencode.lib
文件 162012 2018-01-03 15:37 libqrencode库\libqrencode-32\lib\qrencoded.lib
目录 0 2018-01-03 15:59 libqrencode库\libqrencode-64\
目录 0 2018-01-03 15:59 libqrencode库\libqrencode-64\include\
文件 1595 2017-09-07 11:37 libqrencode库\libqrencode-64\include\bitstream.h
文件 1621 2017-09-07 11:37 libqrencode库\libqrencode-64\include\mask.h
文件 1392 2017-09-07 11:37 libqrencode库\libqrencode-64\include\mmask.h
文件 4943 2017-09-06 21:15 libqrencode库\libqrencode-64\include\mqrspec.h
文件 20787 2017-12-28 22:30 libqrencode库\libqrencode-64\include\qrencode.h
文件 2766 2017-09-07 11:38 libqrencode库\libqrencode-64\include\qrencode_inner.h
文件 3665 2017-09-07 11:38 libqrencode库\libqrencode-64\include\qrinput.h
文件 5992 2017-09-07 11:38 libqrencode库\libqrencode-64\include\qrspec.h
文件 1225 2017-09-07 11:39 libqrencode库\libqrencode-64\include\rsecc.h
文件 1900 2017-09-07 11:39 libqrencode库\libqrencode-64\include\split.h
目录 0 2018-01-03 15:59 libqrencode库\libqrencode-64\lib\
文件 141248 2017-12-28 23:05 libqrencode库\libqrencode-64\lib\qrencode.lib
文件 183976 2017-12-28 23:04 libqrencode库\libqrencode-64\lib\qrencoded.lib
............此处省略84个文件信息
评论
共有 条评论