[Asterisk-code-review] app voicemail: Fix data-type mismatch between app voicemail ... (asterisk[13.20])

Nic Colledge asteriskteam at digium.com
Tue Mar 27 18:53:07 CDT 2018


Nic Colledge has uploaded this change for review. ( https://gerrit.asterisk.org/8680


Change subject: app_voicemail: Fix data-type mismatch between app_voicemail and database
......................................................................

app_voicemail: Fix data-type mismatch between app_voicemail and database

Fix data-type mismatch between app_voicemail and database columns
exposed by new version of MariaDB

See issue ASTERISK-27760

Change-Id: I8543ad480a08c98be78bde1ee870e6e6c84b2c5b
---
M apps/app_voicemail.c
1 file changed, 10 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/80/8680/1

diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 485d03f..019e8e4 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -4273,6 +4273,9 @@
 {
 	struct insert_data *data = vdata;
 	int res;
+	int origtime;
+	int duration;
+	int msgnum;
 	SQLHSTMT stmt;
 
 	res = SQLAllocHandle(SQL_HANDLE_STMT, obj->con, &stmt);
@@ -4281,14 +4284,18 @@
 		return NULL;
 	}
 
+	msgnum = (int)strtol(data->msgnums, NULL, 10);
+	duration = (int)strtol(data->duration, NULL, 10);
+	origtime = (int)strtol(data->origtime, NULL, 10);
+
 	SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->dir), 0, (void *) data->dir, 0, NULL);
-	SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->msgnums), 0, (void *) data->msgnums, 0, NULL);
+	SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &msgnum, 0, NULL);
 	SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_LONGVARBINARY, data->datalen, 0, (void *) data->data, data->datalen, &data->indlen);
 	SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->context), 0, (void *) data->context, 0, NULL);
 	SQLBindParameter(stmt, 5, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->macrocontext), 0, (void *) data->macrocontext, 0, NULL);
 	SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->callerid), 0, (void *) data->callerid, 0, NULL);
-	SQLBindParameter(stmt, 7, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->origtime), 0, (void *) data->origtime, 0, NULL);
-	SQLBindParameter(stmt, 8, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->duration), 0, (void *) data->duration, 0, NULL);
+	SQLBindParameter(stmt, 7, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &origtime, 0, NULL);
+	SQLBindParameter(stmt, 8, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &duration, 0, NULL);
 	SQLBindParameter(stmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->mailboxuser), 0, (void *) data->mailboxuser, 0, NULL);
 	SQLBindParameter(stmt, 10, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->mailboxcontext), 0, (void *) data->mailboxcontext, 0, NULL);
 	SQLBindParameter(stmt, 11, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->flag), 0, (void *) data->flag, 0, NULL);

-- 
To view, visit https://gerrit.asterisk.org/8680
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13.20
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8543ad480a08c98be78bde1ee870e6e6c84b2c5b
Gerrit-Change-Number: 8680
Gerrit-PatchSet: 1
Gerrit-Owner: Nic Colledge <nic at njcolledge.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180327/dabe1759/attachment-0001.html>


More information about the asterisk-code-review mailing list