[svn-commits] seanbright: branch group/NoLossCDR-Redux2 r107014 - /team/group/NoLossCDR-Red...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Mar 9 17:41:24 CDT 2008


Author: seanbright
Date: Sun Mar  9 17:41:24 2008
New Revision: 107014

URL: http://svn.digium.com/view/asterisk?view=rev&rev=107014
Log:
Whitespace and coding standards changes only

Modified:
    team/group/NoLossCDR-Redux2/cdr/cdr_tds.c

Modified: team/group/NoLossCDR-Redux2/cdr/cdr_tds.c
URL: http://svn.digium.com/view/asterisk/team/group/NoLossCDR-Redux2/cdr/cdr_tds.c?view=diff&rev=107014&r1=107013&r2=107014
==============================================================================
--- team/group/NoLossCDR-Redux2/cdr/cdr_tds.c (original)
+++ team/group/NoLossCDR-Redux2/cdr/cdr_tds.c Sun Mar  9 17:41:24 2008
@@ -202,10 +202,11 @@
 
 	do {
 		if (!conf->connected) {
-			if (mssql_connect(conf))
+			if (mssql_connect(conf)) {
 				ast_log(LOG_ERROR, "Failed to reconnect to SQL database.\n");
-			else
+			} else {
 				ast_log(LOG_WARNING, "Reconnected to SQL database.\n");
+			}
 
 			retried = 1;	/* note that we have now tried */
 		}
@@ -247,8 +248,7 @@
 	char *known_bad[] = {"select", "insert", "update", "delete", "drop", ";", "--", "\0"};
 	int idx;
 
-	if ((buf = ast_malloc(len + 1)) == NULL)
-	{
+	if ((buf = ast_malloc(len + 1)) == NULL) {
 		ast_log(LOG_ERROR, "Out of memory\n");
 		return NULL;
 	}
@@ -257,19 +257,17 @@
 	buf_ptr = buf;
 
 	/* Escape single quotes */
-	for (; *str && strlen(buf) < len; str++)
-	{
-		if (*str == '\'')
+	for (; *str && strlen(buf) < len; str++) {
+		if (*str == '\'') {
 			*buf_ptr++ = '\'';
+		}
 		*buf_ptr++ = *str;
 	}
 	*buf_ptr = '\0';
 
 	/* Erase known bad input */
-	for (idx=0; *known_bad[idx]; idx++)
-	{
-		while((srh_ptr = strcasestr(buf, known_bad[idx])))
-		{
+	for (idx = 0; *known_bad[idx]; idx++) {
+		while ((srh_ptr = strcasestr(buf, known_bad[idx]))) {
 			memmove(srh_ptr, srh_ptr+strlen(known_bad[idx]), strlen(srh_ptr+strlen(known_bad[idx]))+1);
 		}
 	}
@@ -283,14 +281,11 @@
 	char buf[80];
 
 	/* To make sure we have date variable if not insert null to SQL */
-	if (!ast_tvzero(tv))
-	{
+	if (!ast_tvzero(tv)) {
 		ast_localtime(&tv, &tm, NULL);
 		ast_strftime(buf, 80, DATE_FORMAT, &tm);
 		sprintf(dateField, "'%s'", buf);
-	}
-	else
-	{
+	} else {
 		strcpy(dateField, "null");
 	}
 }
@@ -327,8 +322,7 @@
 	char query[128];
 
 	/* Connect to M$SQL Server */
-	if (!(conf->login = tds_alloc_login()))
-	{
+	if (!(conf->login = tds_alloc_login())) {
 		ast_log(LOG_ERROR, "tds_alloc_login() failed.\n");
 		return -1;
 	}




More information about the svn-commits mailing list