~ubuntu-branches/ubuntu/trusty/libsdl2/trusty-proposed

« back to all changes in this revision

Viewing changes to src/joystick/SDL_joystick.c

  • Committer: Package Import Robot
  • Author(s): Manuel A. Fernandez Montecelo
  • Date: 2013-12-28 12:31:19 UTC
  • mto: (7.1.3 sid)
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: package-import@ubuntu.com-20131228123119-wehupm72qsjvh6vz
Tags: upstream-2.0.1+dfsg1
ImportĀ upstreamĀ versionĀ 2.0.1+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
437
437
        joysticklist = joysticklist->next;
438
438
    }
439
439
 
440
 
    if (joystick->name)
441
 
        SDL_free(joystick->name);
 
440
    SDL_free(joystick->name);
442
441
 
443
442
    /* Free the data associated with this joystick */
444
 
    if (joystick->axes) {
445
 
        SDL_free(joystick->axes);
446
 
    }
447
 
    if (joystick->hats) {
448
 
        SDL_free(joystick->hats);
449
 
    }
450
 
    if (joystick->balls) {
451
 
        SDL_free(joystick->balls);
452
 
    }
453
 
    if (joystick->buttons) {
454
 
        SDL_free(joystick->buttons);
455
 
    }
 
443
    SDL_free(joystick->axes);
 
444
    SDL_free(joystick->hats);
 
445
    SDL_free(joystick->balls);
 
446
    SDL_free(joystick->buttons);
456
447
    SDL_free(joystick);
457
448
}
458
449
 
488
479
 
489
480
    if (SDL_WasInit(SDL_INIT_VIDEO)) {
490
481
        if (SDL_GetKeyboardFocus() == NULL) {
491
 
            // Video is initialized and we don't have focus, ignore the event.
 
482
            /* Video is initialized and we don't have focus, ignore the event. */
492
483
            return SDL_TRUE;
493
484
        } else {
494
485
            return SDL_FALSE;
495
486
        }
496
487
    }
497
488
 
498
 
    // Video subsystem wasn't initialized, always allow the event
 
489
    /* Video subsystem wasn't initialized, always allow the event */
499
490
    return SDL_FALSE;
500
491
}
501
492
 
772
763
/* return the guid for this opened device */
773
764
SDL_JoystickGUID SDL_JoystickGetGUID(SDL_Joystick * joystick)
774
765
{
 
766
    if (!SDL_PrivateJoystickValid(joystick)) {
 
767
        SDL_JoystickGUID emptyGUID;
 
768
        SDL_zero( emptyGUID );
 
769
        return emptyGUID;
 
770
    }
775
771
    return SDL_SYS_JoystickGetGUID( joystick );
776
772
}
777
773
 
785
781
        return;
786
782
    }
787
783
 
788
 
    for ( i = 0; i < sizeof(guid.data) && i < (cbGUID-1); i++ )
 
784
    for ( i = 0; i < sizeof(guid.data) && i < (cbGUID-1)/2; i++ )
789
785
    {
790
786
        /* each input byte writes 2 ascii chars, and might write a null byte. */
791
787
        /* If we don't have room for next input byte, stop */
834
830
{
835
831
    SDL_JoystickGUID guid;
836
832
    int maxoutputbytes= sizeof(guid);
837
 
    int len = SDL_strlen( pchGUID );
 
833
    size_t len = SDL_strlen( pchGUID );
838
834
    Uint8 *p;
839
835
    int i;
840
836