* Replace sqlite_int64 with int64_t in many places, to better allow for the possibility of other databases. (Thanks Douglas Carmichael)

This commit is contained in:
Justin Maggard 2012-06-29 23:14:27 +00:00
parent 2c7a3bfc06
commit 61fbce18ba
19 changed files with 151 additions and 138 deletions

View File

@ -1,4 +1,4 @@
AM_CFLAGS = -Wall -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 @STATIC_CFLAGS@ AM_CFLAGS = -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 @STATIC_CFLAGS@
SUBDIRS=po SUBDIRS=po

View File

@ -15,6 +15,8 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with MiniDLNA. If not, see <http://www.gnu.org/licenses/>. * along with MiniDLNA. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "config.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -104,7 +106,8 @@ update_if_album_art(const char *path)
DIR *dh; DIR *dh;
struct dirent *dp; struct dirent *dp;
enum file_types type = TYPE_UNKNOWN; enum file_types type = TYPE_UNKNOWN;
sqlite_int64 art_id = 0; int64_t art_id = 0;
int ret;
strncpyt(fpath, path, sizeof(fpath)); strncpyt(fpath, path, sizeof(fpath));
match = basename(fpath); match = basename(fpath);
@ -150,7 +153,8 @@ update_if_album_art(const char *path)
DPRINTF(E_DEBUG, L_METADATA, "New file %s looks like cover art for %s\n", path, dp->d_name); DPRINTF(E_DEBUG, L_METADATA, "New file %s looks like cover art for %s\n", path, dp->d_name);
snprintf(file, sizeof(file), "%s/%s", dir, dp->d_name); snprintf(file, sizeof(file), "%s/%s", dir, dp->d_name);
art_id = find_album_art(file, NULL, 0); art_id = find_album_art(file, NULL, 0);
if( sql_exec(db, "UPDATE DETAILS set ALBUM_ART = %lld where PATH = '%q'", art_id, file) != SQLITE_OK ) ret = sql_exec(db, "UPDATE DETAILS set ALBUM_ART = %lld where PATH = '%q'", (long long)art_id, file);
if( ret != SQLITE_OK )
DPRINTF(E_WARN, L_METADATA, "Error setting %s as cover art for %s\n", match, dp->d_name); DPRINTF(E_WARN, L_METADATA, "Error setting %s as cover art for %s\n", match, dp->d_name);
} }
} }
@ -334,14 +338,14 @@ found_file:
return NULL; return NULL;
} }
sqlite_int64 int64_t
find_album_art(const char *path, const char *image_data, int image_size) find_album_art(const char *path, const char *image_data, int image_size)
{ {
char *album_art = NULL; char *album_art = NULL;
char *sql; char *sql;
char **result; char **result;
int cols, rows; int cols, rows;
sqlite_int64 ret = 0; int64_t ret = 0;
if( (image_size && (album_art = check_embedded_art(path, image_data, image_size))) || if( (image_size && (album_art = check_embedded_art(path, image_data, image_size))) ||
(album_art = check_for_album_file(path)) ) (album_art = check_for_album_file(path)) )

View File

@ -25,9 +25,9 @@
#define __ALBUMART_H__ #define __ALBUMART_H__
void void
update_if_album_art(const char * path); update_if_album_art(const char *path);
sqlite_int64 int64_t
find_album_art(const char * path, const char * image_data, int image_size); find_album_art(const char *path, const char *image_data, int image_size);
#endif #endif

View File

@ -518,7 +518,7 @@ inotify_remove_file(const char * path)
char *id; char *id;
char *ptr; char *ptr;
char **result; char **result;
sqlite_int64 detailID; int64_t detailID;
int rows, playlist; int rows, playlist;
if( ends_with(path, ".srt") ) if( ends_with(path, ".srt") )
@ -546,7 +546,7 @@ inotify_remove_file(const char * path)
else else
{ {
/* Delete the parent containers if we are about to empty them. */ /* Delete the parent containers if we are about to empty them. */
snprintf(sql, sizeof(sql), "SELECT PARENT_ID from OBJECTS where DETAIL_ID = %lld", detailID); snprintf(sql, sizeof(sql), "SELECT PARENT_ID from OBJECTS where DETAIL_ID = %lld", (long long int)detailID);
if( (sql_get_table(db, sql, &result, &rows, NULL) == SQLITE_OK) ) if( (sql_get_table(db, sql, &result, &rows, NULL) == SQLITE_OK) )
{ {
int i, children; int i, children;
@ -596,7 +596,7 @@ inotify_remove_directory(int fd, const char * path)
{ {
char * sql; char * sql;
char **result; char **result;
sqlite_int64 detailID = 0; int64_t detailID = 0;
int rows, i, ret = 1; int rows, i, ret = 1;
/* Invalidate the scanner cache so we don't insert files into non-existent containers */ /* Invalidate the scanner cache so we don't insert files into non-existent containers */

1
log.c
View File

@ -17,6 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include "config.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>

View File

@ -15,6 +15,8 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with MiniDLNA. If not, see <http://www.gnu.org/licenses/>. * along with MiniDLNA. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "config.h"
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
@ -26,7 +28,6 @@
#include <sys/param.h> #include <sys/param.h>
#include <fcntl.h> #include <fcntl.h>
#include "config.h"
#include <libexif/exif-loader.h> #include <libexif/exif-loader.h>
#include "image_utils.h" #include "image_utils.h"
#include "tagutils/tagutils.h" #include "tagutils/tagutils.h"
@ -170,7 +171,7 @@ typedef AVMetadataTag AVDictionaryEntry;
#define MPEG_TS_PACKET_LENGTH 188 #define MPEG_TS_PACKET_LENGTH 188
#define MPEG_TS_PACKET_LENGTH_DLNA 192 /* prepends 4 bytes to TS packet */ #define MPEG_TS_PACKET_LENGTH_DLNA 192 /* prepends 4 bytes to TS packet */
int int
dlna_timestamp_is_present(const char * filename, int * raw_packet_size) dlna_timestamp_is_present(const char *filename, int *raw_packet_size)
{ {
unsigned char buffer[3*MPEG_TS_PACKET_LENGTH_DLNA]; unsigned char buffer[3*MPEG_TS_PACKET_LENGTH_DLNA];
int fd, i; int fd, i;
@ -211,7 +212,7 @@ dlna_timestamp_is_present(const char * filename, int * raw_packet_size)
#ifdef TIVO_SUPPORT #ifdef TIVO_SUPPORT
int int
is_tivo_file(const char * path) is_tivo_file(const char *path)
{ {
unsigned char buf[5]; unsigned char buf[5];
unsigned char hdr[5] = { 'T','i','V','o','\0' }; unsigned char hdr[5] = { 'T','i','V','o','\0' };
@ -230,7 +231,7 @@ is_tivo_file(const char * path)
#endif #endif
void void
check_for_captions(const char * path, sqlite_int64 detailID) check_for_captions(const char *path, int64_t detailID)
{ {
char *file = malloc(MAXPATHLEN); char *file = malloc(MAXPATHLEN);
char *id = NULL; char *id = NULL;
@ -270,7 +271,7 @@ no_source_video:
} }
void void
parse_nfo(const char * path, metadata_t * m) parse_nfo(const char *path, metadata_t *m)
{ {
FILE *nfo; FILE *nfo;
char buf[65536]; char buf[65536];
@ -321,7 +322,7 @@ parse_nfo(const char * path, metadata_t * m)
} }
void void
free_metadata(metadata_t * m, uint32_t flags) free_metadata(metadata_t *m, uint32_t flags)
{ {
if( flags & FLAG_TITLE ) if( flags & FLAG_TITLE )
free(m->title); free(m->title);
@ -357,8 +358,8 @@ free_metadata(metadata_t * m, uint32_t flags)
free(m->rotation); free(m->rotation);
} }
sqlite_int64 int64_t
GetFolderMetadata(const char * name, const char * path, const char * artist, const char * genre, sqlite_int64 album_art) GetFolderMetadata(const char *name, const char *path, const char *artist, const char *genre, int64_t album_art)
{ {
int ret; int ret;
@ -375,16 +376,16 @@ GetFolderMetadata(const char * name, const char * path, const char * artist, con
return ret; return ret;
} }
sqlite_int64 int64_t
GetAudioMetadata(const char * path, char * name) GetAudioMetadata(const char *path, char *name)
{ {
char type[4]; char type[4];
static char lang[6] = { '\0' }; static char lang[6] = { '\0' };
struct stat file; struct stat file;
sqlite_int64 ret; int64_t ret;
char *esc_tag; char *esc_tag;
int i; int i;
sqlite_int64 album_art = 0; int64_t album_art = 0;
struct song_metadata song; struct song_metadata song;
metadata_t m; metadata_t m;
uint32_t free_flags = FLAG_MIME|FLAG_DURATION|FLAG_DLNA_PN|FLAG_DATE; uint32_t free_flags = FLAG_MIME|FLAG_DURATION|FLAG_DLNA_PN|FLAG_DATE;
@ -580,8 +581,8 @@ libjpeg_error_handler(j_common_ptr cinfo)
return; return;
} }
sqlite_int64 int64_t
GetImageMetadata(const char * path, char * name) GetImageMetadata(const char *path, char *name)
{ {
ExifData *ed; ExifData *ed;
ExifEntry *e = NULL; ExifEntry *e = NULL;
@ -593,8 +594,8 @@ GetImageMetadata(const char * path, char * name)
char make[32], model[64] = {'\0'}; char make[32], model[64] = {'\0'};
char b[1024]; char b[1024];
struct stat file; struct stat file;
sqlite_int64 ret; int64_t ret;
image_s * imsrc; image_s *imsrc;
metadata_t m; metadata_t m;
uint32_t free_flags = 0xFFFFFFFF; uint32_t free_flags = 0xFFFFFFFF;
memset(&m, '\0', sizeof(metadata_t)); memset(&m, '\0', sizeof(metadata_t));
@ -752,8 +753,8 @@ no_exifdata:
return ret; return ret;
} }
sqlite_int64 int64_t
GetVideoMetadata(const char * path, char * name) GetVideoMetadata(const char *path, char *name)
{ {
struct stat file; struct stat file;
int ret, i; int ret, i;
@ -763,7 +764,7 @@ GetVideoMetadata(const char * path, char * name)
int audio_stream = -1, video_stream = -1; int audio_stream = -1, video_stream = -1;
enum audio_profiles audio_profile = PROFILE_AUDIO_UNKNOWN; enum audio_profiles audio_profile = PROFILE_AUDIO_UNKNOWN;
char fourcc[4]; char fourcc[4];
sqlite_int64 album_art = 0; int64_t album_art = 0;
char nfo[MAXPATHLEN], *ext; char nfo[MAXPATHLEN], *ext;
struct song_metadata video; struct song_metadata video;
metadata_t m; metadata_t m;

View File

@ -80,24 +80,24 @@ typedef enum {
} ts_timestamp_t; } ts_timestamp_t;
int int
ends_with(const char * haystack, const char * needle); ends_with(const char *haystack, const char *needle);
char * char *
modifyString(char * string, const char * before, const char * after, short like); modifyString(char *string, const char *before, const char *after, short like);
void void
check_for_captions(const char * path, sqlite_int64 detailID); check_for_captions(const char *path, int64_t detailID);
sqlite_int64 int64_t
GetFolderMetadata(const char * name, const char * path, const char * artist, const char * genre, sqlite_int64 album_art); GetFolderMetadata(const char *name, const char *path, const char *artist, const char *genre, int64_t album_art);
sqlite_int64 int64_t
GetAudioMetadata(const char * path, char * name); GetAudioMetadata(const char *path, char *name);
sqlite_int64 int64_t
GetImageMetadata(const char * path, char * name); GetImageMetadata(const char *path, char *name);
sqlite_int64 int64_t
GetVideoMetadata(const char * path, char * name); GetVideoMetadata(const char *path, char *name);
#endif #endif

View File

@ -29,6 +29,8 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "config.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -40,7 +42,6 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <errno.h> #include <errno.h>
#include "config.h"
#include "upnpdescstrings.h" #include "upnpdescstrings.h"
#include "minidlnapath.h" #include "minidlnapath.h"
#include "upnphttp.h" #include "upnphttp.h"

View File

@ -119,7 +119,7 @@ fill_playlists()
struct song_metadata plist; struct song_metadata plist;
struct stat file; struct stat file;
char type[4]; char type[4];
sqlite_int64 plID, detailID; int64_t plID, detailID;
char sql_buf[] = "SELECT ID, NAME, PATH from PLAYLISTS where ITEMS > FOUND"; char sql_buf[] = "SELECT ID, NAME, PATH from PLAYLISTS where ITEMS > FOUND";
DPRINTF(E_WARN, L_SCANNER, "Parsing playlists...\n"); DPRINTF(E_WARN, L_SCANNER, "Parsing playlists...\n");

127
scanner.c
View File

@ -85,16 +85,16 @@ int valid_cache = 0;
struct virtual_item struct virtual_item
{ {
sqlite_int64 objectID; int64_t objectID;
char parentID[64]; char parentID[64];
char name[256]; char name[256];
}; };
sqlite_int64 int64_t
get_next_available_id(const char * table, const char * parentID) get_next_available_id(const char *table, const char *parentID)
{ {
char *ret, *base; char *ret, *base;
sqlite_int64 objectID = 0; int64_t objectID = 0;
ret = sql_get_text_field(db, "SELECT OBJECT_ID from %s where ID = " ret = sql_get_text_field(db, "SELECT OBJECT_ID from %s where ID = "
"(SELECT max(ID) from %s where PARENT_ID = '%s')", "(SELECT max(ID) from %s where PARENT_ID = '%s')",
@ -111,8 +111,8 @@ get_next_available_id(const char * table, const char * parentID)
} }
int int
insert_container(const char * item, const char * rootParent, const char * refID, const char *class, insert_container(const char *item, const char *rootParent, const char *refID, const char *class,
const char *artist, const char *genre, const char *album_art, sqlite_int64 *objectID, sqlite_int64 *parentID) const char *artist, const char *genre, const char *album_art, int64_t *objectID, int64_t *parentID)
{ {
char *result; char *result;
char *base; char *base;
@ -136,7 +136,7 @@ insert_container(const char * item, const char * rootParent, const char * refID,
} }
else else
{ {
sqlite_int64 detailID = 0; int64_t detailID = 0;
*objectID = 0; *objectID = 0;
*parentID = get_next_available_id("OBJECTS", rootParent); *parentID = get_next_available_id("OBJECTS", rootParent);
if( refID ) if( refID )
@ -153,7 +153,8 @@ insert_container(const char * item, const char * rootParent, const char * refID,
" (OBJECT_ID, PARENT_ID, REF_ID, DETAIL_ID, CLASS, NAME) " " (OBJECT_ID, PARENT_ID, REF_ID, DETAIL_ID, CLASS, NAME) "
"VALUES" "VALUES"
" ('%s$%llX', '%s', %Q, %lld, 'container.%s', '%q')", " ('%s$%llX', '%s', %Q, %lld, 'container.%s', '%q')",
rootParent, *parentID, rootParent, refID, detailID, class, item); rootParent, (long long)*parentID, rootParent,
refID, (long long)detailID, class, item);
} }
sqlite3_free(result); sqlite3_free(result);
@ -161,13 +162,13 @@ insert_container(const char * item, const char * rootParent, const char * refID,
} }
static void static void
insert_containers(const char * name, const char *path, const char * refID, const char * class, sqlite_int64 detailID) insert_containers(const char *name, const char *path, const char *refID, const char *class, int64_t detailID)
{ {
char sql[128]; char sql[128];
char **result; char **result;
int ret; int ret;
int cols, row; int cols, row;
sqlite_int64 objectID, parentID; int64_t objectID, parentID;
if( strstr(class, "imageItem") ) if( strstr(class, "imageItem") )
{ {
@ -175,9 +176,9 @@ insert_containers(const char * name, const char *path, const char * refID, const
static struct virtual_item last_date; static struct virtual_item last_date;
static struct virtual_item last_cam; static struct virtual_item last_cam;
static struct virtual_item last_camdate; static struct virtual_item last_camdate;
static sqlite_int64 last_all_objectID = 0; static long long last_all_objectID = 0;
snprintf(sql, sizeof(sql), "SELECT DATE, CREATOR from DETAILS where ID = %lld", detailID); snprintf(sql, sizeof(sql), "SELECT DATE, CREATOR from DETAILS where ID = %lld", (long long)detailID);
ret = sql_get_table(db, sql, &result, &row, &cols); ret = sql_get_table(db, sql, &result, &row, &cols);
if( ret == SQLITE_OK ) if( ret == SQLITE_OK )
{ {
@ -199,7 +200,7 @@ insert_containers(const char * name, const char *path, const char * refID, const
else else
{ {
insert_container(date_taken, IMAGE_DATE_ID, NULL, "album.photoAlbum", NULL, NULL, NULL, &objectID, &parentID); insert_container(date_taken, IMAGE_DATE_ID, NULL, "album.photoAlbum", NULL, NULL, NULL, &objectID, &parentID);
sprintf(last_date.parentID, IMAGE_DATE_ID"$%llX", parentID); sprintf(last_date.parentID, IMAGE_DATE_ID"$%llX", (unsigned long long)parentID);
last_date.objectID = objectID; last_date.objectID = objectID;
strncpyt(last_date.name, date_taken, sizeof(last_date.name)); strncpyt(last_date.name, date_taken, sizeof(last_date.name));
//DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached date item: %s/%s/%X\n", last_date.name, last_date.parentID, last_date.objectID); //DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached date item: %s/%s/%X\n", last_date.name, last_date.parentID, last_date.objectID);
@ -208,12 +209,12 @@ insert_containers(const char * name, const char *path, const char * refID, const
" (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) "
"VALUES" "VALUES"
" ('%s$%llX', '%s', '%s', '%s', %lld, %Q)", " ('%s$%llX', '%s', '%s', '%s', %lld, %Q)",
last_date.parentID, last_date.objectID, last_date.parentID, refID, class, detailID, name); last_date.parentID, (long long)last_date.objectID, last_date.parentID, refID, class, (long long)detailID, name);
if( !valid_cache || strcmp(camera, last_cam.name) != 0 ) if( !valid_cache || strcmp(camera, last_cam.name) != 0 )
{ {
insert_container(camera, IMAGE_CAMERA_ID, NULL, "storageFolder", NULL, NULL, NULL, &objectID, &parentID); insert_container(camera, IMAGE_CAMERA_ID, NULL, "storageFolder", NULL, NULL, NULL, &objectID, &parentID);
sprintf(last_cam.parentID, IMAGE_CAMERA_ID"$%llX", parentID); sprintf(last_cam.parentID, IMAGE_CAMERA_ID"$%llX", (long long)parentID);
strncpyt(last_cam.name, camera, sizeof(last_cam.name)); strncpyt(last_cam.name, camera, sizeof(last_cam.name));
/* Invalidate last_camdate cache */ /* Invalidate last_camdate cache */
last_camdate.name[0] = '\0'; last_camdate.name[0] = '\0';
@ -226,7 +227,7 @@ insert_containers(const char * name, const char *path, const char * refID, const
else else
{ {
insert_container(date_taken, last_cam.parentID, NULL, "album.photoAlbum", NULL, NULL, NULL, &objectID, &parentID); insert_container(date_taken, last_cam.parentID, NULL, "album.photoAlbum", NULL, NULL, NULL, &objectID, &parentID);
sprintf(last_camdate.parentID, "%s$%llX", last_cam.parentID, parentID); sprintf(last_camdate.parentID, "%s$%llX", last_cam.parentID, (long long)parentID);
last_camdate.objectID = objectID; last_camdate.objectID = objectID;
strncpyt(last_camdate.name, date_taken, sizeof(last_camdate.name)); strncpyt(last_camdate.name, date_taken, sizeof(last_camdate.name));
//DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached camdate item: %s/%s/%s/%X\n", camera, last_camdate.name, last_camdate.parentID, last_camdate.objectID); //DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached camdate item: %s/%s/%s/%X\n", camera, last_camdate.name, last_camdate.parentID, last_camdate.objectID);
@ -235,7 +236,7 @@ insert_containers(const char * name, const char *path, const char * refID, const
" (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) "
"VALUES" "VALUES"
" ('%s$%llX', '%s', '%s', '%s', %lld, %Q)", " ('%s$%llX', '%s', '%s', '%s', %lld, %Q)",
last_camdate.parentID, last_camdate.objectID, last_camdate.parentID, refID, class, detailID, name); last_camdate.parentID, last_camdate.objectID, last_camdate.parentID, refID, class, (long long)detailID, name);
/* All Images */ /* All Images */
if( !last_all_objectID ) if( !last_all_objectID )
{ {
@ -245,11 +246,11 @@ insert_containers(const char * name, const char *path, const char * refID, const
" (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) "
"VALUES" "VALUES"
" ('"IMAGE_ALL_ID"$%llX', '"IMAGE_ALL_ID"', '%s', '%s', %lld, %Q)", " ('"IMAGE_ALL_ID"$%llX', '"IMAGE_ALL_ID"', '%s', '%s', %lld, %Q)",
last_all_objectID++, refID, class, detailID, name); last_all_objectID++, refID, class, (long long)detailID, name);
} }
else if( strstr(class, "audioItem") ) else if( strstr(class, "audioItem") )
{ {
snprintf(sql, sizeof(sql), "SELECT ALBUM, ARTIST, GENRE, ALBUM_ART from DETAILS where ID = %lld", detailID); snprintf(sql, sizeof(sql), "SELECT ALBUM, ARTIST, GENRE, ALBUM_ART from DETAILS where ID = %lld", (long long)detailID);
ret = sql_get_table(db, sql, &result, &row, &cols); ret = sql_get_table(db, sql, &result, &row, &cols);
if( ret != SQLITE_OK ) if( ret != SQLITE_OK )
return; return;
@ -267,7 +268,7 @@ insert_containers(const char * name, const char *path, const char * refID, const
static struct virtual_item last_genre; static struct virtual_item last_genre;
static struct virtual_item last_genreArtist; static struct virtual_item last_genreArtist;
static struct virtual_item last_genreArtistAll; static struct virtual_item last_genreArtistAll;
static sqlite_int64 last_all_objectID = 0; static long long last_all_objectID = 0;
if( album ) if( album )
{ {
@ -280,7 +281,7 @@ insert_containers(const char * name, const char *path, const char * refID, const
{ {
strncpyt(last_album.name, album, sizeof(last_album.name)); strncpyt(last_album.name, album, sizeof(last_album.name));
insert_container(album, MUSIC_ALBUM_ID, NULL, "album.musicAlbum", artist, genre, album_art, &objectID, &parentID); insert_container(album, MUSIC_ALBUM_ID, NULL, "album.musicAlbum", artist, genre, album_art, &objectID, &parentID);
sprintf(last_album.parentID, MUSIC_ALBUM_ID"$%llX", parentID); sprintf(last_album.parentID, MUSIC_ALBUM_ID"$%llX", (long long)parentID);
last_album.objectID = objectID; last_album.objectID = objectID;
//DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached album item: %s/%s/%X\n", last_album.name, last_album.parentID, last_album.objectID); //DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached album item: %s/%s/%X\n", last_album.name, last_album.parentID, last_album.objectID);
} }
@ -288,19 +289,19 @@ insert_containers(const char * name, const char *path, const char * refID, const
" (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) "
"VALUES" "VALUES"
" ('%s$%llX', '%s', '%s', '%s', %lld, %Q)", " ('%s$%llX', '%s', '%s', '%s', %lld, %Q)",
last_album.parentID, last_album.objectID, last_album.parentID, refID, class, detailID, name); last_album.parentID, last_album.objectID, last_album.parentID, refID, class, (long long)detailID, name);
} }
if( artist ) if( artist )
{ {
if( !valid_cache || strcmp(artist, last_artist.name) != 0 ) if( !valid_cache || strcmp(artist, last_artist.name) != 0 )
{ {
insert_container(artist, MUSIC_ARTIST_ID, NULL, "person.musicArtist", NULL, genre, NULL, &objectID, &parentID); insert_container(artist, MUSIC_ARTIST_ID, NULL, "person.musicArtist", NULL, genre, NULL, &objectID, &parentID);
sprintf(last_artist.parentID, MUSIC_ARTIST_ID"$%llX", parentID); sprintf(last_artist.parentID, MUSIC_ARTIST_ID"$%llX", (long long)parentID);
strncpyt(last_artist.name, artist, sizeof(last_artist.name)); strncpyt(last_artist.name, artist, sizeof(last_artist.name));
last_artistAlbum.name[0] = '\0'; last_artistAlbum.name[0] = '\0';
/* Add this file to the "- All Albums -" container as well */ /* Add this file to the "- All Albums -" container as well */
insert_container(_("- All Albums -"), last_artist.parentID, NULL, "album", artist, genre, NULL, &objectID, &parentID); insert_container(_("- All Albums -"), last_artist.parentID, NULL, "album", artist, genre, NULL, &objectID, &parentID);
sprintf(last_artistAlbumAll.parentID, "%s$%llX", last_artist.parentID, parentID); sprintf(last_artistAlbumAll.parentID, "%s$%llX", last_artist.parentID, (long long)parentID);
last_artistAlbumAll.objectID = objectID; last_artistAlbumAll.objectID = objectID;
} }
else else
@ -316,7 +317,7 @@ insert_containers(const char * name, const char *path, const char * refID, const
{ {
insert_container(album?album:_("Unknown Album"), last_artist.parentID, album?last_album.parentID:NULL, insert_container(album?album:_("Unknown Album"), last_artist.parentID, album?last_album.parentID:NULL,
"album.musicAlbum", artist, genre, album_art, &objectID, &parentID); "album.musicAlbum", artist, genre, album_art, &objectID, &parentID);
sprintf(last_artistAlbum.parentID, "%s$%llX", last_artist.parentID, parentID); sprintf(last_artistAlbum.parentID, "%s$%llX", last_artist.parentID, (long long)parentID);
last_artistAlbum.objectID = objectID; last_artistAlbum.objectID = objectID;
strncpyt(last_artistAlbum.name, album ? album : _("Unknown Album"), sizeof(last_artistAlbum.name)); strncpyt(last_artistAlbum.name, album ? album : _("Unknown Album"), sizeof(last_artistAlbum.name));
//DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached artist/album item: %s/%s/%X\n", last_artist.name, last_artist.parentID, last_artist.objectID); //DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached artist/album item: %s/%s/%X\n", last_artist.name, last_artist.parentID, last_artist.objectID);
@ -325,23 +326,23 @@ insert_containers(const char * name, const char *path, const char * refID, const
" (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) "
"VALUES" "VALUES"
" ('%s$%llX', '%s', '%s', '%s', %lld, %Q)", " ('%s$%llX', '%s', '%s', '%s', %lld, %Q)",
last_artistAlbum.parentID, last_artistAlbum.objectID, last_artistAlbum.parentID, refID, class, detailID, name); last_artistAlbum.parentID, last_artistAlbum.objectID, last_artistAlbum.parentID, refID, class, (long long)detailID, name);
sql_exec(db, "INSERT into OBJECTS" sql_exec(db, "INSERT into OBJECTS"
" (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) "
"VALUES" "VALUES"
" ('%s$%llX', '%s', '%s', '%s', %lld, %Q)", " ('%s$%llX', '%s', '%s', '%s', %lld, %Q)",
last_artistAlbumAll.parentID, last_artistAlbumAll.objectID, last_artistAlbumAll.parentID, refID, class, detailID, name); last_artistAlbumAll.parentID, last_artistAlbumAll.objectID, last_artistAlbumAll.parentID, refID, class, (long long)detailID, name);
} }
if( genre ) if( genre )
{ {
if( !valid_cache || strcmp(genre, last_genre.name) != 0 ) if( !valid_cache || strcmp(genre, last_genre.name) != 0 )
{ {
insert_container(genre, MUSIC_GENRE_ID, NULL, "genre.musicGenre", NULL, NULL, NULL, &objectID, &parentID); insert_container(genre, MUSIC_GENRE_ID, NULL, "genre.musicGenre", NULL, NULL, NULL, &objectID, &parentID);
sprintf(last_genre.parentID, MUSIC_GENRE_ID"$%llX", parentID); sprintf(last_genre.parentID, MUSIC_GENRE_ID"$%llX", (long long)parentID);
strncpyt(last_genre.name, genre, sizeof(last_genre.name)); strncpyt(last_genre.name, genre, sizeof(last_genre.name));
/* Add this file to the "- All Artists -" container as well */ /* Add this file to the "- All Artists -" container as well */
insert_container(_("- All Artists -"), last_genre.parentID, NULL, "person", NULL, genre, NULL, &objectID, &parentID); insert_container(_("- All Artists -"), last_genre.parentID, NULL, "person", NULL, genre, NULL, &objectID, &parentID);
sprintf(last_genreArtistAll.parentID, "%s$%llX", last_genre.parentID, parentID); sprintf(last_genreArtistAll.parentID, "%s$%llX", last_genre.parentID, (long long)parentID);
last_genreArtistAll.objectID = objectID; last_genreArtistAll.objectID = objectID;
} }
else else
@ -356,7 +357,7 @@ insert_containers(const char * name, const char *path, const char * refID, const
{ {
insert_container(artist?artist:_("Unknown Artist"), last_genre.parentID, artist?last_artist.parentID:NULL, insert_container(artist?artist:_("Unknown Artist"), last_genre.parentID, artist?last_artist.parentID:NULL,
"person.musicArtist", NULL, genre, NULL, &objectID, &parentID); "person.musicArtist", NULL, genre, NULL, &objectID, &parentID);
sprintf(last_genreArtist.parentID, "%s$%llX", last_genre.parentID, parentID); sprintf(last_genreArtist.parentID, "%s$%llX", last_genre.parentID, (long long)parentID);
last_genreArtist.objectID = objectID; last_genreArtist.objectID = objectID;
strncpyt(last_genreArtist.name, artist ? artist : _("Unknown Artist"), sizeof(last_genreArtist.name)); strncpyt(last_genreArtist.name, artist ? artist : _("Unknown Artist"), sizeof(last_genreArtist.name));
//DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached genre/artist item: %s/%s/%X\n", last_genreArtist.name, last_genreArtist.parentID, last_genreArtist.objectID); //DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached genre/artist item: %s/%s/%X\n", last_genreArtist.name, last_genreArtist.parentID, last_genreArtist.objectID);
@ -365,12 +366,12 @@ insert_containers(const char * name, const char *path, const char * refID, const
" (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) "
"VALUES" "VALUES"
" ('%s$%llX', '%s', '%s', '%s', %lld, %Q)", " ('%s$%llX', '%s', '%s', '%s', %lld, %Q)",
last_genreArtist.parentID, last_genreArtist.objectID, last_genreArtist.parentID, refID, class, detailID, name); last_genreArtist.parentID, last_genreArtist.objectID, last_genreArtist.parentID, refID, class, (long long)detailID, name);
sql_exec(db, "INSERT into OBJECTS" sql_exec(db, "INSERT into OBJECTS"
" (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) "
"VALUES" "VALUES"
" ('%s$%llX', '%s', '%s', '%s', %lld, %Q)", " ('%s$%llX', '%s', '%s', '%s', %lld, %Q)",
last_genreArtistAll.parentID, last_genreArtistAll.objectID, last_genreArtistAll.parentID, refID, class, detailID, name); last_genreArtistAll.parentID, last_genreArtistAll.objectID, last_genreArtistAll.parentID, refID, class, (long long)detailID, name);
} }
/* All Music */ /* All Music */
if( !last_all_objectID ) if( !last_all_objectID )
@ -381,11 +382,11 @@ insert_containers(const char * name, const char *path, const char * refID, const
" (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) "
"VALUES" "VALUES"
" ('"MUSIC_ALL_ID"$%llX', '"MUSIC_ALL_ID"', '%s', '%s', %lld, %Q)", " ('"MUSIC_ALL_ID"$%llX', '"MUSIC_ALL_ID"', '%s', '%s', %lld, %Q)",
last_all_objectID++, refID, class, detailID, name); last_all_objectID++, refID, class, (long long)detailID, name);
} }
else if( strstr(class, "videoItem") ) else if( strstr(class, "videoItem") )
{ {
static sqlite_int64 last_all_objectID = 0; static long long last_all_objectID = 0;
/* All Videos */ /* All Videos */
if( !last_all_objectID ) if( !last_all_objectID )
@ -396,7 +397,7 @@ insert_containers(const char * name, const char *path, const char * refID, const
" (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) " " (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) "
"VALUES" "VALUES"
" ('"VIDEO_ALL_ID"$%llX', '"VIDEO_ALL_ID"', '%s', '%s', %lld, %Q)", " ('"VIDEO_ALL_ID"$%llX', '"VIDEO_ALL_ID"', '%s', '%s', %lld, %Q)",
last_all_objectID++, refID, class, detailID, name); last_all_objectID++, refID, class, (long long)detailID, name);
return; return;
} }
else else
@ -408,9 +409,9 @@ insert_containers(const char * name, const char *path, const char * refID, const
} }
int int
insert_directory(const char * name, const char * path, const char * base, const char * parentID, int objectID) insert_directory(const char *name, const char *path, const char *base, const char *parentID, int objectID)
{ {
sqlite_int64 detailID = 0; int64_t detailID = 0;
char class[] = "container.storageFolder"; char class[] = "container.storageFolder";
char *result, *p; char *result, *p;
static char last_found[256] = "-1"; static char last_found[256] = "-1";
@ -469,15 +470,15 @@ insert_directory(const char * name, const char * path, const char * base, const
} }
int int
insert_file(char * name, const char * path, const char * parentID, int object) insert_file(char *name, const char *path, const char *parentID, int object)
{ {
char class[32]; char class[32];
char objectID[64]; char objectID[64];
sqlite_int64 detailID = 0; int64_t detailID = 0;
char base[8]; char base[8];
char * typedir_parentID; char *typedir_parentID;
char * baseid; char *baseid;
char * orig_name = NULL; char *orig_name = NULL;
if( is_image(name) ) if( is_image(name) )
{ {
@ -549,26 +550,26 @@ int
CreateDatabase(void) CreateDatabase(void)
{ {
int ret, i; int ret, i;
const char * containers[] = { "0","-1", "root", const char *containers[] = { "0","-1", "root",
MUSIC_ID, "0", _("Music"), MUSIC_ID, "0", _("Music"),
MUSIC_ALL_ID, MUSIC_ID, _("All Music"), MUSIC_ALL_ID, MUSIC_ID, _("All Music"),
MUSIC_GENRE_ID, MUSIC_ID, _("Genre"), MUSIC_GENRE_ID, MUSIC_ID, _("Genre"),
MUSIC_ARTIST_ID, MUSIC_ID, _("Artist"), MUSIC_ARTIST_ID, MUSIC_ID, _("Artist"),
MUSIC_ALBUM_ID, MUSIC_ID, _("Album"), MUSIC_ALBUM_ID, MUSIC_ID, _("Album"),
MUSIC_DIR_ID, MUSIC_ID, _("Folders"), MUSIC_DIR_ID, MUSIC_ID, _("Folders"),
MUSIC_PLIST_ID, MUSIC_ID, _("Playlists"), MUSIC_PLIST_ID, MUSIC_ID, _("Playlists"),
VIDEO_ID, "0", _("Video"), VIDEO_ID, "0", _("Video"),
VIDEO_ALL_ID, VIDEO_ID, _("All Video"), VIDEO_ALL_ID, VIDEO_ID, _("All Video"),
VIDEO_DIR_ID, VIDEO_ID, _("Folders"), VIDEO_DIR_ID, VIDEO_ID, _("Folders"),
IMAGE_ID, "0", _("Pictures"), IMAGE_ID, "0", _("Pictures"),
IMAGE_ALL_ID, IMAGE_ID, _("All Pictures"), IMAGE_ALL_ID, IMAGE_ID, _("All Pictures"),
IMAGE_DATE_ID, IMAGE_ID, _("Date Taken"), IMAGE_DATE_ID, IMAGE_ID, _("Date Taken"),
IMAGE_CAMERA_ID, IMAGE_ID, _("Camera"), IMAGE_CAMERA_ID, IMAGE_ID, _("Camera"),
IMAGE_DIR_ID, IMAGE_ID, _("Folders"), IMAGE_DIR_ID, IMAGE_ID, _("Folders"),
BROWSEDIR_ID, "0", _("Browse Folders"), BROWSEDIR_ID, "0", _("Browse Folders"),
0 }; 0 };
ret = sql_exec(db, create_objectTable_sqlite); ret = sql_exec(db, create_objectTable_sqlite);
@ -674,13 +675,13 @@ filter_media(scan_filter *d)
} }
void void
ScanDirectory(const char * dir, const char * parent, enum media_types dir_type) ScanDirectory(const char *dir, const char *parent, enum media_types dir_type)
{ {
struct dirent **namelist; struct dirent **namelist;
int i, n, startID=0; int i, n, startID=0;
char parent_id[PATH_MAX]; char parent_id[PATH_MAX];
char full_path[PATH_MAX]; char full_path[PATH_MAX];
char * name = NULL; char *name = NULL;
static long long unsigned int fileno = 0; static long long unsigned int fileno = 0;
enum file_types type; enum file_types type;
@ -760,14 +761,14 @@ ScanDirectory(const char * dir, const char * parent, enum media_types dir_type)
void void
start_scanner() start_scanner()
{ {
struct media_dir_s * media_path = media_dirs; struct media_dir_s *media_path = media_dirs;
char name[MAXPATHLEN]; char name[MAXPATHLEN];
if (setpriority(PRIO_PROCESS, 0, 15) == -1) if (setpriority(PRIO_PROCESS, 0, 15) == -1)
DPRINTF(E_WARN, L_INOTIFY, "Failed to reduce scanner thread priority\n"); DPRINTF(E_WARN, L_INOTIFY, "Failed to reduce scanner thread priority\n");
#ifdef READYNAS #ifdef READYNAS
FILE * flag = fopen("/ramfs/.upnp-av_scan", "w"); FILE *flag = fopen("/ramfs/.upnp-av_scan", "w");
if( flag ) if( flag )
fclose(flag); fclose(flag);
#endif #endif

View File

@ -60,22 +60,22 @@
extern int valid_cache; extern int valid_cache;
int int
is_video(const char * file); is_video(const char *file);
int int
is_audio(const char * file); is_audio(const char *file);
int int
is_image(const char * file); is_image(const char *file);
sqlite_int64 int64_t
get_next_available_id(const char * table, const char * parentID); get_next_available_id(const char *table, const char *parentID);
int int
insert_directory(const char * name, const char * path, const char * base, const char * parentID, int objectID); insert_directory(const char *name, const char *path, const char *base, const char *parentID, int objectID);
int int
insert_file(char * name, const char * path, const char * parentID, int object); insert_file(char *name, const char *path, const char *parentID, int object);
int int
CreateDatabase(void); CreateDatabase(void);

View File

@ -32,10 +32,10 @@
#include "sql.h" #include "sql.h"
#include "log.h" #include "log.h"
void static void
SendRootContainer(struct upnphttp * h) SendRootContainer(struct upnphttp *h)
{ {
char * resp; char *resp;
int len; int len;
len = xasprintf(&resp, "<?xml version='1.0' encoding='UTF-8' ?>\n" len = xasprintf(&resp, "<?xml version='1.0' encoding='UTF-8' ?>\n"
@ -93,8 +93,8 @@ SendRootContainer(struct upnphttp * h)
SendResp_upnphttp(h); SendResp_upnphttp(h);
} }
char * static char *
unescape_tag(char * tag) unescape_tag(char *tag)
{ {
modifyString(tag, "&amp;amp;", "&amp;", 0); modifyString(tag, "&amp;amp;", "&amp;", 0);
modifyString(tag, "&amp;amp;lt;", "&lt;", 0); modifyString(tag, "&amp;amp;lt;", "&lt;", 0);
@ -107,7 +107,8 @@ unescape_tag(char * tag)
#define FLAG_SEND_RESIZED 0x01 #define FLAG_SEND_RESIZED 0x01
#define FLAG_NO_PARAMS 0x02 #define FLAG_NO_PARAMS 0x02
#define FLAG_VIDEO 0x04 #define FLAG_VIDEO 0x04
int callback(void *args, int argc, char **argv, char **azColName) static int
callback(void *args, int argc, char **argv, char **azColName)
{ {
struct Response *passed_args = (struct Response *)args; struct Response *passed_args = (struct Response *)args;
char *id = argv[0], *class = argv[1], *detailID = argv[2], *size = argv[3], *title = argv[4], *duration = argv[5], char *id = argv[0], *class = argv[1], *detailID = argv[2], *size = argv[3], *title = argv[4], *duration = argv[5],
@ -275,8 +276,8 @@ int callback(void *args, int argc, char **argv, char **azColName)
" d.DURATION, d.BITRATE, d.SAMPLERATE, d.ARTIST, d.ALBUM, d.GENRE," \ " d.DURATION, d.BITRATE, d.SAMPLERATE, d.ARTIST, d.ALBUM, d.GENRE," \
" d.COMMENT, d.DATE, d.RESOLUTION, d.MIME, d.PATH, d.DISC, d.TRACK " " d.COMMENT, d.DATE, d.RESOLUTION, d.MIME, d.PATH, d.DISC, d.TRACK "
void static void
SendItemDetails(struct upnphttp * h, sqlite_int64 item) SendItemDetails(struct upnphttp *h, int64_t item)
{ {
char *sql; char *sql;
char *zErrMsg = NULL; char *zErrMsg = NULL;
@ -309,9 +310,9 @@ SendItemDetails(struct upnphttp * h, sqlite_int64 item)
SendResp_upnphttp(h); SendResp_upnphttp(h);
} }
void static void
SendContainer(struct upnphttp * h, const char * objectID, int itemStart, int itemCount, char * anchorItem, SendContainer(struct upnphttp *h, const char *objectID, int itemStart, int itemCount, char *anchorItem,
int anchorOffset, int recurse, char * sortOrder, char * filter, unsigned long int randomSeed) int anchorOffset, int recurse, char *sortOrder, char *filter, unsigned long int randomSeed)
{ {
char *resp = malloc(262144); char *resp = malloc(262144);
char *sql, *item, *saveptr; char *sql, *item, *saveptr;
@ -645,14 +646,14 @@ SendContainer(struct upnphttp * h, const char * objectID, int itemStart, int ite
} }
void void
ProcessTiVoCommand(struct upnphttp * h, const char * orig_path) ProcessTiVoCommand(struct upnphttp *h, const char *orig_path)
{ {
char *path; char *path;
char *key, *val; char *key, *val;
char *saveptr = NULL, *item; char *saveptr = NULL, *item;
char *command = NULL, *container = NULL, *anchorItem = NULL; char *command = NULL, *container = NULL, *anchorItem = NULL;
char *sortOrder = NULL, *filter = NULL; char *sortOrder = NULL, *filter = NULL;
sqlite_int64 detailItem=0; int64_t detailItem=0;
int itemStart=0, itemCount=-100, anchorOffset=0, recurse=0; int itemStart=0, itemCount=-100, anchorOffset=0, recurse=0;
unsigned long int randomSeed=0; unsigned long int randomSeed=0;

View File

@ -25,6 +25,6 @@
#ifdef TIVO_SUPPORT #ifdef TIVO_SUPPORT
void void
ProcessTiVoCommand(struct upnphttp * h, const char * orig_path); ProcessTiVoCommand(struct upnphttp *h, const char *orig_path);
#endif #endif

View File

@ -26,12 +26,12 @@
/* This function based on byRequest */ /* This function based on byRequest */
char * char *
decodeString(char * string, int inplace) decodeString(char *string, int inplace)
{ {
if( !string ) if( !string )
return NULL; return NULL;
int alloc = (int)strlen(string)+1; int alloc = (int)strlen(string)+1;
char * ns = NULL; char *ns = NULL;
unsigned char in; unsigned char in;
int strindex=0; int strindex=0;
long hex; long hex;
@ -132,7 +132,7 @@ seedRandomness(int n, void *pbuf, uint32_t seed)
void void
TiVoRandomSeedFunc(sqlite3_context *context, int argc, sqlite3_value **argv) TiVoRandomSeedFunc(sqlite3_context *context, int argc, sqlite3_value **argv)
{ {
sqlite_int64 r, seed; int64_t r, seed;
if( argc != 1 || sqlite3_value_type(argv[0]) != SQLITE_INTEGER ) if( argc != 1 || sqlite3_value_type(argv[0]) != SQLITE_INTEGER )
return; return;

View File

@ -32,7 +32,7 @@ struct sqlite3PrngType {
} sqlite3Prng; } sqlite3Prng;
char * char *
decodeString(char * string, int inplace); decodeString(char *string, int inplace);
void void
TiVoRandomSeedFunc(sqlite3_context *context, int argc, sqlite3_value **argv); TiVoRandomSeedFunc(sqlite3_context *context, int argc, sqlite3_value **argv);

View File

@ -45,6 +45,8 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "config.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
@ -60,7 +62,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include "config.h"
#include "upnpevents.h" #include "upnpevents.h"
#include "minidlnapath.h" #include "minidlnapath.h"
#include "upnpglobalvars.h" #include "upnpglobalvars.h"

View File

@ -1631,13 +1631,13 @@ SendResp_resizedimg(struct upnphttp * h, char * object)
int rotate; int rotate;
/* Not implemented yet * /* Not implemented yet *
char *pixelshape=NULL; */ char *pixelshape=NULL; */
sqlite_int64 id; int64_t id;
int rows=0, chunked, ret; int rows=0, chunked, ret;
image_s *imsrc = NULL, *imdst = NULL; image_s *imsrc = NULL, *imdst = NULL;
int scale = 1; int scale = 1;
id = strtoll(object, &saveptr, 10); id = strtoll(object, &saveptr, 10);
snprintf(buf, sizeof(buf), "SELECT PATH, RESOLUTION, ROTATION from DETAILS where ID = '%lld'", id); 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); ret = sql_get_table(db, buf, &result, &rows, NULL);
if( (ret != SQLITE_OK) ) if( (ret != SQLITE_OK) )
{ {
@ -1849,10 +1849,10 @@ SendResp_dlnafile(struct upnphttp * h, char * object)
char date[30]; char date[30];
time_t curtime = time(NULL); time_t curtime = time(NULL);
off_t total, offset, size; off_t total, offset, size;
sqlite_int64 id; int64_t id;
int sendfh; int sendfh;
uint32_t dlna_flags = DLNA_FLAG_DLNA_V1_5|DLNA_FLAG_HTTP_STALLING|DLNA_FLAG_TM_B; uint32_t dlna_flags = DLNA_FLAG_DLNA_V1_5|DLNA_FLAG_HTTP_STALLING|DLNA_FLAG_TM_B;
static struct { sqlite_int64 id; static struct { int64_t id;
enum client_types client; enum client_types client;
char path[PATH_MAX]; char path[PATH_MAX];
char mime[32]; char mime[32];
@ -1876,7 +1876,7 @@ SendResp_dlnafile(struct upnphttp * h, char * object)
} }
if( id != last_file.id || h->req_client != last_file.client ) if( id != last_file.id || h->req_client != last_file.client )
{ {
snprintf(buf, sizeof(buf), "SELECT PATH, MIME, DLNA_PN from DETAILS where ID = '%lld'", id); snprintf(buf, sizeof(buf), "SELECT PATH, MIME, DLNA_PN from DETAILS where ID = '%lld'", (long long)id);
ret = sql_get_table(db, buf, &result, &rows, NULL); ret = sql_get_table(db, buf, &result, &rows, NULL);
if( (ret != SQLITE_OK) ) if( (ret != SQLITE_OK) )
{ {

View File

@ -46,6 +46,8 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "config.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -59,7 +61,6 @@
#include <netdb.h> #include <netdb.h>
#include <ctype.h> #include <ctype.h>
#include "config.h"
#include "upnpglobalvars.h" #include "upnpglobalvars.h"
#include "utils.h" #include "utils.h"
#include "upnphttp.h" #include "upnphttp.h"

View File

@ -15,6 +15,8 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with MiniDLNA. If not, see <http://www.gnu.org/licenses/>. * along with MiniDLNA. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "config.h"
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>