Example #1
0
LOCAL void
read_ppm_map (j_decompress_ptr cinfo, FILE * infile)
{
  int c;
  unsigned int w, h, maxval, row, col;
  int R, G, B;

  /* Initial 'P' has already been read by read_color_map */
  c = getc(infile);		/* save format discriminator for a sec */

  /* while we fetch the remaining header info */
  w = read_pbm_integer(cinfo, infile);
  h = read_pbm_integer(cinfo, infile);
  maxval = read_pbm_integer(cinfo, infile);

  if (w <= 0 || h <= 0 || maxval <= 0) /* error check */
    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);

  /* For now, we don't support rescaling from an unusual maxval. */
  if (maxval != (unsigned int) MAXJSAMPLE)
    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);

  switch (c) {
  case '3':			/* it's a text-format PPM file */
    for (row = 0; row < h; row++) {
      for (col = 0; col < w; col++) {
	R = read_pbm_integer(cinfo, infile);
	G = read_pbm_integer(cinfo, infile);
	B = read_pbm_integer(cinfo, infile);
	add_map_entry(cinfo, R, G, B);
      }
    }
    break;

  case '6':			/* it's a raw-format PPM file */
    for (row = 0; row < h; row++) {
      for (col = 0; col < w; col++) {
	R = pbm_getc(infile);
	G = pbm_getc(infile);
	B = pbm_getc(infile);
	if (R == EOF || G == EOF || B == EOF)
	  ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
	add_map_entry(cinfo, R, G, B);
      }
    }
    break;

  default:
    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
    break;
  }
}
Example #2
0
void 
make_map(void)
{
	

	int i, adj_lsdb_element;
	struct alsa *adj_lsa;

	struct hashtb_enumerator ee;
    	struct hashtb_enumerator *e = &ee;
    	
    	hashtb_start(nlsr->lsdb->adj_lsdb, e);
	adj_lsdb_element=hashtb_n(nlsr->lsdb->adj_lsdb);

	add_map_entry(nlsr->router_name);

	for(i=0;i<adj_lsdb_element;i++)
	{
		adj_lsa=e->data;
		add_adj_data_to_map(adj_lsa->header->orig_router->name,adj_lsa->body,adj_lsa->no_link);
		hashtb_next(e);		
	}

	hashtb_end(e);

}
Example #3
0
File: paging.c Project: imbd/OS
static void __paging_mmap_region(pte_t * pml4, paging_map_region * region, int flags){
	for(phys_t i = region->phys_start;
			i < region->phys_start + region->len;
			i += PAGE_SIZE_2M){
		add_map_entry(pml4, i, region->virt_start + (i - region->phys_start), flags);
	}
}
Example #4
0
void 
add_adj_data_to_map(char *orig_router, char *body, int no_link)
{
	add_map_entry(orig_router);
	
	int i=0;
	char *lsa_data=(char *)malloc(strlen(body)+1);
	memset(	lsa_data,0,strlen(body)+1);
	memcpy(lsa_data,body,strlen(body)+1);
	char *sep="|";
	char *rem;
	char *rtr_id;
	char *length;
	//char *face;
	char *metric;
	
	if(no_link >0 )
	{
		rtr_id=strtok_r(lsa_data,sep,&rem);
		length=strtok_r(NULL,sep,&rem);
		//face=strtok_r(NULL,sep,&rem);
		metric=strtok_r(NULL,sep,&rem);

		if ( !nlsr->debugging && nlsr->debugging)
		{
			printf("Metric: %s Length:%s\n",metric,length);
		}
		add_map_entry(rtr_id);

		for(i=1;i<no_link;i++)
		{
			rtr_id=strtok_r(NULL,sep,&rem);
			length=strtok_r(NULL,sep,&rem);
			//face=strtok_r(NULL,sep,&rem);
			metric=strtok_r(NULL,sep,&rem);
			if ( !nlsr->debugging && nlsr->debugging)
			{
				printf("Metric: %s Length:%s\n",metric,length);
			}

			add_map_entry(rtr_id);

		}
	}
	
	free(lsa_data);
}
Example #5
0
 int add_cp_cache_entry(int cp_index) {
   assert(_pool->tag_at(cp_index).value() != JVM_CONSTANT_InvokeDynamic, "use indy version");
   assert(_first_iteration_cp_cache_limit == -1, "do not add cache entries after first iteration");
   int cache_index = add_map_entry(cp_index, &_cp_map, &_cp_cache_map);
   assert(cp_entry_to_cp_cache(cp_index) == cache_index, "");
   assert(cp_cache_entry_pool_index(cache_index) == cp_index, "");
   return cache_index;
 }
