Merge pull request #345 from dl1ycf/master

Corrections. Mostly to make the Compiler happy, but also a serious one.
pull/346/head
Michael Black 2020-07-17 06:30:36 -05:00 zatwierdzone przez GitHub
commit 40b5a0f37f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 10 dodań i 6 usunięć

Wyświetl plik

@ -471,6 +471,7 @@ int dxsr8_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
return -RIG_EINVAL; return -RIG_EINVAL;
} }
filter=0; // avoid compiler warings of being possibly uninitialized
retval = dxsr8_read_num(rig, AL "~RR_NAR" EOM, &filter); retval = dxsr8_read_num(rig, AL "~RR_NAR" EOM, &filter);
if (filter == 0) if (filter == 0)

Wyświetl plik

@ -467,6 +467,7 @@ int aor_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (retval != RIG_OK) { return retval; } if (retval != RIG_OK) { return retval; }
strncpy(mdbuf2, mdbuf + 4, 3); /* Extract first 'BW' part */ strncpy(mdbuf2, mdbuf + 4, 3); /* Extract first 'BW' part */
mdbuf2[3]='\0'; // in case strnpy produces and un-terminated string
mdbuf2_len = strlen(mdbuf2); mdbuf2_len = strlen(mdbuf2);
retval = aor_transaction(rig, mdbuf2, mdbuf2_len, NULL, NULL); retval = aor_transaction(rig, mdbuf2, mdbuf2_len, NULL, NULL);

Wyświetl plik

@ -563,6 +563,7 @@ int drake_set_mem(RIG *rig, vfo_t vfo, int ch)
len = sprintf(buf, "C%03d" EOM, ch); len = sprintf(buf, "C%03d" EOM, ch);
ack_len=0; // fix compile-time warning "possibly uninitialized"
retval = drake_transaction(rig, buf, len, ackbuf, &ack_len); retval = drake_transaction(rig, buf, len, ackbuf, &ack_len);
if (ack_len != 2) if (ack_len != 2)
@ -852,6 +853,7 @@ int drake_get_chan(RIG *rig, channel_t *chan, int read_only)
strncpy(chan->channel_desc, mdbuf + 25, 7); strncpy(chan->channel_desc, mdbuf + 25, 7);
chan->channel_desc[7]='\0'; // in case strncpy did not terminate the string
//now put the radio back the way it was //now put the radio back the way it was
//we apparently can't do a read-only channel read //we apparently can't do a read-only channel read

Wyświetl plik

@ -1661,7 +1661,7 @@ int kenwood_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
int kenwood_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) int kenwood_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit)
{ {
int retval; int retval;
char buf[6]; char buf[7];
struct kenwood_priv_data *priv = rig->state.priv; struct kenwood_priv_data *priv = rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
@ -1710,7 +1710,7 @@ int kenwood_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit)
if (priv->has_rit2) // if backend shows it has the Set 2 command if (priv->has_rit2) // if backend shows it has the Set 2 command
{ {
char cmd[10]; char cmd[15]; // length required to make Apple-gcc happy (unicode-proof).
snprintf(cmd, sizeof(cmd)-1, "R%c%05d", rit > 0 ? 'U' : 'D', abs((int)rit)); snprintf(cmd, sizeof(cmd)-1, "R%c%05d", rit > 0 ? 'U' : 'D', abs((int)rit));
retval = kenwood_transaction(rig, cmd, NULL, 0); retval = kenwood_transaction(rig, cmd, NULL, 0);
} }

Wyświetl plik

@ -182,8 +182,7 @@ static const char *rigerror_table[] =
"Communication bus collision", "Communication bus collision",
"NULL RIG handle or invalid pointer parameter", "NULL RIG handle or invalid pointer parameter",
"Invalid VFO", "Invalid VFO",
"Argument out of domain of func", "Argument out of domain of func"
NULL,
}; };
@ -294,7 +293,8 @@ const char *HAMLIB_API rigerror(int errnum)
if (errnum >= ERROR_TBL_SZ) if (errnum >= ERROR_TBL_SZ)
{ {
return NULL; // This should not happen, but if it happens don't return NULL
return "ERR_OUT_OF_RANGE";
} }
return rigerror_table[errnum]; return rigerror_table[errnum];