This fixes various compiler warnings when -Wdiscarded-qualifiers is used.
/** 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. */
/** 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)
struct unit_mq_string {
uint64_t value;
- char *str;
+ const char *str;
};
/* Please use the same order as in enum sr_unit (libsigrok.h). */
#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];
struct pps_model {
int modelid;
- char *name;
+ const char *name;
int channel_modes;
int num_channels;
struct channel_spec channels[MAX_CHANNELS];
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;
};
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;
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;
{
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;
/* 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 {
/** 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. */
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;
/* 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 */
struct elusb_profile {
int modelid;
- char *modelname;
+ const char *modelname;
int logformat;
};
/** 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 */
};
};
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;
/** 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. */
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;
#define EP_OUT 2 | LIBUSB_ENDPOINT_OUT
struct testo_model {
- char *name;
+ const char *name;
int request_size;
const uint8_t *request;
};
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 *);
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;
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";
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));
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));
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));
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;
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));
* 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.
* 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
* 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
* 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
* 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
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;
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);