Fix all warnings and re-enable -Wextra.
This commit is contained in:
parent
86c5e27908
commit
afc8e4deb6
|
@ -54,9 +54,14 @@ void datastore_destroy(struct datastore *ds)
|
|||
|
||||
void datastore_put(struct datastore *ds, void *data, unsigned int length, int in_unitsize, int *probelist)
|
||||
{
|
||||
int capacity, stored, size, num_chunks, chunk_bytes_free, chunk_offset;
|
||||
unsigned int stored;
|
||||
int capacity, size, num_chunks, chunk_bytes_free, chunk_offset;
|
||||
gpointer chunk;
|
||||
|
||||
/* QUICK HACK */
|
||||
in_unitsize = in_unitsize;
|
||||
probelist = probelist;
|
||||
|
||||
if(ds->chunklist == NULL)
|
||||
chunk = new_chunk(&ds);
|
||||
else
|
||||
|
@ -73,7 +78,7 @@ void datastore_put(struct datastore *ds, void *data, unsigned int length, int in
|
|||
chunk_offset = 0;
|
||||
}
|
||||
|
||||
if(length - stored > chunk_bytes_free)
|
||||
if(length - stored > (unsigned int)chunk_bytes_free)
|
||||
size = chunk_bytes_free;
|
||||
else
|
||||
/* last part, won't fill up this chunk */
|
||||
|
|
6
device.c
6
device.c
|
@ -97,7 +97,7 @@ struct device *device_new(struct device_plugin *plugin, int plugin_index)
|
|||
|
||||
void device_clear(struct device *device)
|
||||
{
|
||||
int probenum;
|
||||
unsigned int probenum;
|
||||
|
||||
/* TODO: plugin-specific clear call? */
|
||||
|
||||
|
@ -110,7 +110,7 @@ void device_clear(struct device *device)
|
|||
|
||||
void device_destroy(struct device *device)
|
||||
{
|
||||
int probenum;
|
||||
unsigned int probenum;
|
||||
|
||||
/* TODO: plugin-specific destroy call, need to decrease refcount in plugin */
|
||||
|
||||
|
@ -201,7 +201,7 @@ void device_probe_name(struct device *device, int probenum, char *name)
|
|||
void device_trigger_clear(struct device *device)
|
||||
{
|
||||
struct probe *p;
|
||||
int probenum;
|
||||
unsigned int probenum;
|
||||
|
||||
if(device->probes)
|
||||
for(probenum = 1; probenum <= g_slist_length(device->probes); probenum++)
|
||||
|
|
3
filter.c
3
filter.c
|
@ -29,7 +29,8 @@
|
|||
int filter_probes(int in_unitsize, int out_unitsize, int *probelist,
|
||||
char *data_in, uint64_t length_in, char **data_out, uint64_t *length_out)
|
||||
{
|
||||
int num_enabled_probes, in_offset, out_offset, out_bit, i;
|
||||
unsigned int in_offset, out_offset;
|
||||
int num_enabled_probes, out_bit, i;
|
||||
uint64_t sample_in, sample_out;
|
||||
|
||||
*data_out = malloc(length_in);
|
||||
|
|
|
@ -48,7 +48,7 @@ GSList *list_serial_ports(void)
|
|||
{
|
||||
glob_t g;
|
||||
GSList *ports;
|
||||
int i, j;
|
||||
unsigned int i, j;
|
||||
|
||||
ports = NULL;
|
||||
for(i = 0; serial_port_glob[i]; i++)
|
||||
|
|
|
@ -448,7 +448,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
|
|||
|
||||
static int receive_data(int fd, int revents, void *user_data)
|
||||
{
|
||||
static int num_transfers = 0;
|
||||
static unsigned int num_transfers = 0;
|
||||
static int num_bytes = 0;
|
||||
static char last_sample[4] = {0xff};
|
||||
static unsigned char sample[4] = {0}, tmp_sample[4];
|
||||
|
@ -672,6 +672,9 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
|
|||
{
|
||||
struct datafeed_packet packet;
|
||||
|
||||
/* QUICK HACK */
|
||||
device_index = device_index;
|
||||
|
||||
packet.type = DF_END;
|
||||
packet.length = 0;
|
||||
session_bus(session_device_id, &packet);
|
||||
|
|
|
@ -66,7 +66,7 @@ static GSList *device_instances = NULL;
|
|||
* upgrade -- this is like a global lock. No device will open until a proper
|
||||
* delay after the last device was upgraded.
|
||||
*/
|
||||
GTimeVal firmware_updated = { 0 };
|
||||
GTimeVal firmware_updated = { 0, 0 };
|
||||
|
||||
static libusb_context *usb_context = NULL;
|
||||
|
||||
|
@ -197,8 +197,8 @@ static int opendev2(int device_index, struct sigrok_device_instance **sdi,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int opendev3(int device_index, struct sigrok_device_instance **sdi,
|
||||
libusb_device *dev, struct libusb_device_descriptor *des)
|
||||
static int opendev3(struct sigrok_device_instance **sdi, libusb_device *dev,
|
||||
struct libusb_device_descriptor *des)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
@ -259,7 +259,7 @@ struct sigrok_device_instance *sl_open_device(int device_index)
|
|||
libusb_get_device_list(usb_context, &devlist);
|
||||
for (i = 0; devlist[i]; i++) {
|
||||
/* TODO: Error handling. */
|
||||
err = opendev3(device_index, &sdi, devlist[i], &des);
|
||||
err = opendev3(&sdi, devlist[i], &des);
|
||||
}
|
||||
} else {
|
||||
/* Status must be ST_ACTIVE, i.e. already in use... */
|
||||
|
@ -356,6 +356,9 @@ static int hw_init(char *deviceinfo)
|
|||
libusb_device **devlist;
|
||||
int err, devcnt, i;
|
||||
|
||||
/* QUICK HACK */
|
||||
deviceinfo = deviceinfo;
|
||||
|
||||
if (libusb_init(&usb_context) != 0) {
|
||||
g_warning("Failed to initialize USB.");
|
||||
return 0;
|
||||
|
@ -581,13 +584,18 @@ static int receive_data(int fd, int revents, void *user_data)
|
|||
{
|
||||
struct timeval tv;
|
||||
|
||||
/* QUICK HACK */
|
||||
fd = fd;
|
||||
revents = revents;
|
||||
user_data = user_data;
|
||||
|
||||
tv.tv_sec = tv.tv_usec = 0;
|
||||
libusb_handle_events_timeout(usb_context, &tv);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void trigger_helper(int i, unsigned char *cur_buf, int cur_buflen,
|
||||
static void trigger_helper(int i, unsigned char *cur_buf,
|
||||
struct datafeed_packet *packet, void *user_data,
|
||||
int *trigger_offset)
|
||||
{
|
||||
|
@ -698,8 +706,8 @@ void receive_transfer(struct libusb_transfer *transfer)
|
|||
trigger_offset = 0;
|
||||
if (trigger_stage >= 0) {
|
||||
for (i = 0; i < cur_buflen; i++) {
|
||||
trigger_helper(i, cur_buf, cur_buflen, &packet,
|
||||
user_data, &trigger_offset);
|
||||
trigger_helper(i, cur_buf, &packet, user_data,
|
||||
&trigger_offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -712,7 +720,7 @@ void receive_transfer(struct libusb_transfer *transfer)
|
|||
g_free(cur_buf);
|
||||
|
||||
num_samples += cur_buflen;
|
||||
if (num_samples > limit_samples) {
|
||||
if ((unsigned int)num_samples > limit_samples) {
|
||||
/* End the acquisition. */
|
||||
packet.type = DF_END;
|
||||
session_bus(user_data, &packet);
|
||||
|
@ -787,6 +795,9 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
|
|||
{
|
||||
struct datafeed_packet packet;
|
||||
|
||||
/* QUICK HACK */
|
||||
device_index = device_index;
|
||||
|
||||
packet.type = DF_END;
|
||||
session_bus(session_device_id, &packet);
|
||||
|
||||
|
|
|
@ -137,7 +137,8 @@ struct sigrok_device_instance *zp_open_device(int device_index)
|
|||
struct sigrok_device_instance *sdi;
|
||||
libusb_device **devlist;
|
||||
struct libusb_device_descriptor des;
|
||||
int err, i, j;
|
||||
unsigned int j;
|
||||
int err, i;
|
||||
|
||||
if(!(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
return NULL;
|
||||
|
@ -263,6 +264,9 @@ static int hw_init(char *deviceinfo)
|
|||
libusb_device **devlist;
|
||||
int err, devcnt, i;
|
||||
|
||||
/* QUICK HACK */
|
||||
deviceinfo = deviceinfo;
|
||||
|
||||
if(libusb_init(&usb_context) != 0) {
|
||||
g_warning("Failed to initialize USB.");
|
||||
return 0;
|
||||
|
@ -416,12 +420,11 @@ static int hw_get_status(int device_index)
|
|||
|
||||
static int *hw_get_capabilities(void)
|
||||
{
|
||||
|
||||
return capabilities;
|
||||
}
|
||||
|
||||
// XXX this will set the same samplerate for all devices
|
||||
int set_configuration_samplerate(struct sigrok_device_instance *sdi, uint64_t samplerate)
|
||||
static int set_configuration_samplerate(uint64_t samplerate)
|
||||
{
|
||||
g_message("%s(%llu)", __FUNCTION__, samplerate);
|
||||
if (samplerate > MHZ(1))
|
||||
|
@ -447,7 +450,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
|
|||
switch (capability) {
|
||||
case HWCAP_SAMPLERATE:
|
||||
tmp_u64 = value;
|
||||
return set_configuration_samplerate(sdi, *tmp_u64);
|
||||
return set_configuration_samplerate(*tmp_u64);
|
||||
|
||||
case HWCAP_PROBECONFIG:
|
||||
return configure_probes( (GSList *) value);
|
||||
|
@ -467,7 +470,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
|||
struct datafeed_packet packet;
|
||||
struct datafeed_header header;
|
||||
int res;
|
||||
int packet_num;
|
||||
unsigned int packet_num;
|
||||
unsigned char *buf;
|
||||
|
||||
if( !(sdi = get_sigrok_device_instance(device_instances, device_index)))
|
||||
|
|
|
@ -137,6 +137,8 @@ struct usb_device_instance *usb_device_instance_new(uint8_t bus, uint8_t address
|
|||
|
||||
void usb_device_instance_free(struct usb_device_instance *usb)
|
||||
{
|
||||
/* QUICK HACK */
|
||||
usb = usb;
|
||||
|
||||
/* nothing to do for this device instance type */
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
#include "config.h"
|
||||
|
||||
struct context {
|
||||
int num_enabled_probes;
|
||||
int unitsize;
|
||||
unsigned int num_enabled_probes;
|
||||
unsigned int unitsize;
|
||||
char *probelist[65];
|
||||
char *header;
|
||||
};
|
||||
|
@ -48,7 +48,8 @@ static int init(struct output *o)
|
|||
struct probe *probe;
|
||||
GSList *l;
|
||||
uint64_t samplerate;
|
||||
int i, b, num_probes;
|
||||
unsigned int i;
|
||||
int b, num_probes;
|
||||
char *c, *samplerate_s;
|
||||
char wbuf[1000];
|
||||
|
||||
|
@ -128,7 +129,7 @@ static int data(struct output *o, char *data_in, uint64_t length_in,
|
|||
char **data_out, uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
int offset, outsize, p, curbit;
|
||||
unsigned int offset, outsize, p, curbit;
|
||||
uint64_t sample, count = 0;
|
||||
char *outbuf, *c;
|
||||
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
#define DEFAULT_BPL_HEX 256
|
||||
|
||||
struct context {
|
||||
int num_enabled_probes;
|
||||
unsigned int num_enabled_probes;
|
||||
int samples_per_line;
|
||||
int unitsize;
|
||||
unsigned int unitsize;
|
||||
int line_offset;
|
||||
int linebuf_len;
|
||||
char *probelist[65];
|
||||
|
@ -40,7 +40,7 @@ struct context {
|
|||
};
|
||||
|
||||
|
||||
static void flush_linebufs(struct context *ctx, GSList *probes, char *outbuf)
|
||||
static void flush_linebufs(struct context *ctx, char *outbuf)
|
||||
{
|
||||
static int max_probename_len = 0;
|
||||
int len, i;
|
||||
|
@ -123,7 +123,7 @@ static int event(struct output *o, int event_type, char **data_out, uint64_t *le
|
|||
case DF_END:
|
||||
outsize = ctx->num_enabled_probes * (ctx->samples_per_line + 20) + 512;
|
||||
outbuf = calloc(1, outsize);
|
||||
flush_linebufs(ctx, o->device->probes, outbuf);
|
||||
flush_linebufs(ctx, outbuf);
|
||||
*data_out = outbuf;
|
||||
*length_out = strlen(outbuf);
|
||||
free(o->internal);
|
||||
|
@ -146,7 +146,7 @@ static int init_binary(struct output *o)
|
|||
static int data_binary(struct output *o, char *data_in, uint64_t length_in, char **data_out, uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
int outsize, offset, p;
|
||||
unsigned int outsize, offset, p;
|
||||
uint64_t sample;
|
||||
char *outbuf;
|
||||
|
||||
|
@ -183,7 +183,7 @@ static int data_binary(struct output *o, char *data_in, uint64_t length_in, char
|
|||
|
||||
/* end of line */
|
||||
if(ctx->spl_cnt >= ctx->samples_per_line) {
|
||||
flush_linebufs(ctx, o->device->probes, outbuf);
|
||||
flush_linebufs(ctx, outbuf);
|
||||
ctx->line_offset = ctx->spl_cnt = 0;
|
||||
}
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ static int init_hex(struct output *o)
|
|||
static int data_hex(struct output *o, char *data_in, uint64_t length_in, char **data_out, uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
int outsize, offset, p;
|
||||
unsigned int outsize, offset, p;
|
||||
uint64_t sample;
|
||||
char *outbuf;
|
||||
|
||||
|
@ -244,7 +244,7 @@ static int data_hex(struct output *o, char *data_in, uint64_t length_in, char **
|
|||
|
||||
/* end of line */
|
||||
if(ctx->spl_cnt >= ctx->samples_per_line) {
|
||||
flush_linebufs(ctx, o->device->probes, outbuf);
|
||||
flush_linebufs(ctx, outbuf);
|
||||
ctx->line_offset = ctx->spl_cnt = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,7 +137,8 @@ static int data(struct output *o, char *data_in, uint64_t length_in,
|
|||
char **data_out, uint64_t *length_out)
|
||||
{
|
||||
struct context *ctx;
|
||||
int offset, outsize, p, curbit, prevbit;
|
||||
unsigned int offset, outsize;
|
||||
int p, curbit, prevbit;
|
||||
uint64_t sample, prevsample;
|
||||
char *outbuf, *c;
|
||||
|
||||
|
|
|
@ -28,13 +28,16 @@
|
|||
struct session *session;
|
||||
|
||||
|
||||
struct session *session_load(char *filename)
|
||||
struct session *session_load(const char *filename)
|
||||
{
|
||||
struct session *session;
|
||||
|
||||
/* TODO: implement */
|
||||
session = NULL;
|
||||
|
||||
/* QUICK HACK */
|
||||
filename = filename;
|
||||
|
||||
return session;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue