diff options
author | Max Kellermann <max@duempel.org> | 2014-01-22 20:44:24 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-22 20:57:10 +0100 |
commit | f363788d768adcd8d582593105060fd5a4dfa538 (patch) | |
tree | 794a7cd201dc11c938ab1e6cb3deab267296ee4c | |
parent | 714056f157cd6a27ed42c2962805a919aeba81a3 (diff) | |
download | mpd-f363788d768adcd8d582593105060fd5a4dfa538.tar.gz mpd-f363788d768adcd8d582593105060fd5a4dfa538.tar.xz mpd-f363788d768adcd8d582593105060fd5a4dfa538.zip |
db/upnp: pass unsigned integers to readDirSlice()
Diffstat (limited to '')
-rw-r--r-- | src/db/upnp/ContentDirectoryService.cxx | 28 | ||||
-rw-r--r-- | src/db/upnp/ContentDirectoryService.hxx | 6 |
2 files changed, 17 insertions, 17 deletions
diff --git a/src/db/upnp/ContentDirectoryService.cxx b/src/db/upnp/ContentDirectoryService.cxx index ea773e6f8..31c16cabe 100644 --- a/src/db/upnp/ContentDirectoryService.cxx +++ b/src/db/upnp/ContentDirectoryService.cxx @@ -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]; diff --git a/src/db/upnp/ContentDirectoryService.hxx b/src/db/upnp/ContentDirectoryService.hxx index 63a13583f..bf1024c32 100644 --- a/src/db/upnp/ContentDirectoryService.hxx +++ b/src/db/upnp/ContentDirectoryService.hxx @@ -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. |