Skip to content

Commit

Permalink
quick: Changing fileoffset to int64_t instead of uint64_t
Browse files Browse the repository at this point in the history
Changing the fileoffset to int64_t to better match the input type for secure file API and resolve some warnings.

Signed-off-by: Tyler Erickson <tyler.erickson@seagate.com>
  • Loading branch information
vonericsen committed Aug 5, 2024
1 parent c7dff24 commit 700a625
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/openseachest_util_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -2386,7 +2386,7 @@ extern "C"
#define RAW_INPUT_FILE_OFFSET_FLAG rawInFileOffset
#define RAW_INPUT_OFFSET_ADJUST_BY_BLOCKS_FLAG rawInOffsetBlocks
#define RAW_INPUT_FILE_OFFSET_VAR \
uint64_t RAW_INPUT_FILE_OFFSET_FLAG = 0; \
int64_t RAW_INPUT_FILE_OFFSET_FLAG = 0; \
getOptBool RAW_INPUT_OFFSET_ADJUST_BY_BLOCKS_FLAG = goFalse;
#define RAW_INPUT_FILE_OFFSET_LONG_OPT_STRING "inputOffset"
#define RAW_INPUT_FILE_OFFSET_LONG_OPT { RAW_INPUT_FILE_OFFSET_LONG_OPT_STRING, required_argument, M_NULLPTR, 0 }
Expand Down
10 changes: 5 additions & 5 deletions utils/C/openSeaChest/openSeaChest_Raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,9 +635,9 @@ int main(int argc, char *argv[])
//set the offset to read the file at
//set the raw data length - but check the units first!
char* unit = M_NULLPTR;
if (get_And_Validate_Integer_Input_Uint64(optarg, &unit, ALLOW_UNIT_DATASIZE, &RAW_INPUT_FILE_OFFSET_FLAG))
if (get_And_Validate_Integer_Input_Int64(optarg, &unit, ALLOW_UNIT_DATASIZE, &RAW_INPUT_FILE_OFFSET_FLAG))
{
uint64_t multiplier = 1;
int64_t multiplier = 1;
if (strstr(optarg, "BLOCKS"))
{
//the user specified the number as a number of logical blocks, so adjust this after we know the device logical block size
Expand Down Expand Up @@ -672,7 +672,7 @@ int main(int argc, char *argv[])
print_Error_In_Cmd_Line_Args(RAW_INPUT_FILE_OFFSET_LONG_OPT_STRING, optarg);
exit(UTIL_EXIT_ERROR_IN_COMMAND_LINE);
}
RAW_INPUT_FILE_OFFSET_FLAG = C_CAST(uint64_t, RAW_INPUT_FILE_OFFSET_FLAG) * multiplier;
RAW_INPUT_FILE_OFFSET_FLAG = RAW_INPUT_FILE_OFFSET_FLAG * multiplier;
}
else
{
Expand Down Expand Up @@ -1304,7 +1304,7 @@ int main(int argc, char *argv[])
}
else
{
long int fileOffset = RAW_INPUT_FILE_OFFSET_FLAG;
int64_t fileOffset = RAW_INPUT_FILE_OFFSET_FLAG;
if (RAW_INPUT_OFFSET_ADJUST_BY_BLOCKS_FLAG)
{
fileOffset = deviceList[deviceIter].drive_info.deviceBlockSize * RAW_INPUT_FILE_OFFSET_FLAG;
Expand Down Expand Up @@ -1712,7 +1712,7 @@ int main(int argc, char *argv[])
}
else
{
long int fileOffset = RAW_INPUT_FILE_OFFSET_FLAG;
int64_t fileOffset = RAW_INPUT_FILE_OFFSET_FLAG;
if (RAW_INPUT_OFFSET_ADJUST_BY_BLOCKS_FLAG)
{
fileOffset = deviceList[deviceIter].drive_info.deviceBlockSize * RAW_INPUT_FILE_OFFSET_FLAG;
Expand Down

0 comments on commit 700a625

Please sign in to comment.