diff options
Diffstat (limited to 'xbee')
-rw-r--r-- | xbee/packxbee.c | 18 | ||||
-rw-r--r-- | xbee/unpackxbee.c | 12 |
2 files changed, 23 insertions, 7 deletions
diff --git a/xbee/packxbee.c b/xbee/packxbee.c index b4cfae5..2355896 100644 --- a/xbee/packxbee.c +++ b/xbee/packxbee.c @@ -134,7 +134,11 @@ static void packxbee_TX(t_packxbee *x, t_symbol *s, int argc, t_atom *argv) error("packxbee_TX: first argument is not a hex string"); return; } - if (x->x_verbosity > 0) post ("packxbee_TX: dest64:0x%I64X", dest64); +#ifdef _MSC_VER + if (x->x_verbosity > 0) post ("packxbee_TX: dest64:0x%016I64X", dest64); +#else + if (x->x_verbosity > 0) post ("packxbee_TX: dest64:0x%016LX", dest64); +#endif /* second arg is dest16 also a symbol starting with "0x" */ if (argv[1].a_type != A_SYMBOL) { @@ -244,7 +248,7 @@ static void packxbee_TX(t_packxbee *x, t_symbol *s, int argc, t_atom *argv) { if (x->x_verbosity > 0) post("packxbee_TX symbol parameter %s", argv[k].a_w.w_symbol->s_name); j = i; - i += sprintf(&floatstring[i], "%s", argv[k].a_w.w_symbol->s_name); + i += sprintf((char *)&floatstring[i], "%s", argv[k].a_w.w_symbol->s_name); for (;j < i; ++j) checksum -= floatstring[j]; } else @@ -336,7 +340,11 @@ static void packxbee_pack_remote_frame(t_packxbee *x, t_symbol *s, int argc, t_a error("packxbee_pack_remote_frame: first argument is not a hex string"); return; } - if (x->x_verbosity > 0) post ("packxbee_pack_remote_frame: dest64:0x%I64X", dest64); +#ifdef _MSC_VER + if (x->x_verbosity > 0) post ("packxbee_pack_remote_frame: dest64:0x%016I64X", dest64); +#else + if (x->x_verbosity > 0) post ("packxbee_pack_remote_frame: dest64:0x%016LX", dest64); +#endif /* second arg is dest16 also a symbol starting with "0x" */ if (argv[1].a_type != A_SYMBOL) { @@ -440,7 +448,7 @@ static void packxbee_pack_remote_frame(t_packxbee *x, t_symbol *s, int argc, t_a if (x->x_verbosity > 0) post("packxbee_pack_remote_frame symbol parameter %s", argv[4].a_w.w_symbol->s_name); if (('0' == argv[4].a_w.w_symbol->s_name[0])&&(('x' == argv[4].a_w.w_symbol->s_name[1]))) { /* this is a hexadecimal number: strip the "0x" and copy the rest to the buffer as ascii digits */ - i += sprintf(&floatstring[i], "%s", &argv[4].a_w.w_symbol->s_name[2]); + i += sprintf((char *)&floatstring[i], "%s", &argv[4].a_w.w_symbol->s_name[2]); } else // if ((0 == strncmp("NI", argv[0].a_w.w_symbol->s_name, 2))||(0 == strncmp("DN", argv[0].a_w.w_symbol->s_name, 2))) { /* we hope it's just an ascii string for the NI command */ @@ -568,7 +576,7 @@ static void packxbee_pack_frame(t_packxbee *x, t_symbol *s, int argc, t_atom *ar if (x->x_verbosity > 0) post("packxbee_AT symbol parameter %s", argv[1].a_w.w_symbol->s_name); if (('0' == argv[1].a_w.w_symbol->s_name[0])&&(('x' == argv[1].a_w.w_symbol->s_name[1]))) { /* this is a hexadecimal number: strip the "0x" and copy the rest to the buffer as ascii digits */ - i += sprintf(&floatstring[i], "%s", &argv[1].a_w.w_symbol->s_name[2]); + i += sprintf((char *)&floatstring[i], "%s", &argv[1].a_w.w_symbol->s_name[2]); } else // if ((0 == strncmp("NI", argv[0].a_w.w_symbol->s_name, 2))||(0 == strncmp("DN", argv[0].a_w.w_symbol->s_name, 2))) { /* we hope it's just an ascii string for the NI command */ diff --git a/xbee/unpackxbee.c b/xbee/unpackxbee.c index 35f36e3..2e43c57 100644 --- a/xbee/unpackxbee.c +++ b/xbee/unpackxbee.c @@ -281,7 +281,11 @@ buf[9]: 214 [0xD6] addr64 |= x->x_message[16];
addr64 <<= 8;
addr64 |= x->x_message[17];
- sprintf(floatstring, "0x%I64X", addr64);
+#ifdef _MSC_VER
+ sprintf(floatstring, "0x%016I64X", addr64);
+#else
+ sprintf(floatstring, "0x%016LX", addr64);
+#endif
SETSYMBOL(&x->x_statusbuf[statuslength], gensym(floatstring)); /* addr64 */
statuslength++;
/*
@@ -399,7 +403,11 @@ buf[28]: 36 [0x24] checksum addr64 |= x->x_message[i++];
addr64 <<= 8;
addr64 |= x->x_message[i++];
- sprintf(floatstring, "0x%I64X", addr64);
+#ifdef _MSC_VER
+ sprintf(floatstring, "0x%016I64X", addr64);
+#else
+ sprintf(floatstring, "0x%016LX", addr64);
+#endif
SETSYMBOL(&x->x_statusbuf[statuslength], gensym(floatstring)); /* addr64 */
statuslength++;
/* 16-bit source address */
|