Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KDE PIM Runtime
Commits
6833eba7
Commit
6833eba7
authored
Apr 07, 2022
by
Nicolas Fella
Browse files
[pop3] Use qint64 instead of ssize_t
ssize_t is not a thing on Windows (cherry picked from commit
d704e64d
)
parent
4ba5b449
Pipeline
#161732
passed with stage
in 10 minutes and 8 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
resources/pop3/pop3protocol.cpp
View file @
6833eba7
...
...
@@ -94,10 +94,10 @@ POP3Protocol::~POP3Protocol()
sasl_done
();
}
ssize_t
POP3Protocol
::
myRead
(
void
*
data
,
ssize_t
len
)
qint64
POP3Protocol
::
myRead
(
void
*
data
,
qint64
len
)
{
if
(
readBufferLen
)
{
ssize_t
copyLen
=
(
len
<
readBufferLen
)
?
len
:
readBufferLen
;
qint64
copyLen
=
(
len
<
readBufferLen
)
?
len
:
readBufferLen
;
memcpy
(
data
,
readBuffer
,
copyLen
);
readBufferLen
-=
copyLen
;
if
(
readBufferLen
)
{
...
...
@@ -111,9 +111,9 @@ ssize_t POP3Protocol::myRead(void *data, ssize_t len)
return
mSocket
->
read
((
char
*
)
data
,
len
);
}
ssize_t
POP3Protocol
::
myReadLine
(
char
*
data
,
ssize_t
len
)
qint64
POP3Protocol
::
myReadLine
(
char
*
data
,
qint64
len
)
{
ssize_t
copyLen
=
0
,
readLen
=
0
;
qint64
copyLen
=
0
,
readLen
=
0
;
while
(
true
)
{
while
(
copyLen
<
readBufferLen
&&
readBuffer
[
copyLen
]
!=
'\n'
)
{
copyLen
++
;
...
...
@@ -247,7 +247,7 @@ bool POP3Protocol::sendCommand(const QByteArray &cmd)
// qCDebug(POP3_LOG) << "C:" << debugCommand;
// Now actually write the command to the socket
if
(
mSocket
->
write
(
cmdrn
.
data
(),
cmdrn
.
size
())
!=
static_cast
<
ssize_t
>
(
cmdrn
.
size
()))
{
if
(
mSocket
->
write
(
cmdrn
.
data
(),
cmdrn
.
size
())
!=
static_cast
<
qint64
>
(
cmdrn
.
size
()))
{
m_sError
=
i18n
(
"Could not send to server.
\n
"
);
return
false
;
}
...
...
@@ -809,7 +809,7 @@ Result POP3Protocol::get(const QString &_commandString)
bool
endOfMail
=
false
;
bool
eat
=
false
;
while
(
true
/* !AtEOF() */
)
{
ssize_t
readlen
=
myRead
(
buf
,
sizeof
(
buf
)
-
1
);
qint64
readlen
=
myRead
(
buf
,
sizeof
(
buf
)
-
1
);
if
(
readlen
<=
0
)
{
const
bool
wasConnected
=
(
mSocket
->
state
()
==
QAbstractSocket
::
ConnectedState
);
closeConnection
();
...
...
@@ -837,7 +837,7 @@ Result POP3Protocol::get(const QString &_commandString)
char
*
buf1
=
buf
,
*
buf2
=
destbuf
;
// ".." at start of a line means only "."
// "." means end of data
for
(
ssize_t
i
=
0
;
i
<
readlen
;
i
++
)
{
for
(
qint64
i
=
0
;
i
<
readlen
;
i
++
)
{
if
(
*
buf1
==
'\r'
&&
eat
)
{
endOfMail
=
true
;
if
(
i
==
readlen
-
1
/* && !AtEOF() */
)
{
...
...
resources/pop3/pop3protocol.h
View file @
6833eba7
...
...
@@ -72,8 +72,8 @@ Q_SIGNALS:
void
messageComplete
();
private:
ssize_t
myRead
(
void
*
data
,
ssize_t
len
);
ssize_t
myReadLine
(
char
*
data
,
ssize_t
len
);
qint64
myRead
(
void
*
data
,
qint64
len
);
qint64
myReadLine
(
char
*
data
,
qint64
len
);
/**
* This returns the size of a message as a long integer.
...
...
@@ -138,5 +138,5 @@ private:
bool
mContinueAfterSslError
=
false
;
QString
m_sError
;
char
readBuffer
[
MAX_PACKET_LEN
];
ssize_t
readBufferLen
;
qint64
readBufferLen
;
};
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment