diff options
author | PA4WDH | 2024-08-26 19:56:17 +0200 |
---|---|---|
committer | PA4WDH | 2024-08-26 19:56:17 +0200 |
commit | f47ea91e2d1b04aea2c23f40c98801e948d7a950 (patch) | |
tree | a949edc52e7ad7bbb2413107fd29ab1dc5af85c9 | |
parent | Small fixes in cpulist.c (diff) | |
download | cputemp2maxfreq-f47ea91e2d1b04aea2c23f40c98801e948d7a950.tar.gz cputemp2maxfreq-f47ea91e2d1b04aea2c23f40c98801e948d7a950.tar.bz2 cputemp2maxfreq-f47ea91e2d1b04aea2c23f40c98801e948d7a950.zip |
Add more compiler warnings
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | argparse.c | 4 | ||||
-rw-r--r-- | cpulist.c | 4 | ||||
-rw-r--r-- | cputemp.c | 2 | ||||
-rw-r--r-- | sysfs.c | 8 | ||||
-rw-r--r-- | sysfs.h | 2 |
6 files changed, 11 insertions, 11 deletions
@@ -1,5 +1,5 @@ CC=gcc -CFLAGS=-Wall -Werror +CFLAGS=-Wall -Wformat -Wconversion -Wtrampolines -Wimplicit-fallthrough -Werror cputemp2maxfreq: version.o debug.o sysfs.o cpufreq.o failsafe.o argparse.o logger.o cputemp.o cpulist.o @@ -120,14 +120,14 @@ void argparse(int argc, char **argv) userconfig.log_data=1; break; case 'p': - userconfig.interval=strtoll(optarg,NULL,10); + userconfig.interval=(unsigned int) strtoll(optarg,NULL,10); break; case 'P': if (strcmp(optarg,"all")==0) { userconfig.cpu=-1; } else { - userconfig.cpu=strtoll(optarg,NULL,10); + userconfig.cpu=(int) strtoll(optarg,NULL,10); } break; case 's': @@ -19,7 +19,7 @@ void cpulist_add(char *cpu) int newlen; newlen=cpudata.cpulist_len+1; - cpudata.cpulist=reallocarray(cpudata.cpulist,newlen,sizeof(char *)); + cpudata.cpulist=reallocarray(cpudata.cpulist,(size_t) newlen,sizeof(char *)); cpudata.cpulist[cpudata.cpulist_len]=malloc(strlen(cpu)+1); strcpy(cpudata.cpulist[cpudata.cpulist_len],cpu); @@ -77,7 +77,7 @@ int cpulist_find_cpus() { DEBUG2_CPULIST("Found CPU %s\n",cpu_dirent->d_name); snprintf(sysfs_file,309,"/sys/devices/system/cpu/%s/topology/physical_package_id",cpu_dirent->d_name); - package=sysfs_read_long_int(sysfs_file); + package=(int) sysfs_read_long_int(sysfs_file); DEBUG2_CPULIST("CPU Belongs to package id %d\n",package); if ((package==config.cpu) || (config.cpu<0)) { @@ -102,7 +102,7 @@ void cputemp_read_hwmon(char *hwmon,char *sensor_name,struct s_sensor *sensor) DEBUG2_CPUTEMP("Found label %s\n",hwmon_dirent->d_name); snprintf(name_file,258,"%s/%s",hwmon,hwmon_dirent->d_name); snprintf(input_file,258,"%s/%s",hwmon,hwmon_dirent->d_name); - offset=strlen(input_file)-5; + offset=(int) strlen(input_file)-5; strncpy(input_file+offset,"input",6); cputemp_match_and_validate(name_file,input_file,sensor_name,sensor); } @@ -12,7 +12,7 @@ extern struct s_config config; int sysfs_read_str(char *sysfs_file,char *buf,size_t bufsize) { int sysfs_handle; - size_t datalen; + ssize_t datalen; DEBUG1_SYSFS("Reading sysfs file %s\n",sysfs_file); @@ -35,7 +35,7 @@ int sysfs_read_str(char *sysfs_file,char *buf,size_t bufsize) buf[datalen]=0; } - return datalen; + return (int) datalen; } long int sysfs_read_long_int(char *sysfs_file) @@ -54,7 +54,7 @@ long int sysfs_read_long_int(char *sysfs_file) int sysfs_write_str(char *sysfs_file,char *value,long int checkdelay) { int sysfs_handle; - size_t len; + ssize_t len; char buf[255]; DEBUG1_SYSFS("Writing %s to sysfs file %s\n",value,sysfs_file); @@ -75,7 +75,7 @@ int sysfs_write_str(char *sysfs_file,char *value,long int checkdelay) DEBUG2_SYSFS("Written %zd bytes\n",len); // Wait if instructed to - if (checkdelay>0) usleep(checkdelay); + if (checkdelay>0) usleep((unsigned int) checkdelay); // Validate we actually set what we want to set sysfs_read_str(sysfs_file,buf,sizeof(buf)); @@ -3,6 +3,6 @@ int sysfs_read_str(char *sysfs_file,char *buf,size_t bufsize); long int sysfs_read_long_int(char *sysfs_file); -int sysfs_write_str(char *sysfs_file,char *value,int checkdelay); +int sysfs_write_str(char *sysfs_file,char *value,long int checkdelay); #endif |