Make command line version compile with MS-VC6 and QT-Version with MS-VC8

This commit is contained in:
Harald Oehlmann 2015-08-18 13:50:42 +02:00
parent 2e5fe31ebf
commit b7b7564457
14 changed files with 198 additions and 52 deletions

View File

@ -36,6 +36,7 @@
#include "common.h"
#ifdef _MSC_VER
#include <malloc.h>
#define inline _inline
#endif
static const char *C25MatrixTable[10] = {"113311", "311131", "131131", "331111", "113131", "313111",

View File

@ -53,6 +53,9 @@ static const char *AusBarTable[64] = {"000", "001", "002", "003", "010", "011",
#include <stdlib.h>
#include "common.h"
#include "reedsol.h"
#ifdef _MSC_VER
#define inline _inline
#endif
static inline char convert_pattern(char data, int shift)
{

View File

@ -679,6 +679,8 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length)
unsigned char local_source[length + 1];
#else
unsigned char* local_source = (unsigned char*)_alloca(length + 1);
unsigned int* data_part;
unsigned int* ecc_part;
#endif
memset(binary_string,0,20000);
@ -1014,8 +1016,8 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length)
#ifndef _MSC_VER
unsigned int data_part[data_blocks + 3], ecc_part[ecc_blocks + 3];
#else
unsigned int* data_part = (unsigned int*)_alloca((data_blocks + 3) * sizeof(unsigned int));
unsigned int* ecc_part = (unsigned int*)_alloca((ecc_blocks + 3) * sizeof(unsigned int));
data_part = (unsigned int*)_alloca((data_blocks + 3) * sizeof(unsigned int));
ecc_part = (unsigned int*)_alloca((ecc_blocks + 3) * sizeof(unsigned int));
#endif
/* Copy across data into separate integers */
memset(data_part,0,(data_blocks + 2)*sizeof(int));

View File

@ -927,6 +927,7 @@ int grid_matrix(struct zint_symbol *symbol, unsigned char source[], int length)
int utfdata[length + 1];
int gbdata[length + 1];
#else
char* grid;
int* utfdata = (int *)_alloca((length + 1) * sizeof(int));
int* gbdata = (int *)_alloca((length + 1) * sizeof(int));
#endif
@ -1050,7 +1051,7 @@ int grid_matrix(struct zint_symbol *symbol, unsigned char source[], int length)
#ifndef _MSC_VER
char grid[size * size];
#else
char* grid = (char *)_alloca((size * size) * sizeof(char));
grid = (char *)_alloca((size * size) * sizeof(char));
#endif
for(x = 0; x < size; x++) {

View File

@ -596,6 +596,9 @@ int reduced_charset(struct zint_symbol *symbol, unsigned char *source, int lengt
int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int length)
{
int error_number, error_buffer, i;
#ifdef _MSC_VER
unsigned char* local_source;
#endif
error_number = 0;
if(length == 0) {
@ -613,7 +616,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
#ifndef _MSC_VER
unsigned char local_source[length + 1];
#else
unsigned char* local_source = (unsigned char*)_alloca(length + 1);
local_source = (unsigned char*)_alloca(length + 1);
#endif
/* First check the symbology field */

View File

@ -84,18 +84,19 @@ int png_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
{
struct mainprog_info_type wpng_info;
struct mainprog_info_type *graphic;
png_structp png_ptr;
png_infop info_ptr;
unsigned char *image_data;
int i, row, column, errno;
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
#ifndef _MSC_VER
unsigned char outdata[image_width * 3];
#else
unsigned char* outdata = (unsigned char*)_alloca(image_width * 3);
#endif
png_structp png_ptr;
png_infop info_ptr;
graphic = &wpng_info;
unsigned char *image_data;
int i, row, column, errno;
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
switch(rotate_angle) {
case 0:
@ -691,7 +692,7 @@ void to_latin1(unsigned char source[], unsigned char preprocessed[])
j = 0;
i = 0;
do {
while (i < input_length) {
if(source[i] < 128) {
preprocessed[j] = source[i];
j++;
@ -708,7 +709,7 @@ void to_latin1(unsigned char source[], unsigned char preprocessed[])
i += 2;
}
}
} while (i < input_length);
}
preprocessed[j] = '\0';
return;

View File

@ -771,6 +771,8 @@ int evaluate(unsigned char *grid, int size, int pattern)
int dark_mods;
int percentage, k, k2;
char str[15];
int m;
int smallest;
#ifndef _MSC_VER
char local[size * size];
@ -987,7 +989,7 @@ int evaluate(unsigned char *grid, int size, int pattern)
}
}
percentage = 100 * (dark_mods / (size * size));
int m=0;
m=0;
for(x = 0; x < 100; x+=5) {
if(x<percentage)
m=x;
@ -997,7 +999,7 @@ int evaluate(unsigned char *grid, int size, int pattern)
k=abs((m-50)/5);
k2=abs((m+5-50)/5);
int smallest=k;
smallest=k;
if(k2<smallest)
smallest=k2;
@ -1214,7 +1216,10 @@ int qr_code(struct zint_symbol *symbol, unsigned char source[], int length)
int jisdata[length + 1];
char mode[length + 1];
#else
int* utfdata = (int *)_alloca((length + 1) * sizeof(int));
int* datastream;
int* fullstream;
unsigned char* grid;
int* utfdata = (int *)_alloca((length + 1) * sizeof(int));
int* jisdata = (int *)_alloca((length + 1) * sizeof(int));
char* mode = (char *)_alloca(length + 1);
#endif
@ -1325,8 +1330,8 @@ int qr_code(struct zint_symbol *symbol, unsigned char source[], int length)
int datastream[target_binlen + 1];
int fullstream[qr_total_codewords[version - 1] + 1];
#else
int* datastream = (int *)_alloca((target_binlen + 1) * sizeof(int));
int* fullstream = (int *)_alloca((qr_total_codewords[version - 1] + 1) * sizeof(int));
datastream = (int *)_alloca((target_binlen + 1) * sizeof(int));
fullstream = (int *)_alloca((qr_total_codewords[version - 1] + 1) * sizeof(int));
#endif
qr_binary(datastream, version, target_binlen, mode, jisdata, length, gs1, est_binlen);
@ -1336,7 +1341,7 @@ int qr_code(struct zint_symbol *symbol, unsigned char source[], int length)
#ifndef _MSC_VER
unsigned char grid[size * size];
#else
unsigned char* grid = (unsigned char *)_alloca((size * size) * sizeof(unsigned char));
grid = (unsigned char *)_alloca((size * size) * sizeof(unsigned char));
#endif
for(i = 0; i < size; i++) {
@ -2214,6 +2219,9 @@ int microqr(struct zint_symbol *symbol, unsigned char source[], int length)
int binary_count[4];
int ecc_level, autoversion, version;
int n_count, a_count, bitmask, format, format_full;
#ifdef _MSC_VER
unsigned char* grid;
#endif
if(length > 35) {
strcpy(symbol->errtxt, "Input data too long");
@ -2384,7 +2392,7 @@ int microqr(struct zint_symbol *symbol, unsigned char source[], int length)
#ifndef _MSC_VER
unsigned char grid[size * size];
#else
unsigned char* grid = (unsigned char *)_alloca((size * size) * sizeof(unsigned char));
grid = (unsigned char *)_alloca((size * size) * sizeof(unsigned char));
#endif
for(i = 0; i < size; i++) {

View File

@ -1,6 +1,13 @@
TEMPLATE = lib
CONFIG += dll
# My qt is configured for static build:
# http://qt-project.org/wiki/Build_Standalone_Qt_Application_for_Windows
CONFIG += staticlib
# for dynamic build enable this:
#CONFIG += dll
macx{
CONFIG -= dll
@ -12,11 +19,12 @@ TARGET = QtZint
INCLUDEPATH += ../backend
#EDIT THIS !!!!
DEFINES += NO_PNG NO_QR ZINT_VERSION="2.3.0"
DEFINES += ZINT_VERSION="\\\"2.3.0\\\"" NO_PNG
!contains(DEFINES, NO_PNG) {
SOURCES += ../backend/png.c
LIBS += -lpng
LIBS += -llibpng
INCLUDEPATH += ../../../support/lpng169
QMAKE_LIBDIR+=../../../support/lpng169/projects/visualc71/Win32_LIB_Release ../../../support/lpng169/projects/visualc71/Win32_LIB_Release/ZLib
}
contains(DEFINES, QR_SYSTEM){
@ -49,14 +57,13 @@ HEADERS += ../backend/aztec.h \
../backend/code49.h \
../backend/common.h \
../backend/composite.h \
../backend/dm200.h \
../backend/dmatrix.h \
../backend/font.h \
../backend/gridmtx.h \
../backend/gs1.h \
../backend/large.h \
../backend/maxicode.h \
../backend/maxipng.h \
../backend/micqr.h \
../backend/pdf417.h \
../backend/reedsol.h \
../backend/rss.h \
@ -67,27 +74,26 @@ HEADERS += ../backend/aztec.h \
SOURCES += ../backend/2of5.c \
../backend/auspost.c \
../backend/aztec.c \
../backend/blockf.c \
../backend/code.c \
../backend/code128.c \
../backend/code16k.c \
../backend/code49.c \
../backend/common.c \
../backend/composite.c \
../backend/dm200.c \
../backend/dmatrix.c \
../backend/gridmtx.c \
../backend/gs1.c \
../backend/imail.c \
../backend/large.c \
../backend/library.c \
../backend/maxicode.c \
../backend/medical.c \
../backend/micqr.c \
../backend/pdf417.c \
../backend/plessey.c \
../backend/postal.c \
../backend/ps.c \
../backend/reedsol.c \
../backend/render.c \
../backend/rss.c \
../backend/svg.c \
../backend/telepen.c \
@ -95,16 +101,19 @@ SOURCES += ../backend/2of5.c \
../backend/qr.c \
../backend/dllversion.c \
../backend/code1.c \
../backend/png.c \
qzint.cpp
VERSION = 2.3.0
#DESTDIR = .
include.path = $$[ZINT_INSTALL_HEADERS]
#include.path = $$[ZINT_INSTALL_HEADERS]
include.path = inst/include
include.files = ../backend/zint.h qzint.h
target.path = $$[ZINT_INSTALL_LIBS]
#target.path = $$[ZINT_INSTALL_LIBS]
target.path = inst/lib
INSTALLS += target include

View File

@ -9,9 +9,9 @@ VERSION = 2.3.0
QMAKE_CFLAGS += /TP /wd4018 /wd4244 /wd4305
QMAKE_CXXFLAGS += /TP /wd4018 /wd4244 /wd4305
INCLUDEPATH += ../backend d:\opt\include
INCLUDEPATH += ../backend d:\\opt\\include
DEFINES += _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS ZINT_VERSION=\\\"$$VERSION\\\"
DEFINES += _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS ZINT_VERSION=\\\"$$VERSION\\\" include=""
!contains(DEFINES, NO_PNG) {
SOURCES += ../backend/png.c
@ -22,7 +22,6 @@ HEADERS += ../backend/aztec.h \
../backend/code49.h \
../backend/common.h \
../backend/composite.h \
../backend/dm200.h \
../backend/dmatrix.h \
../backend/font.h \
../backend/gb2312.h \
@ -43,7 +42,6 @@ HEADERS += ../backend/aztec.h \
SOURCES += ../backend/2of5.c \
../backend/auspost.c \
../backend/aztec.c \
../backend/blockf.c \
../backend/code.c \
../backend/code1.c \
../backend/code128.c \
@ -51,7 +49,6 @@ SOURCES += ../backend/2of5.c \
../backend/code49.c \
../backend/common.c \
../backend/composite.c \
../backend/dm200.c \
../backend/dmatrix.c \
../backend/gridmtx.c \
../backend/gs1.c \
@ -66,9 +63,9 @@ SOURCES += ../backend/2of5.c \
../backend/ps.c \
../backend/qr.c \
../backend/reedsol.c \
../backend/render.c \
../backend/rss.c \
../backend/svg.c \
../backend/telepen.c \
../backend/upcean.c \
qzint.cpp

View File

@ -72,9 +72,14 @@ void ExportWindow::process()
inputpos = 0;
switch(cmbFileFormat->currentIndex()) {
case 0: suffix = ".png"; break;
#ifdef NO_PNG
case 0: suffix = ".eps"; break;
case 1: suffix = ".svg"; break;
#else
case 0: suffix = ".png"; break;
case 1: suffix = ".eps"; break;
case 2: suffix = ".svg"; break;
#endif
}
for(i = 0; i < lines; i++) {

View File

@ -4,21 +4,31 @@
TEMPLATE = app
TARGET =
TARGET = qtZint
DEPENDPATH += . debug release
INCLUDEPATH += .
DEFINES += NO_PNG
# Input
HEADERS += barcodeitem.h mainwindow.h
FORMS += grpAztec.ui \
HEADERS += barcodeitem.h \
datawindow.h \
exportwindow.h \
mainwindow.h \
sequencewindow.h
FORMS += extData.ui \
extExport.ui \
extSequence.ui \
grpAztec.ui \
grpC128.ui \
grpC16k.ui \
grpC39.ui \
grpC49.ui \
grpChannel.ui \
grpCodablock.ui \
grpCodeOne.ui \
grpDBExtend.ui \
grpDM.ui \
grpGrid.ui \
grpMaxicode.ui \
grpMicroPDF.ui \
grpMQR.ui \
@ -26,6 +36,24 @@ FORMS += grpAztec.ui \
grpPDF417.ui \
grpQR.ui \
mainWindow.ui
SOURCES += barcodeitem.cpp \
datawindow.cpp \
exportwindow.cpp \
main.cpp \
mainwindow.cpp \
sequencewindow.cpp
TRANSLATIONS = frontend_de.ts
SOURCES += barcodeitem.cpp main.cpp mainwindow.cpp
RESOURCES += resources.qrc
# Static target following http://qt-project.org/wiki/Build_Standalone_Qt_Application_for_Windows
CONFIG += static
CONFIG += warn_on thread qt uitools
INCLUDEPATH += ../backend_qt4 ../backend
LIBS += -lqtzint -lQtCore
QMAKE_LIBDIR += ../backend_qt4/release

View File

@ -207,6 +207,91 @@
<string>16 x 48</string>
</property>
</item>
<item>
<property name="text">
<string>8 x 48</string>
</property>
</item>
<item>
<property name="text">
<string>8 x 64</string>
</property>
</item>
<item>
<property name="text">
<string>12 x 48</string>
</property>
</item>
<item>
<property name="text">
<string>12 x 64</string>
</property>
</item>
<item>
<property name="text">
<string>16 x 64</string>
</property>
</item>
<item>
<property name="text">
<string>24 x 32</string>
</property>
</item>
<item>
<property name="text">
<string>24 x 40</string>
</property>
</item>
<item>
<property name="text">
<string>24 x 48</string>
</property>
</item>
<item>
<property name="text">
<string>24 x 64</string>
</property>
</item>
<item>
<property name="text">
<string>26 x 32</string>
</property>
</item>
<item>
<property name="text">
<string>26 x 40</string>
</property>
</item>
<item>
<property name="text">
<string>26 x 48</string>
</property>
</item>
<item>
<property name="text">
<string>26 x 64</string>
</property>
</item>
<item>
<property name="text">
<string>36 x 120</string>
</property>
</item>
<item>
<property name="text">
<string>36 x 144</string>
</property>
</item>
<item>
<property name="text">
<string>72 x 120</string>
</property>
</item>
<item>
<property name="text">
<string>72 x 144</string>
</property>
</item>
</widget>
</item>
</layout>

View File

@ -146,9 +146,15 @@ bool MainWindow::save()
{
bool status;
#ifdef NO_PNG
QString fileName = QFileDialog::getSaveFileName(this,
tr("Save Barcode Image"), ".",
tr("Encapsulated Post Script (*.eps);;Scalable Vector Graphic (*.svg)"));
#else
QString fileName = QFileDialog::getSaveFileName(this,
tr("Save Barcode Image"), ".",
tr("Portable Network Graphic (*.png);;Encapsulated Post Script (*.eps);;Scalable Vector Graphic (*.svg)"));
#endif
if (fileName.isEmpty())
return false;

View File

@ -41,8 +41,8 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="d:\opt\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;ZINT_VERSION=&quot;\&quot;2.4.4\&quot;&quot;;BUILD_ZINT_DLL;ZLIB_DLL;PNG_DLL"
AdditionalIncludeDirectories="..\..\..\support\lpng169;&quot;..\..\zlib128-dll\include&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;ZINT_VERSION=&quot;\&quot;2.4.4\&quot;&quot;;BUILD_ZINT_DLL;ZLIB_DLL;PNG_DLL;DEBUG"
MinimalRebuild="true"
ExceptionHandling="0"
BasicRuntimeChecks="3"
@ -68,10 +68,11 @@
<Tool
Name="VCLinkerTool"
LinkLibraryDependencies="false"
AdditionalDependencies="libpng13d.lib zlib1d.lib"
AdditionalDependencies="libpngd.lib zlibd.lib"
OutputFile="$(OutDir)\zintd.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="d:\opt\lib"
AdditionalLibraryDirectories="..\..\..\support\lpng169\projects\visualc71\Win32_LIB_Debug;..\..\..\support\lpng169\projects\visualc71\Win32_LIB_Debug\ZLib"
IgnoreDefaultLibraryNames="libcmtd.lib"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
@ -125,7 +126,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="false"
AdditionalIncludeDirectories="d:\opt\include"
AdditionalIncludeDirectories="..\..\..\support\lpng169;&quot;..\..\zlib128-dll\include&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;ZINT_VERSION=&quot;\&quot;2.4.4\&quot;&quot;;BUILD_ZINT_DLL;ZLIB_DLL;PNG_DLL"
StringPooling="true"
ExceptionHandling="0"
@ -151,10 +152,10 @@
<Tool
Name="VCLinkerTool"
LinkLibraryDependencies="false"
AdditionalDependencies="libpng13.lib zlib1.lib"
AdditionalDependencies="libpng.lib zlib.lib"
OutputFile="$(OutDir)\zint.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="d:\opt\lib"
AdditionalLibraryDirectories="..\..\..\support\lpng169\projects\visualc71\Win32_LIB_Release;..\..\..\support\lpng169\projects\visualc71\Win32_LIB_Release\ZLib"
GenerateDebugInformation="false"
SubSystem="2"
OptimizeReferences="2"
@ -314,10 +315,6 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\backend\dm200.c"
>
</File>
<File
RelativePath="..\backend\dmatrix.c"
>