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
8bee4eb9
Commit
8bee4eb9
authored
May 15, 2005
by
dscho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ANSIfy, fix some warnings from Linus' sparse
parent
be5b1296
Changes
48
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
48 changed files
with
578 additions
and
591 deletions
+578
-591
ChangeLog
ChangeLog
+3
-0
configure.ac
VisualNaCro/configure.ac
+1
-1
default8x16.h
VisualNaCro/default8x16.h
+3
-3
nacro.c
VisualNaCro/nacro.c
+29
-29
SDLvncviewer.c
client_examples/SDLvncviewer.c
+3
-2
ppmtest.c
client_examples/ppmtest.c
+9
-9
zippy.c
contrib/zippy.c
+4
-4
example.c
examples/example.c
+16
-12
fontsel.c
examples/fontsel.c
+5
-5
pnmshow.c
examples/pnmshow.c
+3
-1
pnmshow24.c
examples/pnmshow24.c
+1
-1
radon.h
examples/radon.h
+3
-3
storepasswd.c
examples/storepasswd.c
+1
-1
vncev.c
examples/vncev.c
+15
-12
listen.c
libvncclient/listen.c
+1
-0
rfbproto.c
libvncclient/rfbproto.c
+13
-11
sockets.c
libvncclient/sockets.c
+1
-0
vncviewer.c
libvncclient/vncviewer.c
+7
-4
auth.c
libvncserver/auth.c
+2
-4
cargs.c
libvncserver/cargs.c
+2
-8
corre.c
libvncserver/corre.c
+14
-17
cursor.c
libvncserver/cursor.c
+10
-8
d3des.c
libvncserver/d3des.c
+13
-19
font.c
libvncserver/font.c
+3
-3
hextile.c
libvncserver/hextile.c
+30
-37
httpd.c
libvncserver/httpd.c
+3
-3
main.c
libvncserver/main.c
+23
-31
private.h
libvncserver/private.h
+23
-0
rfbregion.c
libvncserver/rfbregion.c
+28
-26
rfbserver.c
libvncserver/rfbserver.c
+53
-70
rre.c
libvncserver/rre.c
+13
-18
selbox.c
libvncserver/selbox.c
+2
-2
sockets.c
libvncserver/sockets.c
+14
-20
tight.c
libvncserver/tight.c
+143
-157
translate.c
libvncserver/translate.c
+10
-19
vncauth.c
libvncserver/vncauth.c
+7
-1
zlib.c
libvncserver/zlib.c
+11
-7
zrle.c
libvncserver/zrle.c
+2
-1
zrleencodetemplate.c
libvncserver/zrleencodetemplate.c
+1
-1
zrleoutstream.c
libvncserver/zrleoutstream.c
+1
-2
default8x16.h
rfb/default8x16.h
+3
-3
rfb.h
rfb/rfb.h
+4
-1
rfbproto.h
rfb/rfbproto.h
+4
-0
copyrecttest.c
test/copyrecttest.c
+3
-2
cursortest.c
test/cursortest.c
+10
-10
encodingstest.c
test/encodingstest.c
+26
-22
VNCommand.c
vncterm/VNCommand.c
+2
-0
VNConsole.c
vncterm/VNConsole.c
+0
-1
No files found.
ChangeLog
View file @
8bee4eb9
2005-05-15 Johannes E. Schindelin <Johannes.Schindelin@gmx.de>
* almost every file: ANSIfy, fix warnings from Linus' sparse
2005-05-14 Karl Runge <runge@karlrunge.com>
* x11vnc: more work on -scrollcopyrect and -xkb modes.
...
...
VisualNaCro/configure.ac
View file @
8bee4eb9
...
...
@@ -180,7 +180,7 @@ AC_ARG_WITH(perl5,[ --with-perl5=path Set location of Perl5 executable],[
# First figure out what the name of Perl5 is
if test -z "$PERLBIN"; then
AC_CHECK_PROGS(PERL, perl perl5.6.1 perl5.6.0 perl5.004 perl5.003 perl5.002 perl5.001 perl5 perl)
AC_CHECK_PROGS(PERL, perl perl5.
8.1 perl5.
6.1 perl5.6.0 perl5.004 perl5.003 perl5.002 perl5.001 perl5 perl)
else
PERL="$PERLBIN"
fi
...
...
VisualNaCro/default8x16.h
View file @
8bee4eb9
unsigned
char
default8x16FontData
[
4096
+
1
]
=
{
static
unsigned
char
default8x16FontData
[
4096
+
1
]
=
{
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x7e
,
0x81
,
0xa5
,
0x81
,
0x81
,
0xbd
,
0x99
,
0x81
,
0x81
,
0x7e
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x7e
,
0xff
,
0xdb
,
0xff
,
0xff
,
0xc3
,
0xe7
,
0xff
,
0xff
,
0x7e
,
0x00
,
0x00
,
0x00
,
0x00
,
...
...
@@ -256,6 +256,6 @@ unsigned char default8x16FontData[4096+1]={
0x00
,
0x00
,
0x00
,
0x00
,
0x7c
,
0x7c
,
0x7c
,
0x7c
,
0x7c
,
0x7c
,
0x7c
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
};
int
default8x16FontMetaData
[
256
*
5
+
1
]
=
{
static
int
default8x16FontMetaData
[
256
*
5
+
1
]
=
{
0
,
8
,
16
,
0
,
0
,
16
,
8
,
16
,
0
,
0
,
32
,
8
,
16
,
0
,
0
,
48
,
8
,
16
,
0
,
0
,
64
,
8
,
16
,
0
,
0
,
80
,
8
,
16
,
0
,
0
,
96
,
8
,
16
,
0
,
0
,
112
,
8
,
16
,
0
,
0
,
128
,
8
,
16
,
0
,
0
,
144
,
8
,
16
,
0
,
0
,
160
,
8
,
16
,
0
,
0
,
176
,
8
,
16
,
0
,
0
,
192
,
8
,
16
,
0
,
0
,
208
,
8
,
16
,
0
,
0
,
224
,
8
,
16
,
0
,
0
,
240
,
8
,
16
,
0
,
0
,
256
,
8
,
16
,
0
,
0
,
272
,
8
,
16
,
0
,
0
,
288
,
8
,
16
,
0
,
0
,
304
,
8
,
16
,
0
,
0
,
320
,
8
,
16
,
0
,
0
,
336
,
8
,
16
,
0
,
0
,
352
,
8
,
16
,
0
,
0
,
368
,
8
,
16
,
0
,
0
,
384
,
8
,
16
,
0
,
0
,
400
,
8
,
16
,
0
,
0
,
416
,
8
,
16
,
0
,
0
,
432
,
8
,
16
,
0
,
0
,
448
,
8
,
16
,
0
,
0
,
464
,
8
,
16
,
0
,
0
,
480
,
8
,
16
,
0
,
0
,
496
,
8
,
16
,
0
,
0
,
512
,
8
,
16
,
0
,
0
,
528
,
8
,
16
,
0
,
0
,
544
,
8
,
16
,
0
,
0
,
560
,
8
,
16
,
0
,
0
,
576
,
8
,
16
,
0
,
0
,
592
,
8
,
16
,
0
,
0
,
608
,
8
,
16
,
0
,
0
,
624
,
8
,
16
,
0
,
0
,
640
,
8
,
16
,
0
,
0
,
656
,
8
,
16
,
0
,
0
,
672
,
8
,
16
,
0
,
0
,
688
,
8
,
16
,
0
,
0
,
704
,
8
,
16
,
0
,
0
,
720
,
8
,
16
,
0
,
0
,
736
,
8
,
16
,
0
,
0
,
752
,
8
,
16
,
0
,
0
,
768
,
8
,
16
,
0
,
0
,
784
,
8
,
16
,
0
,
0
,
800
,
8
,
16
,
0
,
0
,
816
,
8
,
16
,
0
,
0
,
832
,
8
,
16
,
0
,
0
,
848
,
8
,
16
,
0
,
0
,
864
,
8
,
16
,
0
,
0
,
880
,
8
,
16
,
0
,
0
,
896
,
8
,
16
,
0
,
0
,
912
,
8
,
16
,
0
,
0
,
928
,
8
,
16
,
0
,
0
,
944
,
8
,
16
,
0
,
0
,
960
,
8
,
16
,
0
,
0
,
976
,
8
,
16
,
0
,
0
,
992
,
8
,
16
,
0
,
0
,
1008
,
8
,
16
,
0
,
0
,
1024
,
8
,
16
,
0
,
0
,
1040
,
8
,
16
,
0
,
0
,
1056
,
8
,
16
,
0
,
0
,
1072
,
8
,
16
,
0
,
0
,
1088
,
8
,
16
,
0
,
0
,
1104
,
8
,
16
,
0
,
0
,
1120
,
8
,
16
,
0
,
0
,
1136
,
8
,
16
,
0
,
0
,
1152
,
8
,
16
,
0
,
0
,
1168
,
8
,
16
,
0
,
0
,
1184
,
8
,
16
,
0
,
0
,
1200
,
8
,
16
,
0
,
0
,
1216
,
8
,
16
,
0
,
0
,
1232
,
8
,
16
,
0
,
0
,
1248
,
8
,
16
,
0
,
0
,
1264
,
8
,
16
,
0
,
0
,
1280
,
8
,
16
,
0
,
0
,
1296
,
8
,
16
,
0
,
0
,
1312
,
8
,
16
,
0
,
0
,
1328
,
8
,
16
,
0
,
0
,
1344
,
8
,
16
,
0
,
0
,
1360
,
8
,
16
,
0
,
0
,
1376
,
8
,
16
,
0
,
0
,
1392
,
8
,
16
,
0
,
0
,
1408
,
8
,
16
,
0
,
0
,
1424
,
8
,
16
,
0
,
0
,
1440
,
8
,
16
,
0
,
0
,
1456
,
8
,
16
,
0
,
0
,
1472
,
8
,
16
,
0
,
0
,
1488
,
8
,
16
,
0
,
0
,
1504
,
8
,
16
,
0
,
0
,
1520
,
8
,
16
,
0
,
0
,
1536
,
8
,
16
,
0
,
0
,
1552
,
8
,
16
,
0
,
0
,
1568
,
8
,
16
,
0
,
0
,
1584
,
8
,
16
,
0
,
0
,
1600
,
8
,
16
,
0
,
0
,
1616
,
8
,
16
,
0
,
0
,
1632
,
8
,
16
,
0
,
0
,
1648
,
8
,
16
,
0
,
0
,
1664
,
8
,
16
,
0
,
0
,
1680
,
8
,
16
,
0
,
0
,
1696
,
8
,
16
,
0
,
0
,
1712
,
8
,
16
,
0
,
0
,
1728
,
8
,
16
,
0
,
0
,
1744
,
8
,
16
,
0
,
0
,
1760
,
8
,
16
,
0
,
0
,
1776
,
8
,
16
,
0
,
0
,
1792
,
8
,
16
,
0
,
0
,
1808
,
8
,
16
,
0
,
0
,
1824
,
8
,
16
,
0
,
0
,
1840
,
8
,
16
,
0
,
0
,
1856
,
8
,
16
,
0
,
0
,
1872
,
8
,
16
,
0
,
0
,
1888
,
8
,
16
,
0
,
0
,
1904
,
8
,
16
,
0
,
0
,
1920
,
8
,
16
,
0
,
0
,
1936
,
8
,
16
,
0
,
0
,
1952
,
8
,
16
,
0
,
0
,
1968
,
8
,
16
,
0
,
0
,
1984
,
8
,
16
,
0
,
0
,
2000
,
8
,
16
,
0
,
0
,
2016
,
8
,
16
,
0
,
0
,
2032
,
8
,
16
,
0
,
0
,
2048
,
8
,
16
,
0
,
0
,
2064
,
8
,
16
,
0
,
0
,
2080
,
8
,
16
,
0
,
0
,
2096
,
8
,
16
,
0
,
0
,
2112
,
8
,
16
,
0
,
0
,
2128
,
8
,
16
,
0
,
0
,
2144
,
8
,
16
,
0
,
0
,
2160
,
8
,
16
,
0
,
0
,
2176
,
8
,
16
,
0
,
0
,
2192
,
8
,
16
,
0
,
0
,
2208
,
8
,
16
,
0
,
0
,
2224
,
8
,
16
,
0
,
0
,
2240
,
8
,
16
,
0
,
0
,
2256
,
8
,
16
,
0
,
0
,
2272
,
8
,
16
,
0
,
0
,
2288
,
8
,
16
,
0
,
0
,
2304
,
8
,
16
,
0
,
0
,
2320
,
8
,
16
,
0
,
0
,
2336
,
8
,
16
,
0
,
0
,
2352
,
8
,
16
,
0
,
0
,
2368
,
8
,
16
,
0
,
0
,
2384
,
8
,
16
,
0
,
0
,
2400
,
8
,
16
,
0
,
0
,
2416
,
8
,
16
,
0
,
0
,
2432
,
8
,
16
,
0
,
0
,
2448
,
8
,
16
,
0
,
0
,
2464
,
8
,
16
,
0
,
0
,
2480
,
8
,
16
,
0
,
0
,
2496
,
8
,
16
,
0
,
0
,
2512
,
8
,
16
,
0
,
0
,
2528
,
8
,
16
,
0
,
0
,
2544
,
8
,
16
,
0
,
0
,
2560
,
8
,
16
,
0
,
0
,
2576
,
8
,
16
,
0
,
0
,
2592
,
8
,
16
,
0
,
0
,
2608
,
8
,
16
,
0
,
0
,
2624
,
8
,
16
,
0
,
0
,
2640
,
8
,
16
,
0
,
0
,
2656
,
8
,
16
,
0
,
0
,
2672
,
8
,
16
,
0
,
0
,
2688
,
8
,
16
,
0
,
0
,
2704
,
8
,
16
,
0
,
0
,
2720
,
8
,
16
,
0
,
0
,
2736
,
8
,
16
,
0
,
0
,
2752
,
8
,
16
,
0
,
0
,
2768
,
8
,
16
,
0
,
0
,
2784
,
8
,
16
,
0
,
0
,
2800
,
8
,
16
,
0
,
0
,
2816
,
8
,
16
,
0
,
0
,
2832
,
8
,
16
,
0
,
0
,
2848
,
8
,
16
,
0
,
0
,
2864
,
8
,
16
,
0
,
0
,
2880
,
8
,
16
,
0
,
0
,
2896
,
8
,
16
,
0
,
0
,
2912
,
8
,
16
,
0
,
0
,
2928
,
8
,
16
,
0
,
0
,
2944
,
8
,
16
,
0
,
0
,
2960
,
8
,
16
,
0
,
0
,
2976
,
8
,
16
,
0
,
0
,
2992
,
8
,
16
,
0
,
0
,
3008
,
8
,
16
,
0
,
0
,
3024
,
8
,
16
,
0
,
0
,
3040
,
8
,
16
,
0
,
0
,
3056
,
8
,
16
,
0
,
0
,
3072
,
8
,
16
,
0
,
0
,
3088
,
8
,
16
,
0
,
0
,
3104
,
8
,
16
,
0
,
0
,
3120
,
8
,
16
,
0
,
0
,
3136
,
8
,
16
,
0
,
0
,
3152
,
8
,
16
,
0
,
0
,
3168
,
8
,
16
,
0
,
0
,
3184
,
8
,
16
,
0
,
0
,
3200
,
8
,
16
,
0
,
0
,
3216
,
8
,
16
,
0
,
0
,
3232
,
8
,
16
,
0
,
0
,
3248
,
8
,
16
,
0
,
0
,
3264
,
8
,
16
,
0
,
0
,
3280
,
8
,
16
,
0
,
0
,
3296
,
8
,
16
,
0
,
0
,
3312
,
8
,
16
,
0
,
0
,
3328
,
8
,
16
,
0
,
0
,
3344
,
8
,
16
,
0
,
0
,
3360
,
8
,
16
,
0
,
0
,
3376
,
8
,
16
,
0
,
0
,
3392
,
8
,
16
,
0
,
0
,
3408
,
8
,
16
,
0
,
0
,
3424
,
8
,
16
,
0
,
0
,
3440
,
8
,
16
,
0
,
0
,
3456
,
8
,
16
,
0
,
0
,
3472
,
8
,
16
,
0
,
0
,
3488
,
8
,
16
,
0
,
0
,
3504
,
8
,
16
,
0
,
0
,
3520
,
8
,
16
,
0
,
0
,
3536
,
8
,
16
,
0
,
0
,
3552
,
8
,
16
,
0
,
0
,
3568
,
8
,
16
,
0
,
0
,
3584
,
8
,
16
,
0
,
0
,
3600
,
8
,
16
,
0
,
0
,
3616
,
8
,
16
,
0
,
0
,
3632
,
8
,
16
,
0
,
0
,
3648
,
8
,
16
,
0
,
0
,
3664
,
8
,
16
,
0
,
0
,
3680
,
8
,
16
,
0
,
0
,
3696
,
8
,
16
,
0
,
0
,
3712
,
8
,
16
,
0
,
0
,
3728
,
8
,
16
,
0
,
0
,
3744
,
8
,
16
,
0
,
0
,
3760
,
8
,
16
,
0
,
0
,
3776
,
8
,
16
,
0
,
0
,
3792
,
8
,
16
,
0
,
0
,
3808
,
8
,
16
,
0
,
0
,
3824
,
8
,
16
,
0
,
0
,
3840
,
8
,
16
,
0
,
0
,
3856
,
8
,
16
,
0
,
0
,
3872
,
8
,
16
,
0
,
0
,
3888
,
8
,
16
,
0
,
0
,
3904
,
8
,
16
,
0
,
0
,
3920
,
8
,
16
,
0
,
0
,
3936
,
8
,
16
,
0
,
0
,
3952
,
8
,
16
,
0
,
0
,
3968
,
8
,
16
,
0
,
0
,
3984
,
8
,
16
,
0
,
0
,
4000
,
8
,
16
,
0
,
0
,
4016
,
8
,
16
,
0
,
0
,
4032
,
8
,
16
,
0
,
0
,
4048
,
8
,
16
,
0
,
0
,
4064
,
8
,
16
,
0
,
0
,
4080
,
8
,
16
,
0
,
0
,};
rfbFontData
default8x16Font
=
{
default8x16FontData
,
default8x16FontMetaData
};
static
rfbFontData
default8x16Font
=
{
default8x16FontData
,
default8x16FontMetaData
};
VisualNaCro/nacro.c
View file @
8bee4eb9
...
...
@@ -36,14 +36,14 @@ typedef struct private_resource_t {
static
private_resource_t
resource_pool
[
MAX_RESOURCE_COUNT
];
static
int
resource_count
=
0
;
private_resource_t
*
get_resource
(
int
resource
)
static
private_resource_t
*
get_resource
(
int
resource
)
{
if
(
resource
>=
MAX_RESOURCE_COUNT
||
resource
<
0
||
resource_pool
[
resource
].
client
==
0
)
return
0
;
return
NULL
;
return
resource_pool
+
resource
;
}
private_resource_t
*
get_next_resource
(
)
static
private_resource_t
*
get_next_resource
(
void
)
{
if
(
resource_count
<
MAX_RESOURCE_COUNT
)
{
memset
(
resource_pool
+
resource_count
,
0
,
sizeof
(
private_resource_t
));
...
...
@@ -56,19 +56,19 @@ private_resource_t* get_next_resource()
if
(
i
<
MAX_RESOURCE_COUNT
)
return
resource_pool
+
i
;
}
return
0
;
return
NULL
;
}
void
free_resource
(
int
resource
)
static
void
free_resource
(
int
resource
)
{
private_resource_t
*
res
=
get_resource
(
resource
);
if
(
res
)
res
->
client
=
0
;
res
->
client
=
NULL
;
}
/* hooks */
void
got_key
(
rfbBool
down
,
rfbKeySym
keysym
,
rfbClientRec
*
cl
)
static
void
got_key
(
rfbBool
down
,
rfbKeySym
keysym
,
rfbClientRec
*
cl
)
{
private_resource_t
*
res
=
(
private_resource_t
*
)
cl
->
screen
->
screenData
;
...
...
@@ -77,7 +77,7 @@ void got_key(rfbBool down,rfbKeySym keysym,rfbClientRec* cl)
res
->
result
|=
RESULT_KEY
;
}
void
got_mouse
(
int
buttons
,
int
x
,
int
y
,
rfbClientRec
*
cl
)
static
void
got_mouse
(
int
buttons
,
int
x
,
int
y
,
rfbClientRec
*
cl
)
{
private_resource_t
*
res
=
(
private_resource_t
*
)
cl
->
screen
->
screenData
;
...
...
@@ -87,7 +87,7 @@ void got_mouse(int buttons,int x,int y,rfbClientRec* cl)
res
->
result
|=
RESULT_MOUSE
;
}
rfbBool
malloc_frame_buffer
(
rfbClient
*
cl
)
static
rfbBool
malloc_frame_buffer
(
rfbClient
*
cl
)
{
private_resource_t
*
res
=
(
private_resource_t
*
)
cl
->
clientData
;
...
...
@@ -96,7 +96,7 @@ rfbBool malloc_frame_buffer(rfbClient* cl)
res
->
client
->
frameBuffer
=
malloc
(
w
*
4
*
h
);
res
->
server
=
rfbGetScreen
(
0
,
0
,
w
,
h
,
8
,
3
,
4
);
res
->
server
=
rfbGetScreen
(
NULL
,
NULL
,
w
,
h
,
8
,
3
,
4
);
res
->
server
->
screenData
=
res
;
res
->
server
->
port
=
res
->
listen_port
;
res
->
server
->
frameBuffer
=
res
->
client
->
frameBuffer
;
...
...
@@ -110,7 +110,7 @@ rfbBool malloc_frame_buffer(rfbClient* cl)
}
}
bool_t
do_visual_grep
(
private_resource_t
*
res
,
int
x
,
int
y
,
int
w
,
int
h
)
static
bool_t
do_visual_grep
(
private_resource_t
*
res
,
int
x
,
int
y
,
int
w
,
int
h
)
{
rfbClient
*
cl
;
image_t
*
image
;
...
...
@@ -146,7 +146,7 @@ bool_t do_visual_grep(private_resource_t* res,int x,int y,int w,int h)
return
0
;
}
void
got_frame_buffer
(
rfbClient
*
cl
,
int
x
,
int
y
,
int
w
,
int
h
)
static
void
got_frame_buffer
(
rfbClient
*
cl
,
int
x
,
int
y
,
int
w
,
int
h
)
{
private_resource_t
*
res
=
(
private_resource_t
*
)
cl
->
clientData
;
...
...
@@ -182,8 +182,8 @@ resource_t initvnc(const char* server,int server_port,int listen_port)
res
->
client
->
serverHost
=
strdup
(
server
);
res
->
client
->
serverPort
=
server_port
;
res
->
client
->
appData
.
encodingsString
=
"raw"
;
if
(
!
rfbInitClient
(
res
->
client
,
&
dummy
,
0
))
{
res
->
client
=
0
;
if
(
!
rfbInitClient
(
res
->
client
,
&
dummy
,
NULL
))
{
res
->
client
=
NULL
;
return
-
1
;
}
return
res
-
resource_pool
;
...
...
@@ -202,7 +202,7 @@ void closevnc(resource_t resource)
rfbClientCleanup
(
res
->
client
);
res
->
client
=
0
;
res
->
client
=
NULL
;
}
/* PNM (image) helpers */
...
...
@@ -240,7 +240,7 @@ bool_t savepnm(resource_t resource,const char* filename,int x1,int y1,int x2,int
return
TRUE
;
}
image_t
*
loadpnm
(
const
char
*
filename
)
static
image_t
*
loadpnm
(
const
char
*
filename
)
{
FILE
*
f
=
fopen
(
filename
,
"rb"
);
char
buffer
[
1024
];
...
...
@@ -248,25 +248,25 @@ image_t* loadpnm(const char* filename)
image_t
*
image
;
if
(
f
==
0
)
return
0
;
return
NULL
;
if
(
!
fgets
(
buffer
,
1024
,
f
)
||
strcmp
(
"P6
\n
"
,
buffer
))
{
fclose
(
f
);
return
0
;
return
NULL
;
}
do
{
fgets
(
buffer
,
1024
,
f
);
if
(
feof
(
f
))
{
fclose
(
f
);
return
0
;
return
NULL
;
}
}
while
(
buffer
[
0
]
==
'#'
);
if
(
sscanf
(
buffer
,
"%d %d"
,
&
w
,
&
h
)
!=
2
||
!
fgets
(
buffer
,
1024
,
f
)
||
strcmp
(
"255
\n
"
,
buffer
))
{
fclose
(
f
);
return
0
;
return
NULL
;
}
image
=
(
image_t
*
)
malloc
(
sizeof
(
image_t
));
...
...
@@ -276,7 +276,7 @@ image_t* loadpnm(const char* filename)
if
(
!
image
->
buffer
)
{
fclose
(
f
);
free
(
image
);
return
0
;
return
NULL
;
}
for
(
j
=
0
;
j
<
h
;
j
++
)
...
...
@@ -286,7 +286,7 @@ image_t* loadpnm(const char* filename)
fclose
(
f
);
free
(
image
->
buffer
);
free
(
image
);
return
0
;
return
NULL
;
}
fclose
(
f
);
...
...
@@ -294,7 +294,7 @@ image_t* loadpnm(const char* filename)
return
image
;
}
void
free_image
(
image_t
*
image
)
static
void
free_image
(
image_t
*
image
)
{
if
(
image
->
buffer
)
free
(
image
->
buffer
);
...
...
@@ -304,7 +304,7 @@ void free_image(image_t* image)
/* process() and friends */
/* this function returns only if res->result in return_mask */
result_t
private_process
(
resource_t
resource
,
timeout_t
timeout_in_seconds
,
result_t
return_mask
)
static
result_t
private_process
(
resource_t
resource
,
timeout_t
timeout_in_seconds
,
result_t
return_mask
)
{
private_resource_t
*
res
=
get_resource
(
resource
);
fd_set
fds
;
...
...
@@ -317,7 +317,7 @@ result_t private_process(resource_t resource,timeout_t timeout_in_seconds,result
assert
(
res
->
client
);
gettimeofday
(
&
tv_start
,
0
);
gettimeofday
(
&
tv_start
,
NULL
);
res
->
result
=
0
;
do
{
...
...
@@ -346,7 +346,7 @@ result_t private_process(resource_t resource,timeout_t timeout_in_seconds,result
if
(
res
->
client
->
sock
>
max_fd
)
max_fd
=
res
->
client
->
sock
;
gettimeofday
(
&
tv_end
,
0
);
gettimeofday
(
&
tv_end
,
NULL
);
timeout_done
=
tv_end
.
tv_usec
-
tv_start
.
tv_usec
+
1000000L
*
(
tv_end
.
tv_sec
-
tv_start
.
tv_sec
);
if
(
timeout_done
>=
timeout
)
...
...
@@ -355,7 +355,7 @@ result_t private_process(resource_t resource,timeout_t timeout_in_seconds,result
tv
.
tv_usec
=
((
timeout
-
timeout_done
)
%
1000000
);
tv
.
tv_sec
=
(
timeout
-
timeout_done
)
/
1000000
;
count
=
select
(
max_fd
+
1
,
&
fds
,
0
,
0
,
&
tv
);
count
=
select
(
max_fd
+
1
,
&
fds
,
NULL
,
NULL
,
&
tv
);
if
(
count
<
0
)
return
0
;
...
...
@@ -422,7 +422,7 @@ result_t visualgrep(resource_t resource,const char* filename,timeout_t timeout)
/* free image */
if
(
res
->
grep_image
)
{
free_image
(
res
->
grep_image
);
res
->
grep_image
=
0
;
res
->
grep_image
=
NULL
;
}
return
result
;
...
...
@@ -432,7 +432,7 @@ result_t visualgrep(resource_t resource,const char* filename,timeout_t timeout)
#include "default8x16.h"
void
center_text
(
rfbScreenInfo
*
screen
,
const
char
*
message
,
int
*
x
,
int
*
y
,
int
*
w
,
int
*
h
)
static
void
center_text
(
rfbScreenInfo
*
screen
,
const
char
*
message
,
int
*
x
,
int
*
y
,
int
*
w
,
int
*
h
)
{
rfbFontData
*
font
=&
default8x16Font
;
const
char
*
pointer
;
...
...
client_examples/SDLvncviewer.c
View file @
8bee4eb9
...
...
@@ -46,7 +46,7 @@ static rfbBool resize(rfbClient* client) {
return
TRUE
;
}
rfbKeySym
SDL_keysym2rfbKeySym
(
int
keysym
)
{
static
rfbKeySym
SDL_keysym2rfbKeySym
(
int
keysym
)
{
switch
(
keysym
)
{
case
SDLK_BACKSPACE
:
return
XK_BackSpace
;
case
SDLK_TAB
:
return
XK_ISO_Left_Tab
;
...
...
@@ -184,9 +184,10 @@ rfbKeySym SDL_keysym2rfbKeySym(int keysym) {
case
SDLK_BREAK
:
return
XK_Break
;
default:
rfbClientLog
(
"Unknown keysym: %d
\n
"
,
keysym
);
}
return
0
;
}
void
update
(
rfbClient
*
cl
,
int
x
,
int
y
,
int
w
,
int
h
)
{
static
void
update
(
rfbClient
*
cl
,
int
x
,
int
y
,
int
w
,
int
h
)
{
SDL_UpdateRect
(
cl
->
clientData
,
x
,
y
,
w
,
h
);
}
...
...
client_examples/ppmtest.c
View file @
8bee4eb9
...
...
@@ -6,11 +6,11 @@
#include <errno.h>
#include <rfb/rfbclient.h>
void
PrintRect
(
rfbClient
*
client
,
int
x
,
int
y
,
int
w
,
int
h
)
{
static
void
PrintRect
(
rfbClient
*
client
,
int
x
,
int
y
,
int
w
,
int
h
)
{
rfbClientLog
(
"Received an update for %d,%d,%d,%d.
\n
"
,
x
,
y
,
w
,
h
);
}
void
SaveFramebufferAsPPM
(
rfbClient
*
client
,
int
x
,
int
y
,
int
w
,
int
h
)
{
static
void
SaveFramebufferAsPPM
(
rfbClient
*
client
,
int
x
,
int
y
,
int
w
,
int
h
)
{
static
time_t
t
=
0
,
t1
;
FILE
*
f
;
int
i
,
j
;
...
...
@@ -19,7 +19,7 @@ void SaveFramebufferAsPPM(rfbClient* client, int x, int y, int w, int h) {
int
row_stride
=
client
->
width
*
bpp
;
/* save one picture only if the last is older than 2 seconds */
t1
=
time
(
0
);
t1
=
time
(
NULL
);
if
(
t1
-
t
>
2
)
t
=
t1
;
else
...
...
@@ -46,6 +46,8 @@ void SaveFramebufferAsPPM(rfbClient* client, int x, int y, int w, int h) {
v
=*
(
unsigned
int
*
)
p
;
else
if
(
bpp
==
2
)
v
=*
(
unsigned
short
*
)
p
;
else
v
=*
(
unsigned
char
*
)
p
;
fputc
((
v
>>
pf
->
redShift
)
*
256
/
(
pf
->
redMax
+
1
),
f
);
fputc
((
v
>>
pf
->
greenShift
)
*
256
/
(
pf
->
greenMax
+
1
),
f
);
fputc
((
v
>>
pf
->
blueShift
)
*
256
/
(
pf
->
blueMax
+
1
),
f
);
...
...
@@ -53,14 +55,11 @@ void SaveFramebufferAsPPM(rfbClient* client, int x, int y, int w, int h) {
fclose
(
f
);
}
int
int
main
(
int
argc
,
char
**
argv
)
{
int
i
;
rfbClient
*
client
=
rfbGetClient
(
8
,
3
,
4
);
const
char
*
vncServerHost
=
""
;
int
vncServerPort
=
5900
;
time_t
t
=
time
(
0
);
time_t
t
=
time
(
NULL
);
if
(
argc
>
1
&&
!
strcmp
(
"-print"
,
argv
[
1
]))
{
client
->
GotFrameBufferUpdate
=
PrintRect
;
...
...
@@ -81,7 +80,8 @@ main(int argc, char **argv)
if
(
!
rfbInitClient
(
client
,
&
argc
,
argv
))
return
1
;
while
(
time
(
0
)
-
t
<
5
)
{
/* TODO: better wait for update completion */
while
(
time
(
NULL
)
-
t
<
5
)
{
static
int
i
=
0
;
fprintf
(
stderr
,
"
\r
%d"
,
i
++
);
if
(
WaitForMessage
(
client
,
50
)
<
0
)
...
...
contrib/zippy.c
View file @
8bee4eb9
...
...
@@ -4,7 +4,7 @@
#include <rfb/keysym.h>
#include <rfb/default8x16.h>
int
maxx
=
400
,
maxy
=
400
,
bpp
=
4
;
static
int
maxx
=
400
,
maxy
=
400
,
bpp
=
4
;
/* odd maxx doesn't work (vncviewer bug) */
/* Here we create a structure so that every client has it's own pointer */
...
...
@@ -74,7 +74,7 @@ void draw_primary_colors (char* frame_buffer, int x1, int y1, int x2, int y2)
}
/* Dscho's versions (slower, but works for bpp != 3 or 4) */
void
draw_primary_colours_generic
(
rfbScreenInfoPtr
s
,
int
x1
,
int
y1
,
int
x2
,
int
y2
)
static
void
draw_primary_colours_generic
(
rfbScreenInfoPtr
s
,
int
x1
,
int
y1
,
int
x2
,
int
y2
)
{
rfbPixelFormat
f
=
s
->
serverFormat
;
int
i
,
j
;
...
...
@@ -88,7 +88,7 @@ void draw_primary_colours_generic(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2
rfbDrawPixel
(
s
,
i
,
j
,
f
.
blueMax
<<
f
.
blueShift
);
}
void
draw_primary_colours_generic_fast
(
rfbScreenInfoPtr
s
,
int
x1
,
int
y1
,
int
x2
,
int
y2
)
static
void
draw_primary_colours_generic_fast
(
rfbScreenInfoPtr
s
,
int
x1
,
int
y1
,
int
x2
,
int
y2
)
{
rfbPixelFormat
f
=
s
->
serverFormat
;
int
i
,
j
,
y3
=
(
y1
*
2
+
y2
)
/
3
,
y4
=
(
y1
+
y2
*
2
)
/
3
;
...
...
@@ -106,7 +106,7 @@ void draw_primary_colours_generic_fast(rfbScreenInfoPtr s,int x1,int y1,int x2,i
}
}
void
draw_primary_colours_generic_ultrafast
(
rfbScreenInfoPtr
s
,
int
x1
,
int
y1
,
int
x2
,
int
y2
)
static
void
draw_primary_colours_generic_ultrafast
(
rfbScreenInfoPtr
s
,
int
x1
,
int
y1
,
int
x2
,
int
y2
)
{
rfbPixelFormat
f
=
s
->
serverFormat
;
int
y3
=
(
y1
*
2
+
y2
)
/
3
,
y4
=
(
y1
+
y2
*
2
)
/
3
;
...
...
examples/example.c
View file @
8bee4eb9
...
...
@@ -34,13 +34,13 @@
#include <rfb/rfb.h>
#include <rfb/keysym.h>
const
int
bpp
=
4
;
int
maxx
=
800
,
maxy
=
600
;
static
const
int
bpp
=
4
;
static
int
maxx
=
800
,
maxy
=
600
;
/* TODO: odd maxx doesn't work (vncviewer bug) */
/* This initializes a nice (?) background */
void
initBuffer
(
unsigned
char
*
buffer
)
static
void
initBuffer
(
unsigned
char
*
buffer
)
{
int
i
,
j
;
for
(
j
=
0
;
j
<
maxy
;
++
j
)
{
...
...
@@ -63,12 +63,12 @@ typedef struct ClientData {
int
oldx
,
oldy
;
}
ClientData
;
void
clientgone
(
rfbClientPtr
cl
)
static
void
clientgone
(
rfbClientPtr
cl
)
{
free
(
cl
->
clientData
);
}
enum
rfbNewClientAction
newclient
(
rfbClientPtr
cl
)
static
enum
rfbNewClientAction
newclient
(
rfbClientPtr
cl
)
{
cl
->
clientData
=
(
void
*
)
calloc
(
sizeof
(
ClientData
),
1
);
cl
->
clientGoneHook
=
clientgone
;
...
...
@@ -77,7 +77,7 @@ enum rfbNewClientAction newclient(rfbClientPtr cl)
/* switch to new framebuffer contents */
void
newframebuffer
(
rfbScreenInfoPtr
screen
,
int
width
,
int
height
)
static
void
newframebuffer
(
rfbScreenInfoPtr
screen
,
int
width
,
int
height
)
{
unsigned
char
*
oldfb
,
*
newfb
;
...
...
@@ -94,7 +94,7 @@ void newframebuffer(rfbScreenInfoPtr screen, int width, int height)
/* aux function to draw a line */
void
drawline
(
unsigned
char
*
buffer
,
int
rowstride
,
int
bpp
,
int
x1
,
int
y1
,
int
x2
,
int
y2
)
static
void
drawline
(
unsigned
char
*
buffer
,
int
rowstride
,
int
bpp
,
int
x1
,
int
y1
,
int
x2
,
int
y2
)
{
int
i
,
j
;
i
=
x1
-
x2
;
j
=
y1
-
y2
;
...
...
@@ -121,7 +121,7 @@ void drawline(unsigned char* buffer,int rowstride,int bpp,int x1,int y1,int x2,i
/* Here the pointer events are handled */
void
doptr
(
int
buttonMask
,
int
x
,
int
y
,
rfbClientPtr
cl
)
static
void
doptr
(
int
buttonMask
,
int
x
,
int
y
,
rfbClientPtr
cl
)
{
ClientData
*
cd
=
cl
->
clientData
;
...
...
@@ -163,7 +163,7 @@ void doptr(int buttonMask,int x,int y,rfbClientPtr cl)
/* Here the key events are handled */
void
dokey
(
rfbBool
down
,
rfbKeySym
key
,
rfbClientPtr
cl
)
static
void
dokey
(
rfbBool
down
,
rfbKeySym
key
,
rfbClientPtr
cl
)
{
if
(
down
)
{
if
(
key
==
XK_Escape
)
...
...
@@ -205,8 +205,10 @@ void dokey(rfbBool down,rfbKeySym key,rfbClientPtr cl)
/* Example for an XCursor (foreground/background only) */
int
exampleXCursorWidth
=
9
,
exampleXCursorHeight
=
7
;
char
exampleXCursor
[]
=
#ifdef JUST_AN_EXAMPLE
static
int
exampleXCursorWidth
=
9
,
exampleXCursorHeight
=
7
;
static
char
exampleXCursor
[]
=
" "
" xx xx "
" xx xx "
...
...
@@ -215,9 +217,11 @@ char exampleXCursor[]=
" xx xx "
" "
;
#endif
/* Example for a rich cursor (full-colour) */
void
MakeRichCursor
(
rfbScreenInfoPtr
rfbScreen
)
static
void
MakeRichCursor
(
rfbScreenInfoPtr
rfbScreen
)
{
int
i
,
j
,
w
=
32
,
h
=
32
;
rfbCursorPtr
c
=
rfbScreen
->
cursor
;
...
...
examples/fontsel.c
View file @
8bee4eb9
...
...
@@ -3,16 +3,16 @@
#define FONTDIR "/usr/lib/kbd/consolefonts/"
#define DEFAULTFONT FONTDIR "default8x16"
char
*
fontlist
[
50
]
=
{
static
char
*
fontlist
[
50
]
=
{
"8x16alt"
,
"b.fnt"
,
"c.fnt"
,
"default8x16"
,
"m.fnt"
,
"ml.fnt"
,
"mod_d.fnt"
,
"mod_s.fnt"
,
"mr.fnt"
,
"mu.fnt"
,
"r.fnt"
,
"rl.fnt"
,
"ro.fnt"
,
"s.fnt"
,
"sc.fnt"
,
"scrawl_s.fnt"
,
"scrawl_w.fnt"
,
"sd.fnt"
,
"t.fnt"
,
0
NULL
};
rfbScreenInfoPtr
rfbScreen
=
0
;
rfbFontDataPtr
curFont
=
0
;
void
showFont
(
int
index
)
static
rfbScreenInfoPtr
rfbScreen
=
NULL
;
static
rfbFontDataPtr
curFont
=
NULL
;
static
void
showFont
(
int
index
)
{
char
buffer
[
1024
];
...
...
examples/pnmshow.c
View file @
8bee4eb9
...
...
@@ -2,7 +2,7 @@
#include <rfb/rfb.h>
#include <rfb/keysym.h>
void
HandleKey
(
rfbBool
down
,
rfbKeySym
key
,
rfbClientPtr
cl
)
static
void
HandleKey
(
rfbBool
down
,
rfbKeySym
key
,
rfbClientPtr
cl
)
{
if
(
down
&&
(
key
==
XK_Escape
||
key
==
'q'
||
key
==
'Q'
))
rfbCloseClient
(
cl
);
...
...
@@ -96,6 +96,8 @@ int main(int argc,char** argv)
rfbScreen
->
frameBuffer
[
j
*
paddedWidth
*
4
+
i
]
=
0
;
}
break
;
case
GRAY
:
break
;
case
BW
:
/* correct the format from 1 bit to 8 bits */
for
(
j
=
height
-
1
;
j
>=
0
;
j
--
)
...
...
examples/pnmshow24.c
View file @
8bee4eb9
...
...
@@ -6,7 +6,7 @@
#error "I need the ALLOW24BPP flag to work"
#endif
void
HandleKey
(
rfbBool
down
,
rfbKeySym
key
,
rfbClientPtr
cl
)
static
void
HandleKey
(
rfbBool
down
,
rfbKeySym
key
,
rfbClientPtr
cl
)
{
if
(
down
&&
(
key
==
XK_Escape
||
key
==
'q'
||
key
==
'Q'
))
rfbCloseClient
(
cl
);
...
...
examples/radon.h
View file @
8bee4eb9
unsigned
char
radonFontData
[
2280
]
=
{
static
unsigned
char
radonFontData
[
2280
]
=
{
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 32 */
0x00
,
0x10
,
0x10
,
0x10
,
0x10
,
0x10
,
0x10
,
0x00
,
0x10
,
0x10
,
0x00
,
0x00
,
/* 33 */
0x00
,
0x28
,
0x28
,
0x28
,
0x28
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 34 */
...
...
@@ -190,6 +190,6 @@ unsigned char radonFontData[2280]={
0x04
,
0x18
,
0x00
,
0x00
,
0x42
,
0x42
,
0x42
,
0x42
,
0x42
,
0x3a
,
0x02
,
0x3c
,
/* 253 */
0x00
,
0x80
,
0x80
,
0x9c
,
0xa2
,
0x82
,
0xa2
,
0x9c
,
0x80
,
0x80
,
0x00
,
0x00
,
/* 254 */
};
int
radonFontMetaData
[
256
*
5
]
=
{
static
int
radonFontMetaData
[
256
*
5
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
8
,
12
,
0
,
-
2
,
12
,
8
,
12
,
0
,
-
2
,
24
,
8
,
12
,
0
,
-
2
,
36
,
8
,
12
,
0
,
-
2
,
48
,
8
,
12
,
0
,
-
2
,
60
,
8
,
12
,
0
,
-
2
,
72
,
8
,
12
,
0
,
-
2
,
84
,
8
,
12
,
0
,
-
2
,
96
,
8
,
12
,
0
,
-
2
,
108
,
8
,
12
,
0
,
-
2
,
120
,
8
,
12
,
0
,
-
2
,
132
,
8
,
12
,
0
,
-
2
,
144
,
8
,
12
,
0
,
-
2
,
156
,
8
,
12
,
0
,
-
2
,
168
,
8
,
12
,
0
,
-
2
,
180
,
8
,
12
,
0
,
-
2
,
192
,
8
,
12
,
0
,
-
2
,
204
,
8
,
12
,
0
,
-
2
,
216
,
8
,
12
,
0
,
-
2
,
228
,
8
,
12
,
0
,
-
2
,
240
,
8
,
12
,
0
,
-
2
,
252
,
8
,
12
,
0
,
-
2
,
264
,
8
,
12
,
0
,
-
2
,
276
,
8
,
12
,
0
,
-
2
,
288
,
8
,
12
,
0
,
-
2
,
300
,
8
,
12
,
0
,
-
2
,
312
,
8
,
12
,
0
,
-
2
,
324
,
8
,
12
,
0
,
-
2
,
336
,
8
,
12
,
0
,
-
2
,
348
,
8
,
12
,
0
,
-
2
,
360
,
8
,
12
,
0
,
-
2
,
372
,
8
,
12
,
0
,
-
2
,
384
,
8
,
12
,
0
,
-
2
,
396
,
8
,
12
,
0
,
-
2
,
408
,
8
,
12
,
0
,
-
2
,
420
,
8
,
12
,
0
,
-
2
,
432
,
8
,
12
,
0
,
-
2
,
444
,
8
,
12
,
0
,
-
2
,
456
,
8
,
12
,
0
,
-
2
,
468
,
8
,
12
,
0
,
-
2
,
480
,
8
,
12
,
0
,
-
2
,
492
,
8
,
12
,
0
,
-
2
,
504
,
8
,
12
,
0
,
-
2
,
516
,
8
,
12
,
0
,
-
2
,
528
,
8
,
12
,
0
,
-
2
,
540
,
8
,
12
,
0
,
-
2
,
552
,
8
,
12
,
0
,
-
2
,
564
,
8
,
12
,
0
,
-
2
,
576
,
8
,
12
,
0
,
-
2
,
588
,
8
,
12
,
0
,
-
2
,
600
,
8
,
12
,
0
,
-
2
,
612
,
8
,
12
,
0
,
-
2
,
624
,
8
,
12
,
0
,
-
2
,
636
,
8
,
12
,
0
,
-
2
,
648
,
8
,
12
,
0
,
-
2
,
660
,
8
,
12
,
0
,
-
2
,
672
,
8
,
12
,
0
,
-
2
,
684
,
8
,
12
,
0
,
-
2
,
696
,
8
,
12
,
0
,
-
2
,
708
,
8
,
12
,
0
,
-
2
,
720
,
8
,
12
,
0
,
-
2
,
732
,
8
,
12
,
0
,
-
2
,
744
,
8
,
12
,
0
,
-
2
,
756
,
8
,
12
,
0
,
-
2
,
768
,
8
,
12
,
0
,
-
2
,
780
,
8
,
12
,
0
,
-
2
,
792
,
8
,
12
,
0
,
-
2
,
804
,
8
,
12
,
0
,
-
2
,
816
,
8
,
12
,
0
,
-
2
,
828
,
8
,
12
,
0
,
-
2
,
840
,
8
,
12
,
0
,
-
2
,
852
,
8
,
12
,
0
,
-
2
,
864
,
8
,
12
,
0
,
-
2
,
876
,
8
,
12
,
0
,
-
2
,
888
,
8
,
12
,
0
,
-
2
,
900
,
8
,
12
,
0
,
-
2
,
912
,
8
,
12
,
0
,
-
2
,
924
,
8
,
12
,
0
,
-
2
,
936
,
8
,
12
,
0
,
-
2
,
948
,
8
,
12
,
0
,
-
2
,
960
,
8
,
12
,
0
,
-
2
,
972
,
8
,
12
,
0
,
-
2
,
984
,
8
,
12
,
0
,
-
2
,
996
,
8
,
12
,
0
,
-
2
,
1008
,
8
,
12
,
0
,
-
2
,
1020
,
8
,
12
,
0
,
-
2
,
1032
,
8
,
12
,
0
,
-
2
,
1044
,
8
,
12
,
0
,
-
2
,
1056
,
8
,
12
,
0
,
-
2
,
1068
,
8
,
12
,
0
,
-
2
,
1080
,
8
,
12
,
0
,
-
2
,
1092
,
8
,
12
,
0
,
-
2
,
1104
,
8
,
12
,
0
,
-
2
,
1116
,
8
,
12
,
0
,
-
2
,
1128
,
8
,
12
,
0
,
-
2
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1140
,
8
,
12
,
0
,
-
2
,
1152
,
8
,
12
,
0
,
-
2
,
1164
,
8
,
12
,
0
,
-
2
,
1176
,
8
,
12
,
0
,
-
2
,
1188
,
8
,
12
,
0
,
-
2
,
1200
,
8
,
12
,
0
,
-
2
,
1212
,
8
,
12
,
0
,
-
2
,
1224
,
8
,
12
,
0
,
-
2
,
1236
,
8
,
12
,
0
,
-
2
,
1248
,
8
,
12
,
0
,
-
2
,
1260
,
8
,
12
,
0
,
-
2
,
1272
,
8
,
12
,
0
,
-
2
,
1284
,
8
,
12
,
0
,
-
2
,
1296
,
8
,
12
,
0
,
-
2
,
1308
,
8
,
12
,
0
,
-
2
,
1320
,
8
,
12
,
0
,
-
2
,
1332
,
8
,
12
,
0
,
-
2
,
1344
,
8
,
12
,
0
,
-
2
,
1356
,
8
,
12
,
0
,
-
2
,
1368
,
8
,
12
,
0
,
-
2
,
1380
,
8
,
12
,
0
,
-
2
,
1392
,
8
,
12
,
0
,
-
2
,
1404
,
8
,
12
,
0
,
-
2
,
1416
,
8
,
12
,
0
,
-
2
,
1428
,
8
,
12
,
0
,
-
2
,
1440
,
8
,
12
,
0
,
-
2
,
1452
,
8
,
12
,
0
,
-
2
,
1464
,
8
,
12
,
0
,
-
2
,
1476
,
8
,
12
,
0
,
-
2
,
1488
,
8
,
12
,
0
,
-
2
,
1500
,
8
,
12
,
0
,
-
2
,
1512
,
8
,
12
,
0
,
-
2
,
1524
,
8
,
12
,
0
,
-
2
,
1536
,
8
,
12
,
0
,
-
2
,
1548
,
8
,
12
,
0
,
-
2
,
1560
,
8
,
12
,
0
,
-
2
,
1572
,
8
,
12
,
0
,
-
2
,
1584
,
8
,
12
,
0
,
-
2
,
1596
,
8
,
12
,
0
,
-
2
,
1608
,
8
,
12
,
0
,
-
2
,
1620
,
8
,
12
,
0
,
-
2
,
1632
,
8
,
12
,
0
,
-
2
,
1644
,
8
,
12
,
0
,
-
2
,
1656
,
8
,
12
,
0
,
-
2
,
1668
,
8
,
12
,
0
,
-
2
,
1680
,
8
,
12
,
0
,
-
2
,
1692
,
8
,
12
,
0
,
-
2
,
1704
,
8
,
12
,
0
,
-
2
,
1716
,
8
,
12
,
0
,
-
2
,
1728
,
8
,
12
,
0
,
-
2
,
1740
,
8
,
12
,
0
,
-
2
,
1752
,
8
,
12
,
0
,
-
2
,
1764
,
8
,
12
,
0
,
-
2
,
1776
,
8
,
12
,
0
,
-
2
,
1788
,
8
,
12
,
0
,
-
2
,
1800
,
8
,
12
,
0
,
-
2
,
1812
,
8
,
12
,
0
,
-
2
,
1824
,
8
,
12
,
0
,
-
2
,
1836
,
8
,
12
,
0
,
-
2
,
1848
,
8
,
12
,
0
,
-
2
,
1860
,
8
,
12
,
0
,
-
2
,
1872
,
8
,
12
,
0
,
-
2
,
1884
,
8
,
12
,
0
,
-
2
,
1896
,
8
,
12
,
0
,
-
2
,
1908
,
8
,
12
,
0
,
-
2
,
1920
,
8
,
12
,
0
,
-
2
,
1932
,
8
,
12
,
0
,
-
2
,
1944
,
8
,
12
,
0
,
-
2
,
1956
,
8
,
12
,
0
,
-
2
,
1968
,
8
,
12
,
0
,
-
2
,
1980
,
8
,
12
,
0
,
-
2
,
1992
,
8
,
12
,
0
,
-
2
,
2004
,
8
,
12
,
0
,
-
2
,
2016
,
8
,
12
,
0
,
-
2
,
2028
,
8
,
12
,
0
,
-
2
,
2040
,
8
,
12
,
0
,
-
2
,
2052
,
8
,
12
,
0
,
-
2
,
2064
,
8
,
12
,
0
,
-
2
,
2076
,
8
,
12
,
0
,
-
2
,
2088
,
8
,
12
,
0
,
-
2
,
2100
,
8
,
12
,
0
,
-
2
,
2112
,
8
,
12
,
0
,
-
2
,
2124
,
8
,
12
,
0
,
-
2
,
2136
,
8
,
12
,
0
,
-
2
,
2148
,
8
,
12
,
0
,
-
2
,
2160
,
8
,
12
,
0
,
-
2
,
2172
,
8
,
12
,
0
,
-
2
,
2184
,
8
,
12
,
0
,
-
2
,
2196
,
8
,
12
,
0
,
-
2
,
2208
,
8
,
12
,
0
,
-
2
,
2220
,
8
,
12
,
0
,
-
2
,
2232
,
8
,
12
,
0
,
-
2
,
2244
,
8
,
12
,
0
,
-
2
,
2256
,
8
,
12
,
0
,
-
2
,
2268
,
8
,
12
,
0
,
-
2
,
0
,
0
,
0
,
0
,
0
,};
rfbFontData
radonFont
=
{
radonFontData
,
radonFontMetaData
};
static
rfbFontData
radonFont
=
{
radonFontData
,
radonFontMetaData
};
examples/storepasswd.c
View file @
8bee4eb9
...
...
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <rfb/rfb.h>
void
usage
(
void
)
static
void
usage
(
void
)
{
printf
(
"
\n
usage: storepasswd <password> <filename>
\n\n
"
);
...
...
examples/vncev.c
View file @
8bee4eb9
/* This program is a simple server to show events coming from the client */
#define _BSD_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
...
...
@@ -8,10 +9,12 @@
#include <rfb/rfb.h>
#include <rfb/default8x16.h>
char
f
[
640
*
480
];
char
*
keys
[
0x400
];
#define width 100
#define height 100
static
char
f
[
width
*
height
];
static
char
*
keys
[
0x400
];
int
hex2number
(
unsigned
char
c
)
static
int
hex2number
(
unsigned
char
c
)
{
if
(
c
>
'f'
)
return
(
-
1
);
else
if
(
c
>
'F'
)
...
...
@@ -22,7 +25,7 @@ int hex2number(unsigned char c)
return
(
c
-
'0'
);
}
void
read_keys
(
)
static
void
read_keys
(
void
)
{
int
i
,
j
,
k
;
char
buffer
[
1024
];
...
...
@@ -60,15 +63,15 @@ void read_keys()
fclose
(
keysyms
);
}
int
lineHeight
=
16
,
lineY
=
480
-
16
;
void
output
(
rfbScreenInfoPtr
s
,
char
*
line
)
static
int
lineHeight
=
16
,
lineY
=
height
-
16
;
static
void
output
(
rfbScreenInfoPtr
s
,
char
*
line
)
{
rfbDoCopyRect
(
s
,
0
,
0
,
640
,
480
-
lineHeight
,
0
,
-
lineHeight
);
rfbDoCopyRect
(
s
,
0
,
0
,
width
,
height
-
lineHeight
,
0
,
-
lineHeight
);
rfbDrawString
(
s
,
&
default8x16Font
,
10
,
lineY
,
line
,
0x01
);
rfbLog
(
"%s
\n
"
,
line
);
}
void
dokey
(
rfbBool
down
,
rfbKeySym
k
,
rfbClientPtr
cl
)
static
void
dokey
(
rfbBool
down
,
rfbKeySym
k
,
rfbClientPtr
cl
)
{
char
buffer
[
1024
+
32
];
...
...
@@ -77,7 +80,7 @@ void dokey(rfbBool down,rfbKeySym k,rfbClientPtr cl)
output
(
cl
->
screen
,
buffer
);
}
void
doptr
(
int
buttonMask
,
int
x
,
int
y
,
rfbClientPtr
cl
)
static
void
doptr
(
int
buttonMask
,
int
x
,
int
y
,
rfbClientPtr
cl
)
{
char
buffer
[
1024
];
if
(
buttonMask
)
{
...
...
@@ -87,7 +90,7 @@ void doptr(int buttonMask,int x,int y,rfbClientPtr cl)
}
enum
rfbNewClientAction
newclient
(
rfbClientPtr
cl
)
static
enum
rfbNewClientAction
newclient
(
rfbClientPtr
cl
)
{
char
buffer
[
1024
];
struct
sockaddr_in
addr
;
...
...
@@ -103,7 +106,7 @@ enum rfbNewClientAction newclient(rfbClientPtr cl)
int
main
(
int
argc
,
char
**
argv
)
{
rfbScreenInfoPtr
s
=
rfbGetScreen
(
&
argc
,
argv
,
640
,
480
,
8
,
1
,
1
);
rfbScreenInfoPtr
s
=
rfbGetScreen
(
&
argc
,
argv
,
width
,
height
,
8
,
1
,
1
);
s
->
colourMap
.
is16
=
FALSE
;
s
->
colourMap
.
count
=
2
;
s
->
colourMap
.
data
.
bytes
=
(
unsigned
char
*
)
"
\xd0\xd0\xd0\x30\x01\xe0
"
;
...
...
@@ -113,7 +116,7 @@ int main(int argc,char** argv)
s
->
ptrAddEvent
=
doptr
;
s
->
newClientHook
=
newclient
;
memset
(
f
,
0
,
640
*
480
);
memset
(
f
,
0
,
width
*
height
);
read_keys
();
rfbInitServer
(
s
);
...
...
libvncclient/listen.c
View file @
8bee4eb9
...
...
@@ -21,6 +21,7 @@
* listen.c - listen for incoming connections
*/
#define _BSD_SOURCE
#include <unistd.h>
#include <sys/types.h>
#ifdef __MINGW32__
...
...
libvncclient/rfbproto.c
View file @
8bee4eb9
...
...
@@ -23,6 +23,8 @@
* rfbproto.c - functions to deal with client side of RFB protocol.
*/
#define _BSD_SOURCE
#define _POSIX_SOURCE
#include <unistd.h>
#include <errno.h>
#ifndef __MINGW32__
...
...
@@ -31,6 +33,10 @@
#include <rfb/rfbclient.h>
#ifdef LIBVNCSERVER_HAVE_LIBZ
#include <zlib.h>
#ifdef __CHECKER__
#undef Z_NULL
#define Z_NULL NULL
#endif
#endif
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
#include <jpeglib.h>
...
...
@@ -44,7 +50,7 @@
rfbBool
rfbEnableClientLogging
=
TRUE
;
void
static
void
rfbDefaultClientLog
(
const
char
*
format
,
...)
{
va_list
args
;
...
...
@@ -69,7 +75,7 @@ rfbDefaultClientLog(const char *format, ...)
rfbClientLogProc
rfbClientLog
=
rfbDefaultClientLog
;
rfbClientLogProc
rfbClientErr
=
rfbDefaultClientLog
;
void
FillRectangle
(
rfbClient
*
client
,
int
x
,
int
y
,
int
w
,
int
h
,
uint32_t
colour
)
{
static
void
FillRectangle
(
rfbClient
*
client
,
int
x
,
int
y
,
int
w
,
int
h
,
uint32_t
colour
)
{
int
i
,
j
;
#define FILL_RECT(BPP) \
...
...
@@ -86,7 +92,7 @@ void FillRectangle(rfbClient* client, int x, int y, int w, int h, uint32_t colou
}
}
void
CopyRectangle
(
rfbClient
*
client
,
uint8_t
*
buffer
,
int
x
,
int
y
,
int
w
,
int
h
)
{
static
void
CopyRectangle
(
rfbClient
*
client
,
uint8_t
*
buffer
,
int
x
,
int
y
,
int
w
,
int
h
)
{
int
i
,
j
;
#define COPY_RECT(BPP) \
...
...
@@ -108,7 +114,7 @@ void CopyRectangle(rfbClient* client, uint8_t* buffer, int x, int y, int w, int
}
/* TODO: test */
void
CopyRectangleFromRectangle
(
rfbClient
*
client
,
int
src_x
,
int
src_y
,
int
w
,
int
h
,
int
dest_x
,
int
dest_y
)
{
static
void
CopyRectangleFromRectangle
(
rfbClient
*
client
,
int
src_x
,
int
src_y
,
int
w
,
int
h
,
int
dest_x
,
int
dest_y
)
{
int
i
,
j
;
#define COPY_RECT_FROM_RECT(BPP) \
...
...
@@ -225,7 +231,7 @@ ConnectToRFBServer(rfbClient* client,const char *hostname, int port)
rfbClientLog
(
"Could not open %s.
\n
"
,
client
->
serverHost
);
return
FALSE
;
}
setbuf
(
rec
->
file
,
0
);
setbuf
(
rec
->
file
,
NULL
);
fread
(
buffer
,
1
,
strlen
(
magic
),
rec
->
file
);
if
(
strncmp
(
buffer
,
magic
,
strlen
(
magic
)))
{
rfbClientLog
(
"File %s was not recorded by vncrec.
\n
"
,
client
->
serverHost
);
...
...
@@ -265,7 +271,7 @@ InitialiseRFBConnection(rfbClient* client)
uint32_t
authScheme
,
reasonLen
,
authResult
;
char
*
reason
;
uint8_t
challenge
[
CHALLENGESIZE
];
char
*
passwd
;
char
*
passwd
=
NULL
;
int
i
;
rfbClientInitMsg
ci
;
...
...
@@ -1028,8 +1034,7 @@ HandleRFBServerMessage(rfbClient* client)
*/
void
PrintPixelFormat
(
format
)
rfbPixelFormat
*
format
;
PrintPixelFormat
(
rfbPixelFormat
*
format
)
{
if
(
format
->
bitsPerPixel
==
1
)
{
rfbClientLog
(
" Single bit per pixel.
\n
"
);
...
...
@@ -1143,9 +1148,6 @@ JpegSetSrcManager(j_decompress_ptr cinfo, uint8_t *compressedData,
/* avoid name clashes with LibVNCServer */
#define rfbEncryptBytes rfbClientEncryptBytes
#define rfbEncryptAndStorePasswd rfbClientEncryptAndStorePasswdUnused
#define rfbDecryptPasswdFromFile rfbClientDecryptPasswdFromFileUnused
#define rfbRandomBytes rfbClientRandomBytesUnused
#define rfbDes rfbClientDes
#define rfbDesKey rfbClientDesKey
#define rfbUseKey rfbClientUseKey
...
...
libvncclient/sockets.c
View file @
8bee4eb9
...
...
@@ -21,6 +21,7 @@
* sockets.c - functions to deal with sockets.
*/
#define _BSD_SOURCE
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
...
...
libvncclient/vncviewer.c
View file @
8bee4eb9
...
...
@@ -21,6 +21,8 @@
* vncviewer.c - the Xt-based VNC viewer.
*/
#define _BSD_SOURCE
#define _POSIX_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
...
...
@@ -34,11 +36,12 @@ static rfbBool DummyPoint(rfbClient* client, int x, int y) {
}
static
void
DummyRect
(
rfbClient
*
client
,
int
x
,
int
y
,
int
w
,
int
h
)
{
}
#ifdef __MINGW32__
static
char
*
NoPassword
(
rfbClient
*
client
)
{
return
strdup
(
""
);
}
#ifndef __MINGW32__
#else
#include <stdio.h>
#include <termios.h>
#endif
...
...
@@ -103,10 +106,10 @@ rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel,
rfbClient
*
client
=
(
rfbClient
*
)
calloc
(
sizeof
(
rfbClient
),
1
);
if
(
!
client
)
{
rfbClientErr
(
"Couldn't allocate client structure!
\n
"
);
return
0
;
return
NULL
;
}
initAppData
(
&
client
->
appData
);
client
->
programName
=
0
;
client
->
programName
=
NULL
;
client
->
endianTest
=
1
;
client
->
programName
=
""
;
client
->
serverHost
=
""
;
...
...
libvncserver/auth.c
View file @
8bee4eb9
...
...
@@ -35,8 +35,7 @@
*/
void
rfbAuthNewClient
(
cl
)
rfbClientPtr
cl
;
rfbAuthNewClient
(
rfbClientPtr
cl
)
{
char
buf
[
4
+
CHALLENGESIZE
];
int
len
;
...
...
@@ -68,8 +67,7 @@ rfbAuthNewClient(cl)
*/
void
rfbAuthProcessClientMessage
(
cl
)
rfbClientPtr
cl
;
rfbAuthProcessClientMessage
(
rfbClientPtr
cl
)
{
int
n
;
uint8_t
response
[
CHALLENGESIZE
];
...
...
libvncserver/cargs.c
View file @
8bee4eb9
...
...
@@ -14,7 +14,7 @@
#include <rfb/rfb.h>
extern
rfbStringToAddr
(
char
*
str
,
in_addr_t
*
iface
);
extern
int
rfbStringToAddr
(
char
*
str
,
in_addr_t
*
iface
);
void
rfbUsage
(
void
)
...
...
@@ -88,7 +88,7 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
return
FALSE
;
}
passwds
[
0
]
=
argv
[
++
i
];
passwds
[
1
]
=
0
;
passwds
[
1
]
=
NULL
;
rfbScreen
->
authPasswdData
=
(
void
*
)
passwds
;
rfbScreen
->
passwordCheck
=
rfbCheckPasswordByList
;
}
else
if
(
strcmp
(
argv
[
i
],
"-deferupdate"
)
==
0
)
{
/* -deferupdate milliseconds */
...
...
@@ -149,12 +149,6 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
return
TRUE
;
}
void
rfbSizeUsage
()
{
fprintf
(
stderr
,
"-width sets the width of the framebuffer
\n
"
);
fprintf
(
stderr
,
"-height sets the height of the framebuffer
\n
"
);
}
rfbBool
rfbProcessSizeArguments
(
int
*
width
,
int
*
height
,
int
*
bpp
,
int
*
argc
,
char
*
argv
[])
{
...
...
libvncserver/corre.c
View file @
8bee4eb9
...
...
@@ -57,9 +57,11 @@ static rfbBool rfbSendSmallRectEncodingCoRRE(rfbClientPtr cl, int x, int y,
*/
rfbBool
rfbSendRectEncodingCoRRE
(
cl
,
x
,
y
,
w
,
h
)
rfbClientPtr
cl
;
int
x
,
y
,
w
,
h
;
rfbSendRectEncodingCoRRE
(
rfbClientPtr
cl
,
int
x
,
int
y
,
int
w
,
int
h
)
{
if
(
h
>
cl
->
correMaxHeight
)
{
return
(
rfbSendRectEncodingCoRRE
(
cl
,
x
,
y
,
w
,
cl
->
correMaxHeight
)
&&
...
...
@@ -85,9 +87,11 @@ rfbSendRectEncodingCoRRE(cl, x, y, w, h)
*/
static
rfbBool
rfbSendSmallRectEncodingCoRRE
(
cl
,
x
,
y
,
w
,
h
)
rfbClientPtr
cl
;
int
x
,
y
,
w
,
h
;
rfbSendSmallRectEncodingCoRRE
(
rfbClientPtr
cl
,
int
x
,
int
y
,
int
w
,
int
h
)
{
rfbFramebufferUpdateRectHeader
rect
;
rfbRREHeader
hdr
;
...
...
@@ -206,11 +210,7 @@ rfbSendSmallRectEncodingCoRRE(cl, x, y, w, h)
#define DEFINE_SUBRECT_ENCODE(bpp) \
static int \
subrectEncode##bpp(data,w,h) \
uint##bpp##_t *data; \
int w; \
int h; \
{ \
subrectEncode##bpp(uint##bpp##_t *data, int w, int h) { \
uint##bpp##_t cl; \
rfbCoRRERectangle subrect; \
int x,y; \
...
...
@@ -277,7 +277,7 @@ subrectEncode##bpp(data,w,h) \
return -1; \
\
numsubs += 1; \
*((uint##bpp##_t*)(rreAfterBuf + rreAfterBufLen)) = cl;
\
*((uint##bpp##_t*)(rreAfterBuf + rreAfterBufLen)) = cl; \
rreAfterBufLen += (bpp/8); \
memcpy(&rreAfterBuf[rreAfterBufLen],&subrect,sz_rfbCoRRERectangle); \
rreAfterBufLen += sz_rfbCoRRERectangle; \
...
...
@@ -306,12 +306,9 @@ DEFINE_SUBRECT_ENCODE(32)
* getBgColour() gets the most prevalent colour in a byte array.
*/
static
uint32_t
getBgColour
(
data
,
size
,
bpp
)
char
*
data
;
int
size
;
int
bpp
;
getBgColour
(
char
*
data
,
int
size
,
int
bpp
)
{
#define NUMCLRS 256
static
int
counts
[
NUMCLRS
];
...
...
libvncserver/cursor.c
View file @
8bee4eb9
...
...
@@ -24,14 +24,14 @@
#include <rfb/rfb.h>
#include <rfb/rfbregion.h>
#include "private.h"
/*
* Send cursor shape either in X-style format or in client pixel format.
*/
rfbBool
rfbSendCursorShape
(
cl
)
rfbClientPtr
cl
;
rfbSendCursorShape
(
rfbClientPtr
cl
)
{
rfbCursorPtr
pCursor
;
rfbFramebufferUpdateRectHeader
rect
;
...
...
@@ -360,8 +360,8 @@ void rfbFreeCursor(rfbCursorPtr cursor)
else
{
cursor
->
cleanup
=
cursor
->
cleanupSource
=
cursor
->
cleanupMask
=
cursor
->
cleanupRichSource
=
FALSE
;
cursor
->
source
=
cursor
->
mask
=
cursor
->
richSource
=
0
;
cursor
->
alphaSource
=
0
;
cursor
->
source
=
cursor
->
mask
=
cursor
->
richSource
=
NULL
;
cursor
->
alphaSource
=
NULL
;
}
}
...
...
@@ -633,9 +633,9 @@ void rfbRedrawAfterHideCursor(rfbClientPtr cl,sraRegionPtr updateRegion)
}
}
/* for debugging */
#ifdef DEBUG
void
rfbPrintXCursor
(
rfbCursorPtr
cursor
)
static
void
rfbPrintXCursor
(
rfbCursorPtr
cursor
)
{
int
i
,
i1
,
j
,
w
=
(
cursor
->
width
+
7
)
/
8
;
unsigned
char
bit
;
...
...
@@ -649,6 +649,8 @@ void rfbPrintXCursor(rfbCursorPtr cursor)
}
}
#endif
void
rfbSetCursor
(
rfbScreenInfoPtr
rfbScreen
,
rfbCursorPtr
c
)
{
rfbClientIteratorPtr
iterator
;
...
...
@@ -660,7 +662,7 @@ void rfbSetCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr c)
iterator
=
rfbGetClientIterator
(
rfbScreen
);
while
((
cl
=
rfbClientIteratorNext
(
iterator
)))
if
(
!
cl
->
enableCursorShapeUpdates
)
rfbRedrawAfterHideCursor
(
cl
,
0
);
rfbRedrawAfterHideCursor
(
cl
,
NULL
);
rfbReleaseClientIterator
(
iterator
);
if
(
rfbScreen
->
cursor
->
cleanup
)
...
...
@@ -673,7 +675,7 @@ void rfbSetCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr c)
while
((
cl
=
rfbClientIteratorNext
(
iterator
)))
{
cl
->
cursorWasChanged
=
TRUE
;
if
(
!
cl
->
enableCursorShapeUpdates
)
rfbRedrawAfterHideCursor
(
cl
,
0
);
rfbRedrawAfterHideCursor
(
cl
,
NULL
);
}
rfbReleaseClientIterator
(
iterator
);
...
...
libvncserver/d3des.c
View file @
8bee4eb9
...
...
@@ -71,9 +71,8 @@ static unsigned char pc2[48] = {
40
,
51
,
30
,
36
,
46
,
54
,
29
,
39
,
50
,
44
,
32
,
47
,
43
,
48
,
38
,
55
,
33
,
52
,
45
,
41
,
49
,
35
,
28
,
31
};
void
rfbDesKey
(
key
,
edf
)
/* Thanks to James Gillogly & Phil Karn! */
unsigned
char
*
key
;
int
edf
;
void
rfbDesKey
(
unsigned
char
*
key
,
int
edf
)
{
register
int
i
,
j
,
l
,
m
,
n
;
unsigned
char
pc1m
[
56
],
pcr
[
56
];
...
...
@@ -108,8 +107,7 @@ int edf;
return
;
}
static
void
cookey
(
raw1
)
register
unsigned
long
*
raw1
;
static
void
cookey
(
register
unsigned
long
*
raw1
)
{
register
unsigned
long
*
cook
,
*
raw0
;
unsigned
long
dough
[
32
];
...
...
@@ -131,8 +129,7 @@ register unsigned long *raw1;
return
;
}
void
rfbCPKey
(
into
)
register
unsigned
long
*
into
;
void
rfbCPKey
(
register
unsigned
long
*
into
)
{
register
unsigned
long
*
from
,
*
endp
;
...
...
@@ -141,8 +138,7 @@ register unsigned long *into;
return
;
}
void
rfbUseKey
(
from
)
register
unsigned
long
*
from
;
void
rfbUseKey
(
register
unsigned
long
*
from
)
{
register
unsigned
long
*
to
,
*
endp
;
...
...
@@ -151,8 +147,8 @@ register unsigned long *from;
return
;
}
void
rfbDes
(
inblock
,
outblock
)
unsigned
char
*
inblock
,
*
outblock
;
void
rfbDes
(
unsigned
char
*
inblock
,
unsigned
char
*
outblock
)
{
unsigned
long
work
[
2
];
...
...
@@ -162,9 +158,8 @@ unsigned char *inblock, *outblock;
return
;
}
static
void
scrunch
(
outof
,
into
)
register
unsigned
char
*
outof
;
register
unsigned
long
*
into
;
static
void
scrunch
(
register
unsigned
char
*
outof
,
register
unsigned
long
*
into
)
{
*
into
=
(
*
outof
++
&
0xffL
)
<<
24
;
*
into
|=
(
*
outof
++
&
0xffL
)
<<
16
;
...
...
@@ -177,9 +172,8 @@ register unsigned long *into;
return
;
}
static
void
unscrun
(
outof
,
into
)
register
unsigned
long
*
outof
;
register
unsigned
char
*
into
;
static
void
unscrun
(
register
unsigned
long
*
outof
,
register
unsigned
char
*
into
)
{
*
into
++
=
(
unsigned
char
)((
*
outof
>>
24
)
&
0xffL
);
*
into
++
=
(
unsigned
char
)((
*
outof
>>
16
)
&
0xffL
);
...
...
@@ -336,8 +330,8 @@ static unsigned long SP8[64] = {
0x10041040L
,
0x00041000L
,
0x00041000L
,
0x00001040L
,
0x00001040L
,
0x00040040L
,
0x10000000L
,
0x10041000L
};
static
void
desfunc
(
block
,
keys
)
register
unsigned
long
*
block
,
*
keys
;
static
void
desfunc
(
register
unsigned
long
*
block
,
register
unsigned
long
*
keys
)
{
register
unsigned
long
fval
,
work
,
right
,
leftt
;
register
int
round
;
...
...
libvncserver/font.c
View file @
8bee4eb9
...
...
@@ -145,7 +145,7 @@ void rfbWholeFontBBox(rfbFontDataPtr font,
int
i
;
int
*
m
=
font
->
metaData
;
(
*
x1
)
=
(
*
y1
)
=
INT_MAX
;
(
*
x2
)
=
(
*
y2
)
=
-
INT_MAX
+
1
;
(
*
x1
)
=
(
*
y1
)
=
INT_MAX
;
(
*
x2
)
=
(
*
y2
)
=
1
-
(
INT_MAX
)
;
for
(
i
=
0
;
i
<
256
;
i
++
)
{
if
(
m
[
i
*
5
+
1
]
-
m
[
i
*
5
+
3
]
>
(
*
x2
))
(
*
x2
)
=
m
[
i
*
5
+
1
]
-
m
[
i
*
5
+
3
];
...
...
@@ -164,14 +164,14 @@ rfbFontDataPtr rfbLoadConsoleFont(char *filename)
rfbFontDataPtr
p
;
int
i
;
if
(
!
f
)
return
(
0
)
;
if
(
!
f
)
return
NULL
;
p
=
(
rfbFontDataPtr
)
malloc
(
sizeof
(
rfbFontData
));
p
->
data
=
(
unsigned
char
*
)
malloc
(
4096
);
if
(
1
!=
fread
(
p
->
data
,
4096
,
1
,
f
))
{
free
(
p
->
data
);
free
(
p
);
return
(
0
)
;
return
NULL
;
}
fclose
(
f
);
p
->
metaData
=
(
int
*
)
malloc
(
256
*
5
*
sizeof
(
int
));
...
...
libvncserver/hextile.c
View file @
8bee4eb9
This diff is collapsed.
Click to expand it.
libvncserver/httpd.c
View file @
8bee4eb9
...
...
@@ -69,7 +69,7 @@
#define OK_STR "HTTP/1.0 200 OK\nContent-Type: text/html\r\n\r\n"
static
void
httpProcessInput
();
static
void
httpProcessInput
(
rfbScreenInfoPtr
screen
);
static
rfbBool
compareAndSkip
(
char
**
ptr
,
const
char
*
str
);
static
rfbBool
parseParams
(
const
char
*
request
,
char
*
result
,
int
max_bytes
);
static
rfbBool
validateString
(
char
*
str
);
...
...
@@ -131,7 +131,7 @@ rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen)
fd_set
fds
;
struct
timeval
tv
;
struct
sockaddr_in
addr
;
s
ize
_t
addrlen
=
sizeof
(
addr
);
s
ocklen
_t
addrlen
=
sizeof
(
addr
);
if
(
!
rfbScreen
->
httpDir
)
return
;
...
...
@@ -221,7 +221,7 @@ static void
httpProcessInput
(
rfbScreenInfoPtr
rfbScreen
)
{
struct
sockaddr_in
addr
;
s
ize
_t
addrlen
=
sizeof
(
addr
);
s
ocklen
_t
addrlen
=
sizeof
(
addr
);
char
fullFname
[
512
];
char
params
[
1024
];
char
*
ptr
;
...
...
libvncserver/main.c
View file @
8bee4eb9
...
...
@@ -10,8 +10,10 @@
* see GPL (latest version) for full details
*/
#define _BSD_SOURCE
#include <rfb/rfb.h>
#include <rfb/rfbregion.h>
#include "private.h"
#include <stdarg.h>
#include <errno.h>
...
...
@@ -35,10 +37,10 @@
#include <time.h>
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
MUTEX
(
logMutex
);
static
MUTEX
(
logMutex
);
#endif
int
rfbEnableLogging
=
1
;
static
int
rfbEnableLogging
=
1
;
#ifdef LIBVNCSERVER_WORDS_BIGENDIAN
char
rfbEndianTest
=
0
;
...
...
@@ -46,10 +48,6 @@ char rfbEndianTest = 0;
char
rfbEndianTest
=
-
1
;
#endif
/* from rfbserver.c */
void
rfbIncrClientRef
(
rfbClientPtr
cl
);
void
rfbDecrClientRef
(
rfbClientPtr
cl
);
void
rfbLogEnable
(
int
enabled
)
{
rfbEnableLogging
=
enabled
;
}
...
...
@@ -58,7 +56,7 @@ void rfbLogEnable(int enabled) {
* rfbLog prints a time-stamped message to the log file (stderr).
*/
void
static
void
rfbDefaultLog
(
const
char
*
format
,
...)
{
va_list
args
;
...
...
@@ -220,6 +218,8 @@ void rfbMarkRectAsModified(rfbScreenInfoPtr screen,int x1,int y1,int x2,int y2)
}
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
#include <unistd.h>
static
void
*
clientOutput
(
void
*
data
)
{
...
...
@@ -305,7 +305,7 @@ listenerRun(void *data)
int
client_fd
;
struct
sockaddr_in
peer
;
rfbClientPtr
cl
;
s
ize
_t
len
;
s
ocklen
_t
len
;
len
=
sizeof
(
peer
);
...
...
@@ -355,7 +355,6 @@ rfbDefaultPtrAddEvent(int buttonMask, int x, int y, rfbClientPtr cl)
rfbClientIteratorPtr
iterator
;
rfbClientPtr
other_client
;
rfbScreenInfoPtr
s
=
cl
->
screen
;
rfbCursorPtr
c
=
s
->
cursor
;
if
(
x
!=
s
->
cursorX
||
y
!=
s
->
cursorY
)
{
LOCK
(
s
->
cursorMutex
);
...
...
@@ -378,7 +377,7 @@ rfbDefaultPtrAddEvent(int buttonMask, int x, int y, rfbClientPtr cl)
}
}
void
rfbDefaultSetXCutText
(
char
*
text
,
int
len
,
rfbClientPtr
cl
)
static
void
rfbDefaultSetXCutText
(
char
*
text
,
int
len
,
rfbClientPtr
cl
)
{
}
...
...
@@ -393,7 +392,7 @@ static rfbCursor myCursor =
8
,
7
,
3
,
3
,
0
,
0
,
0
,
0xffff
,
0xffff
,
0xffff
,
0
NULL
};
#else
static
rfbCursor
myCursor
=
...
...
@@ -407,17 +406,17 @@ static rfbCursor myCursor =
width
:
8
,
height
:
7
,
xhot
:
3
,
yhot
:
3
,
foreRed
:
0
,
foreGreen
:
0
,
foreBlue
:
0
,
backRed
:
0xffff
,
backGreen
:
0xffff
,
backBlue
:
0xffff
,
richSource
:
0
richSource
:
NULL
};
#endif
rfbCursorPtr
rfbDefaultGetCursorPtr
(
rfbClientPtr
cl
)
static
rfbCursorPtr
rfbDefaultGetCursorPtr
(
rfbClientPtr
cl
)
{
return
(
cl
->
screen
->
cursor
);
}
/* response is cl->authChallenge vncEncrypted with passwd */
rfbBool
rfbDefaultPasswordCheck
(
rfbClientPtr
cl
,
const
char
*
response
,
int
len
)
static
rfbBool
rfbDefaultPasswordCheck
(
rfbClientPtr
cl
,
const
char
*
response
,
int
len
)
{
int
i
;
char
*
passwd
=
rfbDecryptPasswdFromFile
(
cl
->
screen
->
authPasswdData
);
...
...
@@ -473,12 +472,12 @@ void rfbDoNothingWithClient(rfbClientPtr cl)
{
}
enum
rfbNewClientAction
rfbDefaultNewClientHook
(
rfbClientPtr
cl
)
static
enum
rfbNewClientAction
rfbDefaultNewClientHook
(
rfbClientPtr
cl
)
{
return
RFB_CLIENT_ACCEPT
;
}
rfbBool
rfbDefaultProcessCustomClientMessage
(
rfbClientPtr
cl
,
uint8_t
type
)
static
rfbBool
rfbDefaultProcessCustomClientMessage
(
rfbClientPtr
cl
,
uint8_t
type
)
{
return
FALSE
;
}
...
...
@@ -541,8 +540,8 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
rfbErr
(
"WARNING: Width (%d) is not a multiple of 4. VncViewer has problems with that.
\n
"
,
width
);
screen
->
autoPort
=
FALSE
;
screen
->
clientHead
=
0
;
screen
->
pointerClient
=
0
;
screen
->
clientHead
=
NULL
;
screen
->
pointerClient
=
NULL
;
screen
->
port
=
5900
;
screen
->
socketState
=
RFB_SOCKET_INIT
;
...
...
@@ -552,7 +551,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
screen
->
udpSock
=-
1
;
screen
->
udpSockConnected
=
FALSE
;
screen
->
udpPort
=
0
;
screen
->
udpClient
=
0
;
screen
->
udpClient
=
NULL
;
screen
->
maxFd
=
0
;
screen
->
listenSock
=-
1
;
...
...
@@ -568,7 +567,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
screen
->
alwaysShared
=
FALSE
;
screen
->
neverShared
=
FALSE
;
screen
->
dontDisconnect
=
FALSE
;
screen
->
authPasswdData
=
0
;
screen
->
authPasswdData
=
NULL
;
screen
->
authPasswdFirstViewOnly
=
1
;
screen
->
width
=
width
;
...
...
@@ -586,7 +585,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
if
(
!
rfbProcessArguments
(
screen
,
argc
,
argv
))
{
free
(
screen
);
return
0
;
return
NULL
;
}
#ifdef WIN32
...
...
@@ -626,7 +625,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
screen
->
getCursorPtr
=
rfbDefaultGetCursorPtr
;
screen
->
setTranslateFunction
=
rfbSetTranslateFunction
;
screen
->
newClientHook
=
rfbDefaultNewClientHook
;
screen
->
displayHook
=
0
;
screen
->
displayHook
=
NULL
;
screen
->
processCustomClientMessage
=
rfbDefaultProcessCustomClientMessage
;
/* initialize client list and iterator mutex */
...
...
@@ -709,10 +708,6 @@ void rfbNewFramebuffer(rfbScreenInfoPtr screen, char *framebuffer,
rfbReleaseClientIterator
(
iterator
);
}
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
extern
void
TightCleanup
();
#endif
/* hang up on all clients and free all reserved memory */
void
rfbScreenCleanup
(
rfbScreenInfoPtr
screen
)
...
...
@@ -732,10 +727,10 @@ void rfbScreenCleanup(rfbScreenInfoPtr screen)
TINI_MUTEX
(
screen
->
cursorMutex
);
if
(
screen
->
cursor
&&
screen
->
cursor
->
cleanup
)
rfbFreeCursor
(
screen
->
cursor
);
free
(
screen
);
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
rfbTightCleanup
();
rfbTightCleanup
(
screen
);
#endif
free
(
screen
);
}
void
rfbInitServer
(
rfbScreenInfoPtr
screen
)
...
...
@@ -781,9 +776,6 @@ void gettimeofday(struct timeval* tv,char* dummy)
}
#endif
/* defined in rfbserver.c, but kind of "private" */
rfbClientPtr
rfbClientIteratorHead
(
rfbClientIteratorPtr
i
);
rfbBool
rfbProcessEvents
(
rfbScreenInfoPtr
screen
,
long
usec
)
{
...
...
libvncserver/private.h
0 → 100644
View file @
8bee4eb9
#ifndef RFB_PRIVATE_H
#define RFB_PRIVATE_H
/* from cursor.c */
void
rfbShowCursor
(
rfbClientPtr
cl
);
void
rfbHideCursor
(
rfbClientPtr
cl
);
void
rfbRedrawAfterHideCursor
(
rfbClientPtr
cl
,
sraRegionPtr
updateRegion
);
/* from main.c */
rfbClientPtr
rfbClientIteratorHead
(
rfbClientIteratorPtr
i
);
/* from tight.c */
extern
void
rfbTightCleanup
(
rfbScreenInfoPtr
screen
);
/* from zrle.c */
extern
void
rfbFreeZrleData
(
rfbClientPtr
cl
);
#endif
libvncserver/rfbregion.c
View file @
8bee4eb9
...
...
@@ -30,7 +30,7 @@ typedef struct sraRegion {
sraSpanList
*
sraSpanListDup
(
const
sraSpanList
*
src
);
void
sraSpanListDestroy
(
sraSpanList
*
list
);
sraSpan
*
s
tatic
s
raSpan
*
sraSpanCreate
(
int
start
,
int
end
,
const
sraSpanList
*
subspan
)
{
sraSpan
*
item
=
(
sraSpan
*
)
malloc
(
sizeof
(
sraSpan
));
item
->
_next
=
item
->
_prev
=
NULL
;
...
...
@@ -40,7 +40,7 @@ sraSpanCreate(int start, int end, const sraSpanList *subspan) {
return
item
;
}
sraSpan
*
s
tatic
s
raSpan
*
sraSpanDup
(
const
sraSpan
*
src
)
{
sraSpan
*
span
;
if
(
!
src
)
return
NULL
;
...
...
@@ -48,7 +48,7 @@ sraSpanDup(const sraSpan *src) {
return
span
;
}
void
static
void
sraSpanInsertAfter
(
sraSpan
*
newspan
,
sraSpan
*
after
)
{
newspan
->
_next
=
after
->
_next
;
newspan
->
_prev
=
after
;
...
...
@@ -56,7 +56,7 @@ sraSpanInsertAfter(sraSpan *newspan, sraSpan *after) {
after
->
_next
=
newspan
;
}
void
static
void
sraSpanInsertBefore
(
sraSpan
*
newspan
,
sraSpan
*
before
)
{
newspan
->
_next
=
before
;
newspan
->
_prev
=
before
->
_prev
;
...
...
@@ -64,19 +64,20 @@ sraSpanInsertBefore(sraSpan *newspan, sraSpan *before) {
before
->
_prev
=
newspan
;
}
void
static
void
sraSpanRemove
(
sraSpan
*
span
)
{
span
->
_prev
->
_next
=
span
->
_next
;
span
->
_next
->
_prev
=
span
->
_prev
;
}
void
static
void
sraSpanDestroy
(
sraSpan
*
span
)
{
if
(
span
->
subspan
)
sraSpanListDestroy
(
span
->
subspan
);
free
(
span
);
}
void
#ifdef DEBUG
static
void
sraSpanCheck
(
const
sraSpan
*
span
,
const
char
*
text
)
{
/* Check the span is valid! */
if
(
span
->
start
==
span
->
end
)
{
...
...
@@ -84,12 +85,13 @@ sraSpanCheck(const sraSpan *span, const char *text) {
printf
(
":%d-%d
\n
"
,
span
->
start
,
span
->
end
);
}
}
#endif
/* -=- SpanList routines */
void
sraSpanPrint
(
const
sraSpan
*
s
);
static
void
sraSpanPrint
(
const
sraSpan
*
s
);
void
static
void
sraSpanListPrint
(
const
sraSpanList
*
l
)
{
sraSpan
*
curr
;
if
(
!
l
)
{
...
...
@@ -112,8 +114,8 @@ sraSpanPrint(const sraSpan *s) {
sraSpanListPrint
(
s
->
subspan
);
}
sraSpanList
*
sraSpanListCreate
()
{
s
tatic
s
raSpanList
*
sraSpanListCreate
(
void
)
{
sraSpanList
*
item
=
(
sraSpanList
*
)
malloc
(
sizeof
(
sraSpanList
));
item
->
front
.
_next
=
&
(
item
->
back
);
item
->
front
.
_prev
=
NULL
;
...
...
@@ -152,7 +154,7 @@ sraSpanListDestroy(sraSpanList *list) {
free
(
list
);
}
void
static
void
sraSpanListMakeEmpty
(
sraSpanList
*
list
)
{
sraSpan
*
curr
,
*
next
;
while
(
list
->
front
.
_next
!=
&
(
list
->
back
))
{
...
...
@@ -168,7 +170,7 @@ sraSpanListMakeEmpty(sraSpanList *list) {
list
->
back
.
_next
=
NULL
;
}
rfbBool
static
rfbBool
sraSpanListEqual
(
const
sraSpanList
*
s1
,
const
sraSpanList
*
s2
)
{
sraSpan
*
sp1
,
*
sp2
;
...
...
@@ -201,12 +203,12 @@ sraSpanListEqual(const sraSpanList *s1, const sraSpanList *s2) {
}
}
rfbBool
static
rfbBool
sraSpanListEmpty
(
const
sraSpanList
*
list
)
{
return
(
list
->
front
.
_next
==
&
(
list
->
back
));
}
unsigned
long
static
unsigned
long
sraSpanListCount
(
const
sraSpanList
*
list
)
{
sraSpan
*
curr
=
list
->
front
.
_next
;
unsigned
long
count
=
0
;
...
...
@@ -221,7 +223,7 @@ sraSpanListCount(const sraSpanList *list) {
return
count
;
}
void
static
void
sraSpanMergePrevious
(
sraSpan
*
dest
)
{
sraSpan
*
prev
=
dest
->
_prev
;
...
...
@@ -242,7 +244,7 @@ sraSpanMergePrevious(sraSpan *dest) {
}
}
void
static
void
sraSpanMergeNext
(
sraSpan
*
dest
)
{
sraSpan
*
next
=
dest
->
_next
;
while
((
next
->
_next
)
&&
...
...
@@ -262,7 +264,7 @@ sraSpanMergeNext(sraSpan *dest) {
}
}
void
static
void
sraSpanListOr
(
sraSpanList
*
dest
,
const
sraSpanList
*
src
)
{
sraSpan
*
d_curr
,
*
s_curr
;
int
s_start
,
s_end
;
...
...
@@ -352,7 +354,7 @@ sraSpanListOr(sraSpanList *dest, const sraSpanList *src) {
}
}
rfbBool
static
rfbBool
sraSpanListAnd
(
sraSpanList
*
dest
,
const
sraSpanList
*
src
)
{
sraSpan
*
d_curr
,
*
s_curr
,
*
d_next
;
...
...
@@ -432,7 +434,7 @@ sraSpanListAnd(sraSpanList *dest, const sraSpanList *src) {
return
!
sraSpanListEmpty
(
dest
);
}
rfbBool
static
rfbBool
sraSpanListSubtract
(
sraSpanList
*
dest
,
const
sraSpanList
*
src
)
{
sraSpan
*
d_curr
,
*
s_curr
;
...
...
@@ -506,7 +508,7 @@ sraSpanListSubtract(sraSpanList *dest, const sraSpanList *src) {
/* -=- Region routines */
sraRegion
*
sraRgnCreate
()
{
sraRgnCreate
(
void
)
{
return
(
sraRegion
*
)
sraSpanListCreate
();
}
...
...
@@ -686,7 +688,7 @@ sraRectangleIterator *sraRgnGetIterator(sraRegion *s)
sraRectangleIterator
*
i
=
(
sraRectangleIterator
*
)
malloc
(
sizeof
(
sraRectangleIterator
));
if
(
!
i
)
return
(
0
)
;
return
NULL
;
/* we have to recurse eventually. So, the first sPtr is the pointer to
the sraSpan in the first level. the second sPtr is the pointer to
...
...
@@ -695,7 +697,7 @@ sraRectangleIterator *sraRgnGetIterator(sraRegion *s)
i
->
sPtrs
=
(
sraSpan
**
)
malloc
(
sizeof
(
sraSpan
*
)
*
DEFSIZE
);
if
(
!
i
->
sPtrs
)
{
free
(
i
);
return
(
0
)
;
return
NULL
;
}
i
->
ptrSize
=
DEFSIZE
;
i
->
sPtrs
[
0
]
=
&
(
s
->
front
);
...
...
@@ -703,7 +705,7 @@ sraRectangleIterator *sraRgnGetIterator(sraRegion *s)
i
->
ptrPos
=
0
;
i
->
reverseX
=
0
;
i
->
reverseY
=
0
;
return
(
i
)
;
return
i
;
}
sraRectangleIterator
*
sraRgnGetReverseIterator
(
sraRegion
*
s
,
rfbBool
reverseX
,
rfbBool
reverseY
)
...
...
@@ -718,13 +720,13 @@ sraRectangleIterator *sraRgnGetReverseIterator(sraRegion *s,rfbBool reverseX,rfb
return
(
i
);
}
rfbBool
sraReverse
(
sraRectangleIterator
*
i
)
static
rfbBool
sraReverse
(
sraRectangleIterator
*
i
)
{
return
(
((
i
->
ptrPos
&
2
)
&&
i
->
reverseX
)
||
(
!
(
i
->
ptrPos
&
2
)
&&
i
->
reverseY
));
}
sraSpan
*
sraNextSpan
(
sraRectangleIterator
*
i
)
s
tatic
s
raSpan
*
sraNextSpan
(
sraRectangleIterator
*
i
)
{
if
(
sraReverse
(
i
))
return
(
i
->
sPtrs
[
i
->
ptrPos
]
->
_prev
);
...
...
libvncserver/rfbserver.c
View file @
8bee4eb9
...
...
@@ -24,9 +24,11 @@
* USA.
*/
#define _BSD_SOURCE
#include <string.h>
#include <rfb/rfb.h>
#include <rfb/rfbregion.h>
#include "private.h"
#ifdef LIBVNCSERVER_HAVE_FCNTL_H
#include <fcntl.h>
...
...
@@ -60,11 +62,6 @@
#define DEBUGPROTO(x)
#endif
/* from cursor.c */
void
rfbShowCursor
(
rfbClientPtr
cl
);
void
rfbHideCursor
(
rfbClientPtr
cl
);
void
rfbRedrawAfterHideCursor
(
rfbClientPtr
cl
,
sraRegionPtr
updateRegion
);
static
void
rfbProcessClientProtocolVersion
(
rfbClientPtr
cl
);
static
void
rfbProcessClientNormalMessage
(
rfbClientPtr
cl
);
...
...
@@ -92,7 +89,7 @@ void rfbDecrClientRef(rfbClientPtr cl) {}
#endif
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
MUTEX
(
rfbClientListMutex
);
static
MUTEX
(
rfbClientListMutex
);
#endif
struct
rfbClientIterator
{
...
...
@@ -118,7 +115,7 @@ rfbGetClientIterator(rfbScreenInfoPtr rfbScreen)
{
rfbClientIteratorPtr
i
=
(
rfbClientIteratorPtr
)
malloc
(
sizeof
(
struct
rfbClientIterator
));
i
->
next
=
0
;
i
->
next
=
NULL
;
i
->
screen
=
rfbScreen
;
return
i
;
}
...
...
@@ -175,9 +172,8 @@ rfbReleaseClientIterator(rfbClientIteratorPtr iterator)
*/
void
rfbNewClientConnection
(
rfbScreen
,
sock
)
rfbScreenInfoPtr
rfbScreen
;
int
sock
;
rfbNewClientConnection
(
rfbScreenInfoPtr
rfbScreen
,
int
sock
)
{
rfbClientPtr
cl
;
...
...
@@ -195,10 +191,9 @@ rfbNewClientConnection(rfbScreen,sock)
*/
rfbClientPtr
rfbReverseConnection
(
rfbScreen
,
host
,
port
)
rfbScreenInfoPtr
rfbScreen
;
char
*
host
;
int
port
;
rfbReverseConnection
(
rfbScreenInfoPtr
rfbScreen
,
char
*
host
,
int
port
)
{
int
sock
;
rfbClientPtr
cl
;
...
...
@@ -221,17 +216,16 @@ rfbReverseConnection(rfbScreen,host, port)
* means.
*/
rfbClientPtr
rfbNewTCPOrUDPClient
(
rfbScreen
,
sock
,
isUDP
)
rfbScreenInfoPtr
rfbScreen
;
int
sock
;
rfbBool
isUDP
;
static
rfbClientPtr
rfbNewTCPOrUDPClient
(
rfbScreenInfoPtr
rfbScreen
,
int
sock
,
rfbBool
isUDP
)
{
rfbProtocolVersionMsg
pv
;
rfbClientIteratorPtr
iterator
;
rfbClientPtr
cl
,
cl_
;
struct
sockaddr_in
addr
;
s
ize
_t
addrlen
=
sizeof
(
struct
sockaddr_in
);
s
ocklen
_t
addrlen
=
sizeof
(
struct
sockaddr_in
);
cl
=
(
rfbClientPtr
)
calloc
(
sizeof
(
rfbClientRec
),
1
);
...
...
@@ -287,7 +281,7 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
cl
->
correMaxWidth
=
48
;
cl
->
correMaxHeight
=
48
;
#ifdef LIBVNCSERVER_HAVE_LIBZ
cl
->
zrleData
=
0
;
cl
->
zrleData
=
NULL
;
#endif
cl
->
copyRegion
=
sraRgnCreate
();
...
...
@@ -378,16 +372,14 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
}
rfbClientPtr
rfbNewClient
(
rfbScreen
,
sock
)
rfbScreenInfoPtr
rfbScreen
;
int
sock
;
rfbNewClient
(
rfbScreenInfoPtr
rfbScreen
,
int
sock
)
{
return
(
rfbNewTCPOrUDPClient
(
rfbScreen
,
sock
,
FALSE
));
}
rfbClientPtr
rfbNewUDPClient
(
rfbScreen
)
rfbScreenInfoPtr
rfbScreen
;
rfbNewUDPClient
(
rfbScreenInfoPtr
rfbScreen
)
{
return
((
rfbScreen
->
udpClient
=
rfbNewTCPOrUDPClient
(
rfbScreen
,
rfbScreen
->
udpSock
,
TRUE
)));
...
...
@@ -399,8 +391,7 @@ rfbNewUDPClient(rfbScreen)
*/
void
rfbClientConnectionGone
(
cl
)
rfbClientPtr
cl
;
rfbClientConnectionGone
(
rfbClientPtr
cl
)
{
int
i
;
...
...
@@ -417,7 +408,7 @@ rfbClientConnectionGone(cl)
close
(
cl
->
sock
);
#ifdef LIBVNCSERVER_HAVE_LIBZ
FreeZrleData
(
cl
);
rfb
FreeZrleData
(
cl
);
#endif
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
...
...
@@ -456,7 +447,7 @@ rfbClientConnectionGone(cl)
#endif
if
(
cl
->
screen
->
pointerClient
==
cl
)
cl
->
screen
->
pointerClient
=
0
;
cl
->
screen
->
pointerClient
=
NULL
;
sraRgnDestroy
(
cl
->
modifiedRegion
);
sraRgnDestroy
(
cl
->
requestedRegion
);
...
...
@@ -485,8 +476,7 @@ rfbClientConnectionGone(cl)
*/
void
rfbProcessClientMessage
(
cl
)
rfbClientPtr
cl
;
rfbProcessClientMessage
(
rfbClientPtr
cl
)
{
switch
(
cl
->
state
)
{
case
RFB_PROTOCOL_VERSION
:
...
...
@@ -511,8 +501,7 @@ rfbProcessClientMessage(cl)
*/
static
void
rfbProcessClientProtocolVersion
(
cl
)
rfbClientPtr
cl
;
rfbProcessClientProtocolVersion
(
rfbClientPtr
cl
)
{
rfbProtocolVersionMsg
pv
;
int
n
,
major_
,
minor_
;
...
...
@@ -566,9 +555,8 @@ rfbProcessClientProtocolVersion(cl)
*/
void
rfbClientConnFailed
(
cl
,
reason
)
rfbClientPtr
cl
;
char
*
reason
;
rfbClientConnFailed
(
rfbClientPtr
cl
,
char
*
reason
)
{
char
*
buf
;
int
len
=
strlen
(
reason
);
...
...
@@ -591,8 +579,7 @@ rfbClientConnFailed(cl, reason)
*/
static
void
rfbProcessClientInitMessage
(
cl
)
rfbClientPtr
cl
;
rfbProcessClientInitMessage
(
rfbClientPtr
cl
)
{
rfbClientInitMsg
ci
;
char
buf
[
256
];
...
...
@@ -686,8 +673,7 @@ static rfbBool rectSwapIfLEAndClip(uint16_t* x,uint16_t* y,uint16_t* w,uint16_t*
*/
static
void
rfbProcessClientNormalMessage
(
cl
)
rfbClientPtr
cl
;
rfbProcessClientNormalMessage
(
rfbClientPtr
cl
)
{
int
n
=
0
;
rfbClientToServerMsg
msg
;
...
...
@@ -824,7 +810,7 @@ rfbProcessClientNormalMessage(cl)
cl
->
host
);
/* if cursor was drawn, hide the cursor */
if
(
!
cl
->
enableCursorShapeUpdates
)
rfbRedrawAfterHideCursor
(
cl
,
0
);
rfbRedrawAfterHideCursor
(
cl
,
NULL
);
cl
->
enableCursorShapeUpdates
=
TRUE
;
cl
->
cursorWasChanged
=
TRUE
;
...
...
@@ -835,7 +821,7 @@ rfbProcessClientNormalMessage(cl)
cl
->
host
);
/* if cursor was drawn, hide the cursor */
if
(
!
cl
->
enableCursorShapeUpdates
)
rfbRedrawAfterHideCursor
(
cl
,
0
);
rfbRedrawAfterHideCursor
(
cl
,
NULL
);
cl
->
enableCursorShapeUpdates
=
TRUE
;
cl
->
useRichCursorEncoding
=
TRUE
;
...
...
@@ -1001,7 +987,7 @@ rfbProcessClientNormalMessage(cl)
return
;
if
(
msg
.
pe
.
buttonMask
==
0
)
cl
->
screen
->
pointerClient
=
0
;
cl
->
screen
->
pointerClient
=
NULL
;
else
cl
->
screen
->
pointerClient
=
cl
;
...
...
@@ -1065,11 +1051,10 @@ rfbProcessClientNormalMessage(cl)
*/
rfbBool
rfbSendFramebufferUpdate
(
cl
,
givenUpdateRegion
)
rfbClientPtr
cl
;
sraRegionPtr
givenUpdateRegion
;
rfbSendFramebufferUpdate
(
rfbClientPtr
cl
,
sraRegionPtr
givenUpdateRegion
)
{
sraRectangleIterator
*
i
=
0
;
sraRectangleIterator
*
i
=
NULL
;
sraRect
rect
;
int
nUpdateRegionRects
;
rfbFramebufferUpdateMsg
*
fu
=
(
rfbFramebufferUpdateMsg
*
)
cl
->
updateBuf
;
...
...
@@ -1392,10 +1377,10 @@ updateFailed:
*/
rfbBool
rfbSendCopyRegion
(
cl
,
reg
,
dx
,
dy
)
rfbClientPtr
cl
;
sraRegionPtr
reg
;
int
dx
,
dy
;
rfbSendCopyRegion
(
rfbClientPtr
cl
,
sraRegionPtr
reg
,
int
dx
,
int
dy
)
{
int
x
,
y
,
w
,
h
;
rfbFramebufferUpdateRectHeader
rect
;
...
...
@@ -1443,9 +1428,11 @@ rfbSendCopyRegion(cl, reg, dx, dy)
*/
rfbBool
rfbSendRectEncodingRaw
(
cl
,
x
,
y
,
w
,
h
)
rfbClientPtr
cl
;
int
x
,
y
,
w
,
h
;
rfbSendRectEncodingRaw
(
rfbClientPtr
cl
,
int
x
,
int
y
,
int
w
,
int
h
)
{
rfbFramebufferUpdateRectHeader
rect
;
int
nlines
;
...
...
@@ -1516,8 +1503,7 @@ rfbSendRectEncodingRaw(cl, x, y, w, h)
*/
rfbBool
rfbSendLastRectMarker
(
cl
)
rfbClientPtr
cl
;
rfbSendLastRectMarker
(
rfbClientPtr
cl
)
{
rfbFramebufferUpdateRectHeader
rect
;
...
...
@@ -1548,9 +1534,9 @@ rfbSendLastRectMarker(cl)
*/
rfbBool
rfbSendNewFBSize
(
cl
,
w
,
h
)
rfbClientPtr
cl
;
int
w
,
h
;
rfbSendNewFBSize
(
rfbClientPtr
cl
,
int
w
,
int
h
)
{
rfbFramebufferUpdateRectHeader
rect
;
...
...
@@ -1582,8 +1568,7 @@ rfbSendNewFBSize(cl, w, h)
*/
rfbBool
rfbSendUpdateBuf
(
cl
)
rfbClientPtr
cl
;
rfbSendUpdateBuf
(
rfbClientPtr
cl
)
{
if
(
cl
->
sock
<
0
)
return
FALSE
;
...
...
@@ -1604,10 +1589,9 @@ rfbSendUpdateBuf(cl)
*/
rfbBool
rfbSendSetColourMapEntries
(
cl
,
firstColour
,
nColours
)
rfbClientPtr
cl
;
int
firstColour
;
int
nColours
;
rfbSendSetColourMapEntries
(
rfbClientPtr
cl
,
int
firstColour
,
int
nColours
)
{
char
buf
[
sz_rfbSetColourMapEntriesMsg
+
256
*
3
*
2
];
rfbSetColourMapEntriesMsg
*
scme
=
(
rfbSetColourMapEntriesMsg
*
)
buf
;
...
...
@@ -1707,12 +1691,11 @@ rfbSendServerCutText(rfbScreenInfoPtr rfbScreen,char *str, int len)
* packets (such as 100s of pen readings per second!).
*/
unsigned
char
ptrAcceleration
=
50
;
static
unsigned
char
ptrAcceleration
=
50
;
void
rfbNewUDPConnection
(
rfbScreen
,
sock
)
rfbScreenInfoPtr
rfbScreen
;
int
sock
;
rfbNewUDPConnection
(
rfbScreenInfoPtr
rfbScreen
,
int
sock
)
{
if
(
write
(
sock
,
&
ptrAcceleration
,
1
)
<
0
)
{
rfbLogPerror
(
"rfbNewUDPConnection: write"
);
...
...
libvncserver/rre.c
View file @
8bee4eb9
...
...
@@ -53,9 +53,11 @@ static uint32_t getBgColour(char *data, int size, int bpp);
*/
rfbBool
rfbSendRectEncodingRRE
(
cl
,
x
,
y
,
w
,
h
)
rfbClientPtr
cl
;
int
x
,
y
,
w
,
h
;
rfbSendRectEncodingRRE
(
rfbClientPtr
cl
,
int
x
,
int
y
,
int
w
,
int
h
)
{
rfbFramebufferUpdateRectHeader
rect
;
rfbRREHeader
hdr
;
...
...
@@ -175,26 +177,22 @@ rfbSendRectEncodingRRE(cl, x, y, w, h)
#define DEFINE_SUBRECT_ENCODE(bpp) \
static int \
subrectEncode##bpp(data,w,h) \
uint##bpp##_t *data; \
int w; \
int h; \
{ \
uint##bpp##_t cl; \
subrectEncode##bpp(uint##bpp##_t *data, int w, int h) { \
uint##bpp##_t cl; \
rfbRectangle subrect; \
int x,y; \
int i,j; \
int hx=0,hy,vx=0,vy; \
int hyflag; \
uint##bpp##_t *seg;
\
uint##bpp##_t *line;
\
uint##bpp##_t *seg; \
uint##bpp##_t *line; \
int hw,hh,vw,vh; \
int thex,they,thew,theh; \
int numsubs = 0; \
int newLen; \
uint##bpp##_t bg = (uint##bpp##_t)getBgColour((char*)data,w*h,bpp);
\
uint##bpp##_t bg = (uint##bpp##_t)getBgColour((char*)data,w*h,bpp); \
\
*((uint##bpp##_t*)rreAfterBuf) = bg;
\
*((uint##bpp##_t*)rreAfterBuf) = bg; \
\
rreAfterBufLen = (bpp/8); \
\
...
...
@@ -246,7 +244,7 @@ subrectEncode##bpp(data,w,h) \
return -1; \
\
numsubs += 1; \
*((uint##bpp##_t*)(rreAfterBuf + rreAfterBufLen)) = cl;
\
*((uint##bpp##_t*)(rreAfterBuf + rreAfterBufLen)) = cl; \
rreAfterBufLen += (bpp/8); \
memcpy(&rreAfterBuf[rreAfterBufLen],&subrect,sz_rfbRectangle); \
rreAfterBufLen += sz_rfbRectangle; \
...
...
@@ -275,10 +273,7 @@ DEFINE_SUBRECT_ENCODE(32)
* getBgColour() gets the most prevalent colour in a byte array.
*/
static
uint32_t
getBgColour
(
data
,
size
,
bpp
)
char
*
data
;
int
size
;
int
bpp
;
getBgColour
(
char
*
data
,
int
size
,
int
bpp
)
{
#define NUMCLRS 256
...
...
libvncserver/selbox.c
View file @
8bee4eb9
...
...
@@ -197,7 +197,7 @@ static void selPtrAddEvent(int buttonMask,int x,int y,rfbClientPtr cl)
static
rfbCursorPtr
selGetCursorPtr
(
rfbClientPtr
cl
)
{
return
(
0
)
;
return
NULL
;
}
int
rfbSelectBox
(
rfbScreenInfoPtr
rfbScreen
,
rfbFontDataPtr
font
,
...
...
@@ -263,7 +263,7 @@ int rfbSelectBox(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
rfbScreen
->
kbdAddEvent
=
selKbdAddEvent
;
rfbScreen
->
ptrAddEvent
=
selPtrAddEvent
;
rfbScreen
->
getCursorPtr
=
selGetCursorPtr
;
rfbScreen
->
displayHook
=
0
;
rfbScreen
->
displayHook
=
NULL
;
/* backup screen */
for
(
j
=
0
;
j
<
y2
-
y1
;
j
++
)
...
...
libvncserver/sockets.c
View file @
8bee4eb9
...
...
@@ -216,7 +216,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
fd_set
fds
;
struct
timeval
tv
;
struct
sockaddr_in
addr
;
s
ize
_t
addrlen
=
sizeof
(
addr
);
s
ocklen
_t
addrlen
=
sizeof
(
addr
);
char
buf
[
6
];
const
int
one
=
1
;
int
sock
;
...
...
@@ -342,8 +342,7 @@ rfbDisconnectUDPSock(rfbScreenInfoPtr rfbScreen)
void
rfbCloseClient
(
cl
)
rfbClientPtr
cl
;
rfbCloseClient
(
rfbClientPtr
cl
)
{
LOCK
(
cl
->
updateMutex
);
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
...
...
@@ -371,10 +370,9 @@ rfbCloseClient(cl)
*/
int
rfbConnect
(
rfbScreen
,
host
,
port
)
rfbScreenInfoPtr
rfbScreen
;
char
*
host
;
int
port
;
rfbConnect
(
rfbScreenInfoPtr
rfbScreen
,
char
*
host
,
int
port
)
{
int
sock
;
int
one
=
1
;
...
...
@@ -476,10 +474,9 @@ int rfbReadExact(rfbClientPtr cl,char* buf,int len)
*/
int
rfbWriteExact
(
cl
,
buf
,
len
)
rfbClientPtr
cl
;
const
char
*
buf
;
int
len
;
rfbWriteExact
(
rfbClientPtr
cl
,
const
char
*
buf
,
int
len
)
{
int
sock
=
cl
->
sock
;
int
n
;
...
...
@@ -573,9 +570,8 @@ rfbStringToAddr(char *str, in_addr_t *addr) {
}
int
rfbListenOnTCPPort
(
port
,
iface
)
int
port
;
in_addr_t
iface
;
rfbListenOnTCPPort
(
int
port
,
in_addr_t
iface
)
{
struct
sockaddr_in
addr
;
int
sock
;
...
...
@@ -607,9 +603,8 @@ rfbListenOnTCPPort(port, iface)
}
int
rfbConnectToTcpAddr
(
host
,
port
)
char
*
host
;
int
port
;
rfbConnectToTcpAddr
(
char
*
host
,
int
port
)
{
struct
hostent
*
hp
;
int
sock
;
...
...
@@ -641,9 +636,8 @@ rfbConnectToTcpAddr(host, port)
}
int
rfbListenOnUDPPort
(
port
,
iface
)
int
port
;
in_addr_t
iface
;
rfbListenOnUDPPort
(
int
port
,
in_addr_t
iface
)
{
struct
sockaddr_in
addr
;
int
sock
;
...
...
libvncserver/tight.c
View file @
8bee4eb9
This diff is collapsed.
Click to expand it.
libvncserver/translate.c
View file @
8bee4eb9
...
...
@@ -134,7 +134,7 @@ typedef void (*rfbInitCMTableFnType)(char **table, rfbPixelFormat *in,
typedef
void
(
*
rfbInitTableFnType
)(
char
**
table
,
rfbPixelFormat
*
in
,
rfbPixelFormat
*
out
);
rfbInitCMTableFnType
rfbInitColourMapSingleTableFns
[
COUNT_OFFSETS
]
=
{
static
rfbInitCMTableFnType
rfbInitColourMapSingleTableFns
[
COUNT_OFFSETS
]
=
{
rfbInitColourMapSingleTable8
,
rfbInitColourMapSingleTable16
,
#ifdef LIBVNCSERVER_ALLOW24BPP
...
...
@@ -143,7 +143,7 @@ rfbInitCMTableFnType rfbInitColourMapSingleTableFns[COUNT_OFFSETS] = {
rfbInitColourMapSingleTable32
};
rfbInitTableFnType
rfbInitTrueColourSingleTableFns
[
COUNT_OFFSETS
]
=
{
static
rfbInitTableFnType
rfbInitTrueColourSingleTableFns
[
COUNT_OFFSETS
]
=
{
rfbInitTrueColourSingleTable8
,
rfbInitTrueColourSingleTable16
,
#ifdef LIBVNCSERVER_ALLOW24BPP
...
...
@@ -152,7 +152,7 @@ rfbInitTableFnType rfbInitTrueColourSingleTableFns[COUNT_OFFSETS] = {
rfbInitTrueColourSingleTable32
};
rfbInitTableFnType
rfbInitTrueColourRGBTablesFns
[
COUNT_OFFSETS
]
=
{
static
rfbInitTableFnType
rfbInitTrueColourRGBTablesFns
[
COUNT_OFFSETS
]
=
{
rfbInitTrueColourRGBTables8
,
rfbInitTrueColourRGBTables16
,
#ifdef LIBVNCSERVER_ALLOW24BPP
...
...
@@ -161,7 +161,7 @@ rfbInitTableFnType rfbInitTrueColourRGBTablesFns[COUNT_OFFSETS] = {
rfbInitTrueColourRGBTables32
};
rfbTranslateFnType
rfbTranslateWithSingleTableFns
[
COUNT_OFFSETS
][
COUNT_OFFSETS
]
=
{
static
rfbTranslateFnType
rfbTranslateWithSingleTableFns
[
COUNT_OFFSETS
][
COUNT_OFFSETS
]
=
{
{
rfbTranslateWithSingleTable8to8
,
rfbTranslateWithSingleTable8to16
,
#ifdef LIBVNCSERVER_ALLOW24BPP
...
...
@@ -188,7 +188,7 @@ rfbTranslateFnType rfbTranslateWithSingleTableFns[COUNT_OFFSETS][COUNT_OFFSETS]
rfbTranslateWithSingleTable32to32
}
};
rfbTranslateFnType
rfbTranslateWithRGBTablesFns
[
COUNT_OFFSETS
][
COUNT_OFFSETS
]
=
{
static
rfbTranslateFnType
rfbTranslateWithRGBTablesFns
[
COUNT_OFFSETS
][
COUNT_OFFSETS
]
=
{
{
rfbTranslateWithRGBTables8to8
,
rfbTranslateWithRGBTables8to16
,
#ifdef LIBVNCSERVER_ALLOW24BPP
...
...
@@ -242,8 +242,7 @@ rfbTranslateNone(char *table, rfbPixelFormat *in, rfbPixelFormat *out,
*/
rfbBool
rfbSetTranslateFunction
(
cl
)
rfbClientPtr
cl
;
rfbSetTranslateFunction
(
rfbClientPtr
cl
)
{
rfbLog
(
"Pixel format for client %s:
\n
"
,
cl
->
host
);
PrintPixelFormat
(
&
cl
->
format
);
...
...
@@ -359,8 +358,7 @@ rfbSetTranslateFunction(cl)
*/
static
rfbBool
rfbSetClientColourMapBGR233
(
cl
)
rfbClientPtr
cl
;
rfbSetClientColourMapBGR233
(
rfbClientPtr
cl
)
{
char
buf
[
sz_rfbSetColourMapEntriesMsg
+
256
*
3
*
2
];
rfbSetColourMapEntriesMsg
*
scme
=
(
rfbSetColourMapEntriesMsg
*
)
buf
;
...
...
@@ -414,10 +412,7 @@ rfbSetClientColourMapBGR233(cl)
*/
rfbBool
rfbSetClientColourMap
(
cl
,
firstColour
,
nColours
)
rfbClientPtr
cl
;
int
firstColour
;
int
nColours
;
rfbSetClientColourMap
(
rfbClientPtr
cl
,
int
firstColour
,
int
nColours
)
{
if
(
cl
->
screen
->
serverFormat
.
trueColour
||
!
cl
->
readyForSetColourMapEntries
)
{
return
TRUE
;
...
...
@@ -448,10 +443,7 @@ rfbSetClientColourMap(cl, firstColour, nColours)
*/
void
rfbSetClientColourMaps
(
rfbScreen
,
firstColour
,
nColours
)
rfbScreenInfoPtr
rfbScreen
;
int
firstColour
;
int
nColours
;
rfbSetClientColourMaps
(
rfbScreenInfoPtr
rfbScreen
,
int
firstColour
,
int
nColours
)
{
rfbClientIteratorPtr
i
;
rfbClientPtr
cl
;
...
...
@@ -463,8 +455,7 @@ rfbSetClientColourMaps(rfbScreen, firstColour, nColours)
}
static
void
PrintPixelFormat
(
pf
)
rfbPixelFormat
*
pf
;
PrintPixelFormat
(
rfbPixelFormat
*
pf
)
{
if
(
pf
->
bitsPerPixel
==
1
)
{
rfbLog
(
" 1 bpp, %s sig bit in each byte is leftmost on the screen.
\n
"
,
...
...
libvncserver/vncauth.c
View file @
8bee4eb9
...
...
@@ -21,6 +21,8 @@
* vncauth.c - Functions for VNC password management and authentication.
*/
#define _BSD_SOURCE
#define _POSIX_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
...
...
@@ -47,6 +49,9 @@
#endif
/* libvncclient does not need this */
#ifndef rfbEncryptBytes
/*
* We use a fixed key to store passwords, since we assume that our local
* file system is secure but nonetheless don't want to store passwords
...
...
@@ -147,7 +152,7 @@ rfbRandomBytes(unsigned char *bytes)
static
rfbBool
s_srandom_called
=
FALSE
;
if
(
!
s_srandom_called
)
{
srandom
((
unsigned
int
)
time
(
0
)
^
(
unsigned
int
)
getpid
());
srandom
((
unsigned
int
)
time
(
NULL
)
^
(
unsigned
int
)
getpid
());
s_srandom_called
=
TRUE
;
}
...
...
@@ -156,6 +161,7 @@ rfbRandomBytes(unsigned char *bytes)
}
}
#endif
/*
* Encrypt CHALLENGESIZE bytes in memory using a password.
...
...
libvncserver/zlib.c
View file @
8bee4eb9
...
...
@@ -52,10 +52,12 @@ static int zlibAfterBufLen;
* rectangle encoding.
*/
rfbBool
rfbSendOneRectEncodingZlib
(
cl
,
x
,
y
,
w
,
h
)
rfbClientPtr
cl
;
int
x
,
y
,
w
,
h
;
static
rfbBool
rfbSendOneRectEncodingZlib
(
rfbClientPtr
cl
,
int
x
,
int
y
,
int
w
,
int
h
)
{
rfbFramebufferUpdateRectHeader
rect
;
rfbZlibHeader
hdr
;
...
...
@@ -230,9 +232,11 @@ rfbSendOneRectEncodingZlib(cl, x, y, w, h)
*/
rfbBool
rfbSendRectEncodingZlib
(
cl
,
x
,
y
,
w
,
h
)
rfbClientPtr
cl
;
int
x
,
y
,
w
,
h
;
rfbSendRectEncodingZlib
(
rfbClientPtr
cl
,
int
x
,
int
y
,
int
w
,
int
h
)
{
int
maxLines
;
int
linesRemaining
;
...
...
libvncserver/zrle.c
View file @
8bee4eb9
...
...
@@ -25,6 +25,7 @@
*/
#include "rfb/rfb.h"
#include "private.h"
#include "zrleoutstream.h"
...
...
@@ -174,7 +175,7 @@ rfbBool rfbSendRectEncodingZRLE(rfbClientPtr cl, int x, int y, int w, int h)
}
void
FreeZrleData
(
rfbClientPtr
cl
)
void
rfb
FreeZrleData
(
rfbClientPtr
cl
)
{
if
(
cl
->
zrleData
)
zrleOutStreamFree
(
cl
->
zrleData
);
...
...
libvncserver/zrleencodetemplate.c
View file @
8bee4eb9
...
...
@@ -70,7 +70,7 @@ static zrlePaletteHelper paletteHelper;
void
ZRLE_ENCODE_TILE
(
PIXEL_T
*
data
,
int
w
,
int
h
,
zrleOutStream
*
os
);
void
ZRLE_ENCODE
(
int
x
,
int
y
,
int
w
,
int
h
,
static
void
ZRLE_ENCODE
(
int
x
,
int
y
,
int
w
,
int
h
,
zrleOutStream
*
os
,
void
*
buf
EXTRA_ARGS
)
...
...
libvncserver/zrleoutstream.c
View file @
8bee4eb9
...
...
@@ -209,8 +209,7 @@ static int zrleOutStreamOverrun(zrleOutStream *os,
return
size
;
}
static
inline
int
zrleOutStreamCheck
(
zrleOutStream
*
os
,
int
size
)
static
int
zrleOutStreamCheck
(
zrleOutStream
*
os
,
int
size
)
{
if
(
os
->
in
.
ptr
+
size
>
os
->
in
.
end
)
{
return
zrleOutStreamOverrun
(
os
,
size
);
...
...
rfb/default8x16.h
View file @
8bee4eb9
unsigned
char
default8x16FontData
[
4096
+
1
]
=
{
static
unsigned
char
default8x16FontData
[
4096
+
1
]
=
{
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x7e
,
0x81
,
0xa5
,
0x81
,
0x81
,
0xbd
,
0x99
,
0x81
,
0x81
,
0x7e
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x7e
,
0xff
,
0xdb
,
0xff
,
0xff
,
0xc3
,
0xe7
,
0xff
,
0xff
,
0x7e
,
0x00
,
0x00
,
0x00
,
0x00
,
...
...
@@ -256,6 +256,6 @@ unsigned char default8x16FontData[4096+1]={
0x00
,
0x00
,
0x00
,
0x00
,
0x7c
,
0x7c
,
0x7c
,
0x7c
,
0x7c
,
0x7c
,
0x7c
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
};
int
default8x16FontMetaData
[
256
*
5
+
1
]
=
{
static
int
default8x16FontMetaData
[
256
*
5
+
1
]
=
{
0
,
8
,
16
,
0
,
0
,
16
,
8
,
16
,
0
,
0
,
32
,
8
,
16
,
0
,
0
,
48
,
8
,
16
,
0
,
0
,
64
,
8
,
16
,
0
,
0
,
80
,
8
,
16
,
0
,
0
,
96
,
8
,
16
,
0
,
0
,
112
,
8
,
16
,
0
,
0
,
128
,
8
,
16
,
0
,
0
,
144
,
8
,
16
,
0
,
0
,
160
,
8
,
16
,
0
,
0
,
176
,
8
,
16
,
0
,
0
,
192
,
8
,
16
,
0
,
0
,
208
,
8
,
16
,
0
,
0
,
224
,
8
,
16
,
0
,
0
,
240
,
8
,
16
,
0
,
0
,
256
,
8
,
16
,
0
,
0
,
272
,
8
,
16
,
0
,
0
,
288
,
8
,
16
,
0
,
0
,
304
,
8
,
16
,
0
,
0
,
320
,
8
,
16
,
0
,
0
,
336
,
8
,
16
,
0
,
0
,
352
,
8
,
16
,
0
,
0
,
368
,
8
,
16
,
0
,
0
,
384
,
8
,
16
,
0
,
0
,
400
,
8
,
16
,
0
,
0
,
416
,
8
,
16
,
0
,
0
,
432
,
8
,
16
,
0
,
0
,
448
,
8
,
16
,
0
,
0
,
464
,
8
,
16
,
0
,
0
,
480
,
8
,
16
,
0
,
0
,
496
,
8
,
16
,
0
,
0
,
512
,
8
,
16
,
0
,
0
,
528
,
8
,
16
,
0
,
0
,
544
,
8
,
16
,
0
,
0
,
560
,
8
,
16
,
0
,
0
,
576
,
8
,
16
,
0
,
0
,
592
,
8
,
16
,
0
,
0
,
608
,
8
,
16
,
0
,
0
,
624
,
8
,
16
,
0
,
0
,
640
,
8
,
16
,
0
,
0
,
656
,
8
,
16
,
0
,
0
,
672
,
8
,
16
,
0
,
0
,
688
,
8
,
16
,
0
,
0
,
704
,
8
,
16
,
0
,
0
,
720
,
8
,
16
,
0
,
0
,
736
,
8
,
16
,
0
,
0
,
752
,
8
,
16
,
0
,
0
,
768
,
8
,
16
,
0
,
0
,
784
,
8
,
16
,
0
,
0
,
800
,
8
,
16
,
0
,
0
,
816
,
8
,
16
,
0
,
0
,
832
,
8
,
16
,
0
,
0
,
848
,
8
,
16
,
0
,
0
,
864
,
8
,
16
,
0
,
0
,
880
,
8
,
16
,
0
,
0
,
896
,
8
,
16
,
0
,
0
,
912
,
8
,
16
,
0
,
0
,
928
,
8
,
16
,
0
,
0
,
944
,
8
,
16
,
0
,
0
,
960
,
8
,
16
,
0
,
0
,
976
,
8
,
16
,
0
,
0
,
992
,
8
,
16
,
0
,
0
,
1008
,
8
,
16
,
0
,
0
,
1024
,
8
,
16
,
0
,
0
,
1040
,
8
,
16
,
0
,
0
,
1056
,
8
,
16
,
0
,
0
,
1072
,
8
,
16
,
0
,
0
,
1088
,
8
,
16
,
0
,
0
,
1104
,
8
,
16
,
0
,
0
,
1120
,
8
,
16
,
0
,
0
,
1136
,
8
,
16
,
0
,
0
,
1152
,
8
,
16
,
0
,
0
,
1168
,
8
,
16
,
0
,
0
,
1184
,
8
,
16
,
0
,
0
,
1200
,
8
,
16
,
0
,
0
,
1216
,
8
,
16
,
0
,
0
,
1232
,
8
,
16
,
0
,
0
,
1248
,
8
,
16
,
0
,
0
,
1264
,
8
,
16
,
0
,
0
,
1280
,
8
,
16
,
0
,
0
,
1296
,
8
,
16
,
0
,
0
,
1312
,
8
,
16
,
0
,
0
,
1328
,
8
,
16
,
0
,
0
,
1344
,
8
,
16
,
0
,
0
,
1360
,
8
,
16
,
0
,
0
,
1376
,
8
,
16
,
0
,
0
,
1392
,
8
,
16
,
0
,
0
,
1408
,
8
,
16
,
0
,
0
,
1424
,
8
,
16
,
0
,
0
,
1440
,
8
,
16
,
0
,
0
,
1456
,
8
,
16
,
0
,
0
,
1472
,
8
,
16
,
0
,
0
,
1488
,
8
,
16
,
0
,
0
,
1504
,
8
,
16
,
0
,
0
,
1520
,
8
,
16
,
0
,
0
,
1536
,
8
,
16
,
0
,
0
,
1552
,
8
,
16
,
0
,
0
,
1568
,
8
,
16
,
0
,
0
,
1584
,
8
,
16
,
0
,
0
,
1600
,
8
,
16
,
0
,
0
,
1616
,
8
,
16
,
0
,
0
,
1632
,
8
,
16
,
0
,
0
,
1648
,
8
,
16
,
0
,
0
,
1664
,
8
,
16
,
0
,
0
,
1680
,
8
,
16
,
0
,
0
,
1696
,
8
,
16
,
0
,
0
,
1712
,
8
,
16
,
0
,
0
,
1728
,
8
,
16
,
0
,
0
,
1744
,
8
,
16
,
0
,
0
,
1760
,
8
,
16
,
0
,
0
,
1776
,
8
,
16
,
0
,
0
,
1792
,
8
,
16
,
0
,
0
,
1808
,
8
,
16
,
0
,
0
,
1824
,
8
,
16
,
0
,
0
,
1840
,
8
,
16
,
0
,
0
,
1856
,
8
,
16
,
0
,
0
,
1872
,
8
,
16
,
0
,
0
,
1888
,
8
,
16
,
0
,
0
,
1904
,
8
,
16
,
0
,
0
,
1920
,
8
,
16
,
0
,
0
,
1936
,
8
,
16
,
0
,
0
,
1952
,
8
,
16
,
0
,
0
,
1968
,
8
,
16
,
0
,
0
,
1984
,
8
,
16
,
0
,
0
,
2000
,
8
,
16
,
0
,
0
,
2016
,
8
,
16
,
0
,
0
,
2032
,
8
,
16
,
0
,
0
,
2048
,
8
,
16
,
0
,
0
,
2064
,
8
,
16
,
0
,
0
,
2080
,
8
,
16
,
0
,
0
,
2096
,
8
,
16
,
0
,
0
,
2112
,
8
,
16
,
0
,
0
,
2128
,
8
,
16
,
0
,
0
,
2144
,
8
,
16
,
0
,
0
,
2160
,
8
,
16
,
0
,
0
,
2176
,
8
,
16
,
0
,
0
,
2192
,
8
,
16
,
0
,
0
,
2208
,
8
,
16
,
0
,
0
,
2224
,
8
,
16
,
0
,
0
,
2240
,
8
,
16
,
0
,
0
,
2256
,
8
,
16
,
0
,
0
,
2272
,
8
,
16
,
0
,
0
,
2288
,
8
,
16
,
0
,
0
,
2304
,
8
,
16
,
0
,
0
,
2320
,
8
,
16
,
0
,
0
,
2336
,
8
,
16
,
0
,
0
,
2352
,
8
,
16
,
0
,
0
,
2368
,
8
,
16
,
0
,
0
,
2384
,
8
,
16
,
0
,
0
,
2400
,
8
,
16
,
0
,
0
,
2416
,
8
,
16
,
0
,
0
,
2432
,
8
,
16
,
0
,
0
,
2448
,
8
,
16
,
0
,
0
,
2464
,
8
,
16
,
0
,
0
,
2480
,
8
,
16
,
0
,
0
,
2496
,
8
,
16
,
0
,
0
,
2512
,
8
,
16
,
0
,
0
,
2528
,
8
,
16
,
0
,
0
,
2544
,
8
,
16
,
0
,
0
,
2560
,
8
,
16
,
0
,
0
,
2576
,
8
,
16
,
0
,
0
,
2592
,
8
,
16
,
0
,
0
,
2608
,
8
,
16
,
0
,
0
,
2624
,
8
,
16
,
0
,
0
,
2640
,
8
,
16
,
0
,
0
,
2656
,
8
,
16
,
0
,
0
,
2672
,
8
,
16
,
0
,
0
,
2688
,
8
,
16
,
0
,
0
,
2704
,
8
,
16
,
0
,
0
,
2720
,
8
,
16
,
0
,
0
,
2736
,
8
,
16
,
0
,
0
,
2752
,
8
,
16
,
0
,
0
,
2768
,
8
,
16
,
0
,
0
,
2784
,
8
,
16
,
0
,
0
,
2800
,
8
,
16
,
0
,
0
,
2816
,
8
,
16
,
0
,
0
,
2832
,
8
,
16
,
0
,
0
,
2848
,
8
,
16
,
0
,
0
,
2864
,
8
,
16
,
0
,
0
,
2880
,
8
,
16
,
0
,
0
,
2896
,
8
,
16
,
0
,
0
,
2912
,
8
,
16
,
0
,
0
,
2928
,
8
,
16
,
0
,
0
,
2944
,
8
,
16
,
0
,
0
,
2960
,
8
,
16
,
0
,
0
,
2976
,
8
,
16
,
0
,
0
,
2992
,
8
,
16
,
0
,
0
,
3008
,
8
,
16
,
0
,
0
,
3024
,
8
,
16
,
0
,
0
,
3040
,
8
,
16
,
0
,
0
,
3056
,
8
,
16
,
0
,
0
,
3072
,
8
,
16
,
0
,
0
,
3088
,
8
,
16
,
0
,
0
,
3104
,
8
,
16
,
0
,
0
,
3120
,
8
,
16
,
0
,
0
,
3136
,
8
,
16
,
0
,
0
,
3152
,
8
,
16
,
0
,
0
,
3168
,
8
,
16
,
0
,
0
,
3184
,
8
,
16
,
0
,
0
,
3200
,
8
,
16
,
0
,
0
,
3216
,
8
,
16
,
0
,
0
,
3232
,
8
,
16
,
0
,
0
,
3248
,
8
,
16
,
0
,
0
,
3264
,
8
,
16
,
0
,
0
,
3280
,
8
,
16
,
0
,
0
,
3296
,
8
,
16
,
0
,
0
,
3312
,
8
,
16
,
0
,
0
,
3328
,
8
,
16
,
0
,
0
,
3344
,
8
,
16
,
0
,
0
,
3360
,
8
,
16
,
0
,
0
,
3376
,
8
,
16
,
0
,
0
,
3392
,
8
,
16
,
0
,
0
,
3408
,
8
,
16
,
0
,
0
,
3424
,
8
,
16
,
0
,
0
,
3440
,
8
,
16
,
0
,
0
,
3456
,
8
,
16
,
0
,
0
,
3472
,
8
,
16
,
0
,
0
,
3488
,
8
,
16
,
0
,
0
,
3504
,
8
,
16
,
0
,
0
,
3520
,
8
,
16
,
0
,
0
,
3536
,
8
,
16
,
0
,
0
,
3552
,
8
,
16
,
0
,
0
,
3568
,
8
,
16
,
0
,
0
,
3584
,
8
,
16
,
0
,
0
,
3600
,
8
,
16
,
0
,
0
,
3616
,
8
,
16
,
0
,
0
,
3632
,
8
,
16
,
0
,
0
,
3648
,
8
,
16
,
0
,
0
,
3664
,
8
,
16
,
0
,
0
,
3680
,
8
,
16
,
0
,
0
,
3696
,
8
,
16
,
0
,
0
,
3712
,
8
,
16
,
0
,
0
,
3728
,
8
,
16
,
0
,
0
,
3744
,
8
,
16
,
0
,
0
,
3760
,
8
,
16
,
0
,
0
,
3776
,
8
,
16
,
0
,
0
,
3792
,
8
,
16
,
0
,
0
,
3808
,
8
,
16
,
0
,
0
,
3824
,
8
,
16
,
0
,
0
,
3840
,
8
,
16
,
0
,
0
,
3856
,
8
,
16
,
0
,
0
,
3872
,
8
,
16
,
0
,
0
,
3888
,
8
,
16
,
0
,
0
,
3904
,
8
,
16
,
0
,
0
,
3920
,
8
,
16
,
0
,
0
,
3936
,
8
,
16
,
0
,
0
,
3952
,
8
,
16
,
0
,
0
,
3968
,
8
,
16
,
0
,
0
,
3984
,
8
,
16
,
0
,
0
,
4000
,
8
,
16
,
0
,
0
,
4016
,
8
,
16
,
0
,
0
,
4032
,
8
,
16
,
0
,
0
,
4048
,
8
,
16
,
0
,
0
,
4064
,
8
,
16
,
0
,
0
,
4080
,
8
,
16
,
0
,
0
,};
rfbFontData
default8x16Font
=
{
default8x16FontData
,
default8x16FontMetaData
};
static
rfbFontData
default8x16Font
=
{
default8x16FontData
,
default8x16FontMetaData
};
rfb/rfb.h
View file @
8bee4eb9
...
...
@@ -517,6 +517,7 @@ extern int rfbConnect(rfbScreenInfoPtr rfbScreen, char* host, int port);
extern
int
rfbConnectToTcpAddr
(
char
*
host
,
int
port
);
extern
int
rfbListenOnTCPPort
(
int
port
,
in_addr_t
iface
);
extern
int
rfbListenOnUDPPort
(
int
port
,
in_addr_t
iface
);
extern
int
rfbStringToAddr
(
char
*
string
,
in_addr_t
*
addr
);
/* rfbserver.c */
...
...
@@ -528,6 +529,8 @@ extern void rfbClientListInit(rfbScreenInfoPtr rfbScreen);
extern
rfbClientIteratorPtr
rfbGetClientIterator
(
rfbScreenInfoPtr
rfbScreen
);
extern
rfbClientPtr
rfbClientIteratorNext
(
rfbClientIteratorPtr
iterator
);
extern
void
rfbReleaseClientIterator
(
rfbClientIteratorPtr
iterator
);
extern
void
rfbIncrClientRef
(
rfbClientPtr
cl
);
extern
void
rfbDecrClientRef
(
rfbClientPtr
cl
);
extern
void
rfbNewClientConnection
(
rfbScreenInfoPtr
rfbScreen
,
int
sock
);
extern
rfbClientPtr
rfbNewClient
(
rfbScreenInfoPtr
rfbScreen
,
int
sock
);
...
...
@@ -624,6 +627,7 @@ extern rfbBool rfbTightDisableGradient;
extern
int
rfbNumCodedRectsTight
(
rfbClientPtr
cl
,
int
x
,
int
y
,
int
w
,
int
h
);
extern
rfbBool
rfbSendRectEncodingTight
(
rfbClientPtr
cl
,
int
x
,
int
y
,
int
w
,
int
h
);
#endif
#endif
...
...
@@ -661,7 +665,6 @@ extern void rfbDefaultPtrAddEvent(int buttonMask,int x,int y,rfbClientPtr cl);
/* zrle.c */
#ifdef LIBVNCSERVER_HAVE_LIBZ
extern
rfbBool
rfbSendRectEncodingZRLE
(
rfbClientPtr
cl
,
int
x
,
int
y
,
int
w
,
int
h
);
extern
void
rfbFreeZrleData
(
rfbClientPtr
cl
);
#endif
/* stats.c */
...
...
rfb/rfbproto.h
View file @
8bee4eb9
...
...
@@ -62,6 +62,10 @@
#ifdef LIBVNCSERVER_HAVE_LIBZ
#include <zlib.h>
#ifdef __CHECKER__
#undef Z_NULL
#define Z_NULL NULL
#endif
#endif
...
...
test/copyrecttest.c
View file @
8bee4eb9
#define _BSD_SOURCE
#include <rfb/rfb.h>
#include <math.h>
void
initBackground
(
rfbScreenInfoPtr
server
)
static
void
initBackground
(
rfbScreenInfoPtr
server
)
{
unsigned
int
i
,
j
;
...
...
@@ -16,7 +17,7 @@ void initBackground(rfbScreenInfoPtr server)
int
main
(
int
argc
,
char
**
argv
)
{
int
width
=
400
,
height
=
300
,
w
=
20
,
x
,
y
;
double
r
,
phi
;
double
r
,
phi
=
0
;
rfbScreenInfoPtr
server
=
rfbGetScreen
(
&
argc
,
argv
,
width
,
height
,
8
,
3
,
4
);
server
->
frameBuffer
=
(
char
*
)
malloc
(
width
*
height
*
4
);
...
...
test/cursortest.c
View file @
8bee4eb9
...
...
@@ -24,12 +24,12 @@
#include <rfb/rfb.h>
const
int
bpp
=
4
;
int
maxx
=
800
,
maxy
=
600
;
static
const
int
bpp
=
4
;
static
int
maxx
=
800
,
maxy
=
600
;
/* This initializes a nice (?) background */
void
initBuffer
(
unsigned
char
*
buffer
)
static
void
initBuffer
(
unsigned
char
*
buffer
)
{
int
i
,
j
;
for
(
j
=
0
;
j
<
maxy
;
++
j
)
{
...
...
@@ -43,7 +43,7 @@ void initBuffer(unsigned char* buffer)
/* Example for an XCursor (foreground/background only) */
void
SetXCursor
(
rfbScreenInfoPtr
rfbScreen
)
static
void
SetXCursor
(
rfbScreenInfoPtr
rfbScreen
)
{
int
width
=
13
,
height
=
11
;
char
cursor
[]
=
...
...
@@ -78,7 +78,7 @@ void SetXCursor(rfbScreenInfoPtr rfbScreen)
rfbSetCursor
(
rfbScreen
,
c
);
}
void
SetXCursor2
(
rfbScreenInfoPtr
rfbScreen
)
static
void
SetXCursor2
(
rfbScreenInfoPtr
rfbScreen
)
{
int
width
=
13
,
height
=
22
;
char
cursor
[]
=
...
...
@@ -136,7 +136,7 @@ void SetXCursor2(rfbScreenInfoPtr rfbScreen)
/* Example for a rich cursor (full-colour) */
void
SetRichCursor
(
rfbScreenInfoPtr
rfbScreen
)
static
void
SetRichCursor
(
rfbScreenInfoPtr
rfbScreen
)
{
int
i
,
j
,
w
=
32
,
h
=
32
;
/* runge */
...
...
@@ -192,7 +192,7 @@ void SetRichCursor(rfbScreenInfoPtr rfbScreen)
}
/* runge */
void
SetRichCursor2
(
rfbScreenInfoPtr
rfbScreen
)
static
void
SetRichCursor2
(
rfbScreenInfoPtr
rfbScreen
)
{
int
i
,
j
,
w
=
17
,
h
=
16
;
/* rfbCursorPtr c = rfbScreen->cursor; */
...
...
@@ -232,7 +232,7 @@ void SetRichCursor2(rfbScreenInfoPtr rfbScreen)
/* alpha channel */
void
SetAlphaCursor
(
rfbScreenInfoPtr
screen
,
int
mode
)
static
void
SetAlphaCursor
(
rfbScreenInfoPtr
screen
,
int
mode
)
{
int
i
,
j
;
rfbCursorPtr
c
=
screen
->
cursor
;
...
...
@@ -243,7 +243,7 @@ void SetAlphaCursor(rfbScreenInfoPtr screen,int mode)
if
(
c
->
alphaSource
)
{
free
(
c
->
alphaSource
);
c
->
alphaSource
=
0
;
c
->
alphaSource
=
NULL
;
}
if
(
mode
==
0
)
...
...
@@ -265,7 +265,7 @@ void SetAlphaCursor(rfbScreenInfoPtr screen,int mode)
/* Here the pointer events are handled */
void
doptr
(
int
buttonMask
,
int
x
,
int
y
,
rfbClientPtr
cl
)
static
void
doptr
(
int
buttonMask
,
int
x
,
int
y
,
rfbClientPtr
cl
)
{
static
int
oldButtonMask
=
0
;
static
int
counter
=
0
;
...
...
test/encodingstest.c
View file @
8bee4eb9
#define _BSD_SOURCE
#include <time.h>
#include <stdarg.h>
#include <rfb/rfb.h>
...
...
@@ -8,12 +9,12 @@
#endif
#define ALL_AT_ONCE
/
/#define VERY_VERBOSE
/
*#define VERY_VERBOSE*/
MUTEX
(
frameBufferMutex
);
static
MUTEX
(
frameBufferMutex
);
typedef
struct
{
int
id
;
char
*
str
;
}
encoding_t
;
encoding_t
testEncodings
[]
=
{
static
encoding_t
testEncodings
[]
=
{
{
rfbEncodingRaw
,
"raw"
},
{
rfbEncodingRRE
,
"rre"
},
/* TODO: fix corre */
...
...
@@ -28,22 +29,22 @@ encoding_t testEncodings[]={
{
rfbEncodingTight
,
"tight"
},
#endif
#endif
{
0
,
0
}
{
0
,
NULL
}
};
#define NUMBER_OF_ENCODINGS_TO_TEST (sizeof(testEncodings)/sizeof(encoding_t)-1)
/
/#define NUMBER_OF_ENCODINGS_TO_TEST 1
/
*#define NUMBER_OF_ENCODINGS_TO_TEST 1*/
/* Here come the variables/functions to handle the test output */
const
int
width
=
400
,
height
=
300
;
struct
{
int
x1
,
y1
,
x2
,
y2
;
}
lastUpdateRect
;
unsigned
int
statistics
[
2
][
NUMBER_OF_ENCODINGS_TO_TEST
];
unsigned
int
totalFailed
,
totalCount
;
unsigned
int
countGotUpdate
;
MUTEX
(
statisticsMutex
);
static
const
int
width
=
400
,
height
=
300
;
st
atic
st
ruct
{
int
x1
,
y1
,
x2
,
y2
;
}
lastUpdateRect
;
static
unsigned
int
statistics
[
2
][
NUMBER_OF_ENCODINGS_TO_TEST
];
static
unsigned
int
totalFailed
,
totalCount
;
static
unsigned
int
countGotUpdate
;
static
MUTEX
(
statisticsMutex
);
void
initStatistics
(
)
{
static
void
initStatistics
(
void
)
{
memset
(
statistics
[
0
],
0
,
sizeof
(
int
)
*
NUMBER_OF_ENCODINGS_TO_TEST
);
memset
(
statistics
[
1
],
0
,
sizeof
(
int
)
*
NUMBER_OF_ENCODINGS_TO_TEST
);
totalFailed
=
totalCount
=
0
;
...
...
@@ -54,7 +55,7 @@ void initStatistics() {
INIT_MUTEX
(
statisticsMutex
);
}
void
updateServerStatistics
(
int
x1
,
int
y1
,
int
x2
,
int
y2
)
{
static
void
updateServerStatistics
(
int
x1
,
int
y1
,
int
x2
,
int
y2
)
{
LOCK
(
statisticsMutex
);
countGotUpdate
=
0
;
lastUpdateRect
.
x1
=
x1
;
...
...
@@ -64,7 +65,7 @@ void updateServerStatistics(int x1,int y1,int x2,int y2) {
UNLOCK
(
statisticsMutex
);
}
void
updateStatistics
(
int
encodingIndex
,
rfbBool
failed
)
{
static
void
updateStatistics
(
int
encodingIndex
,
rfbBool
failed
)
{
LOCK
(
statisticsMutex
);
if
(
failed
)
{
statistics
[
1
][
encodingIndex
]
++
;
...
...
@@ -83,7 +84,7 @@ void updateStatistics(int encodingIndex,rfbBool failed) {
/* maxDelta=0 means they are expected to match exactly;
* maxDelta>0 means that the average difference must be lower than maxDelta */
rfbBool
doFramebuffersMatch
(
rfbScreenInfo
*
server
,
rfbClient
*
client
,
static
rfbBool
doFramebuffersMatch
(
rfbScreenInfo
*
server
,
rfbClient
*
client
,
int
maxDelta
)
{
int
i
,
j
,
k
;
...
...
@@ -116,7 +117,10 @@ static rfbBool resize(rfbClient* cl) {
if
(
cl
->
frameBuffer
)
free
(
cl
->
frameBuffer
);
cl
->
frameBuffer
=
(
char
*
)
malloc
(
cl
->
width
*
cl
->
height
*
cl
->
format
.
bitsPerPixel
/
8
);
if
(
!
cl
->
frameBuffer
)
return
FALSE
;
SendFramebufferUpdateRequest
(
cl
,
0
,
0
,
cl
->
width
,
cl
->
height
,
FALSE
);
return
TRUE
;
}
typedef
struct
clientData
{
...
...
@@ -169,11 +173,11 @@ static void* clientLoop(void* data) {
rfbClientLog
(
"Starting client (encoding %s, display %s)
\n
"
,
testEncodings
[
cd
->
encodingIndex
].
str
,
cd
->
display
);
if
(
!
rfbInitClient
(
client
,
0
,
0
))
{
if
(
!
rfbInitClient
(
client
,
NULL
,
NULL
))
{
rfbClientErr
(
"Had problems starting client (encoding %s)
\n
"
,
testEncodings
[
cd
->
encodingIndex
].
str
);
updateStatistics
(
cd
->
encodingIndex
,
TRUE
);
return
0
;
return
NULL
;
}
while
(
1
)
{
if
(
WaitForMessage
(
client
,
50
)
>=
0
)
...
...
@@ -185,7 +189,7 @@ static void* clientLoop(void* data) {
if
(
client
->
frameBuffer
)
free
(
client
->
frameBuffer
);
rfbClientCleanup
(
client
);
return
0
;
return
NULL
;
}
static
void
startClient
(
int
encodingIndex
,
rfbScreenInfo
*
server
)
{
...
...
@@ -258,7 +262,7 @@ static void idle(rfbScreenInfo* server)
/* log function (to show what messages are from the client) */
void
static
void
rfbTestLog
(
const
char
*
format
,
...)
{
va_list
args
;
...
...
@@ -295,7 +299,7 @@ int main(int argc,char** argv)
server
=
rfbGetScreen
(
&
argc
,
argv
,
width
,
height
,
8
,
3
,
4
);
server
->
frameBuffer
=
malloc
(
400
*
300
*
4
);
server
->
cursor
=
0
;
server
->
cursor
=
NULL
;
for
(
j
=
0
;
j
<
400
*
300
*
4
;
j
++
)
server
->
frameBuffer
[
j
]
=
j
;
rfbInitServer
(
server
);
...
...
@@ -311,9 +315,9 @@ int main(int argc,char** argv)
#endif
startClient
(
i
,
server
);
t
=
time
(
0
);
t
=
time
(
NULL
);
/* test 20 seconds */
while
(
time
(
0
)
-
t
<
20
)
{
while
(
time
(
NULL
)
-
t
<
20
)
{
idle
(
server
);
...
...
vncterm/VNCommand.c
View file @
8bee4eb9
#define _BSD_SOURCE
#define _POSIX_SOURCE
#include "VNConsole.h"
#include "vga.h"
#ifdef LIBVNCSERVER_HAVE_FCNTL_H
...
...
vncterm/VNConsole.c
View file @
8bee4eb9
...
...
@@ -24,7 +24,6 @@ unsigned char colourMap16[16*3]={
void
MakeColourMap16
(
vncConsolePtr
c
)
{
int
i
,
j
;
rfbColourMap
*
colourMap
=&
(
c
->
screen
->
colourMap
);
if
(
colourMap
->
count
)
free
(
colourMap
->
data
.
bytes
);
...
...
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