mirror of
https://gitee.com/TarsCloud/TarsCpp.git
synced 2024-12-22 22:16:38 +08:00
fix vector &[0] bug
This commit is contained in:
parent
d627938e93
commit
a76cab4b1c
@ -302,7 +302,6 @@ ELSE ()
|
||||
ENDIF (UNIX)
|
||||
|
||||
#-------------------------------------------------------------
|
||||
|
||||
IF(WIN32)
|
||||
#set(TARS2CPP "${CMAKE_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}/tars2cpp.exe")
|
||||
set(TARS2CPP "${CMAKE_BINARY_DIR}/bin/tars2cpp.exe")
|
||||
@ -322,7 +321,7 @@ message("----------------------------------------------------")
|
||||
message("CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
|
||||
message("PLATFORM: ${PLATFORM}")
|
||||
message("INSTALL_PREFIX: ${INSTALL_PREFIX}")
|
||||
|
||||
message("BIN: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
|
||||
#-------------------------------------------------------------
|
||||
|
||||
message("----------------------------------------------------")
|
||||
|
@ -23,7 +23,7 @@ if(WIN32)
|
||||
add_custom_target(run-http
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
DEPENDS HttpServer HttpClient
|
||||
COMMAND servant/script/busybox.exe bash examples/scripts/run-http.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_SOURCE_DIR}
|
||||
COMMAND servant\\script\\busybox.exe bash examples\\scripts\\run-http.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_SOURCE_DIR}
|
||||
COMMENT "call run http")
|
||||
|
||||
add_custom_target(run-auth
|
||||
|
@ -1,6 +1,11 @@
|
||||
|
||||
echo "run-auth.bat"
|
||||
|
||||
EXE_PATH=$1
|
||||
SRC_PATH=$2
|
||||
|
||||
echo ${EXE_PATH} ${SRC_PATH}
|
||||
|
||||
killall -9 AuthServer.exe
|
||||
sleep 1
|
||||
|
||||
|
@ -34,7 +34,7 @@ SeqManager* ServantProxyThreadData::_pSeq = new SeqManager(MAX_CLIENT_NOTIFYEVEN
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
SeqManager::SeqManager(size_t iNum)
|
||||
SeqManager::SeqManager(uint16_t iNum)
|
||||
{
|
||||
assert(iNum < MAX_UNSIGN_SHORT);
|
||||
assert(iNum > 0);
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
SeqManager(size_t iNum);
|
||||
SeqManager(uint16_t iNum);
|
||||
|
||||
/**
|
||||
* 获取seq
|
||||
@ -106,7 +106,7 @@ public:
|
||||
*/
|
||||
ReqInfoQueue * _reqQueue[MAX_CLIENT_THREAD_NUM]; //队列数组
|
||||
bool _queueInit; //是否初始化
|
||||
size_t _reqQNo; //请求事件通知的seq
|
||||
uint16_t _reqQNo; //请求事件通知的seq
|
||||
size_t _netSeq; //轮训选择网络线程的偏移量
|
||||
int _netThreadSeq; //网络线程发起的请求回到自己的网络线程来处理,其值为网络线程的id
|
||||
|
||||
|
@ -617,7 +617,7 @@ namespace tars
|
||||
template<typename Alloc>
|
||||
void setBuffer(const std::vector<char,Alloc> &buf)
|
||||
{
|
||||
_buf = &buf[0];
|
||||
_buf = buf.data();
|
||||
_buf_len = buf.size();
|
||||
_cur = 0;
|
||||
}
|
||||
@ -694,7 +694,7 @@ namespace tars
|
||||
template<typename Alloc>
|
||||
void setMapBuffer(std::vector<char,Alloc> &buf)
|
||||
{
|
||||
_buf_m = &buf[0];
|
||||
_buf_m = buf.data();
|
||||
_buf_len_m = buf.size();
|
||||
_cur_m = 0;
|
||||
}
|
||||
@ -786,7 +786,7 @@ namespace tars
|
||||
// os._buffer.reserve(len);
|
||||
os._buffer.resize(len);
|
||||
// cout << "_reserve:" << len << endl;
|
||||
return &os._buffer[0];
|
||||
return os._buffer.data();
|
||||
} ;
|
||||
#endif
|
||||
}
|
||||
@ -859,7 +859,7 @@ namespace tars
|
||||
//内存分配器
|
||||
_reserve = [](BufferWriterVector &os, size_t len) {
|
||||
os._buffer.resize(len);
|
||||
return &os._buffer[0];
|
||||
return os._buffer.data();
|
||||
} ;
|
||||
#endif
|
||||
}
|
||||
@ -987,7 +987,7 @@ namespace tars
|
||||
{
|
||||
size_t len = 0;
|
||||
TarsReadTypeBuf(*this, len, uint32_t);
|
||||
len = ntohl(len);
|
||||
len = ntohl((uint32_t)len);
|
||||
TarsReadHeadSkip(*this, len);
|
||||
}
|
||||
break;
|
||||
@ -1933,7 +1933,7 @@ namespace tars
|
||||
Int32 n = (Int32)v.size();
|
||||
write(n, 0);
|
||||
//writeBuf(&v[0], v.size());
|
||||
TarsWriteTypeBuf(*this, &v[0], v.size());
|
||||
TarsWriteTypeBuf(*this, v.data(), v.size());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
@ -776,7 +776,7 @@ public:
|
||||
_iHandleNum = _pEpollServer->_netThreadNum;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < _iHandleNum ; ++i)
|
||||
for (size_t i = 0; i < _iHandleNum ; ++i)
|
||||
{
|
||||
HandlePtr handle = new T();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user