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>
2005-05-14 Karl Runge <runge@karlrunge.com>
* x11vnc: more work on -scrollcopyrect and -xkb modes.
* 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],[
...
@@ -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
# First figure out what the name of Perl5 is
if test -z "$PERLBIN"; then
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
else
PERL="$PERLBIN"
PERL="$PERLBIN"
fi
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
,
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
,
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
,
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]={
...
@@ -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
,
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
,
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
,};
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 {
...
@@ -36,14 +36,14 @@ typedef struct private_resource_t {
static
private_resource_t
resource_pool
[
MAX_RESOURCE_COUNT
];
static
private_resource_t
resource_pool
[
MAX_RESOURCE_COUNT
];
static
int
resource_count
=
0
;
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
)
if
(
resource
>=
MAX_RESOURCE_COUNT
||
resource
<
0
||
resource_pool
[
resource
].
client
==
0
)
return
0
;
return
NULL
;
return
resource_pool
+
resource
;
return
resource_pool
+
resource
;
}
}
private_resource_t
*
get_next_resource
(
)
static
private_resource_t
*
get_next_resource
(
void
)
{
{
if
(
resource_count
<
MAX_RESOURCE_COUNT
)
{
if
(
resource_count
<
MAX_RESOURCE_COUNT
)
{
memset
(
resource_pool
+
resource_count
,
0
,
sizeof
(
private_resource_t
));
memset
(
resource_pool
+
resource_count
,
0
,
sizeof
(
private_resource_t
));
...
@@ -56,19 +56,19 @@ private_resource_t* get_next_resource()
...
@@ -56,19 +56,19 @@ private_resource_t* get_next_resource()
if
(
i
<
MAX_RESOURCE_COUNT
)
if
(
i
<
MAX_RESOURCE_COUNT
)
return
resource_pool
+
i
;
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
);
private_resource_t
*
res
=
get_resource
(
resource
);
if
(
res
)
if
(
res
)
res
->
client
=
0
;
res
->
client
=
NULL
;
}
}
/* hooks */
/* 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
;
private_resource_t
*
res
=
(
private_resource_t
*
)
cl
->
screen
->
screenData
;
...
@@ -77,7 +77,7 @@ void got_key(rfbBool down,rfbKeySym keysym,rfbClientRec* cl)
...
@@ -77,7 +77,7 @@ void got_key(rfbBool down,rfbKeySym keysym,rfbClientRec* cl)
res
->
result
|=
RESULT_KEY
;
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
;
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)
...
@@ -87,7 +87,7 @@ void got_mouse(int buttons,int x,int y,rfbClientRec* cl)
res
->
result
|=
RESULT_MOUSE
;
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
;
private_resource_t
*
res
=
(
private_resource_t
*
)
cl
->
clientData
;
...
@@ -96,7 +96,7 @@ rfbBool malloc_frame_buffer(rfbClient* cl)
...
@@ -96,7 +96,7 @@ rfbBool malloc_frame_buffer(rfbClient* cl)
res
->
client
->
frameBuffer
=
malloc
(
w
*
4
*
h
);
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
->
screenData
=
res
;
res
->
server
->
port
=
res
->
listen_port
;
res
->
server
->
port
=
res
->
listen_port
;
res
->
server
->
frameBuffer
=
res
->
client
->
frameBuffer
;
res
->
server
->
frameBuffer
=
res
->
client
->
frameBuffer
;
...
@@ -110,7 +110,7 @@ rfbBool malloc_frame_buffer(rfbClient* cl)
...
@@ -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
;
rfbClient
*
cl
;
image_t
*
image
;
image_t
*
image
;
...
@@ -146,7 +146,7 @@ bool_t do_visual_grep(private_resource_t* res,int x,int y,int w,int h)
...
@@ -146,7 +146,7 @@ bool_t do_visual_grep(private_resource_t* res,int x,int y,int w,int h)
return
0
;
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
;
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)
...
@@ -182,8 +182,8 @@ resource_t initvnc(const char* server,int server_port,int listen_port)
res
->
client
->
serverHost
=
strdup
(
server
);
res
->
client
->
serverHost
=
strdup
(
server
);
res
->
client
->
serverPort
=
server_port
;
res
->
client
->
serverPort
=
server_port
;
res
->
client
->
appData
.
encodingsString
=
"raw"
;
res
->
client
->
appData
.
encodingsString
=
"raw"
;
if
(
!
rfbInitClient
(
res
->
client
,
&
dummy
,
0
))
{
if
(
!
rfbInitClient
(
res
->
client
,
&
dummy
,
NULL
))
{
res
->
client
=
0
;
res
->
client
=
NULL
;
return
-
1
;
return
-
1
;
}
}
return
res
-
resource_pool
;
return
res
-
resource_pool
;
...
@@ -202,7 +202,7 @@ void closevnc(resource_t resource)
...
@@ -202,7 +202,7 @@ void closevnc(resource_t resource)
rfbClientCleanup
(
res
->
client
);
rfbClientCleanup
(
res
->
client
);
res
->
client
=
0
;
res
->
client
=
NULL
;
}
}
/* PNM (image) helpers */
/* PNM (image) helpers */
...
@@ -240,7 +240,7 @@ bool_t savepnm(resource_t resource,const char* filename,int x1,int y1,int x2,int
...
@@ -240,7 +240,7 @@ bool_t savepnm(resource_t resource,const char* filename,int x1,int y1,int x2,int
return
TRUE
;
return
TRUE
;
}
}
image_t
*
loadpnm
(
const
char
*
filename
)
static
image_t
*
loadpnm
(
const
char
*
filename
)
{
{
FILE
*
f
=
fopen
(
filename
,
"rb"
);
FILE
*
f
=
fopen
(
filename
,
"rb"
);
char
buffer
[
1024
];
char
buffer
[
1024
];
...
@@ -248,25 +248,25 @@ image_t* loadpnm(const char* filename)
...
@@ -248,25 +248,25 @@ image_t* loadpnm(const char* filename)
image_t
*
image
;
image_t
*
image
;
if
(
f
==
0
)
if
(
f
==
0
)
return
0
;
return
NULL
;
if
(
!
fgets
(
buffer
,
1024
,
f
)
||
strcmp
(
"P6
\n
"
,
buffer
))
{
if
(
!
fgets
(
buffer
,
1024
,
f
)
||
strcmp
(
"P6
\n
"
,
buffer
))
{
fclose
(
f
);
fclose
(
f
);
return
0
;
return
NULL
;
}
}
do
{
do
{
fgets
(
buffer
,
1024
,
f
);
fgets
(
buffer
,
1024
,
f
);
if
(
feof
(
f
))
{
if
(
feof
(
f
))
{
fclose
(
f
);
fclose
(
f
);
return
0
;
return
NULL
;
}
}
}
while
(
buffer
[
0
]
==
'#'
);
}
while
(
buffer
[
0
]
==
'#'
);
if
(
sscanf
(
buffer
,
"%d %d"
,
&
w
,
&
h
)
!=
2
if
(
sscanf
(
buffer
,
"%d %d"
,
&
w
,
&
h
)
!=
2
||
!
fgets
(
buffer
,
1024
,
f
)
||
strcmp
(
"255
\n
"
,
buffer
))
{
||
!
fgets
(
buffer
,
1024
,
f
)
||
strcmp
(
"255
\n
"
,
buffer
))
{
fclose
(
f
);
fclose
(
f
);
return
0
;
return
NULL
;
}
}
image
=
(
image_t
*
)
malloc
(
sizeof
(
image_t
));
image
=
(
image_t
*
)
malloc
(
sizeof
(
image_t
));
...
@@ -276,7 +276,7 @@ image_t* loadpnm(const char* filename)
...
@@ -276,7 +276,7 @@ image_t* loadpnm(const char* filename)
if
(
!
image
->
buffer
)
{
if
(
!
image
->
buffer
)
{
fclose
(
f
);
fclose
(
f
);
free
(
image
);
free
(
image
);
return
0
;
return
NULL
;
}
}
for
(
j
=
0
;
j
<
h
;
j
++
)
for
(
j
=
0
;
j
<
h
;
j
++
)
...
@@ -286,7 +286,7 @@ image_t* loadpnm(const char* filename)
...
@@ -286,7 +286,7 @@ image_t* loadpnm(const char* filename)
fclose
(
f
);
fclose
(
f
);
free
(
image
->
buffer
);
free
(
image
->
buffer
);
free
(
image
);
free
(
image
);
return
0
;
return
NULL
;
}
}
fclose
(
f
);
fclose
(
f
);
...
@@ -294,7 +294,7 @@ image_t* loadpnm(const char* filename)
...
@@ -294,7 +294,7 @@ image_t* loadpnm(const char* filename)
return
image
;
return
image
;
}
}
void
free_image
(
image_t
*
image
)
static
void
free_image
(
image_t
*
image
)
{
{
if
(
image
->
buffer
)
if
(
image
->
buffer
)
free
(
image
->
buffer
);
free
(
image
->
buffer
);
...
@@ -304,7 +304,7 @@ void free_image(image_t* image)
...
@@ -304,7 +304,7 @@ void free_image(image_t* image)
/* process() and friends */
/* process() and friends */
/* this function returns only if res->result in return_mask */
/* 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
);
private_resource_t
*
res
=
get_resource
(
resource
);
fd_set
fds
;
fd_set
fds
;
...
@@ -317,7 +317,7 @@ result_t private_process(resource_t resource,timeout_t timeout_in_seconds,result
...
@@ -317,7 +317,7 @@ result_t private_process(resource_t resource,timeout_t timeout_in_seconds,result
assert
(
res
->
client
);
assert
(
res
->
client
);
gettimeofday
(
&
tv_start
,
0
);
gettimeofday
(
&
tv_start
,
NULL
);
res
->
result
=
0
;
res
->
result
=
0
;
do
{
do
{
...
@@ -346,7 +346,7 @@ result_t private_process(resource_t resource,timeout_t timeout_in_seconds,result
...
@@ -346,7 +346,7 @@ result_t private_process(resource_t resource,timeout_t timeout_in_seconds,result
if
(
res
->
client
->
sock
>
max_fd
)
if
(
res
->
client
->
sock
>
max_fd
)
max_fd
=
res
->
client
->
sock
;
max_fd
=
res
->
client
->
sock
;
gettimeofday
(
&
tv_end
,
0
);
gettimeofday
(
&
tv_end
,
NULL
);
timeout_done
=
tv_end
.
tv_usec
-
tv_start
.
tv_usec
+
timeout_done
=
tv_end
.
tv_usec
-
tv_start
.
tv_usec
+
1000000L
*
(
tv_end
.
tv_sec
-
tv_start
.
tv_sec
);
1000000L
*
(
tv_end
.
tv_sec
-
tv_start
.
tv_sec
);
if
(
timeout_done
>=
timeout
)
if
(
timeout_done
>=
timeout
)
...
@@ -355,7 +355,7 @@ result_t private_process(resource_t resource,timeout_t timeout_in_seconds,result
...
@@ -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_usec
=
((
timeout
-
timeout_done
)
%
1000000
);
tv
.
tv_sec
=
(
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
)
if
(
count
<
0
)
return
0
;
return
0
;
...
@@ -422,7 +422,7 @@ result_t visualgrep(resource_t resource,const char* filename,timeout_t timeout)
...
@@ -422,7 +422,7 @@ result_t visualgrep(resource_t resource,const char* filename,timeout_t timeout)
/* free image */
/* free image */
if
(
res
->
grep_image
)
{
if
(
res
->
grep_image
)
{
free_image
(
res
->
grep_image
);
free_image
(
res
->
grep_image
);
res
->
grep_image
=
0
;
res
->
grep_image
=
NULL
;
}
}
return
result
;
return
result
;
...
@@ -432,7 +432,7 @@ result_t visualgrep(resource_t resource,const char* filename,timeout_t timeout)
...
@@ -432,7 +432,7 @@ result_t visualgrep(resource_t resource,const char* filename,timeout_t timeout)
#include "default8x16.h"
#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
;
rfbFontData
*
font
=&
default8x16Font
;
const
char
*
pointer
;
const
char
*
pointer
;
...
...
client_examples/SDLvncviewer.c
View file @
8bee4eb9
...
@@ -46,7 +46,7 @@ static rfbBool resize(rfbClient* client) {
...
@@ -46,7 +46,7 @@ static rfbBool resize(rfbClient* client) {
return
TRUE
;
return
TRUE
;
}
}
rfbKeySym
SDL_keysym2rfbKeySym
(
int
keysym
)
{
static
rfbKeySym
SDL_keysym2rfbKeySym
(
int
keysym
)
{
switch
(
keysym
)
{
switch
(
keysym
)
{
case
SDLK_BACKSPACE
:
return
XK_BackSpace
;
case
SDLK_BACKSPACE
:
return
XK_BackSpace
;
case
SDLK_TAB
:
return
XK_ISO_Left_Tab
;
case
SDLK_TAB
:
return
XK_ISO_Left_Tab
;
...
@@ -184,9 +184,10 @@ rfbKeySym SDL_keysym2rfbKeySym(int keysym) {
...
@@ -184,9 +184,10 @@ rfbKeySym SDL_keysym2rfbKeySym(int keysym) {
case
SDLK_BREAK
:
return
XK_Break
;
case
SDLK_BREAK
:
return
XK_Break
;
default:
rfbClientLog
(
"Unknown keysym: %d
\n
"
,
keysym
);
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
);
SDL_UpdateRect
(
cl
->
clientData
,
x
,
y
,
w
,
h
);
}
}
...
...
client_examples/ppmtest.c
View file @
8bee4eb9
...
@@ -6,11 +6,11 @@
...
@@ -6,11 +6,11 @@
#include <errno.h>
#include <errno.h>
#include <rfb/rfbclient.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
);
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
;
static
time_t
t
=
0
,
t1
;
FILE
*
f
;
FILE
*
f
;
int
i
,
j
;
int
i
,
j
;
...
@@ -19,7 +19,7 @@ void SaveFramebufferAsPPM(rfbClient* client, int x, int y, int w, int h) {
...
@@ -19,7 +19,7 @@ void SaveFramebufferAsPPM(rfbClient* client, int x, int y, int w, int h) {
int
row_stride
=
client
->
width
*
bpp
;
int
row_stride
=
client
->
width
*
bpp
;
/* save one picture only if the last is older than 2 seconds */
/* save one picture only if the last is older than 2 seconds */
t1
=
time
(
0
);
t1
=
time
(
NULL
);
if
(
t1
-
t
>
2
)
if
(
t1
-
t
>
2
)
t
=
t1
;
t
=
t1
;
else
else
...
@@ -46,6 +46,8 @@ void SaveFramebufferAsPPM(rfbClient* client, int x, int y, int w, int h) {
...
@@ -46,6 +46,8 @@ void SaveFramebufferAsPPM(rfbClient* client, int x, int y, int w, int h) {
v
=*
(
unsigned
int
*
)
p
;
v
=*
(
unsigned
int
*
)
p
;
else
if
(
bpp
==
2
)
else
if
(
bpp
==
2
)
v
=*
(
unsigned
short
*
)
p
;
v
=*
(
unsigned
short
*
)
p
;
else
v
=*
(
unsigned
char
*
)
p
;
fputc
((
v
>>
pf
->
redShift
)
*
256
/
(
pf
->
redMax
+
1
),
f
);
fputc
((
v
>>
pf
->
redShift
)
*
256
/
(
pf
->
redMax
+
1
),
f
);
fputc
((
v
>>
pf
->
greenShift
)
*
256
/
(
pf
->
greenMax
+
1
),
f
);
fputc
((
v
>>
pf
->
greenShift
)
*
256
/
(
pf
->
greenMax
+
1
),
f
);
fputc
((
v
>>
pf
->
blueShift
)
*
256
/
(
pf
->
blueMax
+
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) {
...
@@ -53,14 +55,11 @@ void SaveFramebufferAsPPM(rfbClient* client, int x, int y, int w, int h) {
fclose
(
f
);
fclose
(
f
);
}
}
int
int
main
(
int
argc
,
char
**
argv
)
main
(
int
argc
,
char
**
argv
)
{
{
int
i
;
rfbClient
*
client
=
rfbGetClient
(
8
,
3
,
4
);
rfbClient
*
client
=
rfbGetClient
(
8
,
3
,
4
);
const
char
*
vncServerHost
=
""
;
time_t
t
=
time
(
NULL
);
int
vncServerPort
=
5900
;
time_t
t
=
time
(
0
);
if
(
argc
>
1
&&
!
strcmp
(
"-print"
,
argv
[
1
]))
{
if
(
argc
>
1
&&
!
strcmp
(
"-print"
,
argv
[
1
]))
{
client
->
GotFrameBufferUpdate
=
PrintRect
;
client
->
GotFrameBufferUpdate
=
PrintRect
;
...
@@ -81,7 +80,8 @@ main(int argc, char **argv)
...
@@ -81,7 +80,8 @@ main(int argc, char **argv)
if
(
!
rfbInitClient
(
client
,
&
argc
,
argv
))
if
(
!
rfbInitClient
(
client
,
&
argc
,
argv
))
return
1
;
return
1
;
while
(
time
(
0
)
-
t
<
5
)
{
/* TODO: better wait for update completion */
while
(
time
(
NULL
)
-
t
<
5
)
{
static
int
i
=
0
;
static
int
i
=
0
;
fprintf
(
stderr
,
"
\r
%d"
,
i
++
);
fprintf
(
stderr
,
"
\r
%d"
,
i
++
);
if
(
WaitForMessage
(
client
,
50
)
<
0
)
if
(
WaitForMessage
(
client
,
50
)
<
0
)
...
...
contrib/zippy.c
View file @
8bee4eb9
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
#include <rfb/keysym.h>
#include <rfb/keysym.h>
#include <rfb/default8x16.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) */
/* odd maxx doesn't work (vncviewer bug) */
/* Here we create a structure so that every client has it's own pointer */
/* 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)
...
@@ -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) */
/* 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
;
rfbPixelFormat
f
=
s
->
serverFormat
;
int
i
,
j
;
int
i
,
j
;
...
@@ -88,7 +88,7 @@ void draw_primary_colours_generic(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2
...
@@ -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
);
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
;
rfbPixelFormat
f
=
s
->
serverFormat
;
int
i
,
j
,
y3
=
(
y1
*
2
+
y2
)
/
3
,
y4
=
(
y1
+
y2
*
2
)
/
3
;
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
...
@@ -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
;
rfbPixelFormat
f
=
s
->
serverFormat
;
int
y3
=
(
y1
*
2
+
y2
)
/
3
,
y4
=
(
y1
+
y2
*
2
)
/
3
;
int
y3
=
(
y1
*
2
+
y2
)
/
3
,
y4
=
(
y1
+
y2
*
2
)
/
3
;
...
...
examples/example.c
View file @
8bee4eb9
...
@@ -34,13 +34,13 @@
...
@@ -34,13 +34,13 @@
#include <rfb/rfb.h>
#include <rfb/rfb.h>
#include <rfb/keysym.h>
#include <rfb/keysym.h>
const
int
bpp
=
4
;
static
const
int
bpp
=
4
;
int
maxx
=
800
,
maxy
=
600
;
static
int
maxx
=
800
,
maxy
=
600
;
/* TODO: odd maxx doesn't work (vncviewer bug) */
/* TODO: odd maxx doesn't work (vncviewer bug) */
/* This initializes a nice (?) background */
/* This initializes a nice (?) background */
void
initBuffer
(
unsigned
char
*
buffer
)
static
void
initBuffer
(
unsigned
char
*
buffer
)
{
{
int
i
,
j
;
int
i
,
j
;
for
(
j
=
0
;
j
<
maxy
;
++
j
)
{
for
(
j
=
0
;
j
<
maxy
;
++
j
)
{
...
@@ -63,12 +63,12 @@ typedef struct ClientData {
...
@@ -63,12 +63,12 @@ typedef struct ClientData {
int
oldx
,
oldy
;
int
oldx
,
oldy
;
}
ClientData
;
}
ClientData
;
void
clientgone
(
rfbClientPtr
cl
)
static
void
clientgone
(
rfbClientPtr
cl
)
{
{
free
(
cl
->
clientData
);
free
(
cl
->
clientData
);
}
}
enum
rfbNewClientAction
newclient
(
rfbClientPtr
cl
)
static
enum
rfbNewClientAction
newclient
(
rfbClientPtr
cl
)
{
{
cl
->
clientData
=
(
void
*
)
calloc
(
sizeof
(
ClientData
),
1
);
cl
->
clientData
=
(
void
*
)
calloc
(
sizeof
(
ClientData
),
1
);
cl
->
clientGoneHook
=
clientgone
;
cl
->
clientGoneHook
=
clientgone
;
...
@@ -77,7 +77,7 @@ enum rfbNewClientAction newclient(rfbClientPtr cl)
...
@@ -77,7 +77,7 @@ enum rfbNewClientAction newclient(rfbClientPtr cl)
/* switch to new framebuffer contents */
/* 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
;
unsigned
char
*
oldfb
,
*
newfb
;
...
@@ -94,7 +94,7 @@ void newframebuffer(rfbScreenInfoPtr screen, int width, int height)
...
@@ -94,7 +94,7 @@ void newframebuffer(rfbScreenInfoPtr screen, int width, int height)
/* aux function to draw a line */
/* 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
;
int
i
,
j
;
i
=
x1
-
x2
;
j
=
y1
-
y2
;
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
...
@@ -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 */
/* 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
;
ClientData
*
cd
=
cl
->
clientData
;
...
@@ -163,7 +163,7 @@ void doptr(int buttonMask,int x,int y,rfbClientPtr cl)
...
@@ -163,7 +163,7 @@ void doptr(int buttonMask,int x,int y,rfbClientPtr cl)
/* Here the key events are handled */
/* 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
(
down
)
{
if
(
key
==
XK_Escape
)
if
(
key
==
XK_Escape
)
...
@@ -205,8 +205,10 @@ void dokey(rfbBool down,rfbKeySym key,rfbClientPtr cl)
...
@@ -205,8 +205,10 @@ void dokey(rfbBool down,rfbKeySym key,rfbClientPtr cl)
/* Example for an XCursor (foreground/background only) */
/* Example for an XCursor (foreground/background only) */
int
exampleXCursorWidth
=
9
,
exampleXCursorHeight
=
7
;
#ifdef JUST_AN_EXAMPLE
char
exampleXCursor
[]
=
static
int
exampleXCursorWidth
=
9
,
exampleXCursorHeight
=
7
;
static
char
exampleXCursor
[]
=
" "
" "
" xx xx "
" xx xx "
" xx xx "
" xx xx "
...
@@ -215,9 +217,11 @@ char exampleXCursor[]=
...
@@ -215,9 +217,11 @@ char exampleXCursor[]=
" xx xx "
" xx xx "
" "
;
" "
;
#endif
/* Example for a rich cursor (full-colour) */
/* Example for a rich cursor (full-colour) */
void
MakeRichCursor
(
rfbScreenInfoPtr
rfbScreen
)
static
void
MakeRichCursor
(
rfbScreenInfoPtr
rfbScreen
)
{
{
int
i
,
j
,
w
=
32
,
h
=
32
;
int
i
,
j
,
w
=
32
,
h
=
32
;
rfbCursorPtr
c
=
rfbScreen
->
cursor
;
rfbCursorPtr
c
=
rfbScreen
->
cursor
;
...
...
examples/fontsel.c
View file @
8bee4eb9
...
@@ -3,16 +3,16 @@
...
@@ -3,16 +3,16 @@
#define FONTDIR "/usr/lib/kbd/consolefonts/"
#define FONTDIR "/usr/lib/kbd/consolefonts/"
#define DEFAULTFONT FONTDIR "default8x16"
#define DEFAULTFONT FONTDIR "default8x16"
char
*
fontlist
[
50
]
=
{
static
char
*
fontlist
[
50
]
=
{
"8x16alt"
,
"b.fnt"
,
"c.fnt"
,
"default8x16"
,
"m.fnt"
,
"ml.fnt"
,
"mod_d.fnt"
,
"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"
,
"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"
,
"sc.fnt"
,
"scrawl_s.fnt"
,
"scrawl_w.fnt"
,
"sd.fnt"
,
"t.fnt"
,
0
NULL
};
};
rfbScreenInfoPtr
rfbScreen
=
0
;
static
rfbScreenInfoPtr
rfbScreen
=
NULL
;
rfbFontDataPtr
curFont
=
0
;
static
rfbFontDataPtr
curFont
=
NULL
;
void
showFont
(
int
index
)
static
void
showFont
(
int
index
)
{
{
char
buffer
[
1024
];
char
buffer
[
1024
];
...
...
examples/pnmshow.c
View file @
8bee4eb9
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
#include <rfb/rfb.h>
#include <rfb/rfb.h>
#include <rfb/keysym.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'
))
if
(
down
&&
(
key
==
XK_Escape
||
key
==
'q'
||
key
==
'Q'
))
rfbCloseClient
(
cl
);
rfbCloseClient
(
cl
);
...
@@ -96,6 +96,8 @@ int main(int argc,char** argv)
...
@@ -96,6 +96,8 @@ int main(int argc,char** argv)
rfbScreen
->
frameBuffer
[
j
*
paddedWidth
*
4
+
i
]
=
0
;
rfbScreen
->
frameBuffer
[
j
*
paddedWidth
*
4
+
i
]
=
0
;
}
}
break
;
break
;
case
GRAY
:
break
;
case
BW
:
case
BW
:
/* correct the format from 1 bit to 8 bits */
/* correct the format from 1 bit to 8 bits */
for
(
j
=
height
-
1
;
j
>=
0
;
j
--
)
for
(
j
=
height
-
1
;
j
>=
0
;
j
--
)
...
...
examples/pnmshow24.c
View file @
8bee4eb9
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
#error "I need the ALLOW24BPP flag to work"
#error "I need the ALLOW24BPP flag to work"
#endif
#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'
))
if
(
down
&&
(
key
==
XK_Escape
||
key
==
'q'
||
key
==
'Q'
))
rfbCloseClient
(
cl
);
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
,
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
,
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 */
0x00
,
0x28
,
0x28
,
0x28
,
0x28
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
/* 34 */
...
@@ -190,6 +190,6 @@ unsigned char radonFontData[2280]={
...
@@ -190,6 +190,6 @@ unsigned char radonFontData[2280]={
0x04
,
0x18
,
0x00
,
0x00
,
0x42
,
0x42
,
0x42
,
0x42
,
0x42
,
0x3a
,
0x02
,
0x3c
,
/* 253 */
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 */
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
,};
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
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 @@
...
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <stdio.h>
#include <rfb/rfb.h>
#include <rfb/rfb.h>
void
usage
(
void
)
static
void
usage
(
void
)
{
{
printf
(
"
\n
usage: storepasswd <password> <filename>
\n\n
"
);
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 */
/* This program is a simple server to show events coming from the client */
#define _BSD_SOURCE
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/types.h>
...
@@ -8,10 +9,12 @@
...
@@ -8,10 +9,12 @@
#include <rfb/rfb.h>
#include <rfb/rfb.h>
#include <rfb/default8x16.h>
#include <rfb/default8x16.h>
char
f
[
640
*
480
];
#define width 100
char
*
keys
[
0x400
];
#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
);
if
(
c
>
'f'
)
return
(
-
1
);
else
if
(
c
>
'F'
)
else
if
(
c
>
'F'
)
...
@@ -22,7 +25,7 @@ int hex2number(unsigned char c)
...
@@ -22,7 +25,7 @@ int hex2number(unsigned char c)
return
(
c
-
'0'
);
return
(
c
-
'0'
);
}
}
void
read_keys
(
)
static
void
read_keys
(
void
)
{
{
int
i
,
j
,
k
;
int
i
,
j
,
k
;
char
buffer
[
1024
];
char
buffer
[
1024
];
...
@@ -60,15 +63,15 @@ void read_keys()
...
@@ -60,15 +63,15 @@ void read_keys()
fclose
(
keysyms
);
fclose
(
keysyms
);
}
}
int
lineHeight
=
16
,
lineY
=
480
-
16
;
static
int
lineHeight
=
16
,
lineY
=
height
-
16
;
void
output
(
rfbScreenInfoPtr
s
,
char
*
line
)
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
);
rfbDrawString
(
s
,
&
default8x16Font
,
10
,
lineY
,
line
,
0x01
);
rfbLog
(
"%s
\n
"
,
line
);
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
];
char
buffer
[
1024
+
32
];
...
@@ -77,7 +80,7 @@ void dokey(rfbBool down,rfbKeySym k,rfbClientPtr cl)
...
@@ -77,7 +80,7 @@ void dokey(rfbBool down,rfbKeySym k,rfbClientPtr cl)
output
(
cl
->
screen
,
buffer
);
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
];
char
buffer
[
1024
];
if
(
buttonMask
)
{
if
(
buttonMask
)
{
...
@@ -87,7 +90,7 @@ void doptr(int buttonMask,int x,int y,rfbClientPtr cl)
...
@@ -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
];
char
buffer
[
1024
];
struct
sockaddr_in
addr
;
struct
sockaddr_in
addr
;
...
@@ -103,7 +106,7 @@ enum rfbNewClientAction newclient(rfbClientPtr cl)
...
@@ -103,7 +106,7 @@ enum rfbNewClientAction newclient(rfbClientPtr cl)
int
main
(
int
argc
,
char
**
argv
)
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
.
is16
=
FALSE
;
s
->
colourMap
.
count
=
2
;
s
->
colourMap
.
count
=
2
;
s
->
colourMap
.
data
.
bytes
=
(
unsigned
char
*
)
"
\xd0\xd0\xd0\x30\x01\xe0
"
;
s
->
colourMap
.
data
.
bytes
=
(
unsigned
char
*
)
"
\xd0\xd0\xd0\x30\x01\xe0
"
;
...
@@ -113,7 +116,7 @@ int main(int argc,char** argv)
...
@@ -113,7 +116,7 @@ int main(int argc,char** argv)
s
->
ptrAddEvent
=
doptr
;
s
->
ptrAddEvent
=
doptr
;
s
->
newClientHook
=
newclient
;
s
->
newClientHook
=
newclient
;
memset
(
f
,
0
,
640
*
480
);
memset
(
f
,
0
,
width
*
height
);
read_keys
();
read_keys
();
rfbInitServer
(
s
);
rfbInitServer
(
s
);
...
...
libvncclient/listen.c
View file @
8bee4eb9
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
* listen.c - listen for incoming connections
* listen.c - listen for incoming connections
*/
*/
#define _BSD_SOURCE
#include <unistd.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/types.h>
#ifdef __MINGW32__
#ifdef __MINGW32__
...
...
libvncclient/rfbproto.c
View file @
8bee4eb9
...
@@ -23,6 +23,8 @@
...
@@ -23,6 +23,8 @@
* rfbproto.c - functions to deal with client side of RFB protocol.
* rfbproto.c - functions to deal with client side of RFB protocol.
*/
*/
#define _BSD_SOURCE
#define _POSIX_SOURCE
#include <unistd.h>
#include <unistd.h>
#include <errno.h>
#include <errno.h>
#ifndef __MINGW32__
#ifndef __MINGW32__
...
@@ -31,6 +33,10 @@
...
@@ -31,6 +33,10 @@
#include <rfb/rfbclient.h>
#include <rfb/rfbclient.h>
#ifdef LIBVNCSERVER_HAVE_LIBZ
#ifdef LIBVNCSERVER_HAVE_LIBZ
#include <zlib.h>
#include <zlib.h>
#ifdef __CHECKER__
#undef Z_NULL
#define Z_NULL NULL
#endif
#endif
#endif
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
#include <jpeglib.h>
#include <jpeglib.h>
...
@@ -44,7 +50,7 @@
...
@@ -44,7 +50,7 @@
rfbBool
rfbEnableClientLogging
=
TRUE
;
rfbBool
rfbEnableClientLogging
=
TRUE
;
void
static
void
rfbDefaultClientLog
(
const
char
*
format
,
...)
rfbDefaultClientLog
(
const
char
*
format
,
...)
{
{
va_list
args
;
va_list
args
;
...
@@ -69,7 +75,7 @@ rfbDefaultClientLog(const char *format, ...)
...
@@ -69,7 +75,7 @@ rfbDefaultClientLog(const char *format, ...)
rfbClientLogProc
rfbClientLog
=
rfbDefaultClientLog
;
rfbClientLogProc
rfbClientLog
=
rfbDefaultClientLog
;
rfbClientLogProc
rfbClientErr
=
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
;
int
i
,
j
;
#define FILL_RECT(BPP) \
#define FILL_RECT(BPP) \
...
@@ -86,7 +92,7 @@ void FillRectangle(rfbClient* client, int x, int y, int w, int h, uint32_t colou
...
@@ -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
;
int
i
,
j
;
#define COPY_RECT(BPP) \
#define COPY_RECT(BPP) \
...
@@ -108,7 +114,7 @@ void CopyRectangle(rfbClient* client, uint8_t* buffer, int x, int y, int w, int
...
@@ -108,7 +114,7 @@ void CopyRectangle(rfbClient* client, uint8_t* buffer, int x, int y, int w, int
}
}
/* TODO: test */
/* 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
;
int
i
,
j
;
#define COPY_RECT_FROM_RECT(BPP) \
#define COPY_RECT_FROM_RECT(BPP) \
...
@@ -225,7 +231,7 @@ ConnectToRFBServer(rfbClient* client,const char *hostname, int port)
...
@@ -225,7 +231,7 @@ ConnectToRFBServer(rfbClient* client,const char *hostname, int port)
rfbClientLog
(
"Could not open %s.
\n
"
,
client
->
serverHost
);
rfbClientLog
(
"Could not open %s.
\n
"
,
client
->
serverHost
);
return
FALSE
;
return
FALSE
;
}
}
setbuf
(
rec
->
file
,
0
);
setbuf
(
rec
->
file
,
NULL
);
fread
(
buffer
,
1
,
strlen
(
magic
),
rec
->
file
);
fread
(
buffer
,
1
,
strlen
(
magic
),
rec
->
file
);
if
(
strncmp
(
buffer
,
magic
,
strlen
(
magic
)))
{
if
(
strncmp
(
buffer
,
magic
,
strlen
(
magic
)))
{
rfbClientLog
(
"File %s was not recorded by vncrec.
\n
"
,
client
->
serverHost
);
rfbClientLog
(
"File %s was not recorded by vncrec.
\n
"
,
client
->
serverHost
);
...
@@ -265,7 +271,7 @@ InitialiseRFBConnection(rfbClient* client)
...
@@ -265,7 +271,7 @@ InitialiseRFBConnection(rfbClient* client)
uint32_t
authScheme
,
reasonLen
,
authResult
;
uint32_t
authScheme
,
reasonLen
,
authResult
;
char
*
reason
;
char
*
reason
;
uint8_t
challenge
[
CHALLENGESIZE
];
uint8_t
challenge
[
CHALLENGESIZE
];
char
*
passwd
;
char
*
passwd
=
NULL
;
int
i
;
int
i
;
rfbClientInitMsg
ci
;
rfbClientInitMsg
ci
;
...
@@ -1028,8 +1034,7 @@ HandleRFBServerMessage(rfbClient* client)
...
@@ -1028,8 +1034,7 @@ HandleRFBServerMessage(rfbClient* client)
*/
*/
void
void
PrintPixelFormat
(
format
)
PrintPixelFormat
(
rfbPixelFormat
*
format
)
rfbPixelFormat
*
format
;
{
{
if
(
format
->
bitsPerPixel
==
1
)
{
if
(
format
->
bitsPerPixel
==
1
)
{
rfbClientLog
(
" Single bit per pixel.
\n
"
);
rfbClientLog
(
" Single bit per pixel.
\n
"
);
...
@@ -1143,9 +1148,6 @@ JpegSetSrcManager(j_decompress_ptr cinfo, uint8_t *compressedData,
...
@@ -1143,9 +1148,6 @@ JpegSetSrcManager(j_decompress_ptr cinfo, uint8_t *compressedData,
/* avoid name clashes with LibVNCServer */
/* avoid name clashes with LibVNCServer */
#define rfbEncryptBytes rfbClientEncryptBytes
#define rfbEncryptBytes rfbClientEncryptBytes
#define rfbEncryptAndStorePasswd rfbClientEncryptAndStorePasswdUnused
#define rfbDecryptPasswdFromFile rfbClientDecryptPasswdFromFileUnused
#define rfbRandomBytes rfbClientRandomBytesUnused
#define rfbDes rfbClientDes
#define rfbDes rfbClientDes
#define rfbDesKey rfbClientDesKey
#define rfbDesKey rfbClientDesKey
#define rfbUseKey rfbClientUseKey
#define rfbUseKey rfbClientUseKey
...
...
libvncclient/sockets.c
View file @
8bee4eb9
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
* sockets.c - functions to deal with sockets.
* sockets.c - functions to deal with sockets.
*/
*/
#define _BSD_SOURCE
#include <unistd.h>
#include <unistd.h>
#include <errno.h>
#include <errno.h>
#include <fcntl.h>
#include <fcntl.h>
...
...
libvncclient/vncviewer.c
View file @
8bee4eb9
...
@@ -21,6 +21,8 @@
...
@@ -21,6 +21,8 @@
* vncviewer.c - the Xt-based VNC viewer.
* vncviewer.c - the Xt-based VNC viewer.
*/
*/
#define _BSD_SOURCE
#define _POSIX_SOURCE
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
...
@@ -34,11 +36,12 @@ static rfbBool DummyPoint(rfbClient* client, int x, int y) {
...
@@ -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
)
{
static
void
DummyRect
(
rfbClient
*
client
,
int
x
,
int
y
,
int
w
,
int
h
)
{
}
}
#ifdef __MINGW32__
static
char
*
NoPassword
(
rfbClient
*
client
)
{
static
char
*
NoPassword
(
rfbClient
*
client
)
{
return
strdup
(
""
);
return
strdup
(
""
);
}
}
#else
#ifndef __MINGW32__
#include <stdio.h>
#include <stdio.h>
#include <termios.h>
#include <termios.h>
#endif
#endif
...
@@ -103,10 +106,10 @@ rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel,
...
@@ -103,10 +106,10 @@ rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel,
rfbClient
*
client
=
(
rfbClient
*
)
calloc
(
sizeof
(
rfbClient
),
1
);
rfbClient
*
client
=
(
rfbClient
*
)
calloc
(
sizeof
(
rfbClient
),
1
);
if
(
!
client
)
{
if
(
!
client
)
{
rfbClientErr
(
"Couldn't allocate client structure!
\n
"
);
rfbClientErr
(
"Couldn't allocate client structure!
\n
"
);
return
0
;
return
NULL
;
}
}
initAppData
(
&
client
->
appData
);
initAppData
(
&
client
->
appData
);
client
->
programName
=
0
;
client
->
programName
=
NULL
;
client
->
endianTest
=
1
;
client
->
endianTest
=
1
;
client
->
programName
=
""
;
client
->
programName
=
""
;
client
->
serverHost
=
""
;
client
->
serverHost
=
""
;
...
...
libvncserver/auth.c
View file @
8bee4eb9
...
@@ -35,8 +35,7 @@
...
@@ -35,8 +35,7 @@
*/
*/
void
void
rfbAuthNewClient
(
cl
)
rfbAuthNewClient
(
rfbClientPtr
cl
)
rfbClientPtr
cl
;
{
{
char
buf
[
4
+
CHALLENGESIZE
];
char
buf
[
4
+
CHALLENGESIZE
];
int
len
;
int
len
;
...
@@ -68,8 +67,7 @@ rfbAuthNewClient(cl)
...
@@ -68,8 +67,7 @@ rfbAuthNewClient(cl)
*/
*/
void
void
rfbAuthProcessClientMessage
(
cl
)
rfbAuthProcessClientMessage
(
rfbClientPtr
cl
)
rfbClientPtr
cl
;
{
{
int
n
;
int
n
;
uint8_t
response
[
CHALLENGESIZE
];
uint8_t
response
[
CHALLENGESIZE
];
...
...
libvncserver/cargs.c
View file @
8bee4eb9
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
#include <rfb/rfb.h>
#include <rfb/rfb.h>
extern
rfbStringToAddr
(
char
*
str
,
in_addr_t
*
iface
);
extern
int
rfbStringToAddr
(
char
*
str
,
in_addr_t
*
iface
);
void
void
rfbUsage
(
void
)
rfbUsage
(
void
)
...
@@ -88,7 +88,7 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
...
@@ -88,7 +88,7 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
return
FALSE
;
return
FALSE
;
}
}
passwds
[
0
]
=
argv
[
++
i
];
passwds
[
0
]
=
argv
[
++
i
];
passwds
[
1
]
=
0
;
passwds
[
1
]
=
NULL
;
rfbScreen
->
authPasswdData
=
(
void
*
)
passwds
;
rfbScreen
->
authPasswdData
=
(
void
*
)
passwds
;
rfbScreen
->
passwordCheck
=
rfbCheckPasswordByList
;
rfbScreen
->
passwordCheck
=
rfbCheckPasswordByList
;
}
else
if
(
strcmp
(
argv
[
i
],
"-deferupdate"
)
==
0
)
{
/* -deferupdate milliseconds */
}
else
if
(
strcmp
(
argv
[
i
],
"-deferupdate"
)
==
0
)
{
/* -deferupdate milliseconds */
...
@@ -149,12 +149,6 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
...
@@ -149,12 +149,6 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
return
TRUE
;
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
rfbBool
rfbProcessSizeArguments
(
int
*
width
,
int
*
height
,
int
*
bpp
,
int
*
argc
,
char
*
argv
[])
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,
...
@@ -57,9 +57,11 @@ static rfbBool rfbSendSmallRectEncodingCoRRE(rfbClientPtr cl, int x, int y,
*/
*/
rfbBool
rfbBool
rfbSendRectEncodingCoRRE
(
cl
,
x
,
y
,
w
,
h
)
rfbSendRectEncodingCoRRE
(
rfbClientPtr
cl
,
rfbClientPtr
cl
;
int
x
,
int
x
,
y
,
w
,
h
;
int
y
,
int
w
,
int
h
)
{
{
if
(
h
>
cl
->
correMaxHeight
)
{
if
(
h
>
cl
->
correMaxHeight
)
{
return
(
rfbSendRectEncodingCoRRE
(
cl
,
x
,
y
,
w
,
cl
->
correMaxHeight
)
&&
return
(
rfbSendRectEncodingCoRRE
(
cl
,
x
,
y
,
w
,
cl
->
correMaxHeight
)
&&
...
@@ -85,9 +87,11 @@ rfbSendRectEncodingCoRRE(cl, x, y, w, h)
...
@@ -85,9 +87,11 @@ rfbSendRectEncodingCoRRE(cl, x, y, w, h)
*/
*/
static
rfbBool
static
rfbBool
rfbSendSmallRectEncodingCoRRE
(
cl
,
x
,
y
,
w
,
h
)
rfbSendSmallRectEncodingCoRRE
(
rfbClientPtr
cl
,
rfbClientPtr
cl
;
int
x
,
int
x
,
y
,
w
,
h
;
int
y
,
int
w
,
int
h
)
{
{
rfbFramebufferUpdateRectHeader
rect
;
rfbFramebufferUpdateRectHeader
rect
;
rfbRREHeader
hdr
;
rfbRREHeader
hdr
;
...
@@ -206,11 +210,7 @@ rfbSendSmallRectEncodingCoRRE(cl, x, y, w, h)
...
@@ -206,11 +210,7 @@ rfbSendSmallRectEncodingCoRRE(cl, x, y, w, h)
#define DEFINE_SUBRECT_ENCODE(bpp) \
#define DEFINE_SUBRECT_ENCODE(bpp) \
static int \
static int \
subrectEncode##bpp(data,w,h) \
subrectEncode##bpp(uint##bpp##_t *data, int w, int h) { \
uint##bpp##_t *data; \
int w; \
int h; \
{ \
uint##bpp##_t cl; \
uint##bpp##_t cl; \
rfbCoRRERectangle subrect; \
rfbCoRRERectangle subrect; \
int x,y; \
int x,y; \
...
@@ -277,7 +277,7 @@ subrectEncode##bpp(data,w,h) \
...
@@ -277,7 +277,7 @@ subrectEncode##bpp(data,w,h) \
return -1; \
return -1; \
\
\
numsubs += 1; \
numsubs += 1; \
*((uint##bpp##_t*)(rreAfterBuf + rreAfterBufLen)) = cl;
\
*((uint##bpp##_t*)(rreAfterBuf + rreAfterBufLen)) = cl; \
rreAfterBufLen += (bpp/8); \
rreAfterBufLen += (bpp/8); \
memcpy(&rreAfterBuf[rreAfterBufLen],&subrect,sz_rfbCoRRERectangle); \
memcpy(&rreAfterBuf[rreAfterBufLen],&subrect,sz_rfbCoRRERectangle); \
rreAfterBufLen += sz_rfbCoRRERectangle; \
rreAfterBufLen += sz_rfbCoRRERectangle; \
...
@@ -306,12 +306,9 @@ DEFINE_SUBRECT_ENCODE(32)
...
@@ -306,12 +306,9 @@ DEFINE_SUBRECT_ENCODE(32)
* getBgColour() gets the most prevalent colour in a byte array.
* getBgColour() gets the most prevalent colour in a byte array.
*/
*/
static
uint32_t
static
uint32_t
getBgColour
(
data
,
size
,
bpp
)
getBgColour
(
char
*
data
,
int
size
,
int
bpp
)
char
*
data
;
int
size
;
int
bpp
;
{
{
#define NUMCLRS 256
#define NUMCLRS 256
static
int
counts
[
NUMCLRS
];
static
int
counts
[
NUMCLRS
];
...
...
libvncserver/cursor.c
View file @
8bee4eb9
...
@@ -24,14 +24,14 @@
...
@@ -24,14 +24,14 @@
#include <rfb/rfb.h>
#include <rfb/rfb.h>
#include <rfb/rfbregion.h>
#include <rfb/rfbregion.h>
#include "private.h"
/*
/*
* Send cursor shape either in X-style format or in client pixel format.
* Send cursor shape either in X-style format or in client pixel format.
*/
*/
rfbBool
rfbBool
rfbSendCursorShape
(
cl
)
rfbSendCursorShape
(
rfbClientPtr
cl
)
rfbClientPtr
cl
;
{
{
rfbCursorPtr
pCursor
;
rfbCursorPtr
pCursor
;
rfbFramebufferUpdateRectHeader
rect
;
rfbFramebufferUpdateRectHeader
rect
;
...
@@ -360,8 +360,8 @@ void rfbFreeCursor(rfbCursorPtr cursor)
...
@@ -360,8 +360,8 @@ void rfbFreeCursor(rfbCursorPtr cursor)
else
{
else
{
cursor
->
cleanup
=
cursor
->
cleanupSource
=
cursor
->
cleanupMask
cursor
->
cleanup
=
cursor
->
cleanupSource
=
cursor
->
cleanupMask
=
cursor
->
cleanupRichSource
=
FALSE
;
=
cursor
->
cleanupRichSource
=
FALSE
;
cursor
->
source
=
cursor
->
mask
=
cursor
->
richSource
=
0
;
cursor
->
source
=
cursor
->
mask
=
cursor
->
richSource
=
NULL
;
cursor
->
alphaSource
=
0
;
cursor
->
alphaSource
=
NULL
;
}
}
}
}
...
@@ -633,9 +633,9 @@ void rfbRedrawAfterHideCursor(rfbClientPtr cl,sraRegionPtr updateRegion)
...
@@ -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
;
int
i
,
i1
,
j
,
w
=
(
cursor
->
width
+
7
)
/
8
;
unsigned
char
bit
;
unsigned
char
bit
;
...
@@ -649,6 +649,8 @@ void rfbPrintXCursor(rfbCursorPtr cursor)
...
@@ -649,6 +649,8 @@ void rfbPrintXCursor(rfbCursorPtr cursor)
}
}
}
}
#endif
void
rfbSetCursor
(
rfbScreenInfoPtr
rfbScreen
,
rfbCursorPtr
c
)
void
rfbSetCursor
(
rfbScreenInfoPtr
rfbScreen
,
rfbCursorPtr
c
)
{
{
rfbClientIteratorPtr
iterator
;
rfbClientIteratorPtr
iterator
;
...
@@ -660,7 +662,7 @@ void rfbSetCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr c)
...
@@ -660,7 +662,7 @@ void rfbSetCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr c)
iterator
=
rfbGetClientIterator
(
rfbScreen
);
iterator
=
rfbGetClientIterator
(
rfbScreen
);
while
((
cl
=
rfbClientIteratorNext
(
iterator
)))
while
((
cl
=
rfbClientIteratorNext
(
iterator
)))
if
(
!
cl
->
enableCursorShapeUpdates
)
if
(
!
cl
->
enableCursorShapeUpdates
)
rfbRedrawAfterHideCursor
(
cl
,
0
);
rfbRedrawAfterHideCursor
(
cl
,
NULL
);
rfbReleaseClientIterator
(
iterator
);
rfbReleaseClientIterator
(
iterator
);
if
(
rfbScreen
->
cursor
->
cleanup
)
if
(
rfbScreen
->
cursor
->
cleanup
)
...
@@ -673,7 +675,7 @@ void rfbSetCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr c)
...
@@ -673,7 +675,7 @@ void rfbSetCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr c)
while
((
cl
=
rfbClientIteratorNext
(
iterator
)))
{
while
((
cl
=
rfbClientIteratorNext
(
iterator
)))
{
cl
->
cursorWasChanged
=
TRUE
;
cl
->
cursorWasChanged
=
TRUE
;
if
(
!
cl
->
enableCursorShapeUpdates
)
if
(
!
cl
->
enableCursorShapeUpdates
)
rfbRedrawAfterHideCursor
(
cl
,
0
);
rfbRedrawAfterHideCursor
(
cl
,
NULL
);
}
}
rfbReleaseClientIterator
(
iterator
);
rfbReleaseClientIterator
(
iterator
);
...
...
libvncserver/d3des.c
View file @
8bee4eb9
...
@@ -71,9 +71,8 @@ static unsigned char pc2[48] = {
...
@@ -71,9 +71,8 @@ static unsigned char pc2[48] = {
40
,
51
,
30
,
36
,
46
,
54
,
29
,
39
,
50
,
44
,
32
,
47
,
40
,
51
,
30
,
36
,
46
,
54
,
29
,
39
,
50
,
44
,
32
,
47
,
43
,
48
,
38
,
55
,
33
,
52
,
45
,
41
,
49
,
35
,
28
,
31
};
43
,
48
,
38
,
55
,
33
,
52
,
45
,
41
,
49
,
35
,
28
,
31
};
void
rfbDesKey
(
key
,
edf
)
/* Thanks to James Gillogly & Phil Karn! */
void
rfbDesKey
(
unsigned
char
*
key
,
unsigned
char
*
key
;
int
edf
)
int
edf
;
{
{
register
int
i
,
j
,
l
,
m
,
n
;
register
int
i
,
j
,
l
,
m
,
n
;
unsigned
char
pc1m
[
56
],
pcr
[
56
];
unsigned
char
pc1m
[
56
],
pcr
[
56
];
...
@@ -108,8 +107,7 @@ int edf;
...
@@ -108,8 +107,7 @@ int edf;
return
;
return
;
}
}
static
void
cookey
(
raw1
)
static
void
cookey
(
register
unsigned
long
*
raw1
)
register
unsigned
long
*
raw1
;
{
{
register
unsigned
long
*
cook
,
*
raw0
;
register
unsigned
long
*
cook
,
*
raw0
;
unsigned
long
dough
[
32
];
unsigned
long
dough
[
32
];
...
@@ -131,8 +129,7 @@ register unsigned long *raw1;
...
@@ -131,8 +129,7 @@ register unsigned long *raw1;
return
;
return
;
}
}
void
rfbCPKey
(
into
)
void
rfbCPKey
(
register
unsigned
long
*
into
)
register
unsigned
long
*
into
;
{
{
register
unsigned
long
*
from
,
*
endp
;
register
unsigned
long
*
from
,
*
endp
;
...
@@ -141,8 +138,7 @@ register unsigned long *into;
...
@@ -141,8 +138,7 @@ register unsigned long *into;
return
;
return
;
}
}
void
rfbUseKey
(
from
)
void
rfbUseKey
(
register
unsigned
long
*
from
)
register
unsigned
long
*
from
;
{
{
register
unsigned
long
*
to
,
*
endp
;
register
unsigned
long
*
to
,
*
endp
;
...
@@ -151,8 +147,8 @@ register unsigned long *from;
...
@@ -151,8 +147,8 @@ register unsigned long *from;
return
;
return
;
}
}
void
rfbDes
(
inblock
,
outblock
)
void
rfbDes
(
unsigned
char
*
inblock
,
unsigned
char
*
inblock
,
*
outblock
;
unsigned
char
*
outblock
)
{
{
unsigned
long
work
[
2
];
unsigned
long
work
[
2
];
...
@@ -162,9 +158,8 @@ unsigned char *inblock, *outblock;
...
@@ -162,9 +158,8 @@ unsigned char *inblock, *outblock;
return
;
return
;
}
}
static
void
scrunch
(
outof
,
into
)
static
void
scrunch
(
register
unsigned
char
*
outof
,
register
unsigned
char
*
outof
;
register
unsigned
long
*
into
)
register
unsigned
long
*
into
;
{
{
*
into
=
(
*
outof
++
&
0xffL
)
<<
24
;
*
into
=
(
*
outof
++
&
0xffL
)
<<
24
;
*
into
|=
(
*
outof
++
&
0xffL
)
<<
16
;
*
into
|=
(
*
outof
++
&
0xffL
)
<<
16
;
...
@@ -177,9 +172,8 @@ register unsigned long *into;
...
@@ -177,9 +172,8 @@ register unsigned long *into;
return
;
return
;
}
}
static
void
unscrun
(
outof
,
into
)
static
void
unscrun
(
register
unsigned
long
*
outof
,
register
unsigned
long
*
outof
;
register
unsigned
char
*
into
)
register
unsigned
char
*
into
;
{
{
*
into
++
=
(
unsigned
char
)((
*
outof
>>
24
)
&
0xffL
);
*
into
++
=
(
unsigned
char
)((
*
outof
>>
24
)
&
0xffL
);
*
into
++
=
(
unsigned
char
)((
*
outof
>>
16
)
&
0xffL
);
*
into
++
=
(
unsigned
char
)((
*
outof
>>
16
)
&
0xffL
);
...
@@ -336,8 +330,8 @@ static unsigned long SP8[64] = {
...
@@ -336,8 +330,8 @@ static unsigned long SP8[64] = {
0x10041040L
,
0x00041000L
,
0x00041000L
,
0x00001040L
,
0x10041040L
,
0x00041000L
,
0x00041000L
,
0x00001040L
,
0x00001040L
,
0x00040040L
,
0x10000000L
,
0x10041000L
};
0x00001040L
,
0x00040040L
,
0x10000000L
,
0x10041000L
};
static
void
desfunc
(
block
,
keys
)
static
void
desfunc
(
register
unsigned
long
*
block
,
register
unsigned
long
*
block
,
*
keys
;
register
unsigned
long
*
keys
)
{
{
register
unsigned
long
fval
,
work
,
right
,
leftt
;
register
unsigned
long
fval
,
work
,
right
,
leftt
;
register
int
round
;
register
int
round
;
...
...
libvncserver/font.c
View file @
8bee4eb9
...
@@ -145,7 +145,7 @@ void rfbWholeFontBBox(rfbFontDataPtr font,
...
@@ -145,7 +145,7 @@ void rfbWholeFontBBox(rfbFontDataPtr font,
int
i
;
int
i
;
int
*
m
=
font
->
metaData
;
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
++
)
{
for
(
i
=
0
;
i
<
256
;
i
++
)
{
if
(
m
[
i
*
5
+
1
]
-
m
[
i
*
5
+
3
]
>
(
*
x2
))
if
(
m
[
i
*
5
+
1
]
-
m
[
i
*
5
+
3
]
>
(
*
x2
))
(
*
x2
)
=
m
[
i
*
5
+
1
]
-
m
[
i
*
5
+
3
];
(
*
x2
)
=
m
[
i
*
5
+
1
]
-
m
[
i
*
5
+
3
];
...
@@ -164,14 +164,14 @@ rfbFontDataPtr rfbLoadConsoleFont(char *filename)
...
@@ -164,14 +164,14 @@ rfbFontDataPtr rfbLoadConsoleFont(char *filename)
rfbFontDataPtr
p
;
rfbFontDataPtr
p
;
int
i
;
int
i
;
if
(
!
f
)
return
(
0
)
;
if
(
!
f
)
return
NULL
;
p
=
(
rfbFontDataPtr
)
malloc
(
sizeof
(
rfbFontData
));
p
=
(
rfbFontDataPtr
)
malloc
(
sizeof
(
rfbFontData
));
p
->
data
=
(
unsigned
char
*
)
malloc
(
4096
);
p
->
data
=
(
unsigned
char
*
)
malloc
(
4096
);
if
(
1
!=
fread
(
p
->
data
,
4096
,
1
,
f
))
{
if
(
1
!=
fread
(
p
->
data
,
4096
,
1
,
f
))
{
free
(
p
->
data
);
free
(
p
->
data
);
free
(
p
);
free
(
p
);
return
(
0
)
;
return
NULL
;
}
}
fclose
(
f
);
fclose
(
f
);
p
->
metaData
=
(
int
*
)
malloc
(
256
*
5
*
sizeof
(
int
));
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 @@
...
@@ -69,7 +69,7 @@
#define OK_STR "HTTP/1.0 200 OK\nContent-Type: text/html\r\n\r\n"
#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
compareAndSkip
(
char
**
ptr
,
const
char
*
str
);
static
rfbBool
parseParams
(
const
char
*
request
,
char
*
result
,
int
max_bytes
);
static
rfbBool
parseParams
(
const
char
*
request
,
char
*
result
,
int
max_bytes
);
static
rfbBool
validateString
(
char
*
str
);
static
rfbBool
validateString
(
char
*
str
);
...
@@ -131,7 +131,7 @@ rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen)
...
@@ -131,7 +131,7 @@ rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen)
fd_set
fds
;
fd_set
fds
;
struct
timeval
tv
;
struct
timeval
tv
;
struct
sockaddr_in
addr
;
struct
sockaddr_in
addr
;
s
ize
_t
addrlen
=
sizeof
(
addr
);
s
ocklen
_t
addrlen
=
sizeof
(
addr
);
if
(
!
rfbScreen
->
httpDir
)
if
(
!
rfbScreen
->
httpDir
)
return
;
return
;
...
@@ -221,7 +221,7 @@ static void
...
@@ -221,7 +221,7 @@ static void
httpProcessInput
(
rfbScreenInfoPtr
rfbScreen
)
httpProcessInput
(
rfbScreenInfoPtr
rfbScreen
)
{
{
struct
sockaddr_in
addr
;
struct
sockaddr_in
addr
;
s
ize
_t
addrlen
=
sizeof
(
addr
);
s
ocklen
_t
addrlen
=
sizeof
(
addr
);
char
fullFname
[
512
];
char
fullFname
[
512
];
char
params
[
1024
];
char
params
[
1024
];
char
*
ptr
;
char
*
ptr
;
...
...
libvncserver/main.c
View file @
8bee4eb9
...
@@ -10,8 +10,10 @@
...
@@ -10,8 +10,10 @@
* see GPL (latest version) for full details
* see GPL (latest version) for full details
*/
*/
#define _BSD_SOURCE
#include <rfb/rfb.h>
#include <rfb/rfb.h>
#include <rfb/rfbregion.h>
#include <rfb/rfbregion.h>
#include "private.h"
#include <stdarg.h>
#include <stdarg.h>
#include <errno.h>
#include <errno.h>
...
@@ -35,10 +37,10 @@
...
@@ -35,10 +37,10 @@
#include <time.h>
#include <time.h>
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
MUTEX
(
logMutex
);
static
MUTEX
(
logMutex
);
#endif
#endif
int
rfbEnableLogging
=
1
;
static
int
rfbEnableLogging
=
1
;
#ifdef LIBVNCSERVER_WORDS_BIGENDIAN
#ifdef LIBVNCSERVER_WORDS_BIGENDIAN
char
rfbEndianTest
=
0
;
char
rfbEndianTest
=
0
;
...
@@ -46,10 +48,6 @@ char rfbEndianTest = 0;
...
@@ -46,10 +48,6 @@ char rfbEndianTest = 0;
char
rfbEndianTest
=
-
1
;
char
rfbEndianTest
=
-
1
;
#endif
#endif
/* from rfbserver.c */
void
rfbIncrClientRef
(
rfbClientPtr
cl
);
void
rfbDecrClientRef
(
rfbClientPtr
cl
);
void
rfbLogEnable
(
int
enabled
)
{
void
rfbLogEnable
(
int
enabled
)
{
rfbEnableLogging
=
enabled
;
rfbEnableLogging
=
enabled
;
}
}
...
@@ -58,7 +56,7 @@ void rfbLogEnable(int enabled) {
...
@@ -58,7 +56,7 @@ void rfbLogEnable(int enabled) {
* rfbLog prints a time-stamped message to the log file (stderr).
* rfbLog prints a time-stamped message to the log file (stderr).
*/
*/
void
static
void
rfbDefaultLog
(
const
char
*
format
,
...)
rfbDefaultLog
(
const
char
*
format
,
...)
{
{
va_list
args
;
va_list
args
;
...
@@ -220,6 +218,8 @@ void rfbMarkRectAsModified(rfbScreenInfoPtr screen,int x1,int y1,int x2,int y2)
...
@@ -220,6 +218,8 @@ void rfbMarkRectAsModified(rfbScreenInfoPtr screen,int x1,int y1,int x2,int y2)
}
}
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
#include <unistd.h>
static
void
*
static
void
*
clientOutput
(
void
*
data
)
clientOutput
(
void
*
data
)
{
{
...
@@ -305,7 +305,7 @@ listenerRun(void *data)
...
@@ -305,7 +305,7 @@ listenerRun(void *data)
int
client_fd
;
int
client_fd
;
struct
sockaddr_in
peer
;
struct
sockaddr_in
peer
;
rfbClientPtr
cl
;
rfbClientPtr
cl
;
s
ize
_t
len
;
s
ocklen
_t
len
;
len
=
sizeof
(
peer
);
len
=
sizeof
(
peer
);
...
@@ -355,7 +355,6 @@ rfbDefaultPtrAddEvent(int buttonMask, int x, int y, rfbClientPtr cl)
...
@@ -355,7 +355,6 @@ rfbDefaultPtrAddEvent(int buttonMask, int x, int y, rfbClientPtr cl)
rfbClientIteratorPtr
iterator
;
rfbClientIteratorPtr
iterator
;
rfbClientPtr
other_client
;
rfbClientPtr
other_client
;
rfbScreenInfoPtr
s
=
cl
->
screen
;
rfbScreenInfoPtr
s
=
cl
->
screen
;
rfbCursorPtr
c
=
s
->
cursor
;
if
(
x
!=
s
->
cursorX
||
y
!=
s
->
cursorY
)
{
if
(
x
!=
s
->
cursorX
||
y
!=
s
->
cursorY
)
{
LOCK
(
s
->
cursorMutex
);
LOCK
(
s
->
cursorMutex
);
...
@@ -378,7 +377,7 @@ rfbDefaultPtrAddEvent(int buttonMask, int x, int y, rfbClientPtr cl)
...
@@ -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 =
...
@@ -393,7 +392,7 @@ static rfbCursor myCursor =
8
,
7
,
3
,
3
,
8
,
7
,
3
,
3
,
0
,
0
,
0
,
0
,
0
,
0
,
0xffff
,
0xffff
,
0xffff
,
0xffff
,
0xffff
,
0xffff
,
0
NULL
};
};
#else
#else
static
rfbCursor
myCursor
=
static
rfbCursor
myCursor
=
...
@@ -407,17 +406,17 @@ static rfbCursor myCursor =
...
@@ -407,17 +406,17 @@ static rfbCursor myCursor =
width
:
8
,
height
:
7
,
xhot
:
3
,
yhot
:
3
,
width
:
8
,
height
:
7
,
xhot
:
3
,
yhot
:
3
,
foreRed
:
0
,
foreGreen
:
0
,
foreBlue
:
0
,
foreRed
:
0
,
foreGreen
:
0
,
foreBlue
:
0
,
backRed
:
0xffff
,
backGreen
:
0xffff
,
backBlue
:
0xffff
,
backRed
:
0xffff
,
backGreen
:
0xffff
,
backBlue
:
0xffff
,
richSource
:
0
richSource
:
NULL
};
};
#endif
#endif
rfbCursorPtr
rfbDefaultGetCursorPtr
(
rfbClientPtr
cl
)
static
rfbCursorPtr
rfbDefaultGetCursorPtr
(
rfbClientPtr
cl
)
{
{
return
(
cl
->
screen
->
cursor
);
return
(
cl
->
screen
->
cursor
);
}
}
/* response is cl->authChallenge vncEncrypted with passwd */
/* 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
;
int
i
;
char
*
passwd
=
rfbDecryptPasswdFromFile
(
cl
->
screen
->
authPasswdData
);
char
*
passwd
=
rfbDecryptPasswdFromFile
(
cl
->
screen
->
authPasswdData
);
...
@@ -473,12 +472,12 @@ void rfbDoNothingWithClient(rfbClientPtr cl)
...
@@ -473,12 +472,12 @@ void rfbDoNothingWithClient(rfbClientPtr cl)
{
{
}
}
enum
rfbNewClientAction
rfbDefaultNewClientHook
(
rfbClientPtr
cl
)
static
enum
rfbNewClientAction
rfbDefaultNewClientHook
(
rfbClientPtr
cl
)
{
{
return
RFB_CLIENT_ACCEPT
;
return
RFB_CLIENT_ACCEPT
;
}
}
rfbBool
rfbDefaultProcessCustomClientMessage
(
rfbClientPtr
cl
,
uint8_t
type
)
static
rfbBool
rfbDefaultProcessCustomClientMessage
(
rfbClientPtr
cl
,
uint8_t
type
)
{
{
return
FALSE
;
return
FALSE
;
}
}
...
@@ -541,8 +540,8 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
...
@@ -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
);
rfbErr
(
"WARNING: Width (%d) is not a multiple of 4. VncViewer has problems with that.
\n
"
,
width
);
screen
->
autoPort
=
FALSE
;
screen
->
autoPort
=
FALSE
;
screen
->
clientHead
=
0
;
screen
->
clientHead
=
NULL
;
screen
->
pointerClient
=
0
;
screen
->
pointerClient
=
NULL
;
screen
->
port
=
5900
;
screen
->
port
=
5900
;
screen
->
socketState
=
RFB_SOCKET_INIT
;
screen
->
socketState
=
RFB_SOCKET_INIT
;
...
@@ -552,7 +551,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
...
@@ -552,7 +551,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
screen
->
udpSock
=-
1
;
screen
->
udpSock
=-
1
;
screen
->
udpSockConnected
=
FALSE
;
screen
->
udpSockConnected
=
FALSE
;
screen
->
udpPort
=
0
;
screen
->
udpPort
=
0
;
screen
->
udpClient
=
0
;
screen
->
udpClient
=
NULL
;
screen
->
maxFd
=
0
;
screen
->
maxFd
=
0
;
screen
->
listenSock
=-
1
;
screen
->
listenSock
=-
1
;
...
@@ -568,7 +567,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
...
@@ -568,7 +567,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
screen
->
alwaysShared
=
FALSE
;
screen
->
alwaysShared
=
FALSE
;
screen
->
neverShared
=
FALSE
;
screen
->
neverShared
=
FALSE
;
screen
->
dontDisconnect
=
FALSE
;
screen
->
dontDisconnect
=
FALSE
;
screen
->
authPasswdData
=
0
;
screen
->
authPasswdData
=
NULL
;
screen
->
authPasswdFirstViewOnly
=
1
;
screen
->
authPasswdFirstViewOnly
=
1
;
screen
->
width
=
width
;
screen
->
width
=
width
;
...
@@ -586,7 +585,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
...
@@ -586,7 +585,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
if
(
!
rfbProcessArguments
(
screen
,
argc
,
argv
))
{
if
(
!
rfbProcessArguments
(
screen
,
argc
,
argv
))
{
free
(
screen
);
free
(
screen
);
return
0
;
return
NULL
;
}
}
#ifdef WIN32
#ifdef WIN32
...
@@ -626,7 +625,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
...
@@ -626,7 +625,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
screen
->
getCursorPtr
=
rfbDefaultGetCursorPtr
;
screen
->
getCursorPtr
=
rfbDefaultGetCursorPtr
;
screen
->
setTranslateFunction
=
rfbSetTranslateFunction
;
screen
->
setTranslateFunction
=
rfbSetTranslateFunction
;
screen
->
newClientHook
=
rfbDefaultNewClientHook
;
screen
->
newClientHook
=
rfbDefaultNewClientHook
;
screen
->
displayHook
=
0
;
screen
->
displayHook
=
NULL
;
screen
->
processCustomClientMessage
=
rfbDefaultProcessCustomClientMessage
;
screen
->
processCustomClientMessage
=
rfbDefaultProcessCustomClientMessage
;
/* initialize client list and iterator mutex */
/* initialize client list and iterator mutex */
...
@@ -709,10 +708,6 @@ void rfbNewFramebuffer(rfbScreenInfoPtr screen, char *framebuffer,
...
@@ -709,10 +708,6 @@ void rfbNewFramebuffer(rfbScreenInfoPtr screen, char *framebuffer,
rfbReleaseClientIterator
(
iterator
);
rfbReleaseClientIterator
(
iterator
);
}
}
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
extern
void
TightCleanup
();
#endif
/* hang up on all clients and free all reserved memory */
/* hang up on all clients and free all reserved memory */
void
rfbScreenCleanup
(
rfbScreenInfoPtr
screen
)
void
rfbScreenCleanup
(
rfbScreenInfoPtr
screen
)
...
@@ -732,10 +727,10 @@ void rfbScreenCleanup(rfbScreenInfoPtr screen)
...
@@ -732,10 +727,10 @@ void rfbScreenCleanup(rfbScreenInfoPtr screen)
TINI_MUTEX
(
screen
->
cursorMutex
);
TINI_MUTEX
(
screen
->
cursorMutex
);
if
(
screen
->
cursor
&&
screen
->
cursor
->
cleanup
)
if
(
screen
->
cursor
&&
screen
->
cursor
->
cleanup
)
rfbFreeCursor
(
screen
->
cursor
);
rfbFreeCursor
(
screen
->
cursor
);
free
(
screen
);
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
rfbTightCleanup
();
rfbTightCleanup
(
screen
);
#endif
#endif
free
(
screen
);
}
}
void
rfbInitServer
(
rfbScreenInfoPtr
screen
)
void
rfbInitServer
(
rfbScreenInfoPtr
screen
)
...
@@ -781,9 +776,6 @@ void gettimeofday(struct timeval* tv,char* dummy)
...
@@ -781,9 +776,6 @@ void gettimeofday(struct timeval* tv,char* dummy)
}
}
#endif
#endif
/* defined in rfbserver.c, but kind of "private" */
rfbClientPtr
rfbClientIteratorHead
(
rfbClientIteratorPtr
i
);
rfbBool
rfbBool
rfbProcessEvents
(
rfbScreenInfoPtr
screen
,
long
usec
)
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 {
...
@@ -30,7 +30,7 @@ typedef struct sraRegion {
sraSpanList
*
sraSpanListDup
(
const
sraSpanList
*
src
);
sraSpanList
*
sraSpanListDup
(
const
sraSpanList
*
src
);
void
sraSpanListDestroy
(
sraSpanList
*
list
);
void
sraSpanListDestroy
(
sraSpanList
*
list
);
sraSpan
*
s
tatic
s
raSpan
*
sraSpanCreate
(
int
start
,
int
end
,
const
sraSpanList
*
subspan
)
{
sraSpanCreate
(
int
start
,
int
end
,
const
sraSpanList
*
subspan
)
{
sraSpan
*
item
=
(
sraSpan
*
)
malloc
(
sizeof
(
sraSpan
));
sraSpan
*
item
=
(
sraSpan
*
)
malloc
(
sizeof
(
sraSpan
));
item
->
_next
=
item
->
_prev
=
NULL
;
item
->
_next
=
item
->
_prev
=
NULL
;
...
@@ -40,7 +40,7 @@ sraSpanCreate(int start, int end, const sraSpanList *subspan) {
...
@@ -40,7 +40,7 @@ sraSpanCreate(int start, int end, const sraSpanList *subspan) {
return
item
;
return
item
;
}
}
sraSpan
*
s
tatic
s
raSpan
*
sraSpanDup
(
const
sraSpan
*
src
)
{
sraSpanDup
(
const
sraSpan
*
src
)
{
sraSpan
*
span
;
sraSpan
*
span
;
if
(
!
src
)
return
NULL
;
if
(
!
src
)
return
NULL
;
...
@@ -48,7 +48,7 @@ sraSpanDup(const sraSpan *src) {
...
@@ -48,7 +48,7 @@ sraSpanDup(const sraSpan *src) {
return
span
;
return
span
;
}
}
void
static
void
sraSpanInsertAfter
(
sraSpan
*
newspan
,
sraSpan
*
after
)
{
sraSpanInsertAfter
(
sraSpan
*
newspan
,
sraSpan
*
after
)
{
newspan
->
_next
=
after
->
_next
;
newspan
->
_next
=
after
->
_next
;
newspan
->
_prev
=
after
;
newspan
->
_prev
=
after
;
...
@@ -56,7 +56,7 @@ sraSpanInsertAfter(sraSpan *newspan, sraSpan *after) {
...
@@ -56,7 +56,7 @@ sraSpanInsertAfter(sraSpan *newspan, sraSpan *after) {
after
->
_next
=
newspan
;
after
->
_next
=
newspan
;
}
}
void
static
void
sraSpanInsertBefore
(
sraSpan
*
newspan
,
sraSpan
*
before
)
{
sraSpanInsertBefore
(
sraSpan
*
newspan
,
sraSpan
*
before
)
{
newspan
->
_next
=
before
;
newspan
->
_next
=
before
;
newspan
->
_prev
=
before
->
_prev
;
newspan
->
_prev
=
before
->
_prev
;
...
@@ -64,19 +64,20 @@ sraSpanInsertBefore(sraSpan *newspan, sraSpan *before) {
...
@@ -64,19 +64,20 @@ sraSpanInsertBefore(sraSpan *newspan, sraSpan *before) {
before
->
_prev
=
newspan
;
before
->
_prev
=
newspan
;
}
}
void
static
void
sraSpanRemove
(
sraSpan
*
span
)
{
sraSpanRemove
(
sraSpan
*
span
)
{
span
->
_prev
->
_next
=
span
->
_next
;
span
->
_prev
->
_next
=
span
->
_next
;
span
->
_next
->
_prev
=
span
->
_prev
;
span
->
_next
->
_prev
=
span
->
_prev
;
}
}
void
static
void
sraSpanDestroy
(
sraSpan
*
span
)
{
sraSpanDestroy
(
sraSpan
*
span
)
{
if
(
span
->
subspan
)
sraSpanListDestroy
(
span
->
subspan
);
if
(
span
->
subspan
)
sraSpanListDestroy
(
span
->
subspan
);
free
(
span
);
free
(
span
);
}
}
void
#ifdef DEBUG
static
void
sraSpanCheck
(
const
sraSpan
*
span
,
const
char
*
text
)
{
sraSpanCheck
(
const
sraSpan
*
span
,
const
char
*
text
)
{
/* Check the span is valid! */
/* Check the span is valid! */
if
(
span
->
start
==
span
->
end
)
{
if
(
span
->
start
==
span
->
end
)
{
...
@@ -84,12 +85,13 @@ sraSpanCheck(const sraSpan *span, const char *text) {
...
@@ -84,12 +85,13 @@ sraSpanCheck(const sraSpan *span, const char *text) {
printf
(
":%d-%d
\n
"
,
span
->
start
,
span
->
end
);
printf
(
":%d-%d
\n
"
,
span
->
start
,
span
->
end
);
}
}
}
}
#endif
/* -=- SpanList routines */
/* -=- SpanList routines */
void
sraSpanPrint
(
const
sraSpan
*
s
);
static
void
sraSpanPrint
(
const
sraSpan
*
s
);
void
static
void
sraSpanListPrint
(
const
sraSpanList
*
l
)
{
sraSpanListPrint
(
const
sraSpanList
*
l
)
{
sraSpan
*
curr
;
sraSpan
*
curr
;
if
(
!
l
)
{
if
(
!
l
)
{
...
@@ -112,8 +114,8 @@ sraSpanPrint(const sraSpan *s) {
...
@@ -112,8 +114,8 @@ sraSpanPrint(const sraSpan *s) {
sraSpanListPrint
(
s
->
subspan
);
sraSpanListPrint
(
s
->
subspan
);
}
}
sraSpanList
*
s
tatic
s
raSpanList
*
sraSpanListCreate
()
{
sraSpanListCreate
(
void
)
{
sraSpanList
*
item
=
(
sraSpanList
*
)
malloc
(
sizeof
(
sraSpanList
));
sraSpanList
*
item
=
(
sraSpanList
*
)
malloc
(
sizeof
(
sraSpanList
));
item
->
front
.
_next
=
&
(
item
->
back
);
item
->
front
.
_next
=
&
(
item
->
back
);
item
->
front
.
_prev
=
NULL
;
item
->
front
.
_prev
=
NULL
;
...
@@ -152,7 +154,7 @@ sraSpanListDestroy(sraSpanList *list) {
...
@@ -152,7 +154,7 @@ sraSpanListDestroy(sraSpanList *list) {
free
(
list
);
free
(
list
);
}
}
void
static
void
sraSpanListMakeEmpty
(
sraSpanList
*
list
)
{
sraSpanListMakeEmpty
(
sraSpanList
*
list
)
{
sraSpan
*
curr
,
*
next
;
sraSpan
*
curr
,
*
next
;
while
(
list
->
front
.
_next
!=
&
(
list
->
back
))
{
while
(
list
->
front
.
_next
!=
&
(
list
->
back
))
{
...
@@ -168,7 +170,7 @@ sraSpanListMakeEmpty(sraSpanList *list) {
...
@@ -168,7 +170,7 @@ sraSpanListMakeEmpty(sraSpanList *list) {
list
->
back
.
_next
=
NULL
;
list
->
back
.
_next
=
NULL
;
}
}
rfbBool
static
rfbBool
sraSpanListEqual
(
const
sraSpanList
*
s1
,
const
sraSpanList
*
s2
)
{
sraSpanListEqual
(
const
sraSpanList
*
s1
,
const
sraSpanList
*
s2
)
{
sraSpan
*
sp1
,
*
sp2
;
sraSpan
*
sp1
,
*
sp2
;
...
@@ -201,12 +203,12 @@ sraSpanListEqual(const sraSpanList *s1, const sraSpanList *s2) {
...
@@ -201,12 +203,12 @@ sraSpanListEqual(const sraSpanList *s1, const sraSpanList *s2) {
}
}
}
}
rfbBool
static
rfbBool
sraSpanListEmpty
(
const
sraSpanList
*
list
)
{
sraSpanListEmpty
(
const
sraSpanList
*
list
)
{
return
(
list
->
front
.
_next
==
&
(
list
->
back
));
return
(
list
->
front
.
_next
==
&
(
list
->
back
));
}
}
unsigned
long
static
unsigned
long
sraSpanListCount
(
const
sraSpanList
*
list
)
{
sraSpanListCount
(
const
sraSpanList
*
list
)
{
sraSpan
*
curr
=
list
->
front
.
_next
;
sraSpan
*
curr
=
list
->
front
.
_next
;
unsigned
long
count
=
0
;
unsigned
long
count
=
0
;
...
@@ -221,7 +223,7 @@ sraSpanListCount(const sraSpanList *list) {
...
@@ -221,7 +223,7 @@ sraSpanListCount(const sraSpanList *list) {
return
count
;
return
count
;
}
}
void
static
void
sraSpanMergePrevious
(
sraSpan
*
dest
)
{
sraSpanMergePrevious
(
sraSpan
*
dest
)
{
sraSpan
*
prev
=
dest
->
_prev
;
sraSpan
*
prev
=
dest
->
_prev
;
...
@@ -242,7 +244,7 @@ sraSpanMergePrevious(sraSpan *dest) {
...
@@ -242,7 +244,7 @@ sraSpanMergePrevious(sraSpan *dest) {
}
}
}
}
void
static
void
sraSpanMergeNext
(
sraSpan
*
dest
)
{
sraSpanMergeNext
(
sraSpan
*
dest
)
{
sraSpan
*
next
=
dest
->
_next
;
sraSpan
*
next
=
dest
->
_next
;
while
((
next
->
_next
)
&&
while
((
next
->
_next
)
&&
...
@@ -262,7 +264,7 @@ sraSpanMergeNext(sraSpan *dest) {
...
@@ -262,7 +264,7 @@ sraSpanMergeNext(sraSpan *dest) {
}
}
}
}
void
static
void
sraSpanListOr
(
sraSpanList
*
dest
,
const
sraSpanList
*
src
)
{
sraSpanListOr
(
sraSpanList
*
dest
,
const
sraSpanList
*
src
)
{
sraSpan
*
d_curr
,
*
s_curr
;
sraSpan
*
d_curr
,
*
s_curr
;
int
s_start
,
s_end
;
int
s_start
,
s_end
;
...
@@ -352,7 +354,7 @@ sraSpanListOr(sraSpanList *dest, const sraSpanList *src) {
...
@@ -352,7 +354,7 @@ sraSpanListOr(sraSpanList *dest, const sraSpanList *src) {
}
}
}
}
rfbBool
static
rfbBool
sraSpanListAnd
(
sraSpanList
*
dest
,
const
sraSpanList
*
src
)
{
sraSpanListAnd
(
sraSpanList
*
dest
,
const
sraSpanList
*
src
)
{
sraSpan
*
d_curr
,
*
s_curr
,
*
d_next
;
sraSpan
*
d_curr
,
*
s_curr
,
*
d_next
;
...
@@ -432,7 +434,7 @@ sraSpanListAnd(sraSpanList *dest, const sraSpanList *src) {
...
@@ -432,7 +434,7 @@ sraSpanListAnd(sraSpanList *dest, const sraSpanList *src) {
return
!
sraSpanListEmpty
(
dest
);
return
!
sraSpanListEmpty
(
dest
);
}
}
rfbBool
static
rfbBool
sraSpanListSubtract
(
sraSpanList
*
dest
,
const
sraSpanList
*
src
)
{
sraSpanListSubtract
(
sraSpanList
*
dest
,
const
sraSpanList
*
src
)
{
sraSpan
*
d_curr
,
*
s_curr
;
sraSpan
*
d_curr
,
*
s_curr
;
...
@@ -506,7 +508,7 @@ sraSpanListSubtract(sraSpanList *dest, const sraSpanList *src) {
...
@@ -506,7 +508,7 @@ sraSpanListSubtract(sraSpanList *dest, const sraSpanList *src) {
/* -=- Region routines */
/* -=- Region routines */
sraRegion
*
sraRegion
*
sraRgnCreate
()
{
sraRgnCreate
(
void
)
{
return
(
sraRegion
*
)
sraSpanListCreate
();
return
(
sraRegion
*
)
sraSpanListCreate
();
}
}
...
@@ -686,7 +688,7 @@ sraRectangleIterator *sraRgnGetIterator(sraRegion *s)
...
@@ -686,7 +688,7 @@ sraRectangleIterator *sraRgnGetIterator(sraRegion *s)
sraRectangleIterator
*
i
=
sraRectangleIterator
*
i
=
(
sraRectangleIterator
*
)
malloc
(
sizeof
(
sraRectangleIterator
));
(
sraRectangleIterator
*
)
malloc
(
sizeof
(
sraRectangleIterator
));
if
(
!
i
)
if
(
!
i
)
return
(
0
)
;
return
NULL
;
/* we have to recurse eventually. So, the first sPtr is the pointer to
/* 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
the sraSpan in the first level. the second sPtr is the pointer to
...
@@ -695,7 +697,7 @@ sraRectangleIterator *sraRgnGetIterator(sraRegion *s)
...
@@ -695,7 +697,7 @@ sraRectangleIterator *sraRgnGetIterator(sraRegion *s)
i
->
sPtrs
=
(
sraSpan
**
)
malloc
(
sizeof
(
sraSpan
*
)
*
DEFSIZE
);
i
->
sPtrs
=
(
sraSpan
**
)
malloc
(
sizeof
(
sraSpan
*
)
*
DEFSIZE
);
if
(
!
i
->
sPtrs
)
{
if
(
!
i
->
sPtrs
)
{
free
(
i
);
free
(
i
);
return
(
0
)
;
return
NULL
;
}
}
i
->
ptrSize
=
DEFSIZE
;
i
->
ptrSize
=
DEFSIZE
;
i
->
sPtrs
[
0
]
=
&
(
s
->
front
);
i
->
sPtrs
[
0
]
=
&
(
s
->
front
);
...
@@ -703,7 +705,7 @@ sraRectangleIterator *sraRgnGetIterator(sraRegion *s)
...
@@ -703,7 +705,7 @@ sraRectangleIterator *sraRgnGetIterator(sraRegion *s)
i
->
ptrPos
=
0
;
i
->
ptrPos
=
0
;
i
->
reverseX
=
0
;
i
->
reverseX
=
0
;
i
->
reverseY
=
0
;
i
->
reverseY
=
0
;
return
(
i
)
;
return
i
;
}
}
sraRectangleIterator
*
sraRgnGetReverseIterator
(
sraRegion
*
s
,
rfbBool
reverseX
,
rfbBool
reverseY
)
sraRectangleIterator
*
sraRgnGetReverseIterator
(
sraRegion
*
s
,
rfbBool
reverseX
,
rfbBool
reverseY
)
...
@@ -718,13 +720,13 @@ sraRectangleIterator *sraRgnGetReverseIterator(sraRegion *s,rfbBool reverseX,rfb
...
@@ -718,13 +720,13 @@ sraRectangleIterator *sraRgnGetReverseIterator(sraRegion *s,rfbBool reverseX,rfb
return
(
i
);
return
(
i
);
}
}
rfbBool
sraReverse
(
sraRectangleIterator
*
i
)
static
rfbBool
sraReverse
(
sraRectangleIterator
*
i
)
{
{
return
(
((
i
->
ptrPos
&
2
)
&&
i
->
reverseX
)
||
return
(
((
i
->
ptrPos
&
2
)
&&
i
->
reverseX
)
||
(
!
(
i
->
ptrPos
&
2
)
&&
i
->
reverseY
));
(
!
(
i
->
ptrPos
&
2
)
&&
i
->
reverseY
));
}
}
sraSpan
*
sraNextSpan
(
sraRectangleIterator
*
i
)
s
tatic
s
raSpan
*
sraNextSpan
(
sraRectangleIterator
*
i
)
{
{
if
(
sraReverse
(
i
))
if
(
sraReverse
(
i
))
return
(
i
->
sPtrs
[
i
->
ptrPos
]
->
_prev
);
return
(
i
->
sPtrs
[
i
->
ptrPos
]
->
_prev
);
...
...
libvncserver/rfbserver.c
View file @
8bee4eb9
...
@@ -24,9 +24,11 @@
...
@@ -24,9 +24,11 @@
* USA.
* USA.
*/
*/
#define _BSD_SOURCE
#include <string.h>
#include <string.h>
#include <rfb/rfb.h>
#include <rfb/rfb.h>
#include <rfb/rfbregion.h>
#include <rfb/rfbregion.h>
#include "private.h"
#ifdef LIBVNCSERVER_HAVE_FCNTL_H
#ifdef LIBVNCSERVER_HAVE_FCNTL_H
#include <fcntl.h>
#include <fcntl.h>
...
@@ -60,11 +62,6 @@
...
@@ -60,11 +62,6 @@
#define DEBUGPROTO(x)
#define DEBUGPROTO(x)
#endif
#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
rfbProcessClientProtocolVersion
(
rfbClientPtr
cl
);
static
void
rfbProcessClientNormalMessage
(
rfbClientPtr
cl
);
static
void
rfbProcessClientNormalMessage
(
rfbClientPtr
cl
);
...
@@ -92,7 +89,7 @@ void rfbDecrClientRef(rfbClientPtr cl) {}
...
@@ -92,7 +89,7 @@ void rfbDecrClientRef(rfbClientPtr cl) {}
#endif
#endif
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
MUTEX
(
rfbClientListMutex
);
static
MUTEX
(
rfbClientListMutex
);
#endif
#endif
struct
rfbClientIterator
{
struct
rfbClientIterator
{
...
@@ -118,7 +115,7 @@ rfbGetClientIterator(rfbScreenInfoPtr rfbScreen)
...
@@ -118,7 +115,7 @@ rfbGetClientIterator(rfbScreenInfoPtr rfbScreen)
{
{
rfbClientIteratorPtr
i
=
rfbClientIteratorPtr
i
=
(
rfbClientIteratorPtr
)
malloc
(
sizeof
(
struct
rfbClientIterator
));
(
rfbClientIteratorPtr
)
malloc
(
sizeof
(
struct
rfbClientIterator
));
i
->
next
=
0
;
i
->
next
=
NULL
;
i
->
screen
=
rfbScreen
;
i
->
screen
=
rfbScreen
;
return
i
;
return
i
;
}
}
...
@@ -175,9 +172,8 @@ rfbReleaseClientIterator(rfbClientIteratorPtr iterator)
...
@@ -175,9 +172,8 @@ rfbReleaseClientIterator(rfbClientIteratorPtr iterator)
*/
*/
void
void
rfbNewClientConnection
(
rfbScreen
,
sock
)
rfbNewClientConnection
(
rfbScreenInfoPtr
rfbScreen
,
rfbScreenInfoPtr
rfbScreen
;
int
sock
)
int
sock
;
{
{
rfbClientPtr
cl
;
rfbClientPtr
cl
;
...
@@ -195,10 +191,9 @@ rfbNewClientConnection(rfbScreen,sock)
...
@@ -195,10 +191,9 @@ rfbNewClientConnection(rfbScreen,sock)
*/
*/
rfbClientPtr
rfbClientPtr
rfbReverseConnection
(
rfbScreen
,
host
,
port
)
rfbReverseConnection
(
rfbScreenInfoPtr
rfbScreen
,
rfbScreenInfoPtr
rfbScreen
;
char
*
host
,
char
*
host
;
int
port
)
int
port
;
{
{
int
sock
;
int
sock
;
rfbClientPtr
cl
;
rfbClientPtr
cl
;
...
@@ -221,17 +216,16 @@ rfbReverseConnection(rfbScreen,host, port)
...
@@ -221,17 +216,16 @@ rfbReverseConnection(rfbScreen,host, port)
* means.
* means.
*/
*/
rfbClientPtr
static
rfbClientPtr
rfbNewTCPOrUDPClient
(
rfbScreen
,
sock
,
isUDP
)
rfbNewTCPOrUDPClient
(
rfbScreenInfoPtr
rfbScreen
,
rfbScreenInfoPtr
rfbScreen
;
int
sock
,
int
sock
;
rfbBool
isUDP
)
rfbBool
isUDP
;
{
{
rfbProtocolVersionMsg
pv
;
rfbProtocolVersionMsg
pv
;
rfbClientIteratorPtr
iterator
;
rfbClientIteratorPtr
iterator
;
rfbClientPtr
cl
,
cl_
;
rfbClientPtr
cl
,
cl_
;
struct
sockaddr_in
addr
;
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
);
cl
=
(
rfbClientPtr
)
calloc
(
sizeof
(
rfbClientRec
),
1
);
...
@@ -287,7 +281,7 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
...
@@ -287,7 +281,7 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
cl
->
correMaxWidth
=
48
;
cl
->
correMaxWidth
=
48
;
cl
->
correMaxHeight
=
48
;
cl
->
correMaxHeight
=
48
;
#ifdef LIBVNCSERVER_HAVE_LIBZ
#ifdef LIBVNCSERVER_HAVE_LIBZ
cl
->
zrleData
=
0
;
cl
->
zrleData
=
NULL
;
#endif
#endif
cl
->
copyRegion
=
sraRgnCreate
();
cl
->
copyRegion
=
sraRgnCreate
();
...
@@ -378,16 +372,14 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
...
@@ -378,16 +372,14 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
}
}
rfbClientPtr
rfbClientPtr
rfbNewClient
(
rfbScreen
,
sock
)
rfbNewClient
(
rfbScreenInfoPtr
rfbScreen
,
rfbScreenInfoPtr
rfbScreen
;
int
sock
)
int
sock
;
{
{
return
(
rfbNewTCPOrUDPClient
(
rfbScreen
,
sock
,
FALSE
));
return
(
rfbNewTCPOrUDPClient
(
rfbScreen
,
sock
,
FALSE
));
}
}
rfbClientPtr
rfbClientPtr
rfbNewUDPClient
(
rfbScreen
)
rfbNewUDPClient
(
rfbScreenInfoPtr
rfbScreen
)
rfbScreenInfoPtr
rfbScreen
;
{
{
return
((
rfbScreen
->
udpClient
=
return
((
rfbScreen
->
udpClient
=
rfbNewTCPOrUDPClient
(
rfbScreen
,
rfbScreen
->
udpSock
,
TRUE
)));
rfbNewTCPOrUDPClient
(
rfbScreen
,
rfbScreen
->
udpSock
,
TRUE
)));
...
@@ -399,8 +391,7 @@ rfbNewUDPClient(rfbScreen)
...
@@ -399,8 +391,7 @@ rfbNewUDPClient(rfbScreen)
*/
*/
void
void
rfbClientConnectionGone
(
cl
)
rfbClientConnectionGone
(
rfbClientPtr
cl
)
rfbClientPtr
cl
;
{
{
int
i
;
int
i
;
...
@@ -417,7 +408,7 @@ rfbClientConnectionGone(cl)
...
@@ -417,7 +408,7 @@ rfbClientConnectionGone(cl)
close
(
cl
->
sock
);
close
(
cl
->
sock
);
#ifdef LIBVNCSERVER_HAVE_LIBZ
#ifdef LIBVNCSERVER_HAVE_LIBZ
FreeZrleData
(
cl
);
rfb
FreeZrleData
(
cl
);
#endif
#endif
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
...
@@ -456,7 +447,7 @@ rfbClientConnectionGone(cl)
...
@@ -456,7 +447,7 @@ rfbClientConnectionGone(cl)
#endif
#endif
if
(
cl
->
screen
->
pointerClient
==
cl
)
if
(
cl
->
screen
->
pointerClient
==
cl
)
cl
->
screen
->
pointerClient
=
0
;
cl
->
screen
->
pointerClient
=
NULL
;
sraRgnDestroy
(
cl
->
modifiedRegion
);
sraRgnDestroy
(
cl
->
modifiedRegion
);
sraRgnDestroy
(
cl
->
requestedRegion
);
sraRgnDestroy
(
cl
->
requestedRegion
);
...
@@ -485,8 +476,7 @@ rfbClientConnectionGone(cl)
...
@@ -485,8 +476,7 @@ rfbClientConnectionGone(cl)
*/
*/
void
void
rfbProcessClientMessage
(
cl
)
rfbProcessClientMessage
(
rfbClientPtr
cl
)
rfbClientPtr
cl
;
{
{
switch
(
cl
->
state
)
{
switch
(
cl
->
state
)
{
case
RFB_PROTOCOL_VERSION
:
case
RFB_PROTOCOL_VERSION
:
...
@@ -511,8 +501,7 @@ rfbProcessClientMessage(cl)
...
@@ -511,8 +501,7 @@ rfbProcessClientMessage(cl)
*/
*/
static
void
static
void
rfbProcessClientProtocolVersion
(
cl
)
rfbProcessClientProtocolVersion
(
rfbClientPtr
cl
)
rfbClientPtr
cl
;
{
{
rfbProtocolVersionMsg
pv
;
rfbProtocolVersionMsg
pv
;
int
n
,
major_
,
minor_
;
int
n
,
major_
,
minor_
;
...
@@ -566,9 +555,8 @@ rfbProcessClientProtocolVersion(cl)
...
@@ -566,9 +555,8 @@ rfbProcessClientProtocolVersion(cl)
*/
*/
void
void
rfbClientConnFailed
(
cl
,
reason
)
rfbClientConnFailed
(
rfbClientPtr
cl
,
rfbClientPtr
cl
;
char
*
reason
)
char
*
reason
;
{
{
char
*
buf
;
char
*
buf
;
int
len
=
strlen
(
reason
);
int
len
=
strlen
(
reason
);
...
@@ -591,8 +579,7 @@ rfbClientConnFailed(cl, reason)
...
@@ -591,8 +579,7 @@ rfbClientConnFailed(cl, reason)
*/
*/
static
void
static
void
rfbProcessClientInitMessage
(
cl
)
rfbProcessClientInitMessage
(
rfbClientPtr
cl
)
rfbClientPtr
cl
;
{
{
rfbClientInitMsg
ci
;
rfbClientInitMsg
ci
;
char
buf
[
256
];
char
buf
[
256
];
...
@@ -686,8 +673,7 @@ static rfbBool rectSwapIfLEAndClip(uint16_t* x,uint16_t* y,uint16_t* w,uint16_t*
...
@@ -686,8 +673,7 @@ static rfbBool rectSwapIfLEAndClip(uint16_t* x,uint16_t* y,uint16_t* w,uint16_t*
*/
*/
static
void
static
void
rfbProcessClientNormalMessage
(
cl
)
rfbProcessClientNormalMessage
(
rfbClientPtr
cl
)
rfbClientPtr
cl
;
{
{
int
n
=
0
;
int
n
=
0
;
rfbClientToServerMsg
msg
;
rfbClientToServerMsg
msg
;
...
@@ -824,7 +810,7 @@ rfbProcessClientNormalMessage(cl)
...
@@ -824,7 +810,7 @@ rfbProcessClientNormalMessage(cl)
cl
->
host
);
cl
->
host
);
/* if cursor was drawn, hide the cursor */
/* if cursor was drawn, hide the cursor */
if
(
!
cl
->
enableCursorShapeUpdates
)
if
(
!
cl
->
enableCursorShapeUpdates
)
rfbRedrawAfterHideCursor
(
cl
,
0
);
rfbRedrawAfterHideCursor
(
cl
,
NULL
);
cl
->
enableCursorShapeUpdates
=
TRUE
;
cl
->
enableCursorShapeUpdates
=
TRUE
;
cl
->
cursorWasChanged
=
TRUE
;
cl
->
cursorWasChanged
=
TRUE
;
...
@@ -835,7 +821,7 @@ rfbProcessClientNormalMessage(cl)
...
@@ -835,7 +821,7 @@ rfbProcessClientNormalMessage(cl)
cl
->
host
);
cl
->
host
);
/* if cursor was drawn, hide the cursor */
/* if cursor was drawn, hide the cursor */
if
(
!
cl
->
enableCursorShapeUpdates
)
if
(
!
cl
->
enableCursorShapeUpdates
)
rfbRedrawAfterHideCursor
(
cl
,
0
);
rfbRedrawAfterHideCursor
(
cl
,
NULL
);
cl
->
enableCursorShapeUpdates
=
TRUE
;
cl
->
enableCursorShapeUpdates
=
TRUE
;
cl
->
useRichCursorEncoding
=
TRUE
;
cl
->
useRichCursorEncoding
=
TRUE
;
...
@@ -1001,7 +987,7 @@ rfbProcessClientNormalMessage(cl)
...
@@ -1001,7 +987,7 @@ rfbProcessClientNormalMessage(cl)
return
;
return
;
if
(
msg
.
pe
.
buttonMask
==
0
)
if
(
msg
.
pe
.
buttonMask
==
0
)
cl
->
screen
->
pointerClient
=
0
;
cl
->
screen
->
pointerClient
=
NULL
;
else
else
cl
->
screen
->
pointerClient
=
cl
;
cl
->
screen
->
pointerClient
=
cl
;
...
@@ -1065,11 +1051,10 @@ rfbProcessClientNormalMessage(cl)
...
@@ -1065,11 +1051,10 @@ rfbProcessClientNormalMessage(cl)
*/
*/
rfbBool
rfbBool
rfbSendFramebufferUpdate
(
cl
,
givenUpdateRegion
)
rfbSendFramebufferUpdate
(
rfbClientPtr
cl
,
rfbClientPtr
cl
;
sraRegionPtr
givenUpdateRegion
)
sraRegionPtr
givenUpdateRegion
;
{
{
sraRectangleIterator
*
i
=
0
;
sraRectangleIterator
*
i
=
NULL
;
sraRect
rect
;
sraRect
rect
;
int
nUpdateRegionRects
;
int
nUpdateRegionRects
;
rfbFramebufferUpdateMsg
*
fu
=
(
rfbFramebufferUpdateMsg
*
)
cl
->
updateBuf
;
rfbFramebufferUpdateMsg
*
fu
=
(
rfbFramebufferUpdateMsg
*
)
cl
->
updateBuf
;
...
@@ -1392,10 +1377,10 @@ updateFailed:
...
@@ -1392,10 +1377,10 @@ updateFailed:
*/
*/
rfbBool
rfbBool
rfbSendCopyRegion
(
cl
,
reg
,
dx
,
dy
)
rfbSendCopyRegion
(
rfbClientPtr
cl
,
rfbClientPtr
cl
;
sraRegionPtr
reg
,
sraRegionPtr
reg
;
int
dx
,
int
dx
,
dy
;
int
dy
)
{
{
int
x
,
y
,
w
,
h
;
int
x
,
y
,
w
,
h
;
rfbFramebufferUpdateRectHeader
rect
;
rfbFramebufferUpdateRectHeader
rect
;
...
@@ -1443,9 +1428,11 @@ rfbSendCopyRegion(cl, reg, dx, dy)
...
@@ -1443,9 +1428,11 @@ rfbSendCopyRegion(cl, reg, dx, dy)
*/
*/
rfbBool
rfbBool
rfbSendRectEncodingRaw
(
cl
,
x
,
y
,
w
,
h
)
rfbSendRectEncodingRaw
(
rfbClientPtr
cl
,
rfbClientPtr
cl
;
int
x
,
int
x
,
y
,
w
,
h
;
int
y
,
int
w
,
int
h
)
{
{
rfbFramebufferUpdateRectHeader
rect
;
rfbFramebufferUpdateRectHeader
rect
;
int
nlines
;
int
nlines
;
...
@@ -1516,8 +1503,7 @@ rfbSendRectEncodingRaw(cl, x, y, w, h)
...
@@ -1516,8 +1503,7 @@ rfbSendRectEncodingRaw(cl, x, y, w, h)
*/
*/
rfbBool
rfbBool
rfbSendLastRectMarker
(
cl
)
rfbSendLastRectMarker
(
rfbClientPtr
cl
)
rfbClientPtr
cl
;
{
{
rfbFramebufferUpdateRectHeader
rect
;
rfbFramebufferUpdateRectHeader
rect
;
...
@@ -1548,9 +1534,9 @@ rfbSendLastRectMarker(cl)
...
@@ -1548,9 +1534,9 @@ rfbSendLastRectMarker(cl)
*/
*/
rfbBool
rfbBool
rfbSendNewFBSize
(
cl
,
w
,
h
)
rfbSendNewFBSize
(
rfbClientPtr
cl
,
rfbClientPtr
cl
;
int
w
,
int
w
,
h
;
int
h
)
{
{
rfbFramebufferUpdateRectHeader
rect
;
rfbFramebufferUpdateRectHeader
rect
;
...
@@ -1582,8 +1568,7 @@ rfbSendNewFBSize(cl, w, h)
...
@@ -1582,8 +1568,7 @@ rfbSendNewFBSize(cl, w, h)
*/
*/
rfbBool
rfbBool
rfbSendUpdateBuf
(
cl
)
rfbSendUpdateBuf
(
rfbClientPtr
cl
)
rfbClientPtr
cl
;
{
{
if
(
cl
->
sock
<
0
)
if
(
cl
->
sock
<
0
)
return
FALSE
;
return
FALSE
;
...
@@ -1604,10 +1589,9 @@ rfbSendUpdateBuf(cl)
...
@@ -1604,10 +1589,9 @@ rfbSendUpdateBuf(cl)
*/
*/
rfbBool
rfbBool
rfbSendSetColourMapEntries
(
cl
,
firstColour
,
nColours
)
rfbSendSetColourMapEntries
(
rfbClientPtr
cl
,
rfbClientPtr
cl
;
int
firstColour
,
int
firstColour
;
int
nColours
)
int
nColours
;
{
{
char
buf
[
sz_rfbSetColourMapEntriesMsg
+
256
*
3
*
2
];
char
buf
[
sz_rfbSetColourMapEntriesMsg
+
256
*
3
*
2
];
rfbSetColourMapEntriesMsg
*
scme
=
(
rfbSetColourMapEntriesMsg
*
)
buf
;
rfbSetColourMapEntriesMsg
*
scme
=
(
rfbSetColourMapEntriesMsg
*
)
buf
;
...
@@ -1707,12 +1691,11 @@ rfbSendServerCutText(rfbScreenInfoPtr rfbScreen,char *str, int len)
...
@@ -1707,12 +1691,11 @@ rfbSendServerCutText(rfbScreenInfoPtr rfbScreen,char *str, int len)
* packets (such as 100s of pen readings per second!).
* packets (such as 100s of pen readings per second!).
*/
*/
unsigned
char
ptrAcceleration
=
50
;
static
unsigned
char
ptrAcceleration
=
50
;
void
void
rfbNewUDPConnection
(
rfbScreen
,
sock
)
rfbNewUDPConnection
(
rfbScreenInfoPtr
rfbScreen
,
rfbScreenInfoPtr
rfbScreen
;
int
sock
)
int
sock
;
{
{
if
(
write
(
sock
,
&
ptrAcceleration
,
1
)
<
0
)
{
if
(
write
(
sock
,
&
ptrAcceleration
,
1
)
<
0
)
{
rfbLogPerror
(
"rfbNewUDPConnection: write"
);
rfbLogPerror
(
"rfbNewUDPConnection: write"
);
...
...
libvncserver/rre.c
View file @
8bee4eb9
...
@@ -53,9 +53,11 @@ static uint32_t getBgColour(char *data, int size, int bpp);
...
@@ -53,9 +53,11 @@ static uint32_t getBgColour(char *data, int size, int bpp);
*/
*/
rfbBool
rfbBool
rfbSendRectEncodingRRE
(
cl
,
x
,
y
,
w
,
h
)
rfbSendRectEncodingRRE
(
rfbClientPtr
cl
,
rfbClientPtr
cl
;
int
x
,
int
x
,
y
,
w
,
h
;
int
y
,
int
w
,
int
h
)
{
{
rfbFramebufferUpdateRectHeader
rect
;
rfbFramebufferUpdateRectHeader
rect
;
rfbRREHeader
hdr
;
rfbRREHeader
hdr
;
...
@@ -175,26 +177,22 @@ rfbSendRectEncodingRRE(cl, x, y, w, h)
...
@@ -175,26 +177,22 @@ rfbSendRectEncodingRRE(cl, x, y, w, h)
#define DEFINE_SUBRECT_ENCODE(bpp) \
#define DEFINE_SUBRECT_ENCODE(bpp) \
static int \
static int \
subrectEncode##bpp(data,w,h) \
subrectEncode##bpp(uint##bpp##_t *data, int w, int h) { \
uint##bpp##_t *data; \
uint##bpp##_t cl; \
int w; \
int h; \
{ \
uint##bpp##_t cl; \
rfbRectangle subrect; \
rfbRectangle subrect; \
int x,y; \
int x,y; \
int i,j; \
int i,j; \
int hx=0,hy,vx=0,vy; \
int hx=0,hy,vx=0,vy; \
int hyflag; \
int hyflag; \
uint##bpp##_t *seg;
\
uint##bpp##_t *seg; \
uint##bpp##_t *line;
\
uint##bpp##_t *line; \
int hw,hh,vw,vh; \
int hw,hh,vw,vh; \
int thex,they,thew,theh; \
int thex,they,thew,theh; \
int numsubs = 0; \
int numsubs = 0; \
int newLen; \
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); \
rreAfterBufLen = (bpp/8); \
\
\
...
@@ -246,7 +244,7 @@ subrectEncode##bpp(data,w,h) \
...
@@ -246,7 +244,7 @@ subrectEncode##bpp(data,w,h) \
return -1; \
return -1; \
\
\
numsubs += 1; \
numsubs += 1; \
*((uint##bpp##_t*)(rreAfterBuf + rreAfterBufLen)) = cl;
\
*((uint##bpp##_t*)(rreAfterBuf + rreAfterBufLen)) = cl; \
rreAfterBufLen += (bpp/8); \
rreAfterBufLen += (bpp/8); \
memcpy(&rreAfterBuf[rreAfterBufLen],&subrect,sz_rfbRectangle); \
memcpy(&rreAfterBuf[rreAfterBufLen],&subrect,sz_rfbRectangle); \
rreAfterBufLen += sz_rfbRectangle; \
rreAfterBufLen += sz_rfbRectangle; \
...
@@ -275,10 +273,7 @@ DEFINE_SUBRECT_ENCODE(32)
...
@@ -275,10 +273,7 @@ DEFINE_SUBRECT_ENCODE(32)
* getBgColour() gets the most prevalent colour in a byte array.
* getBgColour() gets the most prevalent colour in a byte array.
*/
*/
static
uint32_t
static
uint32_t
getBgColour
(
data
,
size
,
bpp
)
getBgColour
(
char
*
data
,
int
size
,
int
bpp
)
char
*
data
;
int
size
;
int
bpp
;
{
{
#define NUMCLRS 256
#define NUMCLRS 256
...
...
libvncserver/selbox.c
View file @
8bee4eb9
...
@@ -197,7 +197,7 @@ static void selPtrAddEvent(int buttonMask,int x,int y,rfbClientPtr cl)
...
@@ -197,7 +197,7 @@ static void selPtrAddEvent(int buttonMask,int x,int y,rfbClientPtr cl)
static
rfbCursorPtr
selGetCursorPtr
(
rfbClientPtr
cl
)
static
rfbCursorPtr
selGetCursorPtr
(
rfbClientPtr
cl
)
{
{
return
(
0
)
;
return
NULL
;
}
}
int
rfbSelectBox
(
rfbScreenInfoPtr
rfbScreen
,
rfbFontDataPtr
font
,
int
rfbSelectBox
(
rfbScreenInfoPtr
rfbScreen
,
rfbFontDataPtr
font
,
...
@@ -263,7 +263,7 @@ int rfbSelectBox(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
...
@@ -263,7 +263,7 @@ int rfbSelectBox(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
rfbScreen
->
kbdAddEvent
=
selKbdAddEvent
;
rfbScreen
->
kbdAddEvent
=
selKbdAddEvent
;
rfbScreen
->
ptrAddEvent
=
selPtrAddEvent
;
rfbScreen
->
ptrAddEvent
=
selPtrAddEvent
;
rfbScreen
->
getCursorPtr
=
selGetCursorPtr
;
rfbScreen
->
getCursorPtr
=
selGetCursorPtr
;
rfbScreen
->
displayHook
=
0
;
rfbScreen
->
displayHook
=
NULL
;
/* backup screen */
/* backup screen */
for
(
j
=
0
;
j
<
y2
-
y1
;
j
++
)
for
(
j
=
0
;
j
<
y2
-
y1
;
j
++
)
...
...
libvncserver/sockets.c
View file @
8bee4eb9
...
@@ -216,7 +216,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
...
@@ -216,7 +216,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
fd_set
fds
;
fd_set
fds
;
struct
timeval
tv
;
struct
timeval
tv
;
struct
sockaddr_in
addr
;
struct
sockaddr_in
addr
;
s
ize
_t
addrlen
=
sizeof
(
addr
);
s
ocklen
_t
addrlen
=
sizeof
(
addr
);
char
buf
[
6
];
char
buf
[
6
];
const
int
one
=
1
;
const
int
one
=
1
;
int
sock
;
int
sock
;
...
@@ -342,8 +342,7 @@ rfbDisconnectUDPSock(rfbScreenInfoPtr rfbScreen)
...
@@ -342,8 +342,7 @@ rfbDisconnectUDPSock(rfbScreenInfoPtr rfbScreen)
void
void
rfbCloseClient
(
cl
)
rfbCloseClient
(
rfbClientPtr
cl
)
rfbClientPtr
cl
;
{
{
LOCK
(
cl
->
updateMutex
);
LOCK
(
cl
->
updateMutex
);
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
...
@@ -371,10 +370,9 @@ rfbCloseClient(cl)
...
@@ -371,10 +370,9 @@ rfbCloseClient(cl)
*/
*/
int
int
rfbConnect
(
rfbScreen
,
host
,
port
)
rfbConnect
(
rfbScreenInfoPtr
rfbScreen
,
rfbScreenInfoPtr
rfbScreen
;
char
*
host
,
char
*
host
;
int
port
)
int
port
;
{
{
int
sock
;
int
sock
;
int
one
=
1
;
int
one
=
1
;
...
@@ -476,10 +474,9 @@ int rfbReadExact(rfbClientPtr cl,char* buf,int len)
...
@@ -476,10 +474,9 @@ int rfbReadExact(rfbClientPtr cl,char* buf,int len)
*/
*/
int
int
rfbWriteExact
(
cl
,
buf
,
len
)
rfbWriteExact
(
rfbClientPtr
cl
,
rfbClientPtr
cl
;
const
char
*
buf
,
const
char
*
buf
;
int
len
)
int
len
;
{
{
int
sock
=
cl
->
sock
;
int
sock
=
cl
->
sock
;
int
n
;
int
n
;
...
@@ -573,9 +570,8 @@ rfbStringToAddr(char *str, in_addr_t *addr) {
...
@@ -573,9 +570,8 @@ rfbStringToAddr(char *str, in_addr_t *addr) {
}
}
int
int
rfbListenOnTCPPort
(
port
,
iface
)
rfbListenOnTCPPort
(
int
port
,
int
port
;
in_addr_t
iface
)
in_addr_t
iface
;
{
{
struct
sockaddr_in
addr
;
struct
sockaddr_in
addr
;
int
sock
;
int
sock
;
...
@@ -607,9 +603,8 @@ rfbListenOnTCPPort(port, iface)
...
@@ -607,9 +603,8 @@ rfbListenOnTCPPort(port, iface)
}
}
int
int
rfbConnectToTcpAddr
(
host
,
port
)
rfbConnectToTcpAddr
(
char
*
host
,
char
*
host
;
int
port
)
int
port
;
{
{
struct
hostent
*
hp
;
struct
hostent
*
hp
;
int
sock
;
int
sock
;
...
@@ -641,9 +636,8 @@ rfbConnectToTcpAddr(host, port)
...
@@ -641,9 +636,8 @@ rfbConnectToTcpAddr(host, port)
}
}
int
int
rfbListenOnUDPPort
(
port
,
iface
)
rfbListenOnUDPPort
(
int
port
,
int
port
;
in_addr_t
iface
)
in_addr_t
iface
;
{
{
struct
sockaddr_in
addr
;
struct
sockaddr_in
addr
;
int
sock
;
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,
...
@@ -134,7 +134,7 @@ typedef void (*rfbInitCMTableFnType)(char **table, rfbPixelFormat *in,
typedef
void
(
*
rfbInitTableFnType
)(
char
**
table
,
rfbPixelFormat
*
in
,
typedef
void
(
*
rfbInitTableFnType
)(
char
**
table
,
rfbPixelFormat
*
in
,
rfbPixelFormat
*
out
);
rfbPixelFormat
*
out
);
rfbInitCMTableFnType
rfbInitColourMapSingleTableFns
[
COUNT_OFFSETS
]
=
{
static
rfbInitCMTableFnType
rfbInitColourMapSingleTableFns
[
COUNT_OFFSETS
]
=
{
rfbInitColourMapSingleTable8
,
rfbInitColourMapSingleTable8
,
rfbInitColourMapSingleTable16
,
rfbInitColourMapSingleTable16
,
#ifdef LIBVNCSERVER_ALLOW24BPP
#ifdef LIBVNCSERVER_ALLOW24BPP
...
@@ -143,7 +143,7 @@ rfbInitCMTableFnType rfbInitColourMapSingleTableFns[COUNT_OFFSETS] = {
...
@@ -143,7 +143,7 @@ rfbInitCMTableFnType rfbInitColourMapSingleTableFns[COUNT_OFFSETS] = {
rfbInitColourMapSingleTable32
rfbInitColourMapSingleTable32
};
};
rfbInitTableFnType
rfbInitTrueColourSingleTableFns
[
COUNT_OFFSETS
]
=
{
static
rfbInitTableFnType
rfbInitTrueColourSingleTableFns
[
COUNT_OFFSETS
]
=
{
rfbInitTrueColourSingleTable8
,
rfbInitTrueColourSingleTable8
,
rfbInitTrueColourSingleTable16
,
rfbInitTrueColourSingleTable16
,
#ifdef LIBVNCSERVER_ALLOW24BPP
#ifdef LIBVNCSERVER_ALLOW24BPP
...
@@ -152,7 +152,7 @@ rfbInitTableFnType rfbInitTrueColourSingleTableFns[COUNT_OFFSETS] = {
...
@@ -152,7 +152,7 @@ rfbInitTableFnType rfbInitTrueColourSingleTableFns[COUNT_OFFSETS] = {
rfbInitTrueColourSingleTable32
rfbInitTrueColourSingleTable32
};
};
rfbInitTableFnType
rfbInitTrueColourRGBTablesFns
[
COUNT_OFFSETS
]
=
{
static
rfbInitTableFnType
rfbInitTrueColourRGBTablesFns
[
COUNT_OFFSETS
]
=
{
rfbInitTrueColourRGBTables8
,
rfbInitTrueColourRGBTables8
,
rfbInitTrueColourRGBTables16
,
rfbInitTrueColourRGBTables16
,
#ifdef LIBVNCSERVER_ALLOW24BPP
#ifdef LIBVNCSERVER_ALLOW24BPP
...
@@ -161,7 +161,7 @@ rfbInitTableFnType rfbInitTrueColourRGBTablesFns[COUNT_OFFSETS] = {
...
@@ -161,7 +161,7 @@ rfbInitTableFnType rfbInitTrueColourRGBTablesFns[COUNT_OFFSETS] = {
rfbInitTrueColourRGBTables32
rfbInitTrueColourRGBTables32
};
};
rfbTranslateFnType
rfbTranslateWithSingleTableFns
[
COUNT_OFFSETS
][
COUNT_OFFSETS
]
=
{
static
rfbTranslateFnType
rfbTranslateWithSingleTableFns
[
COUNT_OFFSETS
][
COUNT_OFFSETS
]
=
{
{
rfbTranslateWithSingleTable8to8
,
{
rfbTranslateWithSingleTable8to8
,
rfbTranslateWithSingleTable8to16
,
rfbTranslateWithSingleTable8to16
,
#ifdef LIBVNCSERVER_ALLOW24BPP
#ifdef LIBVNCSERVER_ALLOW24BPP
...
@@ -188,7 +188,7 @@ rfbTranslateFnType rfbTranslateWithSingleTableFns[COUNT_OFFSETS][COUNT_OFFSETS]
...
@@ -188,7 +188,7 @@ rfbTranslateFnType rfbTranslateWithSingleTableFns[COUNT_OFFSETS][COUNT_OFFSETS]
rfbTranslateWithSingleTable32to32
}
rfbTranslateWithSingleTable32to32
}
};
};
rfbTranslateFnType
rfbTranslateWithRGBTablesFns
[
COUNT_OFFSETS
][
COUNT_OFFSETS
]
=
{
static
rfbTranslateFnType
rfbTranslateWithRGBTablesFns
[
COUNT_OFFSETS
][
COUNT_OFFSETS
]
=
{
{
rfbTranslateWithRGBTables8to8
,
{
rfbTranslateWithRGBTables8to8
,
rfbTranslateWithRGBTables8to16
,
rfbTranslateWithRGBTables8to16
,
#ifdef LIBVNCSERVER_ALLOW24BPP
#ifdef LIBVNCSERVER_ALLOW24BPP
...
@@ -242,8 +242,7 @@ rfbTranslateNone(char *table, rfbPixelFormat *in, rfbPixelFormat *out,
...
@@ -242,8 +242,7 @@ rfbTranslateNone(char *table, rfbPixelFormat *in, rfbPixelFormat *out,
*/
*/
rfbBool
rfbBool
rfbSetTranslateFunction
(
cl
)
rfbSetTranslateFunction
(
rfbClientPtr
cl
)
rfbClientPtr
cl
;
{
{
rfbLog
(
"Pixel format for client %s:
\n
"
,
cl
->
host
);
rfbLog
(
"Pixel format for client %s:
\n
"
,
cl
->
host
);
PrintPixelFormat
(
&
cl
->
format
);
PrintPixelFormat
(
&
cl
->
format
);
...
@@ -359,8 +358,7 @@ rfbSetTranslateFunction(cl)
...
@@ -359,8 +358,7 @@ rfbSetTranslateFunction(cl)
*/
*/
static
rfbBool
static
rfbBool
rfbSetClientColourMapBGR233
(
cl
)
rfbSetClientColourMapBGR233
(
rfbClientPtr
cl
)
rfbClientPtr
cl
;
{
{
char
buf
[
sz_rfbSetColourMapEntriesMsg
+
256
*
3
*
2
];
char
buf
[
sz_rfbSetColourMapEntriesMsg
+
256
*
3
*
2
];
rfbSetColourMapEntriesMsg
*
scme
=
(
rfbSetColourMapEntriesMsg
*
)
buf
;
rfbSetColourMapEntriesMsg
*
scme
=
(
rfbSetColourMapEntriesMsg
*
)
buf
;
...
@@ -414,10 +412,7 @@ rfbSetClientColourMapBGR233(cl)
...
@@ -414,10 +412,7 @@ rfbSetClientColourMapBGR233(cl)
*/
*/
rfbBool
rfbBool
rfbSetClientColourMap
(
cl
,
firstColour
,
nColours
)
rfbSetClientColourMap
(
rfbClientPtr
cl
,
int
firstColour
,
int
nColours
)
rfbClientPtr
cl
;
int
firstColour
;
int
nColours
;
{
{
if
(
cl
->
screen
->
serverFormat
.
trueColour
||
!
cl
->
readyForSetColourMapEntries
)
{
if
(
cl
->
screen
->
serverFormat
.
trueColour
||
!
cl
->
readyForSetColourMapEntries
)
{
return
TRUE
;
return
TRUE
;
...
@@ -448,10 +443,7 @@ rfbSetClientColourMap(cl, firstColour, nColours)
...
@@ -448,10 +443,7 @@ rfbSetClientColourMap(cl, firstColour, nColours)
*/
*/
void
void
rfbSetClientColourMaps
(
rfbScreen
,
firstColour
,
nColours
)
rfbSetClientColourMaps
(
rfbScreenInfoPtr
rfbScreen
,
int
firstColour
,
int
nColours
)
rfbScreenInfoPtr
rfbScreen
;
int
firstColour
;
int
nColours
;
{
{
rfbClientIteratorPtr
i
;
rfbClientIteratorPtr
i
;
rfbClientPtr
cl
;
rfbClientPtr
cl
;
...
@@ -463,8 +455,7 @@ rfbSetClientColourMaps(rfbScreen, firstColour, nColours)
...
@@ -463,8 +455,7 @@ rfbSetClientColourMaps(rfbScreen, firstColour, nColours)
}
}
static
void
static
void
PrintPixelFormat
(
pf
)
PrintPixelFormat
(
rfbPixelFormat
*
pf
)
rfbPixelFormat
*
pf
;
{
{
if
(
pf
->
bitsPerPixel
==
1
)
{
if
(
pf
->
bitsPerPixel
==
1
)
{
rfbLog
(
" 1 bpp, %s sig bit in each byte is leftmost on the screen.
\n
"
,
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 @@
...
@@ -21,6 +21,8 @@
* vncauth.c - Functions for VNC password management and authentication.
* vncauth.c - Functions for VNC password management and authentication.
*/
*/
#define _BSD_SOURCE
#define _POSIX_SOURCE
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <unistd.h>
#include <unistd.h>
...
@@ -47,6 +49,9 @@
...
@@ -47,6 +49,9 @@
#endif
#endif
/* libvncclient does not need this */
#ifndef rfbEncryptBytes
/*
/*
* We use a fixed key to store passwords, since we assume that our local
* 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
* file system is secure but nonetheless don't want to store passwords
...
@@ -147,7 +152,7 @@ rfbRandomBytes(unsigned char *bytes)
...
@@ -147,7 +152,7 @@ rfbRandomBytes(unsigned char *bytes)
static
rfbBool
s_srandom_called
=
FALSE
;
static
rfbBool
s_srandom_called
=
FALSE
;
if
(
!
s_srandom_called
)
{
if
(
!
s_srandom_called
)
{
srandom
((
unsigned
int
)
time
(
0
)
^
(
unsigned
int
)
getpid
());
srandom
((
unsigned
int
)
time
(
NULL
)
^
(
unsigned
int
)
getpid
());
s_srandom_called
=
TRUE
;
s_srandom_called
=
TRUE
;
}
}
...
@@ -156,6 +161,7 @@ rfbRandomBytes(unsigned char *bytes)
...
@@ -156,6 +161,7 @@ rfbRandomBytes(unsigned char *bytes)
}
}
}
}
#endif
/*
/*
* Encrypt CHALLENGESIZE bytes in memory using a password.
* Encrypt CHALLENGESIZE bytes in memory using a password.
...
...
libvncserver/zlib.c
View file @
8bee4eb9
...
@@ -52,10 +52,12 @@ static int zlibAfterBufLen;
...
@@ -52,10 +52,12 @@ static int zlibAfterBufLen;
* rectangle encoding.
* rectangle encoding.
*/
*/
rfbBool
static
rfbBool
rfbSendOneRectEncodingZlib
(
cl
,
x
,
y
,
w
,
h
)
rfbSendOneRectEncodingZlib
(
rfbClientPtr
cl
,
rfbClientPtr
cl
;
int
x
,
int
x
,
y
,
w
,
h
;
int
y
,
int
w
,
int
h
)
{
{
rfbFramebufferUpdateRectHeader
rect
;
rfbFramebufferUpdateRectHeader
rect
;
rfbZlibHeader
hdr
;
rfbZlibHeader
hdr
;
...
@@ -230,9 +232,11 @@ rfbSendOneRectEncodingZlib(cl, x, y, w, h)
...
@@ -230,9 +232,11 @@ rfbSendOneRectEncodingZlib(cl, x, y, w, h)
*/
*/
rfbBool
rfbBool
rfbSendRectEncodingZlib
(
cl
,
x
,
y
,
w
,
h
)
rfbSendRectEncodingZlib
(
rfbClientPtr
cl
,
rfbClientPtr
cl
;
int
x
,
int
x
,
y
,
w
,
h
;
int
y
,
int
w
,
int
h
)
{
{
int
maxLines
;
int
maxLines
;
int
linesRemaining
;
int
linesRemaining
;
...
...
libvncserver/zrle.c
View file @
8bee4eb9
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
*/
*/
#include "rfb/rfb.h"
#include "rfb/rfb.h"
#include "private.h"
#include "zrleoutstream.h"
#include "zrleoutstream.h"
...
@@ -174,7 +175,7 @@ rfbBool rfbSendRectEncodingZRLE(rfbClientPtr cl, int x, int y, int w, int 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
)
if
(
cl
->
zrleData
)
zrleOutStreamFree
(
cl
->
zrleData
);
zrleOutStreamFree
(
cl
->
zrleData
);
...
...
libvncserver/zrleencodetemplate.c
View file @
8bee4eb9
...
@@ -70,7 +70,7 @@ static zrlePaletteHelper paletteHelper;
...
@@ -70,7 +70,7 @@ static zrlePaletteHelper paletteHelper;
void
ZRLE_ENCODE_TILE
(
PIXEL_T
*
data
,
int
w
,
int
h
,
zrleOutStream
*
os
);
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
zrleOutStream
*
os
,
void
*
buf
EXTRA_ARGS
EXTRA_ARGS
)
)
...
...
libvncserver/zrleoutstream.c
View file @
8bee4eb9
...
@@ -209,8 +209,7 @@ static int zrleOutStreamOverrun(zrleOutStream *os,
...
@@ -209,8 +209,7 @@ static int zrleOutStreamOverrun(zrleOutStream *os,
return
size
;
return
size
;
}
}
static
inline
int
zrleOutStreamCheck
(
zrleOutStream
*
os
,
static
int
zrleOutStreamCheck
(
zrleOutStream
*
os
,
int
size
)
int
size
)
{
{
if
(
os
->
in
.
ptr
+
size
>
os
->
in
.
end
)
{
if
(
os
->
in
.
ptr
+
size
>
os
->
in
.
end
)
{
return
zrleOutStreamOverrun
(
os
,
size
);
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
,
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
,
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
,
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]={
...
@@ -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
,
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
,
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
,};
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);
...
@@ -517,6 +517,7 @@ extern int rfbConnect(rfbScreenInfoPtr rfbScreen, char* host, int port);
extern
int
rfbConnectToTcpAddr
(
char
*
host
,
int
port
);
extern
int
rfbConnectToTcpAddr
(
char
*
host
,
int
port
);
extern
int
rfbListenOnTCPPort
(
int
port
,
in_addr_t
iface
);
extern
int
rfbListenOnTCPPort
(
int
port
,
in_addr_t
iface
);
extern
int
rfbListenOnUDPPort
(
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 */
/* rfbserver.c */
...
@@ -528,6 +529,8 @@ extern void rfbClientListInit(rfbScreenInfoPtr rfbScreen);
...
@@ -528,6 +529,8 @@ extern void rfbClientListInit(rfbScreenInfoPtr rfbScreen);
extern
rfbClientIteratorPtr
rfbGetClientIterator
(
rfbScreenInfoPtr
rfbScreen
);
extern
rfbClientIteratorPtr
rfbGetClientIterator
(
rfbScreenInfoPtr
rfbScreen
);
extern
rfbClientPtr
rfbClientIteratorNext
(
rfbClientIteratorPtr
iterator
);
extern
rfbClientPtr
rfbClientIteratorNext
(
rfbClientIteratorPtr
iterator
);
extern
void
rfbReleaseClientIterator
(
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
void
rfbNewClientConnection
(
rfbScreenInfoPtr
rfbScreen
,
int
sock
);
extern
rfbClientPtr
rfbNewClient
(
rfbScreenInfoPtr
rfbScreen
,
int
sock
);
extern
rfbClientPtr
rfbNewClient
(
rfbScreenInfoPtr
rfbScreen
,
int
sock
);
...
@@ -624,6 +627,7 @@ extern rfbBool rfbTightDisableGradient;
...
@@ -624,6 +627,7 @@ extern rfbBool rfbTightDisableGradient;
extern
int
rfbNumCodedRectsTight
(
rfbClientPtr
cl
,
int
x
,
int
y
,
int
w
,
int
h
);
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
);
extern
rfbBool
rfbSendRectEncodingTight
(
rfbClientPtr
cl
,
int
x
,
int
y
,
int
w
,
int
h
);
#endif
#endif
#endif
#endif
...
@@ -661,7 +665,6 @@ extern void rfbDefaultPtrAddEvent(int buttonMask,int x,int y,rfbClientPtr cl);
...
@@ -661,7 +665,6 @@ extern void rfbDefaultPtrAddEvent(int buttonMask,int x,int y,rfbClientPtr cl);
/* zrle.c */
/* zrle.c */
#ifdef LIBVNCSERVER_HAVE_LIBZ
#ifdef LIBVNCSERVER_HAVE_LIBZ
extern
rfbBool
rfbSendRectEncodingZRLE
(
rfbClientPtr
cl
,
int
x
,
int
y
,
int
w
,
int
h
);
extern
rfbBool
rfbSendRectEncodingZRLE
(
rfbClientPtr
cl
,
int
x
,
int
y
,
int
w
,
int
h
);
extern
void
rfbFreeZrleData
(
rfbClientPtr
cl
);
#endif
#endif
/* stats.c */
/* stats.c */
...
...
rfb/rfbproto.h
View file @
8bee4eb9
...
@@ -62,6 +62,10 @@
...
@@ -62,6 +62,10 @@
#ifdef LIBVNCSERVER_HAVE_LIBZ
#ifdef LIBVNCSERVER_HAVE_LIBZ
#include <zlib.h>
#include <zlib.h>
#ifdef __CHECKER__
#undef Z_NULL
#define Z_NULL NULL
#endif
#endif
#endif
...
...
test/copyrecttest.c
View file @
8bee4eb9
#define _BSD_SOURCE
#include <rfb/rfb.h>
#include <rfb/rfb.h>
#include <math.h>
#include <math.h>
void
initBackground
(
rfbScreenInfoPtr
server
)
static
void
initBackground
(
rfbScreenInfoPtr
server
)
{
{
unsigned
int
i
,
j
;
unsigned
int
i
,
j
;
...
@@ -16,7 +17,7 @@ void initBackground(rfbScreenInfoPtr server)
...
@@ -16,7 +17,7 @@ void initBackground(rfbScreenInfoPtr server)
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
int
width
=
400
,
height
=
300
,
w
=
20
,
x
,
y
;
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
);
rfbScreenInfoPtr
server
=
rfbGetScreen
(
&
argc
,
argv
,
width
,
height
,
8
,
3
,
4
);
server
->
frameBuffer
=
(
char
*
)
malloc
(
width
*
height
*
4
);
server
->
frameBuffer
=
(
char
*
)
malloc
(
width
*
height
*
4
);
...
...
test/cursortest.c
View file @
8bee4eb9
...
@@ -24,12 +24,12 @@
...
@@ -24,12 +24,12 @@
#include <rfb/rfb.h>
#include <rfb/rfb.h>
const
int
bpp
=
4
;
static
const
int
bpp
=
4
;
int
maxx
=
800
,
maxy
=
600
;
static
int
maxx
=
800
,
maxy
=
600
;
/* This initializes a nice (?) background */
/* This initializes a nice (?) background */
void
initBuffer
(
unsigned
char
*
buffer
)
static
void
initBuffer
(
unsigned
char
*
buffer
)
{
{
int
i
,
j
;
int
i
,
j
;
for
(
j
=
0
;
j
<
maxy
;
++
j
)
{
for
(
j
=
0
;
j
<
maxy
;
++
j
)
{
...
@@ -43,7 +43,7 @@ void initBuffer(unsigned char* buffer)
...
@@ -43,7 +43,7 @@ void initBuffer(unsigned char* buffer)
/* Example for an XCursor (foreground/background only) */
/* Example for an XCursor (foreground/background only) */
void
SetXCursor
(
rfbScreenInfoPtr
rfbScreen
)
static
void
SetXCursor
(
rfbScreenInfoPtr
rfbScreen
)
{
{
int
width
=
13
,
height
=
11
;
int
width
=
13
,
height
=
11
;
char
cursor
[]
=
char
cursor
[]
=
...
@@ -78,7 +78,7 @@ void SetXCursor(rfbScreenInfoPtr rfbScreen)
...
@@ -78,7 +78,7 @@ void SetXCursor(rfbScreenInfoPtr rfbScreen)
rfbSetCursor
(
rfbScreen
,
c
);
rfbSetCursor
(
rfbScreen
,
c
);
}
}
void
SetXCursor2
(
rfbScreenInfoPtr
rfbScreen
)
static
void
SetXCursor2
(
rfbScreenInfoPtr
rfbScreen
)
{
{
int
width
=
13
,
height
=
22
;
int
width
=
13
,
height
=
22
;
char
cursor
[]
=
char
cursor
[]
=
...
@@ -136,7 +136,7 @@ void SetXCursor2(rfbScreenInfoPtr rfbScreen)
...
@@ -136,7 +136,7 @@ void SetXCursor2(rfbScreenInfoPtr rfbScreen)
/* Example for a rich cursor (full-colour) */
/* Example for a rich cursor (full-colour) */
void
SetRichCursor
(
rfbScreenInfoPtr
rfbScreen
)
static
void
SetRichCursor
(
rfbScreenInfoPtr
rfbScreen
)
{
{
int
i
,
j
,
w
=
32
,
h
=
32
;
int
i
,
j
,
w
=
32
,
h
=
32
;
/* runge */
/* runge */
...
@@ -192,7 +192,7 @@ void SetRichCursor(rfbScreenInfoPtr rfbScreen)
...
@@ -192,7 +192,7 @@ void SetRichCursor(rfbScreenInfoPtr rfbScreen)
}
}
/* runge */
/* runge */
void
SetRichCursor2
(
rfbScreenInfoPtr
rfbScreen
)
static
void
SetRichCursor2
(
rfbScreenInfoPtr
rfbScreen
)
{
{
int
i
,
j
,
w
=
17
,
h
=
16
;
int
i
,
j
,
w
=
17
,
h
=
16
;
/* rfbCursorPtr c = rfbScreen->cursor; */
/* rfbCursorPtr c = rfbScreen->cursor; */
...
@@ -232,7 +232,7 @@ void SetRichCursor2(rfbScreenInfoPtr rfbScreen)
...
@@ -232,7 +232,7 @@ void SetRichCursor2(rfbScreenInfoPtr rfbScreen)
/* alpha channel */
/* alpha channel */
void
SetAlphaCursor
(
rfbScreenInfoPtr
screen
,
int
mode
)
static
void
SetAlphaCursor
(
rfbScreenInfoPtr
screen
,
int
mode
)
{
{
int
i
,
j
;
int
i
,
j
;
rfbCursorPtr
c
=
screen
->
cursor
;
rfbCursorPtr
c
=
screen
->
cursor
;
...
@@ -243,7 +243,7 @@ void SetAlphaCursor(rfbScreenInfoPtr screen,int mode)
...
@@ -243,7 +243,7 @@ void SetAlphaCursor(rfbScreenInfoPtr screen,int mode)
if
(
c
->
alphaSource
)
{
if
(
c
->
alphaSource
)
{
free
(
c
->
alphaSource
);
free
(
c
->
alphaSource
);
c
->
alphaSource
=
0
;
c
->
alphaSource
=
NULL
;
}
}
if
(
mode
==
0
)
if
(
mode
==
0
)
...
@@ -265,7 +265,7 @@ void SetAlphaCursor(rfbScreenInfoPtr screen,int mode)
...
@@ -265,7 +265,7 @@ void SetAlphaCursor(rfbScreenInfoPtr screen,int mode)
/* Here the pointer events are handled */
/* 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
oldButtonMask
=
0
;
static
int
counter
=
0
;
static
int
counter
=
0
;
...
...
test/encodingstest.c
View file @
8bee4eb9
#define _BSD_SOURCE
#include <time.h>
#include <time.h>
#include <stdarg.h>
#include <stdarg.h>
#include <rfb/rfb.h>
#include <rfb/rfb.h>
...
@@ -8,12 +9,12 @@
...
@@ -8,12 +9,12 @@
#endif
#endif
#define ALL_AT_ONCE
#define ALL_AT_ONCE
/
/#define VERY_VERBOSE
/
*#define VERY_VERBOSE*/
MUTEX
(
frameBufferMutex
);
static
MUTEX
(
frameBufferMutex
);
typedef
struct
{
int
id
;
char
*
str
;
}
encoding_t
;
typedef
struct
{
int
id
;
char
*
str
;
}
encoding_t
;
encoding_t
testEncodings
[]
=
{
static
encoding_t
testEncodings
[]
=
{
{
rfbEncodingRaw
,
"raw"
},
{
rfbEncodingRaw
,
"raw"
},
{
rfbEncodingRRE
,
"rre"
},
{
rfbEncodingRRE
,
"rre"
},
/* TODO: fix corre */
/* TODO: fix corre */
...
@@ -28,22 +29,22 @@ encoding_t testEncodings[]={
...
@@ -28,22 +29,22 @@ encoding_t testEncodings[]={
{
rfbEncodingTight
,
"tight"
},
{
rfbEncodingTight
,
"tight"
},
#endif
#endif
#endif
#endif
{
0
,
0
}
{
0
,
NULL
}
};
};
#define NUMBER_OF_ENCODINGS_TO_TEST (sizeof(testEncodings)/sizeof(encoding_t)-1)
#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 */
/* Here come the variables/functions to handle the test output */
const
int
width
=
400
,
height
=
300
;
static
const
int
width
=
400
,
height
=
300
;
struct
{
int
x1
,
y1
,
x2
,
y2
;
}
lastUpdateRect
;
st
atic
st
ruct
{
int
x1
,
y1
,
x2
,
y2
;
}
lastUpdateRect
;
unsigned
int
statistics
[
2
][
NUMBER_OF_ENCODINGS_TO_TEST
];
static
unsigned
int
statistics
[
2
][
NUMBER_OF_ENCODINGS_TO_TEST
];
unsigned
int
totalFailed
,
totalCount
;
static
unsigned
int
totalFailed
,
totalCount
;
unsigned
int
countGotUpdate
;
static
unsigned
int
countGotUpdate
;
MUTEX
(
statisticsMutex
);
static
MUTEX
(
statisticsMutex
);
void
initStatistics
(
)
{
static
void
initStatistics
(
void
)
{
memset
(
statistics
[
0
],
0
,
sizeof
(
int
)
*
NUMBER_OF_ENCODINGS_TO_TEST
);
memset
(
statistics
[
0
],
0
,
sizeof
(
int
)
*
NUMBER_OF_ENCODINGS_TO_TEST
);
memset
(
statistics
[
1
],
0
,
sizeof
(
int
)
*
NUMBER_OF_ENCODINGS_TO_TEST
);
memset
(
statistics
[
1
],
0
,
sizeof
(
int
)
*
NUMBER_OF_ENCODINGS_TO_TEST
);
totalFailed
=
totalCount
=
0
;
totalFailed
=
totalCount
=
0
;
...
@@ -54,7 +55,7 @@ void initStatistics() {
...
@@ -54,7 +55,7 @@ void initStatistics() {
INIT_MUTEX
(
statisticsMutex
);
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
);
LOCK
(
statisticsMutex
);
countGotUpdate
=
0
;
countGotUpdate
=
0
;
lastUpdateRect
.
x1
=
x1
;
lastUpdateRect
.
x1
=
x1
;
...
@@ -64,7 +65,7 @@ void updateServerStatistics(int x1,int y1,int x2,int y2) {
...
@@ -64,7 +65,7 @@ void updateServerStatistics(int x1,int y1,int x2,int y2) {
UNLOCK
(
statisticsMutex
);
UNLOCK
(
statisticsMutex
);
}
}
void
updateStatistics
(
int
encodingIndex
,
rfbBool
failed
)
{
static
void
updateStatistics
(
int
encodingIndex
,
rfbBool
failed
)
{
LOCK
(
statisticsMutex
);
LOCK
(
statisticsMutex
);
if
(
failed
)
{
if
(
failed
)
{
statistics
[
1
][
encodingIndex
]
++
;
statistics
[
1
][
encodingIndex
]
++
;
...
@@ -83,7 +84,7 @@ void updateStatistics(int encodingIndex,rfbBool failed) {
...
@@ -83,7 +84,7 @@ void updateStatistics(int encodingIndex,rfbBool failed) {
/* maxDelta=0 means they are expected to match exactly;
/* maxDelta=0 means they are expected to match exactly;
* maxDelta>0 means that the average difference must be lower than maxDelta */
* 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
maxDelta
)
{
{
int
i
,
j
,
k
;
int
i
,
j
,
k
;
...
@@ -116,7 +117,10 @@ static rfbBool resize(rfbClient* cl) {
...
@@ -116,7 +117,10 @@ static rfbBool resize(rfbClient* cl) {
if
(
cl
->
frameBuffer
)
if
(
cl
->
frameBuffer
)
free
(
cl
->
frameBuffer
);
free
(
cl
->
frameBuffer
);
cl
->
frameBuffer
=
(
char
*
)
malloc
(
cl
->
width
*
cl
->
height
*
cl
->
format
.
bitsPerPixel
/
8
);
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
);
SendFramebufferUpdateRequest
(
cl
,
0
,
0
,
cl
->
width
,
cl
->
height
,
FALSE
);
return
TRUE
;
}
}
typedef
struct
clientData
{
typedef
struct
clientData
{
...
@@ -169,11 +173,11 @@ static void* clientLoop(void* data) {
...
@@ -169,11 +173,11 @@ static void* clientLoop(void* data) {
rfbClientLog
(
"Starting client (encoding %s, display %s)
\n
"
,
rfbClientLog
(
"Starting client (encoding %s, display %s)
\n
"
,
testEncodings
[
cd
->
encodingIndex
].
str
,
testEncodings
[
cd
->
encodingIndex
].
str
,
cd
->
display
);
cd
->
display
);
if
(
!
rfbInitClient
(
client
,
0
,
0
))
{
if
(
!
rfbInitClient
(
client
,
NULL
,
NULL
))
{
rfbClientErr
(
"Had problems starting client (encoding %s)
\n
"
,
rfbClientErr
(
"Had problems starting client (encoding %s)
\n
"
,
testEncodings
[
cd
->
encodingIndex
].
str
);
testEncodings
[
cd
->
encodingIndex
].
str
);
updateStatistics
(
cd
->
encodingIndex
,
TRUE
);
updateStatistics
(
cd
->
encodingIndex
,
TRUE
);
return
0
;
return
NULL
;
}
}
while
(
1
)
{
while
(
1
)
{
if
(
WaitForMessage
(
client
,
50
)
>=
0
)
if
(
WaitForMessage
(
client
,
50
)
>=
0
)
...
@@ -185,7 +189,7 @@ static void* clientLoop(void* data) {
...
@@ -185,7 +189,7 @@ static void* clientLoop(void* data) {
if
(
client
->
frameBuffer
)
if
(
client
->
frameBuffer
)
free
(
client
->
frameBuffer
);
free
(
client
->
frameBuffer
);
rfbClientCleanup
(
client
);
rfbClientCleanup
(
client
);
return
0
;
return
NULL
;
}
}
static
void
startClient
(
int
encodingIndex
,
rfbScreenInfo
*
server
)
{
static
void
startClient
(
int
encodingIndex
,
rfbScreenInfo
*
server
)
{
...
@@ -258,7 +262,7 @@ static void idle(rfbScreenInfo* server)
...
@@ -258,7 +262,7 @@ static void idle(rfbScreenInfo* server)
/* log function (to show what messages are from the client) */
/* log function (to show what messages are from the client) */
void
static
void
rfbTestLog
(
const
char
*
format
,
...)
rfbTestLog
(
const
char
*
format
,
...)
{
{
va_list
args
;
va_list
args
;
...
@@ -295,7 +299,7 @@ int main(int argc,char** argv)
...
@@ -295,7 +299,7 @@ int main(int argc,char** argv)
server
=
rfbGetScreen
(
&
argc
,
argv
,
width
,
height
,
8
,
3
,
4
);
server
=
rfbGetScreen
(
&
argc
,
argv
,
width
,
height
,
8
,
3
,
4
);
server
->
frameBuffer
=
malloc
(
400
*
300
*
4
);
server
->
frameBuffer
=
malloc
(
400
*
300
*
4
);
server
->
cursor
=
0
;
server
->
cursor
=
NULL
;
for
(
j
=
0
;
j
<
400
*
300
*
4
;
j
++
)
for
(
j
=
0
;
j
<
400
*
300
*
4
;
j
++
)
server
->
frameBuffer
[
j
]
=
j
;
server
->
frameBuffer
[
j
]
=
j
;
rfbInitServer
(
server
);
rfbInitServer
(
server
);
...
@@ -311,9 +315,9 @@ int main(int argc,char** argv)
...
@@ -311,9 +315,9 @@ int main(int argc,char** argv)
#endif
#endif
startClient
(
i
,
server
);
startClient
(
i
,
server
);
t
=
time
(
0
);
t
=
time
(
NULL
);
/* test 20 seconds */
/* test 20 seconds */
while
(
time
(
0
)
-
t
<
20
)
{
while
(
time
(
NULL
)
-
t
<
20
)
{
idle
(
server
);
idle
(
server
);
...
...
vncterm/VNCommand.c
View file @
8bee4eb9
#define _BSD_SOURCE
#define _POSIX_SOURCE
#include "VNConsole.h"
#include "VNConsole.h"
#include "vga.h"
#include "vga.h"
#ifdef LIBVNCSERVER_HAVE_FCNTL_H
#ifdef LIBVNCSERVER_HAVE_FCNTL_H
...
...
vncterm/VNConsole.c
View file @
8bee4eb9
...
@@ -24,7 +24,6 @@ unsigned char colourMap16[16*3]={
...
@@ -24,7 +24,6 @@ unsigned char colourMap16[16*3]={
void
MakeColourMap16
(
vncConsolePtr
c
)
void
MakeColourMap16
(
vncConsolePtr
c
)
{
{
int
i
,
j
;
rfbColourMap
*
colourMap
=&
(
c
->
screen
->
colourMap
);
rfbColourMap
*
colourMap
=&
(
c
->
screen
->
colourMap
);
if
(
colourMap
->
count
)
if
(
colourMap
->
count
)
free
(
colourMap
->
data
.
bytes
);
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