From e8825e119cefe10fefc9fb6900d50f15044707f8 Mon Sep 17 00:00:00 2001 From: ehouse Date: Sat, 5 Sep 2009 13:14:42 +0000 Subject: [PATCH] add comment re: stream format non-change for utf-8 --- xwords4/common/dictnry.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/xwords4/common/dictnry.c b/xwords4/common/dictnry.c index 0b3c9e808..fec15a1c5 100644 --- a/xwords4/common/dictnry.c +++ b/xwords4/common/dictnry.c @@ -242,10 +242,6 @@ dict_writeToStream( const DictionaryCtxt* dict, XWStreamCtxt* stream ) XP_U16 ii, nSpecials; XP_U16 maxCountBits, maxValueBits; - /* Need to keep format identical for non-utf so new versions can play - against old using non-UTF8 dicts. The old ones won't even recognize - UTF8 dicts as dicts, so there shouldn't be any attempts to connect with - them having one open. */ stream_putBits( stream, 6, dict->nFaces ); for ( ii = 0; ii < dict->nFaces*2; ii+=2 ) { @@ -273,6 +269,13 @@ dict_writeToStream( const DictionaryCtxt* dict, XWStreamCtxt* stream ) stream_putBits( stream, maxValueBits, dict->countsAndValues[ii+1] ); } + /* Stream format of the faces is unchanged: chars run together, which + * happens to equal utf-8 for ascii. But now there may be more than one + * byte per face. Old code assumes that, but compatibility is ensured by + * the caller which will not accept an incoming message if the version's + * too new. And utf-8 dicts are flagged as newer by the sender. + */ + XP_UCHAR buf[64]; XP_U16 nBytes = sizeof(buf); ucharsToNarrow( dict, buf, &nBytes );