Skip to content

Commit

Permalink
fix compile when running unit-test
Browse files Browse the repository at this point in the history
  • Loading branch information
cyshi committed Jan 20, 2016
1 parent 9bd6aa5 commit 0a36ae6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ install:
- tar xf protobuf-$PROTOBUF_VERSION.tar.gz
- ( cd protobuf-$PROTOBUF_VERSION && ./configure && make -j4 && sudo make install && sudo ldconfig )
- git clone https://github.com/google/snappy
- ( cd snappy && sh ./autogen.sh && ./configure && make -j4 && sudo make install )
- ( cd snappy && sh ./autogen.sh && ./configure && make -j4 && sudo make install && sudo ldconfig )
- sudo apt-get install zlib1g-dev
- git clone https://github.com/google/googletest.git
script:
Expand Down
12 changes: 5 additions & 7 deletions src/sofa/pbrpc/buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ void ReadBuffer::Append(const ReadBuffer* read_buffer)
SCHECK(read_buffer != NULL);
BufHandleList::const_iterator it = read_buffer->_buf_list.begin();
BufHandleList::const_iterator end = read_buffer->_buf_list.end();
for (; it != end; ++it) {
for (; it != end; ++it)
{
_buf_list.push_back(*it);
TranBufPool::add_ref(it->data);
}
Expand Down Expand Up @@ -316,12 +317,9 @@ bool WriteBuffer::Append(const std::string& data)

bool WriteBuffer::Append(const char* data, int size)
{
if (size <= 0)
{
return false;
}

int64_t head = Reserve(size);
SCHECK_GE(size, 0);
if (size == 0) return true;
int64 head = Reserve(size);
if (head < 0)
{
return false;
Expand Down
6 changes: 3 additions & 3 deletions src/sofa/pbrpc/web_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static std::string FormatPath(const std::string& path)
{
if (!path_vec[i].empty())
{
os << ROOT_PATH << path_vec[i];
os << PATH_SPLITTER << path_vec[i];
}
}
return os.str().empty() ? ROOT_PATH : os.str();
Expand Down Expand Up @@ -255,7 +255,7 @@ Servlet WebService::FindServlet(const std::string& path)
size_t cur_pos = 0;
while (cur_pos < path_size)
{
cur_pos = real_path.find(ROOT_PATH, cur_pos + 1);
cur_pos = real_path.find(PATH_SPLITTER, cur_pos + 1);
if (cur_pos == std::string::npos)
{
ServletMap::const_iterator find = servlets->find(real_path);
Expand All @@ -275,7 +275,7 @@ Servlet WebService::FindServlet(const std::string& path)
size_t find_path_size = find_path.size();
if (find_path_size <= path_size
&& strncmp(real_path.data(), find_path.data(), find_path_size) == 0
&& (find_path_size == path_size || real_path[find_path_size] == ROOT_PATH[0]))
&& (find_path_size == path_size || real_path[find_path_size] == PATH_SPLITTER[0]))
{
ret = find->second.first;
cur_pos = find_path_size;
Expand Down

0 comments on commit 0a36ae6

Please sign in to comment.