Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pistache
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
pistache
Commits
54e2bc98
Unverified
Commit
54e2bc98
authored
Jan 23, 2020
by
Dennis Jenkins
Committed by
GitHub
Jan 23, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #680 from win32asm/data_access_fix
Address array and vector storage through .data()
parents
4cbc4002
6ad622e8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
7 deletions
+7
-7
include/pistache/stream.h
include/pistache/stream.h
+3
-3
include/pistache/view.h
include/pistache/view.h
+2
-2
src/client/client.cc
src/client/client.cc
+1
-1
src/common/stream.cc
src/common/stream.cc
+1
-1
No files found.
include/pistache/stream.h
View file @
54e2bc98
...
@@ -159,12 +159,12 @@ public:
...
@@ -159,12 +159,12 @@ public:
}
}
RawBuffer
buffer
()
const
{
RawBuffer
buffer
()
const
{
return
RawBuffer
(
(
const
char
*
)
data_
.
data
(),
pptr
()
-
&
data_
[
0
]
);
return
RawBuffer
(
data_
.
data
(),
pptr
()
-
data_
.
data
()
);
}
}
void
clear
()
{
void
clear
()
{
data_
.
clear
();
// reset stream buffer to the whole backing storage.
this
->
setp
(
&
data_
[
0
],
&
data_
[
0
]
+
data_
.
capacity
());
this
->
setp
(
data_
.
data
(),
data_
.
data
()
+
data_
.
size
());
}
}
protected:
protected:
...
...
include/pistache/view.h
View file @
54e2bc98
...
@@ -142,7 +142,7 @@ template <typename T, size_t N> struct ViewBuilder<std::array<T, N>> {
...
@@ -142,7 +142,7 @@ template <typename T, size_t N> struct ViewBuilder<std::array<T, N>> {
if
(
size
>
arr
.
size
())
if
(
size
>
arr
.
size
())
throw
std
::
invalid_argument
(
"out of bounds size"
);
throw
std
::
invalid_argument
(
"out of bounds size"
);
return
View
<
T
>
(
&
arr
[
0
]
,
size
);
return
View
<
T
>
(
arr
.
data
()
,
size
);
}
}
};
};
...
@@ -170,7 +170,7 @@ template <typename T> struct ViewBuilder<std::vector<T>> {
...
@@ -170,7 +170,7 @@ template <typename T> struct ViewBuilder<std::vector<T>> {
if
(
size
>
vec
.
size
())
if
(
size
>
vec
.
size
())
throw
std
::
invalid_argument
(
"out of bounds size"
);
throw
std
::
invalid_argument
(
"out of bounds size"
);
return
View
<
T
>
(
&
vec
[
0
]
,
size
);
return
View
<
T
>
(
vec
.
data
()
,
size
);
}
}
};
};
...
...
src/client/client.cc
View file @
54e2bc98
...
@@ -28,7 +28,7 @@ static constexpr const char *UA = "pistache/0.1";
...
@@ -28,7 +28,7 @@ static constexpr const char *UA = "pistache/0.1";
namespace
{
namespace
{
std
::
pair
<
StringView
,
StringView
>
splitUrl
(
const
std
::
string
&
url
)
{
std
::
pair
<
StringView
,
StringView
>
splitUrl
(
const
std
::
string
&
url
)
{
RawStreamBuf
<
char
>
buf
(
const_cast
<
char
*>
(
&
url
[
0
]
),
url
.
size
());
RawStreamBuf
<
char
>
buf
(
const_cast
<
char
*>
(
url
.
data
()
),
url
.
size
());
StreamCursor
cursor
(
&
buf
);
StreamCursor
cursor
(
&
buf
);
match_string
(
"http://"
,
cursor
);
match_string
(
"http://"
,
cursor
);
...
...
src/common/stream.cc
View file @
54e2bc98
...
@@ -95,7 +95,7 @@ void DynamicStreamBuf::reserve(size_t size) {
...
@@ -95,7 +95,7 @@ void DynamicStreamBuf::reserve(size_t size) {
size
=
maxSize
;
size
=
maxSize
;
const
size_t
oldSize
=
data_
.
size
();
const
size_t
oldSize
=
data_
.
size
();
data_
.
resize
(
size
);
data_
.
resize
(
size
);
this
->
setp
(
&
data_
[
0
]
+
oldSize
,
&
data_
[
0
]
+
size
);
this
->
setp
(
data_
.
data
()
+
oldSize
,
data_
.
data
()
+
size
);
}
}
bool
StreamCursor
::
advance
(
size_t
count
)
{
bool
StreamCursor
::
advance
(
size_t
count
)
{
...
...
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