Fixed build dependencies
[maemo-efl] / trunk / epsilon / debian / patches / 02_epsilon_thumb_canola
1 diff -upNr epsilon.orig/src/lib/Epsilon.c epsilon/src/lib/Epsilon.c
2 --- epsilon.orig/src/lib/Epsilon.c      2007-12-05 20:26:23.000000000 -0200
3 +++ epsilon/src/lib/Epsilon.c   2007-12-09 12:15:21.000000000 -0200
4 @@ -23,6 +23,9 @@
5  #ifdef HAVE_EPEG_H
6  #include <Epeg.h>
7  #endif
8 +#define THUMB_HEIGHT_CANOLA 96
9 +#define THUMB_WIDTH_CANOLA 192
10 +#define THUMB_SIZE_CANOLA 192
11  #define THUMB_SIZE_NORMAL 128
12  #define THUMB_SIZE_LARGE 256
13  #define THUMB_SIZE_FAIL -1
14 @@ -38,9 +41,11 @@
15  
16  static char *PATH_DIR_LARGE = NULL;
17  static char *PATH_DIR_NORMAL = NULL;
18 +static char *PATH_DIR_CANOLA = NULL;
19  static char *PATH_DIR_FAIL = NULL;
20  static unsigned LEN_DIR_LARGE = 0;
21  static unsigned LEN_DIR_NORMAL = 0;
22 +static unsigned LEN_DIR_CANOLA = 0;
23  static unsigned LEN_DIR_FAIL = 0;
24  
25  
26 @@ -153,6 +158,11 @@ epsilon_init (void)
27       PATH_DIR_NORMAL = strdup(buf);
28       LEN_DIR_NORMAL = strlen(buf);
29    }
30 +  if (!PATH_DIR_CANOLA) {
31 +     strncpy(buf + base_len, "/canola", PATH_MAX - base_len);
32 +     PATH_DIR_CANOLA = strdup(buf);
33 +     LEN_DIR_CANOLA = strlen(buf);
34 +  }
35    if (!PATH_DIR_FAIL) {
36       strncpy(buf + base_len, "/fail/epsilon", PATH_MAX - base_len);
37       PATH_DIR_FAIL = strdup(buf);
38 @@ -161,6 +171,7 @@ epsilon_init (void)
39  
40    ecore_file_mkpath(PATH_DIR_LARGE);
41    ecore_file_mkpath(PATH_DIR_NORMAL);
42 +  ecore_file_mkpath(PATH_DIR_CANOLA);
43    ecore_file_mkpath(PATH_DIR_FAIL);
44  
45    plugins_mime = ecore_hash_new(ecore_str_hash, ecore_str_compare);
46 @@ -446,6 +457,11 @@ _epsilon_file_name(unsigned thumb_size, 
47         dir = PATH_DIR_NORMAL;
48         dir_len = LEN_DIR_NORMAL;
49       }
50 +   else if (thumb_size == THUMB_SIZE_CANOLA)
51 +     {
52 +       dir = PATH_DIR_CANOLA;
53 +       dir_len = LEN_DIR_CANOLA;
54 +     }
55     else
56       {
57         dir = PATH_DIR_FAIL;
58 @@ -563,10 +579,10 @@ epsilon_generate (Epsilon * e)
59  
60    if (!e || !e->src || !e->hash)
61      return (EPSILON_FAIL);
62 -   
63 +
64    tw = e->tw;
65    th = e->th;
66 -   
67 +
68  #ifdef HAVE_EPEG_H
69    len = strlen (e->src);
70    if ((len > 4) &&
71 @@ -575,15 +591,16 @@ epsilon_generate (Epsilon * e)
72        _epsilon_file_name(e->tw, e->hash, "jpg", outfile, sizeof(outfile));
73        epeg_thumbnail_comments_get (im, &info);
74        epeg_size_get (im, &iw, &ih);
75 -      if (iw > ih)
76 +      /* XXX - hack to force fixed height in case of tw != th (canola) */
77 +      if (iw > ih && tw == th)
78         {
79 -         th = e->th * ((double) ih / (double) iw);
80 -          if (th < 1) th = 1;
81 +         th = ((unsigned long) e->tw * ih) / iw;
82 +         if (th < 1) th = 1;
83         }
84        else
85         {
86 -         tw = e->tw * ((double) iw / (double) ih);
87 -          if (tw < 1) tw = 1;
88 +         tw = ((unsigned long) e->th *  iw) / ih;
89 +         if (tw < 1) tw = 1;
90         }
91        epeg_decode_size_set (im, tw, th);
92        epeg_quality_set (im, 100);
93 @@ -738,7 +755,7 @@ void
94  epsilon_thumb_size(Epsilon *e, Epsilon_Thumb_Size size)
95  {
96     if (!e) return;
97 -   
98 +
99     switch (size)
100       {
101        case EPSILON_THUMB_NORMAL:
102 @@ -749,7 +766,11 @@ epsilon_thumb_size(Epsilon *e, Epsilon_T
103         e->tw = THUMB_SIZE_LARGE;
104         e->th = THUMB_SIZE_LARGE;
105         break;
106 -     }   
107 +      case EPSILON_THUMB_CANOLA:
108 +       e->tw = THUMB_WIDTH_CANOLA;
109 +       e->th = THUMB_HEIGHT_CANOLA;
110 +    break;
111 +     }
112  }
113  
114  
115 diff -upNr epsilon.orig/src/lib/Epsilon.h epsilon/src/lib/Epsilon.h
116 --- epsilon.orig/src/lib/Epsilon.h      2007-12-05 20:26:23.000000000 -0200
117 +++ epsilon/src/lib/Epsilon.h   2007-12-09 12:15:21.000000000 -0200
118 @@ -58,7 +58,8 @@ typedef struct _Epsilon_Info Epsilon_Inf
119  enum _Epsilon_Thumb_Size
120  {
121     EPSILON_THUMB_NORMAL,
122 -   EPSILON_THUMB_LARGE
123 +   EPSILON_THUMB_LARGE,
124 +   EPSILON_THUMB_CANOLA
125  };
126  
127  typedef enum _Epsilon_Thumb_Size Epsilon_Thumb_Size;
128 diff -upNr epsilon.orig/src/lib/epsilon_thumb.c epsilon/src/lib/epsilon_thumb.c
129 --- epsilon.orig/src/lib/epsilon_thumb.c        2007-12-05 20:26:23.000000000 -0200
130 +++ epsilon/src/lib/epsilon_thumb.c     2007-12-09 12:15:21.000000000 -0200
131 @@ -218,6 +218,9 @@ epsilon_cb_server_data(void *data, int t
132         if (e->server != epsilon_server)
133                 return 1;
134  
135 +       if (!(e && e->data))
136 +               return 1;
137 +
138         msg = e->data;
139         Epsilon_Request *thumb;
140  
141 diff -upNr epsilon.orig/src/lib/exiftags/canon.c epsilon/src/lib/exiftags/canon.c
142 --- epsilon.orig/src/lib/exiftags/canon.c       2007-12-05 20:26:23.000000000 -0200
143 +++ epsilon/src/lib/exiftags/canon.c    2007-12-09 12:15:21.000000000 -0200
144 @@ -52,7 +52,7 @@
145  struct ccstm {
146         int32_t val;
147         struct descrip *table;
148 -       const char descr[];
149 +       const char *descr;
150  };
151  
152