From 8ea24c306fdf2a141433e396307e92a227416ba5 Mon Sep 17 00:00:00 2001 From: CNLohr Date: Fri, 17 Mar 2017 01:08:06 -0400 Subject: Fix Warnings --- src/poser_charlesslow.c | 8 ++++---- src/poser_daveortho.c | 2 +- src/survive.c | 4 +++- src/survive_cal.c | 6 +++++- src/survive_config.c | 14 +++++++------- src/survive_config.h | 4 ++-- src/survive_driverman.c | 2 +- src/survive_vive.c | 4 +++- 8 files changed, 26 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/poser_charlesslow.c b/src/poser_charlesslow.c index def8323..080ad6a 100644 --- a/src/poser_charlesslow.c +++ b/src/poser_charlesslow.c @@ -123,9 +123,9 @@ int PoserCharlesSlow( SurviveObject * so, PoserData * pd ) ft = RunOpti(so, fs, lh, 0, LighthousePos, LighthouseQuat); if( cycle == 0 ) { - float sk = ft*10.; + FLT sk = ft*10.; if( sk > 1 ) sk = 1; - uint8_t cell = (1.0 - sk) * 255; + uint8_t cell = (uint8_t)((1.0 - sk) * 255); FLT epsilon = 0.1; if( dz == 0 ) { /* Why is dz special? ? */ @@ -231,7 +231,7 @@ static FLT RunOpti( SurviveObject * hmd, PoserDataFullScene * fs, int lh, int pr if( fs->lengths[p][lh][0] < 0 || fs->lengths[p][lh][1] < 0 ) continue; FLT me_to_dot[3]; sub3d( me_to_dot, LighthousePos, &hmd_points[p*3] ); - float dot = dot3d( &hmd_normals[p*3], me_to_dot ); + FLT dot = dot3d( &hmd_normals[p*3], me_to_dot ); if( dot < -.01 ) { return 1000; } } int iters = 6; @@ -321,7 +321,7 @@ static FLT RunOpti( SurviveObject * hmd, PoserDataFullScene * fs, int lh, int pr } //Step 2: Determine error. - float errorsq = 0.0; + FLT errorsq = 0.0; int count = 0; for( p = 0; p < dpts; p++ ) { diff --git a/src/poser_daveortho.c b/src/poser_daveortho.c index 9f3b55a..e81e154 100644 --- a/src/poser_daveortho.c +++ b/src/poser_daveortho.c @@ -120,7 +120,7 @@ int PoserDaveOrtho( SurviveObject * so, PoserData * pd ) break; } } - + return 0; } diff --git a/src/survive.c b/src/survive.c index 9554d9c..f637bd8 100755 --- a/src/survive.c +++ b/src/survive.c @@ -165,6 +165,7 @@ int survive_add_object( SurviveContext * ctx, SurviveObject * obj ) ctx->objs = realloc( ctx->objs, sizeof( SurviveObject * ) * (oldct+1) ); ctx->objs[oldct] = obj; ctx->objs_ct = oldct+1; + return 0; } void survive_add_driver( SurviveContext * ctx, void * payload, DeviceDriverCb poll, DeviceDriverCb close, DeviceDriverMagicCb magic ) @@ -188,7 +189,8 @@ int survive_send_magic( SurviveContext * ctx, int magic_code, void * data, int d for( i = 0; i < oldct; i++ ) { ctx->drivermagics[i]( ctx, ctx->drivers[i], magic_code, data, datalen ); - } + } + return 0; } void survive_close( SurviveContext * ctx ) diff --git a/src/survive_cal.c b/src/survive_cal.c index 985ab24..0eb9446 100755 --- a/src/survive_cal.c +++ b/src/survive_cal.c @@ -18,6 +18,10 @@ #include "survive_config.h" +#ifdef WINDOWS +int mkdir(const char *); +#endif + #define PTS_BEFORE_COMMON 32 #define NEEDED_COMMON_POINTS 10 #define MIN_SENSORS_VISIBLE_PER_LH_FOR_CAL 4 @@ -455,7 +459,7 @@ static void handle_calibration( struct SurviveCalData *cd ) stddevang += Sdiff2; stddevlen += Ldiff2; - int llm = Sdiff / HISTOGRAMBINANG + (HISTOGRAMSIZE/2.0); + int llm = (int)( Sdiff / HISTOGRAMBINANG + (HISTOGRAMSIZE/2.0) ); if( llm < 0 ) llm = 0; if( llm >= HISTOGRAMSIZE ) llm = HISTOGRAMSIZE-1; diff --git a/src/survive_config.c b/src/survive_config.c index 5458ef0..0810280 100644 --- a/src/survive_config.c +++ b/src/survive_config.c @@ -33,7 +33,7 @@ void destroy_config_entry(config_entry* ce) { if (ce->data!=NULL) { free(ce->data); ce->data=NULL; } } -void init_config_group(config_group *cg, uint16_t count) { +void init_config_group(config_group *cg, uint8_t count) { uint16_t i = 0; cg->used_entries = 0; cg->max_entries = count; @@ -99,7 +99,7 @@ void config_set_lighthouse(config_group* lh_config, BaseStationData* bsd, uint8_ } void sstrcpy(char** dest, const char *src) { - uint32_t len = strlen(src)+1; + uint32_t len = (uint32_t)strlen(src)+1; assert(dest!=NULL); char* ptr = (char*)realloc(*dest, len); //acts like malloc if dest==NULL @@ -143,7 +143,7 @@ FLT config_read_float(config_group *cg, const char *tag, const FLT def) { return config_set_float(cg, tag, def); } -uint16_t config_read_float_array(config_group *cg, const char *tag, const FLT** values, const FLT* def, uint16_t count) { +uint16_t config_read_float_array(config_group *cg, const char *tag, const FLT** values, const FLT* def, uint8_t count) { config_entry *cv = find_config_entry(cg, tag); if (cv != NULL) { @@ -237,7 +237,7 @@ void write_config_group(FILE* f, config_group *cg, char *tag) { for (i=0;i < cg->used_entries;++i) { if (cg->config_entries[i].type == CONFIG_FLOAT) { - json_write_float(f, cg->config_entries[i].tag, cg->config_entries[i].numeric.f); + json_write_float(f, cg->config_entries[i].tag, (float)cg->config_entries[i].numeric.f); } else if (cg->config_entries[i].type == CONFIG_UINT32) { json_write_uint32(f, cg->config_entries[i].tag, cg->config_entries[i].numeric.i); } else if (cg->config_entries[i].type == CONFIG_STRING) { @@ -295,7 +295,7 @@ void pop_config_group() { } -int parse_floats(char* tag, char** values, uint16_t count) { +int parse_floats(char* tag, char** values, uint8_t count) { uint16_t i = 0; FLT *f; f = alloca(sizeof(FLT) * count); @@ -348,12 +348,12 @@ int parse_uint32(char* tag, char** values, uint16_t count) { // if (count>1) // config_set_uint32_array(cg, tag, f, count); // else - config_set_uint32(cg, tag, l[0]); + config_set_uint32(cg, tag, (uint32_t)l[0]); return 1; } -void handle_tag_value(char* tag, char** values, uint16_t count) { +void handle_tag_value(char* tag, char** values, uint8_t count) { print_json_value(tag,values,count); config_group* cg = cg_stack[cg_stack_head]; diff --git a/src/survive_config.h b/src/survive_config.h index c8c7762..83db624 100644 --- a/src/survive_config.h +++ b/src/survive_config.h @@ -35,7 +35,7 @@ typedef struct config_group { //extern config_group global_config_values; //extern config_group lh_config[2]; //lighthouse configs -void init_config_group(config_group *cg, uint16_t count); +void init_config_group(config_group *cg, uint8_t count); void destroy_config_group(config_group* cg); //void config_init(); @@ -52,7 +52,7 @@ const uint32_t config_set_uint32(config_group *cg, const char *tag, const uint32 const char* config_set_str(config_group *cg, const char *tag, const char* value); FLT config_read_float(config_group *cg, const char *tag, const FLT def); -uint16_t config_read_float_array(config_group *cg, const char *tag, const FLT** values, const FLT* def, uint16_t count); +uint16_t config_read_float_array(config_group *cg, const char *tag, const FLT** values, const FLT* def, uint8_t count); uint32_t config_read_uint32(config_group *cg, const char *tag, const uint32_t def); const char* config_read_str(config_group *cg, const char *tag, const char *def); diff --git a/src/survive_driverman.c b/src/survive_driverman.c index d694e64..2afaf65 100644 --- a/src/survive_driverman.c +++ b/src/survive_driverman.c @@ -31,7 +31,7 @@ void * GetDriver( const char * element ) const char * GetDriverNameMatching( const char * prefix, int place ) { int i; - int prefixlen = strlen( prefix ); + int prefixlen = (int)strlen( prefix ); for( i = 0; i < NrDrivers; i++ ) { diff --git a/src/survive_vive.c b/src/survive_vive.c index 5a76d24..cdc319d 100755 --- a/src/survive_vive.c +++ b/src/survive_vive.c @@ -550,7 +550,7 @@ int survive_vive_send_magic(struct SurviveContext * ctx, void * drv, int magic_c if( r != sizeof( vive_magic_power_off2 ) ) return 5; } } - + return 0; } void survive_vive_usb_close( struct SurviveViveData * sv ) @@ -594,6 +594,7 @@ int survive_vive_usb_poll( struct SurviveContext * ctx, void * v ) } return r; #endif + return 0; } @@ -1234,6 +1235,7 @@ int survive_vive_close( SurviveContext * ctx, void * driver ) SurviveViveData * sv = driver; survive_vive_usb_close( sv ); + return 0; } -- cgit v1.2.3