本文整理汇总了C++中MemHandleLock函数的典型用法代码示例。如果您正苦于以下问题:C++ MemHandleLock函数的具体用法?C++ MemHandleLock怎么用?C++ MemHandleLock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MemHandleLock函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: AudioCDTabInit
static void AudioCDTabInit() {
ControlType *cck3P;
FieldType *fld2P, *fld3P;
ListType *list1P, *list2P;
MemHandle lengthH, firstTrackH;
Char *lengthP, *firstTrackP;
cck3P = (ControlType *)GetObjectPtr(TabAudioCDMP3Checkbox);
fld2P = (FieldType *)GetObjectPtr(TabAudioCDLengthSecsField);
fld3P = (FieldType *)GetObjectPtr(TabAudioCDFirstTrackField);
list1P = (ListType *)GetObjectPtr(TabAudioCDDriverList);
list2P = (ListType *)GetObjectPtr(TabAudioCDFormatList);
LstSetSelection(list1P, gameInfoP->musicInfo.sound.drvCD);
CtlSetLabel((ControlType *)GetObjectPtr(TabAudioCDDriverPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P)));
LstSetSelection(list2P, gameInfoP->musicInfo.sound.frtCD);
CtlSetLabel((ControlType *)GetObjectPtr(TabAudioCDFormatPopTrigger), LstGetSelectionText(list2P, LstGetSelection(list2P)));
CtlSetValue(cck3P, gameInfoP->musicInfo.sound.CD);
lengthH = MemHandleNew(FldGetMaxChars(fld2P)+1);
lengthP = (Char *)MemHandleLock(lengthH);
StrIToA(lengthP, gameInfoP->musicInfo.sound.defaultTrackLength);
MemHandleUnlock(lengthH);
FldSetTextHandle(fld2P, lengthH);
firstTrackH = MemHandleNew(FldGetMaxChars(fld3P)+1);
firstTrackP = (Char *)MemHandleLock(firstTrackH);
StrIToA(firstTrackP, gameInfoP->musicInfo.sound.firstTrack);
MemHandleUnlock(firstTrackH);
FldSetTextHandle(fld3P, firstTrackH);
}
开发者ID:iPodLinux-Community,项目名称:iScummVM,代码行数:33,代码来源:formmusic.cpp
示例2: PrvCreateTimeZoneArray
/***********************************************************************
*
* FUNCTION: PrvCreateTimeZoneArray
*
* DESCRIPTION: Create the array of time zone entries from our string
* list, gtm offset list, and country list resources. Sort based on
* time zone name.
*
* DOLATER kwk - we could save the time zone array we're creating here
* in memory, to avoid the performance hit of creating the array.
* On the other hand, then the list of names would need to stay
* locked down, unless we also copy those into the memory buffer,
* which means another 700+ bytes.
*
* PARAMETERS:
* timeZoneNames <-> Ptr to returned handle to list of names.
* numTimeZones <-> Ptr to count of number of time zones.
*
* RETURNED:
* Ptr to allocated array of time zone entry records.
*
* HISTORY:
* 07/31/00 kwk Created by Ken Krugler.
* 08/23/00 kwk Fixed bug where release ROMs caused ErrNonFatalDisplayIf
* to become a no-op, and thus the country and time zone
* offset list ptrs weren't skipping the count word.
*
***********************************************************************/
static TimeZoneEntryType* PrvCreateTimeZoneArray(MemHandle* timeZoneNames, UInt16* numTimeZones)
{
const Char* tzNamesP;
TimeZoneEntryType* tzEntries;
MemHandle offsetsH;
MemHandle countriesH;
UInt16* resP;
Int16* gmtOffsetsP;
UInt16* countriesP;
UInt16 i;
// Specify the number of items in the list, based on total # of items
// in our time zone name list resource.
*timeZoneNames = DmGetResource(strListRscType, TimeZoneNamesStringList);
ErrNonFatalDisplayIf(*timeZoneNames == NULL, "No time zone names");
tzNamesP = (const Char*)MemHandleLock(*timeZoneNames);
// Skip over prefix string, then get the entry count.
tzNamesP += StrLen(tzNamesP) + 1;
*numTimeZones = *tzNamesP++;
*numTimeZones = (*numTimeZones << 8) + *tzNamesP++;
// Allocate the array of time zone records.
tzEntries = (TimeZoneEntryType*)MemPtrNew(*numTimeZones * sizeof(TimeZoneEntryType));
ErrFatalDisplayIf(tzEntries == NULL, "Out of memory");
// Find and lock down the gtm offset and country integer lists.
offsetsH = DmGetResource(wrdListRscType, TimeZoneGMTOffsetsList);
ErrNonFatalDisplayIf(offsetsH == NULL, "No time zone offsets");
resP = (UInt16*)MemHandleLock(offsetsH);
ErrNonFatalDisplayIf(*resP != *numTimeZones, "GMT offset count != name count");
// Skip count at start of list.
gmtOffsetsP = (Int16*)resP + 1;
countriesH = DmGetResource(wrdListRscType, TimeZoneCountriesList);
ErrNonFatalDisplayIf(countriesH == NULL, "No time zone countries");
resP = (UInt16*)MemHandleLock(countriesH);
ErrNonFatalDisplayIf(*resP != *numTimeZones, "Time zone country count != name count");
// Skip count at start of list.
countriesP = resP + 1;
// Now loop to fill in all of the records.
for (i = 0; i < *numTimeZones; i++)
{
tzEntries[i].tzName = tzNamesP;
tzNamesP += StrLen(tzNamesP) + 1;
tzEntries[i].tzOffset = gmtOffsetsP[i];
tzEntries[i].tzCountry = (CountryType)countriesP[i];
}
MemHandleUnlock(offsetsH);
MemHandleUnlock(countriesH);
// Now sort the list, based on the time zone name.
SysQSort(tzEntries, *numTimeZones, sizeof(TimeZoneEntryType), PrvCompareTimeZoneEntries, 0);
return(tzEntries);
} // PrvCreateTimeZoneArray
开发者ID:kernelhcy,项目名称:hcyprojects,代码行数:88,代码来源:SelTimeZone.c
示例3: PrvSetTimeField
/***********************************************************************
*
* FUNCTION: PrvSetTimeField
*
* DESCRIPTION: Set the given field's text to show a time and day of week.
*
* PARAMETERS: frm - a pointer to the form containing the field to set
* timeFieldID - the ID of the field to set
* timeHandle - the handle used for storing the text for this field
* time - a pointer to the date and time to show in the field
* drawField - whether to draw field after setting its text
*
* RETURNED: nothing
*
* REVISION HISTORY:
* Name Date Description
* ---- ---- -----------
* peter 3/7/00 Initial Revision
*
***********************************************************************/
static void PrvSetTimeField(FormType * frm, UInt16 timeFieldID, MemHandle timeHandle,
DateTimeType *time, Boolean drawField)
{
FieldType * timeFieldP;
Char * timeString, * timeZoneDOWFormatString, * currentDOWString;
MemHandle resHandle;
TimeFormatType timeFormat; // Format to display time in
timeFormat = (TimeFormatType)PrefGetPreference(prefTimeFormat);
timeString = MemHandleLock(timeHandle);
TimeToAscii(time->hour, time->minute, timeFormat, timeString);
currentDOWString = timeString + StrLen(timeString);
currentDOWString[0] = ' ';
currentDOWString++;
resHandle = DmGetResource(strRsc, DOWformatString);
ErrNonFatalDisplayIf(resHandle == NULL, "Missing string resource");
timeZoneDOWFormatString = MemHandleLock(resHandle);
DateTemplateToAscii(timeZoneDOWFormatString, time->month, time->day, time->year,
currentDOWString, dowLongDateStrLength);
MemHandleUnlock(resHandle);
MemHandleUnlock(timeHandle);
timeFieldP = FrmGetObjectPtr (frm, FrmGetObjectIndex (frm, timeFieldID));
FldSetTextHandle(timeFieldP, timeHandle);
if (drawField)
FldDrawField(timeFieldP);
}
开发者ID:kernelhcy,项目名称:hcyprojects,代码行数:50,代码来源:SelTimeZone.c
示例4: ExamDelete
static void
ExamDelete(void)
{
MemHandle mex, m;
ExamDBRecord *ex;
UInt16 index=0, pressedButton=0;
Char *courseName, timeTemp[timeStringLength], dateTemp[longDateStrLength];
DmFindRecordByID(DatabaseGetRefN(DB_MAIN), gExamsLastSelRowUID, &index);
mex = DmQueryRecord(DatabaseGetRefN(DB_MAIN), index);
ex = (ExamDBRecord *)MemHandleLock(mex);
m=MemHandleNew(1);
CourseGetName(ex->course, &m, true);
courseName = MemHandleLock(m);
DateToAscii(ex->date.month, ex->date.day, ex->date.year+MAC_SHIT_YEAR_CONSTANT, PrefGetPreference(prefLongDateFormat), dateTemp);
TimeToAscii(ex->begin.hours, ex->begin.minutes, PrefGetPreference(prefTimeFormat), timeTemp);
pressedButton = FrmCustomAlert(ALERT_ex_dodel, courseName, dateTemp, timeTemp);
MemHandleUnlock(m);
MemHandleFree(m);
MemHandleUnlock(mex);
if (pressedButton == 0) {
// OK, the user really wants us to delete the record
NoteDelete(&index);
DmRemoveRecord(DatabaseGetRefN(DB_MAIN), index);
gExamsSelRow=0;
FrmUpdateForm(FORM_exams, frmRedrawUpdateCode);
}
}
开发者ID:timn,项目名称:unimatrix,代码行数:33,代码来源:exams.c
示例5: TableDrawData
static void
TableDrawData(void *table, Int16 row, Int16 column, RectangleType *bounds)
{
UInt16 index=TblGetRowID(table, row);
ExamDBRecord *ex;
MemHandle mex;
RGBColorType fore={0x00, 0x00, 0x00, 0x00}, back={0x00, 0xFF, 0xFF, 0xFF};
if (! TblRowUsable(table, row)) return;
TNSetBackColorRGB(&back, NULL);
TNSetForeColorRGB(&back, NULL);
WinDrawRectangle(bounds, 0);
mex = DmQueryRecord(DatabaseGetRefN(DB_MAIN), index);
ex = (ExamDBRecord *)MemHandleLock(mex);
if (column == EXCOL_COURSE) {
Char *temp;
MemHandle m=MemHandleNew(1);
CourseGetName(ex->course, &m, true);
temp = MemHandleLock(m);
TNSetForeColorRGB(&fore, NULL);
TNDrawCharsToFitWidth(temp, bounds);
MemHandleUnlock(m);
MemHandleFree(m);
} else if (column == EXCOL_NOTE) {
if (ex->note) {
Char noteSymb[2] = { GADGET_NOTESYMBOL, 0 };
FontID oldFont = FntSetFont(symbolFont);
TNDrawCharsToFitWidth(noteSymb, bounds);
FntSetFont(oldFont);
}
} else if (column == EXCOL_DATE) {
Char dateTemp[dateStringLength];
DateToAscii(ex->date.month, ex->date.day, ex->date.year+MAC_SHIT_YEAR_CONSTANT, PrefGetPreference(prefDateFormat), dateTemp);
TNDrawCharsToFitWidth(dateTemp, bounds);
} else if (column == EXCOL_TIME) {
Char timeTemp[timeStringLength];
TimeToAscii(ex->begin.hours, ex->begin.minutes, PrefGetPreference(prefTimeFormat), timeTemp);
TNDrawCharsToFitWidth(timeTemp, bounds);
}
if (ex->flags & EX_FLAG_DONE) {
RGBColorType red = {0x00, 0xFF, 0x00, 0x00}, old;
Int16 yCoord=bounds->topLeft.y+(bounds->extent.y / 2);
TNSetForeColorRGB(&red, &old);
WinDrawLine(bounds->topLeft.x, yCoord, bounds->topLeft.x+bounds->extent.x, yCoord);
TNSetForeColorRGB(&old, NULL);
}
MemHandleUnlock(mex);
}
开发者ID:timn,项目名称:unimatrix,代码行数:57,代码来源:exams.c
示例6: LoadRecordData
/*
** Load the record data (flags, ...) - but not the picture
*/
static void LoadRecordData(void) {
MemHandle t = NULL;
MemPtr ptr = NULL;
UInt16 attr = 0;
UInt32 highDataOffset = 0;
Int16 len = 0;
PRINT("Loading Record Data for %hd", p.dbI);
/* Clear unmasked flag */
d.unmaskedCurrentRecord = false;
/* Open and lock the record */
t = DmQueryRecord(d.dbR, p.dbI);
if (!t) abort();
ptr = MemHandleLock(t);
/* Is the record private? */
DmRecordInfo(d.dbR, p.dbI, &attr, NULL, NULL);
d.record_private = attr & dmRecAttrSecret;
/* Read the header data */
MemMove(&d.record, ptr, sizeof(DiddleBugRecordType));
/* Read the additional alarm info */
highDataOffset = sketchDataOffset + d.record.sketchLength;
len = StrLen((Char*)(ptr + highDataOffset)) + 1; /* +1 for null char */
if (d.record_name) MemHandleFree(d.record_name);
d.record_name = MemHandleNew(len);
ASSERT(d.record_name);
MemMove(MemHandleLock(d.record_name), ptr + highDataOffset, len);
MemHandleUnlock(d.record_name);
highDataOffset += len;
len = StrLen((Char*)(ptr + highDataOffset)) + 1; /* +1 for null char */
if (d.record_note) MemHandleFree(d.record_note);
d.record_note = MemHandleNew(len);
ASSERT(d.record_note);
MemMove(MemHandleLock(d.record_note), ptr + highDataOffset, len);
MemHandleUnlock(d.record_note);
highDataOffset += len;
/* Clear old data since there may not be an extra-data block yet */
MemSet(&d.record_sound, sizeof(AlarmSoundInfoType), 0);
d.record_sound.listIndex = -1; /* default */
/* Read new extra-data (if it exists and is from a compatible version) */
if (d.record.extraLength == sizeof(AlarmSoundInfoType))
MemMove(&d.record_sound, ptr + highDataOffset, d.record.extraLength);
/* Unlock record */
MemHandleUnlock(t);
}
开发者ID:jemyzhang,项目名称:DiddleBug,代码行数:58,代码来源:thumbnails_details.c
示例7: GadgetDrawTime
/*****************************************************************************
* Function: GadgetDrawTime
*
* Description: Show a time in the grid
*****************************************************************************/
void
GadgetDrawTime(TimeType begin, TimeType end, UInt8 day, RGBColorType *color, UInt16 courseID, UInt8 num_times, UInt8 pos)
{
RectangleType rect;
RGBColorType prevColor, inverted;
// Sort out bogus requests, could be more intelligent, maybe later...
if (day >= gGadgetDaysNum) return;
// do nothing if Gadget has not yet been GadgetSet
if (! gForm) return;
if (! gGadgetID) return;
GadgetTimeSetRect(&rect, begin, end, day, num_times, pos);
TNSetForeColorRGB(color, &prevColor);
WinDrawRectangle(&rect, 0);
if ( (gPrefs.showTypes || gPrefs.showShortNames) && (rect.extent.y >= FntLineHeight())) {
RGBColorType oldBack, oldText;
// Get inverted color
inverted.r = 255 - color->r;
inverted.g = 255 - color->g;
inverted.b = 255 - color->b;
RctSetRectangle(&rect, rect.topLeft.x+2, rect.topLeft.y, rect.extent.x-4, rect.extent.y);
TNSetTextColorRGB(&inverted, &oldText);
TNSetBackColorRGB(color, &oldBack);
if (gPrefs.showTypes) {
MemHandle shortName=MemHandleNew(1);;
CourseTypeGetShortByCourseID(&shortName, courseID);
TNDrawCharsToFitWidth((Char *)MemHandleLock(shortName), &rect);
MemHandleUnlock(shortName);
MemHandleFree(shortName);
} else if (gPrefs.showShortNames) {
MemHandle courseName=MemHandleNew(1);
CourseGetName(courseID, &courseName, false);
TNDrawCharsToFitWidth((Char *)MemHandleLock(courseName), &rect);
MemHandleUnlock(courseName);
MemHandleFree(courseName);
}
TNSetBackColorRGB(&oldBack, NULL);
TNSetTextColorRGB(&oldText, NULL);
}
TNSetForeColorRGB(&prevColor, NULL);
}
开发者ID:timn,项目名称:unimatrix,代码行数:60,代码来源:gadget.c
示例8: LoadOffsets
Err vfsFileDBGetRecord
(
FileRef ref,
UInt16 recIndex,
MemHandle *recHP,
UInt8 *recAttrP,
UInt32 *uniqueIDP
)
{
UInt32 offset;
UInt32 length;
MemPtr mp;
Char* buf;
file_rec_t axxFileRec;
Err err;
if (GetFileProperties (ref,&axxFileRec)!=errNone)
return dmErrNotRecordDB;
if (currFileDesc != axxFileRec.fd)
LoadOffsets(axxFileRec.fd);
/*Get the record byte position withing the file */
mp = MemHandleLock(moff);
ASSERT_MSG("AIM0", mp != 0);
offset = ((UInt32*)mp)[recIndex * 2];
length = recIndex < nrec ? ((UInt32*)mp)[recIndex * 2 + 2] :
axxFileRec.size;
MemHandleUnlock(moff);
if ( nrec < recIndex) {
return dmErrIndexOutOfRange;
}
length -= offset;
err=axxPacSeek(LibRef, axxFileRec.fd, offset, SEEK_SET);
if (err==AXXPAC_ERR_FILE_CLOSED) {
axxPacFD FileDesc;
/*This happens when the axxPac has entered into sleep mode */
FileDesc = axxPacOpen(LibRef, axxFileRec.name,axxFileRec.mode);
if (FileDesc<0)
return dmErrNotRecordDB;
/*The axxPac could have assigned a FileDesc different from before */
if (FileDesc!=axxFileRec.fd) {
UpdateFileDesc (ref,FileDesc);
axxFileRec.fd=FileDesc;
}
err=axxPacSeek(LibRef, FileDesc, offset, SEEK_SET);
}
*recHP = MemHandleNew(length);
buf = MemHandleLock(*recHP);
axxPacRead (LibRef, axxFileRec.fd, buf, length);
MemHandleUnlock(*recHP);
return errNone;
}
开发者ID:TimofonicJunkRoom,项目名称:plucker,代码行数:54,代码来源:axxpacimp.c
示例9: CourseListHandleSelection
static Boolean
CourseListHandleSelection(void)
{
MemHandle m, mWebsite, mEmail, old;
CourseDBRecord c;
FieldType *fldWebsite, *fldEmail;
Char *buffer;
m = DmQueryRecord(DatabaseGetRefN(DB_MAIN), gCourseInd[LstGetSelection(GetObjectPtr(LIST_courses))]);
if (! m) return true;
UnpackCourse(&c, MemHandleLock(m));
fldWebsite = GetObjectPtr(FIELD_cl_website);
fldEmail = GetObjectPtr(FIELD_cl_email);
if (StrLen(c.website) == 0) {
mWebsite = MemHandleNew(4);
buffer=MemHandleLock(mWebsite);
MemSet(buffer, 4, 0);
StrCopy(buffer, "-?-");
} else {
mWebsite = MemHandleNew(StrLen(c.website)+1);
buffer = MemHandleLock(mWebsite);
MemSet(buffer, StrLen(c.website)+1, 0);
StrCopy(buffer, c.website);
}
MemHandleUnlock(mWebsite);
old = FldGetTextHandle(fldWebsite);
FldSetTextHandle(fldWebsite, mWebsite);
if (old != NULL) MemHandleFree(old);
FldDrawField(fldWebsite);
if (StrLen(c.teacherEmail) == 0) {
mEmail = MemHandleNew(4);
buffer = MemHandleLock(mEmail);
MemSet(buffer, 4, 0);
StrCopy(buffer, "-?-");
} else {
mEmail = MemHandleNew(StrLen(c.teacherEmail)+1);
buffer = MemHandleLock(mEmail);
MemSet(buffer, StrLen(c.teacherEmail)+1, 0);
StrCopy(buffer, c.teacherEmail);
}
MemHandleUnlock(mEmail);
old = FldGetTextHandle(fldEmail);
FldSetTextHandle(fldEmail, mEmail);
if (old != NULL) MemHandleFree(old);
FldDrawField(fldEmail);
MemHandleUnlock(m);
return false;
}
开发者ID:timn,项目名称:unimatrix,代码行数:52,代码来源:clist.c
示例10: ZDicFontInit
/***********************************************************************
*
* FUNCTION: ZDicFontInit
*
* DESCRIPTION: Initial all font resource
*
* PARAMETERS: nothing
*
* RETURN: errNone if success else fail.
*
* REVISION HISTORY:
* Name Date Description
* ---- ---- -----------
* ZhongYuanHuan 14/Aug/04 Initial Revision
*
***********************************************************************/
Err ZDicFontInit ( UInt16 refNum, ZDicFontType* fontP, Boolean bUseSysFont )
{
#pragma unused(refNum)
UInt32 version;
Err err;
MemSet ( fontP, sizeof ( ZDicFontType ), 0 );
fontP->smallFontID = stdFont;
fontP->largeFontID = largeFont;
if ( bUseSysFont ) return errNone;
fontP->fontLibP = DmOpenDatabaseByTypeCreator ( ZDicFontTypeID, ZDicFontCreatorID, dmModeReadOnly );
if ( fontP->fontLibP == 0 )
{
err = DmGetLastErr ();
return err;
}
// Load the phonic font resource and assign it a font ID.
err = FtrGet(sysFtrCreator, sysFtrNumWinVersion, &version);
if (!err && version >= 4 )
{
// the screen is double density so use double density of phonetic font.
fontP->phonicSmallFontH = DmGetResource('nfnt', PhonicSmallFontHight);
fontP->phonicLargeFontH = DmGetResource('nfnt', PhonicLargeFontHight);
}
if (fontP->phonicSmallFontH == NULL || fontP->phonicLargeFontH == NULL)
{
if (fontP->phonicSmallFontH != NULL) DmReleaseResource(fontP->phonicSmallFontH);
if (fontP->phonicLargeFontH != NULL) DmReleaseResource(fontP->phonicLargeFontH);
// the screen is low desity so use low density of phonetic font.
fontP->phonicSmallFontH = DmGetResource(fontRscType, PhonicSmallFontLow);
fontP->phonicLargeFontH = DmGetResource(fontRscType, PhonicLargeFontLow);
}
fontP->phonicSmallFontP = (FontType *)MemHandleLock(fontP->phonicSmallFontH);
fontP->phonicLargeFontP = (FontType *)MemHandleLock(fontP->phonicLargeFontH);
err = FntDefineFont(kPHONIC_SMALL_FONT_ID, fontP->phonicSmallFontP);
err = FntDefineFont(kPHONIC_LARGE_FONT_ID, fontP->phonicLargeFontP);
fontP->smallFontID = kPHONIC_SMALL_FONT_ID;
fontP->largeFontID = kPHONIC_LARGE_FONT_ID;
return errNone;
}
开发者ID:jemyzhang,项目名称:ZDic,代码行数:65,代码来源:ZDicFontImpl.c
示例11: getSystemFromIndex
/**************************************************************************
* Function: getSystemFromIndex
* Description: based upon a system database index, this will locate the
* system for that index, unpack and decrypt it and initialize s
* ************************************************************************/
void getSystemFromIndex (DmOpenRef SystemDB, md_hash * SysPass, UInt16 index, MemHandle tmp, System * s) {
MemHandle rec = DmQueryRecord (SystemDB, index);
if (rec) {
MemPtr scratch, buff = MemHandleLock (rec);
/* resize the buffer */
if (MemHandleResize (tmp, MemPtrSize (buff)) == 0) {
scratch = MemHandleLock (tmp);
/* unpack and decrypt the account */
UnpackSystem (s, buff, scratch, SysPass, MemHandleSize (rec), true);
}
MemHandleUnlock (rec);
}
}
开发者ID:sjlombardo,项目名称:strip-palm,代码行数:20,代码来源:storage_util.c
示例12: ModSetStack
static void ModSetStack(UInt32 newSize, UInt16 cardNo, LocalID dbID) {
DmOpenRef dbRef = DmOpenDatabase(cardNo, dbID, dmModeReadWrite);
if (dbRef) {
MemHandle pref = DmGetResource('pref',0);
UInt32 size = 0;
if (pref) {
SysAppPrefsType *data = (SysAppPrefsType *)MemHandleLock(pref);
size = data->stackSize;
if (newSize) {
SysAppPrefsType newData;
MemMove(&newData, data, sizeof(SysAppPrefsType));
newData.stackSize = newSize;
DmWrite(data, 0, &newData, sizeof(SysAppPrefsType));
}
MemPtrUnlock(data);
DmReleaseResource(pref);
}
DmCloseDatabase(dbRef);
}
}
开发者ID:iPodLinux-Community,项目名称:iScummVM,代码行数:25,代码来源:launch.cpp
示例13: DmCloseDatabase
/*----------------------------------------CIRexxApp::copyScriptFromFindResult-+
| |
+----------------------------------------------------------------------------*/
void CIRexxApp::copyScriptFromFindResult(GoToParamsPtr pGoToParams)
{
Err err;
LocalID dbID;
UInt16 cardNo = 0;
DmOpenRef dbP;
DmSearchStateType searchState;
MemHandle hRecord;
if ((err = DmGetNextDatabaseByTypeCreator(
true, &searchState, 'data', CREATORID, true, &cardNo, &dbID)) != errNone) {
return;
}
if ((dbP = DmOpenDatabase(cardNo, dbID, dmModeReadOnly)) == 0) {
return;
}
if (!(hRecord = DmQueryRecord(dbP, pGoToParams->recordNum))) {
DmCloseDatabase(dbP);
return;
}
Char * p = (char *)MemHandleLock(hRecord);
UInt32 size = MemHandleSize(hRecord);
if (p[size - 1] == '\0') { --size; }
emptyScript();
appendScript(p, size);
MemHandleUnlock(hRecord);
DmCloseDatabase(dbP);
return;
}
开发者ID:Jaxo,项目名称:yaxx,代码行数:32,代码来源:IRexxApp.cpp
示例14: MainFormLookupClipboard
static void MainFormLookupClipboard(AppContext* appContext)
{
char txtBuf[MAX_WORD_IN_CLIP_LEN+1];
MemHandle clipItemHandle;
UInt16 clipTxtLen;
clipItemHandle = ClipboardGetItem(clipboardText, &clipTxtLen);
if (!clipItemHandle || 0==clipTxtLen)
return;
const char* clipTxt=static_cast<const char*>(MemHandleLock(clipItemHandle));
if (!clipTxt)
{
MemHandleUnlock( clipItemHandle );
return;
}
SafeStrNCopy(txtBuf, sizeof(txtBuf), clipTxt, clipTxtLen);
MemHandleUnlock(clipItemHandle);
StringExtractWord(txtBuf);
StartWordLookup(appContext, static_cast<const char*>(txtBuf));
}
开发者ID:kjk,项目名称:noah-palm,代码行数:25,代码来源:main_form.c
示例15: CountExtBookmarks
/* Return the number of external bookmarks */
UInt16 CountExtBookmarks( void )
{
UInt16 entries;
MemHandle handle;
UInt8* bookmarkPtr;
handle = NULL;
bookmarkPtr = NULL;
entries = 0;
ErrTry {
handle = ReturnRecordHandle( EXTERNAL_BOOKMARKS_ID );
}
ErrCatch( UNUSED_PARAM( err ) ) {
FreeRecordHandle( &handle );
return 0;
} ErrEndCatch
if ( handle == NULL )
return NO_BOOKMARKS;
bookmarkPtr = MemHandleLock( handle );
bookmarkPtr += sizeof( Header );
entries = GET_EXTFIRSTFIELD( bookmarkPtr );
MemHandleUnlock( handle );
FreeRecordHandle( &handle );
return entries;
}
开发者ID:TimofonicJunkRoom,项目名称:plucker,代码行数:30,代码来源:bookmark.c
示例16: ReturnRecordHandle
/* Restore data for external bookmark, return the record ID or
NO_RECORD if it doesn't exist */
UInt16 GotoExtBookmark
(
UInt16 index /* index in bookmarks list */
)
{
UInt16 uid;
UInt16 offset;
MemHandle handle;
UInt8* bookmarkPtr;
handle = NULL;
bookmarkPtr = NULL;
offset = 0;
handle = ReturnRecordHandle( EXTERNAL_BOOKMARKS_ID );
if ( handle == NULL )
return NO_RECORD;
bookmarkPtr = MemHandleLock( handle );
bookmarkPtr += sizeof( Header );
bookmarkPtr += GET_EXTSECONDFIELD( bookmarkPtr ) - sizeof( Header );
bookmarkPtr += index * 4;
uid = GET_EXTFIRSTFIELD( bookmarkPtr );
offset = GET_EXTSECONDFIELD( bookmarkPtr );
if ( IsFullscreenformActive() )
FsFrmGotoForm ( GetMainFormId() );
JumpToRecord( uid, offset, NO_OFFSET );
MemHandleUnlock( handle );
return uid;
}
开发者ID:TimofonicJunkRoom,项目名称:plucker,代码行数:37,代码来源:bookmark.c
示例17: ResetBookmarkVerticalOffsets
/* Reset the verticalOffset fields in all the bookmarks */
void ResetBookmarkVerticalOffsets( void )
{
UInt8* bookmarkPtr;
MemHandle handle;
UInt16 offset;
Int16 entries;
handle = ReturnMetaHandle( INTERNAL_BOOKMARKS_ID, NO_PARAGRAPHS );
if ( handle == NULL )
return;
bookmarkPtr = MemHandleLock( handle );
offset = GET_OFFSET( bookmarkPtr );
entries = GET_ENTRIES( bookmarkPtr );
while ( entries-- ) {
YOffset verticalOffset;
verticalOffset = NO_VERTICAL_OFFSET;
DmWrite( bookmarkPtr, offset + OFFSETOF( BookmarkData, verticalOffset ),
&verticalOffset, sizeof( YOffset ) );
offset += sizeof( BookmarkData );
}
MemHandleUnlock( handle );
}
开发者ID:TimofonicJunkRoom,项目名称:plucker,代码行数:26,代码来源:bookmark.c
示例18: RemoveFileRec
/* remove an item from the list and move te rest one position up */
static Int16 RemoveFileRec(FileRef fr)
{
Int16 i;
Err ret;
file_rec_t* axxFileList;
axxPacFD FileDesc;
axxFileList = MemHandleLock(axxFileListHandle);
i = GetFilePos((Int16)fr);
if (i == -1)
return -1;
FileDesc=axxFileList[i].fd;
for (; i < axxFLSize - 1; i++) {
MemMove (&axxFileList[i], &axxFileList[i + 1],sizeof(axxFileList));
}
axxFLSize--;
ret = MemHandleResize(axxFileListHandle, sizeof(file_rec_t) * axxFLSize);
ret = MemHandleUnlock(axxFileListHandle);
/* Check if the current file is the one removed from the list */
if ((currFileDesc != -1) && ( FileDesc== currFileDesc)) {
/* the cache of offsets is no longer valid if this file
was closed */
currFileDesc = -1;
MemHandleFree(moff);
}
return 0;
}
开发者ID:TimofonicJunkRoom,项目名称:plucker,代码行数:29,代码来源:axxpacimp.c
示例19: ApptNewRecord
/************************************************************
*
* FUNCTION: ApptNewRecord
*
* DESCRIPTION: Create a new packed record in sorted position
*
* PARAMETERS: database pointer
* database record
*
* RETURNS: ##0 if successful, error code if not
*
* CREATED: 1/25/95
*
* BY: Roger Flores
*
*************************************************************/
Err ApptNewRecord(DmOpenRef dbP, ApptDBRecordPtr r, UInt16 *index) {
MemHandle recordH;
ApptPackedDBRecordPtr recordP;
UInt16 newIndex;
Err err;
// Make a new chunk with the correct size.
recordH = DmNewHandle (dbP, (UInt32) ApptPackedSize(r));
if (recordH == NULL)
return dmErrMemError;
recordP = MemHandleLock (recordH);
// Copy the data from the unpacked record to the packed one.
ApptPack (r, recordP);
newIndex = ApptFindSortPosition(dbP, recordP);
MemPtrUnlock (recordP);
// 4) attach in place
err = DmAttachRecord(dbP, &newIndex, recordH, 0);
if (err)
MemHandleFree(recordH);
else
*index = newIndex;
return err;
}
开发者ID:jmjeong,项目名称:happydays.palm,代码行数:46,代码来源:datebook.c
示例20: LoadPreferencesNoahPro
static void LoadPreferencesNoahPro(AppContext* appContext)
{
DmOpenRef db;
UInt recNo;
void * recData;
MemHandle recHandle;
UInt recsCount;
Boolean fRecFound = false;
appContext->fFirstRun = true;
db = DmOpenDatabaseByTypeCreator(NOAH_PREF_TYPE, NOAH_PRO_CREATOR, dmModeReadWrite);
if (!db) return;
recsCount = DmNumRecords(db);
for (recNo = 0; (recNo < recsCount) && !fRecFound; recNo++)
{
recHandle = DmQueryRecord(db, recNo);
recData = MemHandleLock(recHandle);
if ( (MemHandleSize(recHandle)>=PREF_REC_MIN_SIZE) && IsValidPrefRecord( recData ) )
{
LogG( "LoadPreferencesNoahPro(), found prefs record" );
fRecFound = true;
appContext->fFirstRun = false;
DeserializePreferencesNoahPro(appContext, (unsigned char*)recData, MemHandleSize(recHandle) );
}
MemPtrUnlock(recData);
}
DmCloseDatabase(db);
}
开发者ID:kjk,项目名称:noah-palm,代码行数:28,代码来源:noah_pro.c
注:本文中的MemHandleLock函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论