Пример #1
0
char *bmh_search(const char *string, const int stringlen)
{
      int i;
__boundcheck_metadata_store((void *)(&i),(void *)((size_t)(&i)+sizeof(i)*8-1));
int j;
__boundcheck_metadata_store((void *)(&j),(void *)((size_t)(&j)+sizeof(j)*8-1));

      char *s;
__boundcheck_metadata_store((void *)(&s),(void *)((size_t)(&s)+sizeof(s)*8-1));


      i = patlen - 1 - stringlen;
      if (i >= 0)
            return NULL;
      string += stringlen;
      for ( ;; )
      {
            while ( (i += skip[((uchar *)string)[i]]) < 0 )
                  ;                           /* mighty fast inner loop */
            if (i < (LARGE - stringlen))
                  return NULL;
            i -= LARGE;
            j = patlen - 1;
            s = (char *)string + (i - j);
            while (--j >= 0 && s[__boundcheck_ptr_cast_to_array_reference(63,34,"bmh_search",(void *)(s),(void *)(s+j),j)] == pat[__boundcheck_ptr_cast_to_array_reference(63,44,"bmh_search",(void *)(pat),(void *)(pat+j),j)])
                  ;
            if ( j < 0 )                                    /* rdg 10/93 */
                  return s;                                 /* rdg 10/93 */
            if ( (i += skip2) >= 0 )                        /* rdg 10/93 */
                  return NULL;                              /* rdg 10/93 */
      }
}
Пример #2
0
char *bmha_search(const char *string, const int stringlen)
{
      int i;
__boundcheck_metadata_store((void *)(&i),(void *)((size_t)(&i)+sizeof(i)*8-1));
int j;
__boundcheck_metadata_store((void *)(&j),(void *)((size_t)(&j)+sizeof(j)*8-1));

      char *s;
__boundcheck_metadata_store((void *)(&s),(void *)((size_t)(&s)+sizeof(s)*8-1));


      i = patlen - 1 - stringlen;
      if (i >= 0)
            return NULL;
      string += stringlen;
      for ( ;; )
      {
            while ((i += skip[((uchar *)string)[i]]) < 0)
                  ;                           /* mighty fast inner loop */
            if (i < (LARGE - stringlen))
                  return NULL;
            i -= LARGE;
            j = patlen - 1;
            s = (char *)string + (i - j);
            while (--j >= 0 && lowerc(s[j]) == lowerc(pat[j]))
                  ;
            if ( j < 0 )                                    /* rdg 10/93 */
                  return s;                                 /* rdg 10/93 */
            if ( (i += skip2) >= 0 )                        /* rdg 10/93 */
                  return NULL;                              /* rdg 10/93 */
      }
}
Пример #3
0
void bmh_init(const char *pattern)
{
          int i;
__boundcheck_metadata_store((void *)(&i),(void *)((size_t)(&i)+sizeof(i)*8-1));
int lastpatchar;
__boundcheck_metadata_store((void *)(&lastpatchar),(void *)((size_t)(&lastpatchar)+sizeof(lastpatchar)*8-1));


          pat = (uchar *)pattern;
__boundcheck_metadata_trans_check((void *)(pat),(void *)(pattern),(void *)((uchar *)pattern));

          patlen = strlen(pattern);
          for (i = 0; i <= UCHAR_MAX; ++i)                  /* rdg 10/93 */
                skip[i] = patlen;
          for (i = 0; i < patlen; ++i)
                skip[pat[i]] = patlen - i - 1;
          lastpatchar = pat[__boundcheck_ptr_cast_to_array_reference(35,29,"bmh_init",(void *)(pat),(void *)(pat+patlen - 1),patlen - 1)];
          skip[lastpatchar] = LARGE;
          skip2 = patlen;                 /* Horspool's fixed second shift */
          for (i = 0; i < patlen - 1; ++i)
          {
                if (pat[__boundcheck_ptr_cast_to_array_reference(40,25,"bmh_init",(void *)(pat),(void *)(pat+i),i)] == lastpatchar)
                      skip2 = patlen - i - 1;
          }
}
Пример #4
0
jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed,
		    long max_bytes_needed, long already_allocated)
{
  long limit = cinfo->mem->max_memory_to_use - already_allocated;
__boundcheck_metadata_store((void *)(&limit),(void *)((size_t)(&limit)+sizeof(limit)*8-1));

  long slop;
__boundcheck_metadata_store((void *)(&slop),(void *)((size_t)(&slop)+sizeof(slop)*8-1));
long  mem;
__boundcheck_metadata_store((void *)(&mem),(void *)((size_t)(&mem)+sizeof(mem)*8-1));


  /* Don't ask for more than what application has told us we may use */
  if (max_bytes_needed > limit && limit > 0)
    max_bytes_needed = limit;
  /* Find whether there's a big enough free block in the heap.
   * CompactMem tries to create a contiguous block of the requested size,
   * and then returns the size of the largest free block (which could be
   * much more or much less than we asked for).
   * We add some slop to ensure we don't use up all available memory.
   */
  slop = max_bytes_needed / 16 + 32768L;
  mem = CompactMem(max_bytes_needed + slop) - slop;
  if (mem < 0)
    mem = 0;			/* sigh, couldn't even get the slop */
  /* Don't take more than the application says we can have */
  if (mem > limit && limit > 0)
    mem = limit;
  return mem;
}
Пример #5
0
void bmha_init(const char *pattern)
{
      int i;
__boundcheck_metadata_store((void *)(&i),(void *)((size_t)(&i)+sizeof(i)*8-1));
int j;
__boundcheck_metadata_store((void *)(&j),(void *)((size_t)(&j)+sizeof(j)*8-1));

      pat = (uchar *)pattern;
__boundcheck_metadata_trans_check((void *)(pat),(void *)(pattern),(void *)((uchar *)pattern));

      patlen = strlen(pattern);
      for (i = 0; i <= UCHAR_MAX; ++i)                      /* rdg 10/93 */
      {
            skip[i] = patlen;
            for (j = patlen - 1; j >= 0; --j)
            {
                  if (lowerc(i) == lowerc(pat[j]))
                        break;
            }
            if (j >= 0)
                  skip[i] = patlen - j - 1;
            if (j == patlen - 1)
                  skip[i] = LARGE;
      }
      skip2 = patlen;
      for (i = 0; i < patlen - 1; ++i)
      {
            if ( lowerc(pat[i]) == lowerc(pat[patlen - 1]) )
                  skip2 = patlen - i - 1;
      }
}
Пример #6
0
void main(void)
 {
   int row;
__boundcheck_metadata_store((void *)(&row),(void *)((size_t)(&row)+sizeof(row)*8-1));
int  column;
__boundcheck_metadata_store((void *)(&column),(void *)((size_t)(&column)+sizeof(column)*8-1));
int  table;
__boundcheck_metadata_store((void *)(&table),(void *)((size_t)(&table)+sizeof(table)*8-1));


   float values[2][3][5] = {
                            {{1.0, 2.0, 3.0, 4.0, 5.0},
                             {6.0, 7.0, 8.0, 9.0, 10.0},
                             {11.0, 12.0, 13.0, 14.0, 15.0}},
                             
                            {{16.0, 17.0, 18.0, 19.0, 20.0},
                             {21.0, 22.0, 23.0, 24.0, 25.0},
                             {26.0, 27.0, 28.0, 29.0, 30.0}}
                           };
int __values_0;

int __values_1;
	for(__values_0=0;__values_0<2;__values_0++)
	for(__values_1=0;__values_1<3;__values_1++)
__boundcheck_metadata_store(&values[__values_0][__values_1][0],&values[__values_0][__values_1][5-1]);

   
   for (row = 0; row < 2; row++)
    for (column = 0; column < 3; column++)
     for (table = 0; table < 5; table++)
      printf("values[%d][%d][%d] = %f\n", row, column, table, 
        values[_RV_insert_check(0,2,21,9,"main",row)][_RV_insert_check(0,3,21,9,"main",column)][_RV_insert_check(0,5,21,9,"main",table)]);
 }
