Skip to content

Commit

Permalink
Cleanup: Renamed legacy Writer/Reader; namespace usage
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jul 25, 2016
1 parent 51b28e8 commit 700a284
Show file tree
Hide file tree
Showing 53 changed files with 324 additions and 309 deletions.
10 changes: 5 additions & 5 deletions doomsday/apps/api/api_uri.h
Expand Up @@ -107,7 +107,7 @@ DENG_API_TYPEDEF(Uri) // v1
* Constructs a Uri instance by reading it from @a reader. The uri should be
* destroyed with Uri_Delete() once it is no longer needed.
*/
Uri* (*FromReader)(Reader* reader);
Uri* (*FromReader)(Reader1* reader);

/**
* Destroys the uri.
Expand Down Expand Up @@ -232,9 +232,9 @@ DENG_API_TYPEDEF(Uri) // v1
* @param writer Writer instance.
* @param omitComponents @ref uriComponentFlags
*/
void (*Write2)(Uri const* uri, Writer* writer, int omitComponents);
void (*Write2)(Uri const* uri, Writer1* writer, int omitComponents);

void (*Write)(Uri const* uri, Writer* writer/*, omitComponents = 0 (include everything)*/);
void (*Write)(Uri const* uri, Writer1* writer/*, omitComponents = 0 (include everything)*/);

/**
* Deserializes @a uri using @a reader.
Expand All @@ -243,7 +243,7 @@ DENG_API_TYPEDEF(Uri) // v1
* @param reader Reader instance.
* @return Same as @a uri, for caller convenience.
*/
Uri* (*Read)(Uri* uri, Reader* reader);
Uri* (*Read)(Uri* uri, Reader1* reader);

/**
* Deserializes @a uri using @a reader. If the deserialized Uri lacks a scheme,
Expand All @@ -253,7 +253,7 @@ DENG_API_TYPEDEF(Uri) // v1
* @param reader Reader instance.
* @param defaultScheme Default scheme.
*/
void (*ReadWithDefaultScheme)(Uri* uri, Reader* reader, char const* defaultScheme);
void (*ReadWithDefaultScheme)(Uri* uri, Reader1* reader, char const* defaultScheme);

} DENG_API_T(Uri);

Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/client/include/client/cl_infine.h
Expand Up @@ -27,7 +27,7 @@ finaleid_t Cl_CurrentFinale();
/**
* This is where clients start their InFine sequences.
*/
void Cl_Finale(Reader *msg);
void Cl_Finale(Reader1 *msg);

/**
* Client sends a request to skip the finale.
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/client/include/network/net_buf.h
Expand Up @@ -73,7 +73,7 @@ extern dd_bool allowSending;
* as the reading buffer. The reader has to be destroyed with Reader_Delete()
* after it is not needed any more.
*/
Reader* Reader_NewWithNetworkBuffer(void);
Reader1* Reader_NewWithNetworkBuffer(void);

