Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
70f4ee2a
Commit
70f4ee2a
authored
Mar 12, 2018
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(FileExtractor): many fixes
parent
386f1130
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
50 deletions
+11
-50
FileExtractor.cpp
src/components/file/FileExtractor.cpp
+10
-49
FileExtractor.hpp
src/components/file/FileExtractor.hpp
+1
-1
No files found.
src/components/file/FileExtractor.cpp
View file @
70f4ee2a
...
...
@@ -31,40 +31,6 @@
using
namespace
std
;
static
const
char
*
minizipErrorToString
(
int
error
)
{
switch
(
error
)
{
case
MZ_OK
:
return
"ok"
;
case
MZ_STREAM_ERROR
:
return
"stream error"
;
case
MZ_DATA_ERROR
:
return
"data error"
;
case
MZ_MEM_ERROR
:
return
"memory error"
;
case
MZ_END_OF_LIST
:
return
"end of list"
;
case
MZ_END_OF_STREAM
:
return
"end of stream"
;
case
MZ_PARAM_ERROR
:
return
"param error"
;
case
MZ_FORMAT_ERROR
:
return
"format error"
;
case
MZ_INTERNAL_ERROR
:
return
"internal error"
;
case
MZ_CRC_ERROR
:
return
"crc error"
;
case
MZ_CRYPT_ERROR
:
return
"crypt error"
;
case
MZ_EXIST_ERROR
:
return
"exist error"
;
case
MZ_PASSWORD_ERROR
:
return
"password error"
;
}
Q_ASSERT
(
false
);
return
""
;
}
static
int
openMinizipStream
(
void
**
stream
,
const
char
*
filePath
)
{
*
stream
=
nullptr
;
if
(
!
mz_stream_bzip_create
(
stream
))
...
...
@@ -185,8 +151,8 @@ void FileExtractor::clean () {
}
void
FileExtractor
::
emitExtractFailed
(
int
error
)
{
qWarning
()
<<
QStringLiteral
(
"Unable to
open extract file: `%1` (
%2)."
)
.
arg
(
mFile
).
arg
(
minizipErrorToString
(
error
)
);
qWarning
()
<<
QStringLiteral
(
"Unable to
extract file: `%1` (code:
%2)."
)
.
arg
(
mFile
).
arg
(
error
);
mDestinationFile
.
remove
();
clean
();
emit
extractFailed
();
...
...
@@ -208,18 +174,13 @@ void FileExtractor::emitOutputError () {
void
FileExtractor
::
handleExtraction
()
{
char
buffer
[
4096
];
int32_t
readBytes
=
mz_stream_bzip_read
(
mStream
,
buffer
,
sizeof
buffer
);
switch
(
readBytes
)
{
case
MZ_OK
:
break
;
case
MZ_END_OF_STREAM
:
emitExtractFinished
();
return
;
default:
emitExtractFailed
(
readBytes
);
return
;
if
(
readBytes
==
0
)
emitExtractFinished
();
else
if
(
readBytes
<
0
)
emitExtractFailed
(
readBytes
);
else
{
setReadBytes
(
mReadBytes
+
readBytes
);
if
(
mDestinationFile
.
write
(
buffer
,
sizeof
buffer
)
==
-
1
)
emitOutputError
();
}
setReadBytes
(
readBytes
);
if
(
mDestinationFile
.
write
(
buffer
,
sizeof
buffer
)
==
-
1
)
emitOutputError
();
}
src/components/file/FileExtractor.hpp
View file @
70f4ee2a
...
...
@@ -48,7 +48,7 @@ signals:
void
totalBytesChanged
(
qint64
totalBytes
);
void
extractingChanged
(
bool
extracting
);
void
extractFinished
();
void
extractFailed
();
void
extractFailed
();
private:
QString
getFile
()
const
;
...
...
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