Patch #: 171 Type: performance improvement Priority: none Modification: speed up AFP command packing/unpacking Submitted: Rudy Nedved Archived: munnari.OZ.AU mac/cap.patches/cap60.patch171 Application: 'cd cap60; patch -p < cap60.patches/cap60.patch171' Summary: replace afpcmd.c bcopy()s with inline code File: cap60/lib/afp/afpcmd.c *** lib/afp/afpcmd.c.orig Wed Aug 21 00:41:25 1991 --- lib/afp/afpcmd.c Wed Nov 24 22:06:08 1993 *************** *** 1,8 **** /* ! * $Author: djh $ $Date: 1991/08/20 14:41:03 $ ! * $Header: /mac/src/cap60/lib/afp/RCS/afpcmd.c,v 2.2 1991/08/20 14:41:03 djh Rel djh $ ! * $Revision: 2.2 $ ! */ /* * afpcmd.c - Packing and unpacking commands --- 1,9 ---- /* ! * $Author: djh $ $Date: 1993/11/24 11:05:12 $ ! * $Header: /mac/src/cap60/lib/afp/RCS/afpcmd.c,v 2.3 1993/11/24 11:05:12 djh Rel djh $ ! * $Revision: 2.3 $ ! * ! */ /* * afpcmd.c - Packing and unpacking commands *************** *** 12,19 **** * Copyright (c) 1986, 1987 by The Trustees of Columbia University in the * City of New York. * ! * WARNING: if your machine is not a vax, sun, ibm pc/rt or pyramid ! * you must define BYTESWAPPED if you machine is byteswapped * * Edit History: * --- 13,20 ---- * Copyright (c) 1986, 1987 by The Trustees of Columbia University in the * City of New York. * ! * WARNING: if your machine is not a vax, sun, ibm pc/rt or pyramid you ! * (or Configure) must define BYTESWAPPED if your machine is byteswapped * * Edit History: * *************** *** 21,29 **** * */ - /* PATCH: mips.ultrix.byteswap, djh@munnari.OZ.AU, 12/11/90 */ - /* PATCH: XENIX/file.3, djh@munnari.OZ.AU, 20/11/90 */ - #include #include #include /* for ntohs, etc. */ --- 22,27 ---- *************** *** 30,83 **** #include #include #include ! /* following would be really simple if we could use #if, but vms */ ! /* c doesn't like and hopefully someday... */ #ifndef BYTESWAPPED ! #ifdef ultrix ! # ifdef mips ! # define BYTESWAPPED ! # endif ! #endif # ifdef vax - /* This should be defined if you are byte swapped. */ # define BYTESWAPPED ! # endif ! #endif ! /* What bogusity */ ! #ifndef LOOSE_BYTESWAPPED ! # ifdef vax ! /* This should only be defined if you are byte swapped and you can be sure */ ! /* (byte *) would be the same as a (word *) or (dword *) */ ! # define LOOSE_BYTESWAPPED ! # endif ! #endif #ifndef BYTESWAPPED # ifdef ns16000 # define BYTESWAPPED ! # endif ! #endif #ifndef BYTESWAPPED # ifdef ns32000 # define BYTESWAPPED ! # endif ! #endif /* add this in case sequent doesn't define nsxxxxx */ #ifndef BYTESWAPPED # ifdef sequent # define BYTESWAPPED ! # endif ! #endif #ifndef BYTESWAPPED # ifdef MIPSEL # define BYTESWAPPED ! # endif ! #endif #ifndef BYTESWAPPED # ifdef i386 # define BYTESWAPPED ! # endif ! #endif /* machines that aren't byteswapped include: ibm032, pyr, sun, hpux, etc */ --- 28,78 ---- #include #include #include ! #ifndef BYTESWAPPED ! # ifdef ultrix ! # ifdef mips ! # define BYTESWAPPED ! # endif mips ! # endif ultrix ! #endif BYTESWAPPED ! ! #ifndef BYTESWAPPED # ifdef vax # define BYTESWAPPED ! # endif vax ! #endif BYTESWAPPED #ifndef BYTESWAPPED # ifdef ns16000 # define BYTESWAPPED ! # endif ns16000 ! #endif BYTESWAPPED ! #ifndef BYTESWAPPED # ifdef ns32000 # define BYTESWAPPED ! # endif ns32000 ! #endif BYTESWAPPED ! /* add this in case sequent doesn't define nsxxxxx */ #ifndef BYTESWAPPED # ifdef sequent # define BYTESWAPPED ! # endif sequent ! #endif BYTESWAPPED ! #ifndef BYTESWAPPED # ifdef MIPSEL # define BYTESWAPPED ! # endif MIPSEL ! #endif BYTESWAPPED ! #ifndef BYTESWAPPED # ifdef i386 # define BYTESWAPPED ! # endif i386 ! #endif BYTESWAPPED /* machines that aren't byteswapped include: ibm032, pyr, sun, hpux, etc */ *************** *** 86,93 **** #endif NULL export void InitPackTime(); - private void ItoETime(); - private void EtoITime(); char *PackNames[] = { "Word", /* P_WORD */ --- 81,86 ---- *************** *** 105,110 **** --- 98,168 ---- "Time" /* P_TIME */ }; + /* + * Convert between Internal Unix time and External AFP time. + * + * All date and time quantities used by AFP are Greenwich Mean Time (GMT) + * values. They are 32 bit signed integers corresponding to the number of + * seconds measured from 12:00AM January 1, 2000 (the start of the next + * century corresponds to datetime=0). + * + * BSD time base is 12:00AM January 1, 1970 + * AFP time base is 12:00AM January 1, 2000 + * + * Actually, it seems that the Mac sends MacTime - could it be + * that our copy of AppleShare does the wrong thing? Version 1.00 was + * bad. Fixed in 1.10 and (hopefully) beyond. + * + * Another problem exists with DST which is not handled here. + * I mean, things will be within 2 hours isn't that good enough :-) + * + * WARNING: if this code breaks, it will be on or near Jan 1, 2000 + * or Jan 18, 2038. Of course, it's doubtful that this code + * will last that long :-) + * + */ + + private int mactime_not_inited = 1; + private long mymactime; + private long maczerotime; + + /* difference btwn unix and mac in seconds */ + /* mac starts at jan 1, 1904 for appleshare 1.0 */ + #define AS1DOT0_MACZEROTIME 0 /* zero time - see comments above */ + #define AS1DOT0_MACTIME (66*365+17)*24*60*60L + + /* difference btween midnight jan 1, 1970 and midnight jan 1, 2000 */ + /* for all others */ + #define MACTIME (((30*365+7)*(-24)*3600L)) + #define MACZEROTIME 0x80000000 /* zero time - from AppleShare 1.1 on */ + + /* Does time zone adjustment */ + + /* + * call with flag set for appleshare 10 style + * + */ + + export void + InitPackTime(flag) + int flag; + { + struct timeval tp; + struct timezone tzp; + + mactime_not_inited = 0; + gettimeofday(&tp, &tzp); + if (flag) { + mymactime = AS1DOT0_MACTIME; + maczerotime = AS1DOT0_MACZEROTIME; + } else { + mymactime = MACTIME; + maczerotime = MACZEROTIME; + } + mymactime -= ((long)tzp.tz_minuteswest*60); + return; + } + int ntohPackX(pt, net, nlen, host) PackEntry *pt; *************** *** 117,123 **** return(ntohPackXbitmap(pt, net, nlen, host, (word)0)); } ! int ntohPackXbitmap(pt,net,nlen,host, bitmap) PackEntry *pt; byte *net; byte *host; --- 175,182 ---- return(ntohPackXbitmap(pt, net, nlen, host, (word)0)); } ! int ! ntohPackXbitmap(pt, net, nlen, host, bitmap) PackEntry *pt; byte *net; byte *host; *************** *** 134,139 **** --- 193,199 ---- for (i=0; pt[i].pe_typ != P_END; i++) if (si < nlen) upack(&pt[i],net,&si,host,&bmap); /* unpack each item */ + return(si); } *************** *** 154,160 **** * */ ! int htonPackX(pe, host, net) PackEntry *pe; byte *host; byte *net; --- 214,221 ---- * */ ! int ! htonPackX(pe, host, net) PackEntry *pe; byte *host; byte *net; *************** *** 163,169 **** } int ! htonPackXbitmap(pe,host,net, bitmap) PackEntry *pe; byte *host; byte *net; --- 224,230 ---- } int ! htonPackXbitmap(pe, host, net, bitmap) PackEntry *pe; byte *host; byte *net; *************** *** 212,229 **** } ! ! void pack(pe,src,dest,di,bmap,vol) PackEntry *pe; ! byte *src,*dest; int *di; VarObjList *vol; word *bmap; { ! byte *s,*d; int siz; word wrd; dword dwrd; if (pe->pe_bit != 0) { /* check if bitmap item */ if ((*bmap & pe->pe_bit) == 0) /* see if a requested bitmap item */ --- 273,296 ---- } ! /* ! * Pack host to net. ! * ! */ ! ! void ! pack(pe, src, dest, di, bmap, vol) PackEntry *pe; ! byte *src, *dest; int *di; VarObjList *vol; word *bmap; { ! byte *s, *d, *t; int siz; word wrd; dword dwrd; + sdword sdwrd; if (pe->pe_bit != 0) { /* check if bitmap item */ if ((*bmap & pe->pe_bit) == 0) /* see if a requested bitmap item */ *************** *** 236,280 **** switch (pe->pe_typ) { /* according to the data type */ case P_BMAP: /* bitmap (2 bytes) */ ! bcopy(s, bmap, sizeof(word)); /* copy bitmap */ ! vol->vol_first = *di; /* offset */ break; /* BITMAP does NOT get included */ #ifdef BYTESWAPPED ! case P_WORD: ! # ifdef LOOSE_BYTESWAPPED ! /* we should be able to get away with this */ ! *((word *)d) = htons(*(word *)s); ! # else ! bcopy(s, &wrd, sizeof(word)); /* copy in case not byte aligned */ ! wrd = htons(wrd); /* convert to netorder */ ! bcopy(&wrd, d, sizeof(word)); /* and copy into dest */ ! # endif *di += 2; break; ! case P_DWRD: /* long (4 bytes) */ ! # ifdef LOOSE_BYTESWAPPED ! *((dword *)d) = htonl(*(dword *)s); ! # else ! bcopy(s, &dwrd, sizeof(dword)); /* copy in case not byte aligned */ ! dwrd = htonl(dwrd); /* convert to netorder */ ! bcopy(&dwrd, d, sizeof(dword)); /* and copy into dest */ ! # endif *di += 4; break; ! #else ! case P_WORD: /* int (2 bytes) */ ! case P_DWRD: ! #endif ! case P_BYTE: ! case P_BYTS: ! bcopy(s, d, siz); /* copy the word */ *di += siz; break; ! case P_TIME: /* do external to internal time conversion */ ! /* assumes time_t input, sdword output */ ! bcopy(s,&dwrd,sizeof(dwrd)); /* copy it */ ! *di += 4; /* advance */ ! ItoETime(dwrd, d); /* convert to internal time */ break; case P_PSTR: /* c to pascal string */ cpyc2pstr(d,s); --- 303,369 ---- switch (pe->pe_typ) { /* according to the data type */ case P_BMAP: /* bitmap (2 bytes) */ ! t = (byte *)bmap; ! t[0] = s[0]; ! t[1] = s[1]; ! vol->vol_first = *di; /* offset */ break; /* BITMAP does NOT get included */ + case P_WORD: /* word (2 bytes) */ #ifdef BYTESWAPPED ! d[0] = s[1]; ! d[1] = s[0]; ! #else BYTESWAPPED ! d[0] = s[0]; ! d[1] = s[1]; ! #endif BYTESWAPPED *di += 2; break; ! case P_DWRD: /* double word (4 bytes) */ ! #ifdef BYTESWAPPED ! d[0] = s[3]; ! d[1] = s[2]; ! d[2] = s[1]; ! d[3] = s[0]; ! #else BYTESWAPPED ! d[0] = s[0]; ! d[1] = s[1]; ! d[2] = s[2]; ! d[3] = s[3]; ! #endif BYTESWAPPED *di += 4; break; ! case P_BYTE: /* single byte */ ! d[0] = s[0]; ! *di += 1; ! break; ! case P_BYTS: /* multiple bytes */ ! bcopy((char *)s, (char *)d, siz); *di += siz; break; ! case P_TIME: /* internal to external time conv. */ ! t = (byte *)&sdwrd; ! #ifdef BYTESWAPPED ! t[0] = s[3]; ! t[1] = s[2]; ! t[2] = s[1]; ! t[3] = s[0]; ! #else BYTESWAPPED ! t[0] = s[0]; ! t[1] = s[1]; ! t[2] = s[2]; ! t[3] = s[3]; ! #endif BYTESWAPPED ! if (mactime_not_inited) ! InitPackTime(0); /* assume version 1.0 obsolete */ ! if ((time_t)sdwrd == 0) ! sdwrd = maczerotime; ! else ! sdwrd += mymactime; ! d[0] = t[0]; ! d[1] = t[1]; ! d[2] = t[2]; ! d[3] = t[3]; ! *di += 4; /* advance */ break; case P_PSTR: /* c to pascal string */ cpyc2pstr(d,s); *************** *** 298,304 **** break; case P_EVEN: if ((*di % 2) != 0) { ! *d = 0; /* zero the current byte */ (*di)++; } break; --- 387,393 ---- break; case P_EVEN: if ((*di % 2) != 0) { ! *d = 0; /* zero the current byte */ (*di)++; } break; *************** *** 312,332 **** /* - * * Unpack net to host. Source is net, dest is host. * */ ! void upack(pe,src,si,dest,bmap) PackEntry *pe; int *si; ! byte *src,*dest; word *bmap; { word sos; ! byte *d,*s; word wrd; dword dwrd; int siz; if (pe->pe_bit != 0) /* check bitmap active */ --- 401,422 ---- /* * Unpack net to host. Source is net, dest is host. * */ ! void ! upack(pe, src, si, dest, bmap) PackEntry *pe; int *si; ! byte *src, *dest; word *bmap; { word sos; ! byte *d, *s, *t; word wrd; dword dwrd; + time_t timet; int siz; if (pe->pe_bit != 0) /* check bitmap active */ *************** *** 339,405 **** switch (pe->pe_typ) { /* according to the data type */ case P_BMAP: /* bitmap (2 bytes) */ ! bcopy(d, bmap, sizeof(word)); /* copy bitmap */ break; - #ifdef BYTESWAPPED case P_WORD: /* word (2 bytes) */ ! # ifdef LOOSE_BYTESWAPPED ! *((word *)d) = ntohs(*(word *)s); ! # else ! bcopy(s, &wrd, sizeof(word)); /* copy in case unaligned */ ! wrd = ntohs(wrd); /* convert to net order */ ! bcopy(&wrd, d, sizeof(word)); /* and copy it back */ ! # endif *si += 2; break; case P_DWRD: /* double word (4 bytes) */ ! # ifdef LOOSE_BYTESWAPPED ! *((dword *)d) = ntohl(*(dword *)s); ! # else ! bcopy(s, &dwrd, sizeof(dword)); /* copy in case unaligned */ ! dwrd = ntohl(dwrd); /* convert to net order */ ! bcopy(&dwrd, d, sizeof(dword)); /* and copy it back */ ! # endif *si += 4; break; - #else - case P_WORD: /* word (2 bytes) */ - case P_DWRD: /* double word (4 bytes) */ - #endif case P_BYTE: /* byte (1 byte) */ case P_BYTS: /* byte string */ bcopy(s,d,siz); /* copy bytes */ *si += siz; break; ! case P_TIME: /* do external to internal time conversion */ ! /* assumes sdword input, time_t output */ ! bcopy(s,&dwrd,sizeof(dwrd)); /* copy it */ ! *si += 4; /* advance */ ! EtoITime(dwrd, d); /* convert to internal time */ break; case P_PSTR: /* c to pascal string */ ! cpyp2cstr(d,s); *si += (*s)+1; break; case P_OSTR: /* offset string */ ! bcopy(s,&sos,sizeof(word)); /* pick up offset from base */ ! sos = ntohs(sos); *si += 2; ! cpyp2cstr(d,&src[sos]); /* copy string */ break; case P_OPTH: ! bcopy(s,&sos,sizeof(word)); /* pick up offset from base */ ! sos = ntohs(sos); *si += 2; ! bcopy(&src[sos],d,(int)src[sos]+1); /* copy string */ break; case P_PATH: ! bcopy(s,d,(int) (*s)+1); /* pascal string with imbedded nulls */ *si += (*s)+1; break; case P_OPTR: ! bcopy(s,&sos,sizeof(word)); /* pick up offset from base */ ! sos = ntohs(sos); *si += 2; *((char **)d) = (char *)&src[sos]; break; --- 429,536 ---- switch (pe->pe_typ) { /* according to the data type */ case P_BMAP: /* bitmap (2 bytes) */ ! t = (byte *)bmap; ! t[0] = d[0]; ! t[1] = d[1]; break; case P_WORD: /* word (2 bytes) */ ! #ifdef BYTESWAPPED ! d[0] = s[1]; ! d[1] = s[0]; ! #else BYTESWAPPED ! d[0] = s[0]; ! d[1] = s[1]; ! #endif BYTESWAPPED *si += 2; break; case P_DWRD: /* double word (4 bytes) */ ! #ifdef BYTESWAPPED ! d[0] = s[3]; ! d[1] = s[2]; ! d[2] = s[1]; ! d[3] = s[0]; ! #else BYTESWAPPED ! d[0] = s[0]; ! d[1] = s[1]; ! d[2] = s[2]; ! d[3] = s[3]; ! #endif BYTESWAPPED *si += 4; break; case P_BYTE: /* byte (1 byte) */ + d[0] = s[0]; + *si += 1; + break; case P_BYTS: /* byte string */ bcopy(s,d,siz); /* copy bytes */ *si += siz; break; ! case P_TIME: /* external to internal time conv. */ ! t = (byte *)&timet; ! #ifdef BYTESWAPPED ! t[0] = s[3]; ! t[1] = s[2]; ! t[2] = s[1]; ! t[3] = s[0]; ! #else BYTESWAPPED ! t[0] = s[0]; ! t[1] = s[1]; ! t[2] = s[2]; ! t[3] = s[3]; ! #endif BYTESWAPPED ! if (mactime_not_inited) ! InitPackTime(0); /* assume version 1.0 obsolete */ ! if ((sdword)timet == maczerotime) ! timet = 0; ! else ! timet = (time_t)((sdword)timet - mymactime); ! d[0] = t[0]; ! d[1] = t[1]; ! d[2] = t[2]; ! d[3] = t[3]; ! *si += 4; /* advance */ break; case P_PSTR: /* c to pascal string */ ! cpyp2cstr(d, s); *si += (*s)+1; break; case P_OSTR: /* offset string */ ! t = (byte *)&sos; ! #ifdef BYTESWAPPED ! t[0] = s[1]; ! t[1] = s[0]; ! #else BYTESWAPPED ! t[0] = s[0]; ! t[1] = s[1]; ! #endif BYTESWAPPED *si += 2; ! cpyp2cstr(d, &src[sos]); /* copy string */ break; case P_OPTH: ! t = (byte *)&sos; ! #ifdef BYTESWAPPED ! t[0] = s[1]; ! t[1] = s[0]; ! #else BYTESWAPPED ! t[0] = s[0]; ! t[1] = s[1]; ! #endif BYTESWAPPED *si += 2; ! bcopy(&src[sos], d, (int)src[sos]+1); /* copy string */ break; case P_PATH: ! bcopy(s, d, (int)(*s)+1); /* pascal string with imbedded nulls */ *si += (*s)+1; break; case P_OPTR: ! t = (byte *)&sos; ! #ifdef BYTESWAPPED ! t[0] = s[1]; ! t[1] = s[0]; ! #else BYTESWAPPED ! t[0] = s[0]; ! t[1] = s[1]; ! #endif BYTESWAPPED *si += 2; *((char **)d) = (char *)&src[sos]; break; *************** *** 412,417 **** --- 543,549 ---- *d = 0; /* zero dest */ break; } + return; } /* *************** *** 421,453 **** * */ ! void PackDWord(s,d) dword s; byte *d; { ! #ifdef LOOSE_BYTESWAPPED ! *((dword *)d) = htonl(s); ! #else ! # ifdef BYTESWAPPED ! s = htonl(s); ! # endif ! bcopy(&s, d, sizeof(dword)); ! #endif } ! void PackWord(s,d) word s; byte *d; { ! #ifdef LOOSE_BYTESWAPPED ! *((word *)d) = htons(s); ! #else ! # ifdef BYTESWAPPED ! s = htons(s); ! # endif ! bcopy(&s, d, sizeof(word)); ! #endif } /* --- 553,599 ---- * */ ! void ! PackDWord(s, d) dword s; byte *d; { ! byte *t = (byte *)&s; ! #ifdef BYTESWAPPED ! d[0] = t[3]; ! d[1] = t[2]; ! d[2] = t[1]; ! d[3] = t[0]; ! #else BYTESWAPPED ! d[0] = t[0]; ! d[1] = t[1]; ! d[2] = t[2]; ! d[3] = t[3]; ! #endif BYTESWAPPED ! return; } + /* + * void PackWord(dword s, byte *d) + * + * Pack a word into destination. + * + */ ! void ! PackWord(s, d) word s; byte *d; { ! byte *t = (byte *)&s; ! #ifdef BYTESWAPPED ! d[0] = t[1]; ! d[1] = t[0]; ! #else BYTESWAPPED ! d[0] = t[0]; ! d[1] = t[1]; ! #endif BYTESWAPPED ! return; } /* *************** *** 456,591 **** * The src pointer is updated. * */ void ! UnpackDWord(src,dest) byte **src; dword *dest; { #ifdef BYTESWAPPED ! # ifdef LOOSE_BYTESWAPPED ! *dest = ntohl(*(dword *)(*src)); ! # else ! dword dwrd; ! ! bcopy(*src, &dwrd, sizeof(dword)); ! dwrd = ntohl(dwrd); ! bcopy(&dwrd, dest, sizeof(dword)); ! # endif ! #else ! bcopy(*src, dest, sizeof(dword)); ! #endif *src += 4; /* update source pointer */ } - /* * ! * Unpack word (2 bytes) from src into dest. The src pointer is updated. * */ ! void UnpackWord(src,dest) byte **src; word *dest; { #ifdef BYTESWAPPED ! # ifdef LOOSE_BYTESWAPPED ! *dest = ntohs(*(word *)(*src)); ! # else ! word wrd; ! ! bcopy(*src, &wrd, sizeof(word)); ! wrd = ntohs(wrd); ! bcopy(&wrd, dest, sizeof(word)); ! # endif ! #else ! bcopy(*src, dest, sizeof(word)); ! #endif *src += 2; /* update source pointer */ ! } ! ! /* ! * void ItoETime(time_t it, dword *et) ! * void EtoITime(dowrd et, time_t *it) ! * ! * Convert between Internal Unix time and External AFP time. ! * ! * All date and time quantities used by AFP are Greenwich Mean Time (GMT) ! * values. They are 32 bit signed integers corresponding to the number of ! * seconds measured from 12:00AM January 1, 2000 (the start of the next ! * century corresponds to datetime=0). ! * ! * BSD time base is 12:00AM January 1, 1970 ! * AFP time base is 12:00AM January 1, 2000 ! * ! * Actually, it seems that the Mac sends MacTime - could it be ! * that our copy of AppleShare does the wrong thing? Version 1.00 was ! * bad. Fixed in 1.10 and (hopefully) beyond. ! * ! * Another problem exists with DST which is not handled here. ! * I mean, things will be within 2 hours isn't that good enough :-) ! * ! * WARNING: if this code breaks, it will be on or near Jan 1, 2000 ! * or Jan 18, 2038. Of course, it's doubtful that this code ! * will last that long :-) ! * ! */ ! private int mactime_not_inited = 1; ! private long mymactime; ! private long maczerotime; ! /* difference btwn unix and mac in seconds */ ! /* mac starts at jan 1, 1904 for appleshare 1.0 */ ! #define AS1DOT0_MACZEROTIME 0 /* zero time - see comments above */ ! #define AS1DOT0_MACTIME (66*365+17)*24*60*60L ! ! /* difference btween midnight jan 1, 1970 and midnight jan 1, 2000 */ ! /* for all others */ ! #define MACTIME (((30*365+7)*(-24)*3600L)) ! #define MACZEROTIME 0x80000000 /* zero time - from AppleShare 1.1 on */ ! ! /* Does time zone adjustment */ ! ! /* call with flag set for appleshare 10 style */ ! export void ! InitPackTime(flag) ! int flag; ! { ! struct timeval tp; ! struct timezone tzp; ! ! mactime_not_inited = 0; ! gettimeofday(&tp, &tzp); ! if (flag) { ! mymactime = AS1DOT0_MACTIME; ! maczerotime = AS1DOT0_MACZEROTIME; ! } else { ! mymactime = MACTIME; ! maczerotime = MACZEROTIME; ! } ! mymactime -= ((long)tzp.tz_minuteswest*60); ! } ! ! private void ! ItoETime(ost,atpt) ! time_t ost; ! sdword *atpt; /* signed double word */ ! { ! sdword temp; ! ! if (mactime_not_inited) ! InitPackTime(0); /* assume past version 1.0 */ ! temp = htonl((ost) ? ((sdword)ost + mymactime) : maczerotime); ! bcopy(&temp, atpt, sizeof(temp)); ! } ! ! private void ! EtoITime(atpt,ost) ! sdword atpt; /* signed double word */ ! time_t *ost; ! { ! time_t temp; ! if (mactime_not_inited) ! InitPackTime(0); /* assume past version 1.0 */ ! atpt = ntohl(atpt); ! temp = (atpt == maczerotime) ? 0 : ((time_t)atpt - mymactime); ! bcopy(&temp, ost, sizeof(time_t)); /* copy out */ } --- 602,651 ---- * The src pointer is updated. * */ + void ! UnpackDWord(src, dest) byte **src; dword *dest; { + byte *s = *src; + byte *d = (byte *)dest; #ifdef BYTESWAPPED ! d[0] = s[3]; ! d[1] = s[2]; ! d[2] = s[1]; ! d[3] = s[0]; ! #else BYTESWAPPED ! d[0] = s[0]; ! d[1] = s[1]; ! d[2] = s[2]; ! d[3] = s[3]; ! #endif BYTESWAPPED *src += 4; /* update source pointer */ + return; } /* * ! * Unpack word (2 bytes) from src into dest. ! * The src pointer is updated. * */ ! ! void ! UnpackWord(src, dest) byte **src; word *dest; { + byte *s = *src; + byte *d = (byte *)dest; #ifdef BYTESWAPPED ! d[0] = s[1]; ! d[1] = s[0]; ! #else BYTESWAPPED ! d[0] = s[0]; ! d[1] = s[1]; ! #endif BYTESWAPPED *src += 2; /* update source pointer */ ! return; } *** lib/cap/abversion.c.orig Wed Nov 24 00:59:32 1993 --- lib/cap/abversion.c Wed Nov 24 22:08:18 1993 *************** *** 1,7 **** /* ! * $Author: djh $ $Date: 1993/11/23 13:59:23 $ ! * $Header: /mac/src/cap60/lib/cap/RCS/abversion.c,v 2.70 1993/11/23 13:59:23 djh Rel djh $ ! * $Revision: 2.70 $ * */ --- 1,7 ---- /* ! * $Author: djh $ $Date: 1993/11/24 11:08:12 $ ! * $Header: /mac/src/cap60/lib/cap/RCS/abversion.c,v 2.71 1993/11/24 11:08:12 djh Rel djh $ ! * $Revision: 2.71 $ * */ *************** *** 32,38 **** myversion.cv_name = "CAP"; myversion.cv_version = 6; myversion.cv_subversion = 0; ! myversion.cv_patchlevel = 170; myversion.cv_rmonth = "November"; myversion.cv_ryear = "1993"; switch (lap_proto) { --- 32,38 ---- myversion.cv_name = "CAP"; myversion.cv_version = 6; myversion.cv_subversion = 0; ! myversion.cv_patchlevel = 171; myversion.cv_rmonth = "November"; myversion.cv_ryear = "1993"; switch (lap_proto) { *** README.orig Wed Nov 24 01:00:26 1993 --- README Wed Nov 24 22:09:18 1993 *************** *** 2,8 **** CAP - Columbia AppleTalk Package for UNIX o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 170, November 1993 Notice ------ --- 2,8 ---- CAP - Columbia AppleTalk Package for UNIX o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 171, November 1993 Notice ------