1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-05 10:00: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:
FellippeHeitor 2020-01-02 17:25:04 -03:00
parent fdf3fe9a02
commit 114bd7b5a8
4 changed files with 67 additions and 62 deletions

View file

@ -16452,7 +16452,6 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
#include "parts/audio/decode/src.c"
#endif
#ifdef QB64_WINDOWS
#ifdef DEPENDENCY_ZLIB
#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"
@ -16460,7 +16459,6 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
#include "parts/zlib-1.2.11/src.c"
#endif
#endif
#endif

View file

@ -1,6 +1,8 @@
#ifdef DEPENDENCY_ZLIB
#ifdef QB64_WINDOWS
#include "download\zlib.h"
#endif
qbs *func__deflate(qbs *text){
#ifdef QB64_WINDOWS
uLongf filesize = (uint32)text->len; //length of the text
uLongf compsize = compressBound(filesize);
unsigned char *dest = (unsigned char *)malloc(compsize);
@ -9,9 +11,13 @@
memcpy(ret->chr, dest, compsize);
free(dest);
return ret;
#else
return text;
#endif
}
qbs *func__inflate(qbs *text, int64 originalsize, int32 passed){
#ifdef QB64_WINDOWS
int32 result=0;
if (passed==1){
uLongf uncompsize = originalsize;
@ -35,5 +41,7 @@
free(dest);
return ret;
}
}
#else
return text;
#endif
}

View file

@ -12,10 +12,12 @@
extern void CFont(qbs* FontName, int FontSize);
extern void sub__console_cursor(int32 visible, int32 cursorsize, int32 passed);
extern int32 func__getconsoleinput();
#endif
#ifdef DEPENDENCY_ZLIB
qbs *func__deflate(qbs *text);
qbs *func__inflate(qbs *text, int64 originalsize, int32 passed);
#ifdef QB64_WINDOWS
#include "parts\zlib-1.2.11\download\zlib.h"
#endif
#endif

View file

@ -12037,21 +12037,6 @@ IF DEPENDENCY(DEPENDENCY_GL) THEN
defines$ = defines$ + defines_header$ + "DEPENDENCY_GL"
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
DEPENDENCY(DEPENDENCY_IMAGE_CODEC) = 1 'used by OSX to read in screen capture files
END IF
@ -12160,6 +12145,18 @@ IF DEPENDENCY(DEPENDENCY_AUDIO_OUT) THEN
libs$ = libs$ + " " + d2$ + "\src.a"
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
IF LEN(libs$) THEN libs$ = libs$ + " "
PATH_SLASH_CORRECT libs$