From 7817da63526f35d10d6d4f6b3d9c02280719e023 Mon Sep 17 00:00:00 2001 From: Mike Turvey Date: Mon, 15 Jan 2018 21:50:10 -0700 Subject: Fix compiler warnings --- include/libsurvive/survive.h | 5 ++--- redist/json_helpers.c | 2 +- src/poser_octavioradii.c | 2 +- src/poser_turveytori.c | 5 ++--- src/survive.c | 10 ++++++---- src/survive_config.c | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/libsurvive/survive.h b/include/libsurvive/survive.h index 4821e63..3d0d472 100644 --- a/include/libsurvive/survive.h +++ b/include/libsurvive/survive.h @@ -4,7 +4,6 @@ #include #include "survive_types.h" #include "poser.h" -#include "os_generic.h" #ifdef __cplusplus extern "C" { @@ -117,7 +116,7 @@ typedef struct { uint8_t nextReadIndex; //init to 0 uint8_t nextWriteIndex; // init to 0 - og_sema_t buttonservicesem; + void* buttonservicesem; ButtonQueueEntry entry[BUTTON_QUEUE_MAX_LEN]; } ButtonQueue; @@ -150,7 +149,7 @@ struct SurviveContext uint8_t isClosing; // flag to indicate if threads should terminate themselves - og_thread_t buttonservicethread; + void* buttonservicethread; ButtonQueue buttonQueue; }; diff --git a/redist/json_helpers.c b/redist/json_helpers.c index af7ddda..8da841b 100644 --- a/redist/json_helpers.c +++ b/redist/json_helpers.c @@ -121,7 +121,7 @@ char* load_file_to_mem(const char* path) { fseek( f, 0, SEEK_SET ); char * JSON_STRING = malloc( len + 1); memset(JSON_STRING,0,len+1); - int i = fread( JSON_STRING, len, 1, f ); i = i; //Ignore return value. + size_t i = fread( JSON_STRING, len, 1, f ); i = i; //Ignore return value. fclose( f ); return JSON_STRING; } diff --git a/src/poser_octavioradii.c b/src/poser_octavioradii.c index be1e9f7..5805e1a 100644 --- a/src/poser_octavioradii.c +++ b/src/poser_octavioradii.c @@ -591,7 +591,7 @@ int PoserOctavioRadii( SurviveObject * so, PoserData * pd ) } else { - dd->hitCount[i][l->lh][axis] *= 0.5; + dd->hitCount[i][l->lh][axis] = (int)((double)dd->hitCount[i][l->lh][axis] * 0.5); } } //if (0 == l->lh) diff --git a/src/poser_turveytori.c b/src/poser_turveytori.c index 59ff25e..de1516a 100644 --- a/src/poser_turveytori.c +++ b/src/poser_turveytori.c @@ -1,5 +1,5 @@ #include -#include +#include "survive_config.h" #include #include #include @@ -785,7 +785,6 @@ FLT RotationEstimateFitnessQuaternion(Point lhPoint, FLT *quaternion, TrackedObj FLT throwaway = RotationEstimateFitnessAxisAngle(lhPoint, axisAngle, obj); - int a = throwaway; return throwaway; } @@ -1397,7 +1396,7 @@ static Point SolveForLighthouse(FLT posOut[3], FLT quatOut[4], TrackedObject *ob SolveForRotationQuat(rotQuat, obj, refinedEstimateGd); SolveForRotation(rot, obj, refinedEstimateGd); FLT objPos[3]; - FLT objPos2[3]; + //FLT objPos2[3]; //{ // toriData->lastLhRotQuat[lh][0] = rotQuat[0]; diff --git a/src/survive.c b/src/survive.c index a5ca68f..0386275 100755 --- a/src/survive.c +++ b/src/survive.c @@ -8,6 +8,7 @@ #include #include "survive_config.h" +#include "os_generic.h" #ifdef __APPLE__ #define z_const const @@ -40,7 +41,7 @@ static void survivenote( struct SurviveContext * ctx, const char * fault ) fprintf( stderr, "Info: %s\n", fault ); } -static void button_servicer(void * context) +static void *button_servicer(void * context) { SurviveContext *ctx = (SurviveContext*)context; @@ -51,7 +52,7 @@ static void button_servicer(void * context) if (ctx->isClosing) { // we're shutting down. Close. - return; + return NULL; } ButtonQueueEntry *entry = &(ctx->buttonQueue.entry[ctx->buttonQueue.nextReadIndex]); @@ -61,7 +62,7 @@ static void button_servicer(void * context) // the buttonQueue // if it does happen, it will kill all future button input printf("ERROR: Unpopulated ButtonQueueEntry! NextReadIndex=%d\n", ctx->buttonQueue.nextReadIndex); - return; + return NULL; } //printf("ButtonEntry: eventType:%x, buttonId:%d, axis1:%d, axis1Val:%8.8x, axis2:%d, axis2Val:%8.8x\n", @@ -90,6 +91,7 @@ static void button_servicer(void * context) ctx->buttonQueue.nextReadIndex = 0; } }; + return NULL; } SurviveContext * survive_init( int headless ) @@ -182,7 +184,7 @@ SurviveContext * survive_init( int headless ) ctx->buttonQueue.buttonservicesem = OGCreateSema(); // start the thread to process button data - ctx->buttonservicethread = OGCreateThread(&button_servicer, ctx); + ctx->buttonservicethread = OGCreateThread(button_servicer, ctx); survive_install_button_fn(ctx, NULL); survive_install_raw_pose_fn(ctx, NULL); diff --git a/src/survive_config.c b/src/survive_config.c index 0961651..46c6658 100644 --- a/src/survive_config.c +++ b/src/survive_config.c @@ -187,7 +187,7 @@ uint16_t config_read_float_array(config_group *cg, const char *tag, FLT* values, config_entry *cv = find_config_entry(cg, tag); if (cv != NULL) { - for (int i=0; i < CFG_MIN(count, cv->elements); i++) + for (unsigned int i=0; i < CFG_MIN(count, cv->elements); i++) { values[i] = ((double*)cv->data)[i]; } -- cgit v1.2.3 From b2eb7569a8963917116c4520e15b17f0578a2509 Mon Sep 17 00:00:00 2001 From: Mike Turvey Date: Mon, 15 Jan 2018 22:40:14 -0700 Subject: Fix a few warnings --- redist/CNFGWinDriver.c | 5 ++--- redist/json_helpers.c | 2 +- src/ootx_decoder.c | 2 +- src/poser_turveytori.c | 5 +++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/redist/CNFGWinDriver.c b/redist/CNFGWinDriver.c index b1c1eb0..9d1be6a 100644 --- a/redist/CNFGWinDriver.c +++ b/redist/CNFGWinDriver.c @@ -54,8 +54,8 @@ void CNFGGetDimensions( short * x, short * y ) lasty = buffery; InternalHandleResize(); } - *x = bufferx; - *y = buffery; + *x = (short)bufferx; + *y = (short)buffery; } @@ -212,7 +212,6 @@ void CNFGSetup( const char * name_of_window, int width, int height ) void CNFGHandleInput() { - int ldown = 0; MSG msg; while( PeekMessage( &msg, lsHWND, 0, 0xFFFF, 1 ) ) diff --git a/redist/json_helpers.c b/redist/json_helpers.c index 8da841b..109708a 100644 --- a/redist/json_helpers.c +++ b/redist/json_helpers.c @@ -193,7 +193,7 @@ void json_load_file(const char* path) { } else if (value_t->type == JSMN_OBJECT) { printf("Begin Object\n"); if (json_begin_object != NULL) json_begin_object(tag); - children = value_t->size +1; //+1 to account for this loop where we are not yed parsing children + children = (int16_t)(value_t->size +1); //+1 to account for this loop where we are not yed parsing children // i += decode_jsmn_object(JSON_STRING, tokens+i+2,value_t->size); } else { diff --git a/src/ootx_decoder.c b/src/ootx_decoder.c index f7a7938..7bf7d7e 100644 --- a/src/ootx_decoder.c +++ b/src/ootx_decoder.c @@ -44,7 +44,7 @@ void ootx_free_decoder_context(ootx_decoder_context *ctx) { } uint8_t ootx_decode_bit(uint32_t length) { - uint8_t t = (length - 2750) / 500; //why 2750? + uint8_t t = (uint8_t)((length - 2750) / 500); //why 2750? // return ((t & 0x02)>0)?0xFF:0x00; //easier if we need to bitshift right return ((t & 0x02)>>1); } diff --git a/src/poser_turveytori.c b/src/poser_turveytori.c index de1516a..94d572e 100644 --- a/src/poser_turveytori.c +++ b/src/poser_turveytori.c @@ -1050,7 +1050,7 @@ static void WhereIsTheTrackedObjectQuaternion(FLT *posOut, FLT *rotation, Point quatgetreciprocal(inverseRotation, rotation); - FLT objPoint[3] = { lhPoint.x, lhPoint.y, lhPoint.z }; + //FLT objPoint[3] = { lhPoint.x, lhPoint.y, lhPoint.z }; //rotatearoundaxis(objPoint, objPoint, reverseRotation, reverseRotation[3]); quatrotatevector(posOut, inverseRotation, posOut); @@ -1186,7 +1186,7 @@ void SolveForRotation(FLT rotOut[4], TrackedObject *obj, Point lh) // Step 1, create initial quaternion for guess. // This should have the lighthouse directly facing the tracked object. - Point trackedObjRelativeToLh = { .x = -lh.x,.y = -lh.y,.z = -lh.z }; + //Point trackedObjRelativeToLh = { .x = -lh.x,.y = -lh.y,.z = -lh.z }; FLT theta = atan2(-lh.x, -lh.y); FLT zAxis[4] = { 0, 0, 1 , theta - LINMATHPI / 2 }; FLT quat1[4]; @@ -1200,6 +1200,7 @@ void SolveForRotation(FLT rotOut[4], TrackedObject *obj, Point lh) RefineRotationEstimateAxisAngle(rotOut, lh, zAxis, obj); + // TODO: Need to use the quaternion version here!!! //// Step 2, optimize the quaternion to match the data. //RefineRotationEstimateQuaternion(rotOut, lh, quat1, obj); -- cgit v1.2.3