Merge pull request #1446 from ZoneMinder/stdstring_instead_of_c_string

use std::string instead of C strings. Mostly this will quiet build wa…
This commit is contained in:
Steve Gilvarry 2016-04-28 22:13:44 +10:00
commit af361042ef
1 changed files with 4 additions and 5 deletions

View File

@ -757,15 +757,14 @@ int main( int argc, char *argv[] )
if ( function & ZMU_LIST )
{
char sql[ZM_SQL_SML_BUFSIZ];
strncpy( sql, "select Id, Function+0 from Monitors", sizeof(sql) );
std::string sql = "select Id, Function+0 from Monitors";
if ( !verbose )
{
strncat( sql, " where Function != 'None'", sizeof(sql)-strlen(sql) );
sql += "where Function != 'None'";
}
strncat( sql, " order by Id asc", sizeof(sql)-strlen(sql) );
sql += " order by Id asc";
if ( mysql_query( &dbconn, sql ) )
if ( mysql_query( &dbconn, sql.c_str() ) )
{
Error( "Can't run query: %s", mysql_error( &dbconn ) );
exit( mysql_errno( &dbconn ) );