Expunged all the raw_file stuff and fixed a warning.

SVN revision: 5143
This commit is contained in:
Tom Gilbert 2001-08-13 18:16:03 +00:00
parent 70d6cef5b3
commit c0a35f2a2f
8 changed files with 43 additions and 83 deletions

View File

@ -130,7 +130,6 @@ extern "C"
void imlib_context_set_image(Imlib_Image image);
void imlib_context_set_cliprect(int x, int y, int w, int h);
void imlib_context_set_TTF_encoding(Imlib_TTF_Encoding encoding);
void imlib_context_set_filename_raw_mode(int onoff);
/* context getting */
#ifndef X_DISPLAY_MISSING
@ -160,7 +159,6 @@ extern "C"
Imlib_Image imlib_context_get_image(void);
void imlib_context_get_cliprect(int *x, int *y, int *w, int *h);
Imlib_TTF_Encoding imlib_context_get_TTF_encoding(void);
int imlib_context_get_filename_raw_mode(void);
int imlib_get_cache_size(void);
void imlib_set_cache_size(int bytes);

View File

@ -103,7 +103,6 @@ struct _imlibcontext
Imlib_Filter filter;
Imlib_Rectangle cliprect;
Imlib_TTF_Encoding encoding;
int filename_raw;
int references;
char dirty;
@ -187,7 +186,6 @@ imlib_context_new(void)
context->filter = NULL;
context->cliprect = (Imlib_Rectangle) { 0, 0, 0, 0 };
context->encoding = IMLIB_TTF_ENCODING_ISO_8859_1;
context->filename_raw = 0;
context->references = 0;
context->dirty = 0;
@ -629,21 +627,6 @@ imlib_context_get_TTF_encoding(void)
return ctx->encoding;
}
void
imlib_context_set_filename_raw_mode(int onoff)
{
if (!ctx) ctx = imlib_context_new();
ctx->filename_raw = onoff;
}
int
imlib_context_get_filename_raw_mode(void)
{
if (!ctx) ctx = imlib_context_new();
return ctx->filename_raw;
}
/* imlib api */
int
imlib_get_cache_size(void)
@ -725,7 +708,7 @@ imlib_load_image(const char *file)
prev_ctxt_image = ctx->image;
im =
__imlib_LoadImage(file, (ImlibProgressFunction) ctx->progress_func,
ctx->progress_granularity, 0, 0, NULL, ctx->filename_raw);
ctx->progress_granularity, 0, 0, NULL);
ctx->image = prev_ctxt_image;
return (Imlib_Image) im;
}
@ -742,7 +725,7 @@ imlib_load_image_immediately(const char *file)
prev_ctxt_image = ctx->image;
im =
__imlib_LoadImage(file, (ImlibProgressFunction) ctx->progress_func,
ctx->progress_granularity, 1, 0, NULL, ctx->filename_raw);
ctx->progress_granularity, 1, 0, NULL);
ctx->image = prev_ctxt_image;
return (Imlib_Image) im;
}
@ -759,7 +742,7 @@ imlib_load_image_without_cache(const char *file)
prev_ctxt_image = ctx->image;
im =
__imlib_LoadImage(file, (ImlibProgressFunction) ctx->progress_func,
ctx->progress_granularity, 0, 1, NULL, ctx->filename_raw);
ctx->progress_granularity, 0, 1, NULL);
ctx->image = prev_ctxt_image;
return (Imlib_Image) im;
}
@ -776,7 +759,7 @@ imlib_load_image_immediately_without_cache(const char *file)
prev_ctxt_image = ctx->image;
im =
__imlib_LoadImage(file, (ImlibProgressFunction) ctx->progress_func,
ctx->progress_granularity, 1, 1, NULL, ctx->filename_raw);
ctx->progress_granularity, 1, 1, NULL);
ctx->image = prev_ctxt_image;
return (Imlib_Image) im;
}
@ -792,17 +775,17 @@ imlib_load_image_with_error_return(const char *file,
if (!ctx) ctx = imlib_context_new();
CHECK_PARAM_POINTER_RETURN("imlib_load_image_with_error_return", "file",
file, NULL);
if (!__imlib_FileExists(file, ctx->filename_raw))
if (!__imlib_FileExists(file))
{
*error_return = IMLIB_LOAD_ERROR_FILE_DOES_NOT_EXIST;
return NULL;
}
if (__imlib_FileIsDir(file, ctx->filename_raw))
if (__imlib_FileIsDir(file))
{
*error_return = IMLIB_LOAD_ERROR_FILE_IS_DIRECTORY;
return NULL;
}
if (!__imlib_FileCanRead(file, ctx->filename_raw))
if (!__imlib_FileCanRead(file))
{
*error_return = IMLIB_LOAD_ERROR_PERMISSION_DENIED_TO_READ;
return NULL;
@ -812,8 +795,7 @@ imlib_load_image_with_error_return(const char *file,
(Imlib_Image) __imlib_LoadImage(file,
(ImlibProgressFunction)
ctx->progress_func,
ctx->progress_granularity, 1, 0, &er,
ctx->filename_raw);
ctx->progress_granularity, 1, 0, &er);
ctx->image = prev_ctxt_image;
if (im)
*error_return = IMLIB_LOAD_ERROR_NONE;
@ -3759,7 +3741,7 @@ imlib_save_image(const char *filename)
return;
prev_ctxt_image = ctx->image;
__imlib_SaveImage(im, filename, (ImlibProgressFunction) ctx->progress_func,
ctx->progress_granularity, NULL, ctx->filename_raw);
ctx->progress_granularity, NULL);
ctx->image = prev_ctxt_image;
}
@ -3784,7 +3766,7 @@ imlib_save_image_with_error_return(const char *filename,
return;
prev_ctxt_image = ctx->image;
__imlib_SaveImage(im, filename, (ImlibProgressFunction) ctx->progress_func,
ctx->progress_granularity, error_return, ctx->filename_raw);
ctx->progress_granularity, error_return);
ctx->image = prev_ctxt_image;
}

