A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
correct seek's semantic
[simgrid.git]
/
src
/
surf
/
workstation_interface.cpp
diff --git
a/src/surf/workstation_interface.cpp
b/src/surf/workstation_interface.cpp
index
f37bff3
..
4dd6636
100644
(file)
--- a/
src/surf/workstation_interface.cpp
+++ b/
src/surf/workstation_interface.cpp
@@
-315,22
+315,20
@@
sg_size_t Workstation::fileTell(surf_file_t fd){
return fd->current_position;
}
return fd->current_position;
}
-
in
t Workstation::fileSeek(surf_file_t fd, sg_size_t offset, int origin){
+
msg_error_
t Workstation::fileSeek(surf_file_t fd, sg_size_t offset, int origin){
switch (origin) {
case SEEK_SET:
switch (origin) {
case SEEK_SET:
- fd->current_position =
0
;
-
return MSG_OK;
+ fd->current_position =
offset
;
+ return MSG_OK;
case SEEK_CUR:
case SEEK_CUR:
- if(offset > fd->size)
- offset = fd->size;
- fd->current_position = offset;
- return MSG_OK;
+ fd->current_position += offset;
+ return MSG_OK;
case SEEK_END:
case SEEK_END:
-
fd->current_position = fd->size
;
-
return MSG_OK;
+
fd->current_position = fd->size + offset
;
+ return MSG_OK;
default:
default:
-
return MSG_TASK_CANCELED;
+ return MSG_TASK_CANCELED;
}
}
}
}