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

C++ ON_ERROR函数代码示例

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

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



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

示例1: c2w

static int c2w( int c_count, 
                const char* c, 
                int w_count, 
                wchar_t* w // array of at least w_count+1 wide characters
                )
{
  // convert UTF-8 string to UTF-16 string
  int rc = 0;
  if ( w ) 
    w[0] = 0;
  // returns length of converted c[]
  if ( w_count > 0 && w && c_count > 0 && c && c[0] ) {
    w[0] = 0;
    if ( c ) 
    {
      unsigned int error_status = 0;
      unsigned int error_mask = 0xFFFFFFFF;
      ON__UINT32 error_code_point = 0xFFFD;
      const char* p1 = 0;
      rc = ON_ConvertUTF8ToWideChar(c,c_count,w,w_count,&error_status,error_mask,error_code_point,&p1);
      if ( rc > 0 && rc <= w_count )
        w[rc] = 0;
      else {
        w[w_count] = 0;
        rc = 0;
      }
      if ( 0 != error_status )
      {
        ON_ERROR("Error converting UTF-8 encoded char string to UTF-16 encoded wchar_t string.");
      }
    }
  }
	return rc;
}
开发者ID:ckvk,项目名称:opennurbs,代码行数:34,代码来源:opennurbs_wstring.cpp


示例2: ON_GetKnotVectorSpanVector

bool ON_GetKnotVectorSpanVector(
          int order,          // order (>=2)
          int cv_count,       // cv count
          const double* knot, // knot[] array
          double* s           // s[] array
          )
{
  if ( 0 == knot || 0 == s )
  {
    if ( 0 != order || 0 != cv_count )
    {
      ON_ERROR("NULL knot[] or s[] passed to ON_KnotVectorSpanCount.");
      return false;
    }
    return true;
  }

  int i, span_count = 0;
  s[span_count++] = knot[order-2];
  for ( i = order-1; i < cv_count; i++ ) {
    if ( knot[i] > knot[i-1] )
      s[span_count++] = knot[i];
  }
  return (span_count>1) ? true : false;
}
开发者ID:Bastl34,项目名称:PCL,代码行数:25,代码来源:opennurbs_knot.cpp


示例3: Header

void ON_wString::Empty()
{
  ON_wStringHeader* p = Header();
  if ( p != pEmptyStringHeader ) {
    if ( p->ref_count > 1 ) {
      // string memory is shared
      p->ref_count--;
	    Create();
    }
    else if ( p->ref_count == 1 ) {
      // string memory is not shared - reuse it
      if (m_s && p->string_capacity>0)
        *m_s = 0;
      p->string_length = 0;
    }
    else {
      // should not happen
      ON_ERROR("ON_wString::Empty() encountered invalid header - fixed.");
      Create();
    }
  }
  else {
    // initialized again
	  Create();
  }
}
开发者ID:ckvk,项目名称:opennurbs,代码行数:26,代码来源:opennurbs_wstring.cpp


示例4: ON_ERROR

bool ON_BezierCage::IsSingular(		 // true if surface side is collapsed to a point
       int side														 // side of parameter space to test
																			// 0 = south, 1 = east, 2 = north, 3 = west, 4 = bottom, 5 =top
				) const
{
  ON_ERROR("TODO: fill in ON_BezierCage::IsSingular\n");
  return false;
  /*
  int i,j,k=0;
  ON_3dPoint p[2];
  double fuzz[2] = {0.0,0.0};
  p[0].Zero();
  p[1].Zero();
  int i0 = 0;
  int i1 = 0;
  int j0 = 0;
  int j1 = 0;
  switch ( side ) {
  case 0: // south
      i0 = 0;
      i1 = Order(0);
      j0 = 0;
      j1 = 1;
    break;
  case 1: // east
      i0 = Order(0)-1;
      i1 = Order(0);
      j0 = 0;
      j1 = Order(1);
    break;
  case 2: // north
      i0 = 0;
      i1 = Order(0);
      j0 = Order(1)-1;
      j1 = Order(1);
    break;
  case 3: // west
      i0 = 0;
      i1 = 1;
      j0 = 0;
      j1 = Order(1);
    break;
  default:
    return false;
    break;
  }

  GetCV(i0,j0,p[k]);
  fuzz[k] = p[k].Fuzz();
  for ( i = i0; i < i1; i++ ) for ( j = j0; j < j1; j++ ) {
    k = (k+1)%2;
    GetCV( i, j, p[k] );
    fuzz[k] = p[k].Fuzz();
    if ( (p[0]-p[1]).MaximumCoordinate() > fuzz[0]+fuzz[1] )
      return false;
  }
  return true;
  */
}
开发者ID:Bastl34,项目名称:PCL,代码行数:59,代码来源:opennurbs_beziervolume.cpp


