Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Cleanup|libcommon: Accessing pointer-based byte arrays
de::ByteRefArray is the appropriate array class to use for referencing
an existing pointer-based array of bytes with a known size.
  • Loading branch information
skyjake committed Mar 28, 2014
1 parent 9473d1c commit 6147684
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions doomsday/plugins/common/src/p_saveio.cpp
Expand Up @@ -23,6 +23,7 @@

#include <de/Error>
#include <de/FixedByteArray>
#include <de/ByteRefArray>

// Used during write:
static de::Writer *writer;
Expand Down Expand Up @@ -74,10 +75,9 @@ static void srd(reader_s *r, char *data, int len)
if(!r) return;
DENG2_ASSERT(reader);
if(data)
{
de::Block tmp(len);
*reader >> de::FixedByteArray(tmp);
tmp.get(0, (de::Block::Byte *)data, len);
{
de::ByteRefArray ref(data, len);
reader->readPresetSize(ref);
}
else
{
Expand Down Expand Up @@ -158,8 +158,7 @@ static void swd(Writer *w, char const *data, int len)
DENG2_ASSERT(writer);
if(data)
{
de::Block tmp(data, len);
*writer << de::FixedByteArray(tmp);
writer->writePresetSize(de::ByteRefArray(data, len));
}
}

Expand Down

0 comments on commit 6147684

Please sign in to comment.