diff options
author | Alasdair Campbell <alcoheca@gmail.com> | 2012-06-06 18:40:00 +0100 |
---|---|---|
committer | Alasdair Campbell <alcoheca@gmail.com> | 2012-09-05 17:43:08 +0100 |
commit | 0b307a7bef9b02db8682ef5aa8c2a9191dd1a2d8 (patch) | |
tree | 1d17b73fc0dbbc172f5a99bea986d3ef904c0a73 /lib/libUPnP | |
parent | 05e7dcb6ebeacb0dba83cb1a4a30eb6a8532d754 (diff) |
[UPnP] reinstated: '[UPnP] use server provided item count to iterate browse req' by elupus @ cb110ea28b7506cb31d6ab4fd347fad1c96ec9ed
all other modifications to libPlatinum/Neptune since codiqs last commit have
been checked and are not required / have been included upstream
the following patches therefore do not need to be reinstated:
5e5156bde70bb4250c9d912e43656a19d008f110
4df0a4cb1cd059f585de289a10ab915ce1bd95a8
a6eaa587174f73c0fdd7a5130774772c7d475fec
964b08aed02ee52d7f88250409b4e3fdd0363be3
2f70d124f75d76813e48ecc26ffd9aa3625072aa
299d326314619aa3a085f2c026e55860a75b3a5c
5bbf59fbc049325ec4205fadaa0903a753b866ee
370c8366ed83115558e4dcb00561207854c4f971
755f17fe4353b7047ca04c16b7461d1ef3b8ed1b
20c1ed61030f7a5bada60821507f29e54821b1a9
0b11444d6e405fa17e73ef0abc9ceba25a559cce
f96d966e7575b4d9f7c864ad153dd9fb968344c9
99479c384176fd3f82d518506e560ba08ad57e40
347aa55b6c55e2801ff7a421e8bcc02ce0314cab
a1993bf0380b9ced60c39064833435e458aa5434
f13f20aaa9493d58264c55f2a5b2cafd09435b0e
95df1d019cb7ea64a6f748a9104db1ecd666af42
887728b93d0a8cddd6a08bfddc4079f4c2ae82f8
66d2daf7bd90f7be2cb4cdbc5088488627953e3f
ec70e260e95becc5bfcd86512b245776ef9653ea
296435b9a9262b23b49cbfb2302e36e730f292e7
99e0a1eaf18ed07625143e4fadc6eb027f822857
588a66a55067433ade77769a39c81552a995b38d
3fd25488ba88b30cfa0f5b834bbde91a21f05a73
Diffstat (limited to 'lib/libUPnP')
-rw-r--r-- | lib/libUPnP/Platinum/Source/Devices/MediaServer/PltSyncMediaBrowser.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltSyncMediaBrowser.cpp b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltSyncMediaBrowser.cpp index 2bd23f8c9b..091ae00b83 100644 --- a/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltSyncMediaBrowser.cpp +++ b/lib/libUPnP/Platinum/Source/Devices/MediaServer/PltSyncMediaBrowser.cpp @@ -36,6 +36,7 @@ | includes +---------------------------------------------------------------------*/ #include "PltSyncMediaBrowser.h" +#include <algorithm> NPT_SET_LOCAL_LOGGER("platinum.media.server.syncbrowser") @@ -239,6 +240,7 @@ PLT_SyncMediaBrowser::BrowseSync(PLT_DeviceDataReference& device, { NPT_Result res = NPT_FAILURE; NPT_Int32 index = start; + NPT_UInt32 count = 0; // only cache metadata or if starting from 0 and asking for maximum bool cache = m_UseCache && (metadata || (start == 0 && max_results == 0)); @@ -270,9 +272,15 @@ PLT_SyncMediaBrowser::BrowseSync(PLT_DeviceDataReference& device, } // server returned no more, bail now - if (browse_data->info.items->GetItemCount() == 0) + if (browse_data->info.nr == 0) break; + if (browse_data->info.nr != browse_data->info.items->GetItemCount()) { + NPT_LOG_WARNING_2("Server returned unexpected number of items (%d vs %d)", + browse_data->info.nr, browse_data->info.items->GetItemCount()); + } + count += std::max<NPT_UInt32>(browse_data->info.nr, browse_data->info.items->GetItemCount()); + if (list.IsNull()) { list = browse_data->info.items; } else { @@ -290,12 +298,12 @@ PLT_SyncMediaBrowser::BrowseSync(PLT_DeviceDataReference& device, // Unless we were told to stop after reaching a certain amount to avoid // length delays // (some servers may return a total matches out of whack at some point too) - if ((browse_data->info.tm && browse_data->info.tm <= list->GetItemCount()) || - (max_results && list->GetItemCount() >= max_results)) + if ((browse_data->info.tm && browse_data->info.tm <= count) || + (max_results && count >= max_results)) break; // ask for the next chunk of entries - index = list->GetItemCount(); + index = count; } while(1); done: |