<p>Alexander Traud has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7944">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_config_pgsql: Avoid typecasting an int to unsigned char.<br><br>clang 5.0 warned about this.<br><br>ASTERISK-27576<br><br>Change-Id: If41f400a51973c06cdb9b75462e535b616bfe385<br>---<br>M res/res_config_pgsql.c<br>1 file changed, 5 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/44/7944/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c<br>index abd00ca..3b65921 100644<br>--- a/res/res_config_pgsql.c<br>+++ b/res/res_config_pgsql.c<br>@@ -1215,7 +1215,8 @@<br> struct columns *column;<br> struct tables *table;<br> char *elm;<br>- int type, size, res = 0;<br>+ int type, res = 0;<br>+ unsigned int size;<br> <br> /*<br> * Ignore database from the extconfig.conf since it was<br>@@ -1231,7 +1232,7 @@<br> <br> while ((elm = va_arg(ap, char *))) {<br> type = va_arg(ap, require_type);<br>- size = va_arg(ap, int);<br>+ size = va_arg(ap, unsigned int);<br> AST_LIST_TRAVERSE(&table->columns, column, list) {<br> if (strcmp(column->name, elm) == 0) {<br> /* Char can hold anything, as long as it is large enough */<br>@@ -1288,14 +1289,14 @@<br> res = -1;<br> } else {<br> struct ast_str *sql = ast_str_create(100);<br>- char fieldtype[15];<br>+ char fieldtype[10];<br> PGresult *result;<br> <br> if (requirements == RQ_CREATECHAR || type == RQ_CHAR) {<br> /* Size is minimum length; make it at least 50% greater,<br> * just to be sure, because PostgreSQL doesn't support<br> * resizing columns. */<br>- snprintf(fieldtype, sizeof(fieldtype), "CHAR(%hhu)",<br>+ snprintf(fieldtype, sizeof(fieldtype), "CHAR(%d)",<br> size < 15 ? size * 2 :<br> (size * 3 / 2 > 255) ? 255 : size * 3 / 2);<br> } else if (type == RQ_INTEGER1 || type == RQ_UINTEGER1 || type == RQ_INTEGER2) {<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7944">change 7944</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/7944"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: If41f400a51973c06cdb9b75462e535b616bfe385 </div>
<div style="display:none"> Gerrit-Change-Number: 7944 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Alexander Traud <pabstraud@compuserve.com> </div>