summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2012-11-09 11:41:11 -0500
committerMichael J. Chudobiak <mjc@avtechpulse.com>2012-11-09 11:41:11 -0500
commit16d6dea985b85ff596e98d4dc7f15f341ad6966b (patch)
tree445a695bc6c58849b0600af16bdd44ffe79f932e
parent65c7900768799338b143a024c64b32661a38200e (diff)
cppcheck fixes
-rw-r--r--bus.c8
-rw-r--r--dds.c2
2 files changed, 5 insertions, 5 deletions
diff --git a/bus.c b/bus.c
index 3f0dbc6..e733cdf 100644
--- a/bus.c
+++ b/bus.c
@@ -259,7 +259,7 @@ static int gpio_export(unsigned gpio_pin)
{
FILE* exportfile = fopen(GPIO_SYSFSPATH"/"GPIO_EXPORTNODE, "w");
if (exportfile != NULL) {
- fprintf(exportfile, "%d\n", gpio_pin);
+ fprintf(exportfile, "%u\n", gpio_pin);
fclose(exportfile);
return 0;
}
@@ -274,7 +274,7 @@ static int gpio_unexport(unsigned gpio_pin)
{
FILE* unexportfile = fopen(GPIO_SYSFSPATH"/"GPIO_UNEXPORTNODE, "w");
if (unexportfile != NULL) {
- fprintf(unexportfile, "%d\n", gpio_pin);
+ fprintf(unexportfile, "%u\n", gpio_pin);
fclose(unexportfile);
return 0;
}
@@ -288,7 +288,7 @@ static int gpio_unexport(unsigned gpio_pin)
static int gpio_changedirection(unsigned gpio_pin, bool out)
{
char path[PATHLEN];
- snprintf(path, PATHLEN, GPIO_SYSFSPATH"/gpio%d/"GPIO_DIRECTIONNODE, gpio_pin);
+ snprintf(path, PATHLEN, GPIO_SYSFSPATH"/gpio%u/"GPIO_DIRECTIONNODE, gpio_pin);
FILE* directionfile = fopen(path, "w");
if (directionfile != NULL) {
if (out) {
@@ -305,7 +305,7 @@ static int gpio_changedirection(unsigned gpio_pin, bool out)
static void gpio_getvaluenodepath(unsigned gpio_pin, char* buffer)
{
- snprintf(buffer, PATHLEN, GPIO_SYSFSPATH"/gpio%d/"GPIO_VALUENODE, gpio_pin);
+ snprintf(buffer, PATHLEN, GPIO_SYSFSPATH"/gpio%u/"GPIO_VALUENODE, gpio_pin);
}
/*
diff --git a/dds.c b/dds.c
index 8002d78..fe6a35d 100644
--- a/dds.c
+++ b/dds.c
@@ -36,7 +36,7 @@ void dds_setamplitude(float millivolts)
char scalebuff[64];
if (read(scalefd, scalebuff, sizeof(scalebuff))) {
- sscanf(scalebuff, "%f\n", &scale);
+ sscanf(scalebuff, "%10f\n", &scale); // the string should be ?.??? but round up the width a bit just in case
}
if (scale == 0) {