Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
rs-tiled
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microhacks
rs-tiled
Commits
a14e8757
Commit
a14e8757
authored
6 years ago
by
Arvid E. Picciani
Browse files
Options
Downloads
Patches
Plain Diff
replace flate2 with libflate for portability
fixes #47
parent
c8bef8f1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Cargo.toml
+3
-3
3 additions, 3 deletions
Cargo.toml
src/lib.rs
+9
-5
9 additions, 5 deletions
src/lib.rs
with
12 additions
and
8 deletions
Cargo.toml
+
3
−
3
View file @
a14e8757
...
@@ -20,6 +20,6 @@ name = "example"
...
@@ -20,6 +20,6 @@ name = "example"
path
=
"examples/main.rs"
path
=
"examples/main.rs"
[dependencies]
[dependencies]
base64
=
"0.5.2"
base64
=
"0.5.2"
xml-rs
=
"0.3.0"
xml-rs
=
"0.3.0"
flate
2
=
"
1.0
.1"
lib
flate
=
"
0.1
.1
8
"
This diff is collapsed.
Click to expand it.
src/lib.rs
+
9
−
5
View file @
a14e8757
extern
crate
flate
2
;
extern
crate
lib
flate
;
extern
crate
xml
;
extern
crate
xml
;
extern
crate
base64
;
extern
crate
base64
;
...
@@ -11,7 +11,6 @@ use std::fmt;
...
@@ -11,7 +11,6 @@ use std::fmt;
use
xml
::
reader
::{
EventReader
,
Error
as
XmlError
};
use
xml
::
reader
::{
EventReader
,
Error
as
XmlError
};
use
xml
::
reader
::
XmlEvent
;
use
xml
::
reader
::
XmlEvent
;
use
xml
::
attribute
::
OwnedAttribute
;
use
xml
::
attribute
::
OwnedAttribute
;
use
flate2
::
read
::{
ZlibDecoder
,
GzDecoder
};
#[derive(Debug,
Copy,
Clone)]
#[derive(Debug,
Copy,
Clone)]
pub
enum
ParseTileError
{
pub
enum
ParseTileError
{
...
@@ -841,7 +840,9 @@ fn parse_base64<R: Read>(parser: &mut EventReader<R>) -> Result<Vec<u8>, TiledEr
...
@@ -841,7 +840,9 @@ fn parse_base64<R: Read>(parser: &mut EventReader<R>) -> Result<Vec<u8>, TiledEr
}
}
fn
decode_zlib
(
data
:
Vec
<
u8
>
)
->
Result
<
Vec
<
u8
>
,
TiledError
>
{
fn
decode_zlib
(
data
:
Vec
<
u8
>
)
->
Result
<
Vec
<
u8
>
,
TiledError
>
{
let
mut
zd
=
ZlibDecoder
::
new
(
BufReader
::
new
(
&
data
[
..
]));
use
libflate
::
zlib
::{
Decoder
};
let
mut
zd
=
Decoder
::
new
(
BufReader
::
new
(
&
data
[
..
]))
.map_err
(|
e
|
TiledError
::
DecompressingError
(
e
))
?
;
let
mut
data
=
Vec
::
new
();
let
mut
data
=
Vec
::
new
();
match
zd
.read_to_end
(
&
mut
data
)
{
match
zd
.read_to_end
(
&
mut
data
)
{
Ok
(
_v
)
=>
{},
Ok
(
_v
)
=>
{},
...
@@ -851,9 +852,12 @@ fn decode_zlib(data: Vec<u8>) -> Result<Vec<u8>, TiledError> {
...
@@ -851,9 +852,12 @@ fn decode_zlib(data: Vec<u8>) -> Result<Vec<u8>, TiledError> {
}
}
fn
decode_gzip
(
data
:
Vec
<
u8
>
)
->
Result
<
Vec
<
u8
>
,
TiledError
>
{
fn
decode_gzip
(
data
:
Vec
<
u8
>
)
->
Result
<
Vec
<
u8
>
,
TiledError
>
{
let
mut
gzd
=
GzDecoder
::
new
(
BufReader
::
new
(
&
data
[
..
]));
use
libflate
::
gzip
::{
Decoder
};
let
mut
zd
=
Decoder
::
new
(
BufReader
::
new
(
&
data
[
..
]))
.map_err
(|
e
|
TiledError
::
DecompressingError
(
e
))
?
;
let
mut
data
=
Vec
::
new
();
let
mut
data
=
Vec
::
new
();
g
zd
.read_to_end
(
&
mut
data
)
.map_err
(|
e
|
TiledError
::
DecompressingError
(
e
))
?
;
zd
.read_to_end
(
&
mut
data
)
.map_err
(|
e
|
TiledError
::
DecompressingError
(
e
))
?
;
Ok
(
data
)
Ok
(
data
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment