portability of long long

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2880 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.11
Stéphane Fillod, F8CFE 2010-04-16 19:04:00 +00:00
rodzic 2a15ba8d4b
commit 1404b754fe
12 zmienionych plików z 42 dodań i 52 usunięć

Wyświetl plik

@ -1,8 +1,7 @@
/*
* Hamlib Alinco backend - main file
* Copyright (c) 2001-2005 by Stephane Fillod
* Copyright (c) 2001-2010 by Stephane Fillod
*
* $Id: alinco.c,v 1.28 2006-10-07 16:55:04 csete 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
@ -219,7 +218,7 @@ int alinco_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
return -RIG_EINVAL;
/* at least 6 digits */
freq_len = sprintf(freqbuf, AL CMD_RXFREQ "%06"PRIll EOM, (long long)freq);
freq_len = sprintf(freqbuf, AL CMD_RXFREQ "%06"PRIll EOM, (int64_t)freq);
return alinco_transaction (rig, freqbuf, freq_len, NULL, NULL);
}
@ -414,7 +413,7 @@ int alinco_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
return -RIG_EINVAL;
/* at least 6 digits */
freq_len = sprintf(freqbuf, AL CMD_TXFREQ "%06"PRIll EOM, (long long)tx_freq);
freq_len = sprintf(freqbuf, AL CMD_TXFREQ "%06"PRIll EOM, (int64_t)tx_freq);
retval = alinco_transaction (rig, freqbuf, freq_len, NULL, NULL);

Wyświetl plik

