Skip to content

Commit

Permalink
Cleanup|libdoomsday: Whitespace style refresh
Browse files Browse the repository at this point in the history
Use a space in `if`, `for`, etc. statements after the keyword.
This commit only contains whitespace changes.
  • Loading branch information
skyjake committed May 31, 2016
1 parent e1a1a00 commit 05a1132
Show file tree
Hide file tree
Showing 66 changed files with 1,793 additions and 1,793 deletions.
16 changes: 8 additions & 8 deletions doomsday/apps/libdoomsday/include/doomsday/defs/dedarray.h
Expand Up @@ -82,7 +82,7 @@ struct LIBDOOMSDAY_PUBLIC DEDArray

void releaseAll()
{
for(int i = 0; i < count.num; ++i)
for (int i = 0; i < count.num; ++i)
{
elements[i].release();
}
Expand All @@ -98,7 +98,7 @@ struct LIBDOOMSDAY_PUBLIC DEDArray
PODType *copied = (PODType *) M_Malloc(sizeof(PODType) * count.max);
memcpy(copied, elements, sizeof(PODType) * count.num);
elements = copied;
for(int i = 0; i < count.num; ++i)
for (int i = 0; i < count.num; ++i)
{
elements[i].reallocate();
}
Expand Down Expand Up @@ -152,10 +152,10 @@ struct LIBDOOMSDAY_PUBLIC DEDArray
int const first = count.num;

count.num += addedCount;
if(count.num > count.max)
if (count.num > count.max)
{
count.max *= 2; // Double the size of the array.
if(count.num > count.max) count.max = count.num;
if (count.num > count.max) count.max = count.num;
elements = reinterpret_cast<PODType *>(M_Realloc(elements, sizeof(PODType) * count.max));
}

Expand All @@ -169,15 +169,15 @@ struct LIBDOOMSDAY_PUBLIC DEDArray
DENG2_ASSERT(index >= 0);
DENG2_ASSERT(index < size());

if(index < 0 || index >= size()) return;
if (index < 0 || index >= size()) return;

elements[index].release();

memmove(elements + index,
elements + (index + 1),
sizeof(PODType) * (count.num - index - 1));

if(--count.num < count.max / 2)
if (--count.num < count.max / 2)
{
count.max /= 2;
elements = (PODType *) M_Realloc(elements, sizeof(PODType) * count.max);
Expand Down Expand Up @@ -209,7 +209,7 @@ struct LIBDOOMSDAY_PUBLIC DEDArray

int indexOf(PODType const *element) const
{
if(size() > 0 && element >= &first() && element <= &last())
if (size() > 0 && element >= &first() && element <= &last())
return element - elements;
return -1;
}
Expand All @@ -218,7 +218,7 @@ struct LIBDOOMSDAY_PUBLIC DEDArray
{
releaseAll();

if(elements) M_Free(elements);
if (elements) M_Free(elements);
elements = 0;

count.num = count.max = 0;
Expand Down
8 changes: 4 additions & 4 deletions doomsday/apps/libdoomsday/include/doomsday/defs/dedtypes.h
Expand Up @@ -428,14 +428,14 @@ typedef struct LIBDOOMSDAY_PUBLIC ded_group_s {
}

ded_group_member_t *tryFindFirstMemberWithMaterial(de::Uri const &materialUri) {
if(!materialUri.isEmpty()) {
for(int i = 0; i < members.size(); ++i) {
if(members[i].material && *members[i].material == materialUri) {
if (!materialUri.isEmpty()) {
for (int i = 0; i < members.size(); ++i) {
if (members[i].material && *members[i].material == materialUri) {
return &members[i];
}

// Only animate if the first frame in the group?
if(flags & AGF_FIRST_ONLY) break;
if (flags & AGF_FIRST_ONLY) break;
}
}
return nullptr; // Not found.
Expand Down
Expand Up @@ -102,7 +102,7 @@ namespace de
{
// We require an extension for this.
String ext = path.fileNameExtension();
if(!ext.isEmpty())
if (!ext.isEmpty())
{
return knownFileNameExtensions_.contains(ext, Qt::CaseInsensitive);
}
Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/libdoomsday/include/doomsday/filesys/fs_main.h
Expand Up @@ -496,10 +496,10 @@ class LIBDOOMSDAY_PUBLIC FS1
findAll(predicate, parameters, found);
// Filter out the wrong types.
QMutableListIterator<FileHandle *> i(found);
while(i.hasNext())
while (i.hasNext())
{
i.next();
if(!i.value()->file().is<Type>())
if (!i.value()->file().is<Type>())
{
i.remove();
}
Expand Down
Expand Up @@ -82,12 +82,12 @@ class LIBDOOMSDAY_PUBLIC ThinkerData
};

DENG2_SCRIPT_ARGUMENT_TYPE(ThinkerData *,
if(!arg) return ScriptLex::NONE;
if (!arg) return ScriptLex::NONE;
return scriptArgumentAsText(arg->objectNamespace());
)

DENG2_SCRIPT_ARGUMENT_TYPE(ThinkerData const *,
if(!arg) return ScriptLex::NONE;
if (!arg) return ScriptLex::NONE;
return scriptArgumentAsText(arg->objectNamespace());
)

Expand Down
28 changes: 14 additions & 14 deletions doomsday/apps/libdoomsday/src/busymode.cpp
Expand Up @@ -48,7 +48,7 @@ DENG2_PIMPL(BusyMode)
int performTask(BusyTask *task)
{
DENG2_ASSERT(task);
if(!task) return 0;
if (!task) return 0;

DENG2_ASSERT(!busyInited);

Expand All @@ -58,11 +58,11 @@ DENG2_PIMPL(BusyMode)
busyInited = true;

ITaskRunner::Result result;
if(runner)
if (runner)
{
result = runner->runTask(task);
}
if(!result.wasRun)
if (!result.wasRun)
{
// As a fallback, just run the callback.
result.returnValue = task->worker(task->workerData);
Expand All @@ -71,13 +71,13 @@ DENG2_PIMPL(BusyMode)

// Clean up.
busyInited = false;
if(task->name)
if (task->name)
{
LOG_VERBOSE("Busy task \"%s\" performed in %.2f seconds")
<< task->name
<< taskStartedAt.since();
}
if(busyTaskEndedWithError)
if (busyTaskEndedWithError)
{
throw Error("BusyMode::performTask", "Task failed: " + busyError);
}
Expand Down Expand Up @@ -126,7 +126,7 @@ BusyTask *BusyMode::currentTask() const
{
DENG2_GUARD(d)

if(!isActive()) return nullptr;
if (!isActive()) return nullptr;
return d->busyTask;
}

Expand Down Expand Up @@ -161,7 +161,7 @@ static BusyTask *newTask(int mode, std::function<int (void *)> worker, void* wor
task->workerData = workerData;

// Take a copy of the task name.
if(!taskName.isEmpty())
if (!taskName.isEmpty())
{
task->name = M_StrDup(taskName.toLatin1());
}
Expand All @@ -172,7 +172,7 @@ static BusyTask *newTask(int mode, std::function<int (void *)> worker, void* wor
static void deleteTask(BusyTask *task)
{
DENG_ASSERT(task);
if(task->name) M_Free((void *)task->name);
if (task->name) M_Free((void *)task->name);
delete task;
}

Expand Down Expand Up @@ -213,7 +213,7 @@ int BusyMode::runTasks(BusyTask *tasks, int numTasks)

DENG2_ASSERT(!isActive());

if(!tasks || numTasks <= 0) return result; // Hmm, no work?
if (!tasks || numTasks <= 0) return result; // Hmm, no work?

// Pick the first task.
task = tasks;
Expand All @@ -224,10 +224,10 @@ int BusyMode::runTasks(BusyTask *tasks, int numTasks)
}

// Process tasks.
for(i = 0; i < numTasks; ++i, ++task)
for (i = 0; i < numTasks; ++i, ++task)
{
// If no new task name is specified, continue using the name of the previous task.
if(task->name)
if (task->name)
{
currentTaskName = task->name;
}
Expand All @@ -237,15 +237,15 @@ int BusyMode::runTasks(BusyTask *tasks, int numTasks)
/*
/// @todo Kludge: Force BUSYF_STARTUP here so that the animation of one task
/// is not drawn on top of the last frame of the previous.
if(numTasks > 1)
if (numTasks > 1)
{
mode |= BUSYF_STARTUP;
}
// kludge end
*/

// Null tasks are not processed (implicit success).
if(!task->worker) continue;
if (!task->worker) continue;

/**
* Process the work.
Expand All @@ -268,7 +268,7 @@ int BusyMode::runTasks(BusyTask *tasks, int numTasks)
i->busyTaskCompleted(*task);
}

if(result) break;
if (result) break;
}

DENG2_FOR_AUDIENCE2(End, i)
Expand Down
34 changes: 17 additions & 17 deletions doomsday/apps/libdoomsday/src/console/alias.cpp
Expand Up @@ -34,11 +34,11 @@ void Con_InitAliases()

void Con_ClearAliases()
{
if(caliases)
if (caliases)
{
// Free the alias data.
calias_t** cal = caliases;
for(uint i = 0; i < numCAliases; ++i, ++cal)
for (uint i = 0; i < numCAliases; ++i, ++cal)
{
M_Free((*cal)->name);
M_Free((*cal)->command);
Expand All @@ -57,29 +57,29 @@ calias_t *Con_FindAlias(char const *name)
dd_bool isDone;
int result;

if(numCAliases == 0) return 0;
if(!name || !name[0]) return 0;
if (numCAliases == 0) return 0;
if (!name || !name[0]) return 0;

bottomIdx = 0;
topIdx = numCAliases-1;
cal = NULL;
isDone = false;
while(bottomIdx <= topIdx && !isDone)
while (bottomIdx <= topIdx && !isDone)
{
pivot = bottomIdx + (topIdx - bottomIdx)/2;

result = qstricmp(caliases[pivot]->name, name);
if(result == 0)
if (result == 0)
{
// Found.
cal = caliases[pivot];
isDone = true;
}
else
{
if(result > 0)
if (result > 0)
{
if(pivot == 0)
if (pivot == 0)
{
// Not present.
isDone = true;
Expand All @@ -97,20 +97,20 @@ calias_t *Con_FindAlias(char const *name)

calias_t* Con_AddAlias(char const* name, char const* command)
{
if(!name || !name[0] || !command || !command[0]) return 0;
if (!name || !name[0] || !command || !command[0]) return 0;

caliases = (calias_t**) M_Realloc(caliases, sizeof(*caliases) * ++numCAliases);

// Find the insertion point.
uint idx;
for(idx = 0; idx < numCAliases-1; ++idx)
for (idx = 0; idx < numCAliases-1; ++idx)
{
if(qstricmp(caliases[idx]->name, name) > 0)
if (qstricmp(caliases[idx]->name, name) > 0)
break;
}

// Make room for the new alias.
if(idx != numCAliases-1)
if (idx != numCAliases-1)
memmove(caliases + idx + 1, caliases + idx, sizeof(*caliases) * (numCAliases - 1 - idx));

// Add the new variable, making a static copy of the name in the zone (this allows
Expand All @@ -130,20 +130,20 @@ void Con_DeleteAlias(calias_t* cal)
DENG_ASSERT(cal);

uint idx;
for(idx = 0; idx < numCAliases; ++idx)
for (idx = 0; idx < numCAliases; ++idx)
{
if(caliases[idx] == cal)
if (caliases[idx] == cal)
break;
}
if(idx == numCAliases) return;
if (idx == numCAliases) return;

Con_UpdateKnownWords();

M_Free(cal->name);
M_Free(cal->command);
M_Free(cal);

if(idx < numCAliases - 1)
if (idx < numCAliases - 1)
{
memmove(caliases + idx, caliases + idx + 1, sizeof(*caliases) * (numCAliases - idx - 1));
}
Expand All @@ -163,7 +163,7 @@ String Con_AliasAsStyledText(calias_t *alias)
void Con_AddKnownWordsForAliases()
{
calias_t** cal = caliases;
for(uint i = 0; i < numCAliases; ++i, ++cal)
for (uint i = 0; i < numCAliases; ++i, ++cal)
{
Con_AddKnownWord(WT_CALIAS, *cal);
}
Expand Down

0 comments on commit 05a1132

Please sign in to comment.