Skip to content

Commit 018189d

Browse files
rgetzpcercuei
authored andcommitted
iio-utils: remove warning from VS2019_Win64
scan.c(167,33): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data iio_writedev.c(500,65): warning C4244: '=': conversion from 'uint64_t' to 'unsigned int', possible loss of data iio_readdev.c(455,65): warning C4244: '=': conversion from 'uint64_t' to 'unsigned int', possible loss of data so just cast strlen to a (unsigned int); and use uint64_t as default Signed-off-by: Robin Getz <[email protected]>
1 parent 3a4e0b3 commit 018189d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

scan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ struct iio_scan_context * iio_create_scan_context(
164164

165165
if (backend) {
166166
/* Replace the colon separator with a comma. */
167-
len = strlen(ctx->backendopts);
167+
len = (unsigned int)strlen(ctx->backendopts);
168168
for (i = 0; i < len; i++)
169169
if (ctx->backendopts[i] == ':')
170170
ctx->backendopts[i] = ',';

tests/iio_readdev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,14 @@ int main(int argc, char **argv)
198198
unsigned int i, j, nb_channels;
199199
unsigned int nb_active_channels = 0;
200200
unsigned int buffer_size = SAMPLES_PER_READ;
201-
unsigned int refill_per_benchmark = REFILL_PER_BENCHMARK;
201+
uint64_t refill_per_benchmark = REFILL_PER_BENCHMARK;
202202
int c;
203203
struct iio_device *dev;
204204
ssize_t sample_size;
205205
ssize_t ret;
206206
struct option *opts;
207207
bool mib, benchmark = false;
208-
uint64_t before, after, rate, total;
208+
uint64_t before = 0, after, rate, total;
209209

210210
argw = dup_argv(MY_NAME, argc, argv);
211211

tests/iio_writedev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,14 @@ int main(int argc, char **argv)
209209
unsigned int i, j, nb_channels;
210210
unsigned int nb_active_channels = 0;
211211
unsigned int buffer_size = SAMPLES_PER_READ;
212-
unsigned int refill_per_benchmark = REFILL_PER_BENCHMARK;
212+
uint64_t refill_per_benchmark = REFILL_PER_BENCHMARK;
213213
int c;
214214
struct iio_device *dev;
215215
ssize_t sample_size;
216216
bool mib, cyclic_buffer = false, benchmark = false;
217217
ssize_t ret;
218218
struct option *opts;
219-
uint64_t before, after, rate, total;
219+
uint64_t before = 0, after, rate, total;
220220

221221
argw = dup_argv(MY_NAME, argc, argv);
222222

0 commit comments

Comments
 (0)