[asterisk-commits] branch oej/sipdiversion r18622 - in /team/oej/sipdiversion: ./ apps/ res/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Apr 9 12:02:40 MST 2006


Author: oej
Date: Sun Apr  9 14:02:36 2006
New Revision: 18622

URL: http://svn.digium.com/view/asterisk?rev=18622&view=rev
Log:
Reset ... I think

Modified:
    team/oej/sipdiversion/   (props changed)
    team/oej/sipdiversion/apps/app_voicemail.c
    team/oej/sipdiversion/res/res_config_pgsql.c

Propchange: team/oej/sipdiversion/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sun Apr  9 14:02:36 2006
@@ -1,1 +1,1 @@
-/trunk:1-18593
+/trunk:1-18611

Modified: team/oej/sipdiversion/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/apps/app_voicemail.c?rev=18622&r1=18621&r2=18622&view=diff
==============================================================================
--- team/oej/sipdiversion/apps/app_voicemail.c (original)
+++ team/oej/sipdiversion/apps/app_voicemail.c Sun Apr  9 14:02:36 2006
@@ -1697,9 +1697,8 @@
 	ast_log(LOG_DEBUG, "Attaching file '%s', format '%s', uservm is '%d', global is %d\n", attach, format, attach_user_voicemail, ast_test_flag((&globalflags), VM_ATTACH));
 	/* Make a temporary file instead of piping directly to sendmail, in case the mail
 	   command hangs */
-	p = vm_mkftemp(tmp);
-	if (p == NULL) {
-		ast_log(LOG_WARNING, "Unable to launch '%s'\n", mailcmd);
+	if ((p = vm_mkftemp(tmp)) == NULL) {
+		ast_log(LOG_WARNING, "Unable to launch '%s' (can't create temporary file)\n", mailcmd);
 		return -1;
 	} else {
 		gethostname(host, sizeof(host)-1);
@@ -1817,10 +1816,10 @@
 	char tmp[80] = "/tmp/astmail-XXXXXX";
 	char tmp2[256];
 	struct tm tm;
-	FILE *p = vm_mkftemp(tmp);
-
-	if (p == NULL) {
-		ast_log(LOG_WARNING, "Unable to launch '%s'\n", mailcmd);
+	FILE *p;
+
+	if ((p = vm_mkftemp(tmp)) == NULL) {
+		ast_log(LOG_WARNING, "Unable to launch '%s' (can't create temporary file)\n", mailcmd);
 		return -1;
 	} else {
 		gethostname(host, sizeof(host)-1);

Modified: team/oej/sipdiversion/res/res_config_pgsql.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/res/res_config_pgsql.c?rev=18622&r1=18621&r2=18622&view=diff
==============================================================================
--- team/oej/sipdiversion/res/res_config_pgsql.c (original)
+++ team/oej/sipdiversion/res/res_config_pgsql.c Sun Apr  9 14:02:36 2006
@@ -46,11 +46,12 @@
 AST_MUTEX_DEFINE_STATIC(pgsql_lock);
 #define RES_CONFIG_PGSQL_CONF "res_pgsql.conf"
 PGconn*         pgsqlConn = NULL;
-static char   dbhost[50]="";
-static char   dbuser[50]="";
-static char   dbpass[50]="";
-static char   dbname[50]="";
-static char   dbsock[50]="";
+#define MAX_DB_OPTION_SIZE 64
+static char   dbhost[MAX_DB_OPTION_SIZE]="";
+static char   dbuser[MAX_DB_OPTION_SIZE]="";
+static char   dbpass[MAX_DB_OPTION_SIZE]="";
+static char   dbname[MAX_DB_OPTION_SIZE]="";
+static char   dbsock[MAX_DB_OPTION_SIZE]="";
 static int    dbport=5432;
 static time_t connect_time=0;
 
@@ -99,8 +100,7 @@
 
 	/* Create the first part of the query using the first parameter/value pairs we just extracted
 	   If there is only 1 set, then we have our query. Otherwise, loop thru the list and concat */
-
-	if(!strchr(newparam, ' ')) op = " ="; else op = "";
+	op = strchr(newparam, ' ')?"":" =";
 
 	snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE %s%s '%s'", table, newparam, op, newval);
 	while((newparam = va_arg(ap, const char *))) {
@@ -159,8 +159,7 @@
 	  }
 	  for(i = 0; i < numFields; i++)
 	    fieldnames[i]=PQfname(result,i);
-	  for(rowIndex=0;rowIndex<num_rows;rowIndex++)
-	    {
+	  for(rowIndex = 0; rowIndex < num_rows; rowIndex++)
 	      for(i = 0; i < numFields; i++) {
 		stringp = PQgetvalue(result,rowIndex,i);
 		while(stringp) {
@@ -177,7 +176,6 @@
 		  }
 		}
 	      }
-	    }
 	  free(fieldnames);
 	} else {                                
 		ast_log(LOG_WARNING, "Postgresql RealTime: Could not find any rows in table %s.\n", table);
@@ -698,10 +696,7 @@
 {
 	char my_database[50];
 
-	if(!database || ast_strlen_zero(database))
-		ast_copy_string(my_database, dbname, sizeof(my_database));
-	else
-		ast_copy_string(my_database, database, sizeof(my_database));
+	ast_copy_string(my_database, S_OR(database,dbname), sizeof(my_database));
 
 	/* mutex lock should have been locked before calling this function. */
 



More information about the asterisk-commits mailing list