Mercurial > hg > openttd
changeset 17398:00953669945d draft
(svn r22144) -Codechange: Unify 'while (true)' to 'for (;;)'
author | alberth <alberth@openttd.org> |
---|---|
date | Fri, 25 Feb 2011 21:53:43 +0000 (2011-02-25) |
parents | 51622f17c7d4 |
children | c8b6698f2078 |
files | src/depend/depend.cpp src/hotkeys.cpp src/misc/hashtable.hpp src/network/network_content.cpp src/newgrf_station.cpp src/pathfinder/yapf/yapf_base.hpp src/pathfinder/yapf/yapf_road.cpp src/saveload/saveload.cpp src/strings.cpp src/video/dedicated_v.cpp src/widget.cpp |
diffstat | 11 files changed, 14 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/depend/depend.cpp +++ b/src/depend/depend.cpp @@ -565,7 +565,7 @@ { 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 value = ExpressionAnd(lexer, defines, verbose); - while (true) { + for (;;) { if (lexer->GetToken() != TOKEN_OR) return value; if (verbose) fprintf(stderr, " || "); lexer->Lex();
--- a/src/hotkeys.cpp +++ b/src/hotkeys.cpp @@ -90,7 +90,7 @@ { assert(start <= end); uint16 keycode = 0; - while (true) { + for (;;) { const char *cur = start; while (*cur != '+' && cur != end) cur++; uint16 code = ParseCode(start, cur);
--- a/src/misc/hashtable.hpp +++ b/src/misc/hashtable.hpp @@ -67,7 +67,7 @@ return true; } Titem_ *pItem = m_pFirst; - while (true) { + for (;;) { if (pItem == NULL) { return false; }
--- a/src/network/network_content.cpp +++ b/src/network/network_content.cpp @@ -379,7 +379,7 @@ 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
--- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -151,7 +151,7 @@ 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;
--- a/src/pathfinder/yapf/yapf_base.hpp +++ b/src/pathfinder/yapf/yapf_base.hpp @@ -130,7 +130,7 @@ Yapf().PfSetStartupNodes(); bool bDestFound = true; - while (true) { + for (;;) { m_num_steps++; Node *n = m_nodes.GetBestOpenNode(); if (n == NULL) {
--- a/src/pathfinder/yapf/yapf_road.cpp +++ b/src/pathfinder/yapf/yapf_road.cpp @@ -107,7 +107,7 @@ /* 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);
--- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -761,7 +761,7 @@ * 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;
--- a/src/strings.cpp +++ b/src/strings.cpp @@ -675,7 +675,7 @@ 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(); }
--- a/src/video/dedicated_v.cpp +++ b/src/video/dedicated_v.cpp @@ -97,7 +97,7 @@ #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< */
--- a/src/widget.cpp +++ b/src/widget.cpp @@ -1061,7 +1061,7 @@ /* 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 @@ /* 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 @@ 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);