Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Augeas: Use explicit type conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
sanssecours committed Dec 10, 2019
1 parent d4e2ccc commit b19cd99
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/plugins/augeas/augeas.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ int keySetOrderMeta (Key * key, int order)

if (result < 0) return result;

result = keySetMeta (key, "order", buffer);
result = (int) keySetMeta (key, "order", buffer);
elektraFree (buffer);
return result;
}
Expand Down Expand Up @@ -91,7 +91,7 @@ int elektraAugeasGenConf (KeySet * ks, Key * errorKey ELEKTRA_UNUSED)
keyAddBaseName (k, "config");
ksAppendKey (ks, keyDup (k));
keyAddBaseName (k, "lens");
p[0] = toupper (p[0]);
p[0] = (char) toupper (p[0]);
p[l - 1] = 's';
p[l - 2] = 'n';
p[l - 3] = 'l';
Expand Down Expand Up @@ -168,7 +168,7 @@ static Key * createKeyFromPath (Key * parentKey, const char * treePath)
Key * key = keyDup (parentKey);
const char * baseName = (treePath + strlen (AUGEAS_TREE_ROOT) + 1);

size_t baseSize = keyGetNameSize (key);
size_t baseSize = (size_t) keyGetNameSize (key);
size_t keyNameSize = strlen (baseName) + baseSize + 1;
char * newName = elektraMalloc (keyNameSize);

Expand Down Expand Up @@ -210,7 +210,7 @@ static int convertToKey (augeas * handle, const char * treePath, void * data)
/* setting the correct key order failed */
if (result < 0) return result;

result = ksAppendKey (conversionData->ks, key);
result = (int) ksAppendKey (conversionData->ks, key);

return result;
}
Expand Down Expand Up @@ -323,9 +323,9 @@ static char * loadFile (FILE * fh)

if (fileSize > 0)
{
content = elektraMalloc (fileSize * sizeof (char) + 1);
content = elektraMalloc ((size_t) fileSize * sizeof (char) + 1);
if (content == 0) return 0;
int readBytes = fread (content, sizeof (char), fileSize, fh);
int readBytes = (int) fread (content, sizeof (char), (size_t) fileSize, fh);

if (feof (fh) || ferror (fh) || readBytes != fileSize) return 0;

Expand Down Expand Up @@ -359,7 +359,7 @@ static int saveFile (augeas * augeasHandle, FILE * fh)
/* write the file */
if (value)
{
ret = fwrite (value, sizeof (char), strlen (value), fh);
ret = (int) fwrite (value, sizeof (char), strlen (value), fh);

if (feof (fh) || ferror (fh)) return -1;
}
Expand All @@ -371,9 +371,9 @@ static int saveTree (augeas * augeasHandle, KeySet * ks, const char * lensPath,
{
int ret = 0;

size_t prefixSize = keyGetNameSize (parentKey) - 1;
size_t arraySize = ksGetSize (ks);
Key ** keyArray = calloc (ksGetSize (ks), sizeof (Key *));
size_t prefixSize = (size_t) (keyGetNameSize (parentKey) - 1);
size_t arraySize = (size_t) ksGetSize (ks);
Key ** keyArray = calloc ((size_t) ksGetSize (ks), sizeof (Key *));
ret = elektraKsToMemArray (ks, keyArray);

if (ret < 0) goto memoryerror;
Expand Down Expand Up @@ -516,7 +516,7 @@ int elektraAugeasGet (Plugin * handle, KeySet * returned, Key * parentKey)

/* convert the augeas tree to an Elektra KeySet */
ksClear (returned);
KeySet * append = ksNew (ksGetSize (returned) * 2, KS_END);
KeySet * append = ksNew ((size_t) ksGetSize (returned) * 2, KS_END);

Key * key = keyDup (parentKey);
ksAppendKey (append, key);
Expand Down

0 comments on commit b19cd99

Please sign in to comment.