summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlvw <lvw@e10066b5-e1e2-0310-b819-94efdf66514b>2004-10-06 19:40:18 +0000
committerlvw <lvw@e10066b5-e1e2-0310-b819-94efdf66514b>2004-10-06 19:40:18 +0000
commitbd285704d7cc8eb24725ee1af3a48c2ee18fa27b (patch)
tree8e4aa417023828b8572b4c426f414bbd1a7c0d04
parent53564f64951ace9983bf1afe6c13f7d07a220435 (diff)
downloadvdr-plugin-muggle-bd285704d7cc8eb24725ee1af3a48c2ee18fa27b.tar.gz
vdr-plugin-muggle-bd285704d7cc8eb24725ee1af3a48c2ee18fa27b.tar.bz2
Removed compiler warnings and some errors
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@206 e10066b5-e1e2-0310-b819-94efdf66514b
-rw-r--r--gd_content_interface.h1
-rwxr-xr-xmg_content_interface.c6
-rwxr-xr-xmg_content_interface.h4
-rw-r--r--mg_database.c6
-rw-r--r--mg_playlist.c12
-rw-r--r--mg_playlist.h2
-rwxr-xr-xmugglei.c9
7 files changed, 22 insertions, 18 deletions
diff --git a/gd_content_interface.h b/gd_content_interface.h
index 20906df..921f8d7 100644
--- a/gd_content_interface.h
+++ b/gd_content_interface.h
@@ -29,7 +29,6 @@
#include "mg_content_interface.h"
#include "mg_media.h"
-
#include "mg_playlist.h"
#include "mg_filters.h"
#include "i18n.h"
diff --git a/mg_content_interface.c b/mg_content_interface.c
index af16389..defa0ac 100755
--- a/mg_content_interface.c
+++ b/mg_content_interface.c
@@ -105,11 +105,11 @@ mgContentItem* mgTracklist::getItem(unsigned int position)
return *( m_list.begin() + position);
}
-bool mgTracklist::remove(unsigned int position)
+bool mgTracklist::remove(int position)
{
bool result = false;
- if( position < m_list.size() )
+ if( position < (int)m_list.size() )
{
std::vector<mgContentItem*>::iterator iter;
@@ -122,7 +122,7 @@ bool mgTracklist::remove(unsigned int position)
return result;
}
-int mgTracklist::remove(mgContentItem* item)
+int mgTracklist::removeItem(mgContentItem* item)
{
int retval = 0;
std::vector<mgContentItem*>::iterator iter;
diff --git a/mg_content_interface.h b/mg_content_interface.h
index d8bb0ec..b0a27eb 100755
--- a/mg_content_interface.h
+++ b/mg_content_interface.h
@@ -318,12 +318,12 @@ class mgTracklist
*
* \todo needed? if so, it hides bool remove(int)
*/
- virtual int remove(mgContentItem* item); // remove all occurences of item
+ virtual int removeItem(mgContentItem* item); // remove all occurences of item
/*!
* \brief remove all occurences of item
*/
- virtual bool remove(unsigned int position); // remove item at position
+ virtual bool remove(int position); // remove item at position
};
/*!
diff --git a/mg_database.c b/mg_database.c
index 9dfa395..1636262 100644
--- a/mg_database.c
+++ b/mg_database.c
@@ -8,7 +8,11 @@
*/
#include "mg_database.h"
+#include "mg_tools.h"
+#include <stdarg.h>
+
+static const int MAX_QUERY_BUFLEN = 2048;
mgDB::mgDB()
{
@@ -44,6 +48,7 @@ std::string mgDB::escape_string( MYSQL *db, std::string s )
MYSQL_RES* mgDB::read_query( const char *fmt, ...)
{
+ char querybuf[MAX_QUERY_BUFLEN];
va_list ap;
va_start( ap, fmt );
vsnprintf( querybuf, MAX_QUERY_BUFLEN-1, fmt, ap );
@@ -61,6 +66,7 @@ MYSQL_RES* mgDB::read_query( const char *fmt, ...)
void mgDB::write_query( const char *fmt, ... )
{
+ char querybuf[MAX_QUERY_BUFLEN];
va_list ap;
va_start( ap, fmt );
vsnprintf( querybuf, MAX_QUERY_BUFLEN-1, fmt, ap );
diff --git a/mg_playlist.c b/mg_playlist.c
index a0fbb0f..988f35d 100644
--- a/mg_playlist.c
+++ b/mg_playlist.c
@@ -95,14 +95,14 @@ void mgPlaylist::insert( mgContentItem* item, unsigned int position )
}
}
-bool mgPlaylist::remove( unsigned int pos )
+bool mgPlaylist::remove( int pos )
{
bool result = false;
- if( pos != m_current_idx )
+ if( pos > 0 && pos != m_current_idx )
{
result = mgTracklist::remove( pos );
-
+
if( result && pos < m_current_idx )
{
m_current_idx --;
@@ -176,7 +176,7 @@ mgContentItem* mgPlaylist::getCurrent()
{
mgContentItem *result;
- if( 0 <= m_current_idx && m_current_idx < m_list.size() )
+ if( 0 <= m_current_idx && m_current_idx < (int) m_list.size() )
{
result = *( m_list.begin() + m_current_idx );
}
@@ -207,7 +207,7 @@ bool mgPlaylist::skipFwd()
{
bool result = false;
- if( m_current_idx + 1 < m_list.size() ) // unless loop mode
+ if( m_current_idx + 1 < (int) m_list.size() ) // unless loop mode
{
m_current_idx ++;
result = true;
@@ -235,7 +235,7 @@ bool mgPlaylist::skipBack()
// get next track, do not update data structures
mgContentItem* mgPlaylist::sneakNext()
{
- if( m_current_idx + 1 <= m_list.size() ) // unless loop mode
+ if( m_current_idx + 1 <= (int) m_list.size() ) // unless loop mode
{
return *(m_list.begin() + m_current_idx + 1);
}
diff --git a/mg_playlist.h b/mg_playlist.h
index e7c428d..d35dec0 100644
--- a/mg_playlist.h
+++ b/mg_playlist.h
@@ -107,7 +107,7 @@ public:
*
* \param pos - the index of the track to be removed
*/
- bool remove( unsigned int pos );
+ bool remove( int pos );
/* ==== access tracks ==== */
diff --git a/mugglei.c b/mugglei.c
index efc4c07..286ee89 100755
--- a/mugglei.c
+++ b/mugglei.c
@@ -63,7 +63,7 @@ time_t get_fs_modification_time( std::string filename )
struct stat *buf = (struct stat*) malloc( sizeof( struct stat ) );
// yes: obtain modification date for file and db entry
- int statres = stat( filename.c_str(), buf );
+ // int statres = stat( filename.c_str(), buf );
time_t mod = buf->st_mtime;
free( buf );
@@ -89,7 +89,7 @@ TagLib::String escape_string( MYSQL *db, TagLib::String s )
char *buf = strdup( s.toCString() );
char *escbuf = (char *) malloc( 2*strlen( buf ) + 1 );
- int len = mysql_real_escape_string( db, escbuf, buf, strlen( buf ) );
+ mysql_real_escape_string( db, escbuf, buf, strlen( buf ) );
return TagLib::String( escbuf );
}
@@ -155,7 +155,7 @@ void update_db( long uid, std::string filename )
// create new album entry "Unassigned" for this artist
long id = random();
char *buf;
- asprintf( &buf, "%d-%s", id, tag->artist().toCString() );
+ asprintf( &buf, "%ld-%s", id, tag->artist().toCString() );
cddbid = TagLib::String( buf ).substr( 0, 20 );
cddbid = escape_string( db, cddbid );
free( buf );
@@ -189,7 +189,7 @@ void update_db( long uid, std::string filename )
// create new album entry
long id = random();
char *buf;
- asprintf( &buf, "%d-%s", id, tag->album().toCString() );
+ asprintf( &buf, "%ld-%s", id, tag->album().toCString() );
cddbid = TagLib::String( buf ).substr( 0, 20 );
cddbid = escape_string( db, cddbid );
free( buf );
@@ -291,7 +291,6 @@ void evaluate_file( MYSQL *db, std::string filename )
int main( int argc, char *argv[] )
{
- int option_index;
std::string filename;
if( argc < 2 )