|
From: <lab...@us...> - 2018-12-15 23:21:02
|
Revision: 1576
http://sourceforge.net/p/opengtoolkit/svn/1576
Author: labviewer
Date: 2018-12-15 23:21:00 +0000 (Sat, 15 Dec 2018)
Log Message:
-----------
Some more edits for compilation under Linux and VxWorks
Modified Paths:
--------------
trunk/lvzip/c_source/.cproject
trunk/lvzip/c_source/Makefile.vxworks
trunk/lvzip/c_source/aes/brg_endian.h
trunk/lvzip/c_source/bzip2/decompress.c
trunk/lvzip/c_source/crypt.c
trunk/lvzip/c_source/inflate.c
trunk/lvzip/c_source/ioapi.h
trunk/lvzip/c_source/lvapi.c
trunk/lvzip/c_source/lvutil.c
trunk/lvzip/c_source/unzip.c
trunk/lvzip/c_source/zip.c
Modified: trunk/lvzip/c_source/.cproject
===================================================================
--- trunk/lvzip/c_source/.cproject 2018-12-15 17:11:39 UTC (rev 1575)
+++ trunk/lvzip/c_source/.cproject 2018-12-15 23:21:00 UTC (rev 1576)
@@ -40,6 +40,7 @@
<listOptionValue builtIn="false" value="_LARGEFILE64_SOURCE=1"/>
<listOptionValue builtIn="false" value="HAVE_AES"/>
<listOptionValue builtIn="false" value="HAVE_BZIP2"/>
+ <listOptionValue builtIn="false" value="BZ_NO_STDIO"/>
</option>
<option id="gnu.c.compiler.option.dialect.std.1246614591" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.338287776" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
@@ -110,6 +111,7 @@
<listOptionValue builtIn="false" value="_LARGEFILE64_SOURCE=1"/>
<listOptionValue builtIn="false" value="HAVE_AES"/>
<listOptionValue builtIn="false" value="HAVE_BZIP2"/>
+ <listOptionValue builtIn="false" value="BZ_NO_STDIO"/>
</option>
<option id="gnu.c.compiler.option.misc.other.362441626" name="Other flags" superClass="gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-c -fmessage-length=0 -march=armv7-a -mfpu=vfpv3 -mfloat-abi=softfp -fvisibility=hidden" valueType="string"/>
<option id="gnu.c.compiler.option.misc.pic.717189032" name="Position Independent Code (-fPIC)" superClass="gnu.c.compiler.option.misc.pic" useByScannerDiscovery="false" value="true" valueType="boolean"/>
@@ -184,6 +186,7 @@
<listOptionValue builtIn="false" value="_LARGEFILE64_SOURCE=1"/>
<listOptionValue builtIn="false" value="HAVE_AES"/>
<listOptionValue builtIn="false" value="HAVE_BZIP2"/>
+ <listOptionValue builtIn="false" value="BZ_NO_STDIO"/>
</option>
<option id="gnu.c.compiler.option.misc.other.978532756" name="Other flags" superClass="gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-c -fmessage-length=0 -fvisibility=hidden" valueType="string"/>
<option id="gnu.c.compiler.option.misc.pic.804388978" name="Position Independent Code (-fPIC)" superClass="gnu.c.compiler.option.misc.pic" useByScannerDiscovery="false" value="true" valueType="boolean"/>
@@ -257,6 +260,7 @@
<listOptionValue builtIn="false" value="_LARGEFILE64_SOURCE=1"/>
<listOptionValue builtIn="false" value="HAVE_AES"/>
<listOptionValue builtIn="false" value="HAVE_BZIP2"/>
+ <listOptionValue builtIn="false" value="BZ_NO_STDIO"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1427234924" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
Modified: trunk/lvzip/c_source/Makefile.vxworks
===================================================================
--- trunk/lvzip/c_source/Makefile.vxworks 2018-12-15 17:11:39 UTC (rev 1575)
+++ trunk/lvzip/c_source/Makefile.vxworks 2018-12-15 23:21:00 UTC (rev 1576)
@@ -19,12 +19,11 @@
# directory. Make will automatically locate the source file and
# compile it.
# $(OBJ_DIR)/gzclose.o $(OBJ_DIR)/gzlib.o $(OBJ_DIR)/gzread.o $(OBJ_DIR)/gzwrite.o
-OBJECTS := $(OBJ_DIR)/aes/aescrypt.o $(OBJ_DIR)/aes/aeskey.o $(OBJ_DIR)/aes/aestab.o \
- $(OBJ_DIR)/aes/entropy.o $(OBJ_DIR)/aes/filenc.o $(OBJ_DIR)/aes/hmac.o \
- $(OBJ_DIR)/aes/prng.o $(OBJ_DIR)/aes/pwd2key.o $(OBJ_DIR)/aes/sha1.o \
+OBJECTS := $(OBJ_DIR)/aes/aescrypt.o $(OBJ_DIR)/aes/aeskey.o $(OBJ_DIR)/aes/aestab.o $(OBJ_DIR)/aes/fileenc.o \
+ $(OBJ_DIR)/aes/hmac.o $(OBJ_DIR)/aes/prng.o $(OBJ_DIR)/aes/pwd2key.o $(OBJ_DIR)/aes/sha1.o \
$(OBJ_DIR)/bzip2/bzlib.o $(OBJ_DIR)/bzip2/blocksort.o $(OBJ_DIR)/bzip2/huffman.o $(OBJ_DIR)/bzip2/crctable.o \
- $(OBJ_DIR)/bzip2/randtable.o $(OBJ_DIR)/bzip2/compress.o $(OBJ_DIR)/bzip2/decompress.o \
- $(OBJ_DIR)/adler32.o $(OBJ_DIR)/compress.o $(OBJ_DIR)/crc32.o $(OBJ_DIR)/deflate.o \
+ $(OBJ_DIR)/bzip2/randtable.o $(OBJ_DIR)/bzip2/bzcompress.o $(OBJ_DIR)/bzip2/decompress.o \
+ $(OBJ_DIR)/adler32.o $(OBJ_DIR)/compress.o $(OBJ_DIR)/crc32.o $(OBJ_DIR)/crypt.o $(OBJ_DIR)/deflate.o \
$(OBJ_DIR)/inffast.o $(OBJ_DIR)/infback.o $(OBJ_DIR)/inflate.o $(OBJ_DIR)/inftrees.o \
$(OBJ_DIR)/ioapi.o $(OBJ_DIR)/iomem.o $(OBJ_DIR)/lvutil.o $(OBJ_DIR)/lvapi.o \
$(OBJ_DIR)/mztools.o $(OBJ_DIR)/trees.o $(OBJ_DIR)/uncompr.o $(OBJ_DIR)/utf.o \
@@ -75,6 +74,12 @@
@if [ ! -d "$(OBJ_DIR)" ]; then\
mkdir -p $(OBJ_DIR);\
fi
+ @if [ ! -d "$(OBJ_DIR)/aes" ]; then\
+ mkdir -p $(OBJ_DIR)/aes;\
+ fi
+ @if [ ! -d "$(OBJ_DIR)/bzip2" ]; then\
+ mkdir -p $(OBJ_DIR)/bzip2;\
+ fi
clean :
rm -f $(OBJECTS) $(PROJECT_TARGETS) $(wildcard $(OBJ_DIR)/*.unstripped)
Modified: trunk/lvzip/c_source/aes/brg_endian.h
===================================================================
--- trunk/lvzip/c_source/aes/brg_endian.h 2018-12-15 17:11:39 UTC (rev 1575)
+++ trunk/lvzip/c_source/aes/brg_endian.h 2018-12-15 23:21:00 UTC (rev 1576)
@@ -34,7 +34,7 @@
defined(__pnacl__)
# include <machine/endian.h>
#elif defined( __linux__ ) || defined( __GNUC__ ) || defined( __GNU_LIBRARY__ )
-# if !defined( __MINGW32__ ) && !defined( _AIX )
+# if !defined( __MINGW32__ ) && !defined( _AIX ) && !defined(__VXWORKS__)
# include <endian.h>
# if !defined( __BEOS__ )
# include <byteswap.h>
Modified: trunk/lvzip/c_source/bzip2/decompress.c
===================================================================
--- trunk/lvzip/c_source/bzip2/decompress.c 2018-12-15 17:11:39 UTC (rev 1575)
+++ trunk/lvzip/c_source/bzip2/decompress.c 2018-12-15 23:21:00 UTC (rev 1576)
@@ -26,11 +26,11 @@
static
void makeMaps_d ( DState* s )
{
- UChar i;
+ int i;
s->nInUse = 0;
for (i = 0; i <= 255; i++)
if (s->inUse[i]) {
- s->seqToUnseq[s->nInUse] = i;
+ s->seqToUnseq[s->nInUse] = (UChar)i;
s->nInUse++;
}
}
Modified: trunk/lvzip/c_source/crypt.c
===================================================================
--- trunk/lvzip/c_source/crypt.c 2018-12-15 17:11:39 UTC (rev 1575)
+++ trunk/lvzip/c_source/crypt.c 2018-12-15 23:21:00 UTC (rev 1576)
@@ -32,7 +32,7 @@
# include <windows.h>
# define RtlGenRandom SystemFunction036
BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength);
-#elif VxWorks
+#elif defined(__VXWORKS__)
#include <random.h>
#else
# include <sys/stat.h>
@@ -40,10 +40,9 @@
# include <unistd.h>
# include <dlfcn.h>
#endif
-
#include "zlib.h"
#include "crypt.h"
-#include "lvutil.h"
+
/***************************************************************************/
#define CRC32(c, b) ((*(pcrc_32_tab+(((uint32_t)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
@@ -86,7 +85,7 @@
/***************************************************************************/
#ifndef NOCRYPT
-#if Unix
+#if unix
#ifndef ZCR_SEED2
# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
#endif
@@ -111,11 +110,11 @@
}
return rlen;
}
-#elif VxWorks
+#elif defined(__VXWORKS__)
return read_random(buf, len);
#else // Unix
int frand;
- unsigned int rlen;
+ unsigned int rlen = 0;
static int calls = 0;
static void *lib = NULL;
if (!lib)
Modified: trunk/lvzip/c_source/inflate.c
===================================================================
--- trunk/lvzip/c_source/inflate.c 2018-12-15 17:11:39 UTC (rev 1575)
+++ trunk/lvzip/c_source/inflate.c 2018-12-15 23:21:00 UTC (rev 1576)
@@ -428,10 +428,10 @@
/* check function to use adler32() for zlib or crc32() for gzip */
#ifdef GUNZIP
-# define UPDATE(check, buf, len) \
+# define UPDATE_CRC32(check, buf, len) \
(state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
#else
-# define UPDATE(check, buf, len) adler32(check, buf, len)
+# define UPDATE_CRC32(check, buf, len) adler32(check, buf, len)
#endif
/* check macros for header crc */
@@ -1201,7 +1201,7 @@
state->total += out;
if ((state->wrap & 4) && out)
strm->adler = state->check =
- UPDATE(state->check, put - out, out);
+ UPDATE_CRC32(state->check, put - out, out);
out = left;
if ((state->wrap & 4) && (
#ifdef GUNZIP
@@ -1265,8 +1265,7 @@
strm->total_out += out;
state->total += out;
if ((state->wrap & 4) && out)
- strm->adler = state->check =
- UPDATE(state->check, strm->next_out - out, out);
+ strm->adler = state->check = UPDATE_CRC32(state->check, strm->next_out - out, out);
strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
(state->mode == TYPE ? 128 : 0) +
(state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
Modified: trunk/lvzip/c_source/ioapi.h
===================================================================
--- trunk/lvzip/c_source/ioapi.h 2018-12-15 17:11:39 UTC (rev 1575)
+++ trunk/lvzip/c_source/ioapi.h 2018-12-15 23:21:00 UTC (rev 1576)
@@ -37,7 +37,7 @@
# define ZIP_UNUSED
#endif
-#if defined(USE_FILE32API)
+#if defined(USE_FILE32API) || defined(__VXWORKS__)
# define fopen64 fopen
# define ftello64 ftell
# define fseeko64 fseek
Modified: trunk/lvzip/c_source/lvapi.c
===================================================================
--- trunk/lvzip/c_source/lvapi.c 2018-12-15 17:11:39 UTC (rev 1575)
+++ trunk/lvzip/c_source/lvapi.c 2018-12-15 23:21:00 UTC (rev 1576)
@@ -456,10 +456,22 @@
#if Win32
#define strcasecmp _stricmp
#endif
+
static int caseInsensitiveNameComparer(unzFile file, const char *filename1, const char *filename2)
{
Unused(file);
+#if VxWorks
+ int32 c1, c2;
+
+ while (((c1 = *filename1++) == (c2 = *filename2++)) || (tolower(c1) == tolower(c2)))
+ if(c1 == '\0')
+ return 0;
+ c1 = tolower(c1);
+ c2 = tolower(c2);
+ return c1 - c2;
+#else
return strcasecmp(filename1, filename2);
+#endif
}
static int caseSensitiveNameComparer(unzFile file, const char *filename1, const char *filename2)
Modified: trunk/lvzip/c_source/lvutil.c
===================================================================
--- trunk/lvzip/c_source/lvutil.c 2018-12-15 17:11:39 UTC (rev 1575)
+++ trunk/lvzip/c_source/lvutil.c 2018-12-15 23:21:00 UTC (rev 1576)
@@ -95,8 +95,6 @@
#include <dirent.h>
#include <fcntl.h>
#include <unistd.h>
- #define ftello64 ftello
- #define fseeko64 fseeko
#define ftruncate64 ftruncate
#ifdef HAVE_ICONV
#include <iconv.h>
@@ -109,11 +107,8 @@
#endif
#elif MacOSX
#include <CoreFoundation/CoreFoundation.h>
- #include "MacBinaryIII.h"
#include <sys/stat.h>
#include <sys/xattr.h>
- #define ftello64 ftello
- #define fseeko64 fseeko
#define ftruncate64 ftruncate
#if ProcessorType!=kX64
#define MacSpec FSRef
@@ -1890,14 +1885,19 @@
LibAPI(MgErr) LVPath_CreateLink(Path path, Path target, uInt32 flags)
{
+#if !VxWorks
MgErr err = mgNoErr;
LWStrPtr src = NULL;
LWStrPtr tgt = NULL;
+#endif
if (!FIsAbsPath(path))
return mgArgErr;
- err = MakePathDSString(path, &src, 0);
+#if VxWorks
+ return mgNotSupported;
+#else
+ err = MakePathDSString(path, &src, 0);
if (!err)
{
err = MakePathDSString(target, &tgt, 0);
@@ -1937,16 +1937,22 @@
DSDisposePtr((UPtr)src);
}
return err;
+#endif
}
LibAPI(MgErr) LVPath_ReadLink(Path path, Path *target, uInt32 recursive, uInt32 *fileType)
{
+#if !VxWorks
MgErr err = mgNoErr;
LWStrPtr src = NULL;
+#endif
if (!FIsAbsPath(path))
return mgArgErr;
+#if VxWorks
+ return mgNotSupported;
+#else
err = MakePathDSString(path, &src, 0);
if (!err)
{
@@ -2085,6 +2091,7 @@
DSDisposePtr((UPtr)src);
}
return err;
+#endif
}
/*
@@ -3272,12 +3279,14 @@
static MgErr unix_convert_wtomb(const wchar_t *src, int32 srclen, LStrHandle *dest, uInt32 codePage, char defaultChar, LVBoolean *defaultCharWasUsed)
{
- size_t dummy, length, size = 2 * srclength;
+ size_t dummy, length, size = 2 * srclen;
wchar_t wdefChar;
MgErr err = noErr;
if (codePage == CP_UTF8)
+ {
err = wchartoutf8(src, srclen, NULL, &size, 0);
+ }
else
{
if (defaultChar)
@@ -3290,7 +3299,7 @@
if (!err)
{
uChar *dbuf = LStrBuf(**dest), *dend = LStrBuf(**dest) + size;
- wchar_t *sbuf = src, *send = sbuf + length;
+ const wchar_t *sbuf = src, *send = sbuf + srclen;
#ifdef HAVE_WCRTOMB
mbstate_t mbs;
Modified: trunk/lvzip/c_source/unzip.c
===================================================================
--- trunk/lvzip/c_source/unzip.c 2018-12-15 17:11:39 UTC (rev 1575)
+++ trunk/lvzip/c_source/unzip.c 2018-12-15 23:21:00 UTC (rev 1576)
@@ -40,8 +40,8 @@
# include <compression.h>
#endif
+#define Z_BZIP2ED 12
#ifdef HAVE_BZIP2
-# define Z_BZIP2ED 12
# include "bzip2/bzlib.h"
#endif
Modified: trunk/lvzip/c_source/zip.c
===================================================================
--- trunk/lvzip/c_source/zip.c 2018-12-15 17:11:39 UTC (rev 1575)
+++ trunk/lvzip/c_source/zip.c 2018-12-15 23:21:00 UTC (rev 1576)
@@ -39,8 +39,8 @@
# include <compression.h>
#endif
+#define Z_BZIP2ED 12
#ifdef HAVE_BZIP2
-# define Z_BZIP2ED 12
# include "bzip2/bzlib.h"
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|