Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
d0875482
Commit
d0875482
authored
May 08, 2012
by
Ian Barber
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #338 from hurtonm/code_cleanup
Simplify encoder's loop
parents
80e8baaf
64194394
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
12 deletions
+7
-12
encoder.hpp
src/encoder.hpp
+7
-12
No files found.
src/encoder.hpp
View file @
d0875482
...
...
@@ -69,11 +69,11 @@ namespace zmq
unsigned
char
*
buffer
=
!*
data_
?
buf
:
*
data_
;
size_t
buffersize
=
!*
data_
?
bufsize
:
*
size_
;
size_t
pos
=
0
;
if
(
offset_
)
*
offset_
=
-
1
;
while
(
true
)
{
size_t
pos
=
0
;
while
(
pos
<
buffersize
)
{
// If there are no more data to return, run the state machine.
// If there are still no data, return what we already have
...
...
@@ -85,11 +85,8 @@ namespace zmq
if
(
offset_
&&
*
offset_
==
-
1
)
*
offset_
=
static_cast
<
int
>
(
pos
);
if
(
!
(
static_cast
<
T
*>
(
this
)
->*
next
)
())
{
*
data_
=
buffer
;
*
size_
=
pos
;
return
;
}
if
(
!
(
static_cast
<
T
*>
(
this
)
->*
next
)
())
break
;
}
// If there are no data in the buffer yet and we are able to
...
...
@@ -116,12 +113,10 @@ namespace zmq
pos
+=
to_copy
;
write_pos
+=
to_copy
;
to_write
-=
to_copy
;
if
(
pos
==
buffersize
)
{
*
data_
=
buffer
;
*
size_
=
pos
;
return
;
}
}
*
data_
=
buffer
;
*
size_
=
pos
;
}
protected
:
...
...
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