Skip to content

Commit

Permalink
Address most implicit conversion warnings.
Browse files Browse the repository at this point in the history
- Harmonize variable, parameter, etc. data types more fully.
- Adjust system API usage accordingly:
-- For some string constants, use sizeof() - 1 in lieu of strlen,
   taking care to ensure they come from array variables.
-- Keep format specifiers for printf et al. in sync with argument types.
-- dbprrow: Account for the fact that printf always uses int for
   dynamic widths by substituting memchr + fwrite.
-- odbc/prepare_query.c (prepared_rpc): Substitute atoi for strtol
   (already used with no endptr) when populating TDSINT4.
- Cast away some remaining discrepancies where safe, in some cases by
  taking advantage of TDS_PUT_* macros.
- ctlib.h: Explicitly define _CS_CURS_TYPE_* in terms of
  TDS_CURSOR_STATE_* rather than duplicating their values.
- tds_parse_conf_section: To legitimize a cast, tighten debug_flags'
  range check on systems where int is narrower than long.
- odbc_util.c: #include <stddef.h> for ptrdiff_t (now used in
  odbc_set_string_flag).
  • Loading branch information
ucko committed May 22, 2024
1 parent 13da54e commit 1512645
Show file tree
Hide file tree
Showing 86 changed files with 510 additions and 378 deletions.
6 changes: 3 additions & 3 deletions include/ctlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,9 @@ struct _cs_locale

/* internal defines for cursor processing */

#define _CS_CURS_TYPE_UNACTIONED 0
#define _CS_CURS_TYPE_REQUESTED 1
#define _CS_CURS_TYPE_SENT 2
#define _CS_CURS_TYPE_UNACTIONED TDS_CURSOR_STATE_UNACTIONED
#define _CS_CURS_TYPE_REQUESTED TDS_CURSOR_STATE_REQUESTED
#define _CS_CURS_TYPE_SENT TDS_CURSOR_STATE_SENT

