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
tsoc
openmm
Commits
d179864c
Commit
d179864c
authored
Jan 22, 2009
by
Mark Friedrichs
Browse files
Minor changes to remove compiler warnings
parent
f5d1ec23
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
platforms/brook/src/BrookStreamInternal.cpp
platforms/brook/src/BrookStreamInternal.cpp
+21
-9
No files found.
platforms/brook/src/BrookStreamInternal.cpp
View file @
d179864c
...
...
@@ -480,7 +480,13 @@ int BrookStreamInternal::printStreamsToFile( std::string fileName, std::vector<B
// ---------------------------------------------------------------------------------------
FILE
*
filePtr
=
fopen
(
fileName
.
c_str
(),
"w"
);
FILE
*
filePtr
;
#ifdef WIN32
fopen_s
(
&
filePtr
,
fileName
.
c_str
(),
"w"
);
#else
filePtr
=
fopen
(
fileName
.
c_str
(),
"w"
);
#endif
if
(
!
filePtr
){
(
void
)
fprintf
(
stderr
,
"%s could not open file=<%s>
\n
"
,
methodName
.
c_str
(),
fileName
.
c_str
()
);
(
void
)
fflush
(
stderr
);
...
...
@@ -562,7 +568,7 @@ int BrookStreamInternal::printStreamsToFile( std::string fileName, std::vector<B
delete
[]
arrays
;
delete
[]
widths
;
delete
[]
indices
;
for
(
int
ii
=
0
;
ii
<
streams
.
size
();
ii
++
){
for
(
unsigned
int
ii
=
0
;
ii
<
streams
.
size
();
ii
++
){
delete
[]
sums
[
ii
];
}
delete
[]
sums
;
...
...
@@ -591,7 +597,7 @@ typedef struct {
#include <limits>
#include <set>
int
BrookStreamInternal
::
loadStreamGivenFileName
(
std
::
string
&
file
n
ame
){
int
BrookStreamInternal
::
loadStreamGivenFileName
(
std
::
string
&
file
N
ame
){
// ---------------------------------------------------------------------------------------
...
...
@@ -603,15 +609,21 @@ int BrookStreamInternal::loadStreamGivenFileName( std::string& filename ){
/* open file, read header */
FILE
*
filePtr
=
fopen
(
filename
.
c_str
(),
"rb"
);
FILE
*
filePtr
;
#ifdef WIN32
fopen_s
(
&
filePtr
,
fileName
.
c_str
(),
"rb"
);
#else
filePtr
=
fopen
(
fileName
.
c_str
(),
"rb"
);
#endif
if
(
filePtr
==
NULL
){
(
void
)
fprintf
(
log
,
"%s Unable to open/read %s for stream creation
\n
"
,
methodName
.
c_str
(),
file
n
ame
.
c_str
()
);
(
void
)
fprintf
(
log
,
"%s Unable to open/read %s for stream creation
\n
"
,
methodName
.
c_str
(),
file
N
ame
.
c_str
()
);
return
ErrorReturnValue
;
}
STREAM_HEADER
header
;
if
(
1
!=
fread
(
&
header
,
sizeof
(
header
),
1
,
filePtr
)
){
(
void
)
fprintf
(
log
,
"%s Unable to read %s header for stream %s
\n
"
,
methodName
.
c_str
(),
file
n
ame
.
c_str
()
);
(
void
)
fprintf
(
log
,
"%s Unable to read %s header for stream %s
\n
"
,
methodName
.
c_str
(),
file
N
ame
.
c_str
()
);
(
void
)
fclose
(
filePtr
);
return
ErrorReturnValue
;
}
...
...
@@ -653,14 +665,14 @@ int BrookStreamInternal::loadStreamGivenFileName( std::string& filename ){
void
*
dataBuffer
=
(
void
*
)
malloc
(
bytesToRead
);
if
(
dataBuffer
==
NULL
){
(
void
)
fprintf
(
log
,
"%s Memory Error for file=%s
\n
"
,
methodName
.
c_str
(),
file
n
ame
.
c_str
()
);
(
void
)
fprintf
(
log
,
"%s Memory Error for file=%s
\n
"
,
methodName
.
c_str
(),
file
N
ame
.
c_str
()
);
(
void
)
fclose
(
filePtr
);
return
ErrorReturnValue
;
}
size_t
bytesRead
=
fread
(
dataBuffer
,
bytesToRead
,
1
,
filePtr
);
if
(
bytesRead
!=
1
){
(
void
)
fprintf
(
log
,
"%s Unable to read %d bytes=%d stream from %s
\n
"
,
methodName
.
c_str
(),
bytesRead
,
bytesToRead
,
file
n
ame
.
c_str
()
);
(
void
)
fprintf
(
log
,
"%s Unable to read %d bytes=%d stream from %s
\n
"
,
methodName
.
c_str
(),
bytesRead
,
bytesToRead
,
file
N
ame
.
c_str
()
);
free
(
dataBuffer
);
(
void
)
fclose
(
filePtr
);
return
ErrorReturnValue
;
...
...
@@ -683,7 +695,7 @@ int BrookStreamInternal::loadStreamGivenFileName( std::string& filename ){
(
void
)
fclose
(
filePtr
);
free
(
dataBuffer
);
(
void
)
fprintf
(
log
,
"%s read %d bytes for stream %s from %s dim:[%d %d %d %d] container=%d %d
\n
"
,
methodName
.
c_str
(),
bytesToRead
,
getName
().
c_str
(),
file
n
ame
.
c_str
(),
(
void
)
fprintf
(
log
,
"%s read %d bytes for stream %s from %s dim:[%d %d %d %d] container=%d %d
\n
"
,
methodName
.
c_str
(),
bytesToRead
,
getName
().
c_str
(),
file
N
ame
.
c_str
(),
header
.
dims
[
0
],
header
.
dims
[
0
],
header
.
dims
[
0
],
header
.
dims
[
0
],
getStreamSize
(),
getWidth
()
);
(
void
)
fflush
(
log
);
...
...
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