diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-07-17 17:52:28 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-07-17 17:52:28 +0000 |
commit | c1924483f5976a09b74e1aaeb3e20e0ce7df12d0 (patch) | |
tree | ae78ef6df7d2ac2fe125b13df37868793e9425cf | |
parent | e7a1707b61ad9dcf8b7abf720c17b7f1ddeb00ff (diff) |
Merge issues...
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@277777 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | res/res_config_pgsql.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c index 9f996e0b5..14146e330 100644 --- a/res/res_config_pgsql.c +++ b/res/res_config_pgsql.c @@ -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); } |