示例5: ON_ERROR

bool ON_BezierCage::IsSingular(		 // true if surface side is collapsed to a point
       int side														 // side of parameter space to test
																			// 0 = south, 1 = east, 2 = north, 3 = west, 4 = bottom, 5 =top
				) const
{
  ON_ERROR("TODO: fill in ON_BezierCage::IsSingular\n");
  return false;
}
开发者ID:raazui,项目名称:3D-Surface-Reconstruction,代码行数:8,代码来源:opennurbs_beziervolume.cpp


示例6: daemon_init

static void daemon_init(void)
{
   fd = open("./ettercap_demonized.log", O_CREAT|O_TRUNC|O_WRONLY, 0600);
   ON_ERROR(fd, -1, "Can't open daemon log file");
   
   /* daemonize ettercap */
   daemonize();
}
开发者ID:ftbe,项目名称:ettercap,代码行数:8,代码来源:ec_daemon.c


示例7: ON_ERROR

bool ON_SubDArchiveIdMap::AddComponentPtr(ON_SubDComponentPtr eptr, unsigned int archive_id)
{
  if (m_element_count != archive_id)
  {
    ON_ERROR("Archive id is not valid and ON_SubD::Read will fail.");
    return false;
  }
  ON_SubDComponentPtr* p = (ON_SubDComponentPtr*)m_fsp.AllocateElement();
  *p = eptr;

#if defined(ON_DEBUG)
  if (0 != archive_id)
  {
    const ON_SubDComponentPtr* p1 = (const ON_SubDComponentPtr*)m_fsp.Element(archive_id);
    unsigned int archive_id1 = 0;
    if (p1 == p)
    {
      switch (p1->ComponentType())
      {
      case ON_SubDComponentPtr::Type::Vertex:
        archive_id1 = p1->Vertex()->ArchiveId();
        break;
      case ON_SubDComponentPtr::Type::Edge:
        archive_id1 = p1->Edge()->ArchiveId();
        break;
      case ON_SubDComponentPtr::Type::Face:
        archive_id1 = p1->Face()->ArchiveId();
        break;
      default:
        ON_ERROR("invalid element type");
        break;
      }
    }
    if (archive_id1 != archive_id)
    {
      // break here and then see what went wrong
      ON_SubDIncrementErrorCount();
      m_fsp.Element(archive_id);
      m_fsp.Element(archive_id);
    }
  }
#endif

  m_element_count++;
  return true;
}
开发者ID:jiapei100,项目名称:opennurbs,代码行数:46,代码来源:opennurbs_subd_copy.cpp


示例8: check_malloc

//
// Object creation
//
void* check_malloc(size_t size)
{
	void* result = malloc(size);
	if(result == NULL)
		ON_ERROR(-1);

	return result;
}
开发者ID:michay,项目名称:ard_chat,代码行数:11,代码来源:utils.c


示例9: ON_UuidToString