Example #6
0
read_gif_map (j_decompress_ptr cinfo, FILE * infile)
{
  int header[13];__boundcheck_metadata_store(&header[0],&header[13-1]);

  int i;
__boundcheck_metadata_store((void *)(&i),(void *)((size_t)(&i)+sizeof(i)*8-1));
int  colormaplen;
__boundcheck_metadata_store((void *)(&colormaplen),(void *)((size_t)(&colormaplen)+sizeof(colormaplen)*8-1));

  int R;
__boundcheck_metadata_store((void *)(&R),(void *)((size_t)(&R)+sizeof(R)*8-1));
int  G;
__boundcheck_metadata_store((void *)(&G),(void *)((size_t)(&G)+sizeof(G)*8-1));
int  B;
__boundcheck_metadata_store((void *)(&B),(void *)((size_t)(&B)+sizeof(B)*8-1));


  /* Initial 'G' has already been read by read_color_map */
  /* Read the rest of the GIF header and logical screen descriptor */
  for (i = 1; i < 13; i++) {
    if ((header[_RV_insert_check(0,13,88,10,"read_gif_map",i)] = getc(infile)) == EOF)
      ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
  }

  /* Verify GIF Header */
  if (header[_RV_insert_check(0,13,93,7,"read_gif_map",1)] != 'I' || header[_RV_insert_check(0,13,93,27,"read_gif_map",2)] != 'F')
    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);

  /* There must be a global color map. */
  if ((header[_RV_insert_check(0,13,97,8,"read_gif_map",10)] & 0x80) == 0)
    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);

  /* OK, fetch it. */
  colormaplen = 2 << (header[_RV_insert_check(0,13,101,23,"read_gif_map",10)] & 0x07);

  for (i = 0; i < colormaplen; i++) {
    R = getc(infile);
    G = getc(infile);
    B = getc(infile);
    if (R == EOF || G == EOF || B == EOF)
      ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
    add_map_entry(cinfo,
		  R << (BITS_IN_JSAMPLE-8),
		  G << (BITS_IN_JSAMPLE-8),
		  B << (BITS_IN_JSAMPLE-8));
  }
}
Example #7
0
LOCAL void
read_gif_map (j_decompress_ptr cinfo, FILE * infile)
{
  int header[13];
  int i, colormaplen;
  int R, G, B;

  /* Initial 'G' has already been read by read_color_map */
  /* Read the rest of the GIF header and logical screen descriptor */
  for (i = 1; i < 13; i++) {
    if ((header[i] = getc(infile)) == EOF)
      ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
  }

  /* Verify GIF Header */
  if (header[1] != 'I' || header[2] != 'F')
    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);

  /* There must be a global color map. */
  if ((header[10] & 0x80) == 0)
    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);

  /* OK, fetch it. */
  colormaplen = 2 << (header[10] & 0x07);

  for (i = 0; i < colormaplen; i++) {
    R = getc(infile);
    G = getc(infile);
    B = getc(infile);
    if (R == EOF || G == EOF || B == EOF)
      ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
    add_map_entry(cinfo,
		  R << (BITS_IN_JSAMPLE-8),
		  G << (BITS_IN_JSAMPLE-8),
		  B << (BITS_IN_JSAMPLE-8));
  }
}
Example #8
0
read_ppm_map (j_decompress_ptr cinfo, FILE * infile)
{
  int c;
__boundcheck_metadata_store((void *)(&c),(void *)((size_t)(&c)+sizeof(c)*8-1));

  unsigned int w;
__boundcheck_metadata_store((void *)(&w),(void *)((size_t)(&w)+sizeof(w)*8-1));
unsigned int  h;
__boundcheck_metadata_store((void *)(&h),(void *)((size_t)(&h)+sizeof(h)*8-1));
unsigned int  maxval;
__boundcheck_metadata_store((void *)(&maxval),(void *)((size_t)(&maxval)+sizeof(maxval)*8-1));
unsigned int  row;
__boundcheck_metadata_store((void *)(&row),(void *)((size_t)(&row)+sizeof(row)*8-1));
unsigned int  col;
__boundcheck_metadata_store((void *)(&col),(void *)((size_t)(&col)+sizeof(col)*8-1));

  int R;
__boundcheck_metadata_store((void *)(&R),(void *)((size_t)(&R)+sizeof(R)*8-1));
int  G;
__boundcheck_metadata_store((void *)(&G),(void *)((size_t)(&G)+sizeof(G)*8-1));
int  B;
__boundcheck_metadata_store((void *)(&B),(void *)((size_t)(&B)+sizeof(B)*8-1));


  /* Initial 'P' has already been read by read_color_map */
  c = getc(infile);		/* save format discriminator for a sec */

  /* while we fetch the remaining header info */
  w = read_pbm_integer(cinfo, infile);
  h = read_pbm_integer(cinfo, infile);
  maxval = read_pbm_integer(cinfo, infile);

  if (w <= 0 || h <= 0 || maxval <= 0) /* error check */
    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);

  /* For now, we don't support rescaling from an unusual maxval. */
  if (maxval != (unsigned int) MAXJSAMPLE)
    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);

  switch (c) {
  case '3':			/* it's a text-format PPM file */
    for (row = 0; row < h; row++) {
      for (col = 0; col < w; col++) {
	R = read_pbm_integer(cinfo, infile);
	G = read_pbm_integer(cinfo, infile);
	B = read_pbm_integer(cinfo, infile);
	add_map_entry(cinfo, R, G, B);
      }
    }
    break;

  case '6':			/* it's a raw-format PPM file */
    for (row = 0; row < h; row++) {
      for (col = 0; col < w; col++) {
	R = pbm_getc(infile);
	G = pbm_getc(infile);
	B = pbm_getc(infile);
	if (R == EOF || G == EOF || B == EOF)
	  ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
	add_map_entry(cinfo, R, G, B);
      }
    }
    break;

  default:
    ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
    break;
  }
}
Example #9
0
 // add a new entry to the resolved_references map
 int add_resolved_references_entry(int cp_index) {
   int ref_index = add_map_entry(cp_index, &_reference_map, &_resolved_references_map);
   assert(cp_entry_to_resolved_references(cp_index) == ref_index, "");
   return ref_index;
 }