@ -1,8 +1,7 @@
/*
* Hamlib AOR backend - main file
* Copyright (c) 2000-2008 by Stephane Fillod
* Copyright (c) 2000-2010 by Stephane Fillod
*
* $Id: aor.c,v 1.43 2008-04-11 17:10:45 fillods 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
@ -133,7 +132,7 @@ int aor_close(RIG *rig)
static int format_freq(char *buf, freq_t freq)
{
int lowhz;
long long f = (long long)freq;
int64_t f = (int64_t)freq;
/*
* actually, frequency must be like nnnnnnnnm0,

Wyświetl plik

@ -1,8 +1,7 @@
/*
* Hamlib backend - SDR-1000
* Copyright (c) 2003-2007 by Stephane Fillod
* Copyright (c) 2003-2010 by Stephane Fillod
*
* $Id: sdr1k.c,v 1.11 2008-10-26 13:35:41 y32kn 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
@ -264,7 +263,7 @@ static int set_band(RIG *rig, freq_t freq)
ret = write_latch (rig, L_BAND, 1 << band, 0x3f);
rig_debug(RIG_DEBUG_VERBOSE, "%s %"PRIll" band %d\n", __FUNCTION__, (long long)freq, band);
rig_debug(RIG_DEBUG_VERBOSE, "%s %"PRIll" band %d\n", __FUNCTION__, (int64_t)freq, band);
return ret;
}
@ -298,7 +297,7 @@ int sdr1k_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
else
frqval = freq;
rig_debug(RIG_DEBUG_VERBOSE, "%s curr %"PRIll" frqval %"PRIll"\n", __FUNCTION__, (long long)freq, (long long)frqval);
rig_debug(RIG_DEBUG_VERBOSE, "%s curr %"PRIll" frqval %"PRIll"\n", __FUNCTION__, (int64_t)freq, (int64_t)frqval);
if (priv->dds_freq == frqval) {
return RIG_OK;
@ -335,7 +334,7 @@ int sdr1k_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
struct sdr1k_priv_data *priv = (struct sdr1k_priv_data *)rig->state.priv;
*freq = priv->dds_freq;
rig_debug(RIG_DEBUG_TRACE,"%s: %"PRIll"\n", __FUNCTION__, (long long)priv->dds_freq);
rig_debug(RIG_DEBUG_TRACE,"%s: %"PRIll"\n", __FUNCTION__, (int64_t)priv->dds_freq);
return RIG_OK;
}

Wyświetl plik

@ -1,8 +1,7 @@
/*
* Hamlib JRC backend - main file
* Copyright (c) 2001-2009 by Stephane Fillod
* Copyright (c) 2001-2010 by Stephane Fillod
*
* $Id: jrc.c,v 1.30 2009-02-18 22:51:47 fillods 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
@ -235,7 +234,7 @@ int jrc_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
if (freq >= (freq_t)pow(10, priv->max_freq_len))
return -RIG_EINVAL;
freq_len = sprintf(freqbuf, "F%0*"PRIll EOM, priv->max_freq_len, (long long)freq);
freq_len = sprintf(freqbuf, "F%0*"PRIll EOM, priv->max_freq_len, (int64_t)freq);
return jrc_transaction (rig, freqbuf, freq_len, NULL, NULL);
}
@ -1169,7 +1168,7 @@ int jrc_set_chan(RIG *rig, const channel_t *chan)
if (retval != RIG_OK)
return retval;
sprintf(cmdbuf+7,"%0*"PRIll, priv->max_freq_len, (long long)chan->freq);
sprintf(cmdbuf+7,"%0*"PRIll, priv->max_freq_len, (int64_t)chan->freq);
if (priv->mem_len==17) {
switch (chan->levels[rig_setting2idx(RIG_LEVEL_AGC)].i) {

Wyświetl plik

@ -2,9 +2,8 @@
* Hamlib Kenwood backend - IC-10 interface for:
* TS-940, TS-811, TS-711, TS-440, and R-5000
*
* Copyright (c) 2000-2008 by Stephane Fillod and others
* Copyright (c) 2000-2010 by Stephane Fillod and others
*
* $Id: ic10.c,v 1.9 2009-02-03 23:22:58 azummo 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
@ -313,7 +312,7 @@ int ic10_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
return -RIG_EINVAL;
}
freq_len = sprintf(freqbuf,"F%c%011"PRIll";", vfo_letter, (long long)freq);
freq_len = sprintf(freqbuf,"F%c%011"PRIll";", vfo_letter, (int64_t)freq);
retval = ic10_transaction (rig, freqbuf, freq_len, ackbuf, &ack_len);
return retval;
@ -520,9 +519,9 @@ int ic10_set_channel(RIG *rig, const channel_t *chan)
{
char membuf[32],ackbuf[32];
int retval,ack_len,len,md;
long long freq;
int64_t freq;
freq = chan->freq;
freq = (int64_t) chan->freq;
switch (chan->mode) {
case RIG_MODE_CW : md = MD_CW; break;
case RIG_MODE_USB : md = MD_USB; break;

Wyświetl plik

@ -1,9 +1,9 @@
/*
* Hamlib PCR backend - main file
* Copyright (c) 2001-2005 by Stephane Fillod and Darren Hatcher
* Copyright (c) 2001-2005 by Darren Hatcher
* Copyright (c) 2001-2010 by Stephane Fillod
* Copyright (C) 2007-09 by Alessandro Zummo <a.zummo@towertech.it>
*
* $Id: pcr.c,v 1.26 2009-02-06 17:31:33 fillods 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
@ -560,7 +560,7 @@ pcr_set_freq(RIG * rig, vfo_t vfo, freq_t freq)
priv = (struct pcr_priv_data *) rig->state.priv;
freq_len = sprintf((char *) buf, "K0%010" PRIll "0%c0%c00",
(long long) freq,
(int64_t) freq,
priv->last_mode, priv->last_filter);
buf[freq_len] = '\0';
@ -674,7 +674,7 @@ pcr_set_mode(RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
__func__, width, pcrfilter);
buf_len = sprintf((char *) buf, "K0%010" PRIll "0%c0%c00",
(long long) priv->last_freq, pcrmode, pcrfilter);
(int64_t) priv->last_freq, pcrmode, pcrfilter);
err = pcr_transaction(rig, (char *) buf);
if (err != RIG_OK)

Wyświetl plik

@ -1,8 +1,7 @@
/*
* Hamlib R&S backend - main file
* Copyright (c) 2009 by Stéphane Fillod
* Copyright (c) 2009-2010 by Stéphane Fillod
*
* $Id: rs.c,v 1.2 2009/08/07 18:48:34 fillods 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
@ -90,7 +89,7 @@ int rs_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
char freqbuf[32];
int freq_len, retval;
freq_len = sprintf(freqbuf, BOM "FREQ %"PRIll EOM, (long long)freq);
freq_len = sprintf(freqbuf, BOM "FREQ %"PRIll EOM, (int64_t)freq);
retval = rs_transaction(rig, freqbuf, freq_len, NULL, NULL);
return retval;

Wyświetl plik

@ -1,8 +1,8 @@
/*
* Hamlib TenTenc backend - TT-565 description
* Copyright (c) 2004-2008 by Stephane Fillod & Martin Ewing
* Copyright (c) 2004-2008 by Martin Ewing
* Copyright (c) 2004-2010 by Stephane Fillod
*
* $Id: orion.c,v 1.31 2009-02-14 21:33:22 aa6e 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
@ -321,7 +321,7 @@ int tt565_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
/* Use ASCII mode to set frequencies */
cmd_len = sprintf (cmdbuf, "*%cF%"PRIll EOM,
which_vfo(rig, vfo),
(long long)freq);
(int64_t)freq);
#else
/* Use binary mode */
/* Set frequency using Orion's binary mode (short) sequence.

Wyświetl plik

@ -1,6 +1,6 @@
/*
* memsave.c - Copyright (C) 2003-2005 Thierry Leconte
* Copyright (C) 2008 Stephane Fillod
* Copyright (C) 2008-2010 Stephane Fillod
*
*
* $Id: memsave.c,v 1.11 2008-04-27 09:56:06 fillods Exp $
@ -138,7 +138,7 @@ int dump_xml_chan(RIG *rig, channel_t **chan_pp, int chan_num, const chan_t *cha
xmlNewProp(node, (unsigned char *) "ant", (unsigned char *) attrbuf);
}
if (mem_caps->freq && chan.freq != RIG_FREQ_NONE) {
sprintf(attrbuf,"%"PRIll,(long long)chan.freq);
sprintf(attrbuf,"%"PRIll,(int64_t)chan.freq);
xmlNewProp(node, (unsigned char *) "freq", (unsigned char *) attrbuf);
}
if (mem_caps->mode && chan.mode != RIG_MODE_NONE) {
@ -149,7 +149,7 @@ int dump_xml_chan(RIG *rig, channel_t **chan_pp, int chan_num, const chan_t *cha
xmlNewProp(node, (unsigned char *) "width", (unsigned char *) attrbuf);
}
if (mem_caps->tx_freq && chan.tx_freq != RIG_FREQ_NONE) {
sprintf(attrbuf,"%"PRIll,(long long)chan.tx_freq);
sprintf(attrbuf,"%"PRIll,(int64_t)chan.tx_freq);
xmlNewProp(node, (unsigned char *) "tx_freq", (unsigned char *) attrbuf);
}
if (mem_caps->tx_mode && chan.tx_mode != RIG_MODE_NONE) {
@ -194,7 +194,7 @@ int dump_xml_chan(RIG *rig, channel_t **chan_pp, int chan_num, const chan_t *cha
xmlNewProp(node, (unsigned char *) "xit", (unsigned char *) attrbuf);
}
if (mem_caps->funcs) {
sprintf(attrbuf,"%llx",(long long)chan.funcs);
sprintf(attrbuf,"%lx",chan.funcs);
xmlNewProp(node, (unsigned char *) "funcs", (unsigned char *) attrbuf);
}
if (mem_caps->ctcss_tone && chan.ctcss_tone !=0) {

Wyświetl plik

@ -7,8 +7,6 @@
* It takes commands in interactive mode as well as
* from command line options.
*
* $Id: rigctl_parse.c,v 1.16 2009-02-06 17:28:38 fillods Exp $
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -489,7 +487,7 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc)
if (!prompt)
rig_debug(RIG_DEBUG_TRACE, "rigctl(d): %c '0x%02x' '%s' '%s' '%s'\n",
cmd, vfo, p1, p2, p3);
cmd, rig_strvfo(vfo), p1?p1:"", p2?p2:"", p3?p3:"");
/*
* Extended Response protocol: output received command name and arguments
@ -695,7 +693,7 @@ declare_proto_rig(get_freq)
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
fprintf(fout, "%s: ", cmd->arg1); /* i.e. "Frequency" */
fprintf(fout, "%"PRIll"%c", (long long)freq, resp_sep);
fprintf(fout, "%"PRIll"%c", (int64_t)freq, resp_sep);
return status;
}
@ -1022,7 +1020,7 @@ declare_proto_rig(get_split_freq)
return status;
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
fprintf(fout, "%s: ", cmd->arg1);
fprintf(fout, "%"PRIll"%c", (long long)txfreq, resp_sep);
fprintf(fout, "%"PRIll"%c", (int64_t)txfreq, resp_sep);
return status;
}
@ -1714,7 +1712,7 @@ declare_proto_rig(get_channel)
static int myfreq_event(RIG *rig, vfo_t vfo, freq_t freq, rig_ptr_t arg)
{
printf("Event: freq changed to %"PRIll"Hz on %s\n", (long long)freq, rig_strvfo(vfo));
printf("Event: freq changed to %"PRIll"Hz on %s\n", (int64_t)freq, rig_strvfo(vfo));
return 0;
}

