• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ MemHandleUnlock函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MemHandleUnlock函数的典型用法代码示例。如果您正苦于以下问题:C++ MemHandleUnlock函数的具体用法?C++ MemHandleUnlock怎么用?C++ MemHandleUnlock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了MemHandleUnlock函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: MainFormInit

/***********************************************************************
 *
 * FUNCTION:    MainFormInit
 *
 * DESCRIPTION: This routine initializes the MainForm form.
 *
 * PARAMETERS:  frm - pointer to the MainForm form.
 *
 * RETURNED:    nothing
 *
 * REVISION HISTORY:
 *
 *
 ***********************************************************************/
static void MainFormInit(FormPtr frmP)
{
	FieldPtr			fld;
	char *ptr;
   	MemHandle			mh = MemHandleNew (10);
	fld = GetObjectPtr (MainSymbolField);
	ptr = MemHandleLock (mh);
	strcpy(ptr,"IBM");
	FldSetTextHandle (fld, mh);
    MemHandleUnlock(mh);
}
开发者ID:xin3liang,项目名称:platform_external_gsoap,代码行数:25,代码来源:QuoteStarter.c


示例2: ReturnRecordHandle

static UInt16 ConvertBookmarksForRecord
         (
         UInt16        recordId,
         UInt8*        bookmarkPtr,
         OldBookmarkData* dataPtr,
         UInt16        entries,
         Boolean*      done
         )
{
     UInt16    i;
     Header*   record = NULL;
     MemHandle handle = NULL;
     Boolean   success = true;

     for ( i = 0 ; i < entries ; i++ ) {
          if ( dataPtr->recordId == recordId ) {
              AnnotationEntry e;

              if ( handle == NULL ) {
                  handle = ReturnRecordHandle( recordId );

                  if ( handle == NULL )
                      return false;

                  record = MemHandleLock( handle );
              }
              MemSet( &e, sizeof( AnnotationEntry ), 0 );

              e.flags = ANNOTATION_BOOKMARK | ANNOTATION_HIDDEN;

              e.triggerStart = dataPtr->characterPosition;
              e.triggerStop  = dataPtr->characterPosition;

              e.id.uid              = dataPtr->recordId;

              e.id.paragraphNum     = GetParagraphNumber( record, e.triggerStart );
              e.id.indexInParagraph = NEW_ANNOTATION;

              success = AddAnnotation( &e, bookmarkPtr ) && success;

              done[ i ] = true;
          }

          bookmarkPtr    += StrLen( bookmarkPtr ) + 1;
          dataPtr++;
     }

     if ( handle != NULL ) {
         MemHandleUnlock( handle );
         FreeRecordHandle( &handle );
     }

     return success;
}
开发者ID:TimofonicJunkRoom,项目名称:plucker-1,代码行数:54,代码来源:bookmark.c


示例3: Assert

// Open preferences database and find a record that contains preferences.
// Return errNone if opened succesfully, otherwise an error:
//   psErrNoPrefDatabase - pref database couldn't be found
// devnote: it scans through all records even though we only store preferences
// in one record because I want to be able to use preferences database used
// in earlier versions of Noah Pro/Thes.
Err PrefsStoreReader::ErrOpenPrefsDatabase()
{
    if (_db)
    {
        Assert(_recHandle);
        Assert(_recData);
        return errNone;
    }

    // we already tried to open the database but couldn't, so don't try again
    if (_fDbNotFound)
        return psErrNoPrefDatabase;

    LocalID dbId;
    Err err = ErrFindDatabaseByNameTypeCreator(_dbName, _dbType, _dbCreator, &dbId);
    if (dmErrCantFind==err)
    {
        err = psErrNoPrefDatabase;
        goto ExitAndMarkNotFound;
    }
    if (err)
        goto ExitAndMarkNotFound;
    Assert(0!=dbId);

    _db = DmOpenDatabase(0, dbId, dmModeReadWrite);
    if (!_db)
    {
        err = DmGetLastErr();
        Assert(err);
        goto ExitAndMarkNotFound;
    }

    UInt16 recsCount = DmNumRecords(_db);
    for (UInt16 recNo = 0; recNo < recsCount; recNo++)
    {
        _recHandle = DmQueryRecord(_db, recNo);
        _recData = (unsigned char*)MemHandleLock(_recHandle);
        if ( (MemHandleSize(_recHandle)>=4) && FValidPrefsStoreRecord(_recData) )
        {
            // we found the record with prefernces so remember _recData and _recHandle
            // those must be freed in destructor
            return errNone;
        }
        MemHandleUnlock(_recHandle);
        _recHandle = NULL;
    }

    DmCloseDatabase(_db);
    _db = 0;
    err = psErrNoPrefDatabase;
ExitAndMarkNotFound:
    _fDbNotFound = true;
    return err;
}
开发者ID:kjk,项目名称:ars-framework,代码行数:60,代码来源:PrefsStore.cpp