typedef struct {
CS_CHAR name[132];
Expand Down
2 changes: 1 addition & 1 deletion include/dblib.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ typedef struct dboption
typedef struct
{
const BYTE *bindval;
size_t len;
unsigned int len;
} NULLREP;

struct tds_dblib_dbprocess
Expand Down
3 changes: 2 additions & 1 deletion include/freetds/convert.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ CONV_RESULT;
unsigned char tds_willconvert(int srctype, int desttype);

TDS_SERVER_TYPE tds_get_null_type(TDS_SERVER_TYPE srctype);
TDS_INT tds_char2hex(TDS_CHAR *dest, TDS_UINT destlen, const TDS_CHAR * src, TDS_UINT srclen);
ssize_t tds_char2hex(TDS_CHAR *dest, size_t destlen,
const TDS_CHAR * src, size_t srclen);
TDS_INT tds_convert(const TDSCONTEXT *context, int srctype, const void *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr);

size_t tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC * timeptr, int prec);
Expand Down
26 changes: 18 additions & 8 deletions include/freetds/odbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ struct _dheader
{
SQLSMALLINT sql_desc_alloc_type;
/* TODO SQLLEN ?? see http://support.microsoft.com/default.aspx?scid=kb;en-us;298678 */
SQLSMALLINT sql_desc_count;
SQLUSMALLINT sql_desc_count;
SQLINTEGER sql_desc_bind_type;
SQLULEN sql_desc_array_size;
SQLUSMALLINT *sql_desc_array_status_ptr;
Expand Down Expand Up @@ -632,7 +632,8 @@ typedef union {
# define _WIDE
# define ODBC_CHAR SQLCHAR
#endif
int odbc_set_stmt_query(struct _hstmt *stmt, const ODBC_CHAR *sql, int sql_len _WIDE);
int odbc_set_stmt_query(struct _hstmt *stmt, const ODBC_CHAR *sql,
ssize_t sql_len _WIDE);
void odbc_set_return_status(struct _hstmt *stmt, unsigned int n_row);
void odbc_set_return_params(struct _hstmt *stmt, unsigned int n_row);

Expand All @@ -642,23 +643,29 @@ int odbc_sql_to_c_type_default(int sql_type);
TDS_SERVER_TYPE odbc_sql_to_server_type(TDSCONNECTION * conn, int sql_type, int sql_unsigned);
TDS_SERVER_TYPE odbc_c_to_server_type(int c_type);

unsigned int odbc_get_string_size(int size, const ODBC_CHAR * str _WIDE);
size_t odbc_get_string_size(ssize_t size, const ODBC_CHAR * str _WIDE);
void odbc_rdbms_version(TDSSOCKET * tds_socket, char *pversion_string);
SQLINTEGER odbc_get_param_len(const struct _drecord *drec_axd, const struct _drecord *drec_ixd, const TDS_DESC* axd, unsigned int n_row);
SQLLEN odbc_get_param_len(const struct _drecord *drec_axd,
const struct _drecord *drec_ixd,
const TDS_DESC* axd, SQLSETPOSIROW n_row);

#ifdef ENABLE_ODBC_WIDE
DSTR* odbc_dstr_copy_flag(TDS_DBC *dbc, DSTR *s, int size, const ODBC_CHAR * str, int flag);
DSTR* odbc_dstr_copy_flag(TDS_DBC *dbc, DSTR *s, ssize_t size,
const ODBC_CHAR * str, int flag);
#define odbc_dstr_copy(dbc, s, len, out) \
odbc_dstr_copy_flag(dbc, s, len, sizeof((out)->mb) ? (out) : (out), wide)
#define odbc_dstr_copy_oct(dbc, s, len, out) \
odbc_dstr_copy_flag(dbc, s, len, out, wide|0x20)
#else
DSTR* odbc_dstr_copy(TDS_DBC *dbc, DSTR *s, int size, const ODBC_CHAR * str);
DSTR* odbc_dstr_copy(TDS_DBC *dbc, DSTR *s, ssize_t size,
const ODBC_CHAR * str);
#define odbc_dstr_copy_oct odbc_dstr_copy
#endif


SQLRETURN odbc_set_string_flag(TDS_DBC *dbc, SQLPOINTER buffer, SQLINTEGER cbBuffer, void FAR * pcbBuffer, const char *s, int len, int flag);
SQLRETURN odbc_set_string_flag(TDS_DBC *dbc, SQLPOINTER buffer,
SQLINTEGER cbBuffer, void FAR * pcbBuffer,
const char *s, ssize_t len, int flag);
#ifdef ENABLE_ODBC_WIDE
#define odbc_set_string(dbc, buf, buf_len, out_len, s, s_len) \
odbc_set_string_flag(dbc, sizeof((buf)->mb) ? (buf) : (buf), buf_len, out_len, s, s_len, (wide) | (sizeof(*(out_len)) == sizeof(SQLSMALLINT)?0:0x10))
Expand Down Expand Up @@ -696,7 +703,10 @@ const char *odbc_skip_rpc_name(const char *s);
/*
* sql2tds.c
*/
SQLRETURN odbc_sql2tds(TDS_STMT * stmt, const struct _drecord *drec_ixd, const struct _drecord *drec_axd, TDSCOLUMN *curcol, bool compute_row, const TDS_DESC* axd, unsigned int n_row);
SQLRETURN odbc_sql2tds(TDS_STMT * stmt, const struct _drecord *drec_ixd,
const struct _drecord *drec_axd, TDSCOLUMN *curcol,
bool compute_row, const TDS_DESC* axd,
SQLSETPOSIROW n_row);
TDS_INT convert_datetime2server(int bindtype, const void *src, TDS_DATETIMEALL * dta);

/*
Expand Down
30 changes: 19 additions & 11 deletions include/freetds/tds.h
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,7 @@ tds_release_cur_dyn(TDSSOCKET * tds)
}
void tds_dynamic_deallocated(TDSCONNECTION *conn, TDSDYNAMIC *dyn);
void tds_set_cur_dyn(TDSSOCKET *tds, TDSDYNAMIC *dyn);
TDSSOCKET *tds_realloc_socket(TDSSOCKET * tds, size_t bufsize);
TDSSOCKET *tds_realloc_socket(TDSSOCKET * tds, unsigned int bufsize);
char *tds_alloc_client_sqlstate(int msgno);
char *tds_alloc_lookup_sqlstate(TDSSOCKET * tds, int msgno);
TDSLOGIN *tds_alloc_login(int use_environment);
Expand All @@ -1396,7 +1396,8 @@ TDSLOGIN *tds_init_login(TDSLOGIN * login, TDSLOCALE * locale);
TDSLOCALE *tds_alloc_locale(void);
void *tds_alloc_param_data(TDSCOLUMN * curparam);
void tds_free_locale(TDSLOCALE * locale);
TDSCURSOR * tds_alloc_cursor(TDSSOCKET * tds, const char *name, TDS_INT namelen, const char *query, TDS_INT querylen);
TDSCURSOR * tds_alloc_cursor(TDSSOCKET * tds, const char *name, size_t namelen,
const char *query, size_t querylen);
void tds_free_row(TDSRESULTINFO * res_info, unsigned char *row);
TDSSOCKET *tds_alloc_socket(TDSCONTEXT * context, unsigned int bufsize);
TDSSOCKET *tds_alloc_additional_socket(TDSCONNECTION *conn);
Expand Down Expand Up @@ -1453,13 +1454,17 @@ TDSRET tds_submit_begin_tran(TDSSOCKET *tds);
TDSRET tds_submit_rollback(TDSSOCKET *tds, bool cont);
TDSRET tds_submit_commit(TDSSOCKET *tds, bool cont);
TDSRET tds_disconnect(TDSSOCKET * tds);
size_t tds_quote_id(TDSSOCKET * tds, char *buffer, const char *id, int idlen);
size_t tds_quote_id_rpc(TDSSOCKET * tds, char *buffer, const char *id, int idlen);
size_t tds_quote_string(TDSSOCKET * tds, char *buffer, const char *str, int len);
size_t tds_quote_id(TDSSOCKET * tds, char *buffer, const char *id,
ssize_t idlen);
size_t tds_quote_id_rpc(TDSSOCKET * tds, char *buffer, const char *id,
ssize_t idlen);
size_t tds_quote_string(TDSSOCKET * tds, char *buffer, const char *str,
ssize_t len);
const char *tds_skip_comment(const char *s);
const char *tds_skip_quoted(const char *s);
size_t tds_fix_column_size(TDSSOCKET * tds, TDSCOLUMN * curcol);
const char *tds_convert_string(TDSSOCKET * tds, TDSICONV * char_conv, const char *s, int len, size_t *out_len);
const char *tds_convert_string(TDSSOCKET * tds, TDSICONV * char_conv,
const char *s, ssize_t len, size_t *out_len);
void tds_convert_string_free(const char *original, const char *converted);
#if !ENABLE_EXTRA_CHECKS
#define tds_convert_string_free(original, converted) \
Expand Down Expand Up @@ -1588,14 +1593,17 @@ int tds7_get_instance_ports(FILE *output, struct addrinfo *addr);
int tds7_get_instance_port(struct addrinfo *addr, const char *instance);
char *tds_prwsaerror(int erc);
void tds_prwsaerror_free(char *s);
int tds_connection_read(TDSSOCKET * tds, unsigned char *buf, int buflen);
int tds_connection_write(TDSSOCKET *tds, const unsigned char *buf, int buflen, int final);
ssize_t tds_connection_read(TDSSOCKET * tds, unsigned char *buf,
size_t buflen);
ssize_t tds_connection_write(TDSSOCKET *tds, const unsigned char *buf,
size_t buflen, int final);
#define TDSSELREAD POLLIN
#define TDSSELWRITE POLLOUT
int tds_select(TDSSOCKET * tds, unsigned tds_sel, int timeout_seconds);
void tds_connection_close(TDSCONNECTION *conn);
int tds_goodread(TDSSOCKET * tds, unsigned char *buf, int buflen);
int tds_goodwrite(TDSSOCKET * tds, const unsigned char *buffer, size_t buflen);
ssize_t tds_goodread(TDSSOCKET * tds, unsigned char *buf, size_t buflen);
ssize_t tds_goodwrite(TDSSOCKET * tds, const unsigned char *buffer,
size_t buflen);
void tds_socket_flush(TDS_SYS_SOCKET sock);
int tds_socket_set_nonblocking(TDS_SYS_SOCKET sock);
int tds_wakeup_init(TDSPOLLWAKEUP *wakeup);
Expand Down Expand Up @@ -1631,7 +1639,7 @@ typedef struct tds_freeze {
} TDSFREEZE;

void tds_freeze(TDSSOCKET *tds, TDSFREEZE *freeze, unsigned size_len);
size_t tds_freeze_written(TDSFREEZE *freeze);
unsigned int tds_freeze_written(TDSFREEZE *freeze);
TDSRET tds_freeze_abort(TDSFREEZE *freeze);
TDSRET tds_freeze_close(TDSFREEZE *freeze);
TDSRET tds_freeze_close_len(TDSFREEZE *freeze, int32_t size);
Expand Down
3 changes: 2 additions & 1 deletion include/freetds/utils/des.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ void tds_des_encrypt(const DES_KEY * key, des_cblock block);
#endif

void tds_des_set_odd_parity(des_cblock key);
int tds_des_ecb_encrypt(const void *plaintext, int len, DES_KEY * akey, uint8_t *output);
int tds_des_ecb_encrypt(const void *plaintext, size_t len, DES_KEY * akey,
uint8_t *output);

#include <freetds/popvis.h>

Expand Down
2 changes: 1 addition & 1 deletion src/ctlib/blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ blk_describe(CS_BLKDESC * blkdesc, CS_INT item, CS_DATAFMT * datafmt_arg)
curcol = blkdesc->bcpinfo.bindinfo->columns[item - 1];
/* name is always null terminated */
strlcpy(datafmt->name, tds_dstr_cstr(&curcol->column_name), sizeof(datafmt->name));
datafmt->namelen = strlen(datafmt->name);
datafmt->namelen = (CS_INT) strlen(datafmt->name);
/* need to turn the SYBxxx into a CS_xxx_TYPE */
datatype = _ct_get_client_type(curcol, true);
if (datatype == CS_ILLEGAL_TYPE)
Expand Down
17 changes: 11 additions & 6 deletions src/ctlib/cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,8 @@ cs_locale(CS_CONTEXT * ctx, CS_INT action, CS_LOCALE * locale, CS_INT type, CS_V

switch (type) {
case CS_SYB_CHARSET:
tlen = (locale->charset ? strlen(locale->charset) : 0) + 1;
tlen = (locale->charset ? (int) strlen(locale->charset)
: 0) + 1;
if (buflen < tlen)
{
if (outlen)
Expand All @@ -1189,7 +1190,8 @@ cs_locale(CS_CONTEXT * ctx, CS_INT action, CS_LOCALE * locale, CS_INT type, CS_V
break;

case CS_SYB_LANG:
tlen = (locale->language ? strlen(locale->language) : 0) + 1;
tlen = (locale->language ?
(int) strlen(locale->language) : 0) + 1;
if (buflen < tlen)
{
if (outlen)
Expand All @@ -1207,8 +1209,10 @@ cs_locale(CS_CONTEXT * ctx, CS_INT action, CS_LOCALE * locale, CS_INT type, CS_V
{
int clen;

tlen = (locale->language ? strlen(locale->language) : 0) + 1;
clen = (locale->charset ? strlen(locale->charset) : 0) + 1;
tlen = (locale->language ?
(int) strlen(locale->language) : 0) + 1;
clen = (locale->charset ?
(int) strlen(locale->charset) : 0) + 1;

if (buflen < (tlen + clen))
{
Expand All @@ -1222,15 +1226,16 @@ cs_locale(CS_CONTEXT * ctx, CS_INT action, CS_LOCALE * locale, CS_INT type, CS_V
((char *)buffer)[0] = '\0';
strcat((char *)buffer, ".");
if (locale->charset) {
tlen = strlen((char *)buffer);
tlen = (int) strlen((char *)buffer);
strcpy((char *)buffer + tlen, locale->charset);
}
code = CS_SUCCEED;
break;
}

case CS_SYB_SORTORDER:
tlen = (locale->collate ? strlen(locale->collate) : 0) + 1;
tlen = (locale->collate ? (int) strlen(locale->collate)
: 0) + 1;
if (buflen < tlen)
{
if (outlen)
Expand Down
16 changes: 9 additions & 7 deletions src/ctlib/ct.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ ct_con_props(CS_CONNECTION * con, CS_INT action, CS_INT property, CS_VOID * buff
s = &tds_login->database;
str_copy:
if (out_len)
*out_len = tds_dstr_len(s);
*out_len = (CS_INT) tds_dstr_len(s);
strlcpy((char *) buffer, tds_dstr_cstr(s), buflen);
break;
case CS_LOC_PROP:
Expand Down Expand Up @@ -850,7 +850,7 @@ ct_cmd_alloc(CS_CONNECTION * con, CS_COMMAND ** pcmd)
CS_RETCODE
ct_command(CS_COMMAND * cmd, CS_INT type, const CS_VOID * buffer, CS_INT buflen, CS_INT option)
{
int query_len, current_query_len;
ssize_t query_len, current_query_len;

tdsdump_log(TDS_DBG_FUNC, "ct_command(%p, %d, %p, %d, %d)\n", cmd, type, buffer, buflen, option);

Expand Down Expand Up @@ -2520,7 +2520,7 @@ ct_describe(CS_COMMAND * cmd, CS_INT item, CS_DATAFMT * datafmt_arg)
curcol = resinfo->columns[item - 1];
/* name is always null terminated */
strlcpy(datafmt->name, tds_dstr_cstr(&curcol->column_name), sizeof(datafmt->name));
datafmt->namelen = strlen(datafmt->name);
datafmt->namelen = (TDS_INT) strlen(datafmt->name);
/* need to turn the SYBxxx into a CS_xxx_TYPE */
datafmt->datatype = _ct_get_client_type(curcol, true);
if (datafmt->datatype == CS_ILLEGAL_TYPE) {
Expand Down Expand Up @@ -2665,7 +2665,8 @@ ct_config(CS_CONTEXT * ctx, CS_INT action, CS_INT property, CS_VOID * buffer, CS
);
((char*)buffer)[buflen - 1]= 0;
if (*outlen < 0)
*outlen = strlen((char*) buffer);
*outlen = (CS_INT)
strlen((char*) buffer);
ret = CS_SUCCEED;
}
break;
Expand All @@ -2685,7 +2686,8 @@ ct_config(CS_CONTEXT * ctx, CS_INT action, CS_INT property, CS_VOID * buffer, CS
*outlen= snprintf((char*) buffer, buflen, "%s", settings->freetds_version);
((char*)buffer)[buflen - 1]= 0;
if (*outlen < 0)
*outlen = strlen((char*) buffer);
*outlen = (CS_INT)
strlen((char*) buffer);
ret = CS_SUCCEED;
}
break;
Expand Down Expand Up @@ -2800,7 +2802,7 @@ ct_cmd_props(CS_COMMAND * cmd, CS_INT action, CS_INT property, CS_VOID * buffer,
if ((CS_INT) len >= buflen)
return CS_FAIL;
strcpy((char*) buffer, cursor->cursor_name);
if (outlen) *outlen = len;
if (outlen) *outlen = (CS_INT) len;
}
if (property == CS_CUR_ROWCOUNT) {
*(CS_INT *)buffer = cursor->cursor_rows;
Expand Down Expand Up @@ -3369,7 +3371,7 @@ ct_capability(CS_CONNECTION * con, CS_INT action, CS_INT type, CS_INT capability
CS_RETCODE
ct_dynamic(CS_COMMAND * cmd, CS_INT type, CS_CHAR * id, CS_INT idlen, CS_CHAR * buffer, CS_INT buflen)
{
int query_len;
size_t query_len;
CS_CONNECTION *con;
CS_DYNAMIC *dyn;

Expand Down
14 changes: 7 additions & 7 deletions src/ctlib/ctutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ _ct_handle_client_message(const TDSCONTEXT * ctx_tds, TDSSOCKET * tds, TDSMESSAG
errmsg.msgnumber = msg->msgno;
errmsg.severity = _ct_translate_severity(msg->severity);
strlcpy(errmsg.msgstring, msg->message, sizeof(errmsg.msgstring));
errmsg.msgstringlen = strlen(errmsg.msgstring);
errmsg.msgstringlen = (CS_INT) strlen(errmsg.msgstring);
if (msg->osstr) {
errmsg.osstringlen = (CS_INT) strlen(msg->osstr);
strlcpy(errmsg.osstring, msg->osstr, CS_MAX_MSG);
Expand Down Expand Up @@ -184,18 +184,18 @@ _ct_handle_server_message(const TDSCONTEXT * ctx_tds, TDSSOCKET * tds, TDSMESSAG
memset(&errmsg, '\0', sizeof(errmsg));
errmsg.common.msgnumber = msg->msgno;
strlcpy(errmsg.common.text, msg->message, sizeof(errmsg.common.text));
errmsg.common.textlen = strlen(errmsg.common.text);
errmsg.common.textlen = (CS_INT) strlen(errmsg.common.text);
errmsg.common.state = msg->state;
errmsg.common.severity = msg->severity;

#define MIDDLE_PART(part) do { \
common2 = (CS_SERVERMSG_COMMON2 *) &(errmsg.part.line); \
if (msg->server) { \
errmsg.part.svrnlen = strlen(msg->server); \
errmsg.part.svrnlen = (CS_INT) strlen(msg->server); \
strlcpy(errmsg.part.svrname, msg->server, sizeof(errmsg.part.svrname)); \
} \
if (msg->proc_name) { \
errmsg.part.proclen = strlen(msg->proc_name); \
errmsg.part.proclen = (CS_INT) strlen(msg->proc_name); \
strlcpy(errmsg.part.proc, msg->proc_name, sizeof(errmsg.part.proc)); \
} \
} while(0)
Expand All @@ -209,7 +209,7 @@ _ct_handle_server_message(const TDSCONTEXT * ctx_tds, TDSSOCKET * tds, TDSMESSAG
common2->sqlstate[0] = 0;
if (msg->sql_state)
strlcpy((char *) common2->sqlstate, msg->sql_state, sizeof(common2->sqlstate));
common2->sqlstatelen = strlen((char *) common2->sqlstate);
common2->sqlstatelen = (CS_INT) strlen((char *) common2->sqlstate);
common2->line = msg->line_number;

/* if there is no connection, attempt to call the context handler */
Expand Down Expand Up @@ -273,7 +273,7 @@ _ct_datafmt_conv_in(CS_CONTEXT * ctx, const CS_DATAFMT * datafmt, CS_DATAFMT_LAR
small = (const CS_DATAFMT_SMALL *) datafmt;

strlcpy(fmtbuf->name, small->name, sizeof(fmtbuf->name));
fmtbuf->namelen = strlen(fmtbuf->name);
fmtbuf->namelen = (CS_INT) strlen(fmtbuf->name);
*((CS_DATAFMT_COMMON *) &fmtbuf->datatype) = *((CS_DATAFMT_COMMON *) &small->datatype);
return fmtbuf;
}
Expand Down Expand Up @@ -317,7 +317,7 @@ _ct_datafmt_conv_back(CS_DATAFMT * datafmt, CS_DATAFMT_LARGE *fmtbuf)
small = (CS_DATAFMT_SMALL *) datafmt;

strlcpy(small->name, fmtbuf->name, sizeof(small->name));
small->namelen = strlen(small->name);
small->namelen = (CS_INT) strlen(small->name);
*((CS_DATAFMT_COMMON *) &small->datatype) = *((CS_DATAFMT_COMMON *) &fmtbuf->datatype);
}

Expand Down
2 changes: 1 addition & 1 deletion src/ctlib/unittests/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ typedef struct
char USER[512];
char PASSWORD[512];
char fverbose;
int maxlength;
long maxlength;
} COMMON_PWD;
extern COMMON_PWD common_pwd;

Expand Down
4 changes: 2 additions & 2 deletions src/ctlib/unittests/cs_convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static CS_INT dest_format = CS_FMT_UNUSED;
static int
DoTest(
/* source information */
CS_INT fromtype, void *fromdata, CS_INT fromlen,
CS_INT fromtype, void *fromdata, size_t fromlen,
/* to information */
CS_INT totype, CS_INT tomaxlen,
/* expected result */
Expand All @@ -47,7 +47,7 @@ DoTest(

memset(&srcfmt, 0, sizeof(srcfmt));
srcfmt.datatype = fromtype;
srcfmt.maxlength = fromlen;
srcfmt.maxlength = (CS_INT) fromlen;

/*
* FIXME this fix some thing but if error cs_convert should return
Expand Down
Loading

0 comments on commit 1512645

Please sign in to comment.