We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rpc调用的时候,发现字符串长度最长是uint16_t,大概是64k,能否允许传递更长的字符串,比如10M以内,因为代码有点看不懂,我改了几次无法成功
The text was updated successfully, but these errors were encountered:
我用的是2010的buttonrpc: https://github.com/button-chen/buttonrpc
Sorry, something went wrong.
修改了一下,好像是可以了:
` template inline void Serializer::output_type(T& t) { int len = sizeof(T); char* d = new char[len]; if (!m_iodevice.is_eof()){ memcpy(d, m_iodevice.current(), len); m_iodevice.offset(len); byte_orser(d, len); t = reinterpret_cast<T>(&d[0]); } delete [] d; }
template<> inline void Serializer::output_type(std::string& in) { int marklen = sizeof(uint32_t); char* d = new char[marklen]; memcpy(d, m_iodevice.current(), marklen); byte_orser(d, marklen); int len = reinterpret_cast<uint32_t>(&d[0]); m_iodevice.offset(marklen); delete [] d; if (len == 0) return; in.insert(in.begin(), m_iodevice.current(), m_iodevice.current() + len); m_iodevice.offset(len); }
template inline void Serializer::input_type(T t) { int len = sizeof(T); char* d = new char[len]; const char* p = reinterpret_cast<const char*>(&t); memcpy(d, p, len); byte_orser(d, len); m_iodevice.input(d, len); delete [] d; }
template<> inline void Serializer::input_type(std::string in) { // 先存入字符串长度 uint32_t len = in.size(); char* p = reinterpret_cast< char*>(&len); byte_orser(p, sizeof(uint32_t)); m_iodevice.input(p, sizeof(uint32_t));
// 存入字符串 if (len == 0) return; char* d = new char[len]; memcpy(d, in.c_str(), len); m_iodevice.input(d, len); delete [] d;
}
template<> inline void Serializer::input_type(const char* in) { input_typestd::string(std::string(in)); }`
No branches or pull requests
rpc调用的时候,发现字符串长度最长是uint16_t,大概是64k,能否允许传递更长的字符串,比如10M以内,因为代码有点看不懂,我改了几次无法成功
The text was updated successfully, but these errors were encountered: