NSData+GIF.m 465 B

1234567891011121314151617181920212223242526272829303132
  1. //
  2. // NSData+GIF.m
  3. // SDWebImage
  4. //
  5. // Created by Andy LaVoy on 4/28/13.
  6. // Copyright (c) 2013 Dailymotion. All rights reserved.
  7. //
  8. #import "NSData+GIF.h"
  9. @implementation NSData (GIF)
  10. - (BOOL)sd_isGIF
  11. {
  12. BOOL isGIF = NO;
  13. uint8_t c;
  14. [self getBytes:&c length:1];
  15. switch (c)
  16. {
  17. case 0x47: // probably a GIF
  18. isGIF = YES;
  19. break;
  20. default:
  21. break;
  22. }
  23. return isGIF;
  24. }
  25. @end