Merge pull request #19 from ShabbyX/master

Correct usage of ll in %d and %x
pull/30/head
Hans-Erik Floryd 2015-12-17 17:53:17 +01:00
commit 1654afc75f
2 changed files with 6 additions and 4 deletions

View File

@ -13,6 +13,7 @@
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include "ethercattype.h"
#include "nicdrv.h"
@ -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];
@ -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];

View File

@ -13,6 +13,7 @@
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include "ethercattype.h"
#include "nicdrv.h"
@ -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];
@ -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];