diff options
author | CNLohr <lohr85@gmail.com> | 2017-03-14 19:05:46 -0400 |
---|---|---|
committer | CNLohr <lohr85@gmail.com> | 2017-03-14 19:05:46 -0400 |
commit | 0a2550249f9523dca974a79b51b5a7358b5fb943 (patch) | |
tree | 73d8d1e652582ce9199f12d9b3b990c54acce9f8 /src/survive.c | |
parent | f1d9ab47020293d373cc20695234e3677ceacb7f (diff) | |
download | libsurvive-0a2550249f9523dca974a79b51b5a7358b5fb943.tar.gz libsurvive-0a2550249f9523dca974a79b51b5a7358b5fb943.tar.bz2 |
Almost able to build on Windows.
Diffstat (limited to 'src/survive.c')
-rwxr-xr-x | src/survive.c | 47 |
1 files changed, 35 insertions, 12 deletions
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 <stdio.h> #include <stdlib.h> #include <string.h> -#include <zlib.h> #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 <puff.h> + + +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 <zlib.h> + 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 |