View File

@ -116,7 +116,7 @@ void __imlib_dynamic_filters_init()
}
}
static void __imlib_dynamic_filters_deinit()
void __imlib_dynamic_filters_deinit()
{
}

View File

@ -113,7 +113,7 @@ __imlib_FileExtension(const char *file)
}
int
__imlib_FileExists(const char *s, int raw)
__imlib_FileExists(const char *s)
{
struct stat st;
char *fl;
@ -132,7 +132,7 @@ __imlib_FileExists(const char *s, int raw)
}
int
__imlib_FileIsFile(const char *s, int raw)
__imlib_FileIsFile(const char *s)
{
struct stat st;
char *fl;
@ -156,7 +156,7 @@ __imlib_FileIsFile(const char *s, int raw)
}
int
__imlib_FileIsDir(const char *s, int raw)
__imlib_FileIsDir(const char *s)
{
struct stat st;
char *fl;
@ -180,7 +180,7 @@ __imlib_FileIsDir(const char *s, int raw)
}
int
__imlib_FilePermissions(const char *s, int raw)
__imlib_FilePermissions(const char *s)
{
struct stat st;
char *fl;
@ -199,7 +199,7 @@ __imlib_FilePermissions(const char *s, int raw)
}
int
__imlib_FileCanRead(const char *s, int raw)
__imlib_FileCanRead(const char *s)
{
char *fl;
int val;
@ -207,7 +207,7 @@ __imlib_FileCanRead(const char *s, int raw)
if (__imlib_IsRealFile(s)) fl = strdup(s);
else fl = __imlib_FileRealFile(s);
if (!fl) return 0;
if (!(__imlib_FilePermissions(fl, 1) & (S_IRUSR | S_IRGRP | S_IROTH)))
if (!(__imlib_FilePermissions(fl) & (S_IRUSR | S_IRGRP | S_IROTH)))
{
free(fl);
return 0;
@ -314,7 +314,7 @@ __imlib_IsRealFile(const char *s)
}
time_t
__imlib_FileModDate(const char *s, int raw)
__imlib_FileModDate(const char *s)
{
struct stat st;
char *fl;

View File

@ -3,17 +3,17 @@
char *__imlib_FileKey(const char *file);
char *__imlib_FileRealFile(const char *file);
char *__imlib_FileExtension(const char *file);
int __imlib_FileExists(const char *s, int raw);
int __imlib_FileIsFile(const char *s, int raw);
int __imlib_FileIsDir(const char *s, int raw);
int __imlib_FileExists(const char *s);
int __imlib_FileIsFile(const char *s);
int __imlib_FileIsDir(const char *s);
char **__imlib_FileDir(char *dir, int *num);
void __imlib_FileFreeDirList(char **l, int num);
void __imlib_FileDel(char *s);
time_t __imlib_FileModDate(const char *s, int raw);
time_t __imlib_FileModDate(const char *s);
char *__imlib_FileHomeDir(int uid);
char *__imlib_FileField(char *s, int field);
int __imlib_FilePermissions(const char *s, int raw);
int __imlib_FileCanRead(const char *s, int raw);
int __imlib_FilePermissions(const char *s);
int __imlib_FileCanRead(const char *s);
int __imlib_IsRealFile(const char *s);

View File

@ -335,17 +335,17 @@ __imlib_load_font(const char *fontname)
return NULL;
}
sprintf(tmp, "%s.ttf", name);
if (__imlib_FileIsFile(tmp, 1))
if (__imlib_FileIsFile(tmp))
file = strdup(tmp);
else
{
sprintf(tmp, "%s.TTF", name);
if (__imlib_FileIsFile(tmp, 1))
if (__imlib_FileIsFile(tmp))
file = strdup(tmp);
else
{
sprintf(tmp, "%s", name);
if (__imlib_FileIsFile(tmp, 1))
if (__imlib_FileIsFile(tmp))
file = strdup(tmp);
}
}
@ -363,17 +363,17 @@ __imlib_load_font(const char *fontname)
else
{
sprintf(tmp, "%s/%s.ttf", fpath[j], name);
if (__imlib_FileIsFile(tmp, 1))
if (__imlib_FileIsFile(tmp))
file = strdup(tmp);
else
{
sprintf(tmp, "%s/%s.TTF", fpath[j], name);
if (__imlib_FileIsFile(tmp, 1))
if (__imlib_FileIsFile(tmp))
file = strdup(tmp);
else
{
sprintf(tmp, "%s/%s", fpath[j], name);
if (__imlib_FileIsFile(tmp, 1))
if (__imlib_FileIsFile(tmp))
file = strdup(tmp);
}
}
@ -1882,7 +1882,7 @@ __imlib_list_fonts(int *num_ret)
*p = '\0';
if(!__imlib_ItemInList(list, l, dir[j]))
{
if (__imlib_FileIsFile(path, 1))
if (__imlib_FileIsFile(path))
{
TT_Face f;

View File

@ -788,16 +788,16 @@ __imlib_RescanLoaders(void)
/* ok - was the system loaders dir contents modified ? */
last_scan_time = current_time;
#ifndef __EMX__
if (__imlib_FileIsDir(SYS_LOADERS_PATH "/image/", 1))
if (__imlib_FileIsDir(SYS_LOADERS_PATH "/image/"))
#else
if (__imlib_FileIsDir(__XOS2RedirRoot(SYS_LOADERS_PATH "/image/", 1)))
if (__imlib_FileIsDir(__XOS2RedirRoot(SYS_LOADERS_PATH "/image/")))
#endif
{
#ifndef __EMX__
current_time = __imlib_FileModDate(SYS_LOADERS_PATH "/image/", 1);
current_time = __imlib_FileModDate(SYS_LOADERS_PATH "/image/");
#else
current_time =
__imlib_FileModDate(__XOS2RedirRoot(SYS_LOADERS_PATH "/image/", 1));
__imlib_FileModDate(__XOS2RedirRoot(SYS_LOADERS_PATH "/image/"));
#endif
if (current_time > last_modified_system_time)
{
@ -810,9 +810,9 @@ __imlib_RescanLoaders(void)
home = __imlib_FileHomeDir(getuid());
sprintf(s, "%s/" USER_LOADERS_PATH "/image/", home);
free(home);
if (__imlib_FileIsDir(s, 1))
if (__imlib_FileIsDir(s))
{
current_time = __imlib_FileModDate(s, 1);
current_time = __imlib_FileModDate(s);
if (current_time > last_modified_home_time)
{
/* yup - set the "do_reload" flag */
@ -1018,8 +1018,7 @@ __imlib_CreateImage(int w, int h, DATA32 * data)
ImlibImage *
__imlib_LoadImage(const char *file, ImlibProgressFunction progress,
char progress_granularity, char immediate_load,
char dont_cache, ImlibLoadError * er,
int raw_file_mode)
char dont_cache, ImlibLoadError * er)
{
ImlibImage *im;
ImlibLoader *best_loader;
@ -1038,7 +1037,7 @@ __imlib_LoadImage(const char *file, ImlibProgressFunction progress,
{
time_t current_modified_time;
current_modified_time = __imlib_FileModDate(file, raw_file_mode);
current_modified_time = __imlib_FileModDate(file);
/* if the file on disk is newer than the cached one */
if (current_modified_time > im->moddate)
{
@ -1073,7 +1072,7 @@ __imlib_LoadImage(const char *file, ImlibProgressFunction progress,
im->real_file = __imlib_FileRealFile(file);
im->key = __imlib_FileKey(file);
}
im->moddate = __imlib_FileModDate(file, raw_file_mode);
im->moddate = __imlib_FileModDate(file);
/* ok - just check all our loaders are up to date */
__imlib_RescanLoaders();
/* take a guess by extension on the best loader to use */
@ -1298,8 +1297,7 @@ __imlib_DirtyImage(ImlibImage * im)
void
__imlib_SaveImage(ImlibImage * im, const char *file,
ImlibProgressFunction progress, char progress_granularity,
ImlibLoadError * er,
int raw_file_mode)
ImlibLoadError * er)
{
ImlibLoader *l;
char e, *pfile;
@ -1317,22 +1315,6 @@ __imlib_SaveImage(ImlibImage * im, const char *file,
im->file = strdup(file);
im->real_file = strdup(im->file);
/* if (raw_file_mode)
{
if (im->real_file) free(im->real_file);
if (im->key) free(im->key);
im->real_file = strdup(im->file);
im->key = NULL;
}
else
{
if (im->real_file) free(im->real_file);
im->real_file = __imlib_FileRealFile(file);
if (im->key) free(im->key);
im->key = __imlib_FileKey(file);
}
*/
/* find the laoder for the format - if its null use the extension */
l = __imlib_FindBestLoaderForFileFormat(im->real_file, im->format);
/* no loader - abort */

View File

@ -169,8 +169,7 @@ ImlibImage *__imlib_CreateImage(int w, int h, DATA32 *data);
ImlibImage *__imlib_LoadImage(const char *file,
ImlibProgressFunction progress,
char progress_granularity, char immediate_load,
char dont_cache, ImlibLoadError *er,
int raw_file_mode);
char dont_cache, ImlibLoadError *er);
#ifndef X_DISPLAY_MISSING
ImlibImagePixmap *__imlib_FindImlibImagePixmapByID(Display *d, Pixmap p);
#endif
@ -188,8 +187,7 @@ void __imlib_DirtyImage(ImlibImage *im);
void __imlib_SaveImage(ImlibImage *im, const char *file,
ImlibProgressFunction progress,
char progress_granularity,
ImlibLoadError *er,
int raw_file_mode);
ImlibLoadError *er);
# define IMAGE_HAS_ALPHA(im) ((im)->flags & F_HAS_ALPHA)
# define IMAGE_IS_UNLOADED(im) ((im)->flags & F_UNLOADED)