removed astring::stringbuffer() / use cached value in astring::len() instead of strlen() (no whatsnew)
This commit is contained in:
parent
1a391dd044
commit
f08b72209b
@ -104,14 +104,13 @@ public:
|
||||
// C string conversion operators and helpers
|
||||
operator const char *() const { return m_text; }
|
||||
const char *cstr() const { return m_text; }
|
||||
char *stringbuffer(int size) { ensure_room(size); return m_text; }
|
||||
|
||||
// buffer management
|
||||
astring &reset() { return cpy(""); }
|
||||
astring &expand(int length) { ensure_room(length); return *this; }
|
||||
|
||||
// length query
|
||||
int len() const { return strlen(m_text); }
|
||||
int len() const { return m_len; }
|
||||
|
||||
// copy helpers
|
||||
astring &cpy(const char *src, int count);
|
||||
|
@ -1079,7 +1079,12 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex
|
||||
throw CHDERR_METADATA_NOT_FOUND;
|
||||
|
||||
// read the metadata
|
||||
file_read(metaentry.offset + METADATA_HEADER_SIZE, output.stringbuffer(metaentry.length), metaentry.length);
|
||||
// TODO: how to properly allocate a dynamic char buffer?
|
||||
char* metabuf = new char[metaentry.length+1];
|
||||
memset(metabuf, 0x00, metaentry.length+1);
|
||||
file_read(metaentry.offset + METADATA_HEADER_SIZE, metabuf, metaentry.length);
|
||||
output.cpy(metabuf);
|
||||
delete[] metabuf;
|
||||
return CHDERR_NONE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user