提交 b61f3de4 编写于 作者: W wangjiawei04

fix icode error other than RULE103 & 069

Change-Id: Ie3d8315aad1826788211fd2842c823d01fd1f50a
上级 d7fd7c8d
...@@ -38,7 +38,7 @@ int create_req(Request& req) { // NOLINT ...@@ -38,7 +38,7 @@ int create_req(Request& req) { // NOLINT
key = req.mutable_reqs()->Add(); key = req.mutable_reqs()->Add();
key->set_op("GET"); key->set_op("GET");
key->set_key(std::to_string(global_key)); key->set_key(std::to_string(global_key));
global_key ++; global_key++;
return 0; return 0;
} }
...@@ -47,7 +47,7 @@ void print_res(const Request& req, ...@@ -47,7 +47,7 @@ void print_res(const Request& req,
std::string route_tag, std::string route_tag,
uint64_t elapse_ms) { uint64_t elapse_ms) {
LOG(INFO) << "Receive Response size: " << res.ress_size(); LOG(INFO) << "Receive Response size: " << res.ress_size();
for (size_t i = 0; i < res.ress_size(); i++) { for (size_t i = 0; i < res.ress_size(); i++) {
KVDBRes val = res.ress(i); KVDBRes val = res.ress(i);
LOG(INFO) << "Receive value from demo-server: " << val.value(); LOG(INFO) << "Receive value from demo-server: " << val.value();
} }
...@@ -99,9 +99,9 @@ int main(int argc, char** argv) { ...@@ -99,9 +99,9 @@ int main(int argc, char** argv) {
api.thrd_initialize(); api.thrd_initialize();
while (true) { while (true) {
if (global_key > 10000) {
if (global_key > 10000)
break; break;
}
timeval start; timeval start;
gettimeofday(&start, NULL); gettimeofday(&start, NULL);
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#pragma once
#include "kvdb_impl.h" #include "kvdb_impl.h"
#include "paddle_rocksdb.h" #include "paddle_rocksdb.h"
class RocksKVDB: public AbstractKVDB { class RocksKVDB: public AbstractKVDB {
......
...@@ -27,8 +27,10 @@ protected: ...@@ -27,8 +27,10 @@ protected:
} }
static void SetUpTestCase() { static void SetUpTestCase() {
} }
~KVDBTest() {}
}; };
int my_argc; int my_argc;
......
...@@ -30,7 +30,7 @@ void MockDictReader::SetFileName(std::string filename) { ...@@ -30,7 +30,7 @@ void MockDictReader::SetFileName(std::string filename) {
std::string MockDictReader::GetMD5() { std::string MockDictReader::GetMD5() {
auto getCmdOut = [] (std::string cmd) { auto getCmdOut = [] (std::string cmd) {
std::string data; std::string data;
FILE *stream; FILE *stream = nullptr;
const int max_buffer = 256; const int max_buffer = 256;
char buffer[max_buffer]; char buffer[max_buffer];
cmd.append(" 2>&1"); cmd.append(" 2>&1");
...@@ -110,12 +110,12 @@ bool MockParamDict::InsertSparseValue(int64_t feasign, int64_t slot, const std:: ...@@ -110,12 +110,12 @@ bool MockParamDict::InsertSparseValue(int64_t feasign, int64_t slot, const std::
bool MockParamDict::InsertSparseValue(std::string feasign, std::string slot, const std::vector<float>& values) { bool MockParamDict::InsertSparseValue(std::string feasign, std::string slot, const std::vector<float>& values) {
auto FloatToBytes = [](float fvalue, uint8_t *arr){ auto FloatToBytes = [](float fvalue, uint8_t *arr){
unsigned char *pf; unsigned char *pf = nullptr;
unsigned char *px; unsigned char *px = nullptr;
unsigned char i; unsigned char i = 0;
pf =(unsigned char *)&fvalue; pf =(unsigned char *)&fvalue;
px = arr; px = arr;
for(i=0;i<4;i++) for (i = 0; i < 4; i++)
{ {
*(px+i)=*(pf+i); *(px+i)=*(pf+i);
} }
...@@ -128,7 +128,7 @@ bool MockParamDict::InsertSparseValue(std::string feasign, std::string slot, con ...@@ -128,7 +128,7 @@ bool MockParamDict::InsertSparseValue(std::string feasign, std::string slot, con
FloatToBytes(values[i], values_ptr + 4 * i); FloatToBytes(values[i], values_ptr + 4 * i);
} }
char* raw_values_ptr = reinterpret_cast<char*>(values_ptr); char* raw_values_ptr = reinterpret_cast<char*>(values_ptr);
for (size_t i = 0; i < values.size()*4 ; i++) { for (size_t i = 0; i < values.size()*4; i++) {
value.push_back(raw_values_ptr[i]); value.push_back(raw_values_ptr[i]);
} }
back_db->Set(key, value); back_db->Set(key, value);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册