From d13b649d3aed438ef9acde3b770b68f52ced494e Mon Sep 17 00:00:00 2001
From: koral-- <koral--@users.noreply.github.com>
Date: Fri, 11 Apr 2014 01:20:14 +0200
Subject: [PATCH]  #50 fixed

---
 jni/gif.c                  |   9 ++++++---
 libs/armeabi-v7a/libgif.so | Bin 25724 -> 25724 bytes
 libs/armeabi/libgif.so     | Bin 29816 -> 29816 bytes
 libs/mips/libgif.so        | Bin 72864 -> 72864 bytes
 libs/x86/libgif.so         | Bin 29848 -> 29848 bytes
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/jni/gif.c b/jni/gif.c
index 89f28bbd..9fa7f552 100644
--- a/jni/gif.c
+++ b/jni/gif.c
@@ -14,6 +14,9 @@
 //#define  LOG_TAG    "libgif"
 //#define  LOGE(...)  __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
 
+/**
+ * Decoding error - no frames
+ */
 #define D_GIF_ERR_NO_FRAMES     	1000
 #define D_GIF_ERR_INVALID_SCR_DIMS 	1001
 #define D_GIF_ERR_INVALID_IMG_DIMS 	1002
@@ -586,9 +589,6 @@ static jint open(GifFileType *GifFileIn, int Error, int startPos,
 		D_GIF_ERR_NOT_ENOUGH_MEM, env, metaData);
 		return (jint) NULL;
 	}
-
-	if (DDGifSlurp(GifFileIn, info, false) == GIF_ERROR)
-		Error = GifFileIn->Error;
 	if (GifFileIn->SColorMap == NULL
 			|| GifFileIn->SColorMap->ColorCount
 					!= (1 << GifFileIn->SColorMap->BitsPerPixel))
@@ -596,6 +596,9 @@ static jint open(GifFileType *GifFileIn, int Error, int startPos,
 		GifFreeMapObject(GifFileIn->SColorMap);
 		GifFileIn->SColorMap = defaultCmap;
 	}
+	if (DDGifSlurp(GifFileIn, info, false) == GIF_ERROR)
+		Error = GifFileIn->Error;
+
 	int imgCount = GifFileIn->ImageCount;
 	//TODO add leniency support
 	if (imgCount < 1)
diff --git a/libs/armeabi-v7a/libgif.so b/libs/armeabi-v7a/libgif.so
index 6ff68e7c46f9a8d14180a4a806117af68a7d4a62..5cadb60fb5e36005b86c95c24fdec779dd5e190b 100755
GIT binary patch
delta 160
zcmV;R0AK(7$N~Jw0kF6q0h5!tA1eWUljR>L0cn#BAZvd!;Am+uu>m4OXcGDZ^8#p^
zLIuzP@GATjOM65cXlr38Mj=K3A^;};_d5Onxh`z2X&^=;YXB|Szfbgfc9=&9xhAmy
z;ASQuM*sIE{STW!MoC60M$PyDpaGLJM*sH%{{SuwzaT~cAO*0!=<ttjPXGWd>F`eh
OA`EB+Mv1fcAcaE^V?V(F

delta 123
zcmV->0EGYi$N~Jw0kF6q0g{usA1eWTljR>L0cevAAZso%;3!5RMlweK_e%Z%xh`yI
zX)v(?B132r`UCR<XqrL=&;jrx{1QuhL>p*pVUwsJ9499I51T+nNk%G0&G-PI0h2RE
d|Mvv{04@x_AVvTn1+cy7@Q(n$V6*8UlSAx#F{A(h

diff --git a/libs/armeabi/libgif.so b/libs/armeabi/libgif.so
index 80dce300e0df630cfb3cf9b3e3e05f5593acb4aa..a3c004a5ce813220c5a07248dd9a69f9d4dc55c3 100755
GIT binary patch
delta 133
zcmV;00DAxU=mGfX0k8-q0hW^qB`*PflQ|_N0cw+9C1*G{;BaXGC<f3&XaORcKocAS
zXqrL=&;jr}{1;1mL>p*xVK5vi8~`H!_bL7WC%8fY(Kl?gX#gyf{3RSG4E+q64Vwa(
n0FnWd1DPTmI~@P_3jY8ghe80+C>#f{@V)5+0017dK_)j&Et4)(

delta 133
zcmV;00DAxU=mGfX0k8-q0hN;pB`*PelQ|_N0cn$8C1*A^;4mC196B8T_c{ImC;-tn
zY;b7+C<f3&XaORcKocASXqrL=&;jr>{1Z!iL>p*xVYX=iE|dNx94QU`44Ms_0+;}j
n0h0rnG8{V`|Mv_303e4#0MRHM2e9zHz((l<000iNK_)j&LJ=;V

diff --git a/libs/mips/libgif.so b/libs/mips/libgif.so
index f176c391ce9b2e83193f7def0d1e496b674312a8..35d55da6ec75ffe0275f4c8082504bf40a51201b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