]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merge issues...
authorTilghman Lesher <tilghman@meg.abyt.es>
Sat, 17 Jul 2010 17:52:28 +0000 (17:52 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Sat, 17 Jul 2010 17:52:28 +0000 (17:52 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@277777 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_config_pgsql.c

index 9f996e0b5f6c51fd6fae83df074d50cf56f1ed5f..14146e33046b8d5d692793c878563a18aaed467c 100644 (file)
@@ -291,6 +291,18 @@ static struct columns *find_column(struct tables *t, const char *colname)
        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 @@ static struct ast_variable *realtime_pgsql(const char *database, const char *tab
                                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 @@ static struct ast_config *realtime_multi_pgsql(const char *database, const char
                                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);
                                                }