Constify a lot more items.
This fixes various compiler warnings when -Wdiscarded-qualifiers is used.
This commit is contained in:
parent
45ec8f7756
commit
2c24077466
|
@ -546,11 +546,11 @@ struct sr_analog_spec {
|
|||
/** Generic option struct used by various subsystems. */
|
||||
struct sr_option {
|
||||
/* Short name suitable for commandline usage, [a-z0-9-]. */
|
||||
char *id;
|
||||
const char *id;
|
||||
/* Short name suitable for GUI usage, can contain UTF-8. */
|
||||
char *name;
|
||||
const char *name;
|
||||
/* Description of the option, in a sentence. */
|
||||
char *desc;
|
||||
const char *desc;
|
||||
/* Default value for this option. */
|
||||
GVariant *def;
|
||||
/* List of possible values, if this is an option with few values. */
|
||||
|
@ -645,11 +645,11 @@ struct sr_key_info {
|
|||
/** Data type like SR_T_STRING, etc if applicable. */
|
||||
int datatype;
|
||||
/** Short, lowercase ID string, e.g. "serialcomm", "voltage". */
|
||||
char *id;
|
||||
const char *id;
|
||||
/** Full capitalized name, e.g. "Serial communication". */
|
||||
char *name;
|
||||
const char *name;
|
||||
/** Verbose description (unused currently). */
|
||||
char *description;
|
||||
const char *description;
|
||||
};
|
||||
|
||||
#define SR_CONF_GET (1 << 31)
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
struct unit_mq_string {
|
||||
uint64_t value;
|
||||
char *str;
|
||||
const char *str;
|
||||
};
|
||||
|
||||
/* Please use the same order as in enum sr_unit (libsigrok.h). */
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <string.h>
|
||||
#include "protocol.h"
|
||||
|
||||
static void dump_packet(char *msg, uint8_t *packet)
|
||||
static void dump_packet(const char *msg, uint8_t *packet)
|
||||
{
|
||||
int i;
|
||||
char str[128];
|
||||
|
|
|
@ -54,7 +54,7 @@ struct channel_spec {
|
|||
|
||||
struct pps_model {
|
||||
int modelid;
|
||||
char *name;
|
||||
const char *name;
|
||||
int channel_modes;
|
||||
int num_channels;
|
||||
struct channel_spec channels[MAX_CHANNELS];
|
||||
|
|
|
@ -651,7 +651,8 @@ static float read_sample(struct sr_channel *ch)
|
|||
SR_PRIV int bl_acme_open_channel(struct sr_channel *ch)
|
||||
{
|
||||
struct channel_priv *chp;
|
||||
char path[64], *file;
|
||||
char path[64];
|
||||
const char *file;
|
||||
int fd;
|
||||
|
||||
chp = ch->priv;
|
||||
|
|
|
@ -37,9 +37,9 @@ enum {
|
|||
};
|
||||
|
||||
struct center_dev_info {
|
||||
char *vendor;
|
||||
char *device;
|
||||
char *conn;
|
||||
const char *vendor;
|
||||
const char *device;
|
||||
const char *conn;
|
||||
int num_channels;
|
||||
uint32_t max_sample_points;
|
||||
uint8_t packet_size;
|
||||
|
|
|
@ -374,7 +374,7 @@ static int dev_open(struct sr_dev_inst *sdi)
|
|||
struct sr_dev_driver *di = sdi->driver;
|
||||
struct sr_usb_dev_inst *usb;
|
||||
struct dev_context *devc;
|
||||
char *fpga_firmware = NULL;
|
||||
const char *fpga_firmware = NULL;
|
||||
int ret;
|
||||
int64_t timediff_us, timediff_ms;
|
||||
|
||||
|
|
|
@ -428,7 +428,8 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
|
|||
{
|
||||
struct dev_context *devc;
|
||||
struct sr_usb_dev_inst *usb;
|
||||
char str[128], *s;
|
||||
char str[128];
|
||||
const char *s;
|
||||
const uint64_t *vdiv;
|
||||
int ch_idx;
|
||||
|
||||
|
|
|
@ -154,10 +154,10 @@ struct dso_profile {
|
|||
/* VID/PID after firmware upload */
|
||||
uint16_t fw_vid;
|
||||
uint16_t fw_pid;
|
||||
char *vendor;
|
||||
char *model;
|
||||
const char *vendor;
|
||||
const char *model;
|
||||
const uint64_t *buffersizes;
|
||||
char *firmware;
|
||||
const char *firmware;
|
||||
};
|
||||
|
||||
struct dev_context {
|
||||
|
|
|
@ -27,11 +27,11 @@ struct scale_info {
|
|||
/** libsigrok driver info struct. */
|
||||
struct sr_dev_driver di;
|
||||
/** Manufacturer/brand. */
|
||||
char *vendor;
|
||||
const char *vendor;
|
||||
/** Model. */
|
||||
char *device;
|
||||
const char *device;
|
||||
/** serialconn string. */
|
||||
char *conn;
|
||||
const char *conn;
|
||||
/** Baud rate. */
|
||||
uint32_t baudrate;
|
||||
/** Packet size in bytes. */
|
||||
|
|
|
@ -80,7 +80,8 @@ static void give_device_time_to_process(struct dev_context *devc)
|
|||
SR_PRIV int korad_kdxxxxp_set_value(struct sr_serial_dev_inst *serial,
|
||||
struct dev_context *devc)
|
||||
{
|
||||
char msg[21], *cmd;
|
||||
char msg[21];
|
||||
const char *cmd;
|
||||
float value;
|
||||
int ret;
|
||||
|
||||
|
|
|
@ -44,9 +44,9 @@ enum {
|
|||
/* Information on single model */
|
||||
struct korad_kdxxxxp_model {
|
||||
int model_id; /**< Model info */
|
||||
char *vendor; /**< Vendor name */
|
||||
char *name; /**< Model name */
|
||||
char *id; /**< Model ID, as delivered by interface */
|
||||
const char *vendor; /**< Vendor name */
|
||||
const char *name; /**< Model name */
|
||||
const char *id; /**< Model ID, as delivered by interface */
|
||||
int channels; /**< Number of channels */
|
||||
double voltage[3]; /**< Min, max, step */
|
||||
double current[3]; /**< Min, max, step */
|
||||
|
|
|
@ -68,7 +68,7 @@ enum {
|
|||
|
||||
struct elusb_profile {
|
||||
int modelid;
|
||||
char *modelname;
|
||||
const char *modelname;
|
||||
int logformat;
|
||||
};
|
||||
|
||||
|
|
|
@ -58,8 +58,8 @@ enum {
|
|||
/** Information on a single model. */
|
||||
struct hcs_model {
|
||||
int model_id; /**< Model info */
|
||||
char *name; /**< Model name */
|
||||
char *id; /**< Model ID, like delivered by interface */
|
||||
const char *name; /**< Model name */
|
||||
const char *id; /**< Model ID, like delivered by interface */
|
||||
double voltage[3]; /**< Min, max, step */
|
||||
double current[3]; /**< Min, max, step */
|
||||
};
|
||||
|
|
|
@ -36,9 +36,9 @@ enum {
|
|||
};
|
||||
|
||||
struct mic_dev_info {
|
||||
char *vendor;
|
||||
char *device;
|
||||
char *conn;
|
||||
const char *vendor;
|
||||
const char *device;
|
||||
const char *conn;
|
||||
uint32_t max_sample_points;
|
||||
gboolean has_temperature;
|
||||
gboolean has_humidity;
|
||||
|
|
|
@ -26,11 +26,11 @@ struct dmm_info {
|
|||
/** libsigrok driver info struct. */
|
||||
struct sr_dev_driver di;
|
||||
/** Manufacturer/brand. */
|
||||
char *vendor;
|
||||
const char *vendor;
|
||||
/** Model. */
|
||||
char *device;
|
||||
const char *device;
|
||||
/** serialconn string. */
|
||||
char *conn;
|
||||
const char *conn;
|
||||
/** Baud rate. */
|
||||
uint32_t baudrate;
|
||||
/** Packet size in bytes. */
|
||||
|
|
|
@ -61,7 +61,7 @@ SR_PRIV int testo_probe_channels(struct sr_dev_inst *sdi)
|
|||
struct sr_usb_dev_inst *usb;
|
||||
int unit, packet_len, len, i;
|
||||
unsigned char packet[MAX_REPLY_SIZE], buf[MAX_REPLY_SIZE];
|
||||
char *probe_name;
|
||||
const char *probe_name;
|
||||
|
||||
devc = sdi->priv;
|
||||
usb = sdi->conn;
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#define EP_OUT 2 | LIBUSB_ENDPOINT_OUT
|
||||
|
||||
struct testo_model {
|
||||
char *name;
|
||||
const char *name;
|
||||
int request_size;
|
||||
const uint8_t *request;
|
||||
};
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
|
||||
struct dmm_info {
|
||||
struct sr_dev_driver di;
|
||||
char *vendor;
|
||||
char *device;
|
||||
const char *vendor;
|
||||
const char *device;
|
||||
uint32_t baudrate;
|
||||
int packet_size;
|
||||
gboolean (*packet_valid)(const uint8_t *);
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
struct zp_model {
|
||||
uint16_t vid;
|
||||
uint16_t pid;
|
||||
char *model_name;
|
||||
const char *model_name;
|
||||
unsigned int channels;
|
||||
unsigned int sample_depth; /* In Ksamples/channel */
|
||||
unsigned int max_sampling_freq;
|
||||
|
|
|
@ -569,7 +569,8 @@ static int check_key(const struct sr_dev_driver *driver,
|
|||
GVariant *gvar_opts;
|
||||
const uint32_t *opts;
|
||||
uint32_t pub_opt;
|
||||
char *suffix, *opstr;
|
||||
const char *suffix;
|
||||
const char *opstr;
|
||||
|
||||
if (sdi && cg)
|
||||
suffix = " for this device and channel group";
|
||||
|
|
|
@ -150,7 +150,7 @@ static struct sr_option options[] = {
|
|||
ALL_ZERO
|
||||
};
|
||||
|
||||
static struct sr_option *get_options(void)
|
||||
static const struct sr_option *get_options(void)
|
||||
{
|
||||
if (!options[0].def) {
|
||||
options[0].def = g_variant_ref_sink(g_variant_new_int32(DEFAULT_NUM_CHANNELS));
|
||||
|
|
|
@ -162,7 +162,7 @@ static struct sr_option options[] = {
|
|||
ALL_ZERO
|
||||
};
|
||||
|
||||
static struct sr_option *get_options(void)
|
||||
static const struct sr_option *get_options(void)
|
||||
{
|
||||
if (!options[0].def) {
|
||||
options[0].def = g_variant_ref_sink(g_variant_new_int32(DEFAULT_NUM_CHANNELS));
|
||||
|
|
|
@ -784,7 +784,7 @@ static struct sr_option options[] = {
|
|||
ALL_ZERO
|
||||
};
|
||||
|
||||
static struct sr_option *get_options(void)
|
||||
static const struct sr_option *get_options(void)
|
||||
{
|
||||
if (!options[0].def) {
|
||||
options[0].def = g_variant_ref_sink(g_variant_new_int32(0));
|
||||
|
|
|
@ -242,7 +242,7 @@ SR_API struct sr_input *sr_input_new(const struct sr_input_module *imod,
|
|||
GHashTable *options)
|
||||
{
|
||||
struct sr_input *in;
|
||||
struct sr_option *mod_opts;
|
||||
const struct sr_option *mod_opts;
|
||||
const GVariantType *gvt;
|
||||
GHashTable *new_opts;
|
||||
GHashTableIter iter;
|
||||
|
|
|
@ -551,7 +551,7 @@ static struct sr_option options[] = {
|
|||
ALL_ZERO
|
||||
};
|
||||
|
||||
static struct sr_option *get_options(void)
|
||||
static const struct sr_option *get_options(void)
|
||||
{
|
||||
if (!options[0].def) {
|
||||
options[0].def = g_variant_ref_sink(g_variant_new_int32(DEFAULT_NUM_CHANNELS));
|
||||
|
|
|
@ -288,7 +288,7 @@ struct sr_input_module {
|
|||
* Returns a NULL-terminated list of options this module can take.
|
||||
* Can be NULL, if the module has no options.
|
||||
*/
|
||||
struct sr_option *(*options) (void);
|
||||
const struct sr_option *(*options) (void);
|
||||
|
||||
/**
|
||||
* Check if this input module can load and parse the specified stream.
|
||||
|
@ -383,7 +383,7 @@ struct sr_output_module {
|
|||
* A unique ID for this output module, suitable for use in command-line
|
||||
* clients, [a-z0-9-]. Must not be NULL.
|
||||
*/
|
||||
char *id;
|
||||
const char *id;
|
||||
|
||||
/**
|
||||
* A unique name for this output module, suitable for use in GUI
|
||||
|
@ -397,7 +397,7 @@ struct sr_output_module {
|
|||
* This can be displayed by frontends, e.g. when selecting the output
|
||||
* module for saving a file.
|
||||
*/
|
||||
char *desc;
|
||||
const char *desc;
|
||||
|
||||
/**
|
||||
* A NULL terminated array of strings containing a list of file name
|
||||
|
@ -491,7 +491,7 @@ struct sr_transform_module {
|
|||
* A unique ID for this transform module, suitable for use in
|
||||
* command-line clients, [a-z0-9-]. Must not be NULL.
|
||||
*/
|
||||
char *id;
|
||||
const char *id;
|
||||
|
||||
/**
|
||||
* A unique name for this transform module, suitable for use in GUI
|
||||
|
@ -505,7 +505,7 @@ struct sr_transform_module {
|
|||
* This can be displayed by frontends, e.g. when selecting
|
||||
* which transform module(s) to add.
|
||||
*/
|
||||
char *desc;
|
||||
const char *desc;
|
||||
|
||||
/**
|
||||
* Returns a NULL-terminated list of options this transform module
|
||||
|
|
|
@ -68,7 +68,7 @@ static int init(struct sr_output *o, GHashTable *options)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static void si_printf(float value, GString *out, char *unitstr)
|
||||
static void si_printf(float value, GString *out, const char *unitstr)
|
||||
{
|
||||
float v;
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ static int scpi_vxi_open(struct sr_scpi_dev_inst *scpi)
|
|||
link_parms.clientId = (long) vxi->client;
|
||||
link_parms.lockDevice = 0;
|
||||
link_parms.lock_timeout = VXI_DEFAULT_TIMEOUT_MS;
|
||||
link_parms.device = "inst0";
|
||||
link_parms.device = (char *)"inst0";
|
||||
|
||||
if (!(link_resp = create_link_1(&link_parms, vxi->client))) {
|
||||
sr_err("Link creation failed for %s", vxi->address);
|
||||
|
|
Loading…
Reference in New Issue