Skip to content

Commit dc70371

Browse files
The print format for type uint64_t
1 parent c8d226b commit dc70371

File tree

12 files changed

+50
-46
lines changed

12 files changed

+50
-46
lines changed

DSView/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "pv/ui/langresource.h"
3838
#include <QDateTime>
3939
#include <string>
40+
#include <ds_types.h>
4041

4142
#ifdef _WIN32
4243
#include <windows.h>
@@ -216,7 +217,7 @@ bool bHighScale = true;
216217
std::string strTime = dateTime .toString("yyyy-MM-dd hh:mm:ss").toStdString();
217218
dsv_info("%s", strTime.c_str());
218219

219-
int bit_width = sizeof(long);
220+
int bit_width = sizeof(u64_t);
220221
if (bit_width != 8){
221222
dsv_err("Can only run on 64 bit systems");
222223
return 0;

DSView/pv/data/decoderstack.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
#include "../view/logicsignal.h"
3535
#include "../dsvdef.h"
3636
#include "../log.h"
37-
3837
#include "../ui/langresource.h"
38+
#include <ds_types.h>
3939

4040
using namespace pv::data::decode;
4141
using namespace std;
@@ -551,7 +551,8 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod
551551

552552
if (end_index >= align_sample_count){
553553
end_index = align_sample_count - 1;
554-
dsv_info("Reset the decode end sample, new:%lu, old:%lu", end_index, decode_end);
554+
dsv_info("Reset the decode end sample, new:%llu, old:%llu",
555+
(u64_t)end_index, (u64_t)decode_end);
555556
}
556557
}
557558
}
@@ -660,7 +661,7 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod
660661
}
661662
}
662663

663-
dsv_info("%s%lu", "send to decoder times: ", entry_cnt);
664+
dsv_info("%s%llu", "send to decoder times: ", (u64_t)entry_cnt);
664665

665666
if (error != NULL)
666667
g_free(error);
@@ -716,7 +717,8 @@ void DecoderStack::execute_decode_stack()
716717
decode_end = max(dec->decode_end(), decode_end);
717718
}
718719

719-
dsv_info("decoder start sample:%lu, end sample:%lu, count:%lu", decode_start, decode_end, decode_end - decode_start + 1);
720+
dsv_info("decoder start sample:%llu, end sample:%llu, count:%llu",
721+
(u64_t)decode_start, (u64_t)decode_end, (u64_t)(decode_end - decode_start + 1));
720722

