summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-05-04 18:54:13 +0200
committerDaniel Friesel <derf@finalrewind.org>2014-05-04 18:57:00 +0200
commit68037c4d220302a9f7ab250b3a220a5f64217244 (patch)
treef7c200119ab5f9ed30dd1d861d985dfee99a5bf3
parentc7d0afa8cde1d351cedc09c111b0f872fbcae15e (diff)
strip unneded parts from giblib, part 1
Not all functions were examined yet. Also TODO: * check strdup / malloc calls (some are apparently unchecked in giblib), maybe use estrdup / emalloc for those * Check includes and update dependency list if needed
-rw-r--r--ChangeLog6
-rw-r--r--README1
-rw-r--r--src/feh.h6
-rw-r--r--src/gib_hash.c3
-rw-r--r--src/gib_hash.h3
-rw-r--r--src/gib_imlib.c12
-rw-r--r--src/gib_imlib.h10
-rw-r--r--src/gib_list.c12
-rw-r--r--src/gib_list.h8
-rw-r--r--src/gib_style.c132
-rw-r--r--src/gib_style.h5
11 files changed, 61 insertions, 137 deletions
diff --git a/ChangeLog b/ChangeLog
index d347a88..375a80b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,12 @@ git HEAD
* feh-cam and gen-cam-menu are no longer installed by default. Use
make install cam=1 to install them or make uninstall cam=1 to remove
them permanently
+ * feh no longer depends on giblib. Instead, the relevant parts of the
+ giblib source were imported into the feh source.
+ Rationale: giblib is unmaintained and, as far as I know, only used by
+ three projects (one of which is feh). There is at least one known bug
+ in it, and as I do not have the time to take over giblib development,
+ importing the library seems to be the best solution.
Sun, 27 Apr 2014 20:28:02 +0200 Daniel Friesel <derf+feh@finalrewind.org>
diff --git a/README b/README
index d0f3167..f526802 100644
--- a/README
+++ b/README
@@ -8,7 +8,6 @@ feh - Imlib2 based image viewer
Dependencies
------------
- * giblib
* Imlib2
* libcurl (disable with make curl=0)
* libpng
diff --git a/src/feh.h b/src/feh.h
index 2864cad..743771c 100644
--- a/src/feh.h
+++ b/src/feh.h
@@ -57,7 +57,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <math.h>
#include <Imlib2.h>
-#include <giblib/giblib.h>
+#include "gib_hash.h"
+#include "gib_imlib.h"
+#include "gib_list.h"
+#include "gib_style.h"
+#include "gib_utils.h"
#include "structs.h"
#include "menu.h"
diff --git a/src/gib_hash.c b/src/gib_hash.c
index c839222..054161d 100644
--- a/src/gib_hash.c
+++ b/src/gib_hash.c
@@ -121,6 +121,8 @@ void *gib_hash_get(gib_hash *hash, char *key)
return n?n->data:NULL;
}
+/* unused
+
void gib_hash_remove(gib_hash *hash, char *key)
{
gib_list *n = gib_list_find(GIB_LIST(hash->base), gib_hash_find_callback, key);
@@ -142,3 +144,4 @@ void gib_hash_foreach(gib_hash *hash, void (*foreach_cb)(gib_hash_node *nod
return;
}
+*/
diff --git a/src/gib_hash.h b/src/gib_hash.h
index 480ef6e..58506c8 100644
--- a/src/gib_hash.h
+++ b/src/gib_hash.h
@@ -61,9 +61,12 @@ void gib_hash_free_and_data(gib_hash *hash);
void gib_hash_set(gib_hash *hash, char *key, void *data);
void *gib_hash_get(gib_hash *hash, char *key);
+
+/* unused
void gib_hash_remove(gib_hash *hash, char *key);
void gib_hash_foreach(gib_hash *hash, void (*foreach_cb)(gib_hash_node *node, void *data), void *data);
+*/
#ifdef __cplusplus
}
diff --git a/src/gib_imlib.c b/src/gib_imlib.c
index 49eb5cb..5c9d9ef 100644
--- a/src/gib_imlib.c
+++ b/src/gib_imlib.c
@@ -151,6 +151,7 @@ gib_imlib_render_image_on_drawable(Drawable d, Imlib_Image im, int x, int y,
imlib_render_image_on_drawable(x, y);
}
+/*
void
gib_imlib_render_image_on_drawable_with_rotation(Drawable d, Imlib_Image im,
int x, int y, double angle,
@@ -170,6 +171,7 @@ gib_imlib_render_image_on_drawable_with_rotation(Drawable d, Imlib_Image im,
imlib_render_image_on_drawable(x, y);
imlib_free_image();
}
+*/
void
gib_imlib_render_image_on_drawable_at_size(Drawable d, Imlib_Image im, int x,
@@ -185,6 +187,8 @@ gib_imlib_render_image_on_drawable_at_size(Drawable d, Imlib_Image im, int x,
imlib_render_image_on_drawable_at_size(x, y, w, h);
}
+
+/*
void
gib_imlib_render_image_on_drawable_at_size_with_rotation(Drawable d,
Imlib_Image im,
@@ -207,6 +211,8 @@ gib_imlib_render_image_on_drawable_at_size_with_rotation(Drawable d,
imlib_render_image_on_drawable_at_size(x, y, w, h);
imlib_free_image_and_decache();
}
+*/
+
void
gib_imlib_render_image_part_on_drawable_at_size(Drawable d, Imlib_Image im,
@@ -225,6 +231,7 @@ gib_imlib_render_image_part_on_drawable_at_size(Drawable d, Imlib_Image im,
dh);
}
+
void
gib_imlib_render_image_part_on_drawable_at_size_with_rotation(Drawable d,
Imlib_Image im,
@@ -252,6 +259,7 @@ gib_imlib_render_image_part_on_drawable_at_size_with_rotation(Drawable d,
imlib_free_image_and_decache();
}
+
void
gib_imlib_image_fill_rectangle(Imlib_Image im, int x, int y, int w, int h,
int r, int g, int b, int a)
@@ -418,6 +426,7 @@ gib_imlib_image_format(Imlib_Image im)
return imlib_image_format();
}
+
void
gib_imlib_blend_image_onto_image(Imlib_Image dest_image,
Imlib_Image source_image, char merge_alpha,
@@ -434,6 +443,8 @@ gib_imlib_blend_image_onto_image(Imlib_Image dest_image,
dy, dw, dh);
}
+
+/*
void
gib_imlib_blend_image_onto_image_with_rotation(Imlib_Image dest_image,
Imlib_Image source_image,
@@ -455,6 +466,7 @@ gib_imlib_blend_image_onto_image_with_rotation(Imlib_Image dest_image,
dw = 0;
dh = 0;
}
+*/
Imlib_Image gib_imlib_create_cropped_scaled_image(Imlib_Image im, int sx,
int sy, int sw, int sh,
diff --git a/src/gib_imlib.h b/src/gib_imlib.h
index 6289436..6a16a0c 100644
--- a/src/gib_imlib.h
+++ b/src/gib_imlib.h
@@ -57,12 +57,14 @@ void gib_imlib_render_image_on_drawable(Drawable d, Imlib_Image im, int x,
int y, char dither, char blend,
char alias);
+/*
void gib_imlib_render_image_on_drawable_with_rotation(Drawable d,
Imlib_Image im, int x,
int y, double angle,
char dither, char blend,
char alias);
+*/
void gib_imlib_render_image_part_on_drawable_at_size(Drawable d,
Imlib_Image im, int sx,
int sy, int sw, int sh,
@@ -70,6 +72,7 @@ void gib_imlib_render_image_part_on_drawable_at_size(Drawable d,
int dh, char dither,
char blend, char alias);
+
void gib_imlib_render_image_part_on_drawable_at_size_with_rotation(Drawable d,
Imlib_Image
@@ -88,6 +91,7 @@ void gib_imlib_render_image_part_on_drawable_at_size_with_rotation(Drawable d,
char blend,
char
alias);
+
void gib_imlib_image_fill_rectangle(Imlib_Image im, int x, int y, int w,
int h, int r, int g, int b, int a);
void gib_imlib_text_draw(Imlib_Image im, Imlib_Font fn, gib_style * s, int x,
@@ -103,6 +107,7 @@ void gib_imlib_render_image_on_drawable_at_size(Drawable d, Imlib_Image im,
char dither, char blend,
char alias);
+/*
void gib_imlib_render_image_on_drawable_at_size_with_rotation(Drawable d,
Imlib_Image im,
int x, int y,
@@ -112,6 +117,8 @@ void gib_imlib_render_image_on_drawable_at_size_with_rotation(Drawable d,
char dither,
char blend,
char alias);
+*/
+
void gib_imlib_blend_image_onto_image(Imlib_Image dest_image,
Imlib_Image source_image,
char merge_alpha, int sx, int sy,
@@ -119,6 +126,8 @@ void gib_imlib_blend_image_onto_image(Imlib_Image dest_image,
int dh, char dither, char blend,
char alias);
+
+/*
void gib_imlib_blend_image_onto_image_with_rotation(Imlib_Image dest_image,
Imlib_Image source_image,
char merge_alpha, int sx,
@@ -128,6 +137,7 @@ void gib_imlib_blend_image_onto_image_with_rotation(Imlib_Image dest_image,
char dither, char blend,
char alias);
+*/
Imlib_Image gib_imlib_create_cropped_scaled_image(Imlib_Image im, int sx,
int sy, int sw, int sh,
int dw, int dh, char alias);
diff --git a/src/gib_list.c b/src/gib_list.c
index bb16d52..1c313ba 100644
--- a/src/gib_list.c
+++ b/src/gib_list.c
@@ -75,6 +75,7 @@ gib_list_free_and_data(gib_list * l)
return;
}
+#if 0
gib_list *
gib_list_dup(gib_list * list)
{
@@ -125,6 +126,7 @@ gib_list_dup_special(gib_list * list,
}
return (ret);
}
+#endif
gib_list *
gib_list_add_front(gib_list * root, void *data)
@@ -159,6 +161,7 @@ gib_list_add_end(gib_list * root, void *data)
}
}
+#if 0
gib_list *
gib_list_add_at_pos(gib_list * root, int pos, void *data)
{
@@ -216,6 +219,7 @@ gib_list_move_down_by_one(gib_list * root, gib_list * l)
return (root);
}
+#endif
unsigned char
@@ -227,6 +231,7 @@ gib_list_has_more_than_one_item(gib_list * root)
return (0);
}
+#if 0
gib_list *
gib_list_pop_to_end(gib_list * root, gib_list * l)
{
@@ -236,6 +241,7 @@ gib_list_pop_to_end(gib_list * root, gib_list * l)
return (root);
}
+#endif
gib_list *
gib_list_cat(gib_list * root, gib_list * l)
@@ -478,6 +484,7 @@ gib_list_sort_merge(gib_list * l1, gib_list * l2, gib_compare_fn cmp)
return (list.next);
}
+#if 0
gib_list *
gib_list_nth(gib_list * root, unsigned int num)
{
@@ -495,6 +502,7 @@ gib_list_nth(gib_list * root, unsigned int num)
}
return (root);
}
+#endif
gib_list *
gib_list_foreach(gib_list *root, void (*fe_func)(gib_list *node, void *data), void *data)
@@ -572,7 +580,7 @@ gib_string_split(const char *string, const char *delimiter)
return string_list;
}
-
+#if 0
char *
gib_strjoin(const char *separator, ...)
{
@@ -621,4 +629,4 @@ gib_strjoin(const char *separator, ...)
return string;
}
-
+#endif
diff --git a/src/gib_list.h b/src/gib_list.h
index 9eedae5..94c4c39 100644
--- a/src/gib_list.h
+++ b/src/gib_list.h
@@ -54,8 +54,10 @@ gib_list *gib_list_new(void);
void gib_list_free(gib_list * l);
gib_list *gib_list_add_front(gib_list * root, void *data);
gib_list *gib_list_add_end(gib_list * root, void *data);
+/*
gib_list *gib_list_add_at_pos(gib_list * root, int pos, void *data);
gib_list *gib_list_pop_to_end(gib_list * root, gib_list * l);
+*/
gib_list *gib_list_unlink(gib_list * root, gib_list * l);
gib_list *gib_list_cat(gib_list * root, gib_list * l);
int gib_list_length(gib_list * l);
@@ -72,14 +74,18 @@ gib_list *gib_list_sort(gib_list * list, gib_compare_fn cmp);
gib_list *gib_list_sort_merge(gib_list * l1, gib_list * l2,
gib_compare_fn cmp);
+/*
gib_list *gib_list_nth(gib_list * root, unsigned int num);
+*/
unsigned char gib_list_has_more_than_one_item(gib_list * root);
void gib_list_free_and_data(gib_list * l);
+/*
gib_list *gib_list_dup(gib_list * list);
gib_list *gib_list_dup_special(gib_list * list,
void (*cpy_func) (void **dest, void *data));
gib_list *gib_list_move_down_by_one(gib_list * root, gib_list * l);
gib_list *gib_list_move_up_by_one(gib_list * root, gib_list * l);
+*/
gib_list *gib_list_foreach(gib_list *root, void (*fe_func)(gib_list *node, void *data), void *data);
gib_list *gib_list_find(gib_list *root, unsigned char (*find_func)(gib_list *node, void *data), void *data);
@@ -87,7 +93,9 @@ gib_list *gib_list_find_by_data(gib_list *root, void *data);
/* don't really belong here, will do for now */
gib_list *gib_string_split(const char *string, const char *delimiter);
+/*
char *gib_strjoin(const char *separator, ...);
+*/
#ifdef __cplusplus
}
diff --git a/src/gib_style.c b/src/gib_style.c
index 8fd5ae5..6671e6e 100644
--- a/src/gib_style.c
+++ b/src/gib_style.c
@@ -90,6 +90,7 @@ gib_style_bit_free(gib_style_bit * s)
return;
}
+#if 0
gib_style *
gib_style_dup(gib_style * s)
{
@@ -109,133 +110,4 @@ gib_dup_style_bit(void **dest, void *data)
return;
}
-
-void
-gib_style_save_ascii(gib_style * style, char *file)
-{
- FILE *stylefile;
- gib_list *l;
- gib_style_bit *b;
-
- if (!style || !style->bits)
- return;
-
- stylefile = fopen(file, "w");
- if (stylefile)
- {
- fprintf(stylefile, "#Style\n");
- fprintf(stylefile, "#NAME %s\n", style->name);
- l = style->bits;
- while (l)
- {
- b = (gib_style_bit *) l->data;
- fprintf(stylefile, "%d %d %d %d %d %d\n", b->r, b->g, b->b, b->a,
- b->x_offset, b->y_offset);
- l = l->next;
- }
- }
- fclose(stylefile);
-}
-
-gib_style *
-gib_style_new_from_ascii(char *file)
-{
- FILE *stylefile;
- char current[4096];
- char *s;
- gib_style *ret = NULL;
-
- stylefile = fopen(file, "r");
- if (stylefile)
- {
- int r = 0, g = 0, b = 0, a = 0, x_off = 0, y_off = 0;
-
- ret = gib_style_new(NULL);
- /* skip initial idenifier line */
- fgets(current, sizeof(current), stylefile);
- while (fgets(current, sizeof(current), stylefile))
- {
- if (current[0] == '\n')
- continue;
- if (!strncmp(current, "#NAME", 5))
- {
- int l;
-
- l = strlen(current) - 1;
- if (current[l] == '\n')
- current[l] = '\0';
- if (l > 6)
- ret->name = strdup(current + 6);
- continue;
- }
- else
- {
- /* support EFM style bits */
- s = strtok(current, " ");
- if(!s) continue;
- if (strlen(s) == 2)
- {
- if (!strcmp(s, "ol"))
- {
- r = g = b = 0;
- s = strtok(NULL, " ");
- if(!s) continue;
- x_off = atoi(s);
- s = strtok(NULL, " ");
- if(!s) continue;
- y_off = atoi(s);
- }
- else if (!strcmp(s, "sh"))
- {
- r = g = b = 0;
- s = strtok(NULL, " ");
- if(!s) continue;
- x_off = atoi(s);
- s = strtok(NULL, " ");
- if(!s) continue;
- y_off = atoi(s);
- s = strtok(NULL, " ");
- if(!s) continue;
- a = atoi(s);
- }
- else if (!strcmp(s, "fg"))
- {
- r = g = b = a = 0;
- s = strtok(NULL, " ");
- if(!s) continue;
- x_off = atoi(s);
- s = strtok(NULL, " ");
- if(!s) continue;
- y_off = atoi(s);
- }
- }
- else
- {
- /* our own format */
- r = atoi(s);
- s = strtok(NULL, " ");
- if(!s) continue;
- g = atoi(s);
- s = strtok(NULL, " ");
- if(!s) continue;
- b = atoi(s);
- s = strtok(NULL, " ");
- if(!s) continue;
- a = atoi(s);
- s = strtok(NULL, " ");
- if(!s) continue;
- x_off = atoi(s);
- s = strtok(NULL, " ");
- if(!s) continue;
- y_off = atoi(s);
- }
- }
- ret->bits =
- gib_list_add_end(ret->bits,
- gib_style_bit_new(x_off, y_off, r, g, b, a));
- }
- fclose(stylefile);
- }
-
- return (ret);
-}
+#endif
diff --git a/src/gib_style.h b/src/gib_style.h
index ed7920a..d54e2d4 100644
--- a/src/gib_style.h
+++ b/src/gib_style.h
@@ -56,11 +56,10 @@ gib_style_bit *gib_style_bit_new(int x_offset, int y_offset, int r, int g, int b
gib_style *gib_style_new(char *name);
void gib_style_bit_free(gib_style_bit *s);
void gib_style_free(gib_style *s);
+/*
gib_style *gib_style_dup(gib_style *s);
void gib_dup_style_bit(void **dest, void *data);
-gib_style *gib_style_new_from_ascii(char *file);
-void gib_style_save_ascii(gib_style * style, char *file);
-gib_style *gib_style_new_from_ascii(char *file);
+*/
#ifdef __cplusplus
}