Commit 5030d53f authored by dscho's avatar dscho

converted CARD{8,16,32} to uint{8,16,32}_t and included support for stdint.h

parent f86f9cec
......@@ -3,7 +3,7 @@ DIST_SUBDIRS=examples contrib
bin_SCRIPTS = libvncserver-config
include_HEADERS=include/rfb.h include/rfbconfig.h include/rfbproto.h \
include_HEADERS=include/rfb.h include/rfbconfig.h include/rfbint.h include/rfbproto.h \
include/keysym.h
noinst_HEADERS=sraRegion.h d3des.h zrleDecode.h zrleEncode.h \
......
immediate:
----------
autoconf also CARD8,CARD16,...
x11vnc: clipboard, cursor
extra_bytes in rfbDrawCharWithClip.
tested mouse buttons make copy rect, but text is not marked as mod.
......@@ -25,6 +24,7 @@ CORBA
done:
-----
.autoconf also CARD8,CARD16,...
.autoconf
.internal HTTP tunnelling feature (needs a special GET target and a few
. changes to java applet).
......
This diff is collapsed.
......@@ -26,8 +26,6 @@
* USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include "rfb.h"
/*
......@@ -46,12 +44,12 @@ rfbAuthNewClient(cl)
cl->state = RFB_AUTHENTICATION;
if (cl->screen->rfbAuthPasswdData && !cl->reverseConnection) {
*(CARD32 *)buf = Swap32IfLE(rfbVncAuth);
*(uint32_t *)buf = Swap32IfLE(rfbVncAuth);
vncRandomBytes(cl->authChallenge);
memcpy(&buf[4], (char *)cl->authChallenge, CHALLENGESIZE);
len = 4 + CHALLENGESIZE;
} else {
*(CARD32 *)buf = Swap32IfLE(rfbNoAuth);
*(uint32_t *)buf = Swap32IfLE(rfbNoAuth);
len = 4;
cl->state = RFB_INITIALISATION;
}
......@@ -74,8 +72,8 @@ rfbAuthProcessClientMessage(cl)
rfbClientPtr cl;
{
int n;
CARD8 response[CHALLENGESIZE];
CARD32 authResult;
uint8_t response[CHALLENGESIZE];
uint32_t authResult;
if ((n = ReadExact(cl, (char *)response, CHALLENGESIZE)) <= 0) {
if (n != 0)
......
......@@ -71,6 +71,8 @@ AC_C_INLINE
AC_C_BIGENDIAN
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_TYPE_SOCKLEN_T
AC_CREATE_STDINT_H(include/rfbint.h)
# Checks for library functions.
AC_FUNC_MALLOC
......
......@@ -461,7 +461,7 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
screen->paddedWidthInBytes = fb->bytes_per_line;
screen->rfbServerFormat.bitsPerPixel = fb->bits_per_pixel;
screen->rfbServerFormat.depth = fb->depth;
screen->rfbServerFormat.trueColour = (CARD8) TRUE;
screen->rfbServerFormat.trueColour = (uint8_t) TRUE;
if ( screen->rfbServerFormat.bitsPerPixel == 8 ) {
/* 8 bpp */
......
......@@ -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];
}
}
......
......@@ -40,8 +40,8 @@ rfbSendCursorShape(cl)
int saved_ublen;
int bitmapRowBytes, maskBytes, dataBytes;
int i, j;
CARD8 *bitmapData;
CARD8 bitmapByte;
uint8_t *bitmapData;
uint8_t bitmapByte;
pCursor = cl->screen->getCursorPtr(cl);
/*if(!pCursor) return TRUE;*/
......@@ -131,7 +131,7 @@ rfbSendCursorShape(cl)
memcpy(&cl->updateBuf[cl->ublen], (char *)&colors, sz_rfbXCursorColors);
cl->ublen += sz_rfbXCursorColors;
bitmapData = (CARD8 *)pCursor->source;
bitmapData = (uint8_t *)pCursor->source;
for (i = 0; i < pCursor->height; i++) {
for (j = 0; j < bitmapRowBytes; j++) {
......@@ -154,7 +154,7 @@ rfbSendCursorShape(cl)
/* Prepare transparency mask. */
bitmapData = (CARD8 *)pCursor->mask;
bitmapData = (uint8_t *)pCursor->mask;
for (i = 0; i < pCursor->height; i++) {
for (j = 0; j < bitmapRowBytes; j++) {
......@@ -322,7 +322,7 @@ void MakeXCursorFromRichCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor)
rfbPixelFormat* format=&rfbScreen->rfbServerFormat;
int i,j,w=(cursor->width+7)/8,bpp=format->bitsPerPixel/8,
width=cursor->width*bpp;
CARD32 background;
uint32_t background;
char *back=(char*)&background;
unsigned char bit;
......@@ -344,7 +344,7 @@ void MakeRichCursorFromXCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor)
{
rfbPixelFormat* format=&rfbScreen->rfbServerFormat;
int i,j,w=(cursor->width+7)/8,bpp=format->bitsPerPixel/8;
CARD32 background,foreground;
uint32_t background,foreground;
char *back=(char*)&background,*fore=(char*)&foreground;
unsigned char *cp;
unsigned char bit;
......
......@@ -23,7 +23,6 @@
* USA.
*/
#include <stdio.h>
#include "rfb.h"
......
......@@ -25,7 +25,6 @@
* USA.
*/
#include <stdio.h>
#include "rfb.h"
static Bool sendHextiles8(rfbClientPtr cl, int x, int y, int w, int h);
......@@ -90,10 +89,10 @@ rfbSendRectEncodingHextile(cl, x, y, w, h)
#define DEFINE_SEND_HEXTILES(bpp) \
\
\
static Bool subrectEncode##bpp(rfbClientPtr cli, CARD##bpp *data, int w, int h, \
CARD##bpp bg, CARD##bpp fg, Bool mono); \
static void testColours##bpp(CARD##bpp *data, int size, Bool *mono, \
Bool *solid, CARD##bpp *bg, CARD##bpp *fg); \
static Bool subrectEncode##bpp(rfbClientPtr cli, uint##bpp##_t *data, int w, int h, \
uint##bpp##_t bg, uint##bpp##_t fg, Bool mono); \
static void testColours##bpp(uint##bpp##_t *data, int size, Bool *mono, \
Bool *solid, uint##bpp##_t *bg, uint##bpp##_t *fg); \
\
\
/* \
......@@ -108,11 +107,11 @@ sendHextiles##bpp(cl, rx, ry, rw, rh)
int x, y, w, h; \
int startUblen; \
char *fbptr; \
CARD##bpp bg = 0, fg = 0, newBg, newFg; \
uint##bpp##_t bg = 0, fg = 0, newBg, newFg; \
Bool mono, solid; \
Bool validBg = FALSE; \
Bool validFg = FALSE; \
CARD##bpp clientPixelData[16*16*(bpp/8)]; \
uint##bpp##_t clientPixelData[16*16*(bpp/8)]; \
\
for (y = ry; y < ry+rh; y += 16) { \
for (x = rx; x < rx+rw; x += 16) { \
......@@ -194,16 +193,16 @@ sendHextiles##bpp(cl, rx, ry, rw, rh)
\
\
static Bool \
subrectEncode##bpp(rfbClientPtr cl, CARD##bpp *data, int w, int h, \
CARD##bpp bg, CARD##bpp fg, Bool mono) \
subrectEncode##bpp(rfbClientPtr cl, uint##bpp##_t *data, int w, int h, \
uint##bpp##_t bg, uint##bpp##_t fg, Bool mono) \
{ \
CARD##bpp cl2; \
uint##bpp##_t cl2; \
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; \
......@@ -297,14 +296,14 @@ subrectEncode##bpp(rfbClientPtr cl, CARD##bpp *data, int w, int h,
\
static void \
testColours##bpp(data,size,mono,solid,bg,fg) \
CARD##bpp *data; \
uint##bpp##_t *data; \
int size; \
Bool *mono; \
Bool *solid; \
CARD##bpp *bg; \
CARD##bpp *fg; \
uint##bpp##_t *bg; \
uint##bpp##_t *fg; \
{ \
CARD##bpp colour1 = 0, colour2 = 0; \
uint##bpp##_t colour1 = 0, colour2 = 0; \
int n1 = 0, n2 = 0; \
*mono = TRUE; \
*solid = TRUE; \
......
......@@ -22,32 +22,43 @@
* USA.
*/
#include <stdio.h>
#include "rfb.h"
#include <ctype.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <errno.h>
#ifdef WIN32
#include <winsock.h>
#define close closesocket
#else
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netdb.h>
#include <pwd.h>
#include <arpa/inet.h>
#include <unistd.h>
#endif
#include <fcntl.h>
#include <errno.h>
#include <pwd.h>
#endif
#ifdef USE_LIBWRAP
#include <tcpd.h>
#endif
#include "rfb.h"
#define NOT_FOUND_STR "HTTP/1.0 404 Not found\r\n\r\n" \
"<HEAD><TITLE>File Not Found</TITLE></HEAD>\n" \
"<BODY><H1>File Not Found</H1></BODY>\n"
......
rfbconfig.h
rfbconfig.h.in
stamp-h1
stamp-h*
rfbint.h
......@@ -36,52 +36,47 @@ extern "C"
#include <stdlib.h>
#include <string.h>
#include "rfbconfig.h"
#include "rfbint.h"
#include "keysym.h"
#ifdef HAVE_LIBZ
#include <zlib.h>
#endif
/* TODO: this stuff has to go into autoconf */
typedef unsigned char CARD8;
typedef unsigned short CARD16;
typedef unsigned int CARD32;
typedef CARD32 Pixel;
/* typedef CARD32 KeySym; */
typedef unsigned long KeySym;
#define SIGNED signed
typedef signed char Bool;
#undef FALSE
#define FALSE 0
#undef TRUE
#define TRUE -1
#include "rfbproto.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if defined(WIN32)
#define WORDS_BIGENDIAN
#undef Bool
#define Bool int
#endif
#ifdef __sgi__
typedef int socklen_t;
#endif
#ifdef WIN32
#include <sys/timeb.h>
#include <winsock.h>
#undef SOCKET
#define SOCKET int
#else
#define max(a,b) (((a)>(b))?(a):(b))
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#define SOCKET int
#ifndef Bool
typedef int8_t Bool;
#undef FALSE
#define FALSE 0
#undef TRUE
#define TRUE -1
#endif
#endif
typedef uint32_t KeySym;
typedef uint32_t Pixel;
#ifndef INADDR_NONE
#define INADDR_NONE ((in_addr_t) 0xffffffff)
......@@ -171,11 +166,11 @@ typedef enum rfbNewClientAction (*NewClientHookPtr)(struct _rfbClientRec* cl);
typedef void (*DisplayHookPtr)(struct _rfbClientRec* cl);
typedef struct {
CARD32 count;
uint32_t count;
Bool is16; /* is the data format short? */
union {
CARD8* bytes;
CARD16* shorts;
uint8_t* bytes;
uint16_t* shorts;
} data; /* there have to be count*3 entries */
} rfbColourMap;
......@@ -390,7 +385,7 @@ typedef struct _rfbClientRec {
int correMaxWidth, correMaxHeight;
/* The following member is only used during VNC authentication */
CARD8 authChallenge[CHALLENGESIZE];
uint8_t authChallenge[CHALLENGESIZE];
/* The following members represent the update needed to get the client's
framebuffer from its present state to the current state of our
......@@ -473,7 +468,7 @@ typedef struct _rfbClientRec {
struct z_stream_s compStream;
Bool compStreamInited;
CARD32 zlibCompressLevel;
uint32_t zlibCompressLevel;
#ifdef HAVE_LIBJPEG
/* tight encoding -- preserve zlib streams' state for each client */
......
......@@ -60,10 +60,10 @@
*/
typedef struct {
CARD16 x;
CARD16 y;
CARD16 w;
CARD16 h;
uint16_t x;
uint16_t y;
uint16_t w;
uint16_t h;
} rfbRectangle;
#define sz_rfbRectangle 8
......@@ -75,32 +75,32 @@ typedef struct {
typedef struct {
CARD8 bitsPerPixel; /* 8,16,32 only */
uint8_t bitsPerPixel; /* 8,16,32 only */
CARD8 depth; /* 8 to 32 */
uint8_t depth; /* 8 to 32 */
CARD8 bigEndian; /* True if multi-byte pixels are interpreted
uint8_t bigEndian; /* True if multi-byte pixels are interpreted
as big endian, or if single-bit-per-pixel
has most significant bit of the byte
corresponding to first (leftmost) pixel. Of
course this is meaningless for 8 bits/pix */
CARD8 trueColour; /* If false then we need a "colour map" to
uint8_t trueColour; /* If false then we need a "colour map" to
convert pixels to RGB. If true, xxxMax and
xxxShift specify bits used for red, green
and blue */
/* the following fields are only meaningful if trueColour is true */
CARD16 redMax; /* maximum red value (= 2^n - 1 where n is the
uint16_t redMax; /* maximum red value (= 2^n - 1 where n is the
number of bits used for red). Note this
value is always in big endian order. */
CARD16 greenMax; /* similar for green */
uint16_t greenMax; /* similar for green */
CARD16 blueMax; /* and blue */
uint16_t blueMax; /* and blue */
CARD8 redShift; /* number of shifts needed to get the red
uint8_t redShift; /* number of shifts needed to get the red
value in a pixel to the least significant
bit. To find the red value from a given
pixel, do the following:
......@@ -112,12 +112,12 @@ typedef struct {
4) You now have the red value between 0 and
redMax. */
CARD8 greenShift; /* similar for green */
uint8_t greenShift; /* similar for green */
CARD8 blueShift; /* and blue */
uint8_t blueShift; /* and blue */
CARD8 pad1;
CARD16 pad2;
uint8_t pad1;
uint16_t pad2;
} rfbPixelFormat;
......@@ -216,7 +216,7 @@ typedef char rfbProtocolVersionMsg[13]; /* allow extra byte for null */
*/
typedef struct {
CARD8 shared;
uint8_t shared;
} rfbClientInitMsg;
#define sz_rfbClientInitMsg 1
......@@ -231,10 +231,10 @@ typedef struct {
*/
typedef struct {
CARD16 framebufferWidth;
CARD16 framebufferHeight;
uint16_t framebufferWidth;
uint16_t framebufferHeight;
rfbPixelFormat format; /* the server's preferred pixel format */
CARD32 nameLength;
uint32_t nameLength;
/* followed by char name[nameLength] */
} rfbServerInitMsg;
......@@ -363,9 +363,9 @@ typedef struct {
*/
typedef struct {
CARD8 type; /* always rfbFramebufferUpdate */
CARD8 pad;
CARD16 nRects;
uint8_t type; /* always rfbFramebufferUpdate */
uint8_t pad;
uint16_t nRects;
/* followed by nRects rectangles */
} rfbFramebufferUpdateMsg;
......@@ -381,7 +381,7 @@ typedef struct {
typedef struct {
rfbRectangle r;
CARD32 encoding; /* one of the encoding types rfbEncoding... */
uint32_t encoding; /* one of the encoding types rfbEncoding... */
} rfbFramebufferUpdateRectHeader;
#define sz_rfbFramebufferUpdateRectHeader (sz_rfbRectangle + 4)
......@@ -399,8 +399,8 @@ typedef struct {
*/
typedef struct {
CARD16 srcX;
CARD16 srcY;
uint16_t srcX;
uint16_t srcY;
} rfbCopyRect;
#define sz_rfbCopyRect 4
......@@ -414,7 +414,7 @@ typedef struct {
*/
typedef struct {
CARD32 nSubrects;
uint32_t nSubrects;
} rfbRREHeader;
#define sz_rfbRREHeader 4
......@@ -429,10 +429,10 @@ typedef struct {
*/
typedef struct {
CARD8 x;
CARD8 y;
CARD8 w;
CARD8 h;
uint8_t x;
uint8_t y;
uint8_t w;
uint8_t h;
} rfbCoRRERectangle;
#define sz_rfbCoRRERectangle 4
......@@ -498,7 +498,7 @@ typedef struct {
*/
typedef struct {
CARD32 nBytes;
uint32_t nBytes;
} rfbZlibHeader;
#define sz_rfbZlibHeader 4
......@@ -661,12 +661,12 @@ typedef struct {
*/
typedef struct {
CARD8 foreRed;
CARD8 foreGreen;
CARD8 foreBlue;
CARD8 backRed;
CARD8 backGreen;
CARD8 backBlue;
uint8_t foreRed;
uint8_t foreGreen;
uint8_t foreBlue;
uint8_t backRed;
uint8_t backGreen;
uint8_t backBlue;
} rfbXCursorColors;
#define sz_rfbXCursorColors 6
......@@ -692,7 +692,7 @@ typedef struct {
*/
typedef struct {
CARD32 length;
uint32_t length;
} rfbZRLEHeader;
#define sz_rfbZRLEHeader 4
......@@ -711,12 +711,12 @@ typedef struct {
*/
typedef struct {
CARD8 type; /* always rfbSetColourMapEntries */
CARD8 pad;
CARD16 firstColour;
CARD16 nColours;
uint8_t type; /* always rfbSetColourMapEntries */
uint8_t pad;
uint16_t firstColour;
uint16_t nColours;
/* Followed by nColours * 3 * CARD16
/* Followed by nColours * 3 * uint16_t
r1, g1, b1, r2, g2, b2, r3, g3, b3, ..., rn, bn, gn */
} rfbSetColourMapEntriesMsg;
......@@ -730,7 +730,7 @@ typedef struct {
*/
typedef struct {
CARD8 type; /* always rfbBell */
uint8_t type; /* always rfbBell */
} rfbBellMsg;
#define sz_rfbBellMsg 1
......@@ -742,10 +742,10 @@ typedef struct {
*/
typedef struct {
CARD8 type; /* always rfbServerCutText */
CARD8 pad1;
CARD16 pad2;
CARD32 length;
uint8_t type; /* always rfbServerCutText */
uint8_t pad1;
uint16_t pad2;
uint32_t length;
/* followed by char text[length] */
} rfbServerCutTextMsg;
......@@ -762,7 +762,7 @@ typedef rfbServerCutTextMsg rfbBackChannelMsg;
*/
typedef union {
CARD8 type;
uint8_t type;
rfbFramebufferUpdateMsg fu;
rfbSetColourMapEntriesMsg scme;
rfbBellMsg b;
......@@ -784,9 +784,9 @@ typedef union {
*/
typedef struct {
CARD8 type; /* always rfbSetPixelFormat */
CARD8 pad1;
CARD16 pad2;
uint8_t type; /* always rfbSetPixelFormat */
uint8_t pad1;
uint16_t pad2;
rfbPixelFormat format;
} rfbSetPixelFormatMsg;
......@@ -801,12 +801,12 @@ typedef struct {
*/
typedef struct {
CARD8 type; /* always rfbFixColourMapEntries */
CARD8 pad;
CARD16 firstColour;
CARD16 nColours;
uint8_t type; /* always rfbFixColourMapEntries */
uint8_t pad;
uint16_t firstColour;
uint16_t nColours;
/* Followed by nColours * 3 * CARD16
/* Followed by nColours * 3 * uint16_t
r1, g1, b1, r2, g2, b2, r3, g3, b3, ..., rn, bn, gn */
} rfbFixColourMapEntriesMsg;
......@@ -821,10 +821,10 @@ typedef struct {
*/
typedef struct {
CARD8 type; /* always rfbSetEncodings */
CARD8 pad;
CARD16 nEncodings;
/* followed by nEncodings * CARD32 encoding types */
uint8_t type; /* always rfbSetEncodings */
uint8_t pad;
uint16_t nEncodings;
/* followed by nEncodings * uint32_t encoding types */
} rfbSetEncodingsMsg;
#define sz_rfbSetEncodingsMsg 4
......@@ -837,12 +837,12 @@ typedef struct {
*/
typedef struct {
CARD8 type; /* always rfbFramebufferUpdateRequest */
CARD8 incremental;
CARD16 x;
CARD16 y;
CARD16 w;
CARD16 h;
uint8_t type; /* always rfbFramebufferUpdateRequest */
uint8_t incremental;
uint16_t x;
uint16_t y;
uint16_t w;
uint16_t h;
} rfbFramebufferUpdateRequestMsg;
#define sz_rfbFramebufferUpdateRequestMsg 10
......@@ -880,10 +880,10 @@ typedef struct {
*/
typedef struct {
CARD8 type; /* always rfbKeyEvent */
CARD8 down; /* true if down (press), false if up */
CARD16 pad;
CARD32 key; /* key is specified as an X keysym */
uint8_t type; /* always rfbKeyEvent */
uint8_t down; /* true if down (press), false if up */
uint16_t pad;
uint32_t key; /* key is specified as an X keysym */
} rfbKeyEventMsg;
#define sz_rfbKeyEventMsg 8
......@@ -894,10 +894,10 @@ typedef struct {
*/
typedef struct {
CARD8 type; /* always rfbPointerEvent */
CARD8 buttonMask; /* bits 0-7 are buttons 1-8, 0=up, 1=down */
CARD16 x;
CARD16 y;
uint8_t type; /* always rfbPointerEvent */
uint8_t buttonMask; /* bits 0-7 are buttons 1-8, 0=up, 1=down */
uint16_t x;
uint16_t y;
} rfbPointerEventMsg;
#define rfbButton1Mask 1
......@@ -913,10 +913,10 @@ typedef struct {
*/
typedef struct {
CARD8 type; /* always rfbClientCutText */
CARD8 pad1;
CARD16 pad2;
CARD32 length;
uint8_t type; /* always rfbClientCutText */
uint8_t pad1;
uint16_t pad2;
uint32_t length;
/* followed by char text[length] */
} rfbClientCutTextMsg;
......@@ -929,7 +929,7 @@ typedef struct {
*/
typedef union {
CARD8 type;
uint8_t type;
rfbSetPixelFormatMsg spf;
rfbFixColourMapEntriesMsg fcme;
rfbSetEncodingsMsg se;
......
......@@ -10,8 +10,6 @@
* see GPL (latest version) for full details
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <errno.h>
......@@ -20,12 +18,16 @@
#define true -1
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifndef WIN32
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#endif
#include <signal.h>
#include <time.h>
......@@ -734,7 +736,7 @@ void rfbInitServer(rfbScreenInfoPtr rfbScreen)
httpInitSockets(rfbScreen);
}
#ifdef WIN32
#ifndef HAVE_GETTIMEOFDAY
#include <fcntl.h>
#include <conio.h>
#include <sys/timeb.h>
......
......@@ -24,23 +24,30 @@
* USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "rfb.h"
#include "sraRegion.h"
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef WIN32
#define write(sock,buf,len) send(sock,buf,len,0)
#else
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <pwd.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#endif
#include <fcntl.h>
#include <sys/types.h>
#endif
#ifdef CORBA
#include <vncserverctrl.h>
......@@ -538,8 +545,8 @@ rfbClientConnFailed(cl, reason)
int len = strlen(reason);
buf = (char *)malloc(8 + len);
((CARD32 *)buf)[0] = Swap32IfLE(rfbConnFailed);
((CARD32 *)buf)[1] = Swap32IfLE(len);
((uint32_t *)buf)[0] = Swap32IfLE(rfbConnFailed);
((uint32_t *)buf)[1] = Swap32IfLE(len);
memcpy(buf + 8, reason, len);
if (WriteExact(cl, buf, 8 + len) < 0)
......@@ -692,7 +699,7 @@ rfbProcessClientNormalMessage(cl)
case rfbSetEncodings:
{
int i;
CARD32 enc;
uint32_t enc;
if ((n = ReadExact(cl, ((char *)&msg) + 1,
sz_rfbSetEncodingsMsg - 1)) <= 0) {
......@@ -828,15 +835,15 @@ rfbProcessClientNormalMessage(cl)
#endif
default:
#ifdef HAVE_LIBZ
if ( enc >= (CARD32)rfbEncodingCompressLevel0 &&
enc <= (CARD32)rfbEncodingCompressLevel9 ) {
if ( enc >= (uint32_t)rfbEncodingCompressLevel0 &&
enc <= (uint32_t)rfbEncodingCompressLevel9 ) {
cl->zlibCompressLevel = enc & 0x0F;
#ifdef HAVE_LIBJPEG
cl->tightCompressLevel = enc & 0x0F;
rfbLog("Using compression level %d for client %s\n",
cl->tightCompressLevel, cl->host);
} else if ( enc >= (CARD32)rfbEncodingQualityLevel0 &&
enc <= (CARD32)rfbEncodingQualityLevel9 ) {
} else if ( enc >= (uint32_t)rfbEncodingQualityLevel0 &&
enc <= (uint32_t)rfbEncodingQualityLevel9 ) {
cl->tightQualityLevel = enc & 0x0F;
rfbLog("Using image quality level %d for client %s\n",
cl->tightQualityLevel, cl->host);
......@@ -1178,7 +1185,7 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion)
fu->type = rfbFramebufferUpdate;
if (nUpdateRegionRects != 0xFFFF) {
fu->nRects = Swap16IfLE((CARD16)(sraRgnCountRects(updateCopyRegion) +
fu->nRects = Swap16IfLE((uint16_t)(sraRgnCountRects(updateCopyRegion) +
nUpdateRegionRects +
!!sendCursorShape + !!sendCursorPos));
} else {
......@@ -1516,7 +1523,7 @@ rfbSendSetColourMapEntries(cl, firstColour, nColours)
{
char buf[sz_rfbSetColourMapEntriesMsg + 256 * 3 * 2];
rfbSetColourMapEntriesMsg *scme = (rfbSetColourMapEntriesMsg *)buf;
CARD16 *rgb = (CARD16 *)(&buf[sz_rfbSetColourMapEntriesMsg]);
uint16_t *rgb = (uint16_t *)(&buf[sz_rfbSetColourMapEntriesMsg]);
rfbColourMap* cm = &cl->screen->colourMap;
int i, len;
......
......@@ -26,7 +26,6 @@
* USA.
*/
#include <stdio.h>
#include "rfb.h"
/*
......@@ -43,10 +42,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);
/*
......@@ -91,13 +90,13 @@ rfbSendRectEncodingRRE(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);
......@@ -177,25 +176,25 @@ rfbSendRectEncodingRRE(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; \
rfbRectangle 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); \
\
......@@ -247,7 +246,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_rfbRectangle); \
rreAfterBufLen += sz_rfbRectangle; \
......@@ -275,7 +274,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;
......@@ -288,13 +287,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);
......@@ -306,7 +305,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);
......@@ -314,7 +313,7 @@ getBgColour(data,size,bpp)
counts[k] += 1;
if (counts[k] > maxcount) {
maxcount = counts[k];
maxclr = ((CARD8 *)data)[j];
maxclr = ((uint8_t *)data)[j];
}
}
......
......@@ -39,8 +39,12 @@
* USA.
*/
#include <stdio.h>
#include "rfb.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef WIN32
#pragma warning (disable: 4018 4761)
#define close closesocket
......@@ -49,14 +53,23 @@
#define ETIMEDOUT WSAETIMEDOUT
#define write(sock,buf,len) send(sock,buf,len,0)
#else
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netdb.h>
#include <unistd.h>
#include <arpa/inet.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#endif
#if defined(__linux__) && defined(NEED_TIMEVAL)
struct timeval
{
......@@ -64,7 +77,11 @@ struct timeval
}
;
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <errno.h>
#ifdef USE_LIBWRAP
......@@ -74,8 +91,6 @@ int allow_severity=LOG_INFO;
int deny_severity=LOG_WARNING;
#endif
#include "rfb.h"
/*#ifndef WIN32
int max(int i,int j) { return(i<j?j:i); }
#endif
......
......@@ -8,9 +8,6 @@
#include "rfb.h"
#include "sraRegion.h"
#include <stdlib.h>
#include <stdio.h>
/* -=- Internal Span structure */
struct sraRegion;
......
......@@ -24,8 +24,6 @@
* USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include "rfb.h"
static const char* encNames[] = {
......
......@@ -24,22 +24,22 @@
*/
static void
rfbInitOneRGBTable24 (CARD8 *table, int inMax, int outMax, int outShift,int swap);
rfbInitOneRGBTable24 (uint8_t *table, int inMax, int outMax, int outShift,int swap);
static void
rfbInitColourMapSingleTable24(char **table, rfbPixelFormat *in,
rfbPixelFormat *out,rfbColourMap* colourMap)
{
CARD32 i, r, g, b, outValue;
CARD8 *t;
CARD8 c;
uint32_t i, r, g, b, outValue;
uint8_t *t;
uint8_t c;
unsigned int nEntries = 1 << in->bitsPerPixel;
int shift = colourMap->is16?16:8;
if (*table) free(*table);
*table = (char *)malloc(nEntries * 3 + 1);
t = (CARD8 *)*table;
t = (uint8_t *)*table;
for (i = 0; i < nEntries; i++) {
r = g = b = 0;
......@@ -57,7 +57,7 @@ rfbInitColourMapSingleTable24(char **table, rfbPixelFormat *in,
outValue = ((((r * (1 + out->redMax)) >> shift) << out->redShift) |
(((g * (1 + out->greenMax)) >> shift) << out->greenShift) |
(((b * (1 + out->blueMax)) >> shift) << out->blueShift));
*(CARD32*)&t[3*i] = outValue;
*(uint32_t*)&t[3*i] = outValue;
if(!rfbEndianTest)
memmove(t+3*i,t+3*i+1,3);
if (out->bigEndian != in->bigEndian) {
......@@ -77,13 +77,13 @@ rfbInitTrueColourSingleTable24 (char **table, rfbPixelFormat *in,
{
int i,outValue;
int inRed, inGreen, inBlue, outRed, outGreen, outBlue;
CARD8 *t;
CARD8 c;
uint8_t *t;
uint8_t c;
int nEntries = 1 << in->bitsPerPixel;
if (*table) free(*table);
*table = (char *)malloc(nEntries * 3 + 1);
t = (CARD8 *)*table;
t = (uint8_t *)*table;
for (i = 0; i < nEntries; i++) {
inRed = (i >> in->redShift) & in->redMax;
......@@ -97,7 +97,7 @@ rfbInitTrueColourSingleTable24 (char **table, rfbPixelFormat *in,
outValue = ((outRed << out->redShift) |
(outGreen << out->greenShift) |
(outBlue << out->blueShift));
*(CARD32*)&t[3*i] = outValue;
*(uint32_t*)&t[3*i] = outValue;
if(!rfbEndianTest)
memmove(t+3*i,t+3*i+1,3);
if (out->bigEndian != in->bigEndian) {
......@@ -116,14 +116,14 @@ static void
rfbInitTrueColourRGBTables24 (char **table, rfbPixelFormat *in,
rfbPixelFormat *out)
{
CARD8 *redTable;
CARD8 *greenTable;
CARD8 *blueTable;
uint8_t *redTable;
uint8_t *greenTable;
uint8_t *blueTable;
if (*table) free(*table);
*table = (char *)malloc((in->redMax + in->greenMax + in->blueMax + 3)
* 3 + 1);
redTable = (CARD8 *)*table;
redTable = (uint8_t *)*table;
greenTable = redTable + 3*(in->redMax + 1);
blueTable = greenTable + 3*(in->greenMax + 1);
......@@ -136,17 +136,17 @@ rfbInitTrueColourRGBTables24 (char **table, rfbPixelFormat *in,
}
static void
rfbInitOneRGBTable24 (CARD8 *table, int inMax, int outMax, int outShift,
rfbInitOneRGBTable24 (uint8_t *table, int inMax, int outMax, int outShift,
int swap)
{
int i;
int nEntries = inMax + 1;
CARD32 outValue;
CARD8 c;
uint32_t outValue;
uint8_t c;
for (i = 0; i < nEntries; i++) {
outValue = ((i * outMax + inMax / 2) / inMax) << outShift;
*(CARD32 *)&table[3*i] = outValue;
*(uint32_t *)&table[3*i] = outValue;
if(!rfbEndianTest)
memmove(table+3*i,table+3*i+1,3);
if (swap) {
......
......@@ -37,7 +37,7 @@
#error "It is included as part of translate.c"
#endif
#define OUT_T CONCAT2E(CARD,OUT)
#define OUT_T CONCAT3E(uint,OUT,_t)
#define SwapOUT(x) CONCAT2E(Swap,OUT(x))
#define rfbInitColourMapSingleTableOUT \
CONCAT2E(rfbInitColourMapSingleTable,OUT)
......@@ -46,9 +46,9 @@ static void
rfbInitColourMapSingleTableOUT(char **table, rfbPixelFormat *in,
rfbPixelFormat *out,rfbColourMap* colourMap)
{
CARD32 i, r, g, b;
uint32_t i, r, g, b;
OUT_T *t;
CARD32 nEntries = 1 << in->bitsPerPixel;
uint32_t nEntries = 1 << in->bitsPerPixel;
int shift = colourMap->is16?16:8;
if (*table) free(*table);
......
......@@ -39,7 +39,7 @@
#error "It is included as part of translate.c"
#endif
#define OUT_T CONCAT2E(CARD,OUT)
#define OUT_T CONCAT3E(uint,OUT,_t)
#define SwapOUT(x) CONCAT2E(Swap,OUT(x))
#define rfbInitTrueColourSingleTableOUT \
CONCAT2E(rfbInitTrueColourSingleTable,OUT)
......
......@@ -53,19 +53,19 @@ rfbTranslateWithSingleTable24to24 (char *table, rfbPixelFormat *in,
int bytesBetweenInputLines,
int width, int height)
{
CARD8 *ip = (CARD8 *)iptr;
CARD8 *op = (CARD8 *)optr;
uint8_t *ip = (uint8_t *)iptr;
uint8_t *op = (uint8_t *)optr;
int ipextra = bytesBetweenInputLines - width * 3;
CARD8 *opLineEnd;
CARD8 *t = (CARD8 *)table;
uint8_t *opLineEnd;
uint8_t *t = (uint8_t *)table;
int shift = rfbEndianTest?0:8;
CARD8 c;
uint8_t c;
while (height > 0) {
opLineEnd = op + width*3;
while (op < opLineEnd) {
*(CARD32*)op = t[((*(CARD32 *)ip)>>shift)&0x00ffffff];
*(uint32_t*)op = t[((*(uint32_t *)ip)>>shift)&0x00ffffff];
if(!rfbEndianTest)
memmove(op,op+1,3);
if (out->bigEndian != in->bigEndian) {
......@@ -92,21 +92,21 @@ rfbTranslateWithRGBTables24to24 (char *table, rfbPixelFormat *in,
int bytesBetweenInputLines,
int width, int height)
{
CARD8 *ip = (CARD8 *)iptr;
CARD8 *op = (CARD8 *)optr;
uint8_t *ip = (uint8_t *)iptr;
uint8_t *op = (uint8_t *)optr;
int ipextra = bytesBetweenInputLines - width*3;
CARD8 *opLineEnd;
CARD8 *redTable = (CARD8 *)table;
CARD8 *greenTable = redTable + 3*(in->redMax + 1);
CARD8 *blueTable = greenTable + 3*(in->greenMax + 1);
CARD32 outValue,inValue;
uint8_t *opLineEnd;
uint8_t *redTable = (uint8_t *)table;
uint8_t *greenTable = redTable + 3*(in->redMax + 1);
uint8_t *blueTable = greenTable + 3*(in->greenMax + 1);
uint32_t outValue,inValue;
int shift = rfbEndianTest?0:8;
while (height > 0) {
opLineEnd = op+3*width;
while (op < opLineEnd) {
inValue = ((*(CARD32 *)ip)>>shift)&0x00ffffff;
inValue = ((*(uint32_t *)ip)>>shift)&0x00ffffff;
outValue = (redTable[(inValue >> in->redShift) & in->redMax] |
greenTable[(inValue >> in->greenShift) & in->greenMax] |
blueTable[(inValue >> in->blueShift) & in->blueMax]);
......@@ -121,8 +121,8 @@ rfbTranslateWithRGBTables24to24 (char *table, rfbPixelFormat *in,
#else
#define IN_T CONCAT2E(CARD,BPP)
#define OUT_T CONCAT2E(CARD,BPP)
#define IN_T CONCAT3E(uint,BPP,_t)
#define OUT_T CONCAT3E(uint,BPP,_t)
#define rfbTranslateWithSingleTable24toOUT \
CONCAT4E(rfbTranslateWithSingleTable,24,to,BPP)
#define rfbTranslateWithSingleTableINto24 \
......@@ -144,7 +144,7 @@ rfbTranslateWithSingleTable24toOUT (char *table, rfbPixelFormat *in,
int bytesBetweenInputLines,
int width, int height)
{
CARD8 *ip = (CARD8 *)iptr;
uint8_t *ip = (uint8_t *)iptr;
OUT_T *op = (OUT_T *)optr;
int ipextra = bytesBetweenInputLines - width*3;
OUT_T *opLineEnd;
......@@ -155,7 +155,7 @@ rfbTranslateWithSingleTable24toOUT (char *table, rfbPixelFormat *in,
opLineEnd = op + width;
while (op < opLineEnd) {
*(op++) = t[((*(CARD32 *)ip)>>shift)&0x00ffffff];
*(op++) = t[((*(uint32_t *)ip)>>shift)&0x00ffffff];
ip+=3;
}
......@@ -177,21 +177,21 @@ rfbTranslateWithRGBTables24toOUT (char *table, rfbPixelFormat *in,
int bytesBetweenInputLines,
int width, int height)
{
CARD8 *ip = (CARD8 *)iptr;
uint8_t *ip = (uint8_t *)iptr;
OUT_T *op = (OUT_T *)optr;
int ipextra = bytesBetweenInputLines - width*3;
OUT_T *opLineEnd;
OUT_T *redTable = (OUT_T *)table;
OUT_T *greenTable = redTable + in->redMax + 1;
OUT_T *blueTable = greenTable + in->greenMax + 1;
CARD32 inValue;
uint32_t inValue;
int shift = rfbEndianTest?0:8;
while (height > 0) {
opLineEnd = &op[width];
while (op < opLineEnd) {
inValue = ((*(CARD32 *)ip)>>shift)&0x00ffffff;
inValue = ((*(uint32_t *)ip)>>shift)&0x00ffffff;
*(op++) = (redTable[(inValue >> in->redShift) & in->redMax] |
greenTable[(inValue >> in->greenShift) & in->greenMax] |
blueTable[(inValue >> in->blueShift) & in->blueMax]);
......@@ -215,10 +215,10 @@ rfbTranslateWithSingleTableINto24 (char *table, rfbPixelFormat *in,
int width, int height)
{
IN_T *ip = (IN_T *)iptr;
CARD8 *op = (CARD8 *)optr;
uint8_t *op = (uint8_t *)optr;
int ipextra = bytesBetweenInputLines / sizeof(IN_T) - width;
CARD8 *opLineEnd;
CARD8 *t = (CARD8 *)table;
uint8_t *opLineEnd;
uint8_t *t = (uint8_t *)table;
while (height > 0) {
opLineEnd = op + width * 3;
......@@ -247,13 +247,13 @@ rfbTranslateWithRGBTablesINto24 (char *table, rfbPixelFormat *in,
int width, int height)
{
IN_T *ip = (IN_T *)iptr;
CARD8 *op = (CARD8 *)optr;
uint8_t *op = (uint8_t *)optr;
int ipextra = bytesBetweenInputLines / sizeof(IN_T) - width;
CARD8 *opLineEnd;
CARD8 *redTable = (CARD8 *)table;
CARD8 *greenTable = redTable + 3*(in->redMax + 1);
CARD8 *blueTable = greenTable + 3*(in->greenMax + 1);
CARD32 outValue;
uint8_t *opLineEnd;
uint8_t *redTable = (uint8_t *)table;
uint8_t *greenTable = redTable + 3*(in->redMax + 1);
uint8_t *blueTable = greenTable + 3*(in->greenMax + 1);
uint32_t outValue;
while (height > 0) {
opLineEnd = op+3*width;
......
......@@ -39,8 +39,8 @@
#error "It is included as part of translate.c"
#endif
#define IN_T CONCAT2E(CARD,IN)
#define OUT_T CONCAT2E(CARD,OUT)
#define IN_T CONCAT3E(uint,IN,_t)
#define OUT_T CONCAT3E(uint,OUT,_t)
#define rfbTranslateWithSingleTableINtoOUT \
CONCAT4E(rfbTranslateWithSingleTable,IN,to,OUT)
#define rfbTranslateWithRGBTablesINtoOUT \
......
This diff is collapsed.
......@@ -23,8 +23,6 @@
* USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include "rfb.h"
#include "sraRegion.h"
......@@ -60,6 +58,8 @@ static const rfbPixelFormat BGR233Format = {
#define CONCAT2(a,b) a##b
#define CONCAT2E(a,b) CONCAT2(a,b)
#define CONCAT3(a,b,c) a##b##c
#define CONCAT3E(a,b,c) CONCAT3(a,b,c)
#define CONCAT4(a,b,c,d) a##b##c##d
#define CONCAT4E(a,b,c,d) CONCAT4(a,b,c,d)
......@@ -364,7 +364,7 @@ rfbSetClientColourMapBGR233(cl)
{
char buf[sz_rfbSetColourMapEntriesMsg + 256 * 3 * 2];
rfbSetColourMapEntriesMsg *scme = (rfbSetColourMapEntriesMsg *)buf;
CARD16 *rgb = (CARD16 *)(&buf[sz_rfbSetColourMapEntriesMsg]);
uint16_t *rgb = (uint16_t *)(&buf[sz_rfbSetColourMapEntriesMsg]);
int i, len;
int r, g, b;
......
......@@ -21,21 +21,27 @@
* vncauth.c - Functions for VNC password management and authentication.
*/
#include <stdio.h>
#include <stdlib.h>
#include "rfb.h"
#include "d3des.h"
#include <string.h>
#include <math.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include <time.h>
#ifdef WIN32
#define srandom srand
#define random rand
#else
#include <sys/time.h>
#endif
#include "rfb.h"
#include "d3des.h"
/*
......
......@@ -30,7 +30,6 @@
* or send email to feedback@developvnc.org.
*/
#include <stdio.h>
#include "rfb.h"
#ifdef HAVE_LIBZ
......
......@@ -23,7 +23,6 @@
// Routines to implement Zlib Run-length Encoding (ZRLE).
//
#include <stdio.h>
extern "C" {
#include "rfb.h"
}
......@@ -158,7 +157,7 @@ Bool rfbSendRectEncodingZRLE(rfbClientPtr cl, int x, int y, int w, int h)
bytesToCopy = mos.length() - i;
}
memcpy(cl->updateBuf+cl->ublen, (CARD8*)mos.data() + i, bytesToCopy);
memcpy(cl->updateBuf+cl->ublen, (uint8_t*)mos.data() + i, bytesToCopy);
cl->ublen += bytesToCopy;
i += bytesToCopy;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment