Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
6bd3880c
Commit
6bd3880c
authored
May 06, 2014
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix test.
parent
6a5f27be
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
test/gtest-extra.cc
test/gtest-extra.cc
+11
-1
No files found.
test/gtest-extra.cc
View file @
6bd3880c
...
...
@@ -102,9 +102,19 @@ void File::close() {
fmt
::
ThrowSystemError
(
errno
,
"cannot close file"
);
}
#ifdef _WIN32
// On Windows the count argument to read and write is unsigned, so convert
// it from size_t preventing integer overflow.
inline
unsigned
ConvertRWCount
(
std
::
size_t
count
)
{
return
count
<=
UINT_MAX
?
count
:
UINT_MAX
;
}
#else
inline
std
::
size_t
ConvertRWCount
(
std
::
size_t
count
)
{
return
count
;
}
#endif
std
::
streamsize
File
::
read
(
void
*
buffer
,
std
::
size_t
count
)
{
std
::
streamsize
result
=
0
;
FMT_RETRY
(
result
,
::
FMT_POSIX
(
read
(
fd_
,
buffer
,
count
)));
FMT_RETRY
(
result
,
::
FMT_POSIX
(
read
(
fd_
,
buffer
,
ConvertRWCount
(
count
)
)));
if
(
result
==
-
1
)
fmt
::
ThrowSystemError
(
errno
,
"cannot read from file"
);
return
result
;
...
...
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