Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
fd23ce82
Commit
fd23ce82
authored
Aug 07, 2014
by
Thomas Jahns
🤸
Browse files
Fix implicit conversions for record size/offset computations.
parent
7ad199a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/file.c
View file @
fd23ce82
...
...
@@ -531,7 +531,6 @@ off_t fileGetPos(int fileID)
int
fileSetPos
(
int
fileID
,
off_t
offset
,
int
whence
)
{
int
status
=
0
;
off_t
position
;
bfile_t
*
fileptr
;
fileptr
=
file_to_pointer
(
fileID
);
...
...
@@ -549,7 +548,7 @@ int fileSetPos(int fileID, off_t offset, int whence)
case
SEEK_SET
:
if
(
fileptr
->
mode
==
'r'
&&
fileptr
->
type
==
FILE_TYPE_OPEN
)
{
position
=
offset
;
off_t
position
=
offset
;
fileptr
->
position
=
position
;
if
(
position
<
fileptr
->
bufferStart
||
position
>
fileptr
->
bufferEnd
)
{
...
...
@@ -571,7 +570,7 @@ int fileSetPos(int fileID, off_t offset, int whence)
fileptr
->
bufferPos
=
fileptr
->
bufferEnd
+
1
;
}
fileptr
->
bufferCnt
=
fileptr
->
bufferEnd
-
position
+
1
;
fileptr
->
bufferCnt
=
(
size_t
)(
fileptr
->
bufferEnd
-
position
)
+
1
;
fileptr
->
bufferPtr
=
fileptr
->
buffer
+
position
-
fileptr
->
bufferStart
;
}
}
...
...
@@ -584,7 +583,7 @@ int fileSetPos(int fileID, off_t offset, int whence)
if
(
fileptr
->
mode
==
'r'
&&
fileptr
->
type
==
FILE_TYPE_OPEN
)
{
fileptr
->
position
+=
offset
;
position
=
fileptr
->
position
;
off_t
position
=
fileptr
->
position
;
if
(
position
<
fileptr
->
bufferStart
||
position
>
fileptr
->
bufferEnd
)
{
if
(
fileptr
->
bufferType
==
FILE_BUFTYPE_STD
)
...
...
@@ -605,7 +604,7 @@ int fileSetPos(int fileID, off_t offset, int whence)
fileptr
->
bufferPos
=
fileptr
->
bufferEnd
+
1
;
}
fileptr
->
bufferCnt
-=
offset
;
fileptr
->
bufferCnt
-=
(
size_t
)
offset
;
fileptr
->
bufferPtr
+=
offset
;
}
}
...
...
@@ -780,7 +779,7 @@ void file_initialize(void)
{
case
FILE_TYPE_OPEN
:
case
FILE_TYPE_FOPEN
:
FileTypeRead
=
value
;
FileTypeRead
=
(
int
)
value
;
break
;
default:
Warning
(
"File type %d not implemented!"
,
value
);
...
...
@@ -794,7 +793,7 @@ void file_initialize(void)
{
case
FILE_TYPE_OPEN
:
case
FILE_TYPE_FOPEN
:
FileTypeWrite
=
value
;
FileTypeWrite
=
(
int
)
value
;
break
;
default:
Warning
(
"File type %d not implemented!"
,
value
);
...
...
@@ -826,7 +825,7 @@ void file_initialize(void)
{
case
FILE_BUFTYPE_STD
:
case
FILE_BUFTYPE_MMAP
:
FileBufferTypeEnv
=
value
;
FileBufferTypeEnv
=
(
int
)
value
;
break
;
default:
Warning
(
"File buffer type %d not implemented!"
,
value
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment