Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
libvncserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rasky
libvncserver
Commits
67094d7c
Commit
67094d7c
authored
Oct 11, 2001
by
dscho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replaced xalloc with malloc functions, udp input support (untested), fixed http
parent
519a8e0e
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
204 additions
and
236 deletions
+204
-236
auth.c
auth.c
+4
-16
corre.c
corre.c
+4
-4
httpd.c
httpd.c
+3
-3
main.c
main.c
+11
-1
rfb.h
rfb.h
+56
-106
rfbserver.c
rfbserver.c
+99
-77
rre.c
rre.c
+4
-4
sockets.c
sockets.c
+5
-7
sraRegion.c
sraRegion.c
+2
-2
tableinit24.c
tableinit24.c
+2
-2
tableinittctemplate.c
tableinittctemplate.c
+2
-2
tight.c
tight.c
+8
-8
zlib.c
zlib.c
+4
-4
No files found.
auth.c
View file @
67094d7c
...
...
@@ -30,10 +30,6 @@
#include <stdlib.h>
#include "rfb.h"
char
*
rfbAuthPasswdFile
=
NULL
;
/*
* rfbAuthNewClient is called when we reach the point of authenticating
* a new client. If authentication isn't being used then we simply send
...
...
@@ -49,15 +45,12 @@ rfbAuthNewClient(cl)
cl
->
state
=
RFB_AUTHENTICATION
;
if
(
rfbAuthPasswdFile
&&
!
cl
->
reverseConnection
)
{
if
(
cl
->
screen
->
rfbAuthPasswdData
&&
!
cl
->
reverseConnection
)
{
*
(
CARD32
*
)
buf
=
Swap32IfLE
(
rfbVncAuth
);
vncRandomBytes
(
cl
->
authChallenge
);
memcpy
(
&
buf
[
4
],
(
char
*
)
cl
->
authChallenge
,
CHALLENGESIZE
);
len
=
4
+
CHALLENGESIZE
;
}
else
{
*
(
CARD32
*
)
buf
=
Swap32IfLE
(
rfbNoAuth
);
len
=
4
;
cl
->
state
=
RFB_INITIALISATION
;
...
...
@@ -80,7 +73,7 @@ void
rfbAuthProcessClientMessage
(
cl
)
rfbClientPtr
cl
;
{
char
*
passwd
;
char
passwd
[
1024
]
;
int
i
,
n
;
CARD8
response
[
CHALLENGESIZE
];
CARD32
authResult
;
...
...
@@ -92,14 +85,9 @@ rfbAuthProcessClientMessage(cl)
return
;
}
passwd
=
vncDecryptPasswdFromFile
(
rfbAuthPasswdFile
);
if
(
passwd
==
NULL
)
{
rfbLog
(
"rfbAuthProcessClientMessage: could not get password from %s
\n
"
,
rfbAuthPasswdFile
);
if
(
!
cl
->
screen
->
getPassword
(
cl
,
passwd
,
MAXPWLEN
))
{
rfbLog
(
"rfbAuthProcessClientMessage: could not get password
\n
"
);
authResult
=
Swap32IfLE
(
rfbVncAuthFailed
);
if
(
WriteExact
(
cl
,
(
char
*
)
&
authResult
,
4
)
<
0
)
{
rfbLogPerror
(
"rfbAuthProcessClientMessage: write"
);
}
...
...
corre.c
View file @
67094d7c
...
...
@@ -105,17 +105,17 @@ rfbSendSmallRectEncodingCoRRE(cl, x, y, w, h)
if
(
rreBeforeBufSize
<
maxRawSize
)
{
rreBeforeBufSize
=
maxRawSize
;
if
(
rreBeforeBuf
==
NULL
)
rreBeforeBuf
=
(
char
*
)
x
alloc
(
rreBeforeBufSize
);
rreBeforeBuf
=
(
char
*
)
m
alloc
(
rreBeforeBufSize
);
else
rreBeforeBuf
=
(
char
*
)
x
realloc
(
rreBeforeBuf
,
rreBeforeBufSize
);
rreBeforeBuf
=
(
char
*
)
realloc
(
rreBeforeBuf
,
rreBeforeBufSize
);
}
if
(
rreAfterBufSize
<
maxRawSize
)
{
rreAfterBufSize
=
maxRawSize
;
if
(
rreAfterBuf
==
NULL
)
rreAfterBuf
=
(
char
*
)
x
alloc
(
rreAfterBufSize
);
rreAfterBuf
=
(
char
*
)
m
alloc
(
rreAfterBufSize
);
else
rreAfterBuf
=
(
char
*
)
x
realloc
(
rreAfterBuf
,
rreAfterBufSize
);
rreAfterBuf
=
(
char
*
)
realloc
(
rreAfterBuf
,
rreAfterBufSize
);
}
(
*
cl
->
translateFn
)(
cl
->
translateLookupTable
,
&
(
cl
->
screen
->
rfbServerFormat
),
...
...
httpd.c
View file @
67094d7c
...
...
@@ -45,7 +45,7 @@
"<HEAD><TITLE>File Not Found</TITLE></HEAD>\n" \
"<BODY><H1>File Not Found</H1></BODY>\n"
#define OK_STR "HTTP/1.0 200 OK\n\n"
#define OK_STR "HTTP/1.0 200 OK\n
Content-Type: text/html\n
\n"
static
void
httpProcessInput
();
static
Bool
compareAndSkip
(
char
**
ptr
,
const
char
*
str
);
...
...
@@ -273,7 +273,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
/* Open the file */
if
((
fd
=
fopen
(
fullFname
,
O_RDONLY
))
<
0
)
{
if
((
fd
=
fopen
(
fullFname
,
"r"
))
<=
0
)
{
rfbLogPerror
(
"httpProcessInput: open"
);
WriteExact
(
&
cl
,
NOT_FOUND_STR
,
strlen
(
NOT_FOUND_STR
));
httpCloseSock
(
rfbScreen
);
...
...
@@ -283,7 +283,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
WriteExact
(
&
cl
,
OK_STR
,
strlen
(
OK_STR
));
while
(
1
)
{
int
n
=
fread
(
buf
,
BUF_SIZE
-
1
,
1
,
fd
);
int
n
=
fread
(
buf
,
1
,
BUF_SIZE
-
1
,
fd
);
if
(
n
<
0
)
{
rfbLogPerror
(
"httpProcessInput: read"
);
fclose
(
fd
);
...
...
main.c
View file @
67094d7c
...
...
@@ -326,7 +326,7 @@ processArguments(rfbScreenInfoPtr rfbScreen,int argc, char *argv[])
rfbScreen
->
rfbMaxClientWait
=
atoi
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-rfbauth"
)
==
0
)
{
/* -rfbauth passwd-file */
if
(
i
+
1
>=
argc
)
usage
();
rfbScreen
->
rfbAuthPasswd
File
=
argv
[
++
i
];
rfbScreen
->
rfbAuthPasswd
Data
=
argv
[
++
i
];
}
else
if
(
strcmp
(
argv
[
i
],
"-desktop"
)
==
0
)
{
/* -desktop desktop-name */
if
(
i
+
1
>=
argc
)
usage
();
rfbScreen
->
desktopName
=
argv
[
++
i
];
...
...
@@ -400,6 +400,15 @@ rfbCursorPtr defaultGetCursorPtr(rfbClientPtr cl)
return
(
cl
->
screen
->
cursor
);
}
Bool
defaultGetPassword
(
rfbClientPtr
cl
,
char
*
passwd
,
int
len
)
{
char
*
pwd
=
vncDecryptPasswdFromFile
(
cl
->
screen
->
rfbAuthPasswdData
);
if
(
!
pwd
)
return
(
FALSE
);
strncpy
(
passwd
,
pwd
,
MAXPWLEN
);
return
(
TRUE
);
}
void
doNothingWithClient
(
rfbClientPtr
cl
)
{
}
...
...
@@ -511,6 +520,7 @@ rfbScreenInfoPtr rfbGetScreen(int argc,char** argv,
rfbScreen
->
setXCutText
=
defaultSetXCutText
;
rfbScreen
->
getCursorPtr
=
defaultGetCursorPtr
;
rfbScreen
->
setTranslateFunction
=
rfbSetTranslateFunction
;
rfbScreen
->
getPassword
=
defaultGetPassword
;
rfbScreen
->
newClientHook
=
doNothingWithClient
;
rfbScreen
->
displayHook
=
0
;
...
...
rfb.h
View file @
67094d7c
This diff is collapsed.
Click to expand it.
rfbserver.c
View file @
67094d7c
...
...
@@ -173,108 +173,128 @@ rfbReverseConnection(rfbScreen,host, port)
*/
rfbClientPtr
rfbNew
Client
(
rfbScreen
,
sock
)
rfbNew
TCPOrUDPClient
(
rfbScreen
,
sock
,
isUDP
)
rfbScreenInfoPtr
rfbScreen
;
int
sock
;
Bool
isUDP
;
{
rfbProtocolVersionMsg
pv
;
rfbClientIteratorPtr
iterator
;
rfbClientPtr
cl
;
rfbClientPtr
cl
,
cl_
;
struct
sockaddr_in
addr
;
int
addrlen
=
sizeof
(
struct
sockaddr_in
);
int
i
;
rfbLog
(
" other clients:
\n
"
);
iterator
=
rfbGetClientIterator
(
rfbScreen
);
while
((
cl
=
rfbClientIteratorNext
(
iterator
))
!=
NULL
)
{
rfbLog
(
" %s
\n
"
,
cl
->
host
);
}
rfbReleaseClientIterator
(
iterator
);
cl
=
(
rfbClientPtr
)
xalloc
(
sizeof
(
rfbClientRec
));
cl
=
(
rfbClientPtr
)
malloc
(
sizeof
(
rfbClientRec
));
FD_SET
(
sock
,
&
(
rfbScreen
->
allFds
));
cl
->
screen
=
rfbScreen
;
cl
->
sock
=
sock
;
getpeername
(
sock
,
(
struct
sockaddr
*
)
&
addr
,
&
addrlen
);
cl
->
host
=
strdup
(
inet_ntoa
(
addr
.
sin_addr
));
rfbResetStats
(
cl
);
INIT_MUTEX
(
cl
->
outputMutex
);
INIT_MUTEX
(
cl
->
refCountMutex
);
INIT_COND
(
cl
->
deleteCond
);
if
(
isUDP
)
{
rfbLog
(
" accepted UDP client
\n
"
);
}
else
{
getpeername
(
sock
,
(
struct
sockaddr
*
)
&
addr
,
&
addrlen
);
cl
->
host
=
strdup
(
inet_ntoa
(
addr
.
sin_addr
));
cl
->
state
=
RFB_PROTOCOL_VERSION
;
rfbLog
(
" other clients:
\n
"
);
iterator
=
rfbGetClientIterator
(
rfbScreen
);
while
((
cl_
=
rfbClientIteratorNext
(
iterator
))
!=
NULL
)
{
rfbLog
(
" %s
\n
"
,
cl_
->
host
);
}
rfbReleaseClientIterator
(
iterator
);
cl
->
reverseConnection
=
FALSE
;
cl
->
readyForSetColourMapEntries
=
FALSE
;
cl
->
useCopyRect
=
FALSE
;
cl
->
preferredEncoding
=
rfbEncodingRaw
;
cl
->
correMaxWidth
=
48
;
cl
->
correMaxHeight
=
48
;
FD_SET
(
sock
,
&
(
rfbScreen
->
allFds
));
INIT_MUTEX
(
cl
->
outputMutex
);
INIT_MUTEX
(
cl
->
refCountMutex
);
INIT_COND
(
cl
->
deleteCond
);
cl
->
copyRegion
=
sraRgnCreate
();
cl
->
copyDX
=
0
;
cl
->
copyDY
=
0
;
cl
->
state
=
RFB_PROTOCOL_VERSION
;
cl
->
reverseConnection
=
FALSE
;
cl
->
readyForSetColourMapEntries
=
FALSE
;
cl
->
useCopyRect
=
FALSE
;
cl
->
preferredEncoding
=
rfbEncodingRaw
;
cl
->
correMaxWidth
=
48
;
cl
->
correMaxHeight
=
48
;
cl
->
copyRegion
=
sraRgnCreate
();
cl
->
copyDX
=
0
;
cl
->
copyDY
=
0
;
cl
->
modifiedRegion
=
sraRgnCreateRect
(
0
,
0
,
rfbScreen
->
width
,
rfbScreen
->
height
);
cl
->
modifiedRegion
=
sraRgnCreateRect
(
0
,
0
,
rfbScreen
->
width
,
rfbScreen
->
height
);
INIT_MUTEX
(
cl
->
updateMutex
);
INIT_COND
(
cl
->
updateCond
);
INIT_MUTEX
(
cl
->
updateMutex
);
INIT_COND
(
cl
->
updateCond
);
cl
->
requestedRegion
=
sraRgnCreate
();
cl
->
requestedRegion
=
sraRgnCreate
();
cl
->
format
=
cl
->
screen
->
rfbServerFormat
;
cl
->
translateFn
=
rfbTranslateNone
;
cl
->
translateLookupTable
=
NULL
;
cl
->
format
=
cl
->
screen
->
rfbServerFormat
;
cl
->
translateFn
=
rfbTranslateNone
;
cl
->
translateLookupTable
=
NULL
;
LOCK
(
rfbClientListMutex
);
LOCK
(
rfbClientListMutex
);
IF_PTHREADS
(
cl
->
refCount
=
0
);
cl
->
next
=
rfbScreen
->
rfbClientHead
;
cl
->
prev
=
NULL
;
if
(
rfbScreen
->
rfbClientHead
)
IF_PTHREADS
(
cl
->
refCount
=
0
);
cl
->
next
=
rfbScreen
->
rfbClientHead
;
cl
->
prev
=
NULL
;
if
(
rfbScreen
->
rfbClientHead
)
rfbScreen
->
rfbClientHead
->
prev
=
cl
;
rfbScreen
->
rfbClientHead
=
cl
;
UNLOCK
(
rfbClientListMutex
);
rfbScreen
->
rfbClientHead
=
cl
;
UNLOCK
(
rfbClientListMutex
);
cl
->
tightCompressLevel
=
TIGHT_DEFAULT_COMPRESSION
;
cl
->
tightQualityLevel
=
-
1
;
for
(
i
=
0
;
i
<
4
;
i
++
)
cl
->
tightCompressLevel
=
TIGHT_DEFAULT_COMPRESSION
;
cl
->
tightQualityLevel
=
-
1
;
for
(
i
=
0
;
i
<
4
;
i
++
)
cl
->
zsActive
[
i
]
=
FALSE
;
cl
->
enableCursorShapeUpdates
=
FALSE
;
cl
->
useRichCursorEncoding
=
FALSE
;
cl
->
enableLastRectEncoding
=
FALSE
;
cl
->
enableCursorShapeUpdates
=
FALSE
;
cl
->
useRichCursorEncoding
=
FALSE
;
cl
->
enableLastRectEncoding
=
FALSE
;
rfbResetStats
(
cl
);
cl
->
compStreamInited
=
FALSE
;
cl
->
compStream
.
total_in
=
0
;
cl
->
compStream
.
total_out
=
0
;
cl
->
compStream
.
zalloc
=
Z_NULL
;
cl
->
compStream
.
zfree
=
Z_NULL
;
cl
->
compStream
.
opaque
=
Z_NULL
;
cl
->
compStreamInited
=
FALSE
;
cl
->
compStream
.
total_in
=
0
;
cl
->
compStream
.
total_out
=
0
;
cl
->
compStream
.
zalloc
=
Z_NULL
;
cl
->
compStream
.
zfree
=
Z_NULL
;
cl
->
compStream
.
opaque
=
Z_NULL
;
cl
->
zlibCompressLevel
=
5
;
cl
->
zlibCompressLevel
=
5
;
sprintf
(
pv
,
rfbProtocolVersionFormat
,
rfbProtocolMajorVersion
,
rfbProtocolMinorVersion
);
sprintf
(
pv
,
rfbProtocolVersionFormat
,
rfbProtocolMajorVersion
,
rfbProtocolMinorVersion
);
cl
->
clientData
=
NULL
;
cl
->
clientGoneHook
=
doNothingWithClient
;
cl
->
screen
->
newClientHook
(
cl
);
if
(
WriteExact
(
cl
,
pv
,
sz_rfbProtocolVersionMsg
)
<
0
)
{
if
(
WriteExact
(
cl
,
pv
,
sz_rfbProtocolVersionMsg
)
<
0
)
{
rfbLogPerror
(
"rfbNewClient: write"
);
rfbCloseClient
(
cl
);
return
NULL
;
}
}
cl
->
clientData
=
NULL
;
cl
->
clientGoneHook
=
doNothingWithClient
;
cl
->
screen
->
newClientHook
(
cl
);
return
cl
;
}
rfbClientPtr
rfbNewClient
(
rfbScreen
,
sock
)
rfbScreenInfoPtr
rfbScreen
;
int
sock
;
{
return
(
rfbNewTCPOrUDPClient
(
rfbScreen
,
sock
,
FALSE
));
}
rfbClientPtr
rfbNewUDPClient
(
rfbScreen
)
rfbScreenInfoPtr
rfbScreen
;
{
return
((
rfbScreen
->
udpClient
=
rfbNewTCPOrUDPClient
(
rfbScreen
,
rfbScreen
->
udpSock
,
TRUE
)));
}
/*
* rfbClientConnectionGone is called from sockets.c just after a connection
...
...
@@ -342,7 +362,7 @@ rfbClientConnectionGone(cl)
rfbPrintStats
(
cl
);
x
free
(
cl
);
free
(
cl
);
}
...
...
@@ -434,14 +454,14 @@ rfbClientConnFailed(cl, reason)
char
*
buf
;
int
len
=
strlen
(
reason
);
buf
=
(
char
*
)
x
alloc
(
8
+
len
);
buf
=
(
char
*
)
m
alloc
(
8
+
len
);
((
CARD32
*
)
buf
)[
0
]
=
Swap32IfLE
(
rfbConnFailed
);
((
CARD32
*
)
buf
)[
1
]
=
Swap32IfLE
(
len
);
memcpy
(
buf
+
8
,
reason
,
len
);
if
(
WriteExact
(
cl
,
buf
,
8
+
len
)
<
0
)
rfbLogPerror
(
"rfbClientConnFailed: write"
);
x
free
(
buf
);
free
(
buf
);
rfbCloseClient
(
cl
);
}
...
...
@@ -808,19 +828,19 @@ rfbProcessClientNormalMessage(cl)
msg
.
cct
.
length
=
Swap32IfLE
(
msg
.
cct
.
length
);
str
=
(
char
*
)
x
alloc
(
msg
.
cct
.
length
);
str
=
(
char
*
)
m
alloc
(
msg
.
cct
.
length
);
if
((
n
=
ReadExact
(
cl
,
str
,
msg
.
cct
.
length
))
<=
0
)
{
if
(
n
!=
0
)
rfbLogPerror
(
"rfbProcessClientNormalMessage: read"
);
x
free
(
str
);
free
(
str
);
rfbCloseClient
(
cl
);
return
;
}
cl
->
screen
->
setXCutText
(
str
,
msg
.
cct
.
length
,
cl
);
x
free
(
str
);
free
(
str
);
return
;
...
...
@@ -1388,18 +1408,21 @@ rfbNewUDPConnection(rfbScreen,sock)
* number of bytes we can possibly get.
*/
#if 0
void
rfbProcessUDPInput(rfb
ClientPtr cl
)
rfbProcessUDPInput
(
rfb
ScreenInfoPtr
rfbScreen
)
{
int
n
;
rfbClientPtr
cl
=
rfbScreen
->
udpClient
;
rfbClientToServerMsg
msg
;
if ((n = read(cl->udpSock, (char *)&msg, sizeof(msg))) <= 0) {
if
(
!
cl
)
return
;
if
((
n
=
read
(
rfbScreen
->
udpSock
,
(
char
*
)
&
msg
,
sizeof
(
msg
)))
<=
0
)
{
if
(
n
<
0
)
{
rfbLogPerror
(
"rfbProcessUDPInput: read"
);
}
rfbDisconnectUDPSock(
cl
);
rfbDisconnectUDPSock
(
rfbScreen
);
return
;
}
...
...
@@ -1408,7 +1431,7 @@ rfbProcessUDPInput(rfbClientPtr cl)
case
rfbKeyEvent
:
if
(
n
!=
sz_rfbKeyEventMsg
)
{
rfbLog
(
"rfbProcessUDPInput: key event incorrect length
\n
"
);
rfbDisconnectUDPSock(
cl
);
rfbDisconnectUDPSock
(
rfbScreen
);
return
;
}
cl
->
screen
->
kbdAddEvent
(
msg
.
ke
.
down
,
(
KeySym
)
Swap32IfLE
(
msg
.
ke
.
key
),
cl
);
...
...
@@ -1417,7 +1440,7 @@ rfbProcessUDPInput(rfbClientPtr cl)
case
rfbPointerEvent
:
if
(
n
!=
sz_rfbPointerEventMsg
)
{
rfbLog
(
"rfbProcessUDPInput: ptr event incorrect length
\n
"
);
rfbDisconnectUDPSock(
cl
);
rfbDisconnectUDPSock
(
rfbScreen
);
return
;
}
cl
->
screen
->
ptrAddEvent
(
msg
.
pe
.
buttonMask
,
...
...
@@ -1427,7 +1450,6 @@ rfbProcessUDPInput(rfbClientPtr cl)
default
:
rfbLog
(
"rfbProcessUDPInput: unknown message type %d
\n
"
,
msg
.
type
);
rfbDisconnectUDPSock(
cl
);
rfbDisconnectUDPSock
(
rfbScreen
);
}
}
#endif
rre.c
View file @
67094d7c
...
...
@@ -71,17 +71,17 @@ rfbSendRectEncodingRRE(cl, x, y, w, h)
if
(
rreBeforeBufSize
<
maxRawSize
)
{
rreBeforeBufSize
=
maxRawSize
;
if
(
rreBeforeBuf
==
NULL
)
rreBeforeBuf
=
(
char
*
)
x
alloc
(
rreBeforeBufSize
);
rreBeforeBuf
=
(
char
*
)
m
alloc
(
rreBeforeBufSize
);
else
rreBeforeBuf
=
(
char
*
)
x
realloc
(
rreBeforeBuf
,
rreBeforeBufSize
);
rreBeforeBuf
=
(
char
*
)
realloc
(
rreBeforeBuf
,
rreBeforeBufSize
);
}
if
(
rreAfterBufSize
<
maxRawSize
)
{
rreAfterBufSize
=
maxRawSize
;
if
(
rreAfterBuf
==
NULL
)
rreAfterBuf
=
(
char
*
)
x
alloc
(
rreAfterBufSize
);
rreAfterBuf
=
(
char
*
)
m
alloc
(
rreAfterBufSize
);
else
rreAfterBuf
=
(
char
*
)
x
realloc
(
rreAfterBuf
,
rreAfterBufSize
);
rreAfterBuf
=
(
char
*
)
realloc
(
rreAfterBuf
,
rreAfterBufSize
);
}
(
*
cl
->
translateFn
)(
cl
->
translateLookupTable
,
...
...
sockets.c
View file @
67094d7c
...
...
@@ -214,15 +214,14 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
}
if
((
rfbScreen
->
udpSock
!=
-
1
)
&&
FD_ISSET
(
rfbScreen
->
udpSock
,
&
fds
))
{
if
(
!
rfbScreen
->
udpClient
)
rfbNewUDPClient
(
rfbScreen
);
if
(
recvfrom
(
rfbScreen
->
udpSock
,
buf
,
1
,
MSG_PEEK
,
(
struct
sockaddr
*
)
&
addr
,
&
addrlen
)
<
0
)
{
rfbLogPerror
(
"rfbCheckFds: UDP: recvfrom"
);
rfbDisconnectUDPSock
(
rfbScreen
);
rfbScreen
->
udpSockConnected
=
FALSE
;
}
else
{
if
(
!
rfbScreen
->
udpSockConnected
||
(
memcmp
(
&
addr
,
&
rfbScreen
->
udpRemoteAddr
,
addrlen
)
!=
0
))
{
...
...
@@ -242,8 +241,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
rfbNewUDPConnection
(
rfbScreen
,
rfbScreen
->
udpSock
);
}
/* TODO: UDP also needs a client
rfbProcessUDPInput(rfbScreen,rfbScreen->udpSock); */
rfbProcessUDPInput
(
rfbScreen
);
}
FD_CLR
(
rfbScreen
->
udpSock
,
&
fds
);
...
...
@@ -263,7 +261,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
void
rfbDisconnectUDPSock
(
rfbScreenInfoPtr
rfbScreen
)
{
rfbScreen
->
udpSockConnected
=
FALSE
;
rfbScreen
->
udpSockConnected
=
FALSE
;
}
...
...
sraRegion.c
View file @
67094d7c
...
...
@@ -76,7 +76,7 @@ sraSpanRemove(sraSpan *span) {
void
sraSpanDestroy
(
sraSpan
*
span
)
{
if
(
span
->
subspan
)
sraSpanListDestroy
(
span
->
subspan
);
x
free
(
span
);
free
(
span
);
}
void
...
...
@@ -153,7 +153,7 @@ sraSpanListDestroy(sraSpanList *list) {
sraSpanDestroy
(
curr
);
curr
=
next
;
}
x
free
(
list
);
free
(
list
);
}
void
...
...
tableinit24.c
View file @
67094d7c
...
...
@@ -82,7 +82,7 @@ rfbInitTrueColourSingleTable24 (char **table, rfbPixelFormat *in,
int
nEntries
=
1
<<
in
->
bitsPerPixel
;
if
(
*
table
)
free
(
*
table
);
*
table
=
(
char
*
)
x
alloc
(
nEntries
*
3
+
1
);
*
table
=
(
char
*
)
m
alloc
(
nEntries
*
3
+
1
);
t
=
(
CARD8
*
)
*
table
;
for
(
i
=
0
;
i
<
nEntries
;
i
++
)
{
...
...
@@ -121,7 +121,7 @@ rfbInitTrueColourRGBTables24 (char **table, rfbPixelFormat *in,
CARD8
*
blueTable
;
if
(
*
table
)
free
(
*
table
);
*
table
=
(
char
*
)
x
alloc
((
in
->
redMax
+
in
->
greenMax
+
in
->
blueMax
+
3
)
*
table
=
(
char
*
)
m
alloc
((
in
->
redMax
+
in
->
greenMax
+
in
->
blueMax
+
3
)
*
3
+
1
);
redTable
=
(
CARD8
*
)
*
table
;
greenTable
=
redTable
+
3
*
(
in
->
redMax
+
1
);
...
...
tableinittctemplate.c
View file @
67094d7c
...
...
@@ -66,7 +66,7 @@ rfbInitTrueColourSingleTableOUT (char **table, rfbPixelFormat *in,
int
nEntries
=
1
<<
in
->
bitsPerPixel
;
if
(
*
table
)
free
(
*
table
);
*
table
=
(
char
*
)
x
alloc
(
nEntries
*
sizeof
(
OUT_T
));
*
table
=
(
char
*
)
m
alloc
(
nEntries
*
sizeof
(
OUT_T
));
t
=
(
OUT_T
*
)
*
table
;
for
(
i
=
0
;
i
<
nEntries
;
i
++
)
{
...
...
@@ -104,7 +104,7 @@ rfbInitTrueColourRGBTablesOUT (char **table, rfbPixelFormat *in,
OUT_T
*
blueTable
;
if
(
*
table
)
free
(
*
table
);
*
table
=
(
char
*
)
x
alloc
((
in
->
redMax
+
in
->
greenMax
+
in
->
blueMax
+
3
)
*
table
=
(
char
*
)
m
alloc
((
in
->
redMax
+
in
->
greenMax
+
in
->
blueMax
+
3
)
*
sizeof
(
OUT_T
));
redTable
=
(
OUT_T
*
)
*
table
;
greenTable
=
redTable
+
in
->
redMax
+
1
;
...
...
tight.c
View file @
67094d7c
...
...
@@ -241,9 +241,9 @@ rfbSendRectEncodingTight(cl, x, y, w, h)
if
(
tightBeforeBufSize
<
4
)
{
tightBeforeBufSize
=
4
;
if
(
tightBeforeBuf
==
NULL
)
tightBeforeBuf
=
(
char
*
)
x
alloc
(
tightBeforeBufSize
);
tightBeforeBuf
=
(
char
*
)
m
alloc
(
tightBeforeBufSize
);
else
tightBeforeBuf
=
(
char
*
)
x
realloc
(
tightBeforeBuf
,
tightBeforeBuf
=
(
char
*
)
realloc
(
tightBeforeBuf
,
tightBeforeBufSize
);
}
...
...
@@ -503,18 +503,18 @@ SendRectSimple(cl, x, y, w, h)
if
(
tightBeforeBufSize
<
maxBeforeSize
)
{
tightBeforeBufSize
=
maxBeforeSize
;
if
(
tightBeforeBuf
==
NULL
)
tightBeforeBuf
=
(
char
*
)
x
alloc
(
tightBeforeBufSize
);
tightBeforeBuf
=
(
char
*
)
m
alloc
(
tightBeforeBufSize
);
else
tightBeforeBuf
=
(
char
*
)
x
realloc
(
tightBeforeBuf
,
tightBeforeBuf
=
(
char
*
)
realloc
(
tightBeforeBuf
,
tightBeforeBufSize
);
}
if
(
tightAfterBufSize
<
maxAfterSize
)
{
tightAfterBufSize
=
maxAfterSize
;
if
(
tightAfterBuf
==
NULL
)
tightAfterBuf
=
(
char
*
)
x
alloc
(
tightAfterBufSize
);
tightAfterBuf
=
(
char
*
)
m
alloc
(
tightAfterBufSize
);
else
tightAfterBuf
=
(
char
*
)
x
realloc
(
tightAfterBuf
,
tightAfterBuf
=
(
char
*
)
realloc
(
tightAfterBuf
,
tightAfterBufSize
);
}
...
...
@@ -844,7 +844,7 @@ SendGradientRect(cl, w, h)
}
if
(
prevRowBuf
==
NULL
)
prevRowBuf
=
(
int
*
)
x
alloc
(
2048
*
3
*
sizeof
(
int
));
prevRowBuf
=
(
int
*
)
m
alloc
(
2048
*
3
*
sizeof
(
int
));
cl
->
updateBuf
[
cl
->
ublen
++
]
=
(
streamId
|
rfbTightExplicitFilter
)
<<
4
;
cl
->
updateBuf
[
cl
->
ublen
++
]
=
rfbTightFilterGradient
;
...
...
@@ -1645,7 +1645,7 @@ SendJpegRect(cl, x, y, w, h, quality)
if
(
cl
->
screen
->
rfbServerFormat
.
bitsPerPixel
==
8
)
return
SendFullColorRect
(
cl
,
w
,
h
);
srcBuf
=
(
CARD8
*
)
x
alloc
(
w
*
3
);
srcBuf
=
(
CARD8
*
)
m
alloc
(
w
*
3
);
if
(
srcBuf
==
NULL
)
{
return
SendFullColorRect
(
cl
,
w
,
h
);
}
...
...
zlib.c
View file @
67094d7c
...
...
@@ -75,9 +75,9 @@ rfbSendOneRectEncodingZlib(cl, x, y, w, h)
if
(
zlibBeforeBufSize
<
maxRawSize
)
{
zlibBeforeBufSize
=
maxRawSize
;
if
(
zlibBeforeBuf
==
NULL
)
zlibBeforeBuf
=
(
char
*
)
x
alloc
(
zlibBeforeBufSize
);
zlibBeforeBuf
=
(
char
*
)
m
alloc
(
zlibBeforeBufSize
);
else
zlibBeforeBuf
=
(
char
*
)
x
realloc
(
zlibBeforeBuf
,
zlibBeforeBufSize
);
zlibBeforeBuf
=
(
char
*
)
realloc
(
zlibBeforeBuf
,
zlibBeforeBufSize
);
}
/* zlib compression is not useful for very small data sets.
...
...
@@ -115,9 +115,9 @@ rfbSendOneRectEncodingZlib(cl, x, y, w, h)
if
(
zlibAfterBufSize
<
maxCompSize
)
{
zlibAfterBufSize
=
maxCompSize
;
if
(
zlibAfterBuf
==
NULL
)
zlibAfterBuf
=
(
char
*
)
x
alloc
(
zlibAfterBufSize
);
zlibAfterBuf
=
(
char
*
)
m
alloc
(
zlibAfterBufSize
);
else
zlibAfterBuf
=
(
char
*
)
x
realloc
(
zlibAfterBuf
,
zlibAfterBufSize
);
zlibAfterBuf
=
(
char
*
)
realloc
(
zlibAfterBuf
,
zlibAfterBufSize
);
}
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment