From 1de7183c7a7acd06908b3f1d35c7e0d3cab5a9e0 Mon Sep 17 00:00:00 2001 From: ehouse Date: Fri, 8 Oct 2004 23:59:32 +0000 Subject: [PATCH] Take endienness into account when converting dicts so can do from ARM too. --- palm/dictlist.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/palm/dictlist.c b/palm/dictlist.c index 0e701cad4..ce854bfdc 100644 --- a/palm/dictlist.c +++ b/palm/dictlist.c @@ -448,7 +448,8 @@ convertOneDict( UInt16 cardNo, LocalID dbID ) MemHandleResize( h, sizeof(*header) ); } - tmp.flags = 0x0002; + tmp.flags = XP_HTONS(0x0002); + XP_ASSERT( sizeof(tmp.flags) == 2 ); header = (dawg_header*)MemHandleLock(h); charTableRecNum = header->charTableRecNum; firstEdgeRecNum = header->firstEdgeRecNum; @@ -465,13 +466,16 @@ convertOneDict( UInt16 cardNo, LocalID dbID ) XP_ASSERT( err == errNone ); if ( err == errNone ) { - XP_U16 buf[MAX_UNIQUE_TILES+1]; + XP_U8 buf[(MAX_UNIQUE_TILES+1)*2]; XP_S16 i; XP_U8* ptr = (XP_U8*)MemHandleLock( h ); + + XP_MEMSET( buf, 0, sizeof(buf) ); + for ( i = 0; i < nChars; ++i ) { - buf[i] = ptr[i]; + buf[(i*2)+1] = ptr[i]; } - DmWrite( ptr, 0, buf, nChars * sizeof(buf[0]) ); + DmWrite( ptr, 0, buf, nChars * 2 ); MemHandleUnlock(h); } err = DmReleaseRecord( ref, charTableRecNum, true );