Changed parameter name for gesture template save functions from "src" to "dst".
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Sat, 02 Nov 2013 12:07:21 +0100
changeset 7900cc2289c332eb
parent 7899 e94abe9c40ca
child 7901 ae8600f0916a
Changed parameter name for gesture template save functions from "src" to "dst".
README-gesture.txt
include/SDL_gesture.h
src/events/SDL_gesture.c
test/testgesture.c
     1.1 --- a/README-gesture.txt	Sat Nov 02 11:51:23 2013 +0100
     1.2 +++ b/README-gesture.txt	Sat Nov 02 12:07:21 2013 +0100
     1.3 @@ -34,9 +34,9 @@
     1.4  
     1.5  Saving:
     1.6  -------
     1.7 -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.
     1.8 +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.
     1.9  
    1.10 -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.
    1.11 +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.
    1.12  
    1.13  Both functions return the number of gestures successfully saved.
    1.14  
     2.1 --- a/include/SDL_gesture.h	Sat Nov 02 11:51:23 2013 +0100
     2.2 +++ b/include/SDL_gesture.h	Sat Nov 02 12:07:21 2013 +0100
     2.3 @@ -58,14 +58,14 @@
     2.4   *
     2.5   *
     2.6   */
     2.7 -extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *src);
     2.8 +extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst);
     2.9  
    2.10  /**
    2.11   *  \brief Save a currently loaded Dollar Gesture template
    2.12   *
    2.13   *
    2.14   */
    2.15 -extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *src);
    2.16 +extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst);
    2.17  
    2.18  
    2.19  /**
     3.1 --- a/src/events/SDL_gesture.c	Sat Nov 02 11:51:23 2013 +0100
     3.2 +++ b/src/events/SDL_gesture.c	Sat Nov 02 12:07:21 2013 +0100
     3.3 @@ -116,15 +116,14 @@
     3.4  }
     3.5  
     3.6  
     3.7 -static int SaveTemplate(SDL_DollarTemplate *templ, SDL_RWops * src)
     3.8 +static int SaveTemplate(SDL_DollarTemplate *templ, SDL_RWops *dst)
     3.9  {
    3.10 -    if (src == NULL) return 0;
    3.11 -
    3.12 +    if (dst == NULL) return 0;
    3.13  
    3.14      /* No Longer storing the Hash, rehash on load */
    3.15 -    /* if(SDL_RWops.write(src,&(templ->hash),sizeof(templ->hash),1) != 1) return 0; */
    3.16 +    /* if (SDL_RWops.write(dst, &(templ->hash), sizeof(templ->hash), 1) != 1) return 0; */
    3.17  
    3.18 -    if (SDL_RWwrite(src,templ->path,
    3.19 +    if (SDL_RWwrite(dst, templ->path,
    3.20                      sizeof(templ->path[0]),DOLLARNPOINTS) != DOLLARNPOINTS)
    3.21          return 0;
    3.22  
    3.23 @@ -132,26 +131,26 @@
    3.24  }
    3.25  
    3.26  
    3.27 -int SDL_SaveAllDollarTemplates(SDL_RWops *src)
    3.28 +int SDL_SaveAllDollarTemplates(SDL_RWops *dst)
    3.29  {
    3.30      int i,j,rtrn = 0;
    3.31      for (i = 0; i < SDL_numGestureTouches; i++) {
    3.32          SDL_GestureTouch* touch = &SDL_gestureTouch[i];
    3.33          for (j = 0; j < touch->numDollarTemplates; j++) {
    3.34 -            rtrn += SaveTemplate(&touch->dollarTemplate[i],src);
    3.35 +            rtrn += SaveTemplate(&touch->dollarTemplate[i], dst);
    3.36          }
    3.37      }
    3.38      return rtrn;
    3.39  }
    3.40  
    3.41 -int SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *src)
    3.42 +int SDL_SaveDollarTemplate(SDL_GestureID gestureId, SDL_RWops *dst)
    3.43  {
    3.44      int i,j;
    3.45      for (i = 0; i < SDL_numGestureTouches; i++) {
    3.46          SDL_GestureTouch* touch = &SDL_gestureTouch[i];
    3.47          for (j = 0; j < touch->numDollarTemplates; j++) {
    3.48              if (touch->dollarTemplate[i].hash == gestureId) {
    3.49 -                return SaveTemplate(&touch->dollarTemplate[i],src);
    3.50 +                return SaveTemplate(&touch->dollarTemplate[i], dst);
    3.51              }
    3.52          }
    3.53      }
     4.1 --- a/test/testgesture.c	Sat Nov 02 11:51:23 2013 +0100
     4.2 +++ b/test/testgesture.c	Sat Nov 02 12:07:21 2013 +0100
     4.3 @@ -205,7 +205,7 @@
     4.4    SDL_Surface *screen;
     4.5    SDL_Event event;
     4.6    SDL_bool quitting = SDL_FALSE;
     4.7 -  SDL_RWops *src;
     4.8 +  SDL_RWops *stream;
     4.9  
    4.10    /* Enable standard application logging */
    4.11    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
    4.12 @@ -241,14 +241,14 @@
    4.13          SDL_RecordGesture(-1);
    4.14          break;
    4.15            case SDLK_s:
    4.16 -        src = SDL_RWFromFile("gestureSave","w");
    4.17 -        SDL_Log("Wrote %i templates",SDL_SaveAllDollarTemplates(src));
    4.18 -        SDL_RWclose(src);
    4.19 +        stream = SDL_RWFromFile("gestureSave", "w");
    4.20 +        SDL_Log("Wrote %i templates", SDL_SaveAllDollarTemplates(stream));
    4.21 +        SDL_RWclose(stream);
    4.22          break;
    4.23            case SDLK_l:
    4.24 -        src = SDL_RWFromFile("gestureSave","r");
    4.25 -        SDL_Log("Loaded: %i",SDL_LoadDollarTemplates(-1,src));
    4.26 -        SDL_RWclose(src);
    4.27 +        stream = SDL_RWFromFile("gestureSave", "r");
    4.28 +        SDL_Log("Loaded: %i", SDL_LoadDollarTemplates(-1, stream));
    4.29 +        SDL_RWclose(stream);
    4.30          break;
    4.31            case SDLK_ESCAPE:
    4.32          quitting = SDL_TRUE;