本文整理匯總了C++中BlockMoveData函數的典型用法代碼示例。如果您正苦於以下問題:C++ BlockMoveData函數的具體用法?C++ BlockMoveData怎麽用?C++ BlockMoveData使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了BlockMoveData函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: ResolveFileIDRef
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 );
}
示例2: GetDataAvailable
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;
}
示例3: LoadImportPLUG
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);
}
示例4: GetFullPath
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;
}
示例5: NScanResource
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++;
}
}
}
示例6: CopyCatalogNodeInfo
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) );
}
示例7: LinkHeaders
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;
}
示例8: SDL_SYS_CDInit
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);
}
示例9: SDL_SYS_CDInit
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);
}
示例10: PutFile
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);
}
示例11: moveright
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*/
示例12: createMovieFromURL
//--------------------------------------------------------------
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;
}
示例13: NSLoadNamedFragment
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;
}
示例14: ThrowException_AC
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;
}
示例15: GetPPPlugType
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;
}