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
6c41e8f6
Commit
6c41e8f6
authored
Jan 22, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/upnp: check offset<total at end of loop
parent
fa67a4e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
16 deletions
+7
-16
ContentDirectoryService.cxx
src/db/upnp/ContentDirectoryService.cxx
+7
-16
No files found.
src/db/upnp/ContentDirectoryService.cxx
View file @
6c41e8f6
...
...
@@ -114,20 +114,15 @@ ContentDirectoryService::readDir(UpnpClient_Handle handle,
UPnPDirContent
&
dirbuf
,
Error
&
error
)
{
unsigned
offset
=
0
;
unsigned
total
=
1000
;
// Updated on first read.
unsigned
offset
=
0
,
total
=
-
1
,
count
;
while
(
offset
<
total
)
{
unsigned
count
;
do
{
if
(
!
readDirSlice
(
handle
,
objectId
,
offset
,
m_rdreqcnt
,
dirbuf
,
count
,
total
,
error
))
return
false
;
if
(
count
==
0
)
return
true
;
offset
+=
count
;
}
}
while
(
count
>
0
&&
offset
<
total
);
return
true
;
}
...
...
@@ -139,10 +134,9 @@ ContentDirectoryService::search(UpnpClient_Handle hdl,
UPnPDirContent
&
dirbuf
,
Error
&
error
)
{
unsigned
offset
=
0
;
unsigned
total
=
1000
;
// Updated on first read.
unsigned
offset
=
0
,
total
=
-
1
,
count
;
while
(
offset
<
total
)
{
do
{
char
ofbuf
[
100
];
sprintf
(
ofbuf
,
"%d"
,
offset
);
...
...
@@ -173,7 +167,7 @@ ContentDirectoryService::search(UpnpClient_Handle hdl,
const
char
*
value
=
ixmlwrap
::
getFirstElementValue
(
response
,
"NumberReturned"
);
co
nst
unsigned
co
unt
=
value
!=
nullptr
count
=
value
!=
nullptr
?
ParseUnsigned
(
value
)
:
0
;
...
...
@@ -187,10 +181,7 @@ ContentDirectoryService::search(UpnpClient_Handle hdl,
ixmlDocument_free
(
response
);
if
(
!
success
)
return
false
;
if
(
count
==
0
)
break
;
}
}
while
(
count
>
0
&&
offset
<
total
);
return
true
;
}
...
...
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