mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-18 12:00:31 +01:00
Added 'const' attribute to the file name parameter to load/save
This name is not modified by the callee functions (and it should not be anyway), so let's make it official in the internal functions
This commit is contained in:
committed by
Carlos R. Mafra
parent
225c99a6ca
commit
d1e1c13fa3
@@ -48,30 +48,30 @@ typedef enum {
|
||||
/*
|
||||
* Function for Loading in a specific format
|
||||
*/
|
||||
RImage *RLoadPPM(char *file_name);
|
||||
RImage *RLoadPPM(const char *file);
|
||||
|
||||
RImage *RLoadXPM(RContext *context, char *file);
|
||||
RImage *RLoadXPM(RContext *context, const char *file);
|
||||
|
||||
#ifdef USE_TIFF
|
||||
RImage *RLoadTIFF(char *file, int index);
|
||||
RImage *RLoadTIFF(const char *file, int index);
|
||||
#endif
|
||||
|
||||
#ifdef USE_PNG
|
||||
RImage *RLoadPNG(RContext *context, char *file);
|
||||
RImage *RLoadPNG(RContext *context, const char *file);
|
||||
#endif
|
||||
|
||||
#ifdef USE_JPEG
|
||||
RImage *RLoadJPEG(RContext *context, char *file);
|
||||
RImage *RLoadJPEG(RContext *context, const char *file);
|
||||
#endif
|
||||
|
||||
#ifdef USE_GIF
|
||||
RImage *RLoadGIF(char *file, int index);
|
||||
RImage *RLoadGIF(const char *file, int index);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Function for Saving in a specific format
|
||||
*/
|
||||
Bool RSaveXPM(RImage * image, char *filename);
|
||||
Bool RSaveXPM(RImage *image, const char *file);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -91,7 +91,7 @@ static void my_error_exit(j_common_ptr cinfo)
|
||||
longjmp(myerr->setjmp_buffer, 1);
|
||||
}
|
||||
|
||||
RImage *RLoadJPEG(RContext * context, char *file_name)
|
||||
RImage *RLoadJPEG(RContext * context, const char *file_name)
|
||||
{
|
||||
RImage *image = NULL;
|
||||
struct jpeg_decompress_struct cinfo;
|
||||
|
||||
@@ -68,7 +68,7 @@ static int RImageCacheMaxImage = -1; /* 0 = any size */
|
||||
static RCachedImage *RImageCache;
|
||||
|
||||
|
||||
static WRImgFormat identFile(char *path);
|
||||
static WRImgFormat identFile(const char *path);
|
||||
|
||||
|
||||
char **RSupportedFileFormats(void)
|
||||
@@ -123,7 +123,7 @@ static void init_cache()
|
||||
}
|
||||
}
|
||||
|
||||
RImage *RLoadImage(RContext * context, char *file, int index)
|
||||
RImage *RLoadImage(RContext * context, const char *file, int index)
|
||||
{
|
||||
RImage *image = NULL;
|
||||
int i;
|
||||
@@ -238,7 +238,7 @@ RImage *RLoadImage(RContext * context, char *file, int index)
|
||||
return image;
|
||||
}
|
||||
|
||||
char *RGetImageFileFormat(char *file)
|
||||
char *RGetImageFileFormat(const char *file)
|
||||
{
|
||||
switch (identFile(file)) {
|
||||
case IM_XPM:
|
||||
@@ -272,7 +272,7 @@ char *RGetImageFileFormat(char *file)
|
||||
}
|
||||
}
|
||||
|
||||
static WRImgFormat identFile(char *path)
|
||||
static WRImgFormat identFile(const char *path)
|
||||
{
|
||||
FILE *file;
|
||||
unsigned char buffer[32];
|
||||
|
||||
@@ -551,7 +551,7 @@ static void freecolormap(XPMColor * colormap)
|
||||
}
|
||||
|
||||
/* save routine is common to internal support and library support */
|
||||
Bool RSaveXPM(RImage * image, char *filename)
|
||||
Bool RSaveXPM(RImage * image, const char *filename)
|
||||
{
|
||||
FILE *file;
|
||||
int x, y;
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "wraster.h"
|
||||
#include "imgformat.h"
|
||||
|
||||
RImage *RLoadPNG(RContext * context, char *file)
|
||||
RImage *RLoadPNG(RContext *context, const char *file)
|
||||
{
|
||||
char *tmp;
|
||||
RImage *image = NULL;
|
||||
|
||||
@@ -113,7 +113,7 @@ static RImage *load_pixmap(FILE * file, int w, int h, int max, int raw)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RImage *RLoadPPM(char *file_name)
|
||||
RImage *RLoadPPM(const char *file_name)
|
||||
{
|
||||
FILE *file;
|
||||
RImage *image = NULL;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "imgformat.h"
|
||||
|
||||
|
||||
Bool RSaveImage(RImage * image, char *filename, char *format)
|
||||
Bool RSaveImage(RImage * image, const char *filename, const char *format)
|
||||
{
|
||||
if (strcmp(format, "XPM") != 0) {
|
||||
RErrorCode = RERR_BADFORMAT;
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "wraster.h"
|
||||
#include "imgformat.h"
|
||||
|
||||
RImage *RLoadTIFF(char *file, int index)
|
||||
RImage *RLoadTIFF(const char *file, int index)
|
||||
{
|
||||
RImage *image = NULL;
|
||||
TIFF *tif;
|
||||
|
||||
@@ -298,7 +298,7 @@ enum {
|
||||
char **RSupportedFileFormats(void);
|
||||
|
||||
|
||||
char *RGetImageFileFormat(char *file);
|
||||
char *RGetImageFileFormat(const char *file);
|
||||
|
||||
/*
|
||||
* Xlib contexts
|
||||
@@ -320,7 +320,7 @@ RImage *RCreateImageFromXImage(RContext *context, XImage *image, XImage *mask);
|
||||
RImage *RCreateImageFromDrawable(RContext *context, Drawable drawable,
|
||||
Pixmap mask);
|
||||
|
||||
RImage *RLoadImage(RContext *context, char *file, int index);
|
||||
RImage *RLoadImage(RContext *context, const char *file, int index);
|
||||
|
||||
RImage* RRetainImage(RImage *image);
|
||||
|
||||
@@ -331,7 +331,7 @@ RImage *RGetImageFromXPMData(RContext *context, char **xpmData);
|
||||
/*
|
||||
* RImage storing
|
||||
*/
|
||||
Bool RSaveImage(RImage *image, char *filename, char *format);
|
||||
Bool RSaveImage(RImage *image, const char *filename, const char *format);
|
||||
|
||||
/*
|
||||
* Area manipulation
|
||||
|
||||
@@ -153,7 +153,7 @@ RImage *RGetImageFromXPMData(RContext * context, char **xpmData)
|
||||
return image;
|
||||
}
|
||||
|
||||
RImage *RLoadXPM(RContext * context, char *file)
|
||||
RImage *RLoadXPM(RContext * context, const char *file)
|
||||
{
|
||||
Display *dpy = context->dpy;
|
||||
Colormap cmap = context->cmap;
|
||||
@@ -164,7 +164,7 @@ RImage *RLoadXPM(RContext * context, char *file)
|
||||
int *p;
|
||||
int i;
|
||||
|
||||
i = XpmReadFileToXpmImage(file, &xpm, (XpmInfo *) NULL);
|
||||
i = XpmReadFileToXpmImage((char *)file, &xpm, (XpmInfo *) NULL);
|
||||
if (i != XpmSuccess) {
|
||||
switch (i) {
|
||||
case XpmOpenFailed:
|
||||
|
||||
Reference in New Issue
Block a user