From: Rolf K. <lab...@us...> - 2006-01-10 17:21:39
|
Update of /cvsroot/opengtoolkit/lvzip/c_source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29288/c_source Modified Files: macbin.c macbin.h Log Message: Got rid of all Mac OS X compile errors Index: macbin.c =================================================================== RCS file: /cvsroot/opengtoolkit/lvzip/c_source/macbin.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** macbin.c 8 Jan 2006 22:52:26 -0000 1.15 --- macbin.c 10 Jan 2006 17:21:31 -0000 1.16 *************** *** 14,19 **** #if Mac #include <CoreServices/CoreServices.h> // instead of #include <Resources.h> - #include <Finder.h> - #include <Files.h> #include "MacBinaryIII.h" --- 14,17 ---- *************** *** 28,33 **** static OSErr IfDirCloseIt(int16 vol); static MgErr OSErrToLVErr(OSErr err); ! static void MacConvertFromLVTime(uInt32 time, uInt32* sTime); ! static void MacConvertToLVTime(uInt32 sTime, uInt32* time); #elif Win32 #include "iowin32.h" --- 26,57 ---- static OSErr IfDirCloseIt(int16 vol); static MgErr OSErrToLVErr(OSErr err); ! ! static int32 UTCShift(void) ! { ! MachineLocation loc; ! int32 delta; ! ! ReadLocation(&loc); ! delta = loc.u.gmtDelta & 0x00ffffff; /* get sec east of UTC */ ! if (delta & 0x800000) ! delta |= 0xff000000; /* sign extend */ ! return -delta; /* secs from UTC */ ! } ! ! static MgErr ConvertLVTime(uInt32 *lTime, uInt32 *sTime, Boolean toLV) ! { ! if (toLV) ! { ! *lTime = *sTime + UTCShift(); ! } ! else ! { ! if (lTime && *lTime > 0) ! { ! *sTime = *lTime - UTCShift(); ! } ! } ! return noErr; ! } #elif Win32 #include "iowin32.h" *************** *** 163,167 **** ret = SetEOF((int16)fd, 0L); } ! out: IfDirCloseIt(fss.vRefNum); if (ret) --- 187,191 ---- ret = SetEOF((int16)fd, 0L); } ! IfDirCloseIt(fss.vRefNum); if (ret) *************** *** 175,179 **** extern MgErr ZEXPORT UtilFileInfo(Path path, uInt8 write, ! LVFileInfo *finderInfo, PStr comment, int32 *length) --- 199,203 ---- extern MgErr ZEXPORT UtilFileInfo(Path path, uInt8 write, ! LVFileInfo *fileInfo, PStr comment, int32 *length) *************** *** 185,189 **** OSErr err = noErr; ! if (len > 255) return mgArgErr; --- 209,213 ---- OSErr err = noErr; ! if (*length > 255) return mgArgErr; *************** *** 196,282 **** cpb.hFileInfo.ioDirID = fss.parID; ! if (err = PBGetCatInfoSync(&cpb)) ! goto out; ! ! dtpb.ioCompletion = nil; ! dtpb.ioNamePtr = NULL; ! dtpb.ioVRefNum = fss.vRefNum; ! ! if (err = PBDTGetPath(&dtpb)) ! goto out; ! ! dtpb.ioNamePtr = fss.name; ! dtpb.ioDTBuffer = comment; ! dtpb.ioDirID = fss.parID; ! ! if (write) { ! if (MacIsDir(cpb) ! { ! cbp.dirInfo.ioDrUsrWds.frFlags = fileInfo->flags; ! cbp.dirInfo.ioDrUsrWds.frLocation = fileInfo->location; ! ! MacConvertFromLVTime(fileInfo->cDate, cbp.dirInfo.ioDrCrDat); ! MacConvertFromLVTime(fileInfo->mDate, cbp.dirInfo.ioDrMdDat); ! } ! else { ! cbp.hFileInfo.ioFlFndrInfo.fdType = fileInfo->type; ! cbp.hFileInfo.ioFlFndrInfo.fdCreator = fileInfo->creator; ! cpb.hFileInfo.ioFlFndrInfo.fdFlags = fileInfo->flags; ! cpb.hFileInfo.ioFlFndrInfo.fdFldr = fileInfo->fId; ! cbp.hFileInfo.ioFlFndrInfo.fdLocation = fileInfo->location; ! cpb.hFileInfo.ioFlXFndrInfo.fdScript = fileInfo->sId; ! cpb.hFileInfo.ioFlXFndrInfo.fdFlags = fileInfo->xFlags; ! MacConvertFromLVTime(fileInfo->cDate, cbp.hFileInfo.ioFlCrDat); ! MacConvertFromLVTime(fileInfo->mDate, cbp.hFileInfo.ioFlMdDat); ! } ! err = PBSetCatInfoSync(&cpb); ! if (!err && *length && comment && PStrLen(comment)) ! { ! dtpb.ioDTReqCount = *length; ! err = PBDTSetCommentSync(&dtpb); ! } ! } ! else ! { ! if (MacIsDir(cpb) ! { ! fileInfo->type = kUnknownType; ! fileInfo->creator = kUnknownCreator; ! fileInfo->flags = cbp.dirInfo.ioDrUsrWds.frFlags; ! fileInfo->fId = ! fileInfo->location = cbp.dirInfo.ioDrUsrWds.frLocation; ! fileInfo->size = cbp.dirInfo.ioDrNmFls; ! fileInfo->rfSize = 0; ! MacConvertToLVTime(cbp.dirInfo.ioDrCrDat, fileInfo->cDate); ! MacConvertToLVTime(cbp.dirInfo.ioDrMdDat, fileInfo->mDate); ! } ! else ! { ! fileInfo->type = cbp.hFileInfo.ioFlFndrInfo.fdType; ! fileInfo->creator = cbp.hFileInfo.ioFlFndrInfo.fdCreator; ! fileInfo->flags = cpb.hFileInfo.ioFlFndrInfo.fdFlags; ! fileInfo->fId = cpb.hFileInfo.ioFlFndrInfo.fdFldr; ! fileInfo->location = cbp.hFileInfo.ioFlFndrInfo.fdLocation; ! fileInfo->size = catInfoPB.hFileInfo.ioFlLgLen; ! fileInfo->rfSize = catInfoPB.hFileInfo.ioFlRLgLen; ! fileInfo->sId = cpb.hFileInfo.ioFlXFndrInfo.fdScript; ! fileInfo->xFlags = cpb.hFileInfo.ioFlXFndrInfo.fdFlags; ! MacConvertToLVTime(cbp.hFileInfo.ioFlCrDat, fileInfo->cDate); ! MacConvertToLVTime(cbp.hFileInfo.ioFlMdDat, fileInfo->mDate); ! } ! err = PBDTGetCommentSync(&dtpb); ! *length = dtpb.ioDTActCount; ! } ! out: IfDirCloseIt(fss.vRefNum); return OSErrToLVErr(err); --- 220,304 ---- cpb.hFileInfo.ioDirID = fss.parID; ! err = PBGetCatInfoSync(&cpb); ! if (err == noErr) { + dtpb.ioCompletion = nil; + dtpb.ioNamePtr = NULL; + dtpb.ioVRefNum = fss.vRefNum; ! err = PBDTGetPath(&dtpb)) ! if (err == noErr) { ! dtpb.ioNamePtr = fss.name; ! dtpb.ioDTBuffer = comment; ! dtpb.ioDirID = fss.parID; ! if (write) ! { ! if (MacIsDir(cpb) ! { ! cpb.dirInfo.ioDrUsrWds.frFlags = fileInfo->flags; ! cpb.dirInfo.ioDrUsrWds.frLocation = fileInfo->location; ! ConvertLVTime(&fileInfo->cDate, &cpb.dirInfo.ioDrCrDat, false); ! ConvertLVTime(&fileInfo->mDate, &cpb.dirInfo.ioDrMdDat, false); ! } ! else ! { ! cpb.hFileInfo.ioFlFndrInfo.fdType = fileInfo->type; ! cpb.hFileInfo.ioFlFndrInfo.fdCreator = fileInfo->creator; ! cpb.hFileInfo.ioFlFndrInfo.fdFlags = fileInfo->flags; ! cpb.hFileInfo.ioFlFndrInfo.fdFldr = fileInfo->fId; ! cpb.hFileInfo.ioFlFndrInfo.fdLocation = fileInfo->location; ! cpb.hFileInfo.ioFlXFndrInfo.fdScript = fileInfo->sId; ! cpb.hFileInfo.ioFlXFndrInfo.fdFlags = fileInfo->xFlags; ! ConvertLVTime(&fileInfo->cDate, &cpb.hFileInfo.ioFlCrDat, false); ! ConvertLVTime(&fileInfo->mDate, &cpb.hFileInfo.ioFlMdDat, false); ! } ! err = PBSetCatInfoSync(&cpb); ! if (!err && *length && comment && PStrLen(comment)) ! { ! dtpb.ioDTReqCount = *length; ! err = PBDTSetCommentSync(&dtpb); ! } ! } ! else ! { ! if (MacIsDir(cpb) ! { ! fileInfo->type = kUnknownType; ! fileInfo->creator = kUnknownCreator; ! fileInfo->flags = cbp.dirInfo.ioDrUsrWds.frFlags; ! fileInfo->fId = ! fileInfo->location = cbp.dirInfo.ioDrUsrWds.frLocation; ! fileInfo->size = cbp.dirInfo.ioDrNmFls; ! fileInfo->rfSize = 0; ! ConvertLVTime(&fileInfo->cDate, &cbp.dirInfo.ioDrCrDat, true); ! ConvertLVTime(&fileInfo->cDate, &cbp.dirInfo.ioDrMdDat, true); ! } ! else ! { ! fileInfo->type = cbp.hFileInfo.ioFlFndrInfo.fdType; ! fileInfo->creator = cbp.hFileInfo.ioFlFndrInfo.fdCreator; ! fileInfo->flags = cpb.hFileInfo.ioFlFndrInfo.fdFlags; ! fileInfo->fId = cpb.hFileInfo.ioFlFndrInfo.fdFldr; ! fileInfo->location = cbp.hFileInfo.ioFlFndrInfo.fdLocation; ! fileInfo->size = catInfoPB.hFileInfo.ioFlLgLen; ! fileInfo->rfSize = catInfoPB.hFileInfo.ioFlRLgLen; ! fileInfo->sId = cpb.hFileInfo.ioFlXFndrInfo.fdScript; ! fileInfo->xFlags = cpb.hFileInfo.ioFlXFndrInfo.fdFlags; ! ConvertLVTime(&fileInfo->cDate, &cbp.hFileInfo.ioFlCrDat, true); ! ConvertLVTime(&fileInfo->cDate, &cbp.hFileInfo.ioFlMdDat, true); ! } ! err = PBDTGetCommentSync(&dtpb); ! *length = dtpb.ioDTActCount; ! } ! } ! } IfDirCloseIt(fss.vRefNum); return OSErrToLVErr(err); *************** *** 413,441 **** savings time settings and Universal Time Coordinate (also called GMT). */ - static int32 UTCShift() - { - MachineLocation loc; - int32 delta; - - ReadLocation(&loc); - delta = loc.u.gmtDelta & 0x00ffffff; /* get sec east of UTC */ - if (delta & 0x800000) - delta |= 0xff000000; /* sign extend */ - return -delta; /* secs from UTC */ - } - - static void MacConvertFromLVTime(uInt32 time, uInt32 *sTime) - { - if (time > 0.0) - { - *sTime = time - UTCShift(); - } - return; - } - - static void MacConvertToLVTime(uInt32 sTime, uInt32 *time) - { - *time = sTime + UTCShift(); - return; - } #endif --- 435,437 ---- Index: macbin.h =================================================================== RCS file: /cvsroot/opengtoolkit/lvzip/c_source/macbin.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** macbin.h 8 Jan 2006 23:04:32 -0000 1.10 --- macbin.h 10 Jan 2006 17:21:31 -0000 1.11 *************** *** 123,131 **** }; typedef struct { int16 v; int16 h; ! } LVPoint; typedef uChar Str255[256], *PStr, *CStr; --- 123,133 ---- }; + #if !Mac typedef struct { int16 v; int16 h; ! } Point; ! #endif typedef uChar Str255[256], *PStr, *CStr; *************** *** 158,162 **** uInt32 mDate; uInt16 flags; /* Mac only */ ! LVPoint location; /* Mac only */ uInt16 fId; /* Mac only */ uInt8 sId; /* Mac only */ --- 160,164 ---- uInt32 mDate; uInt16 flags; /* Mac only */ ! Point location; /* Mac only */ uInt16 fId; /* Mac only */ uInt8 sId; /* Mac only */ |