From 8ff672d34c2ff17e0192c5802e5dff9828a6caf5 Mon Sep 17 00:00:00 2001 From: "Joop Stakenborg, PG4I" Date: Sun, 12 Mar 2006 09:02:38 +0000 Subject: [PATCH] more unsigned char->char and int->size_t transitions git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2091 7ae35d74-ebe9-4afe-98af-79ac388436b8 --- kenwood/tmv7.c | 20 +++++++++++++------- kenwood/ts140.c | 26 ++++++++++++++++---------- kenwood/ts2000.c | 9 ++++----- kenwood/ts450s.c | 26 ++++++++++++++++---------- kenwood/ts480.c | 33 ++++++++++++++++++--------------- 5 files changed, 67 insertions(+), 47 deletions(-) diff --git a/kenwood/tmv7.c b/kenwood/tmv7.c index 399e5e182..594da526a 100644 --- a/kenwood/tmv7.c +++ b/kenwood/tmv7.c @@ -2,7 +2,7 @@ * Hamlib Kenwood backend - TM-V7 description * Copyright (c) 2004-2005 by Stephane Fillod * - * $Id: tmv7.c,v 1.12 2005-04-03 20:40:21 fillods Exp $ + * $Id: tmv7.c,v 1.13 2006-03-12 09:02:38 pa4tu Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -216,7 +216,8 @@ const struct rig_caps tmv7_caps = { int tmv7_decode_event (RIG *rig) { char asyncbuf[ACKBUF_LEN]; - int retval, asyncbuf_len = ACKBUF_LEN-1; + int retval; + size_t asyncbuf_len = ACKBUF_LEN; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__); retval = kenwood_transaction(rig, NULL, 0, asyncbuf, &asyncbuf_len); @@ -324,7 +325,8 @@ int tmv7_decode_event (RIG *rig) int tmv7_set_vfo (RIG *rig, vfo_t vfo) { char vfobuf[16], ackbuf[ACKBUF_LEN]; - int retval,ack_len; + int retval; + size_t ack_len; rig_debug(RIG_DEBUG_TRACE, "%s: called %d\n", __FUNCTION__,vfo); @@ -383,7 +385,8 @@ int tmv7_set_vfo (RIG *rig, vfo_t vfo) int tmv7_get_mode (RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { char ackbuf[ACKBUF_LEN]; - int retval,ack_len=ACKBUF_LEN; + int retval; + size_t ack_len=ACKBUF_LEN; int step; freq_t freq; @@ -428,7 +431,8 @@ int tmv7_get_powerstat (RIG *rig, powerstat_t *status) int tmv7_get_channel(RIG *rig, channel_t *chan) { char membuf[64],ackbuf[ACKBUF_LEN]; - int retval,ack_len; + int retval; + size_t ack_len; freq_t freq; char req[16],scf[128]; int step, shift, rev, tone, ctcss, tonefq, ctcssfq; @@ -540,7 +544,8 @@ int tmv7_get_channel(RIG *rig, channel_t *chan) int tmv7_set_channel(RIG *rig, const channel_t *chan) { char membuf[ACKBUF_LEN],ackbuf[ACKBUF_LEN]; - int retval,ack_len; + int retval; + size_t ack_len; char req[64]; long long freq; int chn, step, shift, tone, ctcss, tonefq, ctcssfq; @@ -656,7 +661,8 @@ int tmv7_set_channel(RIG *rig, const channel_t *chan) int tmv7_open(RIG *rig) { char ackbuf[ACKBUF_LEN]; - int retval,ack_len=ACKBUF_LEN; + int retval; + size_t ack_len=ACKBUF_LEN; /* just to be sure it's a TM-V7 */ retval = kenwood_transaction(rig, "ID"EOM, 3, ackbuf, &ack_len); diff --git a/kenwood/ts140.c b/kenwood/ts140.c index e15ff3e44..6d3ed9f4f 100644 --- a/kenwood/ts140.c +++ b/kenwood/ts140.c @@ -2,7 +2,7 @@ * Hamlib Kenwood backend - TS140 description * Copyright (c) 2000-2005 by Stephane Fillod * - * $Id: ts140.c,v 1.5 2005-04-03 20:14:26 fillods Exp $ + * $Id: ts140.c,v 1.6 2006-03-12 09:02:38 pa4tu Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -62,8 +62,9 @@ static const struct kenwood_priv_caps ts140_priv_caps = { static int ts140_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { - unsigned char modebuf[50]; - int mode_len, retval; + char modebuf[50]; + int retval; + size_t mode_len; mode_len = 50; retval = kenwood_transaction (rig, "IF;", 3, modebuf, &mode_len); @@ -97,10 +98,12 @@ static int ts140_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) static int ts140_set_vfo(RIG *rig, vfo_t vfo) { - unsigned char cmdbuf[16], ackbuf[16]; - int cmd_len, ack_len, retval; + char cmdbuf[16], ackbuf[50]; + int cmd_len, retval; + size_t ack_len; char vfo_function; + ack_len = 50; switch (vfo) { case RIG_VFO_VFO: case RIG_VFO_A: vfo_function = VFO_A; break; @@ -123,8 +126,9 @@ static int ts140_set_vfo(RIG *rig, vfo_t vfo) static int ts140_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { - unsigned char freqbuf[50]; - int freq_len, retval; + char freqbuf[50]; + size_t freq_len; + int retval; long long f; /* We're using IF; here because the TS-140S is incapable of supplying @@ -151,9 +155,11 @@ static int ts140_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) static int ts140_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { - unsigned char fctbuf[16], ackbuf[16]; - int fct_len, ack_len; - ack_len = 0; + char fctbuf[16], ackbuf[50]; + int fct_len; + size_t ack_len; + + ack_len = 50; switch (func) { case RIG_FUNC_LOCK: if (status > 1) status = 1; diff --git a/kenwood/ts2000.c b/kenwood/ts2000.c index df3928b14..67e1770e2 100644 --- a/kenwood/ts2000.c +++ b/kenwood/ts2000.c @@ -2,7 +2,7 @@ * Hamlib Kenwood backend - TS2000 description * Copyright (c) 2000-2006 by Stephane Fillod * - * $Id: ts2000.c,v 1.20 2006-02-20 22:28:23 fillods Exp $ + * $Id: ts2000.c,v 1.21 2006-03-12 09:02:38 pa4tu Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -258,10 +258,9 @@ const struct rig_caps ts2000_caps = { int ts2000_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { - unsigned char lvlbuf[50]; - int lvl_len, retval; - int lvl; - int i, ret, agclevel; + char lvlbuf[50]; + size_t lvl_len; + int lvl, retval, ret, agclevel; lvl_len = 50; switch (level) { diff --git a/kenwood/ts450s.c b/kenwood/ts450s.c index bb0536a61..4ee7a1a3d 100644 --- a/kenwood/ts450s.c +++ b/kenwood/ts450s.c @@ -2,7 +2,7 @@ * Hamlib Kenwood backend - TS450S description * Copyright (c) 2000-2004 by Stephane Fillod * - * $Id: ts450s.c,v 1.22 2005-04-03 20:14:26 fillods Exp $ + * $Id: ts450s.c,v 1.23 2006-03-12 09:02:38 pa4tu Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -77,9 +77,11 @@ static const struct kenwood_priv_caps ts450_priv_caps = { static int ts450s_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { - unsigned char infobuf[50]; - int info_len, retval; + char infobuf[50]; + size_t info_len; + int retval; + info_len = 50; retval = kenwood_transaction (rig, "IF;", 3, infobuf, &info_len); if (retval != RIG_OK) return retval; @@ -115,9 +117,11 @@ ts450s_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) static int ts450s_get_vfo(RIG *rig, vfo_t *vfo) { - unsigned char infobuf[50]; - int info_len, retval; + char infobuf[50]; + size_t info_len; + int retval; + info_len = 50; retval = kenwood_transaction (rig, "IF;", 3, infobuf, &info_len); if (retval != RIG_OK) return retval; @@ -144,8 +148,9 @@ ts450s_get_vfo(RIG *rig, vfo_t *vfo) static int ts450s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { - unsigned char lvlbuf[50]; - int lvl_len, retval; + char lvlbuf[50]; + size_t lvl_len; + int retval; lvl_len = 50; switch (level) @@ -204,10 +209,11 @@ ts450s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) static int ts450s_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { - unsigned char levelbuf[16], ackbuf[16]; - int level_len, ack_len, retval; - int kenwood_val; + char levelbuf[16], ackbuf[50]; + size_t level_len, ack_len; + int kenwood_val, retval; + ack_len = 50; if (RIG_LEVEL_IS_FLOAT(level)) kenwood_val = val.f * 255; else diff --git a/kenwood/ts480.c b/kenwood/ts480.c index c98a276c7..718464692 100644 --- a/kenwood/ts480.c +++ b/kenwood/ts480.c @@ -2,7 +2,7 @@ * Hamlib Kenwood backend - TS480 description * Copyright (c) 2000-2004 by Stephane Fillod and Juergen Rinas * - * $Id: ts480.c,v 1.4 2005-04-03 20:14:26 fillods Exp $ + * $Id: ts480.c,v 1.5 2006-03-12 09:02:38 pa4tu Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -49,8 +49,8 @@ static int kenwood_ts480_set_ptt (RIG * rig, vfo_t vfo, ptt_t ptt) { - unsigned char ackbuf[16]; - int ack_len = 0; + char ackbuf[50]; + size_t ack_len = 50; if (RIG_PTT_ON == ptt) return kenwood_transaction (rig, "TX1;", 4, ackbuf, &ack_len); @@ -67,8 +67,8 @@ kenwood_ts480_set_ptt (RIG * rig, vfo_t vfo, ptt_t ptt) static int kenwood_ts480_set_ant (RIG * rig, vfo_t vfo, ant_t ant) { - unsigned char ackbuf[16]; - int ack_len = 0; + char ackbuf[50]; + size_t ack_len = 50; if (RIG_ANT_1 == ant) return kenwood_transaction (rig, "AN1;", 4, ackbuf, &ack_len); @@ -87,8 +87,8 @@ kenwood_ts480_set_ant (RIG * rig, vfo_t vfo, ant_t ant) static int kenwood_ts480_get_ant (RIG * rig, vfo_t vfo, ant_t * ant) { - unsigned char ackbuf[16]; - int ack_len = 16; + char ackbuf[50]; + size_t ack_len = 50; int retval; retval = kenwood_transaction (rig, "AN;", 3, ackbuf, &ack_len); @@ -119,8 +119,9 @@ kenwood_ts480_get_ant (RIG * rig, vfo_t vfo, ant_t * ant) static const char * kenwood_ts480_get_info (RIG * rig) { - unsigned char firmbuf[50]; - int firm_len, retval; + char firmbuf[50]; + size_t firm_len; + int retval; firm_len = 50; retval = kenwood_transaction (rig, "TY;", 3, firmbuf, &firm_len); @@ -159,8 +160,9 @@ kenwood_ts480_get_info (RIG * rig) int kenwood_ts480_set_level (RIG * rig, vfo_t vfo, setting_t level, value_t val) { - unsigned char levelbuf[16], ackbuf[16]; - int level_len, ack_len, retval; + char levelbuf[16], ackbuf[50]; + int level_len, retval; + size_t ack_len = 50; int kenwood_val; switch (level) @@ -226,8 +228,8 @@ kenwood_ts480_set_level (RIG * rig, vfo_t vfo, setting_t level, value_t val) int kenwood_ts480_get_level (RIG * rig, vfo_t vfo, setting_t level, value_t * val) { - unsigned char ackbuf[50]; - int ack_len = 50; + char ackbuf[50]; + size_t ack_len = 50; int levelint; int retval; @@ -326,8 +328,9 @@ kenwood_ts480_get_level (RIG * rig, vfo_t vfo, setting_t level, value_t * val) int kenwood_ts480_set_func (RIG * rig, vfo_t vfo, setting_t func, int status) { - unsigned char fctbuf[16], ackbuf[16]; - int fct_len, ack_len; + char fctbuf[16], ackbuf[50]; + int fct_len; + size_t ack_len; ack_len = 0; switch (func)