Wyświetl plik

@ -1,7 +1,7 @@
/*
* Very simple test program to check freq convertion --SF
* This is mainly to test kHz, MHz, GHz macros and long long support.
* This is mainly to test kHz, MHz, GHz macros and int64_t support.
*/
#ifdef HAVE_CONFIG_H
@ -36,27 +36,27 @@ int main (int argc, char *argv[])
/* freq on 31bits test */
f = GHz(2);
printf("GHz(2) = %"PRIll"\n", (long long)f);
printf("GHz(2) = %"PRIll"\n", (int64_t)f);
/* freq on 32bits test */
f = GHz(4);
printf("GHz(4) = %"PRIll"\n", (long long)f);
printf("GHz(4) = %"PRIll"\n", (int64_t)f);
/* freq on >32bits test */
f = GHz(5);
printf("GHz(5) = %"PRIll"\n", (long long)f);
printf("GHz(5) = %"PRIll"\n", (int64_t)f);
/* floating point to freq conversion test */
f = GHz(1.3);
printf("GHz(1.3) = %"PRIll"\n", (long long)f);
printf("GHz(1.3) = %"PRIll"\n", (int64_t)f);
/* floating point to freq conversion precision test */
f = GHz(1.234567890);
printf("GHz(1.234567890) = %"PRIll"\n", (long long)f);
printf("GHz(1.234567890) = %"PRIll"\n", (int64_t)f);
/* floating point to freq conversion precision test, with freq >32bits */
f = GHz(123.456789012);
printf("GHz(123.456789012) = %"PRIll"\n", (long long)f);
printf("GHz(123.456789012) = %"PRIll"\n", (int64_t)f);
return 0;
}

Wyświetl plik

@ -1,6 +1,6 @@
/*
* hamlib - (C) Frank Singleton 2000-2003
* (C) Stephane Fillod 2000-2009
* (C) Stephane Fillod 2000-2010
*
* ft100.c - (C) Chris Karpinsky 2001 (aa1vl@arrl.net)
* This shared library provides an API for communicating
@ -8,8 +8,6 @@
* The starting point for this code was Frank's ft847 implementation.
*
*
* $Id: ft100.c,v 1.26 2009-02-20 12:28:26 fillods Exp $
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -496,7 +494,7 @@ int ft100_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) {
rig_debug(RIG_DEBUG_VERBOSE,"ft100: d1=%"PRIfreq" d2=%"PRIfreq"\n",d1,d2);
rig_debug(RIG_DEBUG_VERBOSE,"ft100: get_freq= %8"PRIll" \n",(long long)d2);
rig_debug(RIG_DEBUG_VERBOSE,"ft100: get_freq= %8"PRIll" \n",(int64_t)d2);
*freq = d2;