Skip to content

Commit

Permalink
Merge pull request OpenEtherCATsociety#19 from ShabbyX/master
Browse files Browse the repository at this point in the history
Correct usage of ll in %d and %x
  • Loading branch information
hefloryd committed Dec 17, 2015
2 parents b82ce4d + d54054f commit 1654afc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions test/linux/slaveinfo/slaveinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <stdio.h>
#include <string.h>
#include <inttypes.h>

#include "ethercattype.h"
#include "nicdrv.h"
Expand Down Expand Up @@ -155,7 +156,7 @@ char* SDO2string(uint16 slave, uint16 index, uint8 subidx, uint16 dtype)
break;
case ECT_INTEGER64:
i64 = (int64*) &usdo[0];
sprintf(hstr, "0x%16.16llx %lld", *i64, *i64);
sprintf(hstr, "0x%16.16"PRIx64" %"PRId64, *i64, *i64);
break;
case ECT_UNSIGNED8:
u8 = (uint8*) &usdo[0];
Expand All @@ -172,7 +173,7 @@ char* SDO2string(uint16 slave, uint16 index, uint8 subidx, uint16 dtype)
break;
case ECT_UNSIGNED64:
u64 = (uint64*) &usdo[0];
sprintf(hstr, "0x%16.16llx %llu", *u64, *u64);
sprintf(hstr, "0x%16.16"PRIx64" %"PRIu64, *u64, *u64);
break;
case ECT_REAL32:
sr = (float*) &usdo[0];
Expand Down
5 changes: 3 additions & 2 deletions test/win32/slaveinfo/slaveinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <stdio.h>
#include <string.h>
#include <inttypes.h>

#include "ethercattype.h"
#include "nicdrv.h"
Expand Down Expand Up @@ -155,7 +156,7 @@ char* SDO2string(uint16 slave, uint16 index, uint8 subidx, uint16 dtype)
break;
case ECT_INTEGER64:
i64 = (int64*) &usdo[0];
sprintf(hstr, "0x%16.16llx %lld", *i64, *i64);
sprintf(hstr, "0x%16.16"PRIx64" %"PRId64, *i64, *i64);
break;
case ECT_UNSIGNED8:
u8 = (uint8*) &usdo[0];
Expand All @@ -172,7 +173,7 @@ char* SDO2string(uint16 slave, uint16 index, uint8 subidx, uint16 dtype)
break;
case ECT_UNSIGNED64:
u64 = (uint64*) &usdo[0];
sprintf(hstr, "0x%16.16llx %llu", *u64, *u64);
sprintf(hstr, "0x%16.16"PRIx64" %"PRIu64, *u64, *u64);
break;
case ECT_REAL32:
sr = (float*) &usdo[0];
Expand Down

0 comments on commit 1654afc

Please sign in to comment.