/**
* Functions.
Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/client/include/network/net_msg.h
Expand Up @@ -27,8 +27,8 @@
#include <de/reader.h>
#include <de/writer.h>

DENG_EXTERN_C Writer* msgWriter;
DENG_EXTERN_C Reader* msgReader;
DENG_EXTERN_C Writer1 *msgWriter;
DENG_EXTERN_C Reader1 *msgReader;

#ifdef __cplusplus
extern "C" {
Expand Down
6 changes: 3 additions & 3 deletions doomsday/apps/client/src/api_uri.cpp
Expand Up @@ -38,13 +38,13 @@
DENG2_ASSERT(inst); \
de::Uri const* self = TOINTERNAL_CONST(inst)

static void readUri(Uri *uri, Reader *reader, de::String defaultScheme = "")
static void readUri(Uri *uri, Reader1 *reader, de::String defaultScheme = "")
{
SELF(uri);
self->readUri(reader, defaultScheme);
}

static void writeUri(Uri const *uri, Writer *writer, int omitComponents = 0)
static void writeUri(Uri const *uri, Writer1 *writer, int omitComponents = 0)
{
SELF_CONST(uri);
self->writeUri(writer, omitComponents);
Expand Down Expand Up @@ -105,7 +105,7 @@ Uri* Uri_Dup(Uri const* other)
}

#undef Uri_FromReader
Uri* Uri_FromReader(Reader* reader)
Uri* Uri_FromReader(Reader1 *reader)
{
DENG_ASSERT(reader);

Expand Down
15 changes: 15 additions & 0 deletions doomsday/apps/client/src/audio/system.cpp
Expand Up @@ -2599,13 +2599,15 @@ bool Mus_IsPlaying()
#endif
}

#undef S_StopMusic
void S_StopMusic()
{
#ifdef __CLIENT__
App_AudioSystem().stopMusic();
#endif
}

#undef S_PauseMusic
void S_PauseMusic(dd_bool paused)
{
#ifdef __CLIENT__
Expand Down Expand Up @@ -2655,6 +2657,7 @@ dint Mus_StartCDTrack(dint cdTrack, bool looped)
#endif
}

#undef S_StartMusicNum
dint S_StartMusicNum(dint musicId, dd_bool looped)
{
#ifdef __CLIENT__
Expand All @@ -2672,6 +2675,7 @@ dint S_StartMusicNum(dint musicId, dd_bool looped)
#endif
}

#undef S_StartMusic
dint S_StartMusic(char const *musicId, dd_bool looped)
{
dint idx = ::defs.getMusicNum(musicId);
Expand All @@ -2694,6 +2698,7 @@ mobj_t *S_GetListenerMobj()
return DD_Player(::displayPlayer)->publicData().mo;
}

#undef S_LocalSoundAtVolumeFrom
dint S_LocalSoundAtVolumeFrom(dint soundIdAndFlags, mobj_t *origin, coord_t *point, dfloat volume)
{
#ifdef __CLIENT__
Expand Down Expand Up @@ -2782,22 +2787,26 @@ dint S_LocalSoundAtVolumeFrom(dint soundIdAndFlags, mobj_t *origin, coord_t *poi
#endif
}

#undef S_LocalSoundAtVolume
dint S_LocalSoundAtVolume(dint soundIdAndFlags, mobj_t *emitter, dfloat volume)
{
return S_LocalSoundAtVolumeFrom(soundIdAndFlags, emitter, nullptr, volume);
}

#undef S_LocalSound
dint S_LocalSound(dint soundIdAndFlags, mobj_t *emitter)
{
// Play local sound at max volume.
return S_LocalSoundAtVolumeFrom(soundIdAndFlags, emitter, nullptr, 1);
}

#undef S_LocalSoundFrom
dint S_LocalSoundFrom(dint soundIdAndFlags, coord_t *origin)
{
return S_LocalSoundAtVolumeFrom(soundIdAndFlags, nullptr, origin, 1);
}

#undef S_StartSound
dint S_StartSound(dint soundIdAndFlags, mobj_t *emitter)
{
#ifdef __SERVER__
Expand All @@ -2809,6 +2818,7 @@ dint S_StartSound(dint soundIdAndFlags, mobj_t *emitter)
return S_LocalSound(soundIdAndFlags, emitter);
}

#undef S_StartSoundEx
dint S_StartSoundEx(dint soundIdAndFlags, mobj_t *emitter)
{
#ifdef __SERVER__
Expand All @@ -2819,6 +2829,7 @@ dint S_StartSoundEx(dint soundIdAndFlags, mobj_t *emitter)
return S_LocalSound(soundIdAndFlags, emitter);
}

#undef S_StartSoundAtVolume
dint S_StartSoundAtVolume(dint soundIdAndFlags, mobj_t *emitter, dfloat volume)
{
#ifdef __SERVER__
Expand All @@ -2830,6 +2841,7 @@ dint S_StartSoundAtVolume(dint soundIdAndFlags, mobj_t *emitter, dfloat volume)
return S_LocalSoundAtVolume(soundIdAndFlags, emitter, volume);
}

#undef S_ConsoleSound
dint S_ConsoleSound(dint soundId, mobj_t *emitter, dint targetConsole)
{
#ifdef __SERVER__
Expand All @@ -2845,16 +2857,19 @@ dint S_ConsoleSound(dint soundId, mobj_t *emitter, dint targetConsole)
return true;
}

#undef S_StopSound
void S_StopSound(dint soundId, mobj_t *emitter)
{
App_AudioSystem().stopSound(soundId, emitter);
}

#undef S_StopSound2
void S_StopSound2(dint soundId, mobj_t *emitter, dint flags)
{
App_AudioSystem().stopSound(soundId, emitter, flags);
}

#undef S_IsPlaying
dint S_IsPlaying(dint soundId, mobj_t *emitter)
{
return (dint) App_AudioSystem().soundIsPlaying(soundId, emitter);
Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/client/src/client/cl_infine.cpp
Expand Up @@ -33,7 +33,7 @@ finaleid_t Cl_CurrentFinale()
return currentFinale;
}

void Cl_Finale(Reader *msg)
void Cl_Finale(Reader1 *msg)
{
LOG_AS("Cl_Finale");

Expand Down Expand Up @@ -71,7 +71,7 @@ void Cl_Finale(Reader *msg)
}

if ((flags & FINF_SKIP) && currentFinale)
{
{
FI_ScriptRequestSkip(currentFinale);
}

Expand Down
28 changes: 14 additions & 14 deletions doomsday/apps/libdoomsday/src/resource/composite.cpp
Expand Up @@ -32,24 +32,24 @@

using namespace de;

namespace res {

namespace internal {

static String readAndPercentEncodeRawName(de::Reader &from)
{
/// @attention The raw ASCII name is not necessarily terminated.
char asciiName[9];
for(int i = 0; i < 8; ++i) { from >> asciiName[i]; }
asciiName[8] = 0;

// WAD format allows characters not typically permitted in native paths.
// To achieve uniformity we apply a percent encoding to the "raw" names.
return QString(QByteArray(asciiName).toPercentEncoding());
}
static String readAndPercentEncodeRawName(de::Reader &from)
{
/// @attention The raw ASCII name is not necessarily terminated.
char asciiName[9];
for(int i = 0; i < 8; ++i) { from >> asciiName[i]; }
asciiName[8] = 0;

// WAD format allows characters not typically permitted in native paths.
// To achieve uniformity we apply a percent encoding to the "raw" names.
return QString(QByteArray(asciiName).toPercentEncoding());
}

} // namespace internal

namespace res {

Composite::Component::Component(Vector2i const &origin)
: _origin (origin)
, _lumpNum(-1)
Expand Down Expand Up @@ -175,7 +175,7 @@ Composite *Composite::constructFrom(de::Reader &reader,
Composite *pctex = new Composite;

// First is the raw name.
pctex->d->name = internal::readAndPercentEncodeRawName(reader);
pctex->d->name = res::internal::readAndPercentEncodeRawName(reader);

// Next is some unused junk from a previous format version.
dint16 unused16;
Expand Down
6 changes: 3 additions & 3 deletions doomsday/apps/libdoomsday/src/resource/texturemanifest.cpp
Expand Up @@ -31,7 +31,7 @@ DENG2_PIMPL(TextureManifest)
, DENG2_OBSERVES(Texture, Deletion)
{
int uniqueId; ///< Scheme-unique identifier (user defined).
Uri resourceUri; ///< Image resource path, to be loaded.
de::Uri resourceUri; ///< Image resource path, to be loaded.
Vector2ui logicalDimensions; ///< Dimensions in map space.
Vector2i origin; ///< Origin offset in map space.
Texture::Flags flags; ///< Classification flags.
Expand Down Expand Up @@ -106,8 +106,8 @@ String const &TextureManifest::schemeName() const
String TextureManifest::description(de::Uri::ComposeAsTextFlags uriCompositionFlags) const
{
String info = String("%1 %2")
.arg(composeUri().compose(uriCompositionFlags | Uri::DecodePath),
( uriCompositionFlags.testFlag(Uri::OmitScheme)? -14 : -22 ) )
.arg(composeUri().compose(uriCompositionFlags | de::Uri::DecodePath),
( uriCompositionFlags.testFlag(de::Uri::OmitScheme)? -14 : -22 ) )
.arg(sourceDescription(), -7);
#ifdef __CLIENT__
info += String("x%1").arg(!hasTexture()? 0 : texture().variantCount());
Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/plugins/common/include/acs/script.h
Expand Up @@ -139,8 +139,8 @@ class Script
*/
void setEntryPoint(Module::EntryPoint const &entryPoint);

