summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2011-02-25 21:53:43 +0000
committeralberth <alberth@openttd.org>2011-02-25 21:53:43 +0000
commit1dbc0a20bed5cd85035b4f84a649c4f7386b07ab (patch)
tree2913d6359a374885441eeb51a67c6e0c7e0f08ef
parent87c8d97aca779cb227a4e015233cd266b63f2b79 (diff)
downloadopenttd-1dbc0a20bed5cd85035b4f84a649c4f7386b07ab.tar.xz
(svn r22144) -Codechange: Unify 'while (true)' to 'for (;;)'
-rw-r--r--src/depend/depend.cpp4
-rw-r--r--src/hotkeys.cpp2
-rw-r--r--src/misc/hashtable.hpp2
-rw-r--r--src/network/network_content.cpp2
-rw-r--r--src/newgrf_station.cpp2
-rw-r--r--src/pathfinder/yapf/yapf_base.hpp2
-rw-r--r--src/pathfinder/yapf/yapf_road.cpp2
-rw-r--r--src/saveload/saveload.cpp2
-rw-r--r--src/strings.cpp2
-rw-r--r--src/video/dedicated_v.cpp2
-rw-r--r--src/widget.cpp6
11 files changed, 14 insertions, 14 deletions
diff --git a/src/depend/depend.cpp b/src/depend/depend.cpp
index ba868464b..a7c4285e3 100644
--- a/src/depend/depend.cpp
+++ b/src/depend/depend.cpp
@@ -565,7 +565,7 @@ bool ExpressionAnd(Lexer *lexer, StringSet *defines, bool verbose)
{
bool value = ExpressionDefined(lexer, defines, verbose);
- while (true) {
+ for (;;) {
if (lexer->GetToken() != TOKEN_AND) return value;
if (verbose) fprintf(stderr, " && ");
lexer->Lex();
@@ -584,7 +584,7 @@ bool ExpressionOr(Lexer *lexer, StringSet *defines, bool verbose)
{
bool value = ExpressionAnd(lexer, defines, verbose);
- while (true) {
+ for (;;) {
if (lexer->GetToken() != TOKEN_OR) return value;
if (verbose) fprintf(stderr, " || ");
lexer->Lex();
diff --git a/src/hotkeys.cpp b/src/hotkeys.cpp
index 5ad8f2bf9..2434686cc 100644
--- a/src/hotkeys.cpp
+++ b/src/hotkeys.cpp
@@ -90,7 +90,7 @@ static uint16 ParseKeycode(const char *start, const char *end)
{
assert(start <= end);
uint16 keycode = 0;
- while (true) {
+ for (;;) {
const char *cur = start;
while (*cur != '+' && cur != end) cur++;
uint16 code = ParseCode(start, cur);
diff --git a/src/misc/hashtable.hpp b/src/misc/hashtable.hpp
index 46ef7ca47..3289d3bbf 100644
--- a/src/misc/hashtable.hpp
+++ b/src/misc/hashtable.hpp
@@ -67,7 +67,7 @@ struct CHashTableSlotT
return true;
}
Titem_ *pItem = m_pFirst;
- while (true) {
+ for (;;) {
if (pItem == NULL) {
return false;
}
diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp
index e0ff5ab28..05a7a7bf5 100644
--- a/src/network/network_content.cpp
+++ b/src/network/network_content.cpp
@@ -379,7 +379,7 @@ static bool GunzipFile(const ContentInfo *ci)
ret = false;
} else {
byte buff[8192];
- while (1) {
+ for (;;) {
int read = gzread(fin, buff, sizeof(buff));
if (read == 0) {
/* If gzread() returns 0, either the end-of-file has been
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp
index b27a09fe3..06d6fdc01 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -151,7 +151,7 @@ static TileIndex FindRailStationEnd(TileIndex tile, TileIndexDiff delta, bool ch
if (check_type) orig_type = GetCustomStationSpecIndex(tile);
if (check_axis) orig_axis = GetRailStationAxis(tile);
- while (true) {
+ for (;;) {
TileIndex new_tile = TILE_ADD(tile, delta);
if (!IsTileType(new_tile, MP_STATION) || GetStationIndex(new_tile) != sid) break;
diff --git a/src/pathfinder/yapf/yapf_base.hpp b/src/pathfinder/yapf/yapf_base.hpp
index 42c73a170..b15d563b6 100644
--- a/src/pathfinder/yapf/yapf_base.hpp
+++ b/src/pathfinder/yapf/yapf_base.hpp
@@ -130,7 +130,7 @@ public:
Yapf().PfSetStartupNodes();
bool bDestFound = true;
- while (true) {
+ for (;;) {
m_num_steps++;
Node *n = m_nodes.GetBestOpenNode();
if (n == NULL) {
diff --git a/src/pathfinder/yapf/yapf_road.cpp b/src/pathfinder/yapf/yapf_road.cpp
index 9d0b65eec..c909e7e8a 100644
--- a/src/pathfinder/yapf/yapf_road.cpp
+++ b/src/pathfinder/yapf/yapf_road.cpp
@@ -107,7 +107,7 @@ public:
/* start at n.m_key.m_tile / n.m_key.m_td and walk to the end of segment */
TileIndex tile = n.m_key.m_tile;
Trackdir trackdir = n.m_key.m_td;
- while (true) {
+ for (;;) {
/* base tile cost depending on distance between edges */
segment_cost += Yapf().OneTileCost(tile, trackdir);
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 76f5215e6..4b7e3845a 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -761,7 +761,7 @@ int SlIterateArray()
* we must have read in all the data, so we must be at end of current block. */
if (_next_offs != 0 && _sl.reader->GetSize() != _next_offs) SlErrorCorrupt("Invalid chunk size");
- while (true) {
+ for (;;) {
uint length = SlReadArrayLength();
if (length == 0) {
_next_offs = 0;
diff --git a/src/strings.cpp b/src/strings.cpp
index c6ad1f445..d5bbabc01 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -675,7 +675,7 @@ static char *FormatString(char *buff, const char *str_arg, int64 *argv, const in
std::stack<const char *> str_stack;
str_stack.push(str_arg);
- while (true) {
+ for (;;) {
while (!str_stack.empty() && (b = Utf8Consume(&str_stack.top())) == '\0') {
str_stack.pop();
}
diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp
index 9942a347d..10a1b92b6 100644
--- a/src/video/dedicated_v.cpp
+++ b/src/video/dedicated_v.cpp
@@ -97,7 +97,7 @@ static void WINAPI CheckForConsoleInput()
#else
DWORD nb;
HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
- while (true) {
+ for (;;) {
ReadFile(hStdin, _win_console_thread_buffer, lengthof(_win_console_thread_buffer), &nb, NULL);
/* Signal input waiting that input is read and wait for it being handled
* SignalObjectAndWait() should be used here, but it's unsupported in Win98< */
diff --git a/src/widget.cpp b/src/widget.cpp
index 44bdb91d8..364403e30 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -1061,7 +1061,7 @@ void NWidgetHorizontal::SetupSmallestSize(Window *w, bool init_array)
/* 1b. Make the container higher if needed to accomadate all childs nicely. */
uint max_smallest = this->smallest_y + 3 * max_vert_fill; // Upper limit to computing smallest height.
uint cur_height = this->smallest_y;
- while (true) {
+ for (;;) {
for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) {
uint step_size = child_wid->GetVerticalStepSize(ST_SMALLEST);
uint child_height = child_wid->smallest_y + child_wid->padding_top + child_wid->padding_bottom;
@@ -1213,7 +1213,7 @@ void NWidgetVertical::SetupSmallestSize(Window *w, bool init_array)
/* 1b. Make the container wider if needed to accomadate all childs nicely. */
uint max_smallest = this->smallest_x + 3 * max_hor_fill; // Upper limit to computing smallest height.
uint cur_width = this->smallest_x;
- while (true) {
+ for (;;) {
for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) {
uint step_size = child_wid->GetHorizontalStepSize(ST_SMALLEST);
uint child_width = child_wid->smallest_x + child_wid->padding_left + child_wid->padding_right;
@@ -2538,7 +2538,7 @@ static int MakeWidgetTree(const NWidgetPart *parts, int count, NWidgetBase **par
assert(*parent == NULL || (nwid_cont != NULL && nwid_parent == NULL) || (nwid_cont == NULL && nwid_parent != NULL));
int total_used = 0;
- while (true) {
+ for (;;) {
NWidgetBase *sub_widget = NULL;
bool fill_sub = false;
int num_used = MakeNWidget(parts, count - total_used, &sub_widget, &fill_sub, biggest_index);