721723
// Start the session
722724
srd_session_metadata_set(session, SRD_CONF_SAMPLERATE,

DSView/pv/prop/binding/decoderoptions.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ DecoderOptions::DecoderOptions(pv::data::DecoderStack* decoder_stack, data::deco
4646
_decoder(decoder)
4747
{
4848
assert(_decoder);
49+
(void)decoder_stack;
4950

5051
const srd_decoder *const dec = _decoder->decoder();
5152
assert(dec);

common/ds_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
#ifndef _DS_TYPES_H
3131
#define _DS_TYPES_H
3232

33-
typedef unsigned long u64_t;
33+
typedef unsigned long long u64_t;
3434

3535
#endif

libsigrok4DSL/hardware/DSL/dsl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2309,7 +2309,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
23092309
if (devc->abort)
23102310
devc->status = DSL_STOP;
23112311

2312-
sr_detail("%lu: receive_transfer(): status %d; timeout %d; received %d bytes.",
2312+
sr_detail("%llu: receive_transfer(): status %d; timeout %d; received %d bytes.",
23132313
(u64_t)g_get_monotonic_time(), transfer->status, transfer->timeout, transfer->actual_length);
23142314

23152315
switch (transfer->status) {
@@ -2441,7 +2441,7 @@ static void receive_header(struct libusb_transfer *transfer)
24412441
devc->status = DSL_ERROR;
24422442
if (!devc->abort && transfer->status == LIBUSB_TRANSFER_COMPLETED &&
24432443
trigger_pos->check_id == TRIG_CHECKID) {
2444-
sr_info("%lu: receive_trigger_pos(): status %d; timeout %d; received %d bytes.",
2444+
sr_info("%llu: receive_trigger_pos(): status %d; timeout %d; received %d bytes.",
24452445
(u64_t)g_get_monotonic_time(), transfer->status, transfer->timeout, transfer->actual_length);
24462446
remain_cnt = trigger_pos->remain_cnt_h;
24472447
remain_cnt = (remain_cnt << 32) + trigger_pos->remain_cnt_l;

libsigrok4DSL/hardware/demo/demo.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -919,11 +919,11 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
919919
{
920920
case SR_CONF_SAMPLERATE:
921921
vdev->samplerate = g_variant_get_uint64(data);
922-
sr_dbg("Setting samplerate to %lu.", (u64_t)vdev->samplerate);
922+
sr_dbg("Setting samplerate to %llu.", (u64_t)vdev->samplerate);
923923
break;
924924
case SR_CONF_LIMIT_SAMPLES:
925925
vdev->total_samples = g_variant_get_uint64(data);
926-
sr_dbg("Setting limit samples to %lu.", (u64_t)vdev->total_samples);
926+
sr_dbg("Setting limit samples to %llu.", (u64_t)vdev->total_samples);
927927
break;
928928
case SR_CONF_LIMIT_MSEC:
929929
break;
@@ -1034,7 +1034,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
10341034
g_timer_start(run_time);
10351035
vdev->timebase_change = TRUE;
10361036
}
1037-
sr_dbg("Setting timebase to %lu.", (u64_t)vdev->timebase);
1037+
sr_dbg("Setting timebase to %llu.", (u64_t)vdev->timebase);
10381038
break;
10391039
case SR_CONF_PROBE_COUPLING:
10401040
if(sdi->mode != LOGIC)

libsigrok4DSL/input/in_vcd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,11 @@ static gboolean parse_header(FILE *file, struct context *ctx)
236236
if (q % p != 0)
237237
{
238238
/* Does not happen unless time value is non-standard */
239-
sr_warn("Inexact rounding of samplerate, %lu / %lu to %lu Hz.",
239+
sr_warn("Inexact rounding of samplerate, %llu / %llu to %llu Hz.",
240240
(u64_t)q, (u64_t)p, (u64_t)ctx->samplerate);
241241
}
242242

243-
sr_dbg("Samplerate: %lu", (u64_t)ctx->samplerate);
243+
sr_dbg("Samplerate: %llu", (u64_t)ctx->samplerate);
244244
}
245245
else
246246
{
@@ -476,7 +476,7 @@ static void parse_contents(FILE *file, const struct sr_dev_inst *sdi, struct con
476476
prev_timestamp = timestamp - ctx->compress;
477477
}
478478

479-
sr_dbg("New timestamp: %lu", (u64_t)timestamp);
479+
sr_dbg("New timestamp: %llu", (u64_t)timestamp);
480480

481481
/* Generate samples from prev_timestamp up to timestamp - 1. */
482482
send_samples(sdi, prev_values, timestamp - prev_timestamp);

libsigrok4DSL/output/gnuplot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
212212
memcpy(ctx->prevsample, sample, logic->unitsize);
213213

214214
/* The first column is a counter (needed for gnuplot). */
215-
g_string_append_printf(*out, "%lu\t", (u64_t)ctx->samplecount-1);
215+
g_string_append_printf(*out, "%llu\t", (u64_t)ctx->samplecount-1);
216216

217217
/* The next columns are the values of all channels. */
218218
for (p = 0; p < ctx->num_enabled_channels; p++) {

libsigrok4DSL/session.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ static void datafeed_dump(const struct sr_datafeed_packet *packet)
290290
break;
291291
case SR_DF_LOGIC:
292292
logic = packet->payload;
293-
sr_dbg("bus: Received SR_DF_LOGIC packet (%lu bytes).",
293+
sr_dbg("bus: Received SR_DF_LOGIC packet (%llu bytes).",
294294
(u64_t)logic->length);
295295
break;
296296
case SR_DF_DSO:

libsigrok4DSL/session_driver.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,19 +1072,19 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
10721072
case SR_CONF_SAMPLERATE:
10731073
vdev->samplerate = g_variant_get_uint64(data);
10741074
samplerates[0] = vdev->samplerate;
1075-
sr_dbg("Setting samplerate to %lu.", (u64_t)vdev->samplerate);
1075+
sr_dbg("Setting samplerate to %llu.", (u64_t)vdev->samplerate);
10761076
break;
10771077
case SR_CONF_TIMEBASE:
10781078
vdev->timebase = g_variant_get_uint64(data);
1079-
sr_dbg("Setting timebase to %lu.", (u64_t)vdev->timebase);
1079+
sr_dbg("Setting timebase to %llu.", (u64_t)vdev->timebase);
10801080
break;
10811081
case SR_CONF_MAX_TIMEBASE:
10821082
vdev->max_timebase = g_variant_get_uint64(data);
1083-
sr_dbg("Setting max timebase to %lu.", (u64_t)vdev->max_timebase);
1083+
sr_dbg("Setting max timebase to %llu.", (u64_t)vdev->max_timebase);
10841084
break;
10851085
case SR_CONF_MIN_TIMEBASE:
10861086
vdev->min_timebase = g_variant_get_uint64(data);
1087-
sr_dbg("Setting min timebase to %lu.", (u64_t)vdev->min_timebase);
1087+
sr_dbg("Setting min timebase to %llu.", (u64_t)vdev->min_timebase);
10881088
break;
10891089
case SR_CONF_UNIT_BITS:
10901090
vdev->unit_bits = g_variant_get_byte(data);
@@ -1105,19 +1105,19 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
11051105
case SR_CONF_LIMIT_SAMPLES:
11061106
vdev->total_samples = g_variant_get_uint64(data);
11071107
samplecounts[0] = vdev->total_samples;
1108-
sr_dbg("Setting limit samples to %lu.", (u64_t)vdev->total_samples);
1108+
sr_dbg("Setting limit samples to %llu.", (u64_t)vdev->total_samples);
11091109
break;
11101110
case SR_CONF_TRIGGER_TIME:
11111111
vdev->trig_time = g_variant_get_int64(data);
1112-
sr_dbg("Setting trigger time to %lu.", (u64_t)vdev->trig_time);
1112+
sr_dbg("Setting trigger time to %llu.", (u64_t)vdev->trig_time);
11131113
break;
11141114
case SR_CONF_TRIGGER_POS:
11151115
vdev->trig_pos = g_variant_get_uint64(data);
1116-
sr_dbg("Setting trigger position to %lu.", (u64_t)vdev->trig_pos);
1116+
sr_dbg("Setting trigger position to %llu.", (u64_t)vdev->trig_pos);
11171117
break;
11181118
case SR_CONF_NUM_BLOCKS:
11191119
vdev->num_blocks = g_variant_get_uint64(data);
1120-
sr_dbg("Setting block number to %lu.", (u64_t)vdev->num_blocks);
1120+
sr_dbg("Setting block number to %llu.", (u64_t)vdev->num_blocks);
11211121
break;
11221122
case SR_CONF_CAPTURE_NUM_PROBES:
11231123
vdev->num_probes = g_variant_get_uint64(data);

0 commit comments

Comments
 (0)