Skip to content

Commit

Permalink
Use atol instead of atoi when reading offset
Browse files Browse the repository at this point in the history
  • Loading branch information
wangvsa committed May 25, 2022
1 parent 951e4d6 commit ade8ace
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tools/build_offset_intervals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,25 +127,25 @@ void handle_data_operation(RRecord &rr,
if(strstr(func, "writev") || strstr(func, "readv")) {
filename = R->args[0];
I.offset = offset_book[filename];
I.count = atoi(R->args[1]);
I.count = atol(R->args[1]);
offset_book[filename] += I.count;
} else if(strstr(func, "fwrite") || strstr(func, "fread")) {
filename = R->args[3];
I.offset = offset_book[filename];
I.count = atoi(R->args[1]) * atoi(R->args[2]);
I.count = atol(R->args[1]) * atol(R->args[2]);
offset_book[filename] += I.count;
} else if(strstr(func, "pwrite") || strstr(func, "pread")) {
filename = R->args[0];
I.count = atoi(R->args[2]);
I.offset = atoi(R->args[3]);
I.count = atol(R->args[2]);
I.offset = atol(R->args[3]);
} else if(strstr(func, "write") || strstr(func, "read")) {
filename = R->args[0];
I.count = atoi(R->args[2]);
I.count = atol(R->args[2]);
I.offset = offset_book[filename];
offset_book[filename] += I.count;
} else if(strstr(func, "fprintf")) {
filename = R->args[0];
I.count = atoi(R->args[1]);
I.count = atol(R->args[1]);
offset_book[filename] += I.count;
}

Expand Down Expand Up @@ -195,7 +195,7 @@ void handle_metadata_operation(RRecord &rr,

} else if(strstr(func, "seek") || strstr(func, "seeko")) {
filename = R->args[0];
int offset = atoi(R->args[1]);
int offset = atol(R->args[1]);
int whence = atoi(R->args[2]);

if(whence == SEEK_SET)
Expand Down

0 comments on commit ade8ace

Please sign in to comment.