1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 04:20:27 +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 gcc-4 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:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -27,7 +27,7 @@ xlfdToFcPattern(char *xlfd)
/* Just skip old font names that contain %d in them.
* We don't support that anymore. */
if (strchr(xlfd, '%')!=NULL)
return FcNameParse(DEFAULT_FONT);
return FcNameParse((FcChar8*)DEFAULT_FONT);
fname= wstrdup(xlfd);
if ((ptr = strchr(fname, ','))) {
@@ -38,7 +38,7 @@ xlfdToFcPattern(char *xlfd)
if (!pattern) {
wwarning(_("invalid font: %s. Trying '%s'"), xlfd, DEFAULT_FONT);
pattern = FcNameParse(DEFAULT_FONT);
pattern = FcNameParse((FcChar8*)DEFAULT_FONT);
}
return pattern;
@@ -52,7 +52,7 @@ xlfdToFcName(char *xlfd)
char *fname;
pattern = xlfdToFcPattern(xlfd);
fname = FcNameUnparse(pattern);
fname = (char*)FcNameUnparse(pattern);
FcPatternDestroy(pattern);
return fname;
@@ -102,7 +102,7 @@ makeFontOfSize(char *font, int size, char *fallback)
if (font[0]=='-') {
pattern = xlfdToFcPattern(font);
} else {
pattern = FcNameParse(font);
pattern = FcNameParse((FcChar8*)font);
}
/*FcPatternPrint(pattern);*/
@@ -116,12 +116,12 @@ makeFontOfSize(char *font, int size, char *fallback)
}
if (fallback && !hasPropertyWithStringValue(pattern, FC_FAMILY, fallback)) {
FcPatternAddString(pattern, FC_FAMILY, fallback);
FcPatternAddString(pattern, FC_FAMILY, (FcChar8*)fallback);
}
/*FcPatternPrint(pattern);*/
result = FcNameUnparse(pattern);
result = (char*)FcNameUnparse(pattern);
FcPatternDestroy(pattern);
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
* oblique font. Same goes for using bold for weight.
*/
pattern = FcNameParse(WMGetFontName(font));
pattern = FcNameParse((FcChar8*)WMGetFontName(font));
switch (style) {
case WFSNormal:
FcPatternDel(pattern, FC_WEIGHT);
@@ -374,21 +374,21 @@ WMCopyFontWithStyle(WMScreen *scrPtr, WMFont *font, WMFontStyle style)
break;
case WFSBold:
FcPatternDel(pattern, FC_WEIGHT);
FcPatternAddString(pattern, FC_WEIGHT, "bold");
FcPatternAddString(pattern, FC_WEIGHT, (FcChar8*)"bold");
break;
case WFSItalic:
FcPatternDel(pattern, FC_SLANT);
FcPatternAddString(pattern, FC_SLANT, "italic");
FcPatternAddString(pattern, FC_SLANT, (FcChar8*)"italic");
break;
case WFSBoldItalic:
FcPatternDel(pattern, FC_WEIGHT);
FcPatternDel(pattern, FC_SLANT);
FcPatternAddString(pattern, FC_WEIGHT, "bold");
FcPatternAddString(pattern, FC_SLANT, "italic");
FcPatternAddString(pattern, FC_WEIGHT, (FcChar8*)"bold");
FcPatternAddString(pattern, FC_SLANT, (FcChar8*)"italic");
break;
}
name = FcNameUnparse(pattern);
name = (char*)FcNameUnparse(pattern);
copy = WMCreateFont(scrPtr, name);
FcPatternDestroy(pattern);
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);
@@ -370,7 +370,7 @@ WMSetFontPanelFont(WMFontPanel *panel, char *fontName)
if (!isXLFD(fontName, &fname_len)) {
/* maybe its proper fontconfig and we can parse it */
pattern = FcNameParse(fontName);
pattern = FcNameParse((FcChar8*)fontName);
} else {
/* maybe its proper xlfd and we can convert it to an FcPattern */
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_STYLE, 0, &style)==FcResultMatch)
if (FcPatternGetDouble(pattern, "pixelsize", 0, &size)==FcResultMatch)
setFontPanelFontName(panel, family, style, size);
setFontPanelFontName(panel, (char*)family, (char*)style, size);
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_STYLE,0,&style)==FcResultMatch)
addFontToXftFamily(families, family, style);
addFontToXftFamily(families, (char*)family, (char*)style);
}
FcFontSetDestroy(fs);
}
@@ -815,7 +815,7 @@ sizeClick(WMWidget *w, void *data)
static void
setFontPanelFontName(FontPanel *panel, FcChar8 *family, FcChar8 *style, double size)
setFontPanelFontName(FontPanel *panel, char *family, char *style, double size)
{
int famrow;
int stlrow;

View File

@@ -305,7 +305,7 @@ static char *CHECK_MARK[] = {
#define STIPPLE_WIDTH 8
#define STIPPLE_HEIGHT 8
static unsigned char STIPPLE_BITS[] = {
static char STIPPLE_BITS[] = {
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_HEIGHT 8
static unsigned char STIPPLE_BITS[] = {
static char STIPPLE_BITS[] = {
0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa
};

View File

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

View File

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

View File

@@ -365,7 +365,8 @@ wUnshadeWindow(WWindow *wwin)
void
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;
WArea usableArea, totalArea;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -787,7 +787,7 @@ void
freeTexture(BackgroundTexture *texture)
{
if (texture->solid) {
long pixel[1];
unsigned long pixel[1];
pixel[0] = texture->color.pixel;
/* dont free black/white pixels */
@@ -966,7 +966,7 @@ changeTexture(BackgroundTexture *texture)
int
readmsg(int fd, unsigned char *buffer, int size)
readmsg(int fd, char *buffer, int size)
{
int count;
@@ -998,7 +998,7 @@ helperLoop(RContext *rc)
{
BackgroundTexture *textures[WORKSPACE_COUNT];
int maxTextures = 0;
unsigned char buffer[2048], buf[8];
char buffer[2048], buf[8];
int size;
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,
unsigned short *ximage,
short *err, short *nerr,
short *rtable, short *gtable,
short *btable,
const unsigned short *rtable,
const unsigned short *gtable,
const unsigned short *btable,
int dr, int dg, int db,
unsigned int roffs,
unsigned int goffs,
@@ -175,9 +176,9 @@ computeStdTable(unsigned int mult, unsigned int max)
static void
convertTrueColor_generic(RXImage *ximg, RImage *image,
signed char *err, signed char *nerr,
const short *rtable,
const short *gtable,
const short *btable,
const unsigned short *rtable,
const unsigned short *gtable,
const unsigned short *btable,
const int dr, const int dg, const int db,
const unsigned short roffs,
const unsigned short goffs,
@@ -408,8 +409,8 @@ image2TrueColor(RContext *ctx, RImage *image)
} else
#endif /* ASM_X86_MMX */
{
char *err;
char *nerr;
signed char *err;
signed char *nerr;
int ch = (HAS_ALPHA(image) ? 4 : 3);
err = malloc(ch*(image->width+2));
@@ -447,9 +448,9 @@ image2TrueColor(RContext *ctx, RImage *image)
static void
convertPseudoColor_to_8(RXImage *ximg, RImage *image,
signed char *err, signed char *nerr,
const short *rtable,
const short *gtable,
const short *btable,
const unsigned short *rtable,
const unsigned short *gtable,
const unsigned short *btable,
const int dr, const int dg, const int db,
unsigned long *pixels,
int cpc)
@@ -459,7 +460,7 @@ convertPseudoColor_to_8(RXImage *ximg, RImage *image,
int pixel;
int rer, ger, ber;
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 cpcpc = cpc*cpc;
@@ -573,8 +574,8 @@ image2PseudoColor(RContext *ctx, RImage *image)
}
} else {
/* dither */
char *err;
char *nerr;
signed char *err;
signed char *nerr;
const int dr=0xff/rmask;
const int dg=0xff/gmask;
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;
int j;
float a, offset;
char *ptr;
unsigned char *ptr;
if (width == 1)
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 {
if (max<256) {
unsigned char *ptr;
char *buf;
int x, y;
char *buf, *ptr;
buf = malloc(w+1);
if (!buf) {
@@ -83,7 +84,7 @@ load_pixmap(char *file_name, FILE *file, int w, int h, int max, int raw)
RImage *image;
int i;
char buf[3];
char *ptr;
unsigned char *ptr;
image = RCreateImage(w, h, 0);
if (!image) {

View File

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

View File

@@ -85,9 +85,9 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image,
unsigned short *ximage,
short *err,
short *nerr,
short *rtable,
short *gtable,
short *btable,
unsigned short *rtable,
unsigned short *gtable,
unsigned short *btable,
int dr,
int dg,
int db,
@@ -99,13 +99,17 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image,
int line_offset)
{
union {
long long rrggbbaa;
struct {short int rr, gg, bb, aa;} words;
long long rrggbbaa;
struct {
short int rr, gg, bb, aa;
} words;
} rrggbbaa;
union {
long long pixel;
struct {short int rr, gg, bb, aa;} words;
long long pixel;
struct {
short int rr, gg, bb, aa;
} words;
} pixel;
short *tmp_err;
@@ -114,7 +118,7 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image,
asm volatile
(
"pushl %%ebx \n\t"
"pushl %%ebx \n\t"
// pack dr, dg and db into mm6
"movl %7, %%eax \n\t"
@@ -227,7 +231,7 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image,
"movq %%mm0, %%mm1 \n\t"
"pmullw %%mm5, %%mm1 \n\t" // mm1 = mm1*7
"psrlw %%mm7, %%mm1 \n\t" // mm1 = mm1/16
"paddw 8(%%ebx), %%mm1 \n\t"
"paddw 8(%%ebx), %%mm1 \n\t"
"movq %%mm1, 8(%%ebx) \n\t" // err[x+1,y] = rer*7/16
@@ -236,7 +240,7 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image,
"movq %%mm0, %%mm1 \n\t"
"pmullw %%mm4, %%mm1 \n\t" // mm1 = mm1*5
"psrlw %%mm7, %%mm1 \n\t" // mm1 = mm1/16
"paddw -8(%%ebx), %%mm1 \n\t"
"paddw -8(%%ebx), %%mm1 \n\t"
"movq %%mm1, -8(%%ebx) \n\t" // err[x-1,y+1] += rer*3/16
"movq %%mm0, %%mm1 \n\t"
@@ -282,7 +286,7 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image,
// because, punpcklbw is used (which reads 8 bytes) and the last
// pixel is only 4 bytes. This is no problem because the image data
// was allocated with extra 4 bytes when created.
"addl $4, %%esi \n\t" // image->data += 4
"addl $4, %%esi \n\t" // image->data += 4
"decl %26 \n\t" // x--
@@ -298,7 +302,7 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image,
".Enda: \n\t" // THE END
"emms \n\t"
"popl %%ebx \n\t"
"popl %%ebx \n\t"
:
:
"m" (image), // %0
@@ -317,18 +321,18 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image,
"m" (width), // %13
"m" (height), // %14
"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.bb), // %18 (access to bb)
"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.bb), // %22 (access to pixel.b)
"m" (pixel.words.aa), // %23 (access to pixel.a)
"m" (tmp_err), // %24
"m" (tmp_nerr), // %25
"m" (x) // %26
: "eax", "ecx", "edx", "esi", "edi"
: "eax", "ecx", "edx", "esi", "edi"
);
}
@@ -352,13 +356,17 @@ x86_mmx_TrueColor_24_to_16(unsigned char *image,
int line_offset)
{
union {
long long rrggbbaa;
struct {short int rr, gg, bb, aa;} words;
long long rrggbbaa;
struct {
short int rr, gg, bb, aa;
} words;
} rrggbbaa;
union {
long long pixel;
struct {short int rr, gg, bb, aa;} words;
long long pixel;
struct {
short int rr, gg, bb, aa;
} words;
} pixel;
short *tmp_err;
@@ -370,7 +378,7 @@ x86_mmx_TrueColor_24_to_16(unsigned char *image,
asm volatile
(
"pushl %%ebx \n\t"
"pushl %%ebx \n\t"
"movl %13, %%eax \n\t" // eax = width
"movl %%eax, %%ebx \n\t"
@@ -440,7 +448,7 @@ x86_mmx_TrueColor_24_to_16(unsigned char *image,
".Endc: \n\t" // THE END
"emms \n\t"
"popl %%ebx \n\t"
"popl %%ebx \n\t"
:
:
"m" (image), // %0
@@ -459,11 +467,11 @@ x86_mmx_TrueColor_24_to_16(unsigned char *image,
"m" (width), // %13
"m" (height), // %14
"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.bb), // %18 (access to bb)
"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.bb), // %22 (access to pixel.b)
"m" (pixel.words.aa), // %23 (access to pixel.a)
@@ -472,7 +480,7 @@ x86_mmx_TrueColor_24_to_16(unsigned char *image,
"m" (x), // %26
"m" (w1), // %27
"m" (w2) // %28
: "eax", "ecx", "edx", "esi", "edi"
: "eax", "ecx", "edx", "esi", "edi"
);
}
@@ -670,7 +678,7 @@ x86_PseudoColor_32_to_8(unsigned char *image,
"movw $0xff, %%dx \n\t" // pixel.blu > 255
"jmp .OKBb \n"
".NEGBb: \n\t"
"xorw %%dx, %%dx \n"
"xorw %%dx, %%dx \n"
".OKBb: \n\t"
//partial reg
"leal (%%edi, %%edx, 2), %%ecx \n\t" // ecx = &ctable[pixel.blu]