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

C++ RAPTOR_FREE函数代码示例

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

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



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

示例1: raptor_rss_common_terminate

void
raptor_rss_common_terminate(raptor_world* world) {
  int i;
  if(--world->rss_common_initialised)
    return;

  if(world->rss_types_info_uris) {
    for(i = 0; i< RAPTOR_RSS_COMMON_SIZE; i++) {
      if(world->rss_types_info_uris[i])
        raptor_free_uri(world->rss_types_info_uris[i]);
    }
    RAPTOR_FREE(raptor_uri* array, world->rss_types_info_uris);
    world->rss_types_info_uris = NULL;
  }

  if(world->rss_fields_info_uris) {
    for(i = 0; i< RAPTOR_RSS_FIELDS_SIZE; i++) {
      if(world->rss_fields_info_uris[i])
        raptor_free_uri(world->rss_fields_info_uris[i]);
    }
    RAPTOR_FREE(raptor_uri* array, world->rss_fields_info_uris);
    world->rss_fields_info_uris = NULL;
  }

  if(world->rss_namespaces_info_uris) {
    for(i = 0; i < RAPTOR_RSS_NAMESPACES_SIZE;i++) {
      if(world->rss_namespaces_info_uris[i])
        raptor_free_uri(world->rss_namespaces_info_uris[i]);
    }
    RAPTOR_FREE(raptor_uri* array, world->rss_namespaces_info_uris);
    world->rss_namespaces_info_uris = NULL;
  }
}
开发者ID:Anchakor,项目名称:raptor,代码行数:33,代码来源:raptor_rss_common.c


示例2: raptor_new_uri_for_retrieval

/**
 * raptor_new_uri_for_retrieval - Turn a URI into one suitable for retrieval
 * @old_uri: URI to transform
 * 
 * Takes an existing URI and ensures it has a path (default /) and has
 * no fragment - URI retrieval does not use the fragment part.
 * 
 * Return value: new URI object or NULL on failure.
 **/