char* ON_UuidToString( const ON_UUID& uuid, char* s)
{
  // s - [out]  The s[] char array must have length >= 37.  
  //            The returned char array will have a 36 
  //            character uuid in s[0..35] and a null in s[36].

  // NOTE WELL: 
  //   This code has to work on non-Windows OSs and on both big and
  //   little endian CPUs.  The result must satisfy
  //   uuid == ON_UuidFromString(ON_UuidToString(uuid,s))

  // 31 August 2005 Dale Lear
  //     Changed upper case to lower case so result is
  //     identical to the string returned by Windows' ::UuidToString().
  //static const char x[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
  static const char x[16] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
  static const int addhyphen[16] = {0,0,0,1, 0,1, 0,1, 0,1,  0, 0, 0, 0, 0, 0};
  const unsigned char* b = (const unsigned char*)&uuid;
  char* p;
  int i;
  
  static const int* rho = ( ON::big_endian == ON::Endian() ) 
                        ? big_endian_rho 
                        : little_endian_rho;

  // 5 December 2002 Dale Lear:
  //   There is either a bug in Purify (likely) or perhaps a bug in the 
  //   way Microsoft compiles  c>>4 when c is an unsigned char.  In any
  //   case, changing c to an unsigned int makes purify happy and should
  //   work just as well.
  //
  //unsigned char c;

  unsigned int c;

  if ( !s )
    return 0;
  p = s;
  for ( i = 0; i < 16; i++ ) {
    c = b[rho[i]];
    *p++ = x[c>>4];  // purify gripes here if c is an unsigned char - the code runs fine.
    *p++ = x[c&0x0F];
    if ( addhyphen[i] )
      *p++ = '-';
  }
  *p = 0;

#if defined(ON_DEBUG)
  {
    ON_UUID u = ON_UuidFromString(s);
    if ( ON_UuidCompare(&u,&uuid) ) {
      ON_ERROR("ON_UuidToString() bug"); // <- breakpoint here
    }
  }
#endif

  return s;
}
开发者ID:ckvk,项目名称:opennurbs,代码行数:58,代码来源:opennurbs_uuid.cpp


示例10: Style

ON_BOOL32 ON_Light::IsValid( ON_TextLog* text_log ) const
{
  int s = Style();
  if ( s <= ON::unknown_light_style || s >= ON::light_style_count ) {
    ON_ERROR("ON_Light::IsValid(): illegal light style.");
    return false;
  }
  return true;
}
开发者ID:ckvk,项目名称:opennurbs,代码行数:9,代码来源:opennurbs_light.cpp


示例11: log_write_packet

void log_write_packet(struct log_fd *fd, struct packet_object *po)
{
   struct log_header_packet hp;
   int c, zerr;

   memset(&hp, 0, sizeof(struct log_header_packet));
   
   /* adjust the timestamp */
   memcpy(&hp.tv, &po->ts, sizeof(struct timeval));
   hp.tv.tv_sec = htonl(hp.tv.tv_sec);
   hp.tv.tv_usec = htonl(hp.tv.tv_usec);
  
   memcpy(&hp.L2_src, &po->L2.src, MEDIA_ADDR_LEN);
   memcpy(&hp.L2_dst, &po->L2.dst, MEDIA_ADDR_LEN);
   
   memcpy(&hp.L3_src, &po->L3.src, sizeof(struct ip_addr));
   memcpy(&hp.L3_dst, &po->L3.dst, sizeof(struct ip_addr));
  
   hp.L4_flags = po->L4.flags;
   hp.L4_proto = po->L4.proto;
   hp.L4_src = po->L4.src;
   hp.L4_dst = po->L4.dst;
 
   /* the length of the payload */
   hp.len = htonl(po->DATA.disp_len);

   LOG_LOCK;
   
   if (fd->type == LOG_COMPRESSED) {
      c = gzwrite(fd->cfd, &hp, sizeof(hp));
      ON_ERROR(c, -1, "%s", gzerror(fd->cfd, &zerr));

      c = gzwrite(fd->cfd, po->DATA.disp_data, po->DATA.disp_len);
      ON_ERROR(c, -1, "%s", gzerror(fd->cfd, &zerr));
   } else {
      c = write(fd->fd, &hp, sizeof(hp));
      ON_ERROR(c, -1, "Can't write to logfile");

      c = write(fd->fd, po->DATA.disp_data, po->DATA.disp_len);
      ON_ERROR(c, -1, "Can't write to logfile");
   }
   
   LOG_UNLOCK;
}
开发者ID:Ettercap,项目名称:ettercap,代码行数:44,代码来源:ec_log.c


