From cd37485e3cac594d42a8780eb47aa2635319aaed Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Sat, 2 Nov 2013 12:07:21 +0100 Subject: [PATCH] Changed parameter name for gesture template save functions from "src" to "dst". --- README-gesture.txt | 4 ++-- include/SDL_gesture.h | 4 ++-- src/events/SDL_gesture.c | 17 ++++++++--------- test/testgesture.c | 14 +++++++------- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/README-gesture.txt b/README-gesture.txt index 4d0a8d681..c2cad7be5 100644 --- a/README-gesture.txt +++ b/README-gesture.txt @@ -34,9 +34,9 @@ Most programs will want to define an appropriate error threshold and check to be Saving: ------- -To save a template, call SDL_SaveDollarTemplate(gestureId, src) where gestureId is the id of the gesture you want to save, and src is an SDL_RWops pointer to the file where the gesture will be stored. +To save a template, call SDL_SaveDollarTemplate(gestureId, dst) where gestureId is the id of the gesture you want to save, and dst is an SDL_RWops pointer to the file where the gesture will be stored. -To save all currently loaded templates, call SDL_SaveAllDollarTemplates(src) where source is an SDL_RWops pointer to the file where the gesture will be stored. +To save all currently loaded templates, call SDL_SaveAllDollarTemplates(dst) where dst is an SDL_RWops pointer to the file where the gesture will be stored. Both functions return the number of gestures successfully saved. diff --git a/include/SDL_gesture.h b/include/SDL_gesture.h index 21f10ead7..015fe0209 100644 --- a/include/SDL_gesture.h +++ b/include/SDL_gesture.h @@ -58,14 +58,14 @@ extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId); * * */ -extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *src); +extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst); /** * \brief Save a currently loaded Dollar Gesture template * * */ -extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *src); +extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst); /** diff --git a/src/events/SDL_gesture.c b/src/events/SDL_gesture.c index d59fde275..c50092c74 100644 --- a/src/events/SDL_gesture.c +++ b/src/events/SDL_gesture.c @@ -116,15 +116,14 @@ static unsigned long SDL_HashDollar(SDL_FloatPoint* points) } -static int SaveTemplate(SDL_DollarTemplate *templ, SDL_RWops * src) +static int SaveTemplate(SDL_DollarTemplate *templ, SDL_RWops *dst) { - if (src == NULL) return 0; - + if (dst == NULL) return 0; /* No Longer storing the Hash, rehash on load */ - /* if(SDL_RWops.write(src,&(templ->hash),sizeof(templ->hash),1) != 1) return 0; */ + /* if (SDL_RWops.write(dst, &(templ->hash), sizeof(templ->hash), 1) != 1) return 0; */ - if (SDL_RWwrite(src,templ->path, + if (SDL_RWwrite(dst, templ->path, sizeof(templ->path[0]),DOLLARNPOINTS) != DOLLARNPOINTS) return 0; @@ -132,26 +131,26 @@ static int SaveTemplate(SDL_DollarTemplate *templ, SDL_RWops * src) } -int SDL_SaveAllDollarTemplates(SDL_RWops *src) +int SDL_SaveAllDollarTemplates(SDL_RWops *dst) { int i,j,rtrn = 0; for (i = 0; i < SDL_numGestureTouches; i++) { SDL_GestureTouch* touch = &SDL_gestureTouch[i]; for (j = 0; j < touch->numDollarTemplates; j++) { - rtrn += SaveTemplate(&touch->dollarTemplate[i],src); + rtrn += SaveTemplate(&touch->dollarTemplate[i], dst); } } return rtrn; } -int SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *src) +int SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *dst) { int i,j; for (i = 0; i < SDL_numGestureTouches; i++) { SDL_GestureTouch* touch = &SDL_gestureTouch[i]; for (j = 0; j < touch->numDollarTemplates; j++) { if (touch->dollarTemplate[i].hash == gestureId) { - return SaveTemplate(&touch->dollarTemplate[i],src); + return SaveTemplate(&touch->dollarTemplate[i], dst); } } } diff --git a/test/testgesture.c b/test/testgesture.c index 016506e11..89008fb3c 100644 --- a/test/testgesture.c +++ b/test/testgesture.c @@ -205,7 +205,7 @@ int main(int argc, char* argv[]) SDL_Surface *screen; SDL_Event event; SDL_bool quitting = SDL_FALSE; - SDL_RWops *src; + SDL_RWops *stream; /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); @@ -241,14 +241,14 @@ int main(int argc, char* argv[]) SDL_RecordGesture(-1); break; case SDLK_s: - src = SDL_RWFromFile("gestureSave","w"); - SDL_Log("Wrote %i templates",SDL_SaveAllDollarTemplates(src)); - SDL_RWclose(src); + stream = SDL_RWFromFile("gestureSave", "w"); + SDL_Log("Wrote %i templates", SDL_SaveAllDollarTemplates(stream)); + SDL_RWclose(stream); break; case SDLK_l: - src = SDL_RWFromFile("gestureSave","r"); - SDL_Log("Loaded: %i",SDL_LoadDollarTemplates(-1,src)); - SDL_RWclose(src); + stream = SDL_RWFromFile("gestureSave", "r"); + SDL_Log("Loaded: %i", SDL_LoadDollarTemplates(-1, stream)); + SDL_RWclose(stream); break; case SDLK_ESCAPE: quitting = SDL_TRUE;