mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +01:00
Don't choke when words are longer than 15 letters.
This commit is contained in:
parent
a4f27e5525
commit
a8fb37504d
1 changed files with 3 additions and 6 deletions
|
@ -485,7 +485,7 @@ readOneWord( char* wordBuf, int bufLen, int* lenp, bool* gotEOF )
|
||||||
bool isEOF = byt == EOF;
|
bool isEOF = byt == EOF;
|
||||||
*gotEOF = isEOF;
|
*gotEOF = isEOF;
|
||||||
|
|
||||||
assert( isEOF || count < bufLen );
|
assert( isEOF || count < bufLen || dropWord );
|
||||||
if ( !dropWord && (count >= gLimLow) && (count <= gLimHigh) ) {
|
if ( !dropWord && (count >= gLimLow) && (count <= gLimHigh) ) {
|
||||||
assert( count < bufLen );
|
assert( count < bufLen );
|
||||||
wordBuf[count] = '\0';
|
wordBuf[count] = '\0';
|
||||||
|
@ -501,7 +501,7 @@ readOneWord( char* wordBuf, int bufLen, int* lenp, bool* gotEOF )
|
||||||
if ( gDebug ) {
|
if ( gDebug ) {
|
||||||
char buf[T2ABUFLEN(count)];
|
char buf[T2ABUFLEN(count)];
|
||||||
wordBuf[count] = '\0';
|
wordBuf[count] = '\0';
|
||||||
fprintf( stderr, "%s: dropping word (len=%d): %s\n", __func__,
|
fprintf( stderr, "%s: dropping word (len>=%d): %s\n", __func__,
|
||||||
count, tileToAscii( buf, sizeof(buf), wordBuf ) );
|
count, tileToAscii( buf, sizeof(buf), wordBuf ) );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -517,10 +517,7 @@ readOneWord( char* wordBuf, int bufLen, int* lenp, bool* gotEOF )
|
||||||
assert( count < bufLen );
|
assert( count < bufLen );
|
||||||
wordBuf[count++] = (char)gTableHash[byt];
|
wordBuf[count++] = (char)gTableHash[byt];
|
||||||
if ( count >= bufLen ) {
|
if ( count >= bufLen ) {
|
||||||
char buf[T2ABUFLEN(count)];
|
dropWord = true;
|
||||||
ERROR_EXIT( "no space for word %d (starting \"%s\")",
|
|
||||||
gWordCount,
|
|
||||||
tileToAscii( buf, sizeof(buf), wordBuf ));
|
|
||||||
}
|
}
|
||||||
} else if ( gKillIfMissing || !dropWord ) {
|
} else if ( gKillIfMissing || !dropWord ) {
|
||||||
char buf[T2ABUFLEN(count)];
|
char buf[T2ABUFLEN(count)];
|
||||||
|
|
Loading…
Reference in a new issue