示例12: ON_SUBD_RETURN_ERROR

bool ON_SubDArchiveIdMap::ConvertArchiveIdToRuntimeVertexPtr(
  unsigned int vertex_count,
  size_t vertex_capacity,
  ON_SubDVertex** vertex
  )
{
  if ( 0 == vertex_count )
    return true;
  if ( 0 == vertex_capacity || nullptr == vertex )
    return ON_SUBD_RETURN_ERROR(false);
  if ( vertex_count > vertex_capacity )
    return ON_SUBD_RETURN_ERROR(false);
  for (unsigned int i = 0; i < vertex_count; i++)
  {
    ON__UINT_PTR vptr = (ON__UINT_PTR)(vertex[i]);
    vertex[i] = nullptr;
    const unsigned int archive_id = ON_SubDArchiveIdMap::ArchiveIdFromComponentPtr(vptr);
    // future use // ON__UINT_PTR flags = ON_SUBD_ELEMENT_FLAGS(vptr);
    if (0 == archive_id || archive_id < m_archive_id_partition[0] || archive_id >= m_archive_id_partition[1])
    {
      ON_ERROR("Invalid vertex archive id.");
      continue;
    }
    const ON_SubDComponentPtr* eleptr = ComponentPtrFromArchiveId(archive_id);
    if (nullptr == eleptr)
    {
      ON_ERROR("null element pointer.");
      continue;
    }
    ON_SubDVertex* v = eleptr->Vertex();
    if (nullptr == v)
    {
      ON_ERROR("null vertex pointer.");
      continue;
    }
    if (archive_id != v->ArchiveId())
    {
      ON_ERROR("archive_id != v->ArchiveId().");
      continue;
    }
    vertex[i] = v;
  }
  return true;
}
开发者ID:jiapei100,项目名称:opennurbs,代码行数:44,代码来源:opennurbs_subd_copy.cpp


示例13: write_output

int write_output(void)
{
   int fd;
   struct filter_op *fop;
   struct filter_header fh;
   size_t ninst, i, data_len;
   u_char pad = 0, *data = NULL;

   /* conver the tree to an array of filter_op */
   ninst = compile_tree(&fop);

   if (fop == NULL)
      return -E_NOTHANDLED;

   if (ninst == 0)
      return -E_INVALID;

   /* create the file */
   fd = open(GBL_OPTIONS->output_file, O_CREAT | O_RDWR | O_TRUNC | O_BINARY, 0644);
   ON_ERROR(fd, -1, "Can't create file %s", GBL_OPTIONS->output_file);

   /* display the message */
   fprintf(stdout, " Writing output to \'%s\' ", GBL_OPTIONS->output_file);
   fflush(stdout);
   
   /* compute the header */
   fh.magic = htons(EC_FILTER_MAGIC);
   strncpy(fh.version, EC_VERSION, sizeof(fh.version));
   fh.data = sizeof(fh);

   data_len = create_data_segment(&data, &fh, fop, ninst);
   
   /* write the header */
   write(fd, &fh, sizeof(struct filter_header));

   /* write the data segment */
   write(fd, data, data_len);
   
   /* write padding to next 8-byte boundary */
   for (i = 0; i < fh.code - (fh.data + data_len); i++)
      write(fd, &pad, 1);

   /* write the instructions */
   for (i = 0; i < ninst; i++) {
      print_progress_bar(&fop[i]);
      write(fd, &fop[i], sizeof(struct filter_op));
   }

   close(fd);
   
   fprintf(stdout, " done.\n\n");
  
   fprintf(stdout, " -> Script encoded into %d instructions.\n\n", (int)(i - 1));
   
   return E_SUCCESS;
}
开发者ID:barak,项目名称:ettercap,代码行数:56,代码来源:ef_output.c