示例4: DrawCourses

/*****************************************************************************
* Function: DrawCourses
*
* Description: local function to fill the course list
*****************************************************************************/
static void
DrawCourses(ListType *lst)
{
  MemHandle mWebsite, mEmail, old;
  Char *buffer;
  FieldType *fldWebsite, *fldEmail;
  
  gNumCourses=CountCourses();
  gCourseList = (Char **) MemPtrNew(gNumCourses * sizeof(Char *));
  gCourseInd = (UInt16 *) MemPtrNew(gNumCourses * sizeof(UInt16));

  CourseListGen(gCourseList, NULL, gCourseInd, gNumCourses, 0, CLIST_SEARCH_INDEX);
  LstSetListChoices(lst, gCourseList, gNumCourses);
  LstSetSelection(lst, -1);

  
  fldWebsite = GetObjectPtr(FIELD_cl_website);
  fldEmail = GetObjectPtr(FIELD_cl_email);
  
  mWebsite = MemHandleNew(4);
  buffer = MemHandleLock(mWebsite);
  MemSet(buffer, 4, 0);
  StrCopy(buffer, "-?-");
  MemHandleUnlock(mWebsite);

  old = FldGetTextHandle(fldWebsite);
  FldSetTextHandle(fldWebsite, mWebsite);
  if (old != NULL)  MemHandleFree(old); 

  mEmail = MemHandleNew(4);
  buffer = MemHandleLock(mEmail);
  MemSet(buffer, 4, 0);
  StrCopy(buffer, "-?-");
  MemHandleUnlock(mEmail);

  old = FldGetTextHandle(fldEmail);
  FldSetTextHandle(fldEmail, mEmail);
  if (old != NULL)  MemHandleFree(old); 

  
}
开发者ID:timn,项目名称:unimatrix,代码行数:46,代码来源:clist.c


示例5: GetLastDocInfo