Пример #7
0
process_restart (j_decompress_ptr cinfo)
{
  huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
__boundcheck_metadata_store((void *)(&entropy),(void *)((size_t)(&entropy)+sizeof(entropy)*8-1));

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


  /* Throw away any unused bits remaining in bit buffer; */
  /* include any full bytes in next_marker's count of discarded bytes */
  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
  entropy->bitstate.bits_left = 0;

  /* Advance past the RSTn marker */
  if (! (*(jpeg_marker_parser_method)(__boundcheck_ptr_reference(404,26,"process_restart",(void *)(cinfo->marker->read_restart_marker),(void *)cinfo->marker->read_restart_marker))) (cinfo))
    return FALSE;

  /* Re-initialize DC predictions to 0 */
  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
    entropy->saved.last_dc_val[_RV_insert_check(0,4,409,5,"process_restart",ci)] = 0;

  /* Reset restart counter */
  entropy->restarts_to_go = cinfo->restart_interval;

  /* Next segment can get another out-of-data warning */
  entropy->bitstate.printed_eod = FALSE;

  return TRUE;
}
Пример #8
0
jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer)
{
  my_coef_ptr coef;
__boundcheck_metadata_store((void *)(&coef),(void *)((size_t)(&coef)+sizeof(coef)*8-1));


  coef = (my_coef_ptr)
    (*(void *(*)(j_common_ptr, int, size_t))(__boundcheck_ptr_reference(409,19,"jinit_c_coef_controller",(void *)(cinfo->mem->alloc_small),(void *)cinfo->mem->alloc_small))) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				SIZEOF(my_coef_controller));
  cinfo->coef = (struct jpeg_c_coef_controller *) coef;
  coef->pub.start_pass = start_pass_coef;

  /* Create the coefficient buffer. */
  if (need_full_buffer) {
#ifdef FULL_COEF_BUFFER_SUPPORTED
    /* Allocate a full-image virtual array for each component, */
    /* padded to a multiple of samp_factor DCT blocks in each direction. */
    int ci;
__boundcheck_metadata_store((void *)(&ci),(void *)((size_t)(&ci)+sizeof(ci)*8-1));

    jpeg_component_info *compptr;
__boundcheck_metadata_store((void *)(&compptr),(void *)((size_t)(&compptr)+sizeof(compptr)*8-1));


    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
	 ci++, compptr++) {
      coef->whole_image[_RV_insert_check(0,10,424,7,"jinit_c_coef_controller",ci)] = (*(jvirt_barray_ptr (*)(j_common_ptr, int, boolean, JDIMENSION, JDIMENSION, JDIMENSION))(__boundcheck_ptr_reference(424,45,"jinit_c_coef_controller",(void *)(cinfo->mem->request_virt_barray),(void *)cinfo->mem->request_virt_barray)))
	((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
	 (JDIMENSION) jround_up((long) compptr->width_in_blocks,
				(long) compptr->h_samp_factor),
	 (JDIMENSION) jround_up((long) compptr->height_in_blocks,
				(long) compptr->v_samp_factor),
	 (JDIMENSION) compptr->v_samp_factor);
    }
#else
    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
#endif
  } else {
    /* We only need a single-MCU buffer. */
    JBLOCKROW buffer;
__boundcheck_metadata_store((void *)(&buffer),(void *)((size_t)(&buffer)+sizeof(buffer)*8-1));

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


    buffer = (JBLOCKROW)
      (*(void *(*)(j_common_ptr, int, size_t))(__boundcheck_ptr_reference(441,21,"jinit_c_coef_controller",(void *)(cinfo->mem->alloc_large),(void *)cinfo->mem->alloc_large))) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				  C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
    for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
      coef->MCU_buffer[_RV_insert_check(0,10,444,7,"jinit_c_coef_controller",i)] = buffer + i;
    }
    coef->whole_image[_RV_insert_check(0,10,446,5,"jinit_c_coef_controller",0)] = NULL; /* flag for no virtual arrays */
  }
}
Пример #9
0
int main(void)
 {
   int sd[10][20];
int __sd_0;
	for(__sd_0=0;__sd_0<10;__sd_0++)
__boundcheck_metadata_store(&sd[__sd_0][0],&sd[__sd_0][20-1]);

   int array1[10];__boundcheck_metadata_store(&array1[0],&array1[10-1]);

   int array2[10]={1,2,3,4,5,6,7,8,9,10};__boundcheck_metadata_store(&array2[0],&array2[10-1]);

   int a[1][10] = {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
int __a_0;
	for(__a_0=0;__a_0<1;__a_0++)
__boundcheck_metadata_store(&a[__a_0][0],&a[__a_0][10-1]);

   int b[2][10] = {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
                   {11, 12, 13, 14, 15, 16, 17, 18, 19, 20}};
int __b_0;
	for(__b_0=0;__b_0<2;__b_0++)
__boundcheck_metadata_store(&b[__b_0][0],&b[__b_0][10-1]);

   int array5[][10]={1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
int __array5_0;
	for(__array5_0=0;__array5_0<2;__array5_0++)
__boundcheck_metadata_store(&array5[__array5_0][0],&array5[__array5_0][10-1]);

   int c[3][10] = {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
                   {11, 12, 13, 14, 15, 16, 17, 18, 19, 20},
                   {21, 22, 23, 24, 25, 26, 27, 28, 29, 30}};
int __c_0;
	for(__c_0=0;__c_0<3;__c_0++)
__boundcheck_metadata_store(&c[__c_0][0],&c[__c_0][10-1]);

   int array3[2][3][4];
int __array3_0;

int __array3_1;
	for(__array3_0=0;__array3_0<2;__array3_0++)
	for(__array3_1=0;__array3_1<3;__array3_1++)
__boundcheck_metadata_store(&array3[__array3_0][__array3_1][0],&array3[__array3_0][__array3_1][4-1]);

   int array4[2][3][4]={{{1,2,3,4},{5,6,7,8},{9,10,11,12}},{{13,14,15,16},{17,18,19,20},{21,22,23,24}}};
int __array4_0;

int __array4_1;
	for(__array4_0=0;__array4_0<2;__array4_0++)
	for(__array4_1=0;__array4_1<3;__array4_1++)
__boundcheck_metadata_store(&array4[__array4_0][__array4_1][0],&array4[__array4_0][__array4_1][4-1]);


   show_2d_array(a, 1);
   show_2d_array(b, 2);
   show_2d_array(c, 3);
   show_3d_array(array4,4);
   printf("%d\n",array1[_RV_insert_check(0,10,40,18,"main",1)]);
   printf("%d\n",a[_RV_insert_check(0,1,41,18,"main",0)][_RV_insert_check(0,10,41,18,"main",4)]);
   return 1;
 }
Пример #10
0
void show_2d_array(int array[][10], int rows)
 {
   int i;
__boundcheck_metadata_store((void *)(&i),(void *)((size_t)(&i)+sizeof(i)*8-1));
int  j;
__boundcheck_metadata_store((void *)(&j),(void *)((size_t)(&j)+sizeof(j)*8-1));


   for (i = 0; i < rows; i++)
     for (j = 0; j < 10; j++)
       printf("array[%d][%d] = %d\n", i, j, *(int *)(__boundcheck_ptr_reference(9,59,"show_2d_array",(void *)(*(array + i)),(void *)(*(array+i)+j))));
 }
Пример #11
0
start_pass_huff_decoder (j_decompress_ptr cinfo)
{
  huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
__boundcheck_metadata_store((void *)(&entropy),(void *)((size_t)(&entropy)+sizeof(entropy)*8-1));

  int ci;
__boundcheck_metadata_store((void *)(&ci),(void *)((size_t)(&ci)+sizeof(ci)*8-1));
int  dctbl;
__boundcheck_metadata_store((void *)(&dctbl),(void *)((size_t)(&dctbl)+sizeof(dctbl)*8-1));
int  actbl;
__boundcheck_metadata_store((void *)(&actbl),(void *)((size_t)(&actbl)+sizeof(actbl)*8-1));

  jpeg_component_info * compptr;
__boundcheck_metadata_store((void *)(&compptr),(void *)((size_t)(&compptr)+sizeof(compptr)*8-1));


  /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
   * This ought to be an error condition, but we make it a warning because
   * there are some baseline files out there with all zeroes in these bytes.
   */
  if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2-1 ||
      cinfo->Ah != 0 || cinfo->Al != 0)
    WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);

  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
    compptr = cinfo->cur_comp_info[_RV_insert_check(0,4,92,15,"start_pass_huff_decoder",ci)];
    dctbl = compptr->dc_tbl_no;
    actbl = compptr->ac_tbl_no;
    /* Make sure requested tables are present */
    if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS ||
	cinfo->dc_huff_tbl_ptrs[_RV_insert_check(0,4,97,2,"start_pass_huff_decoder",dctbl)] == NULL)
      ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl);
    if (actbl < 0 || actbl >= NUM_HUFF_TBLS ||
	cinfo->ac_huff_tbl_ptrs[_RV_insert_check(0,4,100,2,"start_pass_huff_decoder",actbl)] == NULL)
      ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, actbl);
    /* Compute derived values for Huffman tables */
    /* We may do this more than once for a table, but it's not expensive */
    jpeg_make_d_derived_tbl(cinfo, cinfo->dc_huff_tbl_ptrs[_RV_insert_check(0,4,104,36,"start_pass_huff_decoder",dctbl)],
			    & entropy->dc_derived_tbls[_RV_insert_check(0,4,105,10,"start_pass_huff_decoder",dctbl)]);
    jpeg_make_d_derived_tbl(cinfo, cinfo->ac_huff_tbl_ptrs[_RV_insert_check(0,4,106,36,"start_pass_huff_decoder",actbl)],
			    & entropy->ac_derived_tbls[_RV_insert_check(0,4,107,10,"start_pass_huff_decoder",actbl)]);
    /* Initialize DC predictions to 0 */
    entropy->saved.last_dc_val[_RV_insert_check(0,4,109,5,"start_pass_huff_decoder",ci)] = 0;
  }

  /* Initialize bitread state variables */
  entropy->bitstate.bits_left = 0;
  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  entropy->bitstate.printed_eod = FALSE;

  /* Initialize restart counter */
  entropy->restarts_to_go = cinfo->restart_interval;
}
Пример #12
0
make_funny_pointers (j_decompress_ptr cinfo)
/* Create the funny pointer lists discussed in the comments above.
 * The actual workspace is already allocated (in main->buffer),
 * and the space for the pointer lists is allocated too.
 * This routine just fills in the curiously ordered lists.
 * This will be repeated at the beginning of each pass.
 */
{
  my_main_ptr main = (my_main_ptr) cinfo->main;
__boundcheck_metadata_store((void *)(&main),(void *)((size_t)(&main)+sizeof(main)*8-1));

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

  int M = cinfo->min_DCT_scaled_size;
__boundcheck_metadata_store((void *)(&M),(void *)((size_t)(&M)+sizeof(M)*8-1));

  jpeg_component_info *compptr;
__boundcheck_metadata_store((void *)(&compptr),(void *)((size_t)(&compptr)+sizeof(compptr)*8-1));

  JSAMPARRAY buf;
__boundcheck_metadata_store((void *)(&buf),(void *)((size_t)(&buf)+sizeof(buf)*8-1));
JSAMPARRAY  xbuf0;
__boundcheck_metadata_store((void *)(&xbuf0),(void *)((size_t)(&xbuf0)+sizeof(xbuf0)*8-1));
JSAMPARRAY  xbuf1;
__boundcheck_metadata_store((void *)(&xbuf1),(void *)((size_t)(&xbuf1)+sizeof(xbuf1)*8-1));


  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) /
      cinfo->min_DCT_scaled_size; /* height of a row group of component */
    xbuf0 = main->xbuffer[_RV_insert_check(0,2,213,13,"make_funny_pointers",0)][_RV_insert_check(0,2,213,13,"make_funny_pointers",ci)];
    xbuf1 = main->xbuffer[_RV_insert_check(0,2,214,13,"make_funny_pointers",1)][_RV_insert_check(0,2,214,13,"make_funny_pointers",ci)];
    /* First copy the workspace pointers as-is */
    buf = main->buffer[_RV_insert_check(0,10,216,11,"make_funny_pointers",ci)];
    for (i = 0; i < rgroup * (M + 2); i++) {
      (*(JSAMPROW *)(__boundcheck_ptr_reference(218,7,"make_funny_pointers",(void *)(&xbuf0[0]),(void *)(&xbuf0[i])))) = (*(JSAMPROW *)(__boundcheck_ptr_reference(218,18,"make_funny_pointers",(void *)(&xbuf1[0]),(void *)(&xbuf1[i])))) = (*(JSAMPROW *)(__boundcheck_ptr_reference(218,29,"make_funny_pointers",(void *)(&buf[0]),(void *)(&buf[i]))));
    }
    /* In the second list, put the last four row groups in swapped order */
    for (i = 0; i < rgroup * 2; i++) {
      (*(JSAMPROW *)(__boundcheck_ptr_reference(222,7,"make_funny_pointers",(void *)(&xbuf1[0]),(void *)(&xbuf1[rgroup * (M - 2) + i])))) = (*(JSAMPROW *)(__boundcheck_ptr_reference(222,33,"make_funny_pointers",(void *)(&buf[0]),(void *)(&buf[rgroup * M + i]))));
      (*(JSAMPROW *)(__boundcheck_ptr_reference(223,7,"make_funny_pointers",(void *)(&xbuf1[0]),(void *)(&xbuf1[rgroup * M + i])))) = (*(JSAMPROW *)(__boundcheck_ptr_reference(223,29,"make_funny_pointers",(void *)(&buf[0]),(void *)(&buf[rgroup * (M - 2) + i]))));
    }
    /* The wraparound pointers at top and bottom will be filled later
     * (see set_wraparound_pointers, below).  Initially we want the "above"
     * pointers to duplicate the first actual data line.  This only needs
     * to happen in xbuffer[0].
     */
    for (i = 0; i < rgroup; i++) {
      (*(JSAMPROW *)(__boundcheck_ptr_reference(231,7,"make_funny_pointers",(void *)(&xbuf0[0]),(void *)(&xbuf0[i - rgroup])))) = (*(JSAMPROW *)(__boundcheck_ptr_reference(231,27,"make_funny_pointers",(void *)(&xbuf0[0]),(void *)(&xbuf0[0]))));
    }
  }
}
Пример #13
0
void show_3d_array(int values[][3][4],int rows)
{
	int row;
__boundcheck_metadata_store((void *)(&row),(void *)((size_t)(&row)+sizeof(row)*8-1));
int column;
__boundcheck_metadata_store((void *)(&column),(void *)((size_t)(&column)+sizeof(column)*8-1));
int table;
__boundcheck_metadata_store((void *)(&table),(void *)((size_t)(&table)+sizeof(table)*8-1));

	for (row = 0; row < 2; row++)
		for (column = 0; column < 3; column++)
			for (table = 0; table < rows; table++)
				printf("values[%d][%d][%d] = %d\n", row,column,table,(*(int *)(__boundcheck_ptr_reference(18,58,"show_3d_array",(void *)(&values[row][column][0]),(void *)(&values[row][column][table])))));
}
Пример #14
0
start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
{
  my_main_ptr main = (my_main_ptr) cinfo->main;
__boundcheck_metadata_store((void *)(&main),(void *)((size_t)(&main)+sizeof(main)*8-1));


  switch (pass_mode) {
  case JBUF_PASS_THRU:
    if (cinfo->upsample->need_context_rows) {
      main->pub.process_data = process_data_context_main;
      make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
      main->whichptr = 0;	/* Read first iMCU row into xbuffer[0] */
      main->context_state = CTX_PREPARE_FOR_IMCU;
      main->iMCU_row_ctr = 0;
    } else {
      /* Simple case with no context needed */
      main->pub.process_data = process_data_simple_main;
    }
    main->buffer_full = FALSE;	/* Mark buffer empty */
    main->rowgroup_ctr = 0;
    break;
#ifdef QUANT_2PASS_SUPPORTED
  case JBUF_CRANK_DEST:
    /* For last pass of 2-pass quantization, just crank the postprocessor */
    main->pub.process_data = process_data_crank_post;
    break;
#endif
  default:
    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
    break;
  }
}
Пример #15
0
jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines,
		     JDIMENSION max_lines)
{
  JDIMENSION row_ctr;
__boundcheck_metadata_store((void *)(&row_ctr),(void *)((size_t)(&row_ctr)+sizeof(row_ctr)*8-1));


  if (cinfo->global_state != DSTATE_SCANNING)
    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  if (cinfo->output_scanline >= cinfo->output_height) {
    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
    return 0;
  }

  /* Call progress monitor hook if present */
  if (cinfo->progress != NULL) {
    cinfo->progress->pass_counter = (long) cinfo->output_scanline;
    cinfo->progress->pass_limit = (long) cinfo->output_height;
    (*(void (*)(j_common_ptr))(__boundcheck_ptr_reference(168,24,"jpeg_read_scanlines",(void *)(cinfo->progress->progress_monitor),(void *)cinfo->progress->progress_monitor))) ((j_common_ptr) cinfo);
  }

  /* Process some data */
  row_ctr = 0;
  (*(void (*)(j_decompress_ptr, JSAMPARRAY, JDIMENSION *, JDIMENSION))(__boundcheck_ptr_reference(173,18,"jpeg_read_scanlines",(void *)(cinfo->main->process_data),(void *)cinfo->main->process_data))) (cinfo, scanlines, &row_ctr, max_lines);
  cinfo->output_scanline += row_ctr;
  return row_ctr;
}
Пример #16
0
jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data,
		    JDIMENSION max_lines)
{
  JDIMENSION lines_per_iMCU_row;
__boundcheck_metadata_store((void *)(&lines_per_iMCU_row),(void *)((size_t)(&lines_per_iMCU_row)+sizeof(lines_per_iMCU_row)*8-1));


  if (cinfo->global_state != DSTATE_RAW_OK)
    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  if (cinfo->output_scanline >= cinfo->output_height) {
    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
    return 0;
  }

  /* Call progress monitor hook if present */
  if (cinfo->progress != NULL) {
    cinfo->progress->pass_counter = (long) cinfo->output_scanline;
    cinfo->progress->pass_limit = (long) cinfo->output_height;
    (*(void (*)(j_common_ptr))(__boundcheck_ptr_reference(201,24,"jpeg_read_raw_data",(void *)(cinfo->progress->progress_monitor),(void *)cinfo->progress->progress_monitor))) ((j_common_ptr) cinfo);
  }

  /* Verify that at least one iMCU row can be returned. */
  lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->min_DCT_scaled_size;
  if (max_lines < lines_per_iMCU_row)
    ERREXIT(cinfo, JERR_BUFFER_SIZE);

  /* Decompress directly into user's buffer. */
  if (! (*(int (*)(j_decompress_ptr, JSAMPIMAGE))(__boundcheck_ptr_reference(210,24,"jpeg_read_raw_data",(void *)(cinfo->coef->decompress_data),(void *)cinfo->coef->decompress_data))) (cinfo, data))
    return 0;			/* suspension forced, can do nothing more */

  /* OK, we processed one iMCU row. */
  cinfo->output_scanline += lines_per_iMCU_row;
  return lines_per_iMCU_row;
}
Пример #17
0
start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
{
  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
__boundcheck_metadata_store((void *)(&coef),(void *)((size_t)(&coef)+sizeof(coef)*8-1));


  coef->iMCU_row_num = 0;
  start_iMCU_row(cinfo);

  switch (pass_mode) {
  case JBUF_PASS_THRU:
    if (coef->whole_image[_RV_insert_check(0,10,109,9,"start_pass_coef",0)] != NULL)
      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
    coef->pub.compress_data = compress_data;
    break;
#ifdef FULL_COEF_BUFFER_SUPPORTED
  case JBUF_SAVE_AND_PASS:
    if (coef->whole_image[_RV_insert_check(0,10,115,9,"start_pass_coef",0)] == NULL)
      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
    coef->pub.compress_data = compress_first_pass;
    break;
  case JBUF_CRANK_DEST:
    if (coef->whole_image[_RV_insert_check(0,10,120,9,"start_pass_coef",0)] == NULL)
      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
    coef->pub.compress_data = compress_output;
    break;
#endif
  default:
    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
    break;
  }
}
Пример #18
0
int main()
{
  int a=5;
__boundcheck_metadata_store((void *)(&a),(void *)((size_t)(&a)+sizeof(a)*8-1));

  int *b=&a;
__boundcheck_metadata_store((void *)(&b),(void *)((size_t)(&b)+sizeof(b)*8-1));

  int ** c = &b;
__boundcheck_metadata_store((void *)(&c),(void *)((size_t)(&c)+sizeof(c)*8-1));

  printf("%d\n",*(int *)(__boundcheck_ptr_reference(7,19,"main",(void *)(*c),(void *)*c)));
  *(int *)(__boundcheck_ptr_reference(8,5,"main",(void *)(*c),(void *)*c)) =10;
  printf("a=**c=%d\n",*(int *)(__boundcheck_ptr_reference(9,25,"main",(void *)(*c),(void *)*c)));
  return 1;
}
Пример #19
0
jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
{
  my_main_ptr main;
__boundcheck_metadata_store((void *)(&main),(void *)((size_t)(&main)+sizeof(main)*8-1));

  int ci;
__boundcheck_metadata_store((void *)(&ci),(void *)((size_t)(&ci)+sizeof(ci)*8-1));
int  rgroup;
__boundcheck_metadata_store((void *)(&rgroup),(void *)((size_t)(&rgroup)+sizeof(rgroup)*8-1));
int  ngroups;
__boundcheck_metadata_store((void *)(&ngroups),(void *)((size_t)(&ngroups)+sizeof(ngroups)*8-1));

  jpeg_component_info *compptr;
__boundcheck_metadata_store((void *)(&compptr),(void *)((size_t)(&compptr)+sizeof(compptr)*8-1));


  main = (my_main_ptr)
    (*(void *(*)(j_common_ptr, int, size_t))(__boundcheck_ptr_reference(483,19,"jinit_d_main_controller",(void *)(cinfo->mem->alloc_small),(void *)cinfo->mem->alloc_small))) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				SIZEOF(my_main_controller));
  cinfo->main = (struct jpeg_d_main_controller *) main;
  main->pub.start_pass = start_pass_main;

  if (need_full_buffer)		/* shouldn't happen */
    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);

  /* Allocate the workspace.
   * ngroups is the number of row groups we need.
   */
  if (cinfo->upsample->need_context_rows) {
    if (cinfo->min_DCT_scaled_size < 2) /* unsupported, see comments above */
      ERREXIT(cinfo, JERR_NOTIMPL);
    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
    ngroups = cinfo->min_DCT_scaled_size + 2;
  } else {
    ngroups = cinfo->min_DCT_scaled_size;
  }

  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) /
      cinfo->min_DCT_scaled_size; /* height of a row group of component */
    main->buffer[_RV_insert_check(0,10,507,5,"jinit_d_main_controller",ci)] = (*(JSAMPARRAY (*)(j_common_ptr, int, JDIMENSION, JDIMENSION))(__boundcheck_ptr_reference(507,38,"jinit_d_main_controller",(void *)(cinfo->mem->alloc_sarray),(void *)cinfo->mem->alloc_sarray)))
			((j_common_ptr) cinfo, JPOOL_IMAGE,
			 compptr->width_in_blocks * compptr->DCT_scaled_size,
			 (JDIMENSION) (rgroup * ngroups));
  }
}
Пример #20
0
bool conver(int d[],int b[])
{
   int i;
__boundcheck_metadata_store((void *)(&i),(void *)((size_t)(&i)+sizeof(i)*8-1));
int  *p;
__boundcheck_metadata_store((void *)(&p),(void *)((size_t)(&p)+sizeof(p)*8-1));
int  *q;
__boundcheck_metadata_store((void *)(&q),(void *)((size_t)(&q)+sizeof(q)*8-1));

   p=b;
__boundcheck_metadata_trans_check((void *)(p),(void *)(b),(void *)(b));

   printf("%d\n",*(int *)(__boundcheck_ptr_reference(8,23,"conver",(void *)(p),(void *)(p+2))));
   for(i=0;i<5;i++)
      (*(int *)(__boundcheck_ptr_reference(10,7,"conver",(void *)(&d[0]),(void *)(&d[i]))))=(*(int *)(__boundcheck_ptr_reference(10,12,"conver",(void *)(&b[0]),(void *)(&b[i]))));    
   return 1;
}
Пример #21
0
int main()
{
   char *p2=NULL;
__boundcheck_metadata_store((void *)(&p2),(void *)((size_t)(&p2)+sizeof(p2)*8-1));

   char string[8]="ASDDSFF";__boundcheck_metadata_store(&string[0],&string[8-1]);

   char *__tmp_string_0="DDDFF";
 __boundcheck_metadata_store((void *)(__tmp_string_0),(void *)(__tmp_string_0+5));
char *p3=__tmp_string_0;
__boundcheck_metadata_store((void *)(&p3),(void *)((size_t)(&p3)+sizeof(p3)*8-1));

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


   static int a[10];__boundcheck_metadata_store(&a[0],&a[10-1]);

   int num[5]={1,2,3,4,5};__boundcheck_metadata_store(&num[0],&num[5-1]);

   if(conver(a,num))
    for (i = 0; i <5; i++)
      printf("%d  ",a[_RV_insert_check(0,10,25,21,"main",i)]);
 
   return 0;
}
Пример #22
0
int main(void)
 {
/*
   int sd[10][20];
//   __boundcheck_metadata_store(&sd[0][0],&sd[0][19]);

   int array1[10];
   int array2[10]={1,2,3,4,5,6,7,8,9,10};
   int a[1][10] = {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
*/

   int b[2][10] = {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
                   {11, 12, 13, 14, 15, 16, 17, 18, 19, 20}};
	int __b_i;
	for(__b_i=0;__b_i<2;__b_i++)	
	{
		__boundcheck_metadata_store(&b[__RV_i][0],&b[__RV_i][9]);
	}

//	__boundcheck_metadata_store(&b[0][0],&b[1][9]);

/*

   int array5[][10]={1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
   int c[3][10] = {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
                   {11, 12, 13, 14, 15, 16, 17, 18, 19, 20},
                   {21, 22, 23, 24, 25, 26, 27, 28, 29, 30}};
   int array3[2][3][4];
*/
	
   int array4[2][3][4]={{{1,2,3,4},{5,6,7,8},{9,10,11,12}},{{13,14,15,16},{17,18,19,20},{21,22,23,24}}};
	int __array4_i,__array4_j;
	for(__array4_i=0;__array4_i<2;__array4_i++)
		for(__array4_j=0;__array4_j<3;__array4_j++)
			__boundcheck_metadata_store(&array4[__array4_i][__array4_j][0],&array4[__array4_i][__array4_j][3]);

//   show_2d_array(a, 1);
	show_2d_array(b, 2);
//   show_2d_array(c, 3);
//	show_3d_array(array4,4);
   return 1;
 }