示例14: open_log

void open_log(char *file)
{
   int zerr;
   
   GBL_LOGFILE = strdup(file);

   GBL_LOG_FD = gzopen(file, "rb");
   ON_ERROR(GBL_LOG_FD, NULL, "%s", gzerror(GBL_LOG_FD, &zerr));
 
}
开发者ID:LocutusOfBorg,项目名称:Ettercap-NG,代码行数:10,代码来源:el_log.c


示例15: ON_ERROR

unsigned int ON_3dmObjectAttributes::ApplyParentalControl( 
        const ON_3dmObjectAttributes& parents_attributes,
        unsigned int control_limits
        )
{
  ON_ERROR("Do not use deprecated version of ON_3dmObjectAttributes::ApplyParentalControl()");
  ON_Layer bogus_layer;
  bogus_layer.m_layer_index = -1;
  return ApplyParentalControl(parents_attributes,bogus_layer,control_limits);
}
开发者ID:Bastl34,项目名称:PCL,代码行数:10,代码来源:opennurbs_3dm_attributes.cpp


示例16: ON_FLT_SNAN

void ON_FLT_SNAN( float* x)
{
  union 
  {
    float x;
    unsigned char b[4];
  } u;

#if   defined(ON_LITTLE_ENDIAN)
#define i3 3
#define i2 2
#elif defined(ON_BIG_ENDIAN)
#define i3 0
#define i2 1
#else
  unsigned int i3, i2;

  u.x = 2.0f; // sign = 0; mantissa = 0; exponent = 1000 0000

  if ( 0x40 == u.b[3] && 0 == u.b[0] && 0 == u.b[1] && 0 == u.b[2] )
  {
    // little endian doubles
    i3 = 3; i2 = 2;
  }
  else if ( 0x40 == u.b[0] && 0 == u.b[3] && 0 == u.b[1] && 0 == u.b[2] )
  {
    // big endian doubles
    i3 = 0; i2 = 1;
  }
  else
  {
    // this sitation is not handled by this algorithm
    // and that is a bug in the algorithm.
    ON_ERROR("CPU has unexpected bit pattern in float 2.0f.");
    memset(&x,0xFF,sizeof(*x));
    return;
  }
#endif

  // all exponent bits = 1
  // fraction bits = 011...1
  u.b[i3]   = 0x7F; // 0111 1111
  u.b[i2]   = 0xA0; // 1010 0000
  u.b[3-i2] = 0;    // 0...
  u.b[3-i3] = 0;

#if defined(i3)
#undef i3
#undef i2
#endif

  // must use memcpy().  On Intel FPU, assignment using x = u.x 
  // will set x to qnan and invalid op exception occures.
  memcpy(x,&u.x,sizeof(*x));
}
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:55,代码来源:opennurbs_object.cpp


示例17: switch

bool ON_BinaryArchive::ReadCompressedBuffer( // read and uncompress
  size_t sizeof__outbuffer,  // sizeof of uncompressed buffer to read
  void* outbuffer,           // uncompressed output data returned here
  int* bFailedCRC
  )
{
  bool rc = false;
  unsigned int buffer_crc0 = 0;
  unsigned int buffer_crc1 = 0;
  char method = 0;

  if ( bFailedCRC)
    *bFailedCRC = false;
  if ( !ReadMode() )
    return false;
  if ( 0 == sizeof__outbuffer )
    return true;
  if ( 0 == outbuffer )
    return false;

  if ( !ReadInt(&buffer_crc0) ) // 32 bit crc of uncompressed buffer
    return false;

  if ( !ReadChar(&method) )
    return false;

  if ( method != 0 && method != 1 )
    return false;

  switch(method)
  {
  case 0: // uncompressed
    rc = ReadByte(sizeof__outbuffer, outbuffer);
    break;
  case 1: // compressed
    rc = CompressionInit();
    if (rc)
      rc = ReadInflate( sizeof__outbuffer, outbuffer );
    CompressionEnd();
    break;
  }

  if (rc ) 
  {
    buffer_crc1 = ON_CRC32( 0, sizeof__outbuffer, outbuffer );
    if ( buffer_crc1 != buffer_crc0 ) 
    {
      ON_ERROR("ON_BinaryArchive::ReadCompressedBuffer() crc error");
      if ( bFailedCRC )
        *bFailedCRC = true;
    }
  }

  return rc;
}
开发者ID:Bardo91,项目名称:pcl,代码行数:55,代码来源:opennurbs_zlib.cpp


