1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

eliminated gcc-4 compilation warnings

This commit is contained in:
dan
2005-08-22 23:58:19 +00:00
parent 91f5abc955
commit c0317ddae5
28 changed files with 143 additions and 117 deletions

View File

@@ -7,6 +7,7 @@ Changes since version 0.92.0:
- fixed WPrefs.app to find its icons when not installed under GNUstep paths - fixed WPrefs.app to find its icons when not installed under GNUstep paths
- fixed gcc-4 compilation issues (Vladimir Nadvornik <nadvornik@suse.cz>) - fixed gcc-4 compilation issues (Vladimir Nadvornik <nadvornik@suse.cz>)
- fixed amd64 compilation issues (Vladimir Nadvornik <nadvornik@suse.cz>) - fixed amd64 compilation issues (Vladimir Nadvornik <nadvornik@suse.cz>)
- eliminated gcc-4 compilation warnings
Changes since version 0.91.0: Changes since version 0.91.0:

View File

@@ -126,8 +126,8 @@ enqueueMessage(WMConnection *cPtr, char *message)
} }
static unsigned char* static char*
findDelimiter(unsigned char *data, unsigned const char *endPtr) findDelimiter(char *data, const char *endPtr)
{ {
wassertrv(data < endPtr, NULL); wassertrv(data < endPtr, NULL);

View File

@@ -201,7 +201,7 @@ inputHandler(int fd, int mask, void *clientData)
if (cPtr->state == WCInProgress) { if (cPtr->state == WCInProgress) {
Bool failed; Bool failed;
int len = sizeof(result); socklen_t len = sizeof(result);
WCErrorCode = 0; WCErrorCode = 0;
if (getsockopt(cPtr->sock, SOL_SOCKET, SO_ERROR, if (getsockopt(cPtr->sock, SOL_SOCKET, SO_ERROR,
@@ -462,8 +462,8 @@ WMCreateConnectionAsServerAtAddress(char *host, char *service, char *protocol)
{ {
WMConnection *cPtr; WMConnection *cPtr;
struct sockaddr_in *socketaddr; struct sockaddr_in *socketaddr;
socklen_t size;
int sock, on; int sock, on;
int size;
WCErrorCode = 0; WCErrorCode = 0;
@@ -678,7 +678,7 @@ WMConnection*
WMAcceptConnection(WMConnection *listener) WMAcceptConnection(WMConnection *listener)
{ {
struct sockaddr_in clientname; struct sockaddr_in clientname;
int size; socklen_t size;
int newSock; int newSock;
WMConnection *newConnection; WMConnection *newConnection;

View File

@@ -219,7 +219,7 @@ sourceOperationList(WMScreen *scr, Window sourceWin)
} }
operationArray = WMCreateDragOperationArray(count); operationArray = WMCreateDragOperationArray(count);
description = descriptionList; description = (char*)descriptionList;
for (i=0; count > 0; i++) { for (i=0; count > 0; i++) {
size = strlen(description); size = strlen(description);

View File

@@ -279,7 +279,7 @@ getSelectionData(Display *dpy, Window win, Atom where)
WMData *wdata; WMData *wdata;
unsigned char *data; unsigned char *data;
Atom rtype; Atom rtype;
unsigned bits, bpi; int bits, bpi;
unsigned long len, bytes; unsigned long len, bytes;

View File

@@ -7,12 +7,12 @@
#define LIGHT_STIPPLE_WIDTH 4 #define LIGHT_STIPPLE_WIDTH 4
#define LIGHT_STIPPLE_HEIGHT 4 #define LIGHT_STIPPLE_HEIGHT 4
static unsigned char LIGHT_STIPPLE_BITS[] = { static char LIGHT_STIPPLE_BITS[] = {
0x05, 0x0a, 0x05, 0x0a}; 0x05, 0x0a, 0x05, 0x0a};
#define DARK_STIPPLE_WIDTH 4 #define DARK_STIPPLE_WIDTH 4
#define DARK_STIPPLE_HEIGHT 4 #define DARK_STIPPLE_HEIGHT 4
static unsigned char DARK_STIPPLE_BITS[] = { static char DARK_STIPPLE_BITS[] = {
0x0a, 0x04, 0x0a, 0x01}; 0x0a, 0x04, 0x0a, 0x01};

View File

@@ -27,7 +27,7 @@ xlfdToFcPattern(char *xlfd)
/* Just skip old font names that contain %d in them. /* Just skip old font names that contain %d in them.
* We don't support that anymore. */ * We don't support that anymore. */
if (strchr(xlfd, '%')!=NULL) if (strchr(xlfd, '%')!=NULL)
return FcNameParse(DEFAULT_FONT); return FcNameParse((FcChar8*)DEFAULT_FONT);
fname= wstrdup(xlfd); fname= wstrdup(xlfd);
if ((ptr = strchr(fname, ','))) { if ((ptr = strchr(fname, ','))) {
@@ -38,7 +38,7 @@ xlfdToFcPattern(char *xlfd)
if (!pattern) { if (!pattern) {
wwarning(_("invalid font: %s. Trying '%s'"), xlfd, DEFAULT_FONT); wwarning(_("invalid font: %s. Trying '%s'"), xlfd, DEFAULT_FONT);
pattern = FcNameParse(DEFAULT_FONT); pattern = FcNameParse((FcChar8*)DEFAULT_FONT);
} }
return pattern; return pattern;
@@ -52,7 +52,7 @@ xlfdToFcName(char *xlfd)
char *fname; char *fname;
pattern = xlfdToFcPattern(xlfd); pattern = xlfdToFcPattern(xlfd);
fname = FcNameUnparse(pattern); fname = (char*)FcNameUnparse(pattern);
FcPatternDestroy(pattern); FcPatternDestroy(pattern);
return fname; return fname;
@@ -102,7 +102,7 @@ makeFontOfSize(char *font, int size, char *fallback)
if (font[0]=='-') { if (font[0]=='-') {
pattern = xlfdToFcPattern(font); pattern = xlfdToFcPattern(font);
} else { } else {
pattern = FcNameParse(font); pattern = FcNameParse((FcChar8*)font);
} }
/*FcPatternPrint(pattern);*/ /*FcPatternPrint(pattern);*/
@@ -116,12 +116,12 @@ makeFontOfSize(char *font, int size, char *fallback)
} }
if (fallback && !hasPropertyWithStringValue(pattern, FC_FAMILY, fallback)) { if (fallback && !hasPropertyWithStringValue(pattern, FC_FAMILY, fallback)) {
FcPatternAddString(pattern, FC_FAMILY, fallback); FcPatternAddString(pattern, FC_FAMILY, (FcChar8*)fallback);
} }
/*FcPatternPrint(pattern);*/ /*FcPatternPrint(pattern);*/
result = FcNameUnparse(pattern); result = (char*)FcNameUnparse(pattern);
FcPatternDestroy(pattern); FcPatternDestroy(pattern);
return result; return result;
@@ -366,7 +366,7 @@ WMCopyFontWithStyle(WMScreen *scrPtr, WMFont *font, WMFontStyle style)
* return the closest match font to what we requested which is the * return the closest match font to what we requested which is the
* oblique font. Same goes for using bold for weight. * oblique font. Same goes for using bold for weight.
*/ */
pattern = FcNameParse(WMGetFontName(font)); pattern = FcNameParse((FcChar8*)WMGetFontName(font));
switch (style) { switch (style) {
case WFSNormal: case WFSNormal:
FcPatternDel(pattern, FC_WEIGHT); FcPatternDel(pattern, FC_WEIGHT);
@@ -374,21 +374,21 @@ WMCopyFontWithStyle(WMScreen *scrPtr, WMFont *font, WMFontStyle style)
break; break;
case WFSBold: case WFSBold:
FcPatternDel(pattern, FC_WEIGHT); FcPatternDel(pattern, FC_WEIGHT);
FcPatternAddString(pattern, FC_WEIGHT, "bold"); FcPatternAddString(pattern, FC_WEIGHT, (FcChar8*)"bold");
break; break;
case WFSItalic: case WFSItalic:
FcPatternDel(pattern, FC_SLANT); FcPatternDel(pattern, FC_SLANT);
FcPatternAddString(pattern, FC_SLANT, "italic"); FcPatternAddString(pattern, FC_SLANT, (FcChar8*)"italic");
break; break;
case WFSBoldItalic: case WFSBoldItalic:
FcPatternDel(pattern, FC_WEIGHT); FcPatternDel(pattern, FC_WEIGHT);
FcPatternDel(pattern, FC_SLANT); FcPatternDel(pattern, FC_SLANT);
FcPatternAddString(pattern, FC_WEIGHT, "bold"); FcPatternAddString(pattern, FC_WEIGHT, (FcChar8*)"bold");
FcPatternAddString(pattern, FC_SLANT, "italic"); FcPatternAddString(pattern, FC_SLANT, (FcChar8*)"italic");
break; break;
} }
name = FcNameUnparse(pattern); name = (char*)FcNameUnparse(pattern);
copy = WMCreateFont(scrPtr, name); copy = WMCreateFont(scrPtr, name);
FcPatternDestroy(pattern); FcPatternDestroy(pattern);
wfree(name); wfree(name);

View File

@@ -83,7 +83,7 @@ static int scalableFontSizes[] = {
static void setFontPanelFontName(FontPanel *panel, FcChar8 *family, FcChar8 *style, double size); static void setFontPanelFontName(FontPanel *panel, char *family, char *style, double size);
static int isXLFD(char *font, int *length_ret); static int isXLFD(char *font, int *length_ret);
@@ -370,7 +370,7 @@ WMSetFontPanelFont(WMFontPanel *panel, char *fontName)
if (!isXLFD(fontName, &fname_len)) { if (!isXLFD(fontName, &fname_len)) {
/* maybe its proper fontconfig and we can parse it */ /* maybe its proper fontconfig and we can parse it */
pattern = FcNameParse(fontName); pattern = FcNameParse((FcChar8*)fontName);
} else { } else {
/* maybe its proper xlfd and we can convert it to an FcPattern */ /* maybe its proper xlfd and we can convert it to an FcPattern */
pattern = XftXlfdParse(fontName, False, False); pattern = XftXlfdParse(fontName, False, False);
@@ -383,7 +383,7 @@ WMSetFontPanelFont(WMFontPanel *panel, char *fontName)
if (FcPatternGetString(pattern, FC_FAMILY, 0, &family)==FcResultMatch) if (FcPatternGetString(pattern, FC_FAMILY, 0, &family)==FcResultMatch)
if (FcPatternGetString(pattern, FC_STYLE, 0, &style)==FcResultMatch) if (FcPatternGetString(pattern, FC_STYLE, 0, &style)==FcResultMatch)
if (FcPatternGetDouble(pattern, "pixelsize", 0, &size)==FcResultMatch) if (FcPatternGetDouble(pattern, "pixelsize", 0, &size)==FcResultMatch)
setFontPanelFontName(panel, family, style, size); setFontPanelFontName(panel, (char*)family, (char*)style, size);
FcPatternDestroy(pattern); FcPatternDestroy(pattern);
} }
@@ -603,7 +603,7 @@ listFamilies(WMScreen *scr, WMFontPanel *panel)
if (FcPatternGetString(fs->fonts[i],FC_FAMILY,0,&family)==FcResultMatch) if (FcPatternGetString(fs->fonts[i],FC_FAMILY,0,&family)==FcResultMatch)
if (FcPatternGetString(fs->fonts[i],FC_STYLE,0,&style)==FcResultMatch) if (FcPatternGetString(fs->fonts[i],FC_STYLE,0,&style)==FcResultMatch)
addFontToXftFamily(families, family, style); addFontToXftFamily(families, (char*)family, (char*)style);
} }
FcFontSetDestroy(fs); FcFontSetDestroy(fs);
} }
@@ -815,7 +815,7 @@ sizeClick(WMWidget *w, void *data)
static void static void
setFontPanelFontName(FontPanel *panel, FcChar8 *family, FcChar8 *style, double size) setFontPanelFontName(FontPanel *panel, char *family, char *style, double size)
{ {
int famrow; int famrow;
int stlrow; int stlrow;

View File

@@ -305,7 +305,7 @@ static char *CHECK_MARK[] = {
#define STIPPLE_WIDTH 8 #define STIPPLE_WIDTH 8
#define STIPPLE_HEIGHT 8 #define STIPPLE_HEIGHT 8
static unsigned char STIPPLE_BITS[] = { static char STIPPLE_BITS[] = {
0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55
}; };

View File

@@ -207,7 +207,7 @@ output(char *ptr, int len)
#define STIPPLE_WIDTH 8 #define STIPPLE_WIDTH 8
#define STIPPLE_HEIGHT 8 #define STIPPLE_HEIGHT 8
static unsigned char STIPPLE_BITS[] = { static char STIPPLE_BITS[] = {
0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa
}; };

View File

@@ -715,7 +715,8 @@ WMGetViewScreenPosition(WMView *view)
{ {
WMScreen *scr = W_VIEW_SCREEN(view); WMScreen *scr = W_VIEW_SCREEN(view);
Window foo; Window foo;
int x, y, topX, topY, bar; int x, y, topX, topY;
unsigned int bar;
WMView *topView; WMView *topView;
topView = view; topView = view;

View File

@@ -231,11 +231,11 @@ lookup_available_fonts(_Panel *panel)
for (i= 0; i < fonts->nfont; i++) for (i= 0; i < fonts->nfont; i++)
{ {
FcChar8 *name; char *name;
int weight, slant, width; int weight, slant, width;
int j, found; int j, found;
if (FcPatternGetString(fonts->fonts[i], FC_FAMILY, 0, &name) != FcResultMatch) if (FcPatternGetString(fonts->fonts[i], FC_FAMILY, 0, (FcChar8**)&name) != FcResultMatch)
continue; continue;
if (FcPatternGetInteger(fonts->fonts[i], FC_WEIGHT, 0, &weight) != FcResultMatch) if (FcPatternGetInteger(fonts->fonts[i], FC_WEIGHT, 0, &weight) != FcResultMatch)
@@ -309,7 +309,7 @@ lookup_available_fonts(_Panel *panel)
static char* static char*
getSelectedFont(_Panel *panel, char *curfont) getSelectedFont(_Panel *panel, FcChar8 *curfont)
{ {
WMListItem *item; WMListItem *item;
FcPattern *pat= FcNameParse(curfont); FcPattern *pat= FcNameParse(curfont);
@@ -319,7 +319,7 @@ getSelectedFont(_Panel *panel, char *curfont)
if (item) if (item)
{ {
FcPatternDel(pat, FC_FAMILY); FcPatternDel(pat, FC_FAMILY);
FcPatternAddString(pat, FC_FAMILY, item->text); FcPatternAddString(pat, FC_FAMILY, (FcChar8*)item->text);
} }
item= WMGetListSelectedItem(panel->styleL); item= WMGetListSelectedItem(panel->styleL);
@@ -344,7 +344,7 @@ getSelectedFont(_Panel *panel, char *curfont)
FcPatternAddDouble(pat, FC_PIXEL_SIZE, atoi(item->text)); FcPatternAddDouble(pat, FC_PIXEL_SIZE, atoi(item->text));
} }
name= FcNameUnparse(pat); name = (char*)FcNameUnparse(pat);
FcPatternDestroy(pat); FcPatternDestroy(pat);
return name; return name;
@@ -446,12 +446,13 @@ selectedFamily(WMWidget *w, void *data)
{ {
int index= WMGetPopUpButtonSelectedItem(panel->optionP); int index= WMGetPopUpButtonSelectedItem(panel->optionP);
WMMenuItem *item= WMGetPopUpButtonMenuItem(panel->optionP, index); WMMenuItem *item= WMGetPopUpButtonMenuItem(panel->optionP, index);
char *ofont, *nfont; FcChar8 *ofont;
char *nfont;
ofont= (char*)WMGetMenuItemRepresentedObject(item);
ofont= (FcChar8*)WMGetMenuItemRepresentedObject(item);
nfont= getSelectedFont(panel, ofont); nfont= getSelectedFont(panel, ofont);
free(ofont); wfree(ofont);
WMSetMenuItemRepresentedObject(item, nfont); WMSetMenuItemRepresentedObject(item, nfont);
} }
updateSampleFont(panel); updateSampleFont(panel);
@@ -465,12 +466,13 @@ selected(WMWidget *w, void *data)
_Panel *panel= (_Panel*)data; _Panel *panel= (_Panel*)data;
int index= WMGetPopUpButtonSelectedItem(panel->optionP); int index= WMGetPopUpButtonSelectedItem(panel->optionP);
WMMenuItem *item= WMGetPopUpButtonMenuItem(panel->optionP, index); WMMenuItem *item= WMGetPopUpButtonMenuItem(panel->optionP, index);
char *ofont, *nfont; FcChar8 *ofont;
char *nfont;
ofont= (char*)WMGetMenuItemRepresentedObject(item);
ofont = (FcChar8*)WMGetMenuItemRepresentedObject(item);
nfont= getSelectedFont(panel, ofont); nfont= getSelectedFont(panel, ofont);
free(ofont); wfree(ofont);
WMSetMenuItemRepresentedObject(item, nfont); WMSetMenuItemRepresentedObject(item, nfont);
updateSampleFont(panel); updateSampleFont(panel);
@@ -490,10 +492,10 @@ selectedOption(WMWidget *w, void *data)
{ {
FcPattern *pat; FcPattern *pat;
pat= FcNameParse(font); pat= FcNameParse((FcChar8*)font);
if (pat) if (pat)
{ {
FcChar8 *name; char *name;
int weight, slant, width; int weight, slant, width;
double size; double size;
int distance, closest, found; int distance, closest, found;
@@ -501,7 +503,7 @@ selectedOption(WMWidget *w, void *data)
FcDefaultSubstitute(pat); FcDefaultSubstitute(pat);
if (FcPatternGetString(pat, FC_FAMILY, 0, &name) != FcResultMatch) if (FcPatternGetString(pat, FC_FAMILY, 0, (FcChar8**)&name) != FcResultMatch)
name= "sans serif"; name= "sans serif";
found= 0; found= 0;

View File

@@ -365,7 +365,8 @@ wUnshadeWindow(WWindow *wwin)
void void
wMaximizeWindow(WWindow *wwin, int directions) wMaximizeWindow(WWindow *wwin, int directions)
{ {
int new_width, new_height, new_x, new_y; int new_x, new_y;
unsigned int new_width, new_height;
int changed_h, changed_v, shrink_h, shrink_v; int changed_h, changed_v, shrink_h, shrink_v;
WArea usableArea, totalArea; WArea usableArea, totalArea;

View File

@@ -559,6 +559,10 @@ handleMapRequest(XEvent *ev)
wwin->flags.skip_next_animation = 1; wwin->flags.skip_next_animation = 1;
wIconifyWindow(wwin); wIconifyWindow(wwin);
} }
if (wwin->flags.fullscreen) {
wwin->flags.fullscreen = 0;
wFullscreenWindow(wwin);
}
if (wwin->flags.hidden) { if (wwin->flags.hidden) {
WApplication *wapp = wApplicationOf(wwin->main_window); WApplication *wapp = wApplicationOf(wwin->main_window);

View File

@@ -651,7 +651,7 @@ wIconUpdate(WIcon *icon)
if (icon->icon_win!=None) { if (icon->icon_win!=None) {
XWindowAttributes attr; XWindowAttributes attr;
int resize=0; int resize=0;
int width, height, depth; unsigned int width, height, depth;
int theight; int theight;
Pixmap pixmap; Pixmap pixmap;

View File

@@ -1128,7 +1128,7 @@ UnescapeWM_CLASS(char *str, char **name, char **class)
void void
SendHelperMessage(WScreen *scr, char type, int workspace, char *msg) SendHelperMessage(WScreen *scr, char type, int workspace, char *msg)
{ {
unsigned char *buffer; char *buffer;
int len; int len;
int i; int i;
char buf[16]; char buf[16];

View File

@@ -1471,7 +1471,7 @@ wKeyboardMoveResizeWindow(WWindow *wwin)
ww=w;wh=h; ww=w;wh=h;
wh-=vert_border; wh-=vert_border;
wWindowConstrainSize(wwin, &ww, &wh); wWindowConstrainSize(wwin, (unsigned int*)&ww, (unsigned int*)&wh);
wh+=vert_border; wh+=vert_border;
if (wPreferences.ws_cycle){ if (wPreferences.ws_cycle){
@@ -2070,7 +2070,7 @@ wMouseResizeWindow(WWindow *wwin, XEvent *ev)
rh += dh; rh += dh;
fw = rw; fw = rw;
fh = rh - vert_border; fh = rh - vert_border;
wWindowConstrainSize(wwin, &fw, &fh); wWindowConstrainSize(wwin, (unsigned int*)&fw, (unsigned int*)&fh);
fh += vert_border; fh += vert_border;
if (res & LEFT) if (res & LEFT)
fx = rx2 - fw + 1; fx = rx2 - fw + 1;

View File

@@ -234,8 +234,8 @@ PropSetIconTileHint(WScreen *scr, RImage *image)
if (image->format == RRGBAFormat) { if (image->format == RRGBAFormat) {
memcpy(&tmp[4], image->data, image->width*image->height*4); memcpy(&tmp[4], image->data, image->width*image->height*4);
} else { } else {
char *ptr = tmp+4; char *ptr = (char*)(tmp+4);
char *src = image->data; char *src = (char*)image->data;
for (y = 0; y < image->height; y++) { for (y = 0; y < image->height; y++) {
for (x = 0; x < image->width; x++) { for (x = 0; x < image->width; x++) {

View File

@@ -25,6 +25,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h>
#include <errno.h> #include <errno.h>
#include <signal.h> #include <signal.h>
#include <sys/wait.h> #include <sys/wait.h>

View File

@@ -2043,10 +2043,10 @@ wWindowUpdateName(WWindow *wwin, char *newTitle)
*---------------------------------------------------------------------- *----------------------------------------------------------------------
*/ */
void void
wWindowConstrainSize(WWindow *wwin, int *nwidth, int *nheight) wWindowConstrainSize(WWindow *wwin, unsigned int *nwidth, unsigned int *nheight)
{ {
int width = *nwidth; int width = (int)*nwidth;
int height = *nheight; int height = (int)*nheight;
int winc = 1; int winc = 1;
int hinc = 1; int hinc = 1;
int minW = 1, minH = 1; int minW = 1, minH = 1;
@@ -2143,8 +2143,8 @@ wWindowConstrainSize(WWindow *wwin, int *nwidth, int *nheight)
void void
wWindowCropSize(WWindow *wwin, int maxW, int maxH, wWindowCropSize(WWindow *wwin, unsigned int maxW, unsigned int maxH,
int *width, int *height) unsigned int *width, unsigned int *height)
{ {
int baseW = 0, baseH = 0; int baseW = 0, baseH = 0;
int winc = 1, hinc = 1; int winc = 1, hinc = 1;

View File

@@ -388,9 +388,9 @@ void wWindowFocus(WWindow *wwin, WWindow *owin);
void wWindowUnfocus(WWindow *wwin); void wWindowUnfocus(WWindow *wwin);
void wWindowUpdateName(WWindow *wwin, char *newTitle); void wWindowUpdateName(WWindow *wwin, char *newTitle);
void wWindowConstrainSize(WWindow *wwin, int *nwidth, int *nheight); void wWindowConstrainSize(WWindow *wwin, unsigned int *nwidth, unsigned int *nheight);
void wWindowCropSize(WWindow *wwin, int maxw, int maxh, void wWindowCropSize(WWindow *wwin, unsigned int maxw, unsigned int maxh,
int *nwidth, int *nheight); unsigned int *nwidth, unsigned int *nheight);
void wWindowConfigure(WWindow *wwin, int req_x, int req_y, void wWindowConfigure(WWindow *wwin, int req_x, int req_y,
int req_width, int req_height); int req_width, int req_height);

View File

@@ -15,11 +15,11 @@
#include <X11/Xproto.h> #include <X11/Xproto.h>
#include <WMaker.h> #include <WMaker.h>
static unsigned char bits[] = { static char bits[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
static unsigned char mbits[] = { static char mbits[] = {
0xff, 0x03, 0xff, 0x01, 0xff, 0x00, 0x7f, 0x00, 0x3f, 0x00, 0x1f, 0x00, 0xff, 0x03, 0xff, 0x01, 0xff, 0x00, 0x7f, 0x00, 0x3f, 0x00, 0x1f, 0x00,
0x0f, 0x00, 0x07, 0x00, 0x03, 0x00, 0x01, 0x00}; 0x0f, 0x00, 0x07, 0x00, 0x03, 0x00, 0x01, 0x00};

View File

@@ -787,7 +787,7 @@ void
freeTexture(BackgroundTexture *texture) freeTexture(BackgroundTexture *texture)
{ {
if (texture->solid) { if (texture->solid) {
long pixel[1]; unsigned long pixel[1];
pixel[0] = texture->color.pixel; pixel[0] = texture->color.pixel;
/* dont free black/white pixels */ /* dont free black/white pixels */
@@ -966,7 +966,7 @@ changeTexture(BackgroundTexture *texture)
int int
readmsg(int fd, unsigned char *buffer, int size) readmsg(int fd, char *buffer, int size)
{ {
int count; int count;
@@ -998,7 +998,7 @@ helperLoop(RContext *rc)
{ {
BackgroundTexture *textures[WORKSPACE_COUNT]; BackgroundTexture *textures[WORKSPACE_COUNT];
int maxTextures = 0; int maxTextures = 0;
unsigned char buffer[2048], buf[8]; char buffer[2048], buf[8];
int size; int size;
int errcount = 4; int errcount = 4;

View File

@@ -68,8 +68,9 @@ extern int x86_check_mmx();
extern void x86_mmx_TrueColor_32_to_16(unsigned char *image, extern void x86_mmx_TrueColor_32_to_16(unsigned char *image,
unsigned short *ximage, unsigned short *ximage,
short *err, short *nerr, short *err, short *nerr,
short *rtable, short *gtable, const unsigned short *rtable,
short *btable, const unsigned short *gtable,
const unsigned short *btable,
int dr, int dg, int db, int dr, int dg, int db,
unsigned int roffs, unsigned int roffs,
unsigned int goffs, unsigned int goffs,
@@ -175,9 +176,9 @@ computeStdTable(unsigned int mult, unsigned int max)
static void static void
convertTrueColor_generic(RXImage *ximg, RImage *image, convertTrueColor_generic(RXImage *ximg, RImage *image,
signed char *err, signed char *nerr, signed char *err, signed char *nerr,
const short *rtable, const unsigned short *rtable,
const short *gtable, const unsigned short *gtable,
const short *btable, const unsigned short *btable,
const int dr, const int dg, const int db, const int dr, const int dg, const int db,
const unsigned short roffs, const unsigned short roffs,
const unsigned short goffs, const unsigned short goffs,
@@ -408,8 +409,8 @@ image2TrueColor(RContext *ctx, RImage *image)
} else } else
#endif /* ASM_X86_MMX */ #endif /* ASM_X86_MMX */
{ {
char *err; signed char *err;
char *nerr; signed char *nerr;
int ch = (HAS_ALPHA(image) ? 4 : 3); int ch = (HAS_ALPHA(image) ? 4 : 3);
err = malloc(ch*(image->width+2)); err = malloc(ch*(image->width+2));
@@ -447,9 +448,9 @@ image2TrueColor(RContext *ctx, RImage *image)
static void static void
convertPseudoColor_to_8(RXImage *ximg, RImage *image, convertPseudoColor_to_8(RXImage *ximg, RImage *image,
signed char *err, signed char *nerr, signed char *err, signed char *nerr,
const short *rtable, const unsigned short *rtable,
const short *gtable, const unsigned short *gtable,
const short *btable, const unsigned short *btable,
const int dr, const int dg, const int db, const int dr, const int dg, const int db,
unsigned long *pixels, unsigned long *pixels,
int cpc) int cpc)
@@ -459,7 +460,7 @@ convertPseudoColor_to_8(RXImage *ximg, RImage *image,
int pixel; int pixel;
int rer, ger, ber; int rer, ger, ber;
unsigned char *ptr = image->data; unsigned char *ptr = image->data;
unsigned char *optr = ximg->image->data; unsigned char *optr = (unsigned char*)ximg->image->data;
int channels = (HAS_ALPHA(image) ? 4 : 3); int channels = (HAS_ALPHA(image) ? 4 : 3);
int cpcpc = cpc*cpc; int cpcpc = cpc*cpc;
@@ -573,8 +574,8 @@ image2PseudoColor(RContext *ctx, RImage *image)
} }
} else { } else {
/* dither */ /* dither */
char *err; signed char *err;
char *nerr; signed char *nerr;
const int dr=0xff/rmask; const int dr=0xff/rmask;
const int dg=0xff/gmask; const int dg=0xff/gmask;
const int db=0xff/bmask; const int db=0xff/bmask;

View File

@@ -242,7 +242,7 @@ renderDGradient(unsigned width, unsigned height, int r0, int g0, int b0,
RImage *image, *tmp; RImage *image, *tmp;
int j; int j;
float a, offset; float a, offset;
char *ptr; unsigned char *ptr;
if (width == 1) if (width == 1)
return renderVGradient(width, height, r0, g0, b0, rf, gf, bf); return renderVGradient(width, height, r0, g0, b0, rf, gf, bf);

View File

@@ -43,8 +43,9 @@ load_graymap(char *file_name, FILE *file, int w, int h, int max, int raw)
} else { } else {
if (max<256) { if (max<256) {
unsigned char *ptr;
char *buf;
int x, y; int x, y;
char *buf, *ptr;
buf = malloc(w+1); buf = malloc(w+1);
if (!buf) { if (!buf) {
@@ -83,7 +84,7 @@ load_pixmap(char *file_name, FILE *file, int w, int h, int max, int raw)
RImage *image; RImage *image;
int i; int i;
char buf[3]; char buf[3];
char *ptr; unsigned char *ptr;
image = RCreateImage(w, h, 0); image = RCreateImage(w, h, 0);
if (!image) { if (!image) {

View File

@@ -283,31 +283,37 @@ RCombineImagesWithOpaqueness(RImage *image, RImage *src, int opaqueness)
int int
calculateCombineArea(RImage *des, RImage *src, int *sx, int *sy, calculateCombineArea(RImage *des, RImage *src, int *sx, int *sy,
int *swidth, int *sheight, int *dx, int *dy) unsigned int *swidth, unsigned int *sheight, int *dx, int *dy)
{ {
int width = (int)*swidth, height = (int)*sheight;
if (*dx < 0) { if (*dx < 0) {
*sx = -*dx; *sx = -*dx;
*swidth = *swidth + *dx; width = width + *dx;
*dx = 0; *dx = 0;
} }
if (*dx + *swidth > des->width) { if (*dx + width > des->width) {
*swidth = des->width - *dx; width = des->width - *dx;
} }
if (*dy < 0) { if (*dy < 0) {
*sy = -*dy; *sy = -*dy;
*sheight = *sheight + *dy; height = height + *dy;
*dy = 0; *dy = 0;
} }
if (*dy + *sheight > des->height) { if (*dy + height > des->height) {
*sheight = des->height - *dy; height = des->height - *dy;
} }
if (*sheight > 0 && *swidth > 0) { if (height>0 && width>0) {
*swidth = width;
*sheight = height;
return True; return True;
} else return False; }
return False;
} }
void void

View File

@@ -85,9 +85,9 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image,
unsigned short *ximage, unsigned short *ximage,
short *err, short *err,
short *nerr, short *nerr,
short *rtable, unsigned short *rtable,
short *gtable, unsigned short *gtable,
short *btable, unsigned short *btable,
int dr, int dr,
int dg, int dg,
int db, int db,
@@ -100,12 +100,16 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image,
{ {
union { union {
long long rrggbbaa; long long rrggbbaa;
struct {short int rr, gg, bb, aa;} words; struct {
short int rr, gg, bb, aa;
} words;
} rrggbbaa; } rrggbbaa;
union { union {
long long pixel; long long pixel;
struct {short int rr, gg, bb, aa;} words; struct {
short int rr, gg, bb, aa;
} words;
} pixel; } pixel;
short *tmp_err; short *tmp_err;
@@ -317,11 +321,11 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image,
"m" (width), // %13 "m" (width), // %13
"m" (height), // %14 "m" (height), // %14
"m" (line_offset), // %15 "m" (line_offset), // %15
"m" (rrggbbaa.rrggbbaa), // %16 (access to rr) "m" (rrggbbaa.words.rr), // %16 (access to rr)
"m" (rrggbbaa.words.gg), // %17 (access to gg) "m" (rrggbbaa.words.gg), // %17 (access to gg)
"m" (rrggbbaa.words.bb), // %18 (access to bb) "m" (rrggbbaa.words.bb), // %18 (access to bb)
"m" (rrggbbaa.words.aa), // %19 (access to aa) "m" (rrggbbaa.words.aa), // %19 (access to aa)
"m" (pixel.pixel), // %20 (access to pixel.r) "m" (pixel.words.rr), // %20 (access to pixel.r)
"m" (pixel.words.gg), // %21 (access to pixel.g) "m" (pixel.words.gg), // %21 (access to pixel.g)
"m" (pixel.words.bb), // %22 (access to pixel.b) "m" (pixel.words.bb), // %22 (access to pixel.b)
"m" (pixel.words.aa), // %23 (access to pixel.a) "m" (pixel.words.aa), // %23 (access to pixel.a)
@@ -353,12 +357,16 @@ x86_mmx_TrueColor_24_to_16(unsigned char *image,
{ {
union { union {
long long rrggbbaa; long long rrggbbaa;
struct {short int rr, gg, bb, aa;} words; struct {
short int rr, gg, bb, aa;
} words;
} rrggbbaa; } rrggbbaa;
union { union {
long long pixel; long long pixel;
struct {short int rr, gg, bb, aa;} words; struct {
short int rr, gg, bb, aa;
} words;
} pixel; } pixel;
short *tmp_err; short *tmp_err;
@@ -459,11 +467,11 @@ x86_mmx_TrueColor_24_to_16(unsigned char *image,
"m" (width), // %13 "m" (width), // %13
"m" (height), // %14 "m" (height), // %14
"m" (line_offset), // %15 "m" (line_offset), // %15
"m" (rrggbbaa.rrggbbaa), // %16 (access to rr) "m" (rrggbbaa.words.rr), // %16 (access to rr)
"m" (rrggbbaa.words.gg), // %17 (access to gg) "m" (rrggbbaa.words.gg), // %17 (access to gg)
"m" (rrggbbaa.words.bb), // %18 (access to bb) "m" (rrggbbaa.words.bb), // %18 (access to bb)
"m" (rrggbbaa.words.aa), // %19 (access to aa) "m" (rrggbbaa.words.aa), // %19 (access to aa)
"m" (pixel.pixel), // %20 (access to pixel.r) "m" (pixel.words.rr), // %20 (access to pixel.r)
"m" (pixel.words.gg), // %21 (access to pixel.g) "m" (pixel.words.gg), // %21 (access to pixel.g)
"m" (pixel.words.bb), // %22 (access to pixel.b) "m" (pixel.words.bb), // %22 (access to pixel.b)
"m" (pixel.words.aa), // %23 (access to pixel.a) "m" (pixel.words.aa), // %23 (access to pixel.a)