Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
paho.mqtt.c
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eclipse
paho.mqtt.c
Commits
278b62ea
Commit
278b62ea
authored
Nov 04, 2015
by
Ian Craggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix size_t change issue, and test2 test not run on Windows
parent
54b90529
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
build.xml
build.xml
+8
-1
MQTTAsync.c
src/MQTTAsync.c
+8
-8
No files found.
build.xml
View file @
278b62ea
...
@@ -82,7 +82,14 @@
...
@@ -82,7 +82,14 @@
</target>
</target>
<target
name=
"test"
>
<target
name=
"test"
>
<foreach
target=
"runAtest"
param=
"aTest"
list=
"test1,test2,test4"
/>
<if>
<os
family=
"windows"
/>
<then>
<!-- TODO: build test2 for windows -->
<foreach
target=
"runAtest"
param=
"aTest"
list=
"test1,test4"
/>
</else>
<foreach
target=
"runAtest"
param=
"aTest"
list=
"test1,test2,test4"
/>
</if>
<foreach
target=
"runSSLtest"
param=
"aTest"
list=
"test3,test5"
/>
<foreach
target=
"runSSLtest"
param=
"aTest"
list=
"test3,test5"
/>
</target>
</target>
...
...
src/MQTTAsync.c
View file @
278b62ea
...
@@ -489,7 +489,7 @@ int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd)
...
@@ -489,7 +489,7 @@ int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd)
int
rc
=
0
;
int
rc
=
0
;
MQTTAsyncs
*
aclient
=
qcmd
->
client
;
MQTTAsyncs
*
aclient
=
qcmd
->
client
;
MQTTAsync_command
*
command
=
&
qcmd
->
command
;
MQTTAsync_command
*
command
=
&
qcmd
->
command
;
size_
t
*
lens
=
NULL
;
in
t
*
lens
=
NULL
;
void
**
bufs
=
NULL
;
void
**
bufs
=
NULL
;
int
bufindex
=
0
,
i
,
nbufs
=
0
;
int
bufindex
=
0
,
i
,
nbufs
=
0
;
char
key
[
PERSISTENCE_MAX_KEY_LENGTH
+
1
];
char
key
[
PERSISTENCE_MAX_KEY_LENGTH
+
1
];
...
@@ -500,7 +500,7 @@ int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd)
...
@@ -500,7 +500,7 @@ int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd)
case
SUBSCRIBE
:
case
SUBSCRIBE
:
nbufs
=
3
+
(
command
->
details
.
sub
.
count
*
2
);
nbufs
=
3
+
(
command
->
details
.
sub
.
count
*
2
);
lens
=
(
size_
t
*
)
malloc
(
nbufs
*
sizeof
(
int
));
lens
=
(
in
t
*
)
malloc
(
nbufs
*
sizeof
(
int
));
bufs
=
malloc
(
nbufs
*
sizeof
(
char
*
));
bufs
=
malloc
(
nbufs
*
sizeof
(
char
*
));
bufs
[
bufindex
]
=
&
command
->
type
;
bufs
[
bufindex
]
=
&
command
->
type
;
...
@@ -515,7 +515,7 @@ int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd)
...
@@ -515,7 +515,7 @@ int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd)
for
(
i
=
0
;
i
<
command
->
details
.
sub
.
count
;
++
i
)
for
(
i
=
0
;
i
<
command
->
details
.
sub
.
count
;
++
i
)
{
{
bufs
[
bufindex
]
=
command
->
details
.
sub
.
topics
[
i
];
bufs
[
bufindex
]
=
command
->
details
.
sub
.
topics
[
i
];
lens
[
bufindex
++
]
=
strlen
(
command
->
details
.
sub
.
topics
[
i
])
+
1
;
lens
[
bufindex
++
]
=
(
int
)
strlen
(
command
->
details
.
sub
.
topics
[
i
])
+
1
;
bufs
[
bufindex
]
=
&
command
->
details
.
sub
.
qoss
[
i
];
bufs
[
bufindex
]
=
&
command
->
details
.
sub
.
qoss
[
i
];
lens
[
bufindex
++
]
=
sizeof
(
command
->
details
.
sub
.
qoss
[
i
]);
lens
[
bufindex
++
]
=
sizeof
(
command
->
details
.
sub
.
qoss
[
i
]);
}
}
...
@@ -525,7 +525,7 @@ int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd)
...
@@ -525,7 +525,7 @@ int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd)
case
UNSUBSCRIBE
:
case
UNSUBSCRIBE
:
nbufs
=
3
+
command
->
details
.
unsub
.
count
;
nbufs
=
3
+
command
->
details
.
unsub
.
count
;
lens
=
(
size_t
*
)
malloc
(
nbufs
*
sizeof
(
size_
t
));
lens
=
(
int
*
)
malloc
(
nbufs
*
sizeof
(
in
t
));
bufs
=
malloc
(
nbufs
*
sizeof
(
char
*
));
bufs
=
malloc
(
nbufs
*
sizeof
(
char
*
));
bufs
[
bufindex
]
=
&
command
->
type
;
bufs
[
bufindex
]
=
&
command
->
type
;
...
@@ -540,7 +540,7 @@ int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd)
...
@@ -540,7 +540,7 @@ int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd)
for
(
i
=
0
;
i
<
command
->
details
.
unsub
.
count
;
++
i
)
for
(
i
=
0
;
i
<
command
->
details
.
unsub
.
count
;
++
i
)
{
{
bufs
[
bufindex
]
=
command
->
details
.
unsub
.
topics
[
i
];
bufs
[
bufindex
]
=
command
->
details
.
unsub
.
topics
[
i
];
lens
[
bufindex
++
]
=
strlen
(
command
->
details
.
unsub
.
topics
[
i
])
+
1
;
lens
[
bufindex
++
]
=
(
int
)
strlen
(
command
->
details
.
unsub
.
topics
[
i
])
+
1
;
}
}
sprintf
(
key
,
"%s%d"
,
PERSISTENCE_COMMAND_KEY
,
++
aclient
->
command_seqno
);
sprintf
(
key
,
"%s%d"
,
PERSISTENCE_COMMAND_KEY
,
++
aclient
->
command_seqno
);
break
;
break
;
...
@@ -548,7 +548,7 @@ int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd)
...
@@ -548,7 +548,7 @@ int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd)
case
PUBLISH
:
case
PUBLISH
:
nbufs
=
7
;
nbufs
=
7
;
lens
=
(
size_t
*
)
malloc
(
nbufs
*
sizeof
(
size_
t
));
lens
=
(
int
*
)
malloc
(
nbufs
*
sizeof
(
in
t
));
bufs
=
malloc
(
nbufs
*
sizeof
(
char
*
));
bufs
=
malloc
(
nbufs
*
sizeof
(
char
*
));
bufs
[
bufindex
]
=
&
command
->
type
;
bufs
[
bufindex
]
=
&
command
->
type
;
...
@@ -558,7 +558,7 @@ int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd)
...
@@ -558,7 +558,7 @@ int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd)
lens
[
bufindex
++
]
=
sizeof
(
command
->
token
);
lens
[
bufindex
++
]
=
sizeof
(
command
->
token
);
bufs
[
bufindex
]
=
command
->
details
.
pub
.
destinationName
;
bufs
[
bufindex
]
=
command
->
details
.
pub
.
destinationName
;
lens
[
bufindex
++
]
=
strlen
(
command
->
details
.
pub
.
destinationName
)
+
1
;
lens
[
bufindex
++
]
=
(
int
)
strlen
(
command
->
details
.
pub
.
destinationName
)
+
1
;
bufs
[
bufindex
]
=
&
command
->
details
.
pub
.
payloadlen
;
bufs
[
bufindex
]
=
&
command
->
details
.
pub
.
payloadlen
;
lens
[
bufindex
++
]
=
sizeof
(
command
->
details
.
pub
.
payloadlen
);
lens
[
bufindex
++
]
=
sizeof
(
command
->
details
.
pub
.
payloadlen
);
...
@@ -577,7 +577,7 @@ int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd)
...
@@ -577,7 +577,7 @@ int MQTTAsync_persistCommand(MQTTAsync_queuedCommand* qcmd)
}
}
if
(
nbufs
>
0
)
if
(
nbufs
>
0
)
{
{
if
((
rc
=
aclient
->
c
->
persistence
->
pput
(
aclient
->
c
->
phandle
,
key
,
nbufs
,
(
char
**
)
bufs
,
(
int
*
)
lens
))
!=
0
)
if
((
rc
=
aclient
->
c
->
persistence
->
pput
(
aclient
->
c
->
phandle
,
key
,
nbufs
,
(
char
**
)
bufs
,
lens
))
!=
0
)
Log
(
LOG_ERROR
,
0
,
"Error persisting command, rc %d"
,
rc
);
Log
(
LOG_ERROR
,
0
,
"Error persisting command, rc %d"
,
rc
);
qcmd
->
seqno
=
aclient
->
command_seqno
;
qcmd
->
seqno
=
aclient
->
command_seqno
;
}
}
...
...
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