Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
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
brpc
Commits
760c9473
Commit
760c9473
authored
May 21, 2019
by
gejun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Suppress strict-alias warnings in recordio.cc
parent
751b3696
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
recordio.cc
src/butil/recordio.cc
+8
-4
No files found.
src/butil/recordio.cc
View file @
760c9473
...
...
@@ -172,7 +172,8 @@ bool RecordReader::CutUntilNextRecordCandidate() {
if
(
_cutter
.
copy_to
(
magic
,
sizeof
(
magic
))
!=
sizeof
(
magic
))
{
return
false
;
}
if
(
*
(
const
uint32_t
*
)
magic
==
*
(
const
uint32_t
*
)
BRPC_RECORDIO_MAGIC
)
{
void
*
dummy
=
magic
;
// suppressing strict-aliasing warning
if
(
*
(
const
uint32_t
*
)
dummy
==
*
(
const
uint32_t
*
)
BRPC_RECORDIO_MAGIC
)
{
_cutter
.
pop_front
(
sizeof
(
magic
));
_ncut
+=
sizeof
(
magic
);
}
...
...
@@ -184,7 +185,8 @@ bool RecordReader::CutUntilNextRecordCandidate() {
}
const
size_t
m
=
nc
+
1
-
sizeof
(
magic
);
for
(
size_t
i
=
0
;
i
<
m
;
++
i
)
{
if
(
*
(
const
uint32_t
*
)(
buf
+
i
)
==
*
(
const
uint32_t
*
)
BRPC_RECORDIO_MAGIC
)
{
void
*
dummy
=
buf
+
i
;
// suppressing strict-aliasing warning
if
(
*
(
const
uint32_t
*
)
dummy
==
*
(
const
uint32_t
*
)
BRPC_RECORDIO_MAGIC
)
{
_cutter
.
pop_front
(
i
);
_ncut
+=
i
;
LOG
(
INFO
)
<<
"Found record candidate after "
<<
_ncut
-
old_ncut
<<
" bytes"
;
...
...
@@ -204,7 +206,8 @@ int RecordReader::CutRecord(Record* rec) {
if
(
_cutter
.
copy_to
(
headbuf
,
sizeof
(
headbuf
))
!=
sizeof
(
headbuf
))
{
return
0
;
}
if
(
*
(
const
uint32_t
*
)
headbuf
!=
*
(
const
uint32_t
*
)
BRPC_RECORDIO_MAGIC
)
{
void
*
dummy
=
headbuf
;
// suppressing strict-aliasing warning
if
(
*
(
const
uint32_t
*
)
dummy
!=
*
(
const
uint32_t
*
)
BRPC_RECORDIO_MAGIC
)
{
LOG
(
ERROR
)
<<
"Invalid magic_num="
<<
butil
::
PrintedAsBinary
(
std
::
string
((
char
*
)
headbuf
,
4
))
<<
", offset="
<<
read_bytes
();
...
...
@@ -310,7 +313,8 @@ int RecordWriter::WriteWithoutFlush(const Record& rec) {
if
(
!
rec
.
Payload
().
empty
())
{
_buf
.
append
(
rec
.
Payload
());
}
*
(
uint32_t
*
)
headbuf
=
*
(
const
uint32_t
*
)
BRPC_RECORDIO_MAGIC
;
void
*
dummy
=
headbuf
;
// suppressing strict-aliasing warning
*
(
uint32_t
*
)
dummy
=
*
(
const
uint32_t
*
)
BRPC_RECORDIO_MAGIC
;
const
size_t
data_size
=
_buf
.
size
()
-
old_size
-
sizeof
(
headbuf
);
if
(
data_size
>
0x7FFFFFFFULL
)
{
LOG
(
ERROR
)
<<
"data_size="
<<
data_size
<<
" is too long"
;
...
...
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