/* Return info for last openned document */
DocumentInfo* GetLastDocInfo( void )
{
    DocumentInfo* docInfo;

    docInfo = NULL;

    if ( plkrDocList == NULL ) {
        plkrDocList = DmOpenDatabaseByTypeCreator( PlkrDocListType, ViewerAppID,
                        dmModeReadWrite );
    }
    if ( plkrDocList != NULL ) {
        DocumentData*   recordPtr;
        MemHandle       handle;

        ErrTry {
            /* assign doc info values for document */
            handle = FindDocData( Prefs()->docName, ALL_ELEMENTS, NULL );
            if ( handle != NULL ) {
                recordPtr = MemHandleLock( handle );

                StrNCopy( lastDocInfo.name, recordPtr->name, dmDBNameLength );
                lastDocInfo.cardNo      = recordPtr->cardNo;
                lastDocInfo.created     = recordPtr->created;
                lastDocInfo.attributes  = recordPtr->attributes;
                lastDocInfo.size        = recordPtr->size;
                lastDocInfo.categories  = recordPtr->categories;
                lastDocInfo.location    = recordPtr->location;
                lastDocInfo.timestamp   = recordPtr->timestamp;
                if ( lastDocInfo.location != RAM ) {
                    UInt16 fileLength;

                    ReleaseLastDocInfo();

                    fileLength              = StrLen( recordPtr->data ) + 1;
                    lastDocInfo.filename    = SafeMemPtrNew( fileLength );
                    StrNCopy( lastDocInfo.filename, recordPtr->data,
                        fileLength );
                    lastDocInfo.volumeRef   = FindVolRefNum( recordPtr->data +
                                                             fileLength );
                }
                MemHandleUnlock( handle );
                CloseRecord( handle, false );

                CloseDocList();

                docInfo = &lastDocInfo;
            }
        }
        ErrCatch( UNUSED_PARAM( err ) ) {
        } ErrEndCatch

        CloseDocList();
    }
开发者ID:TimofonicJunkRoom,项目名称:plucker-1,代码行数:54,代码来源:doclist.c


示例6: SetFieldFromInt

void SetFieldFromInt ( UInt16 fieldID, int data ) {
	
	/* Temporary place in heap in order to store the string data */
	MemHandle txtH;
	
	txtH = MemHandleNew ( 10 );
	if ( !txtH) return;

	StrPrintF ( MemHandleLock(txtH), "%i", data);
	SetFieldFromHandle ( fieldID, txtH);
	MemHandleUnlock (txtH);

}
开发者ID:teras,项目名称:FEdit,代码行数:13,代码来源:helper.c


示例7: GetFileProperties

 /*Returns the File record associated to an vfs fileRef */
Int32 GetFileProperties (FileRef fileRef, file_rec_t* axxFileRec)
{
    Int16 i;
    file_rec_t* axxFileList;

    i = GetFilePos((Int16)fileRef) ;
    if (i == -1)
        return expErrNotOpen;    
    axxFileList = MemHandleLock(axxFileListHandle);
    MemMove (axxFileRec, &axxFileList[i],sizeof(file_rec_t));    
    MemHandleUnlock(axxFileListHandle);
    return errNone;
}
开发者ID:TimofonicJunkRoom,项目名称:plucker,代码行数:14,代码来源:axxpacimp.c


示例8: writeRecord

/********************************************************************
 * Function: addRecord
 * Description:  function responsible for writing a packed System record
 * to the database. 
 * ******************************************************************/ 
void writeRecord (MemPtr record, MemHandle recordDBrec) {
	UInt16 length = 0, offset = 0;
	Char *ch;
	
	/* get length of the system buffer */
	length = MemPtrSize (record);
	
	/* re-size and write. */
	if (MemHandleResize (recordDBrec, length) == 0) {
		ch = MemHandleLock (recordDBrec);
		DmWrite (ch, offset, record, length);
		MemHandleUnlock (recordDBrec);
	}
}
开发者ID:sjlombardo,项目名称:strip-palm,代码行数:19,代码来源:storage_util.c


示例9: SetFieldTextFromStr

/* SetFieldTextFromStr -- Fills a field with a string
 * Args:    
 *     Word     fieldID  -- ID of field to fill, see cwimp.rpc file
 *     CharPtr  strP     -- String to fill ID with
 * Returns:
 *     FieldPtr          -- Ptr to the field set.
 */
FieldPtr SetFieldTextFromStr(Word fieldID, CharPtr strP)
{
  VoidHand txtH;
  
  txtH = MemHandleNew(StrLen(strP) + 1);
  if(!txtH) return NULL;
  
  StrCopy(MemHandleLock(txtH), strP);
  
  // ToDo: SetFieldTextFromHandle should happen *before* unlock
  MemHandleUnlock(txtH);
  
  return SetFieldTextFromHandle(fieldID, txtH);
}
开发者ID:docwhat,项目名称:cwimp,代码行数:21,代码来源:lowlevel.c


示例10: WinDrawBitmap

void Graphics::drawBitmap(uint_t bitmapId, const Point& topLeft)
{
    MemHandle handle=DmGet1Resource(bitmapRsc, bitmapId);
    if (handle) 
    {
        BitmapType* bmp=static_cast<BitmapType*>(MemHandleLock(handle));
        if (bmp) 
        {
            WinDrawBitmap(bmp, topLeft.x, topLeft.y);
            MemHandleUnlock(handle);
        }
        DmReleaseResource(handle);
    }
}
开发者ID:kjk,项目名称:ars-framework,代码行数:14,代码来源:PalmGraphics.cpp


示例11: String_Done

void String_Done()
{
	MemHandle *i;
	context* p = Context();

	StringFree();

	for (i=ARRAYBEGIN(p->StrModule,MemHandle);i!=ARRAYEND(p->StrModule,MemHandle);++i)
	{
		MemHandleUnlock(*i);
		DmReleaseResource(*i);
	}
	ArrayClear(&p->StrModule);
}
开发者ID:Erikhht,项目名称:TCPMP,代码行数:14,代码来源:str_palmos.c


示例12: AppendField

int AppendField( FieldPtr fld, CharPtr str, UInt len )
{
	Err err=0;
	CharPtr  s;
	VoidHand h;
	UInt prevlen;

	h=(VoidHand)FldGetTextHandle(fld);

	if(h==NULL) {
		h=MemHandleNew(len+1);
		if(h==NULL) return(-1);
		s=MemHandleLock(h);
		StrNCopy(s, str, len);
		s[len]=0;
		MemHandleUnlock(h);
	} else {
		prevlen=FldGetTextLength(fld);

		FldSetTextHandle(fld, NULL);

		if( MemHandleSize(h)<=(prevlen+len)) {
			err=MemHandleResize( h, prevlen+len+1 );
		}
		if( err!=0 ) return(-1);

		s=MemHandleLock(h);
		StrNCopy(s+prevlen, str, len);
		s[len+prevlen]=0;
		MemHandleUnlock(h);
	}

	FldSetTextHandle(fld, (Handle)h);
	/* FldDrawField(fld); */

	return( 0 );
}
开发者ID:12019,项目名称:scez-ng,代码行数:37,代码来源:scdir.c


示例13: GadgetDrawWeekdays

/*****************************************************************************
* Function: GadgetDrawWeekdays
*
* Description: Draws the weekdays, extra function since called in
*              GadgetDrawTimeline
*****************************************************************************/
void
GadgetDrawWeekdays(void)
{
  UInt8 i;
  MemHandle mh;
  Char *text;
  RGBColorType color, prevColor;
  DateTimeType now;
  Int16 dow;
  RectangleType bounds, rect;
  UInt16 gadgetIndex;

  // Get info about Gadget
  gadgetIndex = FrmGetObjectIndex(gForm, gGadgetID);
  FrmGetObjectBounds(gForm, gadgetIndex, &bounds);

  // Initialize time constants
  TimSecondsToDateTime(TimGetSeconds(), &now);
  dow = DayOfWeek(now.month, now.day, now.year);
  
  RctSetRectangle(&rect, bounds.topLeft.x+GADGET_BASELEFT+GADGET_LEFT, bounds.topLeft.y,
                         130, FntLineHeight()+2);

  // Erase background
  WinEraseRectangle(&rect, 0);

  for (i=0; i < gGadgetDaysNum; ++i) {
    Int16 leftoff;
    mh = DmGetResource(strRsc, GADGET_STRINGS_WDAYSTART+i);
    text = MemHandleLock(mh);
    leftoff = (gGadgetDaysWidth+2 - FntLineWidth(text, MemPtrSize(text))) / 2;
    if (TNisColored() && (dow == i+1)) {
      color.r = 0xFF;  color.g = 0x00;  color.b = 0x00;
      TNSetTextColorRGB(&color, &prevColor);
    }
    WinDrawChars(text, StrLen(text), bounds.topLeft.x+GADGET_BASELEFT+GADGET_LEFT+i*gGadgetDaysWidth+i+leftoff+2, bounds.topLeft.y);
    if (dow == i+1) {
      if (TNisColored()) {
        TNSetTextColorRGB(&prevColor, NULL);
      } else {
        // Draw some kind of underline to determine current day
        Int16 lineWidth=FntLineWidth(text, StrLen(text));
        WinDrawLine(rect.topLeft.x+i*gGadgetDaysWidth+i+leftoff+1, rect.topLeft.y+FntLineHeight(),
                    rect.topLeft.x+i*gGadgetDaysWidth+i+leftoff+1+lineWidth, rect.topLeft.y+FntLineHeight());
      }
    }
    MemHandleUnlock(mh);
  }
}
开发者ID:timn,项目名称:unimatrix,代码行数:55,代码来源:gadget.c


示例14: CourseGetIndex

Boolean
CourseGetIndex(DmOpenRef cats, UInt16 category, UInt16 courseID, UInt16 *index)
{
  MemHandle m;

  *index = 0;
  
  while ((m = DmQueryNextInCategory(cats, index, category)) != NULL) {
    Char *s=(Char *)MemHandleLock(m);
    if (s[0] == TYPE_COURSE) {
      CourseDBRecord c;
      UnpackCourse(&c, s);
      if (c.id == courseID) {
        // Found it!
        MemHandleUnlock(m);
        return true;
      }
    }
    MemHandleUnlock(m);
    *index += 1;
  }

  return false;
}
开发者ID:timn,项目名称:unimatrix,代码行数:24,代码来源:clist.c


示例15: 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


示例16: ExamBeam

static void
ExamBeam(void)
{
  MemHandle mex;
  ExamDBRecord *ex;
  UInt16 index=0;

  DmFindRecordByID(DatabaseGetRefN(DB_MAIN), gExamsLastSelRowUID, &index);
  mex = DmQueryRecord(DatabaseGetRefN(DB_MAIN), index);
  ex = (ExamDBRecord *)MemHandleLock(mex);

  MemHandleUnlock(mex);

  BeamCourseByCID(ex->course);
}
开发者ID:timn,项目名称:unimatrix,代码行数:15,代码来源:exams.c


示例17: CountCourses

/*****************************************************************************
* Function:  CountCourses
*
* Description: Counts the courses saved in the given current category.
* Assumptions: This functions assumes, that the Records are SORTED with the
*              courses first and then the times.
*****************************************************************************/
UInt16
CountCourses(void)
{
  MemHandle m;
  UInt16 index=0,count=0;

  while ((m = DmQueryNextInCategory(DatabaseGetRefN(DB_MAIN), &index, DatabaseGetCat()))) {
    Char *s = MemHandleLock(m);
    if (s[0] == TYPE_COURSE) count += 1;
    MemHandleUnlock(m);
    index += 1;
  }

  return count;
}
开发者ID:timn,项目名称:unimatrix,代码行数:22,代码来源:clist.c


示例18: StartXferMode

/*
** Initiates transfer mode.
*/
void StartXferMode(void) {
  FormType* frm = FrmGetActiveForm();
  FieldType* fld =  GetObjectPointer(frm, XferField);
  const UInt32 len = MemHandleSize(d.record_name);
  MemHandle textH = MemHandleNew(len);

  ASSERT(textH);

  FlushToBuffer();
  FrmSetMenu(frm, XferMenu);
  d.is_xfer_mode = true;
  ToggleButtonBar(frm, false);
  ResetDrawingAreaRectangle(p.formID == DiddleTForm, true);
  FrmUpdateForm(p.formID, 0);
  InitXferList();
  ToggleXferBar(frm, true);
  FrmSetFocus(frm, FrmGetObjectIndex(frm, XferField));

  /* Init field with record title */
  MemMove(MemHandleLock(textH), MemHandleLock(d.record_name), len);
  MemHandleUnlock(textH);
  MemHandleUnlock(d.record_name);
  FldSetTextHandle(fld, textH);
}
开发者ID:jemyzhang,项目名称:DiddleBug,代码行数:27,代码来源:xfer.c


示例19: smUnlock

/**
 * FUNCTION: smUnlock
 *
 * Free pointer mapped to memH memory block.
 *
 * PRE-Condition:   memH is a valid handle; memory block is locked
 *
 * POST-Condition:  memory block is unlocked
 *
 * IN:      memH
 *          Handle to memory block
 *
 * RETURN:  SML_ERR_OK, if O.K.
 *          SML_ERR_WRONG_PARAM, if memH is unknown
 *          SML_ERR_WRONG_USAGE, if memH was already unlocked
 *          SML_ERR_UNSPECIFIC, if unlock failed
 *
 * @see  smLock
 */
Ret_t smUnlock (MemHandle_t memH) {

  if ( memH != smMemH ) {
    return SML_ERR_WRONG_PARAM;
  }
  if ( ! smLocked ) {
    return SML_ERR_WRONG_USAGE;
  }

  if ( MemHandleUnlock((VoidHand)smPalmH) != 0 ) {
    return SML_ERR_UNSPECIFIC;
  }
  smLocked = 0;

  return SML_ERR_OK;
}
开发者ID:guadalinex-archive,项目名称:guadalinex-v5,代码行数:35,代码来源:wsm_sm.c


示例20: resourceLoad

// Function loads a resource with specified name
resource_p resourceLoad(const char* name)
{
    resource_p resource = NULL;
    MemHandle handle = NULL;

    ASSERT(NULL != name, "resourceLoad");

    resource = resourceFind(name);
    if (NULL == resource) {
        handle = resourceOpen(name);
        if (NULL == handle) {
            THROW("resourceLoad",
                  appErrResourceNotFound);
        }

        TRY
        {
            resource = (resource_p)objectCreate(
                sizeof(*resource),
                (destructor_f)resourceDestroy);

            resource->handle = handle;
            resource->memory
                = (const void*)MemHandleLock(
                    handle);
            resource->size
                = MemHandleSize(handle);

            if (NULL != resourcesList) {
                resource->prev = NULL;
                resource->next = resourcesList;
                resourcesList->prev = resource;
            }

            resourcesList = resource;

            resource = resourceRetain(resource);
        }
        CATCH
        {
            MemHandleUnlock(handle);
            RETHROW();
        }
        END;

        resource = resourceAutorelease(resource);
    }
开发者ID:vasalvit,项目名称:2048.prc,代码行数:48,代码来源:vav-resources.c



注:本文中的MemHandleUnlock函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MemMove函数代码示例发布时间:2022-05-30
下一篇:
C++ MemHandleLock函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap