From 0a2550249f9523dca974a79b51b5a7358b5fb943 Mon Sep 17 00:00:00 2001 From: CNLohr Date: Tue, 14 Mar 2017 19:05:46 -0400 Subject: Almost able to build on Windows. --- src/survive.c | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) (limited to 'src/survive.c') diff --git a/src/survive.c b/src/survive.c index 6d49d55..d786d3d 100755 --- a/src/survive.c +++ b/src/survive.c @@ -6,7 +6,6 @@ #include #include #include -#include #include "survive_config.h" @@ -211,6 +210,40 @@ int survive_poll( struct SurviveContext * ctx ) } +struct SurviveObject * survive_get_so_by_name( struct SurviveContext * ctx, const char * name ) +{ + int i; + for( i = 0; i < ctx->objs_ct; i++ ) + { + if( strcmp( ctx->objs[i]->codename, name ) == 0 ) + return ctx->objs[i]; + } + return 0; +} + +#ifdef NOZLIB + +#include + + +int survive_simple_inflate( struct SurviveContext * ctx, const char * input, int inlen, char * output, int outlen ) +{ + unsigned long ol = outlen; + unsigned long il = inlen; + int ret = puff( output, &ol, input, &il ); + if( ret == 0 ) + return ol; + else + { + SV_INFO( "puff returned error code %d\n", ret ); + return -5; + } +} + +#else + +#include + int survive_simple_inflate( struct SurviveContext * ctx, const char * input, int inlen, char * output, int outlen ) { z_stream zs; //Zlib stream. May only be used by configuration at beginning and by USB thread periodically. @@ -233,14 +266,4 @@ int survive_simple_inflate( struct SurviveContext * ctx, const char * input, int return len; } -struct SurviveObject * survive_get_so_by_name( struct SurviveContext * ctx, const char * name ) -{ - int i; - for( i = 0; i < ctx->objs_ct; i++ ) - { - if( strcmp( ctx->objs[i]->codename, name ) == 0 ) - return ctx->objs[i]; - } - return 0; -} - +#endif \ No newline at end of file -- cgit v1.2.3