Пример #23
0
set_sample_factors (j_compress_ptr cinfo, char *arg)
/* Process a sample-factors parameter string, of the form
 *     HxV[,HxV,...]
 * If there are more components than parameters, "1x1" is assumed for the rest.
 */
{
  int ci;
__boundcheck_metadata_store((void *)(&ci),(void *)((size_t)(&ci)+sizeof(ci)*8-1));
int  val1;
__boundcheck_metadata_store((void *)(&val1),(void *)((size_t)(&val1)+sizeof(val1)*8-1));
int  val2;
__boundcheck_metadata_store((void *)(&val2),(void *)((size_t)(&val2)+sizeof(val2)*8-1));

  char ch1;
__boundcheck_metadata_store((void *)(&ch1),(void *)((size_t)(&ch1)+sizeof(ch1)*8-1));
char  ch2;
__boundcheck_metadata_store((void *)(&ch2),(void *)((size_t)(&ch2)+sizeof(ch2)*8-1));


  for (ci = 0; ci < MAX_COMPONENTS; ci++) {
    if (*(char *)(__boundcheck_ptr_reference(311,10,"set_sample_factors",(void *)(arg),(void *)(arg)))) {
      ch2 = ',';		/* if not set by sscanf, will be ',' */
      if (sscanf(arg, "%d%c%d%c", &val1, &ch1, &val2, &ch2) < 3)
	return FALSE;
      if ((ch1 != 'x' && ch1 != 'X') || ch2 != ',') /* syntax check */
	return FALSE;
      if (val1 <= 0 || val1 > 4 || val2 <= 0 || val2 > 4) {
	fprintf(stderr, "JPEG sampling factors must be 1..4\n");
	return FALSE;
      }
      cinfo->comp_info[ci].h_samp_factor = val1;
      cinfo->comp_info[ci].v_samp_factor = val2;
      while (*(char *)(__boundcheck_ptr_reference(323,15,"set_sample_factors",(void *)(arg),(void *)(arg))) && *(char *)(__boundcheck_ptr_reference(323,26,"set_sample_factors",(void *)(arg),(void *)(arg++))) != ',') /* advance to next segment of arg string */
	;
    } else {
      /* reached end of parameter, set remaining components to 1x1 sampling */
      cinfo->comp_info[ci].h_samp_factor = 1;
      cinfo->comp_info[ci].v_samp_factor = 1;
    }
  }
  return TRUE;
}
Пример #24
0
int
main(int argc, char *argv[])
{
	__global_variables_init();

      DWORD crc;
__boundcheck_metadata_store((void *)(&crc),(void *)((size_t)(&crc)+sizeof(crc)*8-1));

      long charcnt;
__boundcheck_metadata_store((void *)(&charcnt),(void *)((size_t)(&charcnt)+sizeof(charcnt)*8-1));

      register errors = 0;

      while(--argc > 0)
      {
            errors |= crc32file(*++argv, &crc, &charcnt);
            printf("%08lX %7ld %s\n", crc, charcnt, *argv);
      }
      return(errors != 0);
}
Пример #25
0
jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor,
			 boolean force_baseline)
