[asterisk-commits] tilghman: branch 1.6.2 r277777 - /branches/1.6.2/res/res_config_pgsql.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Jul 17 12:52:31 CDT 2010


Author: tilghman
Date: Sat Jul 17 12:52:28 2010
New Revision: 277777

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=277777
Log:
Merge issues...

Modified:
    branches/1.6.2/res/res_config_pgsql.c

Modified: branches/1.6.2/res/res_config_pgsql.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/res/res_config_pgsql.c?view=diff&rev=277777&r1=277776&r2=277777
==============================================================================
--- branches/1.6.2/res/res_config_pgsql.c (original)
+++ branches/1.6.2/res/res_config_pgsql.c Sat Jul 17 12:52:28 2010
@@ -291,6 +291,18 @@
 	return NULL;
 }
 
+static char *decode_chunk(char *chunk)
+{
+	char *orig = chunk;
+	for (; *chunk; chunk++) {
+		if (*chunk == '^' && strchr("0123456789ABCDEFabcdef", chunk[1]) && strchr("0123456789ABCDEFabcdef", chunk[2])) {
+			sscanf(chunk + 1, "%02hhd", chunk);
+			memmove(chunk + 1, chunk + 3, strlen(chunk + 3) + 1);
+		}
+	}
+	return orig;
+}
+
 static struct ast_variable *realtime_pgsql(const char *database, const char *tablename, va_list ap)
 {
 	PGresult *result = NULL;
@@ -402,7 +414,7 @@
 				stringp = PQgetvalue(result, rowIndex, i);
 				while (stringp) {
 					chunk = strsep(&stringp, ";");
-					if (chunk && !ast_strlen_zero(ast_realtime_decode_chunk(ast_strip(chunk)))) {
+					if (chunk && !ast_strlen_zero(decode_chunk(ast_strip(chunk)))) {
 						if (prev) {
 							prev->next = ast_variable_new(fieldnames[i], chunk, "");
 							if (prev->next) {
@@ -561,7 +573,7 @@
 				stringp = PQgetvalue(result, rowIndex, i);
 				while (stringp) {
 					chunk = strsep(&stringp, ";");
-					if (chunk && !ast_strlen_zero(ast_realtime_decode_chunk(ast_strip(chunk)))) {
+					if (chunk && !ast_strlen_zero(decode_chunk(ast_strip(chunk)))) {
 						if (initfield && !strcmp(initfield, fieldnames[i])) {
 							ast_category_rename(cat, chunk);
 						}




More information about the asterisk-commits mailing list