void read(Reader *reader);
void write(Writer *writer) const;
void read(Reader1 *reader);
void write(Writer1 *writer) const;

public: /// @todo make private:

Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/plugins/common/include/d_net.h
Expand Up @@ -194,9 +194,9 @@ DENG_EXTERN_C float netJumpPower;
extern "C" {
#endif

Writer *D_NetWrite(void);
Writer1 *D_NetWrite(void);

Reader *D_NetRead(byte const *buffer, size_t len);
Reader1 *D_NetRead(byte const *buffer, size_t len);

void D_NetClearBuffer(void);

Expand Down
30 changes: 15 additions & 15 deletions doomsday/apps/plugins/common/include/d_netcl.h
Expand Up @@ -29,41 +29,41 @@
extern "C" {
#endif

void NetCl_UpdateGameState(Reader *msg);
void NetCl_UpdateGameState(Reader1 *msg);

void NetCl_PlayerSpawnPosition(Reader *msg);
void NetCl_PlayerSpawnPosition(Reader1 *msg);

void NetCl_UpdateTotalCounts(Reader *msg);
void NetCl_UpdateTotalCounts(Reader1 *msg);

void NetCl_UpdatePlayerState(Reader *msg, int plrNum);
void NetCl_UpdatePlayerState(Reader1 *msg, int plrNum);

void NetCl_UpdatePlayerState2(Reader *msg, int plrNum);
void NetCl_UpdatePlayerState2(Reader1 *msg, int plrNum);

void NetCl_UpdatePSpriteState(Reader *msg);
void NetCl_UpdatePSpriteState(Reader1 *msg);

/**
* Set the jump power used in client mode.
*/
void NetCl_UpdateJumpPower(Reader *msg);
void NetCl_UpdateJumpPower(Reader1 *msg);

void NetCl_DismissHUDs(Reader *msg);
void NetCl_DismissHUDs(Reader1 *msg);

void NetCl_Intermission(Reader *msg);
void NetCl_Intermission(Reader1 *msg);

void NetCl_LocalMobjState(Reader *msg);
void NetCl_LocalMobjState(Reader1 *msg);

/**
* Clients have other players' info, but it's only "FYI"; they don't really need it.
*/
void NetCl_UpdatePlayerInfo(Reader *msg);
void NetCl_UpdatePlayerInfo(Reader1 *msg);

void NetCl_SaveGame(Reader *msg);
void NetCl_SaveGame(Reader1 *msg);

void NetCl_LoadGame(Reader *msg);
void NetCl_LoadGame(Reader1 *msg);

void NetCl_Paused(Reader *msg);
void NetCl_Paused(Reader1 *msg);

void NetCl_MobjImpulse(Reader *msg);
void NetCl_MobjImpulse(Reader1 *msg);

void NetCl_SendPlayerInfo(void);

Expand Down

0 comments on commit 700a284

Please sign in to comment.