Fix linker issue on Windows
This commit is contained in:
parent
8a8cc94cbb
commit
5bf0d44735
|
|
@ -16,7 +16,7 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
// Function: StringStream::Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE StringStream::
|
||||
StringStream() : iostream(&_buf) {
|
||||
|
|
@ -80,9 +80,7 @@ INLINE void StringStream::
|
|||
set_data(const string &data) {
|
||||
_buf.clear();
|
||||
if (!data.empty()) {
|
||||
pvector<unsigned char> pv;
|
||||
pv.insert(pv.end(), (const unsigned char *)&data[0], (const unsigned char *)&data[0] + data.size());
|
||||
_buf.swap_data(pv);
|
||||
set_data((const unsigned char *)data.data(), data.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,3 +13,17 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stringStream.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: StringStream::set_data
|
||||
// Access: Public
|
||||
// Description: Replaces the contents of the data stream. This
|
||||
// implicitly reseeks to 0.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void StringStream::
|
||||
set_data(const unsigned char *data, size_t size) {
|
||||
_buf.clear();
|
||||
pvector<unsigned char> pv;
|
||||
pv.insert(pv.end(), data, data + size);
|
||||
_buf.swap_data(pv);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ public:
|
|||
#ifndef CPPPARSER
|
||||
INLINE string get_data();
|
||||
INLINE void set_data(const string &data);
|
||||
void set_data(const unsigned char *data, size_t size);
|
||||
#endif
|
||||
|
||||
INLINE void swap_data(pvector<unsigned char> &data);
|
||||
|
|
@ -59,4 +60,3 @@ private:
|
|||
#include "stringStream.I"
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -71,9 +71,7 @@ set_data(PyObject *data) {
|
|||
"StringStream requires a contiguous buffer");
|
||||
return;
|
||||
}
|
||||
pvector<unsigned char> pv;
|
||||
pv.insert(pv.end(), (const unsigned char *)view.buf, (const unsigned char *)view.buf + view.len);
|
||||
_this->_buf.swap_data(pv);
|
||||
_this->set_data((const unsigned char *)view.buf, view.len);
|
||||
PyBuffer_Release(&view);
|
||||
return;
|
||||
}
|
||||
|
|
@ -84,9 +82,7 @@ set_data(PyObject *data) {
|
|||
char *buffer;
|
||||
Py_ssize_t length;
|
||||
if (PyString_AsStringAndSize(data, &buffer, &length) != -1) {
|
||||
pvector<unsigned char> pv;
|
||||
pv.insert(pv.end(), (const unsigned char *)buffer, (const unsigned char *)buffer + length);
|
||||
_this->_buf.swap_data(pv);
|
||||
_this->set_data((const unsigned char *)buffer, (size_t)length);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue