siglent-sds: Fix various compiler warnings.

src/hardware/siglent-sds/protocol.c: In function 'siglent_sds_get_digital':
  src/hardware/siglent-sds/protocol.c:382:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          if (data_low_channels->len <= samples_index) {
                                     ^
  src/hardware/siglent-sds/protocol.c:391:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          if (data_high_channels->len <= samples_index) {
                                      ^
  src/hardware/siglent-sds/protocol.c:417:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (long index = 0; index < tmp_samplebuf->len; index++) {
                                  ^
  In file included from src/hardware/siglent-sds/protocol.c:37:0:
  src/hardware/siglent-sds/protocol.c: In function 'siglent_sds_receive':
  src/hardware/siglent-sds/protocol.h:28:20: warning: format '%li' expects argument of type 'long int', but argument 3 has type 'uint64_t {aka long long unsigned int}' [-Wformat=]
   #define LOG_PREFIX "siglent-sds"
                      ^
  ./src/libsigrok-internal.h:815:41: note: in expansion of macro 'LOG_PREFIX'
   #define sr_dbg(...) sr_log(SR_LOG_DBG,  LOG_PREFIX ": " __VA_ARGS__)
                                           ^
  src/hardware/siglent-sds/protocol.c:564:6: note: in expansion of macro 'sr_dbg'
        sr_dbg("Requesting: %li bytes.", devc->num_samples - devc->num_block_bytes);
        ^
  src/hardware/siglent-sds/protocol.c: In function 'siglent_sds_get_dev_cfg_horizontal':
  src/hardware/siglent-sds/protocol.h:28:20: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint64_t {aka long long unsigned int}' [-Wformat=]
   #define LOG_PREFIX "siglent-sds"
                      ^
  ./src/libsigrok-internal.h:815:41: note: in expansion of macro 'LOG_PREFIX'
   #define sr_dbg(...) sr_log(SR_LOG_DBG,  LOG_PREFIX ": " __VA_ARGS__)
                                           ^
  src/hardware/siglent-sds/protocol.c:933:2: note: in expansion of macro 'sr_dbg'
    sr_dbg("Current memory depth: %lu.", devc->memory_depth_analog);
    ^
This commit is contained in:
Uwe Hermann 2020-05-02 15:39:26 +02:00
parent 4704f64551
commit 4c5ac0cf5b
1 changed files with 4 additions and 4 deletions

View File

@ -348,7 +348,7 @@ static int siglent_sds_get_digital(const struct sr_dev_inst *sdi, struct sr_chan
gboolean low_channels; /* Lower channels enabled */
gboolean high_channels; /* Higher channels enabled */
int len, channel_index;
long samples_index;
uint64_t samples_index;
len = 0;
channel_index = 0;
@ -414,7 +414,7 @@ static int siglent_sds_get_digital(const struct sr_dev_inst *sdi, struct sr_chan
}
/* Storing the converted temp values from the the scope into the buffers. */
for (long index = 0; index < tmp_samplebuf->len; index++) {
for (uint64_t index = 0; index < tmp_samplebuf->len; index++) {
uint8_t value = g_array_index(tmp_samplebuf, uint8_t, index);
if (ch->index < 8)
g_array_append_val(data_low_channels, value);
@ -561,7 +561,7 @@ SR_PRIV int siglent_sds_receive(int fd, int revents, void *cb_data)
devc->buffer += devc->block_header_size;
len = devc->num_samples;
} else {
sr_dbg("Requesting: %li bytes.", devc->num_samples - devc->num_block_bytes);
sr_dbg("Requesting: %" PRIu64 " bytes.", devc->num_samples - devc->num_block_bytes);
len = sr_scpi_read_data(scpi, (char *)devc->buffer, devc->num_samples-devc->num_block_bytes);
if (len == -1) {
sr_err("Read error, aborting capture.");
@ -930,7 +930,7 @@ SR_PRIV int siglent_sds_get_dev_cfg_horizontal(const struct sr_dev_inst *sdi)
sr_dbg("Current timebase: %g.", devc->timebase);
devc->samplerate = devc->memory_depth_analog / (devc->timebase * devc->model->series->num_horizontal_divs);
sr_dbg("Current samplerate: %0f.", devc->samplerate);
sr_dbg("Current memory depth: %lu.", devc->memory_depth_analog);
sr_dbg("Current memory depth: %" PRIu64 ".", devc->memory_depth_analog);
return SR_OK;
}