Commit 50aaa985 authored by gejun's avatar gejun

fix typos

parent 760c9473
...@@ -59,8 +59,7 @@ DEFINE_bool(baidu_protocol_use_fullname, true, ...@@ -59,8 +59,7 @@ DEFINE_bool(baidu_protocol_use_fullname, true,
// Pack header into `buf' // Pack header into `buf'
inline void PackRpcHeader(char* rpc_header, int meta_size, int payload_size) { inline void PackRpcHeader(char* rpc_header, int meta_size, int payload_size) {
// supress strict-aliasing warning. uint32_t* dummy = (uint32_t*)rpc_header; // suppress strict-alias warning
uint32_t* dummy = (uint32_t*)rpc_header;
*dummy = *(uint32_t*)"PRPC"; *dummy = *(uint32_t*)"PRPC";
butil::RawPacker(rpc_header + 4) butil::RawPacker(rpc_header + 4)
.pack32(meta_size + payload_size) .pack32(meta_size + payload_size)
......
...@@ -142,8 +142,7 @@ private: ...@@ -142,8 +142,7 @@ private:
}; };
inline void PackHuluHeader(char* hulu_header, int meta_size, int body_size) { inline void PackHuluHeader(char* hulu_header, int meta_size, int body_size) {
// dummy supresses strict-aliasing warning. uint32_t* dummy = reinterpret_cast<uint32_t*>(hulu_header); // suppress strict-alias warning
uint32_t* dummy = reinterpret_cast<uint32_t*>(hulu_header);
*dummy = *reinterpret_cast<const uint32_t*>("HULU"); *dummy = *reinterpret_cast<const uint32_t*>("HULU");
HuluRawPacker rp(hulu_header + 4); HuluRawPacker rp(hulu_header + 4);
rp.pack32(meta_size + body_size).pack32(meta_size); rp.pack32(meta_size + body_size).pack32(meta_size);
......
...@@ -128,8 +128,7 @@ private: ...@@ -128,8 +128,7 @@ private:
}; };
inline void PackSofaHeader(char* sofa_header, int meta_size, int body_size) { inline void PackSofaHeader(char* sofa_header, int meta_size, int body_size) {
// dummy supresses strict-aliasing warning. uint32_t* dummy = reinterpret_cast<uint32_t*>(sofa_header); // suppress strict-alias warning
uint32_t* dummy = reinterpret_cast<uint32_t*>(sofa_header);
*dummy = *reinterpret_cast<const uint32_t*>("SOFA"); *dummy = *reinterpret_cast<const uint32_t*>("SOFA");
SofaRawPacker rp(sofa_header + 4); SofaRawPacker rp(sofa_header + 4);
......
...@@ -43,8 +43,7 @@ void PackStreamMessage(butil::IOBuf* out, ...@@ -43,8 +43,7 @@ void PackStreamMessage(butil::IOBuf* out,
const uint32_t data_length = data ? data->length() : 0; const uint32_t data_length = data ? data->length() : 0;
const uint32_t meta_length = fm.ByteSize(); const uint32_t meta_length = fm.ByteSize();
char head[12]; char head[12];
// dummy supresses strict-aliasing warning. uint32_t* dummy = (uint32_t*)head; // suppresses strict-alias warning
uint32_t* dummy = (uint32_t*)head;
*(uint32_t*)dummy = *(const uint32_t*)"STRM"; *(uint32_t*)dummy = *(const uint32_t*)"STRM";
butil::RawPacker(head + 4) butil::RawPacker(head + 4)
.pack32(data_length + meta_length) .pack32(data_length + meta_length)
......
...@@ -247,8 +247,7 @@ bool RpcDumpContext::Serialize(butil::IOBuf& buf, SampledRequest* sample) { ...@@ -247,8 +247,7 @@ bool RpcDumpContext::Serialize(butil::IOBuf& buf, SampledRequest* sample) {
const size_t meta_size = buf.size() - starting_size; const size_t meta_size = buf.size() - starting_size;
buf.append(sample->request); buf.append(sample->request);
// dummy supresses strict-aliasing warning. uint32_t* dummy = (uint32_t*)rpc_header; // suppress strict-alias warning
uint32_t* dummy = (uint32_t*)rpc_header;
*dummy = *(uint32_t*)"PRPC"; *dummy = *(uint32_t*)"PRPC";
butil::RawPacker(rpc_header + 4) butil::RawPacker(rpc_header + 4)
.pack32(meta_size + sample->request.size()) .pack32(meta_size + sample->request.size())
......
...@@ -124,7 +124,7 @@ void* push_thread_which_addresses_execq(void *arg) { ...@@ -124,7 +124,7 @@ void* push_thread_which_addresses_execq(void *arg) {
TEST_F(ExecutionQueueTest, performance) { TEST_F(ExecutionQueueTest, performance) {
pthread_t threads[8]; pthread_t threads[8];
bthread::ExecutionQueueId<LongIntTask> queue_id = { 0 }; // to supress warns bthread::ExecutionQueueId<LongIntTask> queue_id = { 0 }; // to suppress warnings
bthread::ExecutionQueueOptions options; bthread::ExecutionQueueOptions options;
int64_t result = 0; int64_t result = 0;
ASSERT_EQ(0, bthread::execution_queue_start(&queue_id, &options, ASSERT_EQ(0, bthread::execution_queue_start(&queue_id, &options,
...@@ -220,7 +220,7 @@ int add_with_suspend(void* meta, bthread::TaskIterator<LongIntTask>& iter) { ...@@ -220,7 +220,7 @@ int add_with_suspend(void* meta, bthread::TaskIterator<LongIntTask>& iter) {
TEST_F(ExecutionQueueTest, execute_urgent) { TEST_F(ExecutionQueueTest, execute_urgent) {
g_should_be_urgent = false; g_should_be_urgent = false;
pthread_t threads[10]; pthread_t threads[10];
bthread::ExecutionQueueId<LongIntTask> queue_id = { 0 }; // to supress warns bthread::ExecutionQueueId<LongIntTask> queue_id = { 0 }; // to suppress warnings
bthread::ExecutionQueueOptions options; bthread::ExecutionQueueOptions options;
int64_t result = 0; int64_t result = 0;
ASSERT_EQ(0, bthread::execution_queue_start(&queue_id, &options, ASSERT_EQ(0, bthread::execution_queue_start(&queue_id, &options,
...@@ -262,7 +262,7 @@ TEST_F(ExecutionQueueTest, execute_urgent) { ...@@ -262,7 +262,7 @@ TEST_F(ExecutionQueueTest, execute_urgent) {
TEST_F(ExecutionQueueTest, urgent_task_is_the_last_task) { TEST_F(ExecutionQueueTest, urgent_task_is_the_last_task) {
g_should_be_urgent = false; g_should_be_urgent = false;
g_suspending = false; g_suspending = false;
bthread::ExecutionQueueId<LongIntTask> queue_id = { 0 }; // to supress warns bthread::ExecutionQueueId<LongIntTask> queue_id = { 0 }; // to suppress warnings
bthread::ExecutionQueueOptions options; bthread::ExecutionQueueOptions options;
int64_t result = 0; int64_t result = 0;
ASSERT_EQ(0, bthread::execution_queue_start(&queue_id, &options, ASSERT_EQ(0, bthread::execution_queue_start(&queue_id, &options,
...@@ -319,7 +319,7 @@ int check_order(void* meta, bthread::TaskIterator<LongIntTask>& iter) { ...@@ -319,7 +319,7 @@ int check_order(void* meta, bthread::TaskIterator<LongIntTask>& iter) {
TEST_F(ExecutionQueueTest, multi_threaded_order) { TEST_F(ExecutionQueueTest, multi_threaded_order) {
memset(next_task, 0, sizeof(next_task)); memset(next_task, 0, sizeof(next_task));
long disorder_times = 0; long disorder_times = 0;
bthread::ExecutionQueueId<LongIntTask> queue_id = { 0 }; // to supress warns bthread::ExecutionQueueId<LongIntTask> queue_id = { 0 }; // to suppress warnings
bthread::ExecutionQueueOptions options; bthread::ExecutionQueueOptions options;
ASSERT_EQ(0, bthread::execution_queue_start(&queue_id, &options, ASSERT_EQ(0, bthread::execution_queue_start(&queue_id, &options,
check_order, &disorder_times)); check_order, &disorder_times));
...@@ -346,7 +346,7 @@ int check_running_thread(void* arg, bthread::TaskIterator<LongIntTask>& iter) { ...@@ -346,7 +346,7 @@ int check_running_thread(void* arg, bthread::TaskIterator<LongIntTask>& iter) {
TEST_F(ExecutionQueueTest, in_place_task) { TEST_F(ExecutionQueueTest, in_place_task) {
pthread_t thread_id = pthread_self(); pthread_t thread_id = pthread_self();
bthread::ExecutionQueueId<LongIntTask> queue_id = { 0 }; // to supress warns bthread::ExecutionQueueId<LongIntTask> queue_id = { 0 }; // to suppress warnings
bthread::ExecutionQueueOptions options; bthread::ExecutionQueueOptions options;
ASSERT_EQ(0, bthread::execution_queue_start(&queue_id, &options, ASSERT_EQ(0, bthread::execution_queue_start(&queue_id, &options,
check_running_thread, check_running_thread,
...@@ -434,7 +434,7 @@ void* inplace_push_thread(void* arg) { ...@@ -434,7 +434,7 @@ void* inplace_push_thread(void* arg) {
TEST_F(ExecutionQueueTest, inplace_and_order) { TEST_F(ExecutionQueueTest, inplace_and_order) {
memset(next_task, 0, sizeof(next_task)); memset(next_task, 0, sizeof(next_task));
long disorder_times = 0; long disorder_times = 0;
bthread::ExecutionQueueId<LongIntTask> queue_id = { 0 }; // to supress warns bthread::ExecutionQueueId<LongIntTask> queue_id = { 0 }; // to suppress warnings
bthread::ExecutionQueueOptions options; bthread::ExecutionQueueOptions options;
ASSERT_EQ(0, bthread::execution_queue_start(&queue_id, &options, ASSERT_EQ(0, bthread::execution_queue_start(&queue_id, &options,
check_order, &disorder_times)); check_order, &disorder_times));
...@@ -476,7 +476,7 @@ int add_with_suspend2(void* meta, bthread::TaskIterator<LongIntTask>& iter) { ...@@ -476,7 +476,7 @@ int add_with_suspend2(void* meta, bthread::TaskIterator<LongIntTask>& iter) {
} }
TEST_F(ExecutionQueueTest, cancel) { TEST_F(ExecutionQueueTest, cancel) {
bthread::ExecutionQueueId<LongIntTask> queue_id = { 0 }; // to supress warns bthread::ExecutionQueueId<LongIntTask> queue_id = { 0 }; // to suppress warnings
bthread::ExecutionQueueOptions options; bthread::ExecutionQueueOptions options;
int64_t result = 0; int64_t result = 0;
ASSERT_EQ(0, bthread::execution_queue_start(&queue_id, &options, ASSERT_EQ(0, bthread::execution_queue_start(&queue_id, &options,
...@@ -517,7 +517,7 @@ int cancel_self(void* /*meta*/, bthread::TaskIterator<CancelSelf*>& iter) { ...@@ -517,7 +517,7 @@ int cancel_self(void* /*meta*/, bthread::TaskIterator<CancelSelf*>& iter) {
} }
TEST_F(ExecutionQueueTest, cancel_self) { TEST_F(ExecutionQueueTest, cancel_self) {
bthread::ExecutionQueueId<CancelSelf*> queue_id = { 0 }; // to supress warns bthread::ExecutionQueueId<CancelSelf*> queue_id = { 0 }; // to suppress warnings
bthread::ExecutionQueueOptions options; bthread::ExecutionQueueOptions options;
ASSERT_EQ(0, bthread::execution_queue_start(&queue_id, &options, ASSERT_EQ(0, bthread::execution_queue_start(&queue_id, &options,
cancel_self, NULL)); cancel_self, NULL));
...@@ -665,7 +665,7 @@ int add_with_suspend3(void* meta, bthread::TaskIterator<LongIntTask>& iter) { ...@@ -665,7 +665,7 @@ int add_with_suspend3(void* meta, bthread::TaskIterator<LongIntTask>& iter) {
TEST_F(ExecutionQueueTest, cancel_unexecuted_high_priority_task) { TEST_F(ExecutionQueueTest, cancel_unexecuted_high_priority_task) {
g_should_be_urgent = false; g_should_be_urgent = false;
bthread::ExecutionQueueId<LongIntTask> queue_id = { 0 }; // to supress warns bthread::ExecutionQueueId<LongIntTask> queue_id = { 0 }; // to suppress warnings
bthread::ExecutionQueueOptions options; bthread::ExecutionQueueOptions options;
int64_t result = 0; int64_t result = 0;
ASSERT_EQ(0, bthread::execution_queue_start(&queue_id, &options, ASSERT_EQ(0, bthread::execution_queue_start(&queue_id, &options,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment