Improve portability.

This commit is contained in:
yzrh 2020-12-31 18:43:29 +00:00
parent 1f62c53da6
commit 3bd7ea7520
6 changed files with 24 additions and 36 deletions

View file

@ -11,6 +11,13 @@ any failures with a sample that can reproduce the behaviour.
HN support is being worked on.
Dependency
----------
1. OpenSSL
2. libiconv
3. zlib
Usage
=====

View file

@ -1,28 +0,0 @@
#
# Copyright (c) 2020, yzrh <yzrh@noema.org>
#
# SPDX-License-Identifier: Apache-2.0
#
src != ls *.c
obj = ${src:.c=.o}
PREFIX = /usr/local
CFLAGS = -O3 -march=native -pipe -Wall
LDFLAGS = -Wl,-O3 -lcrypto -lz -Wl,--as-needed
all: ${obj}
${CC} ${LDFLAGS} -o melon $^
clean:
rm -f melon ${obj}
install:
install -d ${PREFIX}/bin
install melon ${PREFIX}/bin/
deinstall:
rm -f ${PREFIX}/bin/melon
.PHONY: all clean install deinstall

View file

@ -4,16 +4,25 @@
# SPDX-License-Identifier: Apache-2.0
#
src != ls *.c
src = melon.c iconv.c zlib.c \
cnki_caj.c cnki_hn.c cnki_kdh.c cnki_outline_tree.c \
cnki_pdf.c cnki_xml.c cnki_zlib.c cnki.c \
pdf_cnki.c pdf_get.c pdf_parser.c pdf_writer.c pdf.c
inc = extern.h version.h iconv.h zlib.h \
cnki.h pdf_cnki.h pdf.h
obj = ${src:.c=.o}
PREFIX = /usr/local
CFLAGS = -O3 -march=native -pipe -flto=thin -Wall
LDFLAGS = -Wl,-O3 -lcrypto -lz -Wl,--as-needed
LDFLAGS = -Wl,-O3 -lcrypto -liconv -lz -Wl,--as-needed
all: ${obj}
${CC} ${LDFLAGS} -o melon $>
CFLAGS += -I/usr/local/include
LDFLAGS += -L/usr/local/lib
all: ${obj} ${inc}
${CC} ${LDFLAGS} -o melon ${obj}
clean:
rm -f melon ${obj}

View file

@ -45,7 +45,7 @@ typedef struct _object_outline_tree_t {
} object_outline_tree_t;
typedef enum _hn_code {
CCITTFAX,
JBIG,
DCT_0,
DCT_1, /* Inverted */
JBIG2,

View file

@ -172,7 +172,7 @@ cnki_hn(cnki_t **param)
conv_src[0] = buf[i + 7];
conv_src[1] = buf[i + 6];
conv_size = 512;
conv_size = 6;
if (strconv(&conv_dst, "UTF-16BE",
conv_src, "GB18030", &conv_size) == 0) {
@ -202,7 +202,7 @@ cnki_hn(cnki_t **param)
conv_src[0] = ptr->text[i + 3];
conv_src[1] = ptr->text[i + 2];
conv_size = 512;
conv_size = 6;
if (strconv(&conv_dst, "UTF-16BE",
conv_src, "GB18030", &conv_size) == 0) {

View file

@ -42,7 +42,7 @@ _outline(pdf_object_t **pdf, object_outline_tree_t **outline_tree, int id, int *
strcat(dictionary, "<<\n");
size = 512;
size = 514;
str = NULL;
if (strconv(&str, "UTF-16BE",