mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
Merged revisions 11503 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r11503 | tilghman | 2006-03-01 11:41:52 -0600 (Wed, 01 Mar 2006) | 2 lines Bug 6615 - Fix 64bit conversion errors by using a long int ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@11504 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
8
cdr.c
8
cdr.c
@@ -263,18 +263,18 @@ void ast_cdr_getvar(struct ast_cdr *cdr, const char *name, char **ret, char *wor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(name, "duration"))
|
} else if (!strcasecmp(name, "duration"))
|
||||||
snprintf(workspace, workspacelen, "%d", cdr->duration);
|
snprintf(workspace, workspacelen, "%ld", cdr->duration);
|
||||||
else if (!strcasecmp(name, "billsec"))
|
else if (!strcasecmp(name, "billsec"))
|
||||||
snprintf(workspace, workspacelen, "%d", cdr->billsec);
|
snprintf(workspace, workspacelen, "%ld", cdr->billsec);
|
||||||
else if (!strcasecmp(name, "disposition")) {
|
else if (!strcasecmp(name, "disposition")) {
|
||||||
if (raw) {
|
if (raw) {
|
||||||
snprintf(workspace, workspacelen, "%d", cdr->disposition);
|
snprintf(workspace, workspacelen, "%ld", cdr->disposition);
|
||||||
} else {
|
} else {
|
||||||
ast_copy_string(workspace, ast_cdr_disp2str(cdr->disposition), workspacelen);
|
ast_copy_string(workspace, ast_cdr_disp2str(cdr->disposition), workspacelen);
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(name, "amaflags")) {
|
} else if (!strcasecmp(name, "amaflags")) {
|
||||||
if (raw) {
|
if (raw) {
|
||||||
snprintf(workspace, workspacelen, "%d", cdr->amaflags);
|
snprintf(workspace, workspacelen, "%ld", cdr->amaflags);
|
||||||
} else {
|
} else {
|
||||||
ast_copy_string(workspace, ast_cdr_flags2str(cdr->amaflags), workspacelen);
|
ast_copy_string(workspace, ast_cdr_flags2str(cdr->amaflags), workspacelen);
|
||||||
}
|
}
|
||||||
|
@@ -121,8 +121,8 @@ static int manager_log(struct ast_cdr *cdr)
|
|||||||
"StartTime: %s\r\n"
|
"StartTime: %s\r\n"
|
||||||
"AnswerTime: %s\r\n"
|
"AnswerTime: %s\r\n"
|
||||||
"EndTime: %s\r\n"
|
"EndTime: %s\r\n"
|
||||||
"Duration: %d\r\n"
|
"Duration: %ld\r\n"
|
||||||
"BillableSeconds: %d\r\n"
|
"BillableSeconds: %ld\r\n"
|
||||||
"Disposition: %s\r\n"
|
"Disposition: %s\r\n"
|
||||||
"AMAFlags: %s\r\n"
|
"AMAFlags: %s\r\n"
|
||||||
"UniqueID: %s\r\n"
|
"UniqueID: %s\r\n"
|
||||||
|
@@ -122,7 +122,7 @@ static int odbc_log(struct ast_cdr *cdr)
|
|||||||
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) {
|
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) {
|
||||||
if (option_verbose > 10)
|
if (option_verbose > 10)
|
||||||
ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: Failure in AllocStatement %d\n", ODBC_res);
|
ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: Failure in AllocStatement %d\n", ODBC_res);
|
||||||
SQLGetDiagRec(SQL_HANDLE_DBC, ODBC_con, 1, ODBC_stat, &ODBC_err, ODBC_msg, 100, &ODBC_mlen);
|
SQLGetDiagRec(SQL_HANDLE_DBC, ODBC_con, 1, (unsigned char *)ODBC_stat, &ODBC_err, (unsigned char *)ODBC_msg, 100, &ODBC_mlen);
|
||||||
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
|
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
|
||||||
connected = 0;
|
connected = 0;
|
||||||
ast_mutex_unlock(&odbc_lock);
|
ast_mutex_unlock(&odbc_lock);
|
||||||
@@ -133,12 +133,12 @@ static int odbc_log(struct ast_cdr *cdr)
|
|||||||
strange reason if I don't it blows holes in memory like
|
strange reason if I don't it blows holes in memory like
|
||||||
like a shotgun. So we just do this so its safe. */
|
like a shotgun. So we just do this so its safe. */
|
||||||
|
|
||||||
ODBC_res = SQLPrepare(ODBC_stmt, sqlcmd, SQL_NTS);
|
ODBC_res = SQLPrepare(ODBC_stmt, (unsigned char *)sqlcmd, SQL_NTS);
|
||||||
|
|
||||||
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) {
|
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) {
|
||||||
if (option_verbose > 10)
|
if (option_verbose > 10)
|
||||||
ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: Error in PREPARE %d\n", ODBC_res);
|
ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: Error in PREPARE %d\n", ODBC_res);
|
||||||
SQLGetDiagRec(SQL_HANDLE_DBC, ODBC_con, 1, ODBC_stat, &ODBC_err, ODBC_msg, 100, &ODBC_mlen);
|
SQLGetDiagRec(SQL_HANDLE_DBC, ODBC_con, 1, (unsigned char *)ODBC_stat, &ODBC_err, (unsigned char *)ODBC_msg, 100, &ODBC_mlen);
|
||||||
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
|
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
|
||||||
connected = 0;
|
connected = 0;
|
||||||
ast_mutex_unlock(&odbc_lock);
|
ast_mutex_unlock(&odbc_lock);
|
||||||
@@ -381,7 +381,7 @@ static int odbc_do_query(void)
|
|||||||
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) {
|
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) {
|
||||||
if (option_verbose > 10)
|
if (option_verbose > 10)
|
||||||
ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: Error in Query %d\n", ODBC_res);
|
ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: Error in Query %d\n", ODBC_res);
|
||||||
SQLGetDiagRec(SQL_HANDLE_DBC, ODBC_con, 1, ODBC_stat, &ODBC_err, ODBC_msg, 100, &ODBC_mlen);
|
SQLGetDiagRec(SQL_HANDLE_DBC, ODBC_con, 1, (unsigned char *)ODBC_stat, &ODBC_err, (unsigned char *)ODBC_msg, 100, &ODBC_mlen);
|
||||||
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
|
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
|
||||||
connected = 0;
|
connected = 0;
|
||||||
return -1;
|
return -1;
|
||||||
@@ -438,7 +438,7 @@ static int odbc_init(void)
|
|||||||
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) {
|
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) {
|
||||||
if (option_verbose > 10)
|
if (option_verbose > 10)
|
||||||
ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: Error SQLConnect %d\n", ODBC_res);
|
ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: Error SQLConnect %d\n", ODBC_res);
|
||||||
SQLGetDiagRec(SQL_HANDLE_DBC, ODBC_con, 1, ODBC_stat, &ODBC_err, ODBC_msg, 100, &ODBC_mlen);
|
SQLGetDiagRec(SQL_HANDLE_DBC, ODBC_con, 1, (unsigned char *)ODBC_stat, &ODBC_err, (unsigned char *)ODBC_msg, 100, &ODBC_mlen);
|
||||||
SQLFreeHandle(SQL_HANDLE_ENV, ODBC_env);
|
SQLFreeHandle(SQL_HANDLE_ENV, ODBC_env);
|
||||||
connected = 0;
|
connected = 0;
|
||||||
return -1;
|
return -1;
|
||||||
|
@@ -123,7 +123,7 @@ static int pgsql_log(struct ast_cdr *cdr)
|
|||||||
|
|
||||||
snprintf(sqlcmd,sizeof(sqlcmd),"INSERT INTO %s (calldate,clid,src,dst,dcontext,channel,dstchannel,"
|
snprintf(sqlcmd,sizeof(sqlcmd),"INSERT INTO %s (calldate,clid,src,dst,dcontext,channel,dstchannel,"
|
||||||
"lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield) VALUES"
|
"lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield) VALUES"
|
||||||
" ('%s','%s','%s','%s','%s', '%s','%s','%s','%s',%d,%d,'%s',%d,'%s','%s','%s')",
|
" ('%s','%s','%s','%s','%s', '%s','%s','%s','%s',%ld,%ld,'%s',%ld,'%s','%s','%s')",
|
||||||
table,timestr,clid,cdr->src, cdr->dst, dcontext,channel, dstchannel, lastapp, lastdata,
|
table,timestr,clid,cdr->src, cdr->dst, dcontext,channel, dstchannel, lastapp, lastdata,
|
||||||
cdr->duration,cdr->billsec,ast_cdr_disp2str(cdr->disposition),cdr->amaflags, cdr->accountcode, uniqueid, userfield);
|
cdr->duration,cdr->billsec,ast_cdr_disp2str(cdr->disposition),cdr->amaflags, cdr->accountcode, uniqueid, userfield);
|
||||||
|
|
||||||
|
@@ -169,8 +169,8 @@ static int tds_log(struct ast_cdr *cdr)
|
|||||||
"%s, " /* start */
|
"%s, " /* start */
|
||||||
"%s, " /* answer */
|
"%s, " /* answer */
|
||||||
"%s, " /* end */
|
"%s, " /* end */
|
||||||
"%d, " /* duration */
|
"%ld, " /* duration */
|
||||||
"%d, " /* billsec */
|
"%ld, " /* billsec */
|
||||||
"'%s', " /* disposition */
|
"'%s', " /* disposition */
|
||||||
"'%s', " /* amaflags */
|
"'%s', " /* amaflags */
|
||||||
"'%s'" /* uniqueid */
|
"'%s'" /* uniqueid */
|
||||||
|
@@ -74,13 +74,13 @@ struct ast_cdr {
|
|||||||
|
|
||||||
struct timeval end;
|
struct timeval end;
|
||||||
/*! Total time in system, in seconds */
|
/*! Total time in system, in seconds */
|
||||||
int duration;
|
long int duration;
|
||||||
/*! Total time call is up, in seconds */
|
/*! Total time call is up, in seconds */
|
||||||
int billsec;
|
long int billsec;
|
||||||
/*! What happened to the call */
|
/*! What happened to the call */
|
||||||
int disposition;
|
long int disposition;
|
||||||
/*! What flags to use */
|
/*! What flags to use */
|
||||||
int amaflags;
|
long int amaflags;
|
||||||
/*! What account number to use */
|
/*! What account number to use */
|
||||||
char accountcode[AST_MAX_ACCOUNT_CODE];
|
char accountcode[AST_MAX_ACCOUNT_CODE];
|
||||||
/*! flags */
|
/*! flags */
|
||||||
|
@@ -105,7 +105,7 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl
|
|||||||
newval = va_arg(aq, const char *);
|
newval = va_arg(aq, const char *);
|
||||||
}
|
}
|
||||||
va_end(aq);
|
va_end(aq);
|
||||||
res = SQLPrepare(stmt, sql, SQL_NTS);
|
res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS);
|
||||||
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||||
ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
|
ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
|
||||||
SQLFreeHandle (SQL_HANDLE_STMT, stmt);
|
SQLFreeHandle (SQL_HANDLE_STMT, stmt);
|
||||||
@@ -148,7 +148,7 @@ static struct ast_variable *realtime_odbc(const char *database, const char *tabl
|
|||||||
for (x=0;x<colcount;x++) {
|
for (x=0;x<colcount;x++) {
|
||||||
rowdata[0] = '\0';
|
rowdata[0] = '\0';
|
||||||
collen = sizeof(coltitle);
|
collen = sizeof(coltitle);
|
||||||
res = SQLDescribeCol(stmt, x + 1, coltitle, sizeof(coltitle), &collen,
|
res = SQLDescribeCol(stmt, x + 1, (unsigned char *)coltitle, sizeof(coltitle), &collen,
|
||||||
&datatype, &colsize, &decimaldigits, &nullable);
|
&datatype, &colsize, &decimaldigits, &nullable);
|
||||||
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||||
ast_log(LOG_WARNING, "SQL Describe Column error!\n[%s]\n\n", sql);
|
ast_log(LOG_WARNING, "SQL Describe Column error!\n[%s]\n\n", sql);
|
||||||
@@ -251,7 +251,7 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char *
|
|||||||
if (initfield)
|
if (initfield)
|
||||||
snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " ORDER BY %s", initfield);
|
snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " ORDER BY %s", initfield);
|
||||||
va_end(aq);
|
va_end(aq);
|
||||||
res = SQLPrepare(stmt, sql, SQL_NTS);
|
res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS);
|
||||||
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||||
ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
|
ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
|
||||||
SQLFreeHandle (SQL_HANDLE_STMT, stmt);
|
SQLFreeHandle (SQL_HANDLE_STMT, stmt);
|
||||||
@@ -302,7 +302,7 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char *
|
|||||||
for (x=0;x<colcount;x++) {
|
for (x=0;x<colcount;x++) {
|
||||||
rowdata[0] = '\0';
|
rowdata[0] = '\0';
|
||||||
collen = sizeof(coltitle);
|
collen = sizeof(coltitle);
|
||||||
res = SQLDescribeCol(stmt, x + 1, coltitle, sizeof(coltitle), &collen,
|
res = SQLDescribeCol(stmt, x + 1, (unsigned char *)coltitle, sizeof(coltitle), &collen,
|
||||||
&datatype, &colsize, &decimaldigits, &nullable);
|
&datatype, &colsize, &decimaldigits, &nullable);
|
||||||
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||||
ast_log(LOG_WARNING, "SQL Describe Column error!\n[%s]\n\n", sql);
|
ast_log(LOG_WARNING, "SQL Describe Column error!\n[%s]\n\n", sql);
|
||||||
@@ -378,7 +378,7 @@ static int update_odbc(const char *database, const char *table, const char *keyf
|
|||||||
va_end(aq);
|
va_end(aq);
|
||||||
snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " WHERE %s=?", keyfield);
|
snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), " WHERE %s=?", keyfield);
|
||||||
|
|
||||||
res = SQLPrepare(stmt, sql, SQL_NTS);
|
res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS);
|
||||||
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
|
||||||
ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
|
ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
|
||||||
SQLFreeHandle (SQL_HANDLE_STMT, stmt);
|
SQLFreeHandle (SQL_HANDLE_STMT, stmt);
|
||||||
|
Reference in New Issue
Block a user