forked from old/legacy-imlib2
wooo! found bug in filename:key splitting.... fix fix fix... :)
SVN revision: 3371
This commit is contained in:
parent
8b4280d552
commit
ee6dba3708
124
doc/index.html
124
doc/index.html
|
@ -1177,18 +1177,31 @@ char imlib_copy_drawable_to_image(Pixmap mask,
|
||||||
int destination_y,
|
int destination_y,
|
||||||
char need_to_grab_x);
|
char need_to_grab_x);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This routine will grab a section of the current drawable (optionally using
|
||||||
|
the pixmap provided as a corresponding mask for that drawable - if mask is 0
|
||||||
|
this is not used). It grabs the x, y, width, height rectangle and places it
|
||||||
|
at the destination x, y location in the current image. If need_to_grab_x is
|
||||||
|
1 it will grab and ungrab the server whilst doing this - you need to do this
|
||||||
|
if you have not already grabbed the server.
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
Imlib_Image imlib_clone_image(void);
|
Imlib_Image imlib_clone_image(void);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This creates an exact duplicate of the current image and returns a valid
|
||||||
|
image handle on success, or NULL on failure.
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
Imlib_Image imlib_create_cropped_image(int x,
|
Imlib_Image imlib_create_cropped_image(int x,
|
||||||
int y,
|
int y,
|
||||||
int width,
|
int width,
|
||||||
int height);
|
int height);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This creates a duplicate of a x, y, width, height rectangle in the current
|
||||||
|
image and returns a valid image handle on success, or NULL on failure.
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
Imlib_Image imlib_create_cropped_scaled_image(int source_x,
|
Imlib_Image imlib_create_cropped_scaled_image(int source_x,
|
||||||
int source_y,
|
int source_y,
|
||||||
|
@ -1197,11 +1210,17 @@ Imlib_Image imlib_create_cropped_scaled_image(int source_x,
|
||||||
int destination_width,
|
int destination_width,
|
||||||
int destination_height);
|
int destination_height);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This function works the same as imlib_create_cropped_image() but will scale
|
||||||
|
the new image to the new destination width and height whilst cropping.
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
Imlib_Updates imlib_updates_clone(Imlib_Updates updates);
|
Imlib_Updates imlib_updates_clone(Imlib_Updates updates);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This function creates a duplicate of the updates list passed into the
|
||||||
|
function.
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
Imlib_Updates imlib_update_append_rect(Imlib_Updates updates,
|
Imlib_Updates imlib_update_append_rect(Imlib_Updates updates,
|
||||||
int x,
|
int x,
|
||||||
|
@ -1209,27 +1228,45 @@ Imlib_Updates imlib_update_append_rect(Imlib_Updates updates,
|
||||||
int w,
|
int w,
|
||||||
int h);
|
int h);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This function appends an update rectangle to the updates list passed in (if
|
||||||
|
the updates is NULL it will create a new updates list) and returns a handle
|
||||||
|
to the modified updates list (the handle may be modified so only use the new
|
||||||
|
updates handle returned)
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
Imlib_Updates imlib_updates_merge(Imlib_Updates updates,
|
Imlib_Updates imlib_updates_merge(Imlib_Updates updates,
|
||||||
int w,
|
int w,
|
||||||
int h);
|
int h);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This function takes an updates list, and modifies it by merging overlapped
|
||||||
|
rectangles and lots of tiny rectangles into larger rentangles to minimize
|
||||||
|
the number of rectangles in the list for optimized redrawing. The new
|
||||||
|
updates handle is now valid and the old one passed in is not.
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
Imlib_Updates imlib_updates_merge_for_rendering(Imlib_Updates updates,
|
Imlib_Updates imlib_updates_merge_for_rendering(Imlib_Updates updates,
|
||||||
int w,
|
int w,
|
||||||
int h);
|
int h);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This works almots exactly as imlib_updates_merge() but is more lenient on
|
||||||
|
the spacign between update rectangles - if they are very close it amalgamates
|
||||||
|
2 smaller rectangles into 1 larger one.
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
void imlib_updates_free(Imlib_Updates updates);
|
void imlib_updates_free(Imlib_Updates updates);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This frees an updates list.
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
Imlib_Updates imlib_updates_get_next(Imlib_Updates updates);
|
Imlib_Updates imlib_updates_get_next(Imlib_Updates updates);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
Thsi gets the next update in the updates list relative to the one passed in.
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
void imlib_updates_get_coordinates(Imlib_Updates updates,
|
void imlib_updates_get_coordinates(Imlib_Updates updates,
|
||||||
int *x_return,
|
int *x_return,
|
||||||
|
@ -1237,7 +1274,9 @@ void imlib_updates_get_coordinates(Imlib_Updates updates,
|
||||||
int *width_return,
|
int *width_return,
|
||||||
int *height_return);
|
int *height_return);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This returns the coordinates of an update.
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
void imlib_updates_set_coordinates(Imlib_Updates updates,
|
void imlib_updates_set_coordinates(Imlib_Updates updates,
|
||||||
int x,
|
int x,
|
||||||
|
@ -1245,58 +1284,95 @@ void imlib_updates_set_coordinates(Imlib_Updates updates,
|
||||||
int width,
|
int width,
|
||||||
int height);
|
int height);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This modifies the coordinates of an update in an updates list.
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
void imlib_render_image_updates_on_drawable(Imlib_Updates updates,
|
void imlib_render_image_updates_on_drawable(Imlib_Updates updates,
|
||||||
int x,
|
int x,
|
||||||
int y);
|
int y);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
Given an updates list (preferable already merged for rendering) this will
|
||||||
|
render the corresponding parts of the image to the current drawable at an
|
||||||
|
offset of x, y in the drawable.
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
Imlib_Updates imlib_updates_init(void);
|
Imlib_Updates imlib_updates_init(void);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This initialises an updates list before you add any updates to it or merge
|
||||||
|
it for rendering etc.
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
Imlib_Updates imlib_updates_append_updates(Imlib_Updates updates,
|
Imlib_Updates imlib_updates_append_updates(Imlib_Updates updates,
|
||||||
Imlib_Updates appended_updates);
|
Imlib_Updates appended_updates);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This appends one updates list (appended_updates) to the updates list
|
||||||
|
(updates) and retruens the new list.
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
void imlib_image_flip_horizontal(void);
|
void imlib_image_flip_horizontal(void);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This will flip/mirror the current image horizontally.
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
void imlib_image_flip_vertical(void);
|
void imlib_image_flip_vertical(void);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This will flip/mirror the current image vertically.
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
void imlib_image_flip_diagonal(void);
|
void imlib_image_flip_diagonal(void);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This will flip/mirror the current image diagonally (good for quick and dirty
|
||||||
|
90 degree rotations if used before to after a horizontal or vertical flip).
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
void imlib_image_orientate(int orientation);
|
void imlib_image_orientate(int orientation);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This will performan 90 degree rotations on the current image. Passing in
|
||||||
|
orientation does not rotate, 1 rotates clockwise by 90 degree, 2,
|
||||||
|
rotates clockwise by 180 degrees, 3 rotates clockwise by 270 degrees.
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
void imlib_image_blur(int radius);
|
void imlib_image_blur(int radius);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This will blur the current image. A radius of 0 has no effect, 1 and above
|
||||||
|
determine the blur matrix radius that determine how much to blur the image.
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
void imlib_image_sharpen(int radius);
|
void imlib_image_sharpen(int radius);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This sharpens the current image. The radius affects how much to sharpen by.
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
void imlib_image_tile_horizontal(void);
|
void imlib_image_tile_horizontal(void);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This modifies an image so it will tile seamlessly horizontally if used as a
|
||||||
|
tile (ie drawn multiple times horizotnally)
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
void imlib_image_tile_vertical(void);
|
void imlib_image_tile_vertical(void);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This modifies an image so it will tile seamlessly vertically if used as a
|
||||||
|
tile (ie drawn multiple times vertically)
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
void imlib_image_tile(void);
|
void imlib_image_tile(void);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
<blockquote>
|
||||||
|
This modifies an image so it will tile seamlessly horizontally and vertically
|
||||||
|
if used as a tile (ie drawn multiple times horizotnally and vertically)
|
||||||
|
</blockquote>
|
||||||
<pre><b><tt><font color="#660000"><font size=+2>
|
<pre><b><tt><font color="#660000"><font size=+2>
|
||||||
Imlib_Font imlib_load_font(const char *font_name);
|
Imlib_Font imlib_load_font(const char *font_name);
|
||||||
</font></font></tt></b></pre>
|
</font></font></tt></b></pre>
|
||||||
|
|
196
src/file.c
196
src/file.c
|
@ -13,37 +13,40 @@
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
|
||||||
static void __imlib_FileFieldWord(char *s, int num, char *wd);
|
static void __imlib_FileFieldWord(char *s, int num, char *wd);
|
||||||
|
static char *__imlib_FileRealFile(const char *file);
|
||||||
|
|
||||||
|
static char *
|
||||||
|
__imlib_FileRealFile(const char *file)
|
||||||
|
{
|
||||||
|
char *colon;
|
||||||
|
char *newfile;
|
||||||
|
|
||||||
|
newfile = strdup(file);
|
||||||
|
if (!newfile) return NULL;
|
||||||
|
colon = strrchr(file, ':');
|
||||||
|
if (!colon) return newfile;
|
||||||
|
*colon = 0;
|
||||||
|
return newfile;
|
||||||
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
__imlib_FileExtension(const char *file)
|
__imlib_FileExtension(const char *file)
|
||||||
{
|
{
|
||||||
char *p, *c;
|
char *p;
|
||||||
|
char *fl;
|
||||||
|
|
||||||
|
fl = __imlib_FileRealFile(file);
|
||||||
|
if (!fl) return strdup("");
|
||||||
p = strrchr(file, '.');
|
p = strrchr(file, '.');
|
||||||
c = strrchr(file, ':');
|
if (p)
|
||||||
if (!c)
|
|
||||||
{
|
{
|
||||||
if (p != NULL)
|
char *ret;
|
||||||
return strdup(p + 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((p) && (c > p))
|
|
||||||
{
|
|
||||||
char *buf;
|
|
||||||
|
|
||||||
buf = malloc(strlen(p));
|
ret = strdup(p + 1);
|
||||||
if (!buf) return NULL;
|
free(fl);
|
||||||
strcpy(buf, p);
|
return ret;
|
||||||
buf[c - p] = 0;
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (p != NULL)
|
|
||||||
return strdup(p + 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
free(fl);
|
||||||
return strdup("");
|
return strdup("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,27 +54,17 @@ int
|
||||||
__imlib_FileExists(const char *s)
|
__imlib_FileExists(const char *s)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char *p, *buf = NULL;
|
char *fl;
|
||||||
|
|
||||||
if ((!s) || (!*s))
|
if ((!s) || (!*s)) return 0;
|
||||||
return(0);
|
fl = __imlib_FileRealFile(s);
|
||||||
p = strrchr(s, ':');
|
if (!fl) return 0;
|
||||||
if (p)
|
if (stat(fl, &st) < 0)
|
||||||
{
|
{
|
||||||
|
free(fl);
|
||||||
buf = malloc(strlen(s));
|
|
||||||
if (!buf) return 0;
|
|
||||||
strcpy(buf, s);
|
|
||||||
p = strrchr(buf, ':');
|
|
||||||
if (p) *p = 0;
|
|
||||||
s = buf;
|
|
||||||
}
|
|
||||||
if (stat(s, &st) < 0)
|
|
||||||
{
|
|
||||||
if (buf) free(buf);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (buf) free(buf);
|
free(fl);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,93 +72,63 @@ int
|
||||||
__imlib_FileIsFile(const char *s)
|
__imlib_FileIsFile(const char *s)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char *p, *buf = NULL;
|
char *fl;
|
||||||
|
|
||||||
if ((!s) || (!*s))
|
if ((!s) || (!*s)) return 0;
|
||||||
return(0);
|
fl = __imlib_FileRealFile(s);
|
||||||
p = strrchr(s, ':');
|
if (!fl) return 0;
|
||||||
if (p)
|
if (stat(fl, &st) < 0)
|
||||||
{
|
{
|
||||||
|
free(fl);
|
||||||
buf = malloc(strlen(s));
|
return 0;
|
||||||
if (!buf) return 0;
|
|
||||||
strcpy(buf, s);
|
|
||||||
p = strrchr(buf, ':');
|
|
||||||
if (p) *p = 0;
|
|
||||||
s = buf;
|
|
||||||
}
|
|
||||||
if (stat(s, &st) < 0)
|
|
||||||
{
|
|
||||||
if (buf) free(buf);
|
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
if (S_ISREG(st.st_mode))
|
if (S_ISREG(st.st_mode))
|
||||||
{
|
{
|
||||||
if (buf) free(buf);
|
free(fl);
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
if (buf) free(buf);
|
free(fl);
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
__imlib_FileIsDir(const char *s)
|
__imlib_FileIsDir(const char *s)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char *p, *buf = NULL;
|
char *fl;
|
||||||
|
|
||||||
if ((!s) || (!*s))
|
if ((!s) || (!*s)) return 0;
|
||||||
return(0);
|
fl = __imlib_FileRealFile(s);
|
||||||
p = strrchr(s, ':');
|
if (!fl) return 0;
|
||||||
if (p)
|
if (stat(fl, &st) < 0)
|
||||||
{
|
{
|
||||||
|
free(fl);
|
||||||
buf = malloc(strlen(s));
|
return 0;
|
||||||
if (!buf) return 0;
|
|
||||||
strcpy(buf, s);
|
|
||||||
p = strrchr(buf, ':');
|
|
||||||
if (p) *p = 0;
|
|
||||||
s = buf;
|
|
||||||
}
|
|
||||||
if (stat(s, &st) < 0)
|
|
||||||
{
|
|
||||||
if (buf) free(buf);
|
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
if (S_ISDIR(st.st_mode))
|
if (S_ISDIR(st.st_mode))
|
||||||
{
|
{
|
||||||
if (buf) free(buf);
|
free(fl);
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
if (buf) free(buf);
|
free(fl);
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
__imlib_FilePermissions(const char *s)
|
__imlib_FilePermissions(const char *s)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char *p, *buf = NULL;
|
char *fl;
|
||||||
|
|
||||||
if ((!s) || (!*s))
|
if ((!s) || (!*s)) return 0;
|
||||||
return 0;
|
fl = __imlib_FileRealFile(s);
|
||||||
p = strrchr(s, ':');
|
if (!fl) return 0;
|
||||||
if (p)
|
if (stat(fl, &st) < 0)
|
||||||
{
|
{
|
||||||
|
free(fl);
|
||||||
buf = malloc(strlen(s));
|
|
||||||
if (!buf) return 0;
|
|
||||||
strcpy(buf, s);
|
|
||||||
p = strrchr(buf, ':');
|
|
||||||
if (p) *p = 0;
|
|
||||||
s = buf;
|
|
||||||
}
|
|
||||||
if (!stat(s, &st) < 0)
|
|
||||||
{
|
|
||||||
if (buf) free(buf);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (buf) free(buf);
|
free(fl);
|
||||||
return st.st_mode;
|
return st.st_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,38 +232,23 @@ time_t
|
||||||
__imlib_FileModDate(const char *s)
|
__imlib_FileModDate(const char *s)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char *p, *buf = NULL;
|
char *fl;
|
||||||
|
|
||||||
if ((!s) || (!*s))
|
if ((!s) || (!*s)) return 0;
|
||||||
return(0);
|
fl = __imlib_FileRealFile(s);
|
||||||
p = strrchr(s, ':');
|
if (!fl) return 0;
|
||||||
if (p)
|
if (stat(fl, &st) < 0)
|
||||||
{
|
{
|
||||||
|
free(fl);
|
||||||
buf = malloc(strlen(s));
|
return 0;
|
||||||
if (!buf) return 0;
|
|
||||||
strcpy(buf, s);
|
|
||||||
p = strrchr(buf, ':');
|
|
||||||
if (p) *p = 0;
|
|
||||||
s = buf;
|
|
||||||
}
|
|
||||||
if (!stat(s, &st) < 0)
|
|
||||||
{
|
|
||||||
if (buf) free(buf);
|
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
if (st.st_mtime > st.st_ctime)
|
if (st.st_mtime > st.st_ctime)
|
||||||
{
|
{
|
||||||
if (buf) free(buf);
|
free(fl);
|
||||||
return(st.st_mtime);
|
return st.st_mtime;
|
||||||
}
|
}
|
||||||
else
|
free(fl);
|
||||||
{
|
return st.st_ctime;
|
||||||
if (buf) free(buf);
|
|
||||||
return(st.st_ctime);
|
|
||||||
}
|
|
||||||
if (buf) free(buf);
|
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|
|
@ -897,6 +897,8 @@ __imlib_FindBestLoaderForFileFormat(const char *file, char *format)
|
||||||
/* change the extension to all lower case as all "types" are listed as */
|
/* change the extension to all lower case as all "types" are listed as */
|
||||||
/* lower case strings fromt he loader that represent all the possible */
|
/* lower case strings fromt he loader that represent all the possible */
|
||||||
/* extensions that file format could have */
|
/* extensions that file format could have */
|
||||||
|
if (extension)
|
||||||
|
{
|
||||||
lower = extension;
|
lower = extension;
|
||||||
while (*lower)
|
while (*lower)
|
||||||
{
|
{
|
||||||
|
@ -904,9 +906,10 @@ __imlib_FindBestLoaderForFileFormat(const char *file, char *format)
|
||||||
lower++;
|
lower++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!extension)
|
if (!extension)
|
||||||
return NULL;
|
return NULL;
|
||||||
/* look thought the loaders one by one to see if one matches that format */
|
/* look through the loaders one by one to see if one matches that format */
|
||||||
l = loaders;
|
l = loaders;
|
||||||
while (l)
|
while (l)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue