-#include <cstring>
+#include <algorithm>
#include <msp/strings/format.h>
#include <msp/strings/lexicalcast.h>
#include <msp/strings/utils.h>
VertexFormat::VertexFormat(const VertexFormat &f):
data(0)
{
- if(f.data)
- {
- data = new unsigned char[(f.data[0]&~7)+8];
- memcpy(data, f.data, f.data[0]+1);
- }
+ *this = f;
}
VertexFormat &VertexFormat::operator=(const VertexFormat &f)
if(f.data)
{
data = new unsigned char[(f.data[0]&~7)+8];
- memcpy(data, f.data, f.data[0]+1);
+ copy(f.data, f.data+f.data[0]+1, data);
}
else
data = 0;
if(r.data)
{
const unsigned char n = ++r.data[0];
- if((n&7)==7)
+ if((n&7)==0)
{
- unsigned char *newdt = new unsigned char[n+9];
- memcpy(newdt, r.data, n);
+ unsigned char *newdt = new unsigned char[n+8];
+ copy(r.data, r.data+n, newdt);
delete r.data;
r.data = newdt;
}