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
2a747b19
Commit
2a747b19
authored
Jul 25, 2014
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CheckPtr -> make_ptr (
https://github.com/cppformat/cppformat/issues/50
)
parent
d142e3b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
format.h
format.h
+6
-6
No files found.
format.h
View file @
2a747b19
...
...
@@ -228,12 +228,12 @@ enum { INLINE_BUFFER_SIZE = 500 };
#if _SECURE_SCL
// Use checked iterator to avoid warnings on MSVC.
template
<
typename
T
>
inline
stdext
::
checked_array_iterator
<
T
*>
CheckP
tr
(
T
*
ptr
,
std
::
size_t
size
)
{
inline
stdext
::
checked_array_iterator
<
T
*>
make_p
tr
(
T
*
ptr
,
std
::
size_t
size
)
{
return
stdext
::
checked_array_iterator
<
T
*>
(
ptr
,
size
);
}
#else
template
<
typename
T
>
inline
T
*
CheckP
tr
(
T
*
ptr
,
std
::
size_t
)
{
return
ptr
;
}
inline
T
*
make_p
tr
(
T
*
ptr
,
std
::
size_t
)
{
return
ptr
;
}
#endif
// A simple array for POD types with the first SIZE elements stored in
...
...
@@ -259,7 +259,7 @@ class Array {
capacity_
=
other
.
capacity_
;
if
(
other
.
ptr_
==
other
.
data_
)
{
ptr_
=
data_
;
std
::
copy
(
other
.
data_
,
other
.
data_
+
size_
,
CheckP
tr
(
data_
,
capacity_
));
std
::
copy
(
other
.
data_
,
other
.
data_
+
size_
,
make_p
tr
(
data_
,
capacity_
));
}
else
{
ptr_
=
other
.
ptr_
;
// Set pointer to the inline array so that delete is not called
...
...
@@ -325,7 +325,7 @@ template <typename T, std::size_t SIZE>
void
Array
<
T
,
SIZE
>::
grow
(
std
::
size_t
size
)
{
capacity_
=
(
std
::
max
)(
size
,
capacity_
+
capacity_
/
2
);
T
*
p
=
new
T
[
capacity_
];
std
::
copy
(
ptr_
,
ptr_
+
size_
,
CheckP
tr
(
p
,
capacity_
));
std
::
copy
(
ptr_
,
ptr_
+
size_
,
make_p
tr
(
p
,
capacity_
));
if
(
ptr_
!=
data_
)
delete
[]
ptr_
;
ptr_
=
p
;
...
...
@@ -336,7 +336,7 @@ void Array<T, SIZE>::append(const T *begin, const T *end) {
std
::
ptrdiff_t
num_elements
=
end
-
begin
;
if
(
size_
+
num_elements
>
capacity_
)
grow
(
size_
+
num_elements
);
std
::
copy
(
begin
,
end
,
CheckP
tr
(
ptr_
,
capacity_
)
+
size_
);
std
::
copy
(
begin
,
end
,
make_p
tr
(
ptr_
,
capacity_
)
+
size_
);
size_
+=
num_elements
;
}
...
...
@@ -1311,7 +1311,7 @@ class BasicWriter {
CharPtr
GrowBuffer
(
std
::
size_t
n
)
{
std
::
size_t
size
=
buffer_
.
size
();
buffer_
.
resize
(
size
+
n
);
return
internal
::
CheckP
tr
(
&
buffer_
[
size
],
n
);
return
internal
::
make_p
tr
(
&
buffer_
[
size
],
n
);
}
// Prepare a buffer for integer formatting.
...
...
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