示例18: log_write_info_arp_icmp

void log_write_info_arp_icmp(struct log_fd *fd, struct packet_object *po)
{
   struct log_header_info hi;
   int c, zerr;

   memset(&hi, 0, sizeof(struct log_header_info));

   /* the mac address */
   memcpy(&hi.L2_addr, &po->L2.src, MEDIA_ADDR_LEN);
   
   /* the ip address */
   memcpy(&hi.L3_addr, &po->L3.src, sizeof(struct ip_addr));
  
   /* set the distance */
   if (po->L3.ttl > 1)
      hi.distance = TTL_PREDICTOR(po->L3.ttl) - po->L3.ttl + 1;
   else
      hi.distance = po->L3.ttl;
   
   /* resolve the host */
   host_iptoa(&po->L3.src, hi.hostname);
   
   /* local, non local ecc ecc */
   if (po->L3.proto == htons(LL_TYPE_ARP)) {
      hi.type |= LOG_ARP_HOST;
      hi.type |= FP_HOST_LOCAL;
   } else {
      hi.type = po->PASSIVE.flags;
   }
   
   LOG_LOCK;
   
   if (fd->type == LOG_COMPRESSED) {
      c = gzwrite(fd->cfd, &hi, sizeof(hi));
      ON_ERROR(c, -1, "%s", gzerror(fd->cfd, &zerr));
   } else {
      c = write(fd->fd, &hi, sizeof(hi));
      ON_ERROR(c, -1, "Can't write to logfile");
   }

   LOG_UNLOCK;
}
开发者ID:Ettercap,项目名称:ettercap,代码行数:42,代码来源:ec_log.c


示例19: ON_ERROR

ON_InstanceDefinition::IDEF_UPDATE_TYPE ON_InstanceDefinition::IdefUpdateType() const
{
  if ( ON_InstanceDefinition::embedded_def == m_idef_update_type )
  {
    ON_ERROR("Using obsolete ON_InstanceDefinition::embedded_def value - fix code.");
    const_cast< ON_InstanceDefinition* >(this)->m_idef_update_type 
                                  = ( m_source_archive.Length() > 0 )
                                  ? ON_InstanceDefinition::linked_and_embedded_def
                                  : ON_InstanceDefinition::static_def;
  }
  return m_idef_update_type;
}
开发者ID:2php,项目名称:pcl,代码行数:12,代码来源:opennurbs_instance.cpp


示例20: ON_SetBinaryArchiveOpenNURBSVersion

void ON_SetBinaryArchiveOpenNURBSVersion(ON_BinaryArchive& file, int value)
{
    if ( value >= 200012210 )
    {
        file.m_3dm_opennurbs_version = value;
    }
    else
    {
        ON_ERROR("ON_SetBinaryArchiveOpenNURBSVersion - invalid opennurbs version");
        file.m_3dm_opennurbs_version = 0;
    }
}
开发者ID:raazui,项目名称:3D-Surface-Reconstruction,代码行数:12,代码来源:opennurbs_3dm_properties.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ OOFEM_LOG_INFO函数代码示例发布时间:2022-05-30
下一篇:
C++ ON_BLOCK_EXIT函数代码示例发布时间: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