raptor_uri*
raptor_new_uri_for_retrieval(raptor_uri* old_uri)
{
  unsigned char *uri_string=raptor_uri_as_string(old_uri);
  unsigned char *buffer;
  size_t buffer_len=strlen((const char*)uri_string)+1;
  unsigned char *scheme;
  unsigned char *authority;
  unsigned char *path;
  unsigned char *query;
  unsigned char *fragment;
  unsigned char *new_uri_string;
  raptor_uri* new_uri;

  buffer=(unsigned char*)RAPTOR_MALLOC(cstring, buffer_len);
  if(!buffer)
    return NULL;
  
  raptor_uri_parse (uri_string, buffer, buffer_len,
                    &scheme, &authority, &path, &query, &fragment);

  if(!path)
    path=(unsigned char*)"/";
  
  new_uri_string=raptor_uri_construct(scheme, authority, path, query, NULL);
  RAPTOR_FREE(cstring, buffer);
  if(!new_uri_string)
    return NULL;
  
  new_uri=raptor_new_uri(new_uri_string);
  RAPTOR_FREE(cstring, new_uri_string);

  return new_uri;
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:43,代码来源:raptor_uri.c


示例3: assert_uri_to_filename

static int
assert_uri_to_filename (const char *uri, const char *reference_filename)
{
  char *filename;

  filename=raptor_uri_uri_string_to_filename((const unsigned char*)uri);

  if(filename && !reference_filename) {
    fprintf(stderr, 
            "%s: raptor_uri_uri_string_to_filename(%s) FAILED giving filename %s != NULL\n", 
            program, uri, filename);
    if(filename)
      RAPTOR_FREE(cstring, filename);
    return 1;
  } else if (filename && strcmp(filename, reference_filename)) {
    fprintf(stderr,
            "%s: raptor_uri_uri_string_to_filename(%s) FAILED gaving filename %s != %s\n",
            program, uri, filename, reference_filename);
    if(filename)
      RAPTOR_FREE(cstring, filename);
    return 1;
  }

  RAPTOR_FREE(cstring, filename);
  return 0;
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:26,代码来源:raptor_uri.c


示例4: assert_uri_to_relative

static int
assert_uri_to_relative(const char *base, const char *uri, const char *relative)
{
  unsigned char *output;
  int result;
  raptor_uri* base_uri=NULL;
  raptor_uri* reference_uri=raptor_new_uri((const unsigned char*)uri);
  size_t length=0;

  if(base)
    base_uri=raptor_new_uri((const unsigned char*)base);
  
  output=raptor_uri_to_relative_counted_uri_string(base_uri, reference_uri, 
                                                   &length);
  result=strcmp(relative, (const char*)output);
  if (result) {
    fprintf(stderr,
            "%s: raptor_uri_string_to_relative_uri_string FAILED: base='%s', uri='%s', expected='%s', got='%s'\n",
            program, base, uri, relative, output);
    RAPTOR_FREE(cstring, output);
    return 1;
  }
  RAPTOR_FREE(cstring, output);
  raptor_free_uri(base_uri);
  raptor_free_uri(reference_uri);
  return 0;
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:27,代码来源:raptor_uri.c


示例5: raptor_print_subject

void
raptor_print_subject(raptor_abbrev_subject* subject) 
{
  int i;
  unsigned char *subj;
  unsigned char *pred;
  unsigned char *obj;
  raptor_avltree_iterator* iter=NULL;

  /* Note: The raptor_abbrev_node field passed as the first argument for
   * raptor_statement_part_as_string() is somewhat arbitrary, since as
   * the data structure is designed, the first word in the value union
   * is what was passed as the subject/predicate/object of the
   * statement.
   */
  subj = raptor_statement_part_as_string(subject->node->value.resource.uri,
                                         subject->node->type, NULL, NULL);

  if(subject->type) {
      obj=raptor_statement_part_as_string(subject->type->value.resource.uri,
                                          subject->type->type,
                                          subject->type->value.literal.datatype,
                                          subject->type->value.literal.language);
      fprintf(stderr,"[%s, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, %s]\n", subj, obj);      
      RAPTOR_FREE(cstring, obj);
  }
  
  for(i=0; i < raptor_sequence_size(subject->elements); i++) {

    raptor_abbrev_node* o = raptor_sequence_get_at(subject->elements, i);
    if(o) {
      obj = raptor_statement_part_as_string(o->value.literal.string,
                                            o->type,
                                            o->value.literal.datatype,
                                            o->value.literal.language);
      fprintf(stderr,"[%s, [rdf:_%d], %s]\n", subj, i, obj);      
      RAPTOR_FREE(cstring, obj);
    }
    
  }


  iter=raptor_new_avltree_iterator(subject->properties, NULL, NULL, 1);
  while(iter) {
    raptor_abbrev_node** nodes;
    nodes=(raptor_abbrev_node**)raptor_avltree_iterator_get(iter);
    if(!nodes)
      break;
    raptor_print_abbrev_po(stderr, nodes);

    if(raptor_avltree_iterator_next(iter))
      break;
  }
  if(iter)
    raptor_free_avltree_iterator(iter);
  
  RAPTOR_FREE(cstring, subj);
  
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:59,代码来源:raptor_abbrev.c


示例6: raptor_rss_field_free

void
raptor_rss_field_free(raptor_rss_field* field)
{
    if(field->value)
        RAPTOR_FREE(cstring, field->value);
    if(field->uri)
        raptor_free_uri(field->uri);
    if(field->next)
        raptor_rss_field_free(field->next);
    RAPTOR_FREE(raptor_rss_field, field);
}
开发者ID:nevali,项目名称:raptor,代码行数:11,代码来源:raptor_rss_common.c


示例7: raptor_new_iostream_to_string

/**
 * raptor_new_iostream_to_string:
 * @string_p: pointer to location to hold string
 * @length_p: pointer to location to hold length of string (or NULL)
 * @malloc_handler: pointer to malloc to use to make string (or NULL)
 *
 * Constructor - create a new iostream writing to a string.
 *
 * If @malloc_handler is null, raptor will allocate it using it's
 * own memory allocator.  *@string_p is set to NULL on failure (and
 * *@length_p to 0 if @length_p is not NULL).
 * 
 * Return value: new #raptor_iostream object or NULL on failure
 **/
RAPTOR_EXTERN_C
raptor_iostream*
raptor_new_iostream_to_string(void **string_p, size_t *length_p,
                              void *(*malloc_handler)(size_t size))
{
  raptor_iostream* iostr;
  struct raptor_write_string_iostream_context* con;
  const raptor_iostream_handler2* handler2=&raptor_iostream_write_string_handler;
  const unsigned int mode=RAPTOR_IOSTREAM_MODE_WRITE;
  
  if(!raptor_iostream_check_handler(handler2, mode))
    return NULL;

  iostr=(raptor_iostream*)RAPTOR_CALLOC(raptor_iostream, 1,
                                        sizeof(raptor_iostream));
  if(!iostr)
    return NULL;

  con=(struct raptor_write_string_iostream_context*)RAPTOR_CALLOC(raptor_write_string_iostream_context, 1, sizeof(struct raptor_write_string_iostream_context));
  if(!con) {
    RAPTOR_FREE(raptor_iostream, iostr);
    return NULL;
  }

  con->sb=raptor_new_stringbuffer();
  if(!con->sb) {
    RAPTOR_FREE(raptor_iostream, iostr);
    RAPTOR_FREE(raptor_write_string_iostream_context, con);
    return NULL;
  }

  con->string_p=string_p;
  *string_p=NULL;

  con->length_p=length_p;  
  if(length_p)
    *length_p=0;

  if(malloc_handler)
    con->malloc_handler=malloc_handler;
  else
    con->malloc_handler=raptor_alloc_memory;
  
  iostr->handler=handler2;
  iostr->user_data=(void*)con;
  iostr->mode = mode;

  if(iostr->handler->init && iostr->handler->init(iostr->user_data)) {
    raptor_free_iostream(iostr);
    return NULL;
  }
  return iostr;
}
开发者ID:copasi,项目名称:copasi-dependencies,代码行数:67,代码来源:raptor_iostream.c


示例8: raptor_free_term

/**
 * raptor_free_term:
 * @term: #raptor_term object
 *
 * Destructor - destroy a raptor_term object.
 *
 **/
void
raptor_free_term(raptor_term *term)
{
  if(!term)
    return;
  
  if(--term->usage)
    return;
  
  switch(term->type) {
    case RAPTOR_TERM_TYPE_URI:
      if(term->value.uri) {
        raptor_free_uri(term->value.uri);
        term->value.uri = NULL;
      }
      break;

    case RAPTOR_TERM_TYPE_BLANK:
      if(term->value.blank.string) {
        RAPTOR_FREE(cstring, (void*)term->value.blank.string);
        term->value.blank.string = NULL;
      }
      break;
      
    case RAPTOR_TERM_TYPE_LITERAL:
      if(term->value.literal.string) {
        RAPTOR_FREE(cstring, (void*)term->value.literal.string);
        term->value.literal.string = NULL;
      }

      if(term->value.literal.datatype) {
        raptor_free_uri(term->value.literal.datatype);
        term->value.literal.datatype = NULL;
      }
      
      if(term->value.literal.language) {
        RAPTOR_FREE(cstring, (void*)term->value.literal.language);
        term->value.literal.language = NULL;
      }
      break;
      
    case RAPTOR_TERM_TYPE_UNKNOWN:
    default:
      break;
  }

  RAPTOR_FREE(term, (void*)term);
}
开发者ID:nevali,项目名称:raptor,代码行数:55,代码来源:raptor_term.c


示例9: raptor_free_iostream

/**
 * raptor_free_iostream:
 * @iostr: iostream object
 *
 * Destructor - destroy an iostream.
 **/
void
raptor_free_iostream(raptor_iostream *iostr)
{
  RAPTOR_ASSERT_OBJECT_POINTER_RETURN(iostr, raptor_iostream);
  
  if(iostr->flags & RAPTOR_IOSTREAM_FLAGS_EOF)
    raptor_iostream_write_end(iostr);

  if(iostr->handler->finish)
    iostr->handler->finish(iostr->user_data);

  if((iostr->flags & RAPTOR_IOSTREAM_FLAGS_FREE_HANDLER))
    RAPTOR_FREE(raptor_iostream_handler2, iostr->handler);

  RAPTOR_FREE(raptor_iostream, iostr);
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:22,代码来源:raptor_iostream.c


示例10: raptor_new_iostream_from_file_handle

/**
 * raptor_new_iostream_from_file_handle:
 * @handle: Input file_handle to open and read from
 *
 * Constructor - create a new iostream reading from a file_handle.
 * 
 * The @handle must already be open for reading.
 * NOTE: This does not fclose the @handle when it is finished.
 *
 * Return value: new #raptor_iostream object or NULL on failure
 **/
raptor_iostream*
raptor_new_iostream_from_file_handle(FILE *handle)
{
  raptor_iostream* iostr;
  const raptor_iostream_handler2* handler2=&raptor_iostream_read_file_handle_handler;
  const unsigned int mode=RAPTOR_IOSTREAM_MODE_READ;

  if(!handle)
    return NULL;
  
  if(!raptor_iostream_check_handler(handler2, mode))
    return NULL;

  iostr=(raptor_iostream*)RAPTOR_CALLOC(raptor_iostream, 1,
                                        sizeof(raptor_iostream));
  if(!iostr)
    return NULL;

  iostr->handler=handler2;
  iostr->user_data=(void*)handle;
  iostr->mode = mode;

  if(iostr->handler->init && 
     iostr->handler->init(iostr->user_data)) {
    RAPTOR_FREE(raptor_iostream, iostr);
    return NULL;
  }
  return iostr;
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:40,代码来源:raptor_iostream.c


示例11: raptor_new_iostream_from_handler

/**
 * raptor_new_iostream_from_handler:
 * @context: pointer to context information to pass in to calls
 * @handler: pointer to handler methods
 *
 * Create a new iostream over a user-defined handler.
 *
 * @deprecated: Use raptor_new_iostream_from_handler2() instead
 *
 * Return value: new #raptor_iostream object or NULL on failure
 **/
raptor_iostream*
raptor_new_iostream_from_handler(void *user_data,
                                 const raptor_iostream_handler *handler)
{
  raptor_iostream* iostr=NULL;
  raptor_iostream_handler2 *handler2;

  if(!handler)
    return NULL;

  handler2=(raptor_iostream_handler2*)RAPTOR_CALLOC(raptor_iostream_handler2, 1,
                                                   sizeof(raptor_iostream_handler2*));
  if(!handler2)
    return NULL;
  
  /* Copy V1 functions to V2 structure */
  handler2->init        = handler->init;
  handler2->finish      = handler->finish;
  handler2->write_byte  = handler->write_byte;
  handler2->write_bytes = handler->write_bytes;
  handler2->write_end   = handler->write_end;

  iostr=raptor_new_iostream_from_handler2(user_data, handler2);
  if(iostr) {
    /* Ensure newly alloced structure is freed on iostream destruction */
    iostr->flags |= RAPTOR_IOSTREAM_FLAGS_FREE_HANDLER;
  } else
    /* failure: so delete it now */
    RAPTOR_FREE(raptor_iostream_handler2, handler2);

  return iostr;
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:43,代码来源:raptor_iostream.c


示例12: raptor_libxml_validation_warning

void
raptor_libxml_validation_warning(void* user_data, const char *msg, ...) 
{
  va_list args;
  raptor_sax2* sax2 = (raptor_sax2*)user_data;
  int prefix_length = strlen(xml_validation_warning_prefix);
  int length;
  char *nmsg;
  size_t msg_len;
  
  va_start(args, msg);

  raptor_libxml_update_document_locator(sax2, sax2->locator);

  msg_len = strlen(msg);
  length = prefix_length + msg_len + 1;
  nmsg = (char*)RAPTOR_MALLOC(cstring, length);
  if(nmsg) {
    memcpy(nmsg, xml_validation_warning_prefix, prefix_length); /* Do not copy NUL */
    memcpy(nmsg + prefix_length, msg, msg_len + 1); /* Copy NUL */
    if(nmsg[length-2] == '\n')
      nmsg[length-2]='\0';
  }

  raptor_log_error_varargs(sax2->world,
                           RAPTOR_LOG_LEVEL_WARN,
                           sax2->locator, 
                           nmsg ? nmsg : msg, 
                           args);
  if(nmsg)
    RAPTOR_FREE(cstring,nmsg);
  va_end(args);
}
开发者ID:nevali,项目名称:raptor,代码行数:33,代码来源:raptor_libxml.c


示例13: raptor_www_curl_header_callback

static size_t 
raptor_www_curl_header_callback(void* ptr,  size_t  size, size_t nmemb,
                                void *userdata) 
{
  raptor_www* www=(raptor_www*)userdata;
  int bytes=size*nmemb;

  /* If WWW has been aborted, return nothing so that
   * libcurl will abort the transfer
   */
  if(www->failed)
    return 0;
  
  if(!strncmp((char*)ptr, "Content-Type: ", 14)) {
    int len=bytes-16;
    char *type_buffer=(char*)RAPTOR_MALLOC(cstring, len+1);
    strncpy(type_buffer, (char*)ptr+14, len);
    type_buffer[len]='\0';
    if(www->type)
      RAPTOR_FREE(cstring, www->type);
    www->type=type_buffer;
    www->free_type=1;

#if RAPTOR_DEBUG > 2
    RAPTOR_DEBUG3("Got content type '%s' (%d bytes)\n", type_buffer, len);
#endif
    if(www->content_type)
      www->content_type(www, www->content_type_userdata, www->type);
  }
  
  return bytes;
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:32,代码来源:raptor_www_curl.c


示例14: raptor_free_sax2

/**
 * raptor_free_sax2:
 * @sax2: SAX2 object
 *
 * Destructor - destroy a SAX2 object
 */
void
raptor_free_sax2(raptor_sax2 *sax2)
{
  raptor_xml_element *xml_element;

  if(!sax2)
    return;

#ifdef RAPTOR_XML_LIBXML
  if(sax2->xc) {
    raptor_libxml_free(sax2->xc);
    sax2->xc = NULL;
  }
#endif

  while( (xml_element = raptor_xml_element_pop(sax2)) )
    raptor_free_xml_element(xml_element);

  raptor_namespaces_clear(&sax2->namespaces);

  if(sax2->base_uri)
    raptor_free_uri(sax2->base_uri);

  raptor_object_options_clear(&sax2->options);
  
  RAPTOR_FREE(raptor_sax2, sax2);
}
开发者ID:JervenBolleman,项目名称:raptor,代码行数:33,代码来源:raptor_sax2.c


示例15: raptor_ntriples_parse_terminate

/*
 * raptor_ntriples_parse_terminate - Free the Raptor NTriples parser
 * @rdf_parser: parser object
 * 
 **/
static void
raptor_ntriples_parse_terminate(raptor_parser* rdf_parser)
{
  raptor_ntriples_parser_context *ntriples_parser=(raptor_ntriples_parser_context*)rdf_parser->context;
  if(ntriples_parser->line_length)
    RAPTOR_FREE(cdata, ntriples_parser->line);
}
开发者ID:copasi,项目名称:copasi-dependencies,代码行数:12,代码来源:ntriples_parse.c


示例16: raptor_libxml_validation_warning

void
raptor_libxml_validation_warning(void* user_data, const char *msg, ...) 
{
  va_list args;
  raptor_sax2* sax2=(raptor_sax2*)user_data;
  int prefix_length=strlen(xml_validation_warning_prefix);
  int length;
  char *nmsg;

  va_start(args, msg);

  raptor_libxml_update_document_locator(sax2, sax2->locator);

  length=prefix_length+strlen(msg)+1;
  nmsg=(char*)RAPTOR_MALLOC(cstring, length);
  if(nmsg) {
    strcpy(nmsg, xml_validation_warning_prefix);
    strcpy(nmsg+prefix_length, msg);
    if(nmsg[length-2]=='\n')
      nmsg[length-2]='\0';
  }

  raptor_log_error_varargs(RAPTOR_LOG_LEVEL_WARNING,
                           sax2->error_handlers->handlers[RAPTOR_LOG_LEVEL_WARNING].handler,
                           sax2->error_handlers->handlers[RAPTOR_LOG_LEVEL_WARNING].user_data,
                           sax2->locator, 
                           nmsg ? nmsg : msg, 
                           args);
  if(nmsg)
    RAPTOR_FREE(cstring,nmsg);
  va_end(args);
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:32,代码来源:raptor_libxml.c


示例17: raptor_libxml_generic_error

void
raptor_libxml_generic_error(void* user_data, const char *msg, ...) 
{
  raptor_error_handlers* error_handlers=(raptor_error_handlers*)user_data;
  va_list args;
  const char* prefix=xml_generic_error_prefix;
  int prefix_length=strlen(prefix);
  int length;
  char *nmsg;

  va_start(args, msg);

  /* no SAX2 and locator from error_handlers */

  length=prefix_length+strlen(msg)+1;
  nmsg=(char*)RAPTOR_MALLOC(cstring, length);
  if(nmsg) {
    strcpy(nmsg, prefix);
    strcpy(nmsg+prefix_length, msg);
    if(nmsg[length-1]=='\n')
      nmsg[length-1]='\0';
  }

  raptor_log_error_varargs(RAPTOR_LOG_LEVEL_ERROR,
                           error_handlers->handlers[RAPTOR_LOG_LEVEL_ERROR].handler,
                           error_handlers->handlers[RAPTOR_LOG_LEVEL_ERROR].user_data,
                           error_handlers->locator,
                           nmsg ? nmsg : msg, 
                           args);
  
  if(nmsg)
    RAPTOR_FREE(cstring,nmsg);

  va_end(args);
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:35,代码来源:raptor_libxml.c


示例18: raptor_term_to_counted_string

/**
 * raptor_term_to_counted_string:
 * @term: #raptor_term
 * @len_p: Pointer to location to store length of new string (if not NULL)
 *
 * Turns part of raptor term into a N-Triples format counted string.
 * 
 * Turns the given @term into an N-Triples escaped string using all the
 * escapes as defined in http://www.w3.org/TR/rdf-testcases/#ntriples
 *
 * This function uses raptor_term_ntriples_write() to write to an
 * #raptor_iostream which is the prefered way to write formatted
 * output.
 *
 * Return value: the new string or NULL on failure.  The length of
 * the new string is returned in *@len_p if len_p is not NULL.
 **/
unsigned char*
raptor_term_to_counted_string(raptor_term *term, size_t* len_p)
{
  raptor_iostream *iostr;
  void *string = NULL;
  int rc;

  RAPTOR_ASSERT_OBJECT_POINTER_RETURN_VALUE(term, raptor_term, NULL);
  
  iostr = raptor_new_iostream_to_string(term->world, 
                                        &string, len_p, NULL);
  if(!iostr)
    return NULL;
  rc = raptor_term_ntriples_write(term, iostr);
  raptor_free_iostream(iostr);
  
  if(rc) {
    if(string) {
      RAPTOR_FREE(cstring, string);
      string = NULL;
    }
  }

  return (unsigned char *)string;
}
开发者ID:nevali,项目名称:raptor,代码行数:42,代码来源:raptor_term.c


示例19: raptor_iostream_format_hexadecimal

/**
 * raptor_iostream_format_hexadecimal:
 * @iostr: raptor iostream
 * @integer: unsigned integer to format as hexadecimal
 * @width: field width
 *
 * Write an integer in hexadecimal to the iostream.
 *
 * Always 0-fills the entire field and writes in uppercase A-F
 * 
 * Return value: non-0 on failure
 **/
int
raptor_iostream_format_hexadecimal(raptor_iostream* iostr, 
                                   unsigned int integer, int width)
{
  unsigned char *buf;
  unsigned char *p;
  int rc;

  if(width <1)
    return 1;
  
  buf=(unsigned char*)RAPTOR_MALLOC(cstring, width);
  if(!buf)
    return 1;
  
  p=buf+width-1;
  do {
    unsigned int digit=(integer & 15);
    *p-- =(digit < 10) ? '0'+digit : 'A'+(digit-10);
    integer >>= 4;
  } while(integer);
  while(p >= buf)
    *p-- = '0';
  
  rc=raptor_iostream_write_bytes(iostr, buf, 1, width);
  RAPTOR_FREE(cstring, buf);
  return rc;
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:40,代码来源:raptor_iostream.c


示例20: raptor_write_string_iostream_finish

static void
raptor_write_string_iostream_finish(void *user_data) 
{
  struct raptor_write_string_iostream_context* con;
  size_t len;
  void *str = NULL;

  con = (struct raptor_write_string_iostream_context*)user_data;
  len = raptor_stringbuffer_length(con->sb);

  *con->string_p = NULL;
  if(con->length_p)
    *con->length_p = len;
  
  str = (void*)con->malloc_handler(len+1);
  if(str) {
    if(len)
      raptor_stringbuffer_copy_to_string(con->sb, (unsigned char*)str, len+1);
    else
      *(char*)str='\0';
    *con->string_p = str;
  }

  if(!str && con->length_p)
    *con->length_p = 0;
  
  raptor_free_stringbuffer(con->sb);
  RAPTOR_FREE(raptor_write_string_iostream_context, con);
  return;
}
开发者ID:bbcarchdev,项目名称:deb-raptor2,代码行数:30,代码来源:raptor_iostream.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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