pascal OSErr ResolveFileIDRef(ConstStr255Param volName, short vRefNum, long fileID, long *parID, StringPtr fileName) { HParamBlockRec pb; OSErr error; Str255 tempStr; tempStr[0] = 0; if ( volName != NULL ) { BlockMoveData(volName, tempStr, volName[0] + 1); } pb.fidParam.ioNamePtr = (StringPtr)tempStr; pb.fidParam.ioVRefNum = vRefNum; pb.fidParam.ioFileID = fileID; error = PBResolveFileIDRefSync(&pb); if ( error == noErr ) { *parID = pb.fidParam.ioSrcDirID; if ( fileName != NULL ) { BlockMoveData(tempStr, fileName, tempStr[0] + 1); } } return ( error ); }
UInt32 RingBuffer::Reallocate(UInt32 inBufferByteSize) { Byte *bptr = NULL; UInt32 data_size = 0; // can't decrease the size at the moment if (inBufferByteSize > mBSize) { bptr = new Byte[inBufferByteSize * 2]; data_size = GetDataAvailable(); if (mNeedsWrapping) { UInt32 headBytes = mBSize - mBStart; BlockMoveData(mBuffer + mBStart, bptr, headBytes); BlockMoveData(mBuffer, bptr + headBytes, mBEnd); mNeedsWrapping = false; } else { BlockMoveData(mBuffer + mBStart, bptr, data_size); } mBEnd = data_size; mBStart = 0; delete[] mBuffer; mBuffer = bptr; mBSize = inBufferByteSize; } return mBSize; }
void LoadImportPLUG( MADLibrary *inMADDriver, short No, FSSpec *theSpec) { Handle theRes; short fileID; Str255 tStr; inMADDriver->ThePlug[ No].file = *theSpec; { Boolean targetIsFolder, wasAliased; ResolveAliasFile( &inMADDriver->ThePlug[ No].file, true, &targetIsFolder, &wasAliased); } pStrCpy( inMADDriver->ThePlug[ No].filename, inMADDriver->ThePlug[ No].file.name); fileID = FSpOpenResFile( theSpec, fsCurPerm); /** CODE du Plug-in **/ GetIndString( tStr, 1000, 1); BlockMoveData( tStr + 1, &inMADDriver->ThePlug[ No].type, 4); inMADDriver->ThePlug[ No].type[ 4] = 0; GetIndString( tStr, 1000, 2); BlockMoveData( tStr + 1, &inMADDriver->ThePlug[ No].mode, 4); GetIndString( inMADDriver->ThePlug[ No].MenuName, 1000, 3); GetIndString( inMADDriver->ThePlug[ No].AuthorString, 1000, 4); CloseResFile( fileID); }
OSErr GetFullPath( const FSSpec* spec, Str255 fullPath) { CInfoPBRec myPB; Str255 dirName; OSErr myErr; fullPath[0] = '\0'; BlockMoveData(spec->name, fullPath, spec->name[spec->name[0]]+1 ); myPB.dirInfo.ioNamePtr = dirName; myPB.dirInfo.ioVRefNum = spec->vRefNum; myPB.dirInfo.ioDrParID = spec->parID; myPB.dirInfo.ioFDirIndex = -1; do{ myPB.dirInfo.ioDrDirID = myPB.dirInfo.ioDrParID; myErr = PBGetCatInfoSync(&myPB); dirName[0]++; dirName[ dirName[0] ]=':'; if( dirName[0]+fullPath[0]>=254 ){ fullPath[0]=0; return 1; } BlockMoveData(fullPath+1, dirName+dirName[0]+1, fullPath[0]); dirName[0]+=fullPath[0]; BlockMoveData(dirName, fullPath, dirName[0]+1); }while( !(myPB.dirInfo.ioDrDirID == fsRtDirID) ); return noErr; }
void NScanResource( MADLibrary *inMADDriver) { short i; #define BASERES 1000 for( i = 0; i < MAXPLUG; i++) { Boolean ResourceOK; Handle aRes, bRes; ResourceOK = true; aRes = MADGet1Resource( 'CODE', BASERES + i, inMADDriver); if( aRes == NULL) ResourceOK = false; else { DisposeHandle( aRes); aRes = NULL; } bRes = MADGet1Resource( 'STR#', BASERES + i, inMADDriver); if( bRes == NULL) ResourceOK = false; else { DisposeHandle( bRes); bRes = NULL; } if( inMADDriver->TotalPlug < MAXPLUG && ResourceOK == true) { short No = inMADDriver->TotalPlug; Handle theRes; Str255 tStr; // theName = LMGetCurApName(); HGetVol( NULL, &inMADDriver->ThePlug[ No].file.vRefNum, &inMADDriver->ThePlug[ No].file.parID); pStrCpy( inMADDriver->ThePlug[ No].file.name, RSRCNAME); /** CODE du Plug-in **/ GetIndString( tStr, BASERES+i, 1); BlockMoveData( tStr + 1, &inMADDriver->ThePlug[ No].type, 4); inMADDriver->ThePlug[ No].type[ 4] = 0; GetIndString( tStr, BASERES+i, 2); BlockMoveData( tStr + 1, &inMADDriver->ThePlug[ No].mode, 4); GetIndString( inMADDriver->ThePlug[ No].MenuName, BASERES+i, 3); GetIndString( inMADDriver->ThePlug[ No].AuthorString, BASERES+i, 4); inMADDriver->TotalPlug++; } } }
static void CopyCatalogNodeInfo( CatalogRecord *src, CatalogRecord *dest ) { dest->hfsFile.dataLogicalSize = src->hfsFile.dataLogicalSize; dest->hfsFile.dataPhysicalSize = src->hfsFile.dataPhysicalSize; dest->hfsFile.rsrcLogicalSize = src->hfsFile.rsrcLogicalSize; dest->hfsFile.rsrcPhysicalSize = src->hfsFile.rsrcPhysicalSize; dest->hfsFile.modifyDate = src->hfsFile.modifyDate; BlockMoveData( src->hfsFile.dataExtents, dest->hfsFile.dataExtents, sizeof(HFSExtentRecord) ); BlockMoveData( src->hfsFile.rsrcExtents, dest->hfsFile.rsrcExtents, sizeof(HFSExtentRecord) ); }
static CWResult LinkHeaders(CWPluginContext context, XPIDLSettings& settings) { // find out how many files there are to link. long fileCount = 0; CWResult err = CWGetProjectFileCount(context, &fileCount); if (err != cwNoErr || fileCount == 0) return err; // get the output directory. FSSpec outputDir; err = CWGetOutputFileDirectory(context, &outputDir); if (!CWSUCCESS(err)) return err; // enumerate all of the output header files, and make aliases to them in // the output directory. for (long index = 0; (err == cwNoErr) && (index < fileCount); index++) { // get the name of each output file. CWFileSpec outputFile; err = CWGetStoredObjectFileSpec(context, index, &outputFile); if (err == cwNoErr) { FInfo info; err = FSpGetFInfo(&outputFile, &info); FSSpec aliasFile = { outputDir.vRefNum, outputDir.parID }; BlockMoveData(outputFile.name, aliasFile.name, 1 + outputFile.name[0]); AliasHandle alias = NULL; if (NewAliasMinimal(&outputFile, &alias) == noErr) { // recreate the alias file from scratch. FSpDelete(&aliasFile); FSpCreateResFile(&aliasFile, info.fdCreator, info.fdType, smRoman); short refNum = FSpOpenResFile(&aliasFile, fsRdWrPerm); if (refNum != -1) { UseResFile(refNum); AddResource(Handle(alias), rAliasType, 0, aliasFile.name); ReleaseResource(Handle(alias)); UpdateResFile(refNum); CloseResFile(refNum); } // finally, mark the newly created file as an alias file. FSpGetFInfo(&aliasFile, &info); info.fdFlags |= kIsAlias; FSpSetFInfo(&aliasFile, &info); } } } // create the target file in the output directory. BlockMoveData(settings.output, outputDir.name, 1 + settings.output[0]); FILE* outputFile = FSp_fopen(&outputDir, "w"); if (outputFile != NULL) fclose(outputFile); return err; }
int SDL_SYS_CDInit(void) { SInt16 dRefNum = 0; SInt16 first, last; SDL_numcds = 0; /* Check that the software is available */ if (Gestalt(kGestaltAudioCDSelector, &SDL_cdversion) || !SDL_cdversion) return(0); /* Fill in our driver capabilities */ SDL_CDcaps.Name = SDL_SYS_CDName; SDL_CDcaps.Open = SDL_SYS_CDOpen; SDL_CDcaps.GetTOC = SDL_SYS_CDGetTOC; SDL_CDcaps.Status = SDL_SYS_CDStatus; SDL_CDcaps.Play = SDL_SYS_CDPlay; SDL_CDcaps.Pause = SDL_SYS_CDPause; SDL_CDcaps.Resume = SDL_SYS_CDResume; SDL_CDcaps.Stop = SDL_SYS_CDStop; SDL_CDcaps.Eject = SDL_SYS_CDEject; SDL_CDcaps.Close = SDL_SYS_CDClose; /* Walk the list, count each AudioCD driver, and save the refnums */ first = -1; last = 0 - LMGetUnitTableEntryCount(); for(dRefNum = first; dRefNum >= last; dRefNum--) { Str255 driverName; StringPtr namePtr; DCtlHandle deviceEntry; deviceEntry = GetDCtlEntry(dRefNum); if (! deviceEntry) continue; /* Is this an .AppleCD ? */ namePtr = (*deviceEntry)->dCtlFlags & (1L << dRAMBased) ? ((StringPtr) ((DCtlPtr) deviceEntry)->dCtlDriver + 18) : ((StringPtr) (*deviceEntry)->dCtlDriver + 18); BlockMoveData(namePtr, driverName, namePtr[0]+1); if (driverName[0] > gDriverName[0]) driverName[0] = gDriverName[0]; if (! EqualString(driverName, gDriverName, false, false)) continue; /* Record the basic info for each drive */ SDL_cdlist[SDL_numcds].dRefNum = dRefNum; BlockMoveData(namePtr + 1, SDL_cdlist[SDL_numcds].name, namePtr[0]); SDL_cdlist[SDL_numcds].name[namePtr[0]] = 0; SDL_cdlist[SDL_numcds].hasAudio = false; SDL_numcds++; } return(0); }
int SDL_SYS_CDInit(void) { SInt16 dRefNum = 0; SInt16 first, last; SDL_numcds = 0; if (Gestalt(kGestaltAudioCDSelector, &SDL_cdversion) || !SDL_cdversion) return(0); SDL_CDcaps.Name = SDL_SYS_CDName; SDL_CDcaps.Open = SDL_SYS_CDOpen; SDL_CDcaps.GetTOC = SDL_SYS_CDGetTOC; SDL_CDcaps.Status = SDL_SYS_CDStatus; SDL_CDcaps.Play = SDL_SYS_CDPlay; SDL_CDcaps.Pause = SDL_SYS_CDPause; SDL_CDcaps.Resume = SDL_SYS_CDResume; SDL_CDcaps.Stop = SDL_SYS_CDStop; SDL_CDcaps.Eject = SDL_SYS_CDEject; SDL_CDcaps.Close = SDL_SYS_CDClose; first = -1; last = 0 - LMGetUnitTableEntryCount(); for(dRefNum = first; dRefNum >= last; dRefNum--) { Str255 driverName; StringPtr namePtr; DCtlHandle deviceEntry; deviceEntry = GetDCtlEntry(dRefNum); if (! deviceEntry) continue; namePtr = (*deviceEntry)->dCtlFlags & (1L << dRAMBased) ? ((StringPtr) ((DCtlPtr) deviceEntry)->dCtlDriver + 18) : ((StringPtr) (*deviceEntry)->dCtlDriver + 18); BlockMoveData(namePtr, driverName, namePtr[0]+1); if (driverName[0] > gDriverName[0]) driverName[0] = gDriverName[0]; if (! EqualString(driverName, gDriverName, false, false)) continue; SDL_cdlist[SDL_numcds].dRefNum = dRefNum; BlockMoveData(namePtr + 1, SDL_cdlist[SDL_numcds].name, namePtr[0]); SDL_cdlist[SDL_numcds].name[namePtr[0]] = 0; SDL_cdlist[SDL_numcds].hasAudio = false; SDL_numcds++; } return(0); }
OSErr PutFile (ConstStr255Param thePrompt, ConstStr255Param theFileName, FSSpecPtr theFSSpecPtr, Boolean *theIsSelected, Boolean *theIsReplacing) { NavReplyRecord myReply; NavDialogOptions myDialogOptions; NavEventUPP myEventUPP = NewNavEventUPP(HandleNavEvent); OSErr myErr = noErr; if ((theFSSpecPtr == NULL) || (theIsSelected == NULL) || (theIsReplacing == NULL)) return(paramErr); // assume we are not replacing an existing file *theIsReplacing = false; *theIsSelected = false; // specify the options for the dialog box NavGetDefaultDialogOptions(&myDialogOptions); myDialogOptions.dialogOptionFlags += kNavNoTypePopup; myDialogOptions.dialogOptionFlags += kNavDontAutoTranslate; BlockMoveData(theFileName, myDialogOptions.savedFileName, theFileName[0] + 1); BlockMoveData(thePrompt, myDialogOptions.message, thePrompt[0] + 1); // prompt the user for a file myErr = NavPutFile(NULL, &myReply, &myDialogOptions, myEventUPP, MovieFileType, sigMoviePlayer, NULL); if ((myErr == noErr) && myReply.validRecord) { AEKeyword myKeyword; DescType myActualType; Size myActualSize = 0; // get the FSSpec for the selected file if (theFSSpecPtr != NULL) myErr = AEGetNthPtr(&(myReply.selection), 1, typeFSS, &myKeyword, &myActualType, theFSSpecPtr, sizeof(FSSpec), &myActualSize); *theIsSelected = myReply.validRecord; if (myReply.validRecord) { *theIsReplacing = myReply.replacing; } NavDisposeReply(&myReply); } DisposeNavEventUPP(myEventUPP); return(myErr); }
void moveright (ptrvoid psource, ptrvoid pdest, long length) { /* do a mass memory move with the right edge leading. good for opening up a gap in a buffer, among other thingsÉ */ #if defined (MACVERSION) BlockMoveData (psource, pdest, length); #else register ptrbyte ps, pd; register long ctloops; ctloops = length; if (ctloops > 0) { ps = (ptrbyte) psource + length - 1; /*right edge of source*/ pd = (ptrbyte) pdest + length - 1; /*right edge of destination*/ while (ctloops--) *pd-- = *ps--; } #endif } /*moveright*/
//-------------------------------------------------------------- bool createMovieFromURL(string urlIn, Movie &movie){ char * url = (char *)urlIn.c_str(); Handle urlDataRef; OSErr err; urlDataRef = NewHandle(strlen(url) + 1); if ( ( err = MemError()) != noErr){ ofLogError("ofQuickTimePlayer") << "createMovieFromURL(): couldn't create url handle from \"" << urlIn << "\": OSErr " << err; return false; } BlockMoveData(url, *urlDataRef, strlen(url) + 1); err = NewMovieFromDataRef(&movie, newMovieActive,nil, urlDataRef, URLDataHandlerSubType); DisposeHandle(urlDataRef); if(err != noErr){ ofLogError("ofQuickTimePlayer") << "createMovieFromURL(): couldn't load url \"" << urlIn << "\": OSErr " << err; return false; }else{ return true; } return false; }
OSErr NSLoadNamedFragment(const FSSpec *fileSpec, const char* fragmentName, CFragConnectionID *outConnectionID) { UInt32 fragOffset, fragLength; short fragNameLength; Ptr main; Str255 fragName; Str255 errName; OSErr err; err = GetNamedFragmentOffsets(fileSpec, fragmentName, &fragOffset, &fragLength); if (err != noErr) return err; // convert fragment name to pascal string fragNameLength = strlen(fragmentName); if (fragNameLength > 255) fragNameLength = 255; BlockMoveData(fragmentName, &fragName[1], fragNameLength); fragName[0] = fragNameLength; // Note that we pass the fragment name as the 4th param to GetDiskFragment. // This value affects the ability of debuggers, and the Talkback system, // to match code fragments with symbol files err = GetDiskFragment(fileSpec, fragOffset, fragLength, fragName, kLoadCFrag, outConnectionID, &main, errName); return err; }
OSErr HFSPlusExtentsOverflow::readBytes (long long start, long long count, void **buffer) { UInt32 blockSize = fVolume->getBlockSize (); UInt32 extraBytesAtStart = start % blockSize; if (extraBytesAtStart) { start -= extraBytesAtStart; count += extraBytesAtStart; } UInt32 extraBytesAtEnd = count % blockSize; if (extraBytesAtEnd) count += blockSize - extraBytesAtEnd; if ((start % blockSize != 0) || (count % blockSize != 0)) { #if qLogging gLogFile << "Unaligned allocation block read" << endl_AC; #endif ThrowException_AC (kUnalignedAllocationBlockRead, 0); } start /= blockSize; count /= blockSize; OSErr err = readAllocationBlocks (start, count, buffer); if (err) return err; if (extraBytesAtStart) { UInt8 *mark = (UInt8 *) *buffer; mark += extraBytesAtStart; BlockMoveData (mark, *buffer, count * blockSize - extraBytesAtStart); } return noErr; }
OSType GetPPPlugType( MADLibrary *inMADDriver, short ID, OSType mode) { short i, x; if( ID >= inMADDriver->TotalPlug) MyDebugStr( __LINE__, __FILE__, "PP-Plug ERROR. "); for( i = 0, x = 0; i < inMADDriver->TotalPlug; i++) { if( inMADDriver->ThePlug[ i].mode == mode || inMADDriver->ThePlug[ i].mode == 'EXIM') { if( ID == x) { short xx; OSType type; xx = strlen( inMADDriver->ThePlug[ i].type); if( xx > 4) xx = 4; type = ' '; BlockMoveData( inMADDriver->ThePlug[ i].type, &type, xx); return type; } x++; } } MyDebugStr( __LINE__, __FILE__, "PP-Plug ERROR II."); return noErr; }
OSErr grow_buffer(Theora_Globals glob, UInt32 min_size) { /* increase the size of the packet buffer, in kPacketBufferAllocIncrement blocks, preserving the content of the used part of the buffer */ OSErr err = noErr; UInt32 new_size = glob->p_buffer_len; dbg_printf("--:Theora:- _grow_buffer(%08lx, %ld)\n", (long)glob, min_size); while (new_size < min_size) new_size += kPacketBufferAllocIncrement; /* first try to resize in-place */ SetPtrSize((Ptr) glob->p_buffer, new_size); if (err = MemError()) { /* resizing failed: allocate new block, memcpy, release the old block */ Ptr p = NewPtr(new_size); if (err = MemError()) goto bail; BlockMoveData(glob->p_buffer, p, glob->p_buffer_used); DisposePtr((Ptr) glob->p_buffer); glob->p_buffer = (UInt8 *) p; } glob->p_buffer_len = new_size; bail: if (err) dbg_printf("--:Theora:- _grow_buffer(%08lx, %ld) failed = %d\n", (long)glob, min_size, err); return err; }
static OSErr QT_AddUserDataTextToMovie (Movie theMovie, char *theText, OSType theType) { UserData myUserData = NULL; Handle myHandle = NULL; long myLength = strlen(theText); OSErr myErr = noErr; // get the movie's user data list myUserData = GetMovieUserData(theMovie); if (myUserData == NULL) return(paramErr); // copy the specified text into a new handle myHandle = NewHandleClear(myLength); if (myHandle == NULL) return(MemError()); BlockMoveData(theText, *myHandle, myLength); // add the data to the movie's user data myErr = AddUserDataText(myUserData, myHandle, theType, 1, (short)GetScriptManagerVariable(smRegionCode)); // clean up DisposeHandle(myHandle); return(myErr); }
void * (memcpy)(void * dst, const void * src, size_t n) { BlockMoveData(src, dst, n); return(dst); }
void loadMacros(NewMacroInfo *macrost, FSSpec *theFile) { SFReply sfr; long junk; SFTypeList typesok = {'TEXT'}; Point where; FSSpec macros; OSErr err; short fileRef; where.h=100;where.v=100; if (theFile == 0L) { SFGetFile( where, NULL, 0L, 1, typesok, 0L, &sfr); if (!sfr.good) return; BlockMoveData(&sfr.fName, macros.name, (*sfr.fName)+1); GetWDInfo(sfr.vRefNum, ¯os.vRefNum, ¯os.parID, &junk); err = HOpenDF(macros.vRefNum, macros.parID, macros.name, fsRdPerm, &fileRef); } else err = HOpenDF(theFile->vRefNum, theFile->parID, theFile->name, fsRdPerm, &fileRef); if (err != noErr) return; parseMacroFile(macrost, fileRef); FSClose(fileRef); }
/* ** GetVolumeInfoNoName uses pathname and vRefNum to call PBHGetVInfoSync ** in cases where the returned volume name is not needed by the caller. ** The pathname and vRefNum parameters are not touched, and the pb ** parameter is initialized by PBHGetVInfoSync except that ioNamePtr in ** the parameter block is always returned as NULL (since it might point ** to the local tempPathname). ** ** I noticed using this code in several places, so here it is once. ** This reduces the code size of MoreFiles. */ static pascal OSErr GetVolumeInfoNoName(ConstStr255Param pathname, short vRefNum, HParmBlkPtr pb) { Str255 tempPathname; OSErr error; /* Make sure pb parameter is not NULL */ if ( pb != NULL ) { pb->volumeParam.ioVRefNum = vRefNum; if ( pathname == NULL ) { pb->volumeParam.ioNamePtr = NULL; pb->volumeParam.ioVolIndex = 0; /* use ioVRefNum only */ } else { BlockMoveData(pathname, tempPathname, pathname[0] + 1); /* make a copy of the string and */ pb->volumeParam.ioNamePtr = (StringPtr)tempPathname; /* use the copy so original isn't trashed */ pb->volumeParam.ioVolIndex = -1; /* use ioNamePtr/ioVRefNum combination */ } error = PBHGetVInfoSync(pb); pb->volumeParam.ioNamePtr = NULL; /* ioNamePtr may point to local tempPathname, so don't return it */ } else { error = paramErr; } return ( error ); }
static long local_ALGetDataFromGroup(Handle dataHandle, OSType flavorType, Handle groupData, long *marker) { long dataSize; OSErr err; if ( dataHandle == nil || groupData == nil || marker == nil ) return 0; // Check to see if we've got the right flavor of data. if ( *(long *)&((*groupData)[*marker]) != flavorType ) return 0; // Set the dataHandle's size to match the data from the group. *marker += sizeof(long); dataSize = *(long *)&((*groupData)[*marker]); SetHandleSize(dataHandle, dataSize); err = MemError(); if (err == noErr) { *marker += sizeof(long); BlockMoveData(&((*groupData)[ *marker ]), *dataHandle, dataSize); *marker += dataSize; return dataSize; } else return 0; }
void CopyPascalToCString(const StringPtr src, char *dest, long maxLen) { short len = Min(maxLen, src[0]); BlockMoveData(&src[1], dest, len); dest[len] = '\0'; }
Handle CreateOpenHandle (OSType theApplicationSignature, short theNumTypes, TypeListPtr theTypeList) { Handle myHandle = NULL; // see if we have an 'open' resource... myHandle = Get1Resource('open', 128); if ( myHandle != NULL && ResError() == noErr ) { DetachResource( myHandle ); return myHandle; } else { myHandle = NULL; } // nope, use the passed in types and dynamically create the NavTypeList if (theTypeList == NULL) return myHandle; if (theNumTypes > 0) { myHandle = NewHandle(sizeof(NavTypeList) + (theNumTypes * sizeof(OSType))); if (myHandle != NULL) { NavTypeListHandle myOpenResHandle = (NavTypeListHandle)myHandle; (*myOpenResHandle)->componentSignature = theApplicationSignature; (*myOpenResHandle)->osTypeCount = theNumTypes; BlockMoveData(theTypeList, (*myOpenResHandle)->osType, theNumTypes * sizeof(OSType)); } } return myHandle; }
//-------------------------------------------------------------- bool createMovieFromURL(string urlIn, Movie &movie) { char * url = (char *)urlIn.c_str(); Handle urlDataRef; OSErr err; urlDataRef = NewHandle(strlen(url) + 1); if ( ( err = MemError()) != noErr) { ofLog(OF_LOG_ERROR,"createMovieFromURL: error creating url handle"); return false; } BlockMoveData(url, *urlDataRef, strlen(url) + 1); err = NewMovieFromDataRef(&movie, newMovieActive,nil, urlDataRef, URLDataHandlerSubType); DisposeHandle(urlDataRef); if(err != noErr) { ofLog(OF_LOG_ERROR,"createMovieFromURL: error loading url"); return false; } else { return true; } return false; }
static CFStringRef BIMCreatePortName( const ProcessSerialNumber *inProcessSerialNumber ) { CFMutableStringRef portName; CFStringRef processSerialNumberStringRef; Str255 processSerialNumberString; Str255 processSerialNumberLowString; // Convert the high and low parts of the process serial number into a string. NumToString( inProcessSerialNumber->highLongOfPSN, processSerialNumberString ); NumToString( inProcessSerialNumber->lowLongOfPSN, processSerialNumberLowString ); BlockMoveData( processSerialNumberLowString + 1, processSerialNumberString + processSerialNumberString [0] + 1, processSerialNumberLowString [0] ); processSerialNumberString [0] += processSerialNumberLowString [0]; // Create a CFString and append the process serial number string onto the end. portName = CFStringCreateMutableCopy( NULL, 255, CFSTR( kBasicServerPortName ) ); processSerialNumberStringRef = CFStringCreateWithPascalString( NULL, processSerialNumberString, CFStringGetSystemEncoding() ); CFStringAppend( portName, processSerialNumberStringRef ); CFRelease( processSerialNumberStringRef ); return portName; }
static void InitDevDriver(struct DRV *driver, int indx) { w32 savedRegs[4]; w32 *p; char *name=(driver->namep)->name; BlockMoveData(aReg,savedRegs,4*sizeof(w32)); reg[1]=40+strlen(name); if((strlen(name)&1)!=0) reg[1]++; if (driver->slot != 0) { if(driver->slot <reg[1]) { printf("requested driver size for driver %s too small: %d\n",*name,driver->slot); goto ddier; } reg[1]=driver->slot; } reg[2]=0; QLtrap(1,0x18,200000l); /* allocate memory for the driver linkage block */ if((*reg)==0) { driver->ref=aReg[0]; p=(w32*)(aReg[0]+(Ptr)theROM+4); WL(p,DEV_IO_ADDR); /* io */ WL(p+1,(w32) ((Ptr)(p+3)-(Ptr)theROM)); /* open */ WL(p+2,DEV_CLOSE_ADDR); /* close */ WW(p+3,DEVO_CMD_CODE); strcpy((Ptr)(p+6)+4,name); /* name for QPAC2 etc */ WW((Ptr)(p+3+3)+2,strlen(name)); WL((Ptr)(p+3)+2,0x264f4eba); /* so much code is needed to fool QPAC2 ...*/ WL((Ptr)(p+4)+2,0x2c566046); WL((Ptr)(p+5)+2,0x6044604a); if ((*(driver->init))(indx,p-1) <0) goto ddier; QLtrap(1,0x20,20000l); /* link directory device driver in IOSS */ } ddier: BlockMoveData(savedRegs,aReg,4*sizeof(w32)); }
void QTInfo_PStringToTextHandle (Str255 theString, Handle theHandle) { SetHandleSize(theHandle, theString[0]); if (GetHandleSize(theHandle) != theString[0]) return; BlockMoveData(&(theString[1]), *theHandle, theString[0]); }
void pgp_memcpy(void *dest, void *src, long len) { #ifdef PGP_MACINTOSH BlockMoveData(src, dest, len); #elif PGP_WIN32 memcpy(dest, src, len); #endif }
static int manually_locate_product(const char *name, char *buf, size_t bufsize, const char *title) { NavDialogCreationOptions dlgopt; NavDialogRef dlg; NavReplyRecord reply; NavUserAction action; AEKeyword keyword; AEDesc desc; FSRef fsref; OSStatus rc; int retval = 0; const char *promptfmt = _("We can't find your \"%s\" installation." " Would you like to show us where it is?"); char *promptstr = alloca(strlen(name) + strlen(promptfmt) + 1); if (promptstr == NULL) { log_fatal(_("Out of memory.")); return(0); } /* if */ sprintf(promptstr, promptfmt, name); if (!ui_prompt_yn(promptstr, title)) return(0); NavGetDefaultDialogCreationOptions(&dlgopt); dlgopt.optionFlags |= kNavSupportPackages; dlgopt.optionFlags |= kNavAllowOpenPackages; dlgopt.optionFlags &= ~kNavAllowMultipleFiles; dlgopt.windowTitle = CFSTR("Please select the product's icon and click 'OK'."); /* !!! FIXME! */ dlgopt.actionButtonLabel = CFSTR("OK"); NavCreateChooseFolderDialog(&dlgopt, NULL, NULL, NULL, &dlg); NavDialogRun(dlg); action = NavDialogGetUserAction(dlg); if (action != kNavUserActionCancel) { NavDialogGetReply(dlg, &reply); rc = AEGetNthDesc(&reply.selection, 1, typeFSRef, &keyword, &desc); if (rc != noErr) log_fatal("Unexpected error in AEGetNthDesc: %d", (int) rc); else { /* !!! FIXME: Check return values here! */ BlockMoveData(*desc.dataHandle, &fsref, sizeof (fsref)); FSRefMakePath(&fsref, BAD_CAST buf, bufsize - 1); buf[bufsize - 1] = '\0'; AEDisposeDesc(&desc); retval = 1; } /* if */ NavDisposeReply(&reply); } /* else */ NavDialogDispose(dlg); return(retval); } /* manually_locate_product */
OSStatus GetRezLibVersion( NumVersion *version ) { if( NULL == version ) return paramErr; BlockMoveData( &gRLVersion, version, sizeof( NumVersion ) ); return noErr; }