Commit e03fafa5 authored by Federico Vaga's avatar Federico Vaga

sw: cppcheck fixes in tools

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent b469bcce
......@@ -126,7 +126,7 @@ int main(int argc, char *argv[])
{"help",no_argument, 0, 'h'},
{0, 0, 0, 0}
};
int opt_index = 0, err = 0;
int opt_index = 0, err;
char c;
long time1[3], time2[3];
......@@ -139,7 +139,6 @@ int main(int argc, char *argv[])
if (c == 'h') {
fau_help();
exit(1);
break;
}
if (c == 'V') {
print_version(argv[0]);
......
......@@ -57,7 +57,7 @@ int fau_write_attribute(enum fau_attribute attr, uint32_t val)
char buf[buf_len], fullpath[200];
/* convert val to string */
sprintf(buf,"%d",val);
sprintf(buf,"%u",val);
/* build the attribute path */
strcpy(fullpath, basepath);
strcat(fullpath, attribute[attr]);
......@@ -125,7 +125,7 @@ int main(int argc, char *argv[])
{"help",no_argument, 0, 'h'},
{0, 0, 0, 0}
};
int i, opt_index = 0, err = 0, cur_val;
int i, opt_index = 0, err = 0;
char c;
if (argc == 1) {
......@@ -175,7 +175,7 @@ int main(int argc, char *argv[])
printf("Sysfs path to device is: %s\n", basepath);
for (i = 0; i < FAU_TRIG_NUM_ATTR; ++i) {
cur_val = attrval[i];
int cur_val = attrval[i];
if (cur_val == -1) {
if (force)
cur_val = attrdef[i];
......
......@@ -41,7 +41,8 @@ static void print_version(char *pname)
int main(int argc, char **argv)
{
int fd, addr, count, usec, ret;
unsigned int addr;
int fd, count, usec, ret;
int64_t tics;
if ((argc == 2) &&
......@@ -84,8 +85,12 @@ int main(int argc, char **argv)
lseek(fd, addr, SEEK_SET);
ret = write(fd, b + 1, 1);
if (ret < 0)
break;
lseek(fd, addr, SEEK_SET);
ret = write(fd, b + 0, 1);
if (ret < 0)
break;
if (count > 1) {
tics += usec;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment