Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
noVNC
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
noVNC
Commits
c577ca23
Commit
c577ca23
authored
Jan 25, 2012
by
Mike Tinglof
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
keep zlib history so we can decode as a stream
parent
de84e098
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
10 deletions
+26
-10
jsunzip.js
include/jsunzip.js
+24
-8
rfb.js
include/rfb.js
+2
-2
No files found.
include/jsunzip.js
View file @
c577ca23
...
...
@@ -201,6 +201,7 @@ function TINF() {
this
.
OK
=
0
;
this
.
DATA_ERROR
=
(
-
3
);
this
.
WINDOW_SIZE
=
32768
;
/* ------------------------------ *
* -- internal data structures -- *
...
...
@@ -219,6 +220,8 @@ this.DATA = function(that) {
this
.
dest
=
[];
this
.
history
=
[];
this
.
ltree
=
new
that
.
TREE
();
/* dynamic length/symbol tree */
this
.
dtree
=
new
that
.
TREE
();
/* dynamic distance tree */
};
...
...
@@ -482,7 +485,7 @@ this.inflate_block_data = function(d, lt, dt)
if
(
sym
<
256
)
{
ddest
[
ddestlength
++
]
=
String
.
fromCharCode
(
sym
);
ddest
[
ddestlength
++
]
=
sym
;
// ?
String.fromCharCode(sym);
}
else
{
var
length
,
dist
,
offs
;
...
...
@@ -500,6 +503,9 @@ this.inflate_block_data = function(d, lt, dt)
/* copy match */
for
(
i
=
offs
;
i
<
offs
+
length
;
++
i
)
{
if
(
i
<
0
)
ddest
[
ddestlength
++
]
=
d
.
history
[
d
.
history
.
length
+
i
];
else
ddest
[
ddestlength
++
]
=
ddest
[
i
];
}
}
...
...
@@ -576,7 +582,7 @@ this.init = function()
this
.
reset
=
function
()
{
this
.
d
=
new
this
.
DATA
(
this
);
this
.
header
=
null
;
delete
this
.
header
;
}
/* inflate stream from source to dest */
...
...
@@ -597,9 +603,9 @@ this.uncompress = function(source, offset)
d
.
dest
=
[];
// Skip zlib header at start of stream
/*if (typeof
header == 'undefined') {
header = this.read_bits(d, 16, 0);
}
*/
if
(
typeof
this
.
header
==
'undefined'
)
{
this
.
header
=
this
.
read_bits
(
d
,
16
,
0
);
}
do
{
...
...
@@ -633,11 +639,21 @@ this.uncompress = function(source, offset)
if
(
res
!=
this
.
OK
)
return
{
'status'
:
this
.
DATA_ERROR
};
}
while
(
!
bfinal
);
}
while
(
!
bfinal
&&
d
.
sourceIndex
<
d
.
source
.
length
-
3
);
if
(
Object
.
prototype
.
toString
.
call
(
source
)
!==
'[object Array]'
)
{
d
.
dest
=
d
.
dest
.
join
(
''
);
}
else
{
if
(
d
.
dest
.
length
>=
this
.
WINDOW_SIZE
)
{
d
.
history
=
d
.
dest
.
slice
(
d
.
dest
.
length
-
this
.
WINDOW_SIZE
);
}
else
{
var
overflow
=
d
.
history
.
length
+
d
.
dest
.
length
-
this
.
WINDOW_SIZE
;
if
(
overflow
>
0
)
d
.
history
=
d
.
history
.
slice
(
overflow
);
}
d
.
history
.
push
.
apply
(
d
.
history
,
d
.
dest
);
}
return
{
'status'
:
this
.
OK
,
'data'
:
d
.
dest
};
}
...
...
include/rfb.js
View file @
c577ca23
...
...
@@ -1293,8 +1293,8 @@ encHandlers.TIGHT = function display_tight() {
var
decompress
=
function
(
data
)
{
// TODO: process resetStreams here
var
uncompressed
=
FBU
.
zlibs
[
streamId
].
uncompress
(
data
,
0
);
/*
if (uncompressed.status != 0)
throw("Invalid data in zlib stream");
*/
if
(
uncompressed
.
status
!=
0
)
throw
(
"Invalid data in zlib stream"
);
return
uncompressed
.
data
;
}
...
...
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