Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
f363788d
Commit
f363788d
authored
Jan 22, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/upnp: pass unsigned integers to readDirSlice()
parent
714056f1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
17 deletions
+17
-17
ContentDirectoryService.cxx
src/db/upnp/ContentDirectoryService.cxx
+14
-14
ContentDirectoryService.hxx
src/db/upnp/ContentDirectoryService.hxx
+3
-3
No files found.
src/db/upnp/ContentDirectoryService.cxx
View file @
f363788d
...
...
@@ -71,15 +71,15 @@ ReadResultTag(UPnPDirContent &dirbuf, IXML_Document *response, Error &error)
inline
bool
ContentDirectoryService
::
readDirSlice
(
UpnpClient_Handle
hdl
,
const
char
*
objectId
,
int
offset
,
int
count
,
UPnPDirContent
&
dirbuf
,
int
*
didreadp
,
int
*
totalp
,
const
char
*
objectId
,
unsigned
offset
,
unsigned
count
,
UPnPDirContent
&
dirbuf
,
unsigned
&
didreadp
,
unsigned
&
totalp
,
Error
&
error
)
{
// Create request
char
ofbuf
[
100
],
cntbuf
[
100
];
sprintf
(
ofbuf
,
"%
d
"
,
offset
);
sprintf
(
cntbuf
,
"%
d
"
,
count
);
sprintf
(
ofbuf
,
"%
u
"
,
offset
);
sprintf
(
cntbuf
,
"%
u
"
,
count
);
// Some devices require an empty SortCriteria, else bad params
IXML_Document
*
request
=
MakeActionHelper
(
"Browse"
,
m_serviceType
.
c_str
(),
...
...
@@ -112,7 +112,7 @@ ContentDirectoryService::readDirSlice(UpnpClient_Handle hdl,
if
(
value
!=
nullptr
)
didread
=
atoi
(
value
);
if
(
count
==
-
1
||
count
==
0
)
{
if
(
count
==
0
)
{
// TODO: what's this?
error
.
Set
(
upnp_domain
,
"got -1 or 0 entries"
);
return
false
;
...
...
@@ -120,12 +120,12 @@ ContentDirectoryService::readDirSlice(UpnpClient_Handle hdl,
value
=
ixmlwrap
::
getFirstElementValue
(
response
,
"TotalMatches"
);
if
(
value
!=
nullptr
)
*
totalp
=
atoi
(
value
);
totalp
=
atoi
(
value
);
if
(
!
ReadResultTag
(
dirbuf
,
response
,
error
))
return
false
;
*
didreadp
=
didread
;
didreadp
=
didread
;
return
true
;
}
...
...
@@ -135,13 +135,13 @@ ContentDirectoryService::readDir(UpnpClient_Handle handle,
UPnPDirContent
&
dirbuf
,
Error
&
error
)
{
int
offset
=
0
;
int
total
=
1000
;
// Updated on first read.
unsigned
offset
=
0
;
unsigned
total
=
1000
;
// Updated on first read.
while
(
offset
<
total
)
{
int
count
;
unsigned
count
;
if
(
!
readDirSlice
(
handle
,
objectId
,
offset
,
m_rdreqcnt
,
dirbuf
,
&
count
,
&
total
,
error
))
count
,
total
,
error
))
return
false
;
offset
+=
count
;
...
...
@@ -157,8 +157,8 @@ ContentDirectoryService::search(UpnpClient_Handle hdl,
UPnPDirContent
&
dirbuf
,
Error
&
error
)
{
int
offset
=
0
;
int
total
=
1000
;
// Updated on first read.
unsigned
offset
=
0
;
unsigned
total
=
1000
;
// Updated on first read.
while
(
offset
<
total
)
{
char
ofbuf
[
100
];
...
...
src/db/upnp/ContentDirectoryService.hxx
View file @
f363788d
...
...
@@ -78,9 +78,9 @@ public:
Error
&
error
);
bool
readDirSlice
(
UpnpClient_Handle
handle
,
const
char
*
objectId
,
int
offset
,
int
count
,
UPnPDirContent
&
dirbuf
,
int
*
didread
,
int
*
total
,
const
char
*
objectId
,
unsigned
offset
,
unsigned
count
,
UPnPDirContent
&
dirbuf
,
unsigned
&
didread
,
unsigned
&
total
,
Error
&
error
);
/** Search the content directory service.
...
...
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