Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
23f64cf5
Commit
23f64cf5
authored
Dec 16, 2009
by
Uwe Schulzweida
Browse files
fileRead: check result of fread
parent
43b53d42
Changes
3
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
23f64cf5
2009-12-15 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* fileRead: check result of fread
* binReadF77Block: check result of fileRead
* Version 1.4.1 released
2009-12-11 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* streamSync: check that vlist has variables to sync [report: Martin Schultz]
...
...
src/binary.c
View file @
23f64cf5
...
...
@@ -67,14 +67,15 @@ UINT64 get_SUINT64(unsigned char *x)
size_t
binReadF77Block
(
int
fileID
,
int
byteswap
)
{
unsigned
char
f77block
[
4
];
size_t
blocklen
;
size_t
blocklen
=
0
;
fileRead
(
fileID
,
f77block
,
4
);
if
(
byteswap
)
blocklen
=
get_SUINT32
(
f77block
);
else
blocklen
=
get_UINT32
(
f77block
);
if
(
fileRead
(
fileID
,
f77block
,
4
)
==
4
)
{
if
(
byteswap
)
blocklen
=
get_SUINT32
(
f77block
);
else
blocklen
=
get_UINT32
(
f77block
);
}
return
(
blocklen
);
}
...
...
src/file.c
View file @
23f64cf5
...
...
@@ -1323,7 +1323,16 @@ size_t filePtrRead(void *vfileptr, void *ptr, size_t size)
if
(
fileptr
->
mode
==
'r'
&&
fileptr
->
type
==
FILE_TYPE_OPEN
)
nread
=
file_read_from_buffer
(
fileptr
,
ptr
,
size
);
else
nread
=
fread
(
ptr
,
1
,
size
,
fileptr
->
fp
);
{
nread
=
fread
(
ptr
,
1
,
size
,
fileptr
->
fp
);
if
(
nread
!=
size
)
{
if
(
nread
==
0
)
fileptr
->
flag
|=
FILE_EOF
;
else
fileptr
->
flag
|=
FILE_ERROR
;
}
}
fileptr
->
position
+=
nread
;
fileptr
->
byteTrans
+=
nread
;
...
...
@@ -1349,7 +1358,16 @@ size_t fileRead(int fileID, void *ptr, size_t size)
if
(
fileptr
->
mode
==
'r'
&&
fileptr
->
type
==
FILE_TYPE_OPEN
)
nread
=
file_read_from_buffer
(
fileptr
,
ptr
,
size
);
else
nread
=
fread
(
ptr
,
1
,
size
,
fileptr
->
fp
);
{
nread
=
fread
(
ptr
,
1
,
size
,
fileptr
->
fp
);
if
(
nread
!=
size
)
{
if
(
nread
==
0
)
fileptr
->
flag
|=
FILE_EOF
;
else
fileptr
->
flag
|=
FILE_ERROR
;
}
}
fileptr
->
position
+=
nread
;
fileptr
->
byteTrans
+=
nread
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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