/* Set or change the 'quality' (quantization) setting, using default tables
 * and a straight percentage-scaling quality scale.  In most cases it's better
 * to use jpeg_set_quality (below); this entry point is provided for
 * applications that insist on a linear percentage scaling.
 */
{
  /* These are the sample quantization tables given in JPEG spec section K.1.
   * The spec says that the values given produce "good" quality, and
   * when divided by 2, "very good" quality.
   */
  static const unsigned int std_luminance_quant_tbl[DCTSIZE2] = {
    16,  11,  10,  16,  24,  40,  51,  61,
    12,  12,  14,  19,  26,  58,  60,  55,
    14,  13,  16,  24,  40,  57,  69,  56,
    14,  17,  22,  29,  51,  87,  80,  62,
    18,  22,  37,  56,  68, 109, 103,  77,
    24,  35,  55,  64,  81, 104, 113,  92,
    49,  64,  78,  87, 103, 121, 120, 101,
    72,  92,  95,  98, 112, 100, 103,  99
  };__boundcheck_metadata_store(&std_luminance_quant_tbl[0],&std_luminance_quant_tbl[64-1]);

  static const unsigned int std_chrominance_quant_tbl[DCTSIZE2] = {
    17,  18,  24,  47,  99,  99,  99,  99,
    18,  21,  26,  66,  99,  99,  99,  99,
    24,  26,  56,  99,  99,  99,  99,  99,
    47,  66,  99,  99,  99,  99,  99,  99,
    99,  99,  99,  99,  99,  99,  99,  99,
    99,  99,  99,  99,  99,  99,  99,  99,
    99,  99,  99,  99,  99,  99,  99,  99,
    99,  99,  99,  99,  99,  99,  99,  99
  };__boundcheck_metadata_store(&std_chrominance_quant_tbl[0],&std_chrominance_quant_tbl[64-1]);


  /* Set up two quantization tables using the specified scaling */
  jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl,
		       scale_factor, force_baseline);
  jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl,
		       scale_factor, force_baseline);
}
Пример #26
0
int main()
{
	__global_variables_init();

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

  printf("%d\n",s[_RV_insert_check(0,6,39,17,"main",i)].len);
  printf("%d\n",ss[_RV_insert_check(0,8,40,17,"main",i+1)].len);
  printf("%c\n",sss[_RV_insert_check(0,2,41,17,"main",1)].array[_RV_insert_check(0,10,41,17,"main",2)]);
  return 0;
}
Пример #27
0
set_bottom_pointers (j_decompress_ptr cinfo)
/* Change the pointer lists to duplicate the last sample row at the bottom
 * of the image.  whichptr indicates which xbuffer holds the final iMCU row.
 * Also sets rowgroups_avail to indicate number of nondummy row groups in row.
 */
{
  my_main_ptr main = (my_main_ptr) cinfo->main;
__boundcheck_metadata_store((void *)(&main),(void *)((size_t)(&main)+sizeof(main)*8-1));

  int ci;
__boundcheck_metadata_store((void *)(&ci),(void *)((size_t)(&ci)+sizeof(ci)*8-1));
int  i;
__boundcheck_metadata_store((void *)(&i),(void *)((size_t)(&i)+sizeof(i)*8-1));
int  rgroup;
__boundcheck_metadata_store((void *)(&rgroup),(void *)((size_t)(&rgroup)+sizeof(rgroup)*8-1));
int  iMCUheight;
__boundcheck_metadata_store((void *)(&iMCUheight),(void *)((size_t)(&iMCUheight)+sizeof(iMCUheight)*8-1));
int  rows_left;
__boundcheck_metadata_store((void *)(&rows_left),(void *)((size_t)(&rows_left)+sizeof(rows_left)*8-1));

  jpeg_component_info *compptr;
__boundcheck_metadata_store((void *)(&compptr),(void *)((size_t)(&compptr)+sizeof(compptr)*8-1));

  JSAMPARRAY xbuf;
__boundcheck_metadata_store((void *)(&xbuf),(void *)((size_t)(&xbuf)+sizeof(xbuf)*8-1));


  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    /* Count sample rows in one iMCU row and in one row group */
    iMCUheight = compptr->v_samp_factor * compptr->DCT_scaled_size;
    rgroup = iMCUheight / cinfo->min_DCT_scaled_size;
    /* Count nondummy sample rows remaining for this component */
    rows_left = (int) (compptr->downsampled_height % (JDIMENSION) iMCUheight);
    if (rows_left == 0) rows_left = iMCUheight;
    /* Count nondummy row groups.  Should get same answer for each component,
     * so we need only do it once.
     */
    if (ci == 0) {
      main->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1);
    }
    /* Duplicate the last real sample row rgroup*2 times; this pads out the
     * last partial rowgroup and ensures at least one full rowgroup of context.
     */
    xbuf = main->xbuffer[_RV_insert_check(0,2,294,12,"set_bottom_pointers",main->whichptr)][_RV_insert_check(0,2,294,12,"set_bottom_pointers",ci)];
    for (i = 0; i < rgroup * 2; i++) {
      (*(JSAMPROW *)(__boundcheck_ptr_reference(296,7,"set_bottom_pointers",(void *)(&xbuf[0]),(void *)(&xbuf[rows_left + i])))) = (*(JSAMPROW *)(__boundcheck_ptr_reference(296,29,"set_bottom_pointers",(void *)(&xbuf[0]),(void *)(&xbuf[rows_left - 1]))));
    }
  }
}
Пример #28
0
jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
		      const unsigned int *basic_table,
		      int scale_factor, boolean force_baseline)
/* Define a quantization table equal to the basic_table times
 * a scale factor (given as a percentage).
 * If force_baseline is TRUE, the computed quantization table entries
 * are limited to 1..255 for JPEG baseline compatibility.
 */
{
  JQUANT_TBL ** qtblptr = & cinfo->quant_tbl_ptrs[_RV_insert_check(0,4,32,29,"jpeg_add_quant_table",which_tbl)];
__boundcheck_metadata_store((void *)(&qtblptr),(void *)((size_t)(&qtblptr)+sizeof(qtblptr)*8-1));

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

  long temp;
__boundcheck_metadata_store((void *)(&temp),(void *)((size_t)(&temp)+sizeof(temp)*8-1));


  /* Safety check to ensure start_compress not called yet. */
  if (cinfo->global_state != CSTATE_START)
    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);

  if (*(JQUANT_TBL **)(__boundcheck_ptr_reference(40,8,"jpeg_add_quant_table",(void *)(qtblptr),(void *)(qtblptr))) == NULL)
    *(JQUANT_TBL **)(__boundcheck_ptr_reference(41,6,"jpeg_add_quant_table",(void *)(qtblptr),(void *)(qtblptr))) = jpeg_alloc_quant_table((j_common_ptr) cinfo);

  for (i = 0; i < DCTSIZE2; i++) {
    temp = ((long) (*(const unsigned int *)(__boundcheck_ptr_reference(44,20,"jpeg_add_quant_table",(void *)(&basic_table[0]),(void *)(&basic_table[i])))) * scale_factor + 50L) / 100L;
    /* limit the values to the valid range */
    if (temp <= 0L) temp = 1L;
    if (temp > 32767L) temp = 32767L; /* max quantizer needed for 12 bits */
    if (force_baseline && temp > 255L)
      temp = 255L;		/* limit to baseline range if requested */
    (*(JQUANT_TBL **)(__boundcheck_ptr_reference(50,7,"jpeg_add_quant_table",(void *)(qtblptr),(void *)(qtblptr))))->quantval[_RV_insert_check(0,64,50,5,"jpeg_add_quant_table",i)] = (UINT16) temp;
  }

  /* Initialize sent_table FALSE so table will be written to JPEG file. */
  (*(JQUANT_TBL **)(__boundcheck_ptr_reference(54,5,"jpeg_add_quant_table",(void *)(qtblptr),(void *)(qtblptr))))->sent_table = FALSE;
}
Пример #29
0
set_quant_slots (j_compress_ptr cinfo, char *arg)
/* Process a quantization-table-selectors parameter string, of the form
 *     N[,N,...]
 * If there are more components than parameters, the last value is replicated.
 */
{
  int val = 0;
__boundcheck_metadata_store((void *)(&val),(void *)((size_t)(&val)+sizeof(val)*8-1));
			/* default table # */
  int ci;
__boundcheck_metadata_store((void *)(&ci),(void *)((size_t)(&ci)+sizeof(ci)*8-1));

  char ch;
__boundcheck_metadata_store((void *)(&ch),(void *)((size_t)(&ch)+sizeof(ch)*8-1));


  for (ci = 0; ci < MAX_COMPONENTS; ci++) {
    if (*(char *)(__boundcheck_ptr_reference(277,10,"set_quant_slots",(void *)(arg),(void *)(arg)))) {
      ch = ',';			/* if not set by sscanf, will be ',' */
      if (sscanf(arg, "%d%c", &val, &ch) < 1)
	return FALSE;
      if (ch != ',')		/* syntax check */
	return FALSE;
      if (val < 0 || val >= NUM_QUANT_TBLS) {
	fprintf(stderr, "JPEG quantization tables are numbered 0..%d\n",
		NUM_QUANT_TBLS-1);
	return FALSE;
      }
      cinfo->comp_info[ci].quant_tbl_no = val;
      while (*(char *)(__boundcheck_ptr_reference(289,15,"set_quant_slots",(void *)(arg),(void *)(arg))) && *(char *)(__boundcheck_ptr_reference(289,26,"set_quant_slots",(void *)(arg),(void *)(arg++))) != ',') /* advance to next segment of arg string */
	;
    } else {
      /* reached end of parameter, set remaining components to last table */
      cinfo->comp_info[ci].quant_tbl_no = val;
    }
  }
  return TRUE;
}
Пример #30
0
void bmhi_init(const char *pattern)
{
      int i;
__boundcheck_metadata_store((void *)(&i),(void *)((size_t)(&i)+sizeof(i)*8-1));
int lastpatchar;
__boundcheck_metadata_store((void *)(&lastpatchar),(void *)((size_t)(&lastpatchar)+sizeof(lastpatchar)*8-1));

      patlen = strlen(pattern);

      /* Make uppercase copy of pattern */

      pat = realloc ((void*)pat, patlen);
      if (!pat)
            exit(1);
      else  atexit(bhmi_cleanup);
      for (i=0; i < patlen; i++)
            pat[__boundcheck_ptr_cast_to_array_reference(54,17,"bmhi_init",(void *)(pat),(void *)(pat+i),i)] = toupper(pattern[__boundcheck_ptr_cast_to_array_reference(54,38,"bmhi_init",(void *)(pattern),(void *)(pattern+i),i)]);

      /* initialize skip array */

      for ( i = 0; i <= UCHAR_MAX; ++i )                    /* rdg 10/93 */
            skip[i] = patlen;
      for ( i = 0; i < patlen - 1; ++i )
      {
            skip[        pat[i] ] = patlen - i - 1;
            skip[tolower(pat[i])] = patlen - i - 1;
      }
      lastpatchar = pat[__boundcheck_ptr_cast_to_array_reference(65,25,"bmhi_init",(void *)(pat),(void *)(pat+patlen - 1),patlen - 1)];
      skip[        lastpatchar ] = LARGE;
      skip[tolower(lastpatchar)] = LARGE;
      skip2 = patlen;                     /* Horspool's fixed second shift */
      for (i = 0; i < patlen - 1; ++i)
      {
            if ( pat[__boundcheck_ptr_cast_to_array_reference(71,22,"bmhi_init",(void *)(pat),(void *)(pat+i),i)] == lastpatchar )
                  skip2 = patlen - i - 1;
      }
}