1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-01 07:54:27 +00:00

Replace do { while (true) ; with for (;;)

This commit is contained in:
libretroadmin 2024-04-05 20:02:36 +02:00
parent 0212d8e770
commit b8d12a7d12
3 changed files with 26 additions and 38 deletions

View File

@ -86,7 +86,7 @@ bool TInputScanner::consumeComment()
// a '//' style comment
get(); // consume the second '/'
c = get();
do {
for (;;) {
while (c != EndOfInput && c != '\\' && c != '\r' && c != '\n')
c = get();
@ -107,19 +107,16 @@ bool TInputScanner::consumeComment()
get();
c = get();
}
} while (true);
};
// put back the last non-comment character
if (c != EndOfInput)
unget();
return true;
} else if (c == '*') {
// a '/*' style comment
get(); // consume the '*'
c = get();
do {
for (;;) {
while (c != EndOfInput && c != '*')
c = get();
if (c == '*') {
@ -129,21 +126,22 @@ bool TInputScanner::consumeComment()
// not end of comment
} else // end of input
break;
} while (true);
return true;
} else {
};
}
else
{
// it's not a comment, put the '/' back
unget();
return false;
}
return true;
}
// skip whitespace, then skip a comment, rinse, repeat
void TInputScanner::consumeWhitespaceComment(bool& foundNonSpaceTab)
{
do {
for (;;) {
consumeWhiteSpace(foundNonSpaceTab);
// if not starting a comment now, then done
@ -153,10 +151,9 @@ void TInputScanner::consumeWhitespaceComment(bool& foundNonSpaceTab)
// skip potential comment
foundNonSpaceTab = true;
if (! consumeComment())
if (!consumeComment())
return;
} while (true);
};
}
// Returns true if there was non-white space (e.g., a comment, newline) before the #version
@ -184,7 +181,7 @@ bool TInputScanner::scanVersion(int& version, EProfile& profile, bool& notFirstT
bool foundNonSpaceTab = false;
bool lookingInMiddle = false;
int c;
do {
for (;;) {
if (lookingInMiddle) {
notFirstToken = true;
// make forward progress by finishing off the current line plus extra new lines
@ -273,7 +270,7 @@ bool TInputScanner::scanVersion(int& version, EProfile& profile, bool& notFirstT
profile = ECompatibilityProfile;
return versionNotFirst;
} while (true);
};
}
// Fill this in when doing glslang-level scanning, to hand back to the parser.
@ -723,7 +720,7 @@ void TScanContext::deleteKeywordMap()
// Returning 0 implies end of input.
int TScanContext::tokenize(TPpContext* pp, TParserToken& token)
{
do {
for (;;) {
parserToken = &token;
TPpToken ppToken;
int token = pp->tokenize(ppToken);
@ -818,7 +815,7 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token)
_parseContext.error(loc, "unexpected token", buf, "");
break;
}
} while (true);
};
}
int TScanContext::tokenizeIdentifier()

View File

@ -89,16 +89,12 @@
*/
static const void *MD5_body(MD5_CTX *ctx, const void *data, unsigned long size)
{
const unsigned char *ptr;
MD5_u32plus a, b, c, d;
MD5_u32plus saved_a, saved_b, saved_c, saved_d;
ptr = (const unsigned char *)data;
a = ctx->a;
b = ctx->b;
c = ctx->c;
d = ctx->d;
const unsigned char *ptr = (const unsigned char *)data;
MD5_u32plus a = ctx->a;
MD5_u32plus b = ctx->b;
MD5_u32plus c = ctx->c;
MD5_u32plus d = ctx->d;
do {
saved_a = a;
@ -207,10 +203,8 @@ void MD5_Init(MD5_CTX *ctx)
void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size)
{
MD5_u32plus saved_lo;
unsigned long used, available;
saved_lo = ctx->lo;
unsigned long used;
MD5_u32plus saved_lo = ctx->lo;
if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
ctx->hi++;
ctx->hi += size >> 29;
@ -219,7 +213,7 @@ void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size)
if (used)
{
available = 64 - used;
unsigned long available = 64 - used;
if (size < available)
{
@ -244,9 +238,8 @@ void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size)
void MD5_Final(unsigned char *result, MD5_CTX *ctx)
{
unsigned long used, available;
used = ctx->lo & 0x3f;
unsigned long available;
unsigned long used = ctx->lo & 0x3f;
ctx->buffer[used++] = 0x80;

View File

@ -226,11 +226,9 @@ void SHA1Input( SHA1Context *context,
context->Length_High++;
/* Force it to 32 bits */
context->Length_High &= 0xFFFFFFFF;
/* Message is too long */
if (context->Length_High == 0)
{
/* Message is too long */
context->Corrupted = 1;
}
}
if (context->Message_Block_Index == 64)