Importing epsilon debian dirs.
[maemo-efl] / trunk / epsilon / debian / patches / 02_epsilon_thumb_canola
diff --git a/trunk/epsilon/debian/patches/02_epsilon_thumb_canola b/trunk/epsilon/debian/patches/02_epsilon_thumb_canola
new file mode 100644 (file)
index 0000000..9009ef5
--- /dev/null
@@ -0,0 +1,152 @@
+diff -upNr epsilon.orig/src/lib/Epsilon.c epsilon/src/lib/Epsilon.c
+--- epsilon.orig/src/lib/Epsilon.c     2007-12-05 20:26:23.000000000 -0200
++++ epsilon/src/lib/Epsilon.c  2007-12-09 12:15:21.000000000 -0200
+@@ -23,6 +23,9 @@
+ #ifdef HAVE_EPEG_H
+ #include <Epeg.h>
+ #endif
++#define THUMB_HEIGHT_CANOLA 96
++#define THUMB_WIDTH_CANOLA 192
++#define THUMB_SIZE_CANOLA 192
+ #define THUMB_SIZE_NORMAL 128
+ #define THUMB_SIZE_LARGE 256
+ #define THUMB_SIZE_FAIL -1
+@@ -38,9 +41,11 @@
+ static char *PATH_DIR_LARGE = NULL;
+ static char *PATH_DIR_NORMAL = NULL;
++static char *PATH_DIR_CANOLA = NULL;
+ static char *PATH_DIR_FAIL = NULL;
+ static unsigned LEN_DIR_LARGE = 0;
+ static unsigned LEN_DIR_NORMAL = 0;
++static unsigned LEN_DIR_CANOLA = 0;
+ static unsigned LEN_DIR_FAIL = 0;
+@@ -153,6 +158,11 @@ epsilon_init (void)
+      PATH_DIR_NORMAL = strdup(buf);
+      LEN_DIR_NORMAL = strlen(buf);
+   }
++  if (!PATH_DIR_CANOLA) {
++     strncpy(buf + base_len, "/canola", PATH_MAX - base_len);
++     PATH_DIR_CANOLA = strdup(buf);
++     LEN_DIR_CANOLA = strlen(buf);
++  }
+   if (!PATH_DIR_FAIL) {
+      strncpy(buf + base_len, "/fail/epsilon", PATH_MAX - base_len);
+      PATH_DIR_FAIL = strdup(buf);
+@@ -161,6 +171,7 @@ epsilon_init (void)
+   ecore_file_mkpath(PATH_DIR_LARGE);
+   ecore_file_mkpath(PATH_DIR_NORMAL);
++  ecore_file_mkpath(PATH_DIR_CANOLA);
+   ecore_file_mkpath(PATH_DIR_FAIL);
+   plugins_mime = ecore_hash_new(ecore_str_hash, ecore_str_compare);
+@@ -446,6 +457,11 @@ _epsilon_file_name(unsigned thumb_size, 
+       dir = PATH_DIR_NORMAL;
+       dir_len = LEN_DIR_NORMAL;
+      }
++   else if (thumb_size == THUMB_SIZE_CANOLA)
++     {
++      dir = PATH_DIR_CANOLA;
++      dir_len = LEN_DIR_CANOLA;
++     }
+    else
+      {
+       dir = PATH_DIR_FAIL;
+@@ -563,10 +579,10 @@ epsilon_generate (Epsilon * e)
+   if (!e || !e->src || !e->hash)
+     return (EPSILON_FAIL);
+-   
++
+   tw = e->tw;
+   th = e->th;
+-   
++
+ #ifdef HAVE_EPEG_H
+   len = strlen (e->src);
+   if ((len > 4) &&
+@@ -575,15 +591,16 @@ epsilon_generate (Epsilon * e)
+       _epsilon_file_name(e->tw, e->hash, "jpg", outfile, sizeof(outfile));
+       epeg_thumbnail_comments_get (im, &info);
+       epeg_size_get (im, &iw, &ih);
+-      if (iw > ih)
++      /* XXX - hack to force fixed height in case of tw != th (canola) */
++      if (iw > ih && tw == th)
+       {
+-        th = e->th * ((double) ih / (double) iw);
+-         if (th < 1) th = 1;
++        th = ((unsigned long) e->tw * ih) / iw;
++        if (th < 1) th = 1;
+       }
+       else
+       {
+-        tw = e->tw * ((double) iw / (double) ih);
+-         if (tw < 1) tw = 1;
++        tw = ((unsigned long) e->th *  iw) / ih;
++        if (tw < 1) tw = 1;
+       }
+       epeg_decode_size_set (im, tw, th);
+       epeg_quality_set (im, 100);
+@@ -738,7 +755,7 @@ void
+ epsilon_thumb_size(Epsilon *e, Epsilon_Thumb_Size size)
+ {
+    if (!e) return;
+-   
++
+    switch (size)
+      {
+       case EPSILON_THUMB_NORMAL:
+@@ -749,7 +766,11 @@ epsilon_thumb_size(Epsilon *e, Epsilon_T
+       e->tw = THUMB_SIZE_LARGE;
+       e->th = THUMB_SIZE_LARGE;
+       break;
+-     }   
++      case EPSILON_THUMB_CANOLA:
++      e->tw = THUMB_WIDTH_CANOLA;
++      e->th = THUMB_HEIGHT_CANOLA;
++    break;
++     }
+ }
+diff -upNr epsilon.orig/src/lib/Epsilon.h epsilon/src/lib/Epsilon.h
+--- epsilon.orig/src/lib/Epsilon.h     2007-12-05 20:26:23.000000000 -0200
++++ epsilon/src/lib/Epsilon.h  2007-12-09 12:15:21.000000000 -0200
+@@ -58,7 +58,8 @@ typedef struct _Epsilon_Info Epsilon_Inf
+ enum _Epsilon_Thumb_Size
+ {
+    EPSILON_THUMB_NORMAL,
+-   EPSILON_THUMB_LARGE
++   EPSILON_THUMB_LARGE,
++   EPSILON_THUMB_CANOLA
+ };
+ typedef enum _Epsilon_Thumb_Size Epsilon_Thumb_Size;
+diff -upNr epsilon.orig/src/lib/epsilon_thumb.c epsilon/src/lib/epsilon_thumb.c
+--- epsilon.orig/src/lib/epsilon_thumb.c       2007-12-05 20:26:23.000000000 -0200
++++ epsilon/src/lib/epsilon_thumb.c    2007-12-09 12:15:21.000000000 -0200
+@@ -218,6 +218,9 @@ epsilon_cb_server_data(void *data, int t
+       if (e->server != epsilon_server)
+               return 1;
++      if (!(e && e->data))
++              return 1;
++
+       msg = e->data;
+       Epsilon_Request *thumb;
+diff -upNr epsilon.orig/src/lib/exiftags/canon.c epsilon/src/lib/exiftags/canon.c
+--- epsilon.orig/src/lib/exiftags/canon.c      2007-12-05 20:26:23.000000000 -0200
++++ epsilon/src/lib/exiftags/canon.c   2007-12-09 12:15:21.000000000 -0200
+@@ -52,7 +52,7 @@
+ struct ccstm {
+       int32_t val;
+       struct descrip *table;
+-      const char descr[];
++      const char *descr;
+ };