--- a/albumart.c
+++ b/albumart.c
@@ -15,6 +15,8 @@
  * You should have received a copy of the GNU General Public License
  * along with MiniDLNA. If not, see <http://www.gnu.org/licenses/>.
  */
+#include "config.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -104,7 +106,8 @@
 	DIR *dh;
 	struct dirent *dp;
 	enum file_types type = TYPE_UNKNOWN;
-	sqlite_int64 art_id = 0;
+	int64_t art_id = 0;
+	int ret;
 
 	strncpyt(fpath, path, sizeof(fpath));
 	match = basename(fpath);
@@ -150,7 +153,8 @@
 			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);
 			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);
 		}
 	}
@@ -334,14 +338,14 @@
 	return NULL;
 }
 
-sqlite_int64
+int64_t
 find_album_art(const char *path, const char *image_data, int image_size)
 {
 	char *album_art = NULL;
 	char *sql;
 	char **result;
 	int cols, rows;
-	sqlite_int64 ret = 0;
+	int64_t ret = 0;
 
 	if( (image_size && (album_art = check_embedded_art(path, image_data, image_size))) ||
 	    (album_art = check_for_album_file(path)) )