mirror of
https://github.com/QB64Official/qb64.git
synced 2024-07-05 11:10:23 +00:00
Adds stubs for _INFLATE$ and DEFLATE$ for OSes other than Windows.
These will return the unchanged text$ passed for now.
This commit is contained in:
parent
fdf3fe9a02
commit
114bd7b5a8
|
@ -16452,15 +16452,13 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
|
||||||
#include "parts/audio/decode/src.c"
|
#include "parts/audio/decode/src.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QB64_WINDOWS
|
#ifdef DEPENDENCY_ZLIB
|
||||||
#ifdef DEPENDENCY_ZLIB
|
#ifdef QB64_BACKSLASH_FILESYSTEM //change slashes depending on OS, I guess? Included by copying audio template, and it works. (SMcNeill comment)
|
||||||
#ifdef QB64_BACKSLASH_FILESYSTEM //change slashes depending on OS, I guess? Included by copying audio template, and it works. (SMcNeill comment)
|
#include "parts\\zlib-1.2.11\\src.c"
|
||||||
#include "parts\\zlib-1.2.11\\src.c"
|
#else
|
||||||
#else
|
#include "parts/zlib-1.2.11/src.c"
|
||||||
#include "parts/zlib-1.2.11/src.c"
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,39 +1,47 @@
|
||||||
#ifdef DEPENDENCY_ZLIB
|
#ifdef QB64_WINDOWS
|
||||||
#include "download\zlib.h"
|
#include "download\zlib.h"
|
||||||
|
#endif
|
||||||
qbs *func__deflate(qbs *text){
|
qbs *func__deflate(qbs *text){
|
||||||
uLongf filesize = (uint32)text->len; //length of the text
|
#ifdef QB64_WINDOWS
|
||||||
uLongf compsize = compressBound(filesize);
|
uLongf filesize = (uint32)text->len; //length of the text
|
||||||
unsigned char *dest = (unsigned char *)malloc(compsize);
|
uLongf compsize = compressBound(filesize);
|
||||||
int32 result = compress(dest, &compsize, text->chr, filesize);
|
unsigned char *dest = (unsigned char *)malloc(compsize);
|
||||||
qbs *ret = qbs_new(compsize,1);
|
int32 result = compress(dest, &compsize, text->chr, filesize);
|
||||||
memcpy(ret->chr, dest, compsize);
|
qbs *ret = qbs_new(compsize,1);
|
||||||
free(dest);
|
memcpy(ret->chr, dest, compsize);
|
||||||
return ret;
|
free(dest);
|
||||||
|
return ret;
|
||||||
|
#else
|
||||||
|
return text;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
qbs *func__inflate(qbs *text, int64 originalsize, int32 passed){
|
qbs *func__inflate(qbs *text, int64 originalsize, int32 passed){
|
||||||
int32 result=0;
|
#ifdef QB64_WINDOWS
|
||||||
if (passed==1){
|
int32 result=0;
|
||||||
uLongf uncompsize = originalsize;
|
if (passed==1){
|
||||||
unsigned char *dest = (unsigned char *)malloc(originalsize);
|
uLongf uncompsize = originalsize;
|
||||||
int32 result = uncompress(dest, &uncompsize, text->chr, text->len);
|
unsigned char *dest = (unsigned char *)malloc(originalsize);
|
||||||
qbs *ret = qbs_new(uncompsize,1);
|
int32 result = uncompress(dest, &uncompsize, text->chr, text->len);
|
||||||
memcpy(ret->chr, dest, uncompsize);
|
qbs *ret = qbs_new(uncompsize,1);
|
||||||
free(dest);
|
memcpy(ret->chr, dest, uncompsize);
|
||||||
return ret;
|
free(dest);
|
||||||
}else{
|
return ret;
|
||||||
uLongf uncompsize = 0;
|
}else{
|
||||||
unsigned char *dest;
|
uLongf uncompsize = 0;
|
||||||
do {
|
unsigned char *dest;
|
||||||
uncompsize = uncompsize + 10000000; //10 mb original buffer, resized by 10 mb each pass until it's large enough to hold the uncompressed data.
|
do {
|
||||||
dest = (unsigned char *)malloc(uncompsize);
|
uncompsize = uncompsize + 10000000; //10 mb original buffer, resized by 10 mb each pass until it's large enough to hold the uncompressed data.
|
||||||
result = uncompress(dest, &uncompsize, text->chr, text->len);
|
dest = (unsigned char *)malloc(uncompsize);
|
||||||
if (result==Z_BUF_ERROR)free(dest); //if the buffer is too small, free the old buffer
|
result = uncompress(dest, &uncompsize, text->chr, text->len);
|
||||||
} while(result==Z_BUF_ERROR); // and try again with a larger buffer
|
if (result==Z_BUF_ERROR)free(dest); //if the buffer is too small, free the old buffer
|
||||||
qbs *ret = qbs_new(uncompsize,1);
|
} while(result==Z_BUF_ERROR); // and try again with a larger buffer
|
||||||
memcpy(ret->chr, dest, uncompsize);
|
qbs *ret = qbs_new(uncompsize,1);
|
||||||
free(dest);
|
memcpy(ret->chr, dest, uncompsize);
|
||||||
return ret;
|
free(dest);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
#else
|
||||||
#endif
|
return text;
|
||||||
|
#endif
|
||||||
|
}
|
|
@ -12,11 +12,13 @@
|
||||||
extern void CFont(qbs* FontName, int FontSize);
|
extern void CFont(qbs* FontName, int FontSize);
|
||||||
extern void sub__console_cursor(int32 visible, int32 cursorsize, int32 passed);
|
extern void sub__console_cursor(int32 visible, int32 cursorsize, int32 passed);
|
||||||
extern int32 func__getconsoleinput();
|
extern int32 func__getconsoleinput();
|
||||||
|
#endif
|
||||||
#ifdef DEPENDENCY_ZLIB
|
|
||||||
qbs *func__deflate(qbs *text);
|
#ifdef DEPENDENCY_ZLIB
|
||||||
qbs *func__inflate(qbs *text, int64 originalsize, int32 passed);
|
qbs *func__deflate(qbs *text);
|
||||||
#include "parts\zlib-1.2.11\download\zlib.h"
|
qbs *func__inflate(qbs *text, int64 originalsize, int32 passed);
|
||||||
|
#ifdef QB64_WINDOWS
|
||||||
|
#include "parts\zlib-1.2.11\download\zlib.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -12037,21 +12037,6 @@ IF DEPENDENCY(DEPENDENCY_GL) THEN
|
||||||
defines$ = defines$ + defines_header$ + "DEPENDENCY_GL"
|
defines$ = defines$ + defines_header$ + "DEPENDENCY_GL"
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
IF DEPENDENCY(DEPENDENCY_ZLIB) THEN
|
|
||||||
IF win THEN 'ZLIB is only supported for windows versions so far
|
|
||||||
defines$ = defines$ + defines_header$ + "DEPENDENCY_ZLIB"
|
|
||||||
|
|
||||||
d$ = "internal\c\parts\zlib-1.2.11\"
|
|
||||||
'rebuild?
|
|
||||||
IF _FILEEXISTS(d$ + "os\" + o$ + "\src.a") = 0 THEN
|
|
||||||
Build d$ + "os\" + o$
|
|
||||||
END IF
|
|
||||||
defines$ = defines$ + defines_header$ + "DEPENDENCY_ZLIB"
|
|
||||||
libs$ = libs$ + " " + "parts\zlib-1.2.11\os\" + o$ + "\src.a -lz"
|
|
||||||
END IF
|
|
||||||
END IF
|
|
||||||
|
|
||||||
|
|
||||||
IF DEPENDENCY(DEPENDENCY_SCREENIMAGE) THEN
|
IF DEPENDENCY(DEPENDENCY_SCREENIMAGE) THEN
|
||||||
DEPENDENCY(DEPENDENCY_IMAGE_CODEC) = 1 'used by OSX to read in screen capture files
|
DEPENDENCY(DEPENDENCY_IMAGE_CODEC) = 1 'used by OSX to read in screen capture files
|
||||||
END IF
|
END IF
|
||||||
|
@ -12160,6 +12145,18 @@ IF DEPENDENCY(DEPENDENCY_AUDIO_OUT) THEN
|
||||||
libs$ = libs$ + " " + d2$ + "\src.a"
|
libs$ = libs$ + " " + d2$ + "\src.a"
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
IF DEPENDENCY(DEPENDENCY_ZLIB) THEN
|
||||||
|
defines$ = defines$ + defines_header$ + "DEPENDENCY_ZLIB"
|
||||||
|
IF win THEN 'ZLIB is only supported for windows versions so far
|
||||||
|
d$ = "internal\c\parts\zlib-1.2.11\"
|
||||||
|
'rebuild?
|
||||||
|
IF _FILEEXISTS(d$ + "os\" + o$ + "\src.a") = 0 THEN
|
||||||
|
Build d$ + "os\" + o$
|
||||||
|
END IF
|
||||||
|
libs$ = libs$ + " " + "parts\zlib-1.2.11\os\" + o$ + "\src.a -lz"
|
||||||
|
END IF
|
||||||
|
END IF
|
||||||
|
|
||||||
'finalize libs$ and defines$ strings
|
'finalize libs$ and defines$ strings
|
||||||
IF LEN(libs$) THEN libs$ = libs$ + " "
|
IF LEN(libs$) THEN libs$ = libs$ + " "
|
||||||
PATH_SLASH_CORRECT libs$
|
PATH_SLASH_CORRECT libs$
|
||||||
|
|
Loading…
Reference in a new issue