From 750e3fb70bad9b306856cdec3398e9c751b3a1b7 Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Wed, 29 Jun 2011 08:31:14 +0000 Subject: [PATCH] * Fix a bug where paging up to the top of a TiVo music list would yield a mostly empty page. --- tivo_commands.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tivo_commands.c b/tivo_commands.c index aebce3d..c70d040 100644 --- a/tivo_commands.c +++ b/tivo_commands.c @@ -278,7 +278,6 @@ int callback(void *args, int argc, char **argv, char **azColName) void SendItemDetails(struct upnphttp * h, sqlite_int64 item) { - char * resp = malloc(32768); char *sql; char *zErrMsg = NULL; struct Response args; @@ -287,8 +286,9 @@ SendItemDetails(struct upnphttp * h, sqlite_int64 item) memset(&args, 0, sizeof(args)); memset(&str, 0, sizeof(str)); - str.data = resp; - ret = strcatf(&str, "\n"); + str.data = malloc(32768); + str.size = 32768; + str.off = sprintf(str.data, "\n"); args.str = &str; args.requested = 1; asprintf(&sql, SELECT_COLUMNS @@ -597,7 +597,7 @@ SendContainer(struct upnphttp * h, const char * objectID, int itemStart, int ite " where %s and (%s)", which, myfilter); totalMatches = (ret > 0) ? ret : 0; - if( itemCount < 0 && !args.start ) + if( itemCount < 0 && !itemStart && !anchorOffset ) { args.start = totalMatches + itemCount; }