@@ -107,7 +107,7 @@ rte_cfgfile_load(const char *filename, int flags)
memset(cfg->sections, 0, sizeof(cfg->sections[0]) * allocated_sections);
- while (fgets(buffer, sizeof(buffer), f) != NULL) {
+ while (fgets(buffer, (int)sizeof(buffer), f) != NULL) {
char *pos = NULL;
size_t len = strnlen(buffer, sizeof(buffer));
lineno++;
@@ -134,7 +134,7 @@ eal_parse_sysfs_value(const char *filename, unsigned long *val)
return -1;
}
- if (fgets(buf, sizeof(buf), f) == NULL) {
+ if (fgets(buf, (int)sizeof(buf), f) == NULL) {
RTE_LOG(ERR, EAL, "%s(): cannot read sysfs value %s\n",
__func__, filename);
fclose(f);
@@ -115,7 +115,7 @@ get_default_hp_size(void)
FILE *fd = fopen(proc_meminfo, "r");
if (fd == NULL)
rte_panic("Cannot open %s\n", proc_meminfo);
- while(fgets(buffer, sizeof(buffer), fd)){
+ while (fgets(buffer, (int)sizeof(buffer), fd)) {
if (strncmp(buffer, str_hugepagesz, hugepagesz_len) == 0){
size = rte_str_to_size(&buffer[hugepagesz_len]);
break;
@@ -155,7 +155,7 @@ get_hugepage_dir(uint64_t hugepage_sz)
if (default_size == 0)
default_size = get_default_hp_size();
- while (fgets(buf, sizeof(buf), fd)){
+ while (fgets(buf, (int)sizeof(buf), fd)) {
if (rte_strsplit(buf, sizeof(buf), splitstr, _FIELDNAME_MAX,
split_tok) != _FIELDNAME_MAX) {
RTE_LOG(ERR, EAL, "Error parsing %s\n", proc_mounts);
@@ -614,7 +614,7 @@ find_numasocket(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi)
"%s/%s", hpi->hugedir, internal_config.hugefile_prefix);
/* parse numa map */
- while (fgets(buf, sizeof(buf), f) != NULL) {
+ while (fgets(buf, (int)sizeof(buf), f) != NULL) {
/* ignore non huge page */
if (strstr(buf, " huge ") == NULL &&
@@ -162,7 +162,7 @@ pci_parse_sysfs_resource(const char *filename, struct rte_pci_device *dev)
for (i = 0; i<PCI_MAX_RESOURCE; i++) {
- if (fgets(buf, sizeof(buf), f) == NULL) {
+ if (fgets(buf, (int)sizeof(buf), f) == NULL) {
RTE_LOG(ERR, EAL,
"%s(): cannot read resource\n", __func__);
goto error;
@@ -253,7 +253,7 @@ check_tsc_flags(void)
return;
}
- while (fgets(line, sizeof line, stream)) {
+ while (fgets(line, (int)sizeof(line), stream)) {
char *constant_tsc;
char *nonstop_tsc;
@@ -832,7 +832,7 @@ parse_sysfs_value(const char *filename, unsigned long *val)
return -1;
}
- if (fgets(buf, sizeof(buf), f) == NULL) {
+ if (fgets(buf, (int)sizeof(buf), f) == NULL) {
PMD_INIT_LOG(ERR, "%s(): cannot read sysfs value %s",
__func__, filename);
fclose(f);
@@ -164,7 +164,7 @@ power_set_governor_userspace(struct rte_power_info *pi)
f = fopen(fullpath, "rw+");
FOPEN_OR_ERR_RET(f, ret);
- s = fgets(buf, sizeof(buf), f);
+ s = fgets(buf, (int)sizeof(buf), f);
FOPS_OR_NULL_GOTO(s, out);
/* Check if current governor is userspace */
@@ -214,7 +214,7 @@ power_get_available_freqs(struct rte_power_info *pi)
f = fopen(fullpath, "r");
FOPEN_OR_ERR_RET(f, ret);
- s = fgets(buf, sizeof(buf), f);
+ s = fgets(buf, (int)sizeof(buf), f);
FOPS_OR_NULL_GOTO(s, out);
/* Strip the line break if there is */
@@ -223,7 +223,7 @@ power_get_available_freqs(struct rte_power_info *pi)
*p = 0;
/* Split string into at most RTE_MAX_LCORE_FREQS frequencies */
- count = rte_strsplit(buf, sizeof(buf), freqs,
+ count = rte_strsplit(buf, (int)sizeof(buf), freqs,
RTE_MAX_LCORE_FREQS, ' ');
if (count <= 0) {
RTE_LOG(ERR, POWER, "No available frequency in "
@@ -270,7 +270,7 @@ power_init_for_setting_freq(struct rte_power_info *pi)
f = fopen(fullpath, "rw+");
FOPEN_OR_ERR_RET(f, -1);
- s = fgets(buf, sizeof(buf), f);
+ s = fgets(buf, (int)sizeof(buf), f);
FOPS_OR_NULL_GOTO(s, out);
freq = strtoul(buf, NULL, POWER_CONVERT_TO_DECIMAL);
@@ -367,7 +367,7 @@ power_set_governor_original(struct rte_power_info *pi)
f = fopen(fullpath, "rw+");
FOPEN_OR_ERR_RET(f, ret);
- s = fgets(buf, sizeof(buf), f);
+ s = fgets(buf, (int)sizeof(buf), f);
FOPS_OR_NULL_GOTO(s, out);
/* Check if the governor to be set is the same as current */