summaryrefslogtreecommitdiffstats
path: root/corre.c
diff options
context:
space:
mode:
Diffstat (limited to 'corre.c')
-rw-r--r--corre.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/corre.c b/corre.c
index d866712..06934b1 100644
--- a/corre.c
+++ b/corre.c
@@ -27,8 +27,6 @@
* USA.
*/
-#include <stdio.h>
-#include <stdlib.h>
#include "rfb.h"
/*
@@ -45,10 +43,10 @@ static int rreAfterBufSize = 0;
static char *rreAfterBuf = NULL;
static int rreAfterBufLen;
-static int subrectEncode8(CARD8 *data, int w, int h);
-static int subrectEncode16(CARD16 *data, int w, int h);
-static int subrectEncode32(CARD32 *data, int w, int h);
-static CARD32 getBgColour(char *data, int size, int bpp);
+static int subrectEncode8(uint8_t *data, int w, int h);
+static int subrectEncode16(uint16_t *data, int w, int h);
+static int subrectEncode32(uint32_t *data, int w, int h);
+static uint32_t getBgColour(char *data, int size, int bpp);
static Bool rfbSendSmallRectEncodingCoRRE(rfbClientPtr cl, int x, int y,
int w, int h);
@@ -123,13 +121,13 @@ rfbSendSmallRectEncodingCoRRE(cl, x, y, w, h)
switch (cl->format.bitsPerPixel) {
case 8:
- nSubrects = subrectEncode8((CARD8 *)rreBeforeBuf, w, h);
+ nSubrects = subrectEncode8((uint8_t *)rreBeforeBuf, w, h);
break;
case 16:
- nSubrects = subrectEncode16((CARD16 *)rreBeforeBuf, w, h);
+ nSubrects = subrectEncode16((uint16_t *)rreBeforeBuf, w, h);
break;
case 32:
- nSubrects = subrectEncode32((CARD32 *)rreBeforeBuf, w, h);
+ nSubrects = subrectEncode32((uint32_t *)rreBeforeBuf, w, h);
break;
default:
rfbLog("getBgColour: bpp %d?\n",cl->format.bitsPerPixel);
@@ -209,25 +207,25 @@ rfbSendSmallRectEncodingCoRRE(cl, x, y, w, h)
#define DEFINE_SUBRECT_ENCODE(bpp) \
static int \
subrectEncode##bpp(data,w,h) \
- CARD##bpp *data; \
+ uint##bpp##_t *data; \
int w; \
int h; \
{ \
- CARD##bpp cl; \
+ uint##bpp##_t cl; \
rfbCoRRERectangle subrect; \
int x,y; \
int i,j; \
int hx=0,hy,vx=0,vy; \
int hyflag; \
- CARD##bpp *seg; \
- CARD##bpp *line; \
+ uint##bpp##_t *seg; \
+ uint##bpp##_t *line; \
int hw,hh,vw,vh; \
int thex,they,thew,theh; \
int numsubs = 0; \
int newLen; \
- CARD##bpp bg = (CARD##bpp)getBgColour((char*)data,w*h,bpp); \
+ uint##bpp##_t bg = (uint##bpp##_t)getBgColour((char*)data,w*h,bpp); \
\
- *((CARD##bpp*)rreAfterBuf) = bg; \
+ *((uint##bpp##_t*)rreAfterBuf) = bg; \
\
rreAfterBufLen = (bpp/8); \
\
@@ -279,7 +277,7 @@ subrectEncode##bpp(data,w,h) \
return -1; \
\
numsubs += 1; \
- *((CARD##bpp*)(rreAfterBuf + rreAfterBufLen)) = cl; \
+ *((uint##bpp##_t*)(rreAfterBuf + rreAfterBufLen)) = cl; \
rreAfterBufLen += (bpp/8); \
memcpy(&rreAfterBuf[rreAfterBufLen],&subrect,sz_rfbCoRRERectangle); \
rreAfterBufLen += sz_rfbCoRRERectangle; \
@@ -307,7 +305,7 @@ DEFINE_SUBRECT_ENCODE(32)
/*
* getBgColour() gets the most prevalent colour in a byte array.
*/
-static CARD32
+static uint32_t
getBgColour(data,size,bpp)
char *data;
int size;
@@ -320,13 +318,13 @@ getBgColour(data,size,bpp)
int i,j,k;
int maxcount = 0;
- CARD8 maxclr = 0;
+ uint8_t maxclr = 0;
if (bpp != 8) {
if (bpp == 16) {
- return ((CARD16 *)data)[0];
+ return ((uint16_t *)data)[0];
} else if (bpp == 32) {
- return ((CARD32 *)data)[0];
+ return ((uint32_t *)data)[0];
} else {
rfbLog("getBgColour: bpp %d?\n",bpp);
exit(1);
@@ -338,7 +336,7 @@ getBgColour(data,size,bpp)
}
for (j=0; j<size; j++) {
- k = (int)(((CARD8 *)data)[j]);
+ k = (int)(((uint8_t *)data)[j]);
if (k >= NUMCLRS) {
rfbLog("getBgColour: unusual colour = %d\n", k);
exit(1);
@@ -346,7 +344,7 @@ getBgColour(data,size,bpp)
counts[k] += 1;
if (counts[k] > maxcount) {
maxcount = counts[k];
- maxclr = ((CARD8 *)data)[j];
+ maxclr = ((uint8_t *)data)[j];
}
}