(svn r22144) -Codechange: Unify 'while (true)' to 'for (;;)'

pull/155/head
alberth 13 years ago
parent c43e818ff2
commit a14f4eb271

@ -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();

@ -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);

@ -67,7 +67,7 @@ struct CHashTableSlotT
return true;
}
Titem_ *pItem = m_pFirst;
while (true) {
for (;;) {
if (pItem == NULL) {
return false;
}

@ -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

@ -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;

@ -130,7 +130,7 @@ public:
Yapf().PfSetStartupNodes();
bool bDestFound = true;
while (true) {
for (;;) {
m_num_steps++;
Node *n = m_nodes.GetBestOpenNode();
if (n == NULL) {

@ -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);

@ -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;

@ -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();
}

@ -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< */

@ -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);

Loading…
Cancel
Save