* Streamline some TiVo ifdefs.

This commit is contained in:
Justin Maggard
2012-06-30 00:26:55 +00:00
parent 61fbce18ba
commit 5f14c68597
5 changed files with 37 additions and 36 deletions

View File

@ -75,10 +75,8 @@
#include "log.h"
#include "sql.h"
#include <libexif/exif-loader.h>
#ifdef TIVO_SUPPORT
#include "tivo_utils.h"
#include "tivo_commands.h"
#endif
#include "sendfile.h"
@ -1624,14 +1622,14 @@ SendResp_resizedimg(struct upnphttp * h, char * object)
int width=640, height=480, dstw, dsth, size;
int srcw, srch;
unsigned char * data = NULL;
char *path, *file_path;
char *resolution;
char *path, *file_path = NULL;
char *resolution = NULL;
char *key, *val;
char *saveptr, *item=NULL;
char *saveptr, *item = NULL;
int rotate;
/* Not implemented yet *
char *pixelshape=NULL; */
int64_t id;
long long id;
int rows=0, chunked, ret;
image_s *imsrc = NULL, *imdst = NULL;
int scale = 1;
@ -1639,16 +1637,18 @@ SendResp_resizedimg(struct upnphttp * h, char * object)
id = strtoll(object, &saveptr, 10);
snprintf(buf, sizeof(buf), "SELECT PATH, RESOLUTION, ROTATION from DETAILS where ID = '%lld'", (long long)id);
ret = sql_get_table(db, buf, &result, &rows, NULL);
if( (ret != SQLITE_OK) )
if( ret != SQLITE_OK )
{
DPRINTF(E_ERROR, L_HTTP, "Didn't find valid file for %lld!\n", id);
Send500(h);
return;
}
file_path = result[3];
resolution = result[4];
rotate = result[5] ? atoi(result[5]) : 0;
if( !rows || !file_path || !resolution || (access(file_path, F_OK) != 0) )
if( rows )
{
file_path = result[3];
resolution = result[4];
rotate = result[5] ? atoi(result[5]) : 0;
}
if( !file_path || !resolution || (access(file_path, F_OK) != 0) )
{
DPRINTF(E_WARN, L_HTTP, "%s not found, responding ERROR 404\n", object);
sqlite3_free_table(result);
@ -1661,9 +1661,7 @@ SendResp_resizedimg(struct upnphttp * h, char * object)
path = saveptr ? saveptr + 1 : object;
for( item = strtok_r(path, "&,", &saveptr); item != NULL; item = strtok_r(NULL, "&,", &saveptr) )
{
#ifdef TIVO_SUPPORT
decodeString(item, 1);
#endif
val = item;
key = strsep(&val, "=");
if( !val )