Block Resolver: Use explicit type conversion
@@ -190,7 +190,7 @@ static long getBlockEnd (FILE * fp, const char * identifier, long offset)
{
if (!strcmp (buffer + strlen (identifier) + 1, "stop\n"))
{
- position = ftell (fp) - strlen (buffer);
+ position = ftell (fp) - (long) strlen (buffer);
break;
}
else
@@ -206,7 +206,7 @@ static const char * getBlock (FILE * fp, const long startPos, const long endPos)
{
fseek (fp, startPos, SEEK_SET);
if (endPos <= startPos) return NULL;
- size_t blockSize = endPos - startPos;
+ size_t blockSize = (size_t) (endPos - startPos);
if (blockSize <= 0) return NULL;
char * block = elektraMalloc (blockSize + 1);
if (!block) return NULL;
@@ -294,7 +294,7 @@ int elektraBlockresolverGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned E
retVal = -1;
goto GET_CLEANUP;
}
- size_t blockSize = data->endPos - data->startPos;
+ size_t blockSize = (size_t) (data->endPos - data->startPos);
fwrite (block, 1, blockSize, fout);
retVal = 1;
++(data->getPass);
@@ -355,11 +355,11 @@ int elektraBlockresolverSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned E
ELEKTRA_SET_VALIDATION_SYNTACTIC_ERRORF (parentKey, "Failed to extract block before %s\n", data->identifier);
goto SET_CLEANUP;
}
- fwrite (block, 1, data->startPos, fout);
+ fwrite (block, 1, (size_t) data->startPos, fout);
fseek (fin, 0, SEEK_END);
elektraFree (block);
block = NULL;
- size_t blockSize = ftell (fin) - data->endPos;
+ size_t blockSize = (size_t) (ftell (fin) - data->endPos);
block = (char *) getBlock (fin, data->endPos, ftell (fin));
if (!block)
{
