这篇教程C++ CHECK_INIT函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CHECK_INIT函数的典型用法代码示例。如果您正苦于以下问题:C++ CHECK_INIT函数的具体用法?C++ CHECK_INIT怎么用?C++ CHECK_INIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CHECK_INIT函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: gp_camera_file_read/** * Reads a file partially from the #Camera. * * @param camera a #Camera * @param folder a folder * @param file the name of a file * @param type the #CameraFileType * @param offset the offset into the camera file * @param data the buffer receiving the data * @param size the size to be read and that was read * @param context a #GPContext * @return a gphoto2 error code * **/intgp_camera_file_read (Camera *camera, const char *folder, const char *file, CameraFileType type, uint64_t offset, char *buf, uint64_t *size, GPContext *context){ GP_LOG_D ("Getting file '%s' in folder '%s'...", file, folder); C_PARAMS (camera && folder && file && buf && size); CHECK_INIT (camera, context); /* Did we get reasonable foldername/filename? */ if (strlen (folder) == 0) { CAMERA_UNUSED (camera, context); return (GP_ERROR_DIRECTORY_NOT_FOUND); } if (strlen (file) == 0) { CAMERA_UNUSED (camera, context); return (GP_ERROR_FILE_NOT_FOUND); } CHECK_RESULT_OPEN_CLOSE (camera, gp_filesystem_read_file (camera->fs, folder, file, type, offset, buf, size, context), context); CAMERA_UNUSED (camera, context); return (GP_OK);}
开发者ID:Jay314,项目名称:libgphoto2,代码行数:41,
示例2: gp_camera_capture_preview/** * Captures a preview that won't be stored on the camera but returned in * supplied file. * * @param camera a #Camera * @param file a #CameraFile * @param context a #GPContext * @return a gphoto2 error code * * For example, you could use gp_capture_preview() for taking some sample * pictures before calling gp_capture(). * **/intgp_camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context){ char *xname; C_PARAMS (camera && file); CHECK_INIT (camera, context); CR (camera, gp_file_clean (file), context); if (!camera->functions->capture_preview) { gp_context_error (context, _("This camera can " "not capture previews.")); CAMERA_UNUSED (camera, context); return (GP_ERROR_NOT_SUPPORTED); } CHECK_RESULT_OPEN_CLOSE (camera, camera->functions->capture_preview ( camera, file, context), context); gp_file_get_name_by_type (file, "capture_preview", GP_FILE_TYPE_NORMAL, &xname); /* FIXME: Marcus ... will go away, just keep compatible now. */ gp_file_set_name (file, xname); free (xname); CAMERA_UNUSED (camera, context); return (GP_OK);}
开发者ID:Jay314,项目名称:libgphoto2,代码行数:39,
示例3: gp_port_check_int/** * /brief Check for intterupt. * * /param port a GPPort * /param data a pointer to an allocated buffer * /param size the number of bytes that should be read * * Reads a specified number of bytes from the interrupt endpoint * into the supplied buffer. * Function waits port->timeout miliseconds for data on interrupt endpoint. * * /return a gphoto2 error code **/intgp_port_check_int (GPPort *port, char *data, int size){ int retval; gp_log (GP_LOG_DEBUG, "gphoto2-port", ngettext( "Reading %i=0x%x byte from interrupt endpoint...", "Reading %i=0x%x bytes from interrupt endpoint...", size), size, size); CHECK_NULL (port); CHECK_INIT (port); /* Check if we read as many bytes as expected */ CHECK_SUPP (port, "check_int", port->pc->ops->check_int); retval = port->pc->ops->check_int (port, data, size, port->timeout); CHECK_RESULT (retval); if (retval != size) gp_log (GP_LOG_DEBUG, "gphoto2-port", _("Could only read %i " "out of %i byte(s)"), retval, size); gp_log_data ("gphoto2-port", data, retval); return (retval);}
开发者ID:CastorGemini,项目名称:libgphoto2,代码行数:39,
示例4: html_valid_set_optionstatic html_valid_status_thtml_valid_set_option (html_valid_t * htv, SV * option, SV * value){ TidyOption to; TidyOptionType tot; TidyOptionId ti; const char * coption; STRLEN coption_length; CHECK_INIT (htv); coption = SvPV (option, coption_length); to = tidyGetOptionByName(htv->tdoc, coption); if (to == 0) { warn ("unknown option %s", coption); return html_valid_unknown_option; } ti = tidyOptGetId (to); tot = tidyOptGetType (to); switch (tot) { case TidyString: CALL (set_string_option (htv, coption, ti, value)); break; case TidyInteger: CALL (set_number_option (htv, coption, ti, value)); break; case TidyBoolean: tidyOptSetBool (htv->tdoc, ti, SvTRUE (value)); break; default: fprintf (stderr, "%s:%d: bad option type %d from tidy library./n", __FILE__, __LINE__, tot); return html_valid_bad_option_type; } return html_valid_ok;}
开发者ID:Manwar,项目名称:html-valid,代码行数:34,
示例5: gp_port_check_int_fast/** * /brief Check for interrupt without wait * /param port a GPPort * /param data a pointer to an allocated buffer * /param size the number of bytes that should be read * * Reads a specified number of bytes from the inerrupt endpoint * into the supplied buffer. * Function waits 50 miliseconds for data on interrupt endpoint. * * /return a gphoto2 error code **/intgp_port_check_int_fast (GPPort *port, char *data, int size){ int retval; gp_log (GP_LOG_DATA, __func__, "Reading %i = 0x%x bytes from interrupt endpoint...", size, size); C_PARAMS (port); CHECK_INIT (port); /* Check if we read as many bytes as expected */ CHECK_SUPP (port, "check_int", port->pc->ops->check_int); retval = port->pc->ops->check_int (port, data, size, FAST_TIMEOUT); CHECK_RESULT (retval);#ifdef IGNORE_EMPTY_INTR_READS /* For Canon cameras, we will make lots of reads that will return zero length. Don't bother to log them as errors. */ if (retval != 0 )#endif LOG_DATA (data, retval, size, "Read ", "from interrupt endpoint (fast):"); return (retval);}
开发者ID:axxel,项目名称:libgphoto2,代码行数:37,
示例6: PrioQueueTopint32_t PrioQueueTop(PrioQueue *self, Item *pItem){ CHECK_INIT(self); BinHeap *pHeap = self->pData->pHeap_; int32_t iRtnCode = pHeap->top(pHeap, pItem); return iRtnCode;}
开发者ID:czchen,项目名称:C-Common-Data-Structures,代码行数:7,
示例7: _DEFUN_VOIDFILE *_DEFUN_VOID (tmpfile){ int ret; FILE* fp; struct _reent *ptr = _REENT; CHECK_INIT(ptr); fp = __sfp(ptr); if (!fp) { return NULL; } ret = __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_TMPFILE, &ret); if (ret) { fp->_fp = ret; return fp; } else { __sfp_free(fp); return NULL; }}
开发者ID:32bitmicro,项目名称:newlib-nano-1.0,代码行数:25,
示例8: VFSCANF/** * @brief Formats input of a stdarg argument list. * * @details The function is equivalent to fscanf() except that * instead of being called with a variable number of arguments, * is called with an argument list as defined in the <stdarg.h> header. * * @return Returns the same value of fscanf(). */int VFSCANF(register FILE *fp, const char *fmt, va_list ap){ struct _reent *reent = _REENT; CHECK_INIT(reent, fp); return __SVFSCANF_R (reent, fp, fmt, ap);}
开发者ID:rurtle,项目名称:nanvix,代码行数:16,
示例9: gp_camera_file_get/** * Retrieves a file from the #Camera. * * @param camera a #Camera * @param folder a folder * @param file the name of a file * @param type the #CameraFileType * @param camera_file a #CameraFile * @param context a #GPContext * @return a gphoto2 error code * **/int gp_camera_file_get (Camera *camera, const char *folder, const char *file, CameraFileType type, CameraFile *camera_file, GPContext *context){ gp_log (GP_LOG_DEBUG, "gphoto2-camera", "Getting file '%s' in " "folder '%s'...", file, folder); CHECK_NULL (camera && folder && file && camera_file); CHECK_INIT (camera, context); CR (camera, gp_file_clean (camera_file), context); /* Did we get reasonable foldername/filename? */ if (strlen (folder) == 0) { CAMERA_UNUSED (camera, context); return (GP_ERROR_DIRECTORY_NOT_FOUND); } if (strlen (file) == 0) { CAMERA_UNUSED (camera, context); return (GP_ERROR_FILE_NOT_FOUND); } CHECK_RESULT_OPEN_CLOSE (camera, gp_filesystem_get_file (camera->fs, folder, file, type, camera_file, context), context); CAMERA_UNUSED (camera, context); return (GP_OK);}
开发者ID:JohnChu,项目名称:Snoopy,代码行数:41,
示例10: PrioQueueSetCompareint32_t PrioQueueSetCompare(PrioQueue *self, int32_t (*pFunc) (Item, Item)){ CHECK_INIT(self); BinHeap *pHeap = self->pData->pHeap_; int32_t iRtnCode = pHeap->set_compare(pHeap, pFunc); return iRtnCode;}
开发者ID:czchen,项目名称:C-Common-Data-Structures,代码行数:7,
示例11: CHECK_INIT// Minimizes (but does not destroy) the windowvoid Window::Minimize(){ CHECK_INIT(); if(!CloseWindow(hwnd())) throw WIN32EXCEPTION_1("CloseWindow");}
开发者ID:miherius,项目名称:DirChangesWatcher,代码行数:8,
示例12: PrioQueueSetDestroyint32_t PrioQueueSetDestroy(PrioQueue *self, void (*pFunc) (Item)){ CHECK_INIT(self); BinHeap *pHeap = self->pData->pHeap_; int32_t iRtnCode = pHeap->set_destroy(pHeap, pFunc); return iRtnCode;}
开发者ID:czchen,项目名称:C-Common-Data-Structures,代码行数:7,
示例13: gp_camera_file_get_info/** * Retrieves information about a file. * * @param camera a #Camera * @param folder a folder * @param file the name of the file * @param info * @param context a #GPContext * @return a gphoto2 error code * **/intgp_camera_file_get_info (Camera *camera, const char *folder, const char *file, CameraFileInfo *info, GPContext *context){ int result = GP_OK; const char *mime_type; const char *data; /* long int size; */ CameraFile *cfile; gp_log (GP_LOG_DEBUG, "gphoto2-camera", "Getting file info for '%s' " "in '%s'...", file, folder); CHECK_NULL (camera && folder && file && info); CHECK_INIT (camera, context); memset (info, 0, sizeof (CameraFileInfo)); /* Check first if the camera driver supports the filesystem */ CHECK_OPEN (camera, context); result = gp_filesystem_get_info (camera->fs, folder, file, info, context); CHECK_CLOSE (camera, context); if (result != GP_ERROR_NOT_SUPPORTED) { CAMERA_UNUSED (camera, context); return (result); } /* * The CameraFilesystem doesn't support file info. We simply get * the preview and the file and look for ourselves... */ /* It takes too long to get the file */ info->file.fields = GP_FILE_INFO_NONE; /* Get the preview */ info->preview.fields = GP_FILE_INFO_NONE; CRS (camera, gp_file_new (&cfile), context); if (gp_camera_file_get (camera, folder, file, GP_FILE_TYPE_PREVIEW, cfile, context) == GP_OK) { unsigned long size; info->preview.fields |= GP_FILE_INFO_SIZE | GP_FILE_INFO_TYPE; gp_file_get_data_and_size (cfile, &data, &size); info->preview.size = size; gp_file_get_mime_type (cfile, &mime_type); strncpy (info->preview.type, mime_type, sizeof (info->preview.type)); } gp_file_unref (cfile); /* We don't trust the camera libraries */ info->file.fields |= GP_FILE_INFO_NAME; strncpy (info->file.name, file, sizeof (info->file.name)); info->preview.fields &= ~GP_FILE_INFO_NAME; CAMERA_UNUSED (camera, context); return (GP_OK);}
开发者ID:JohnChu,项目名称:Snoopy,代码行数:71,
示例14: gp_port_usb_msg_interface_read/** * /brief Send a USB interface control message with input data * * /param port a GPPort * /param request control request code * /param value control value * /param index control index * /param bytes pointer to data * /param size size of the data * * Sends a specific USB control command and read associated data. * * /return a gphoto2 error code */intgp_port_usb_msg_interface_read (GPPort *port, int request, int value, int index, char *bytes, int size){ int retval; gp_log (GP_LOG_DEBUG, "gphoto2-port", "Reading message " "(request=0x%x value=0x%x index=0x%x size=%i=0x%x)...", request, value, index, size, size); CHECK_NULL (port); CHECK_INIT (port); CHECK_SUPP (port, "msg_read", port->pc->ops->msg_interface_read); retval = port->pc->ops->msg_interface_read (port, request, value, index, bytes, size); CHECK_RESULT (retval); if (retval != size) gp_log (GP_LOG_DEBUG, "gphoto2-port", "Could only read %i " "out of %i byte(s)", retval, size); gp_log_data ("gphoto2-port", bytes, retval); return (retval);}
开发者ID:Dvizhenka,项目名称:libgphoto2,代码行数:40,
示例15: _perror_rvoid_perror_r (struct _reent *ptr, const char *s){ char *error; int dummy; FILE *fp = _stderr_r (ptr); CHECK_INIT (ptr, fp); _newlib_flockfile_start(fp); _fflush_r (ptr, fp); if (s != NULL && *s != '/0') { WRITE_STR (s); WRITE_STR (": "); } if ((error = _strerror_r (ptr, ptr->_errno, 1, &dummy)) != NULL) WRITE_STR (error);#ifdef __SCLE WRITE_STR ((fp->_flags & __SCLE) ? "/r/n" : "/n");#else WRITE_STR ("/n");#endif fp->_flags &= ~__SOFF; _newlib_flockfile_end(fp);}
开发者ID:Alexpux,项目名称:Cygwin,代码行数:29,
示例16: PrioQueueSizeint32_t PrioQueueSize(PrioQueue *self){ CHECK_INIT(self); BinHeap *pHeap = self->pData->pHeap_; int32_t iSize = pHeap->size(pHeap); return iSize;}
开发者ID:czchen,项目名称:C-Common-Data-Structures,代码行数:7,
示例17: CHECK_INITvoid ImageWindow::unsetCaptionRect(){ CHECK_INIT(); _captionRectUsed = false; ZeroMemory(&_captionRect, sizeof(RECT));}
开发者ID:miherius,项目名称:DirChangesWatcher,代码行数:7,
示例18: PrioQueuePopint32_t PrioQueuePop(PrioQueue *self, bool bClean){ CHECK_INIT(self); BinHeap *pHeap = self->pData->pHeap_; int32_t iRtnCode = pHeap->pop(pHeap, bClean); return iRtnCode;}
开发者ID:czchen,项目名称:C-Common-Data-Structures,代码行数:7,
示例19: PrioQueuePushint32_t PrioQueuePush(PrioQueue *self, Item item){ CHECK_INIT(self); BinHeap *pHeap = self->pData->pHeap_; int32_t iRtnCode = pHeap->push(pHeap, item); return iRtnCode;}
开发者ID:czchen,项目名称:C-Common-Data-Structures,代码行数:7,
示例20: _zend_hash_index_update_or_next_insertZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC){ uint nIndex; Bucket *p;#ifdef ZEND_SIGNALS TSRMLS_FETCH();#endif IS_CONSISTENT(ht); CHECK_INIT(ht); if (flag & HASH_NEXT_INSERT) { h = ht->nNextFreeElement; } nIndex = h & ht->nTableMask; p = ht->arBuckets[nIndex]; while (p != NULL) { if ((p->nKeyLength == 0) && (p->h == h)) { if (flag & HASH_NEXT_INSERT || flag & HASH_ADD) { return FAILURE; } ZEND_ASSERT(p->pData != pData); HANDLE_BLOCK_INTERRUPTIONS(); if (ht->pDestructor) { ht->pDestructor(p->pData); } UPDATE_DATA(ht, p, pData, nDataSize); HANDLE_UNBLOCK_INTERRUPTIONS(); if (pDest) { *pDest = p->pData; } return SUCCESS; } p = p->pNext; } p = (Bucket *) pemalloc_rel(sizeof(Bucket), ht->persistent); p->arKey = NULL; p->nKeyLength = 0; /* Numeric indices are marked by making the nKeyLength == 0 */ p->h = h; INIT_DATA(ht, p, pData, nDataSize); if (pDest) { *pDest = p->pData; } CONNECT_TO_BUCKET_DLLIST(p, ht->arBuckets[nIndex]); HANDLE_BLOCK_INTERRUPTIONS(); ht->arBuckets[nIndex] = p; CONNECT_TO_GLOBAL_DLLIST(p, ht); HANDLE_UNBLOCK_INTERRUPTIONS(); if ((long)h >= (long)ht->nNextFreeElement) { ht->nNextFreeElement = h < LONG_MAX ? h + 1 : LONG_MAX; } ht->nNumOfElements++; ZEND_HASH_IF_FULL_DO_RESIZE(ht); return SUCCESS;}
开发者ID:kmiku7,项目名称:php-5.6.10-annotated,代码行数:59,
示例21: IS_CONSISTENTstatic zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_string *key, zval *pData, uint32_t flag ZEND_FILE_LINE_DC){ zend_ulong h; uint32_t nIndex; uint32_t idx; Bucket *p; IS_CONSISTENT(ht); if (UNEXPECTED(ht->nTableMask == 0)) { CHECK_INIT(ht, 0); goto add_to_hash; } else if (ht->u.flags & HASH_FLAG_PACKED) { zend_hash_packed_to_hash(ht); } else if ((flag & HASH_ADD_NEW) == 0) { p = zend_hash_find_bucket(ht, key); if (p) { zval *data; if (flag & HASH_ADD) { return NULL; } ZEND_ASSERT(&p->val != pData); data = &p->val; if ((flag & HASH_UPDATE_INDIRECT) && Z_TYPE_P(data) == IS_INDIRECT) { data = Z_INDIRECT_P(data); } HANDLE_BLOCK_INTERRUPTIONS(); if (ht->pDestructor) { ht->pDestructor(data); } ZVAL_COPY_VALUE(data, pData); HANDLE_UNBLOCK_INTERRUPTIONS(); return data; } } ZEND_HASH_IF_FULL_DO_RESIZE(ht); /* If the Hash table is full, resize it */add_to_hash: HANDLE_BLOCK_INTERRUPTIONS(); idx = ht->nNumUsed++; ht->nNumOfElements++; if (ht->nInternalPointer == INVALID_IDX) { ht->nInternalPointer = idx; } p = ht->arData + idx; p->h = h = zend_string_hash_val(key); p->key = key; zend_string_addref(key); ZVAL_COPY_VALUE(&p->val, pData); nIndex = h & ht->nTableMask; Z_NEXT(p->val) = ht->arHash[nIndex]; ht->arHash[nIndex] = idx; HANDLE_UNBLOCK_INTERRUPTIONS(); return &p->val;}
开发者ID:AmesianX,项目名称:php-src,代码行数:59,
示例22: fputwcwint_tfputwc (wchar_t wc, FILE *fp){ struct _reent *reent = _REENT; CHECK_INIT(reent, fp); return _fputwc_r (reent, wc, fp);}
开发者ID:Alexpux,项目名称:Cygwin,代码行数:9,
示例23: gp_port_send_scsi_cmd/** * /brief Send a SCSI command to a port (for usb scsi ports) * * /param port a #GPPort * /param to_dev data direction, set to 1 for a scsi cmd which sends * data to the device, set to 0 for cmds which read data from the dev. * /param cmd buffer holding the command to send * /param cmd_size sizeof cmd buffer * /param sense buffer for returning scsi sense information * /param sense_size sizeof sense buffer * /param data buffer containing informatino to write to the device * (to_dev is 1), or to store data read from the device (to_dev 0). * * Send a SCSI command to a usb scsi port attached device. * * /return a gphoto2 error code **/int gp_port_send_scsi_cmd (GPPort *port, int to_dev, char *cmd, int cmd_size, char *sense, int sense_size, char *data, int data_size){ int retval; gp_log (GP_LOG_DEBUG, "gphoto2-port", "Sending scsi cmd:"); gp_log_data ("gphoto2-port", cmd, cmd_size); if (to_dev && data_size) { gp_log (GP_LOG_DEBUG, "gphoto2-port", "scsi cmd data:"); gp_log_data ("gphoto2-port", data, data_size); } CHECK_NULL (port); CHECK_INIT (port); memset (sense, 0, sense_size); CHECK_SUPP (port, "send_scsi_cmd", port->pc->ops->send_scsi_cmd); retval = port->pc->ops->send_scsi_cmd (port, to_dev, cmd, cmd_size, sense, sense_size, data, data_size); gp_log (GP_LOG_DEBUG, "gphoto2-port", "scsi cmd result: %d", retval); if (sense[0] != 0) { gp_log (GP_LOG_DEBUG, "gphoto2-port", "sense data:"); gp_log_data ("gphoto2-port", sense, sense_size); /* https://secure.wikimedia.org/wikipedia/en/wiki/Key_Code_Qualifier */ gp_log(GP_LOG_DEBUG, "gphoto2-port","sense decided:"); if ((sense[0]&0x7f)!=0x70) { gp_log(GP_LOG_DEBUG, "gphoto2-port","/tInvalid header."); } gp_log(GP_LOG_DEBUG, "gphoto2-port", "/tCurrent command read filemark: %s",(sense[2]&0x80)?"yes":"no"); gp_log(GP_LOG_DEBUG, "gphoto2-port", "/tEarly warning passed: %s",(sense[2]&0x40)?"yes":"no"); gp_log(GP_LOG_DEBUG, "gphoto2-port", "/tIncorrect blocklengt: %s",(sense[2]&0x20)?"yes":"no"); gp_log(GP_LOG_DEBUG, "gphoto2-port", "/tSense Key: %d",sense[2]&0xf); if (sense[0]&0x80) gp_log(GP_LOG_DEBUG, "gphoto2-port", "/tResidual Length: %d",sense[3]*0x1000000+sense[4]*0x10000+sense[5]*0x100+sense[6]); gp_log(GP_LOG_DEBUG, "gphoto2-port", "/tAdditional Sense Length: %d",sense[7]); gp_log(GP_LOG_DEBUG, "gphoto2-port", "/tAdditional Sense Code: %d",sense[12]); gp_log(GP_LOG_DEBUG, "gphoto2-port", "/tAdditional Sense Code Qualifier: %d",sense[13]); if (sense[15]&0x80) { gp_log(GP_LOG_DEBUG, "gphoto2-port", "/tIllegal Param is in %s",(sense[15]&0x40)?"the CDB":"the Data Out Phase"); if (sense[15]&0x8) { gp_log(GP_LOG_DEBUG, "gphoto2-port", "Pointer at %d, bit %d",sense[16]*256+sense[17],sense[15]&0x7); } } } if (!to_dev && data_size) { gp_log (GP_LOG_DEBUG, "gphoto2-port", "scsi cmd data:"); gp_log_data ("gphoto2-port", data, data_size); } return retval;}
开发者ID:Dvizhenka,项目名称:libgphoto2,代码行数:73,
示例24: ferrorintferror (FILE * fp){ int result; CHECK_INIT(_REENT, fp); _newlib_flockfile_start (fp); result = __sferror (fp); _newlib_flockfile_end (fp); return result;}
开发者ID:Alexpux,项目名称:Cygwin,代码行数:10,
注:本文中的CHECK_INIT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CHECK_LE函数代码示例 C++ CHECK_ID函数代码示例 |