|
From: icreedon <icr...@us...> - 2004-11-22 19:07:39
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27278 Modified Files: ops.c Log Message: added bcdToLong function, used to fix Mac OS X major revision number bug Index: ops.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/ops.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ops.c 26 Oct 2004 10:24:57 -0000 1.3 --- ops.c 22 Nov 2004 19:07:28 -0000 1.4 *************** *** 39,44 **** - - static tydirection directions [ctdirections] = { --- 39,42 ---- *************** *** 865,869 **** gestalt (gestaltSystemVersion, &x); ! numbertostring (x >> 8, bs); /*high byte is major rev.*/ pushchar ('.', bs); --- 863,867 ---- gestalt (gestaltSystemVersion, &x); ! numbertostring (bcdToLong (x >> 8), bs); /* high byte is major rev., 2004-11-16 creedon - convert from bcd for correct display on Mac OS X */ pushchar ('.', bs); *************** *** 955,958 **** --- 953,968 ---- + UInt32 bcdToLong (UInt32 bcd) { /* 2004-11-16 creedon */ + UInt32 ret = 0; + UInt16 i; + for (i = 0; i < 8; i++) { + if (i > 0) + ret += i * 10 * (bcd & 0x0000000f); + else + ret += bcd & 0x0000000f; + bcd >>= 4; + } + return (ret); + } /* bcdToLong */ |