コード例 #1
0
ファイル: jddiffct.c プロジェクト: Ithamar/cosmoe
output_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
{
  j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec;
  d_diff_ptr diff = (d_diff_ptr) losslsd->diff_private;
  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  int ci, samp_rows, row;
  JSAMPARRAY buffer;
  jpeg_component_info *compptr;

  /* Force some input to be done if we are getting ahead of the input. */
  while (cinfo->input_scan_number < cinfo->output_scan_number ||
	 (cinfo->input_scan_number == cinfo->output_scan_number &&
	  cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
    if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED)
      return JPEG_SUSPENDED;
  }

  /* OK, output from the virtual arrays. */
  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    /* Align the virtual buffer for this component. */
    buffer = (*cinfo->mem->access_virt_sarray)
      ((j_common_ptr) cinfo, diff->whole_image[ci],
       cinfo->output_iMCU_row * compptr->v_samp_factor,
       (JDIMENSION) compptr->v_samp_factor, FALSE);

    if (cinfo->output_iMCU_row < last_iMCU_row)
      samp_rows = compptr->v_samp_factor;
    else {
      /* NB: can't use last_row_height here; it is input-side-dependent! */
      samp_rows = (int) (compptr->height_in_data_units % compptr->v_samp_factor);
      if (samp_rows == 0) samp_rows = compptr->v_samp_factor;
    }

    for (row = 0; row < samp_rows; row++) {
      MEMCOPY(output_buf[ci][row], buffer[row],
	      compptr->width_in_data_units * SIZEOF(JSAMPLE));
    }
  }

  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
    return JPEG_ROW_COMPLETED;
  return JPEG_SCAN_COMPLETED;
}
コード例 #2
0
ファイル: vector.c プロジェクト: martinqo99/school-projects
int vecPushBack(S_Vector *pVec, void *pElem)
{
    static const int blockSize = 512;

    IZG_ASSERT(pVec && pElem);

    if( pVec->size >= pVec->reserved )
    {
        char *p = (char *)realloc(pVec->data, (pVec->size + blockSize) * pVec->elemSize);
        IZG_CHECK(p, "Cannot allocate enough memory");
        pVec->data = p;
        pVec->reserved = pVec->size + blockSize;
    }

    MEMCOPY(pVec->data + pVec->size * pVec->elemSize, pElem, pVec->elemSize);
    ++pVec->size;

    return (pVec->size - 1);
}
コード例 #3
0
ファイル: rr_canonize.c プロジェクト: koodaamo/yadifa
static void
rr_canonize_nsec3param(zdb_packed_ttlrdata* rr, ptr_vector* v)
{
    while(rr != NULL)
    {
        zdb_canonized_packed_ttlrdata* c_rr;

        u32 c_rr_size = sizeof (zdb_canonized_packed_ttlrdata) - 1 + ZDB_PACKEDRECORD_PTR_RDATASIZE(rr);
        MALLOC_OR_DIE(zdb_canonized_packed_ttlrdata*, c_rr, c_rr_size, RR_CANONIZE_NOP_TAG);

        ZDB_PACKEDRECORD_PTR_RDATASIZE(c_rr) = ZDB_PACKEDRECORD_PTR_RDATASIZE(rr);
        c_rr->rdata_canonized_size = htons(ZDB_PACKEDRECORD_PTR_RDATASIZE(rr));
        MEMCOPY(&c_rr->rdata_start[0], ZDB_PACKEDRECORD_PTR_RDATAPTR(rr), ZDB_PACKEDRECORD_PTR_RDATASIZE(rr));
        c_rr->rdata_start[1] = 0; /* The signed NSEC3PARAM has its flags to 0 */
        ptr_vector_append(v, c_rr);

        rr = rr->next;
    }
}
コード例 #4
0
// This should be called after CBKE.
bool emAfPluginCommsHubFunctionTunnelCreate(EmberEUI64 remoteDeviceId,
                                               uint8_t remoteEndpoint)
{
  uint8_t tunnelIndex;
  emberAfDebugPrint("CHF: TunnelCreate ");
  emberAfDebugDebugExec(emberAfPrintBigEndianEui64(remoteDeviceId));
  emberAfDebugPrintln(" 0x%x", remoteEndpoint);

  // We only support one tunnel to a given remote device/endpoint so if we
  // already have a tunnel lets work with it.
  tunnelIndex = findTunnelByDeviceId(remoteDeviceId);
  if (tunnelIndex != EM_AF_PLUGIN_COMMS_HUB_FUNCTION_NULL_TUNNEL_INDEX) {
    if (tunnels[tunnelIndex].state == CLOSED_TUNNEL) {
      return requestTunnel(tunnelIndex);
    }
    return true;
  }

  // Find a slot in the tunnels table for the new tunnel
  tunnelIndex = findUnusedTunnel();
  if (tunnelIndex != EM_AF_PLUGIN_COMMS_HUB_FUNCTION_NULL_TUNNEL_INDEX) {
    MEMCOPY(tunnels[tunnelIndex].remoteDeviceId, remoteDeviceId, EUI64_SIZE);
    tunnels[tunnelIndex].remoteNodeId = emberLookupNodeIdByEui64(remoteDeviceId);
    tunnels[tunnelIndex].remoteEndpoint = remoteEndpoint;
    tunnels[tunnelIndex].type = CLIENT_TUNNEL;
    tunnels[tunnelIndex].state = CLOSED_TUNNEL;
    tunnels[tunnelIndex].tunnelId = 0xFF;
    tunnels[tunnelIndex].timeoutMSec = 0;
    return requestTunnel(tunnelIndex);
  }

  // This is a misconfiguration or a bug in the code calling this API. Either
  // the tunnel client plugin limit is set too low for the number of tunnels
  // required or the code that is calling this function is in error.  Either way,
  // we'll print the error and return false indicating that the tunnel was
  // not created.
  emberAfPluginCommsHubFunctionPrintln("%p%p%p",
                                       "Error: ",
                                       "Tunnel Create failed: ",
                                       "Too many tunnels");
  return false;
}
コード例 #5
0
ファイル: jcprepct.cpp プロジェクト: revelator/MHDoom
create_context_buffer( j_compress_ptr cinfo )
{
	my_prep_ptr prep = ( my_prep_ptr ) cinfo->prep;
	int rgroup_height = cinfo->max_v_samp_factor;
	int ci, i;
	jpeg_component_info *compptr;
	JSAMPARRAY true_buffer, fake_buffer;
	
	/* Grab enough space for fake row pointers for all the components;
	 * we need five row groups' worth of pointers for each component.
	 */
	fake_buffer = ( JSAMPARRAY )
				  ( *cinfo->mem->alloc_small )( ( j_common_ptr ) cinfo, JPOOL_IMAGE,
						  ( cinfo->num_components * 5 * rgroup_height ) *
						  SIZEOF( JSAMPROW ) );
						  
	for( ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
			ci++, compptr++ )
	{
		/* Allocate the actual buffer space (3 row groups) for this component.
		 * We make the buffer wide enough to allow the downsampler to edge-expand
		 * horizontally within the buffer, if it so chooses.
		 */
		true_buffer = ( *cinfo->mem->alloc_sarray )
					  ( ( j_common_ptr ) cinfo, JPOOL_IMAGE,
						( JDIMENSION )( ( ( long ) compptr->width_in_blocks *
										  cinfo->min_DCT_h_scaled_size *
										  cinfo->max_h_samp_factor ) / compptr->h_samp_factor ),
						( JDIMENSION )( 3 * rgroup_height ) );
		/* Copy true buffer row pointers into the middle of the fake row array */
		MEMCOPY( fake_buffer + rgroup_height, true_buffer,
				 3 * rgroup_height * SIZEOF( JSAMPROW ) );
		/* Fill in the above and below wraparound pointers */
		for( i = 0; i < rgroup_height; i++ )
		{
			fake_buffer[i] = true_buffer[2 * rgroup_height + i];
			fake_buffer[4 * rgroup_height + i] = true_buffer[i];
		}
		prep->color_buf[ci] = fake_buffer + rgroup_height;
		fake_buffer += 5 * rgroup_height; /* point to space for next component */
	}
}
コード例 #6
0
/* allocate and fill in the sample_range_limit table */
int
il_setup_quantize(void)
{
	JSAMPLE *table;
	int i;

	if(the_sample_range_limit)
		return TRUE;

	/* lost for ever */
	table = (JSAMPLE *)XP_ALLOC((5 * (MAXJSAMPLE+1) + CENTERJSAMPLE) * SIZEOF(JSAMPLE));
	if (!table) 
	{
		XP_TRACE(("il: range limit table lossage"));
		return FALSE;
	}

	table += (MAXJSAMPLE+1);	/* allow negative subscripts of simple table */
	the_sample_range_limit = table;

	/* First segment of "simple" table: limit[x] = 0 for x < 0 */
	MEMZERO(table - (MAXJSAMPLE+1), (MAXJSAMPLE+1) * SIZEOF(JSAMPLE));

	/* Main part of "simple" table: limit[x] = x */
	for (i = 0; i <= MAXJSAMPLE; i++)
		table[i] = (JSAMPLE) i;

	table += CENTERJSAMPLE;	/* Point to where post-IDCT table starts */

	/* End of simple table, rest of first half of post-IDCT table */
	for (i = CENTERJSAMPLE; i < 2*(MAXJSAMPLE+1); i++)
		table[i] = MAXJSAMPLE;

	/* Second half of post-IDCT table */
	MEMZERO(table + (2 * (MAXJSAMPLE+1)),
			(2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * SIZEOF(JSAMPLE));
	MEMCOPY(table + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE),
			the_sample_range_limit, CENTERJSAMPLE * SIZEOF(JSAMPLE));

	return TRUE;
}
コード例 #7
0
ファイル: wrppm.c プロジェクト: GerbilSoft/rom-properties
copy_pixel_rows(j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
                JDIMENSION rows_supplied)
{
  ppm_dest_ptr dest = (ppm_dest_ptr)dinfo;
  register char *bufferptr;
  register JSAMPROW ptr;
#if BITS_IN_JSAMPLE != 8 || (!defined(HAVE_UNSIGNED_CHAR) && !defined(__CHAR_UNSIGNED__))
  register JDIMENSION col;
#endif

  ptr = dest->pub.buffer[0];
  bufferptr = dest->iobuffer;
#if BITS_IN_JSAMPLE == 8 && (defined(HAVE_UNSIGNED_CHAR) || defined(__CHAR_UNSIGNED__))
  MEMCOPY(bufferptr, ptr, dest->samples_per_row);
#else
  for (col = dest->samples_per_row; col > 0; col--) {
    PUTPPMSAMPLE(bufferptr, GETJSAMPLE(*ptr++));
  }
#endif
  (void)JFWRITE(dest->pub.output_file, dest->iobuffer, dest->buffer_width);
}
コード例 #8
0
ファイル: rr_canonize.c プロジェクト: koodaamo/yadifa
static void
rr_canonize_nop(zdb_packed_ttlrdata* rr, ptr_vector* v)
{
    while(rr != NULL)
    {
        zdb_canonized_packed_ttlrdata* c_rr;

        u32 c_rr_size = sizeof (zdb_canonized_packed_ttlrdata) - 1 + ZDB_PACKEDRECORD_PTR_RDATASIZE(rr);
        MALLOC_OR_DIE(zdb_canonized_packed_ttlrdata*, c_rr, c_rr_size, RR_CANONIZE_NOP_TAG);

        ZDB_PACKEDRECORD_PTR_RDATASIZE(c_rr) = ZDB_PACKEDRECORD_PTR_RDATASIZE(rr);
        c_rr->rdata_canonized_size = htons(ZDB_PACKEDRECORD_PTR_RDATASIZE(rr));
        /** @todo CHECK: If we don't lo-case anymore maybe I could grab some
         *        more cycles here.  Not for the A-records on a 64bits arch,
         *        but for any case where the rdata is (much) bigger than 8 bytes
         */
        MEMCOPY(&c_rr->rdata_start[0], ZDB_PACKEDRECORD_PTR_RDATAPTR(rr), ZDB_PACKEDRECORD_PTR_RDATASIZE(rr));
        ptr_vector_append(v, c_rr);

        rr = rr->next;
    }
}
コード例 #9
0
ファイル: lusol.c プロジェクト: SimonRit/RTK
int LUSOL_ftran(LUSOLrec *LUSOL, REAL b[], int NZidx[], MYBOOL prepareupdate)
{
  int  inform;
  REAL *vector;

  if(prepareupdate)
    vector = LUSOL->vLU6L;
  else
    vector = LUSOL->w;

  /* Copy RHS vector, but make adjustment for offset since this
     can create a memory error when the calling program uses
     a 0-base vector offset back to comply with LUSOL. */
  MEMCOPY(vector+1, b+1, LUSOL->n);
  if (vector != NULL)
    vector[0] = 0;

  LU6SOL(LUSOL, LUSOL_SOLVE_Aw_v, vector, b, NZidx, &inform);
  LUSOL->luparm[LUSOL_IP_FTRANCOUNT]++;

  return(inform);
}
コード例 #10
0
ファイル: ptr_vector.c プロジェクト: koodaamo/yadifa
void
ptr_vector_resize(ptr_vector*v, s32 newsize)
{
    void** data;

    zassert(newsize >= v->offset + 1);

    /* Only the data up to v->offset (included) is relevant */
    MALLOC_OR_DIE(void**, data, newsize * sizeof (void*), PTR_VECTOR_TAG);
    MEMCOPY(data, v->data, (v->offset + 1) * sizeof (void*));

#ifndef NDEBUG
    if(v->data != NULL)
    {
        memset(v->data, 0xff, v->size * sizeof (void*));
    }
#endif

    free(v->data);
    v->data = data;
    v->size = newsize;
}
コード例 #11
0
ファイル: vorbis_util.cpp プロジェクト: fungos/seed1
size_t vorbis_read(void *ptr, size_t byteSize, size_t sizeToRead, void *datasource)
{
	size_t spaceToEOF;
	size_t actualSizeToRead;
	sOggFile *vorbisData;

	vorbisData = (sOggFile *)datasource;

	spaceToEOF = static_cast<size_t>(vorbisData->dataSize - vorbisData->dataRead);
	if ((sizeToRead*byteSize) < spaceToEOF)
		actualSizeToRead = (sizeToRead*byteSize);
	else
		actualSizeToRead = spaceToEOF;

	if (actualSizeToRead)
	{
		MEMCOPY(ptr, (char*)vorbisData->dataPtr + vorbisData->dataRead, actualSizeToRead);
		vorbisData->dataRead += (actualSizeToRead);
	}

	return actualSizeToRead;
}
コード例 #12
0
ファイル: jdinput.cpp プロジェクト: Triocrossing/mrpt
latch_quant_tables(j_decompress_ptr cinfo)
{
	int ci, qtblno;
	jpeg_component_info* compptr;
	JQUANT_TBL* qtbl;

	for (ci = 0; ci < cinfo->comps_in_scan; ci++)
	{
		compptr = cinfo->cur_comp_info[ci];
		/* No work if we already saved Q-table for this component */
		if (compptr->quant_table != nullptr) continue;
		/* Make sure specified quantization table is present */
		qtblno = compptr->quant_tbl_no;
		if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
			cinfo->quant_tbl_ptrs[qtblno] == nullptr)
			ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
		/* OK, save away the quantization table */
		qtbl = (JQUANT_TBL*)(*cinfo->mem->alloc_small)(
			(j_common_ptr)cinfo, JPOOL_IMAGE, SIZEOF(JQUANT_TBL));
		MEMCOPY(qtbl, cinfo->quant_tbl_ptrs[qtblno], SIZEOF(JQUANT_TBL));
		compptr->quant_table = qtbl;
	}
}
コード例 #13
0
EmberStatus emberSendUdp(uint8_t options,
                         const uint8_t *destination,
                         uint8_t hopLimit,
                         uint16_t sourcePort,
                         uint16_t destinationPort,
                         uint8_t *payload,
                         uint16_t payloadLength)
{
  uint8_t source[16];
  if (! emStoreIpSourceAddress(source, destination)) {
    return EMBER_BAD_ARGUMENT;
  }

  HostListener *listener = emberFindListener(sourcePort, source);
  if (listener != NULL) {
    struct sockaddr_in6 outSock = {0};
    outSock.sin6_family = AF_INET6;
    outSock.sin6_port = htons(destinationPort);
    MEMCOPY(outSock.sin6_addr.s6_addr, destination, 16);
    int interfaceIndex = if_nametoindex(emUnixInterface);
    outSock.sin6_scope_id = interfaceIndex;

    nativeWrite(listener->socket,
                payload,
                payloadLength,
                (struct sockaddr *)&outSock,
                sizeof(outSock));
    emberCounterHandler(EMBER_COUNTER_UDP_OUT, 1);

    return EMBER_SUCCESS;
  } else {
    fprintf(stderr, "No listener on sourcePort:%d\n",
            sourcePort);
    return EMBER_INVALID_CALL;
  }
}
コード例 #14
0
/** @brief Tunnel Opened
 *
 * This function is called by the Tunneling server plugin whenever a tunnel is
 * opened.  Clients may open tunnels by sending a Request Tunnel command.
 *
 * @param tunnelId The identifier of the tunnel that has been opened.  Ver.:
 * always
 * @param protocolId The identifier of the metering communication protocol for
 * the tunnel.  Ver.: always
 * @param manufacturerCode The manufacturer code for manufacturer-defined
 * protocols or 0xFFFF in unused.  Ver.: always
 * @param flowControlSupport true is flow control support is requested or false
 * if it is not.  Ver.: always
 * @param maximumIncomingTransferSize The maximum incoming transfer size of the
 * client.  Ver.: always
 */
void emberAfPluginTunnelingServerTunnelOpenedCallback(uint16_t tunnelId,
                                                      uint8_t protocolId,
                                                      uint16_t manufacturerCode,
                                                      bool flowControlSupport,
                                                      uint16_t maximumIncomingTransferSize)
{
  EmberEUI64 remoteDeviceId;
  EmberNodeId remoteNodeId;
  uint8_t tunnelIndex;

  emberAfDebugPrintln("CHF: ServerTunnelOpened:0x%x,0x%2x", tunnelId, maximumIncomingTransferSize);

  // Since the tunneling cluster server code does not pass the EUI64 or the
  // node ID of the remote end of the tunnel so we need to look them up.
  // Luckily this callback is called in the context of the RequestTunnel
  // command processing and we look into the command for this info.
  remoteNodeId = emberAfCurrentCommand()->source;
  emberLookupEui64ByNodeId(emberAfCurrentCommand()->source, remoteDeviceId);

  // We only support one tunnel to a given remote device/endpoint so if we
  // already have a tunnel lets work with it.
  tunnelIndex = findTunnelByDeviceId(remoteDeviceId);
  if (tunnelIndex == EM_AF_PLUGIN_COMMS_HUB_FUNCTION_NULL_TUNNEL_INDEX) {
    // Find a slot in the tunnels table for the new tunnel
    tunnelIndex = findUnusedTunnel();
  }

  if (tunnelIndex != EM_AF_PLUGIN_COMMS_HUB_FUNCTION_NULL_TUNNEL_INDEX) {
    MEMCOPY(tunnels[tunnelIndex].remoteDeviceId, remoteDeviceId, EUI64_SIZE);
    tunnels[tunnelIndex].remoteNodeId = remoteNodeId;
    tunnels[tunnelIndex].remoteEndpoint = emberAfCurrentCommand()->apsFrame->sourceEndpoint;
    tunnels[tunnelIndex].type = SERVER_TUNNEL;
    tunnels[tunnelIndex].state = ACTIVE_TUNNEL;
    tunnels[tunnelIndex].tunnelId = tunnelId;
    tunnels[tunnelIndex].timeoutMSec = 0;

    // Per GBCS v0.8 section 10.2.2, Devices supporting the Tunneling Cluster
    // as a Server shall have a MaximumIncomingTransferSize set to 1500 octets,
    // in line with the ZSE default.  All Devices supporting the Tunneling
    // Cluster shall use this value in any RequestTunnelResponse command and
    // any RequestTunnel command.
    //
    // So rather than bring down the tunnel in the case when the maximumIncomingTransferSize
    // is less than 1500 we'll just log a warning message.
    if (maximumIncomingTransferSize < 1500) {
      emberAfPluginCommsHubFunctionPrintln("Warning: tunnel opened but MaximumIncomingTransferSize of client is %d but should be 1500",
                                           maximumIncomingTransferSize);
    }
    return;
  }

  // This is a misconfiguration or a bug in the code calling this API. Either
  // the tunnel client plugin limit is set too low for the number of tunnels
  // required or the code that is calling this function is in error.  Either way,
  // we'll print the error and return false indicating that the tunnel was
  // not created.
  emberAfPluginCommsHubFunctionPrintln("%p%p%p",
                                       "Error: ",
                                       "Tunnel Opened failed: ",
                                       "Too many tunnels");
}
コード例 #15
0
EmberStatus emberUdpListen(uint16_t port, const uint8_t *localAddress)
{
  if (emIsUnspecifiedAddress(localAddress)) {
    return EMBER_ERR_FATAL;
  }
  if (emberFindListener(port, localAddress) != NULL) {
    return EMBER_SUCCESS;
  }

  // The localAddress variable is used to glean the source address
  // associated with a particular listener.  For multicast listeners,
  // we use the mesh local address as source.
  bool isMulticast = emIsMulticastAddress(localAddress);
  EmberIpv6Address meshLocalAddress;
  emberGetLocalIpAddress(0, &meshLocalAddress);

  HostListener *listener = emberAddListener(port,
                                            (isMulticast
                                             ? meshLocalAddress.bytes
                                             : localAddress),
                                            SOCK_DGRAM, 0); // UDP

  if (listener == NULL) {
    return EMBER_TABLE_FULL;
  }

  if (listener->socket == INVALID_SOCKET) {
    return EMBER_ERR_FATAL;
  }

  int interfaceIndex = if_nametoindex(emUnixInterface);
  struct ipv6_mreq mreq6 = {0};
  MEMCOPY(&mreq6.ipv6mr_multiaddr.s6_addr, localAddress, 16);
  mreq6.ipv6mr_interface = interfaceIndex;
  int mcastTTL = 10;
  int loopBack = 1;

  if (setsockopt(listener->socket,
                 IPPROTO_IPV6,
                 IPV6_MULTICAST_IF,
                 &interfaceIndex,
                 sizeof(interfaceIndex))
      < 0) {
    perror("setsockopt:: IPV6_MULTICAST_IF:: ");
    return EMBER_ERR_FATAL;
  }

  if (setsockopt(listener->socket,
                 IPPROTO_IPV6,
                 IPV6_MULTICAST_LOOP,
                 &loopBack,
                 sizeof(loopBack))
      < 0) {
    perror("setsockopt:: IPV6_MULTICAST_LOOP:: ");
    return EMBER_ERR_FATAL;
  }

  if (setsockopt(listener->socket,
                 IPPROTO_IPV6,
                 IPV6_MULTICAST_HOPS,
                 &mcastTTL,
                 sizeof(mcastTTL))
      < 0) {
    perror("setsockopt:: IPV6_MULTICAST_HOPS::  ");
    return EMBER_ERR_FATAL;
  }

  if (isMulticast) {
    if (setsockopt(listener->socket,
                   IPPROTO_IPV6,
                   IPV6_JOIN_GROUP,
                   &mreq6,
                   sizeof(mreq6))
        < 0) {
      perror("setsockopt:: IPV6_JOIN_GROUP:: ");
      return EMBER_ERR_FATAL;
    }
  }

  return EMBER_SUCCESS;
}
コード例 #16
0
ファイル: rdswitch.c プロジェクト: vinnie38170/klImageCore
read_scan_script (j_compress_ptr cinfo, char * filename)
/* Read a scan script from the specified text file.
 * Each entry in the file defines one scan to be emitted.
 * Entries are separated by semicolons ';'.
 * An entry contains one to four component indexes,
 * optionally followed by a colon ':' and four progressive-JPEG parameters.
 * The component indexes denote which component(s) are to be transmitted
 * in the current scan.  The first component has index 0.
 * Sequential JPEG is used if the progressive-JPEG parameters are omitted.
 * The file is free format text: any whitespace may appear between numbers
 * and the ':' and ';' punctuation marks.  Also, other punctuation (such
 * as commas or dashes) can be placed between numbers if desired.
 * Comments preceded by '#' may be included in the file.
 * Note: we do very little validity checking here;
 * jcmaster.c will validate the script parameters.
 */
{
  FILE * fp;
  int scanno, ncomps, termchar;
  long val;
  jpeg_scan_info * scanptr;
#define MAX_SCANS  100    /* quite arbitrary limit */
  jpeg_scan_info scans[MAX_SCANS];

  if ((fp = fopen(filename, "r")) == NULL) {
    fprintf(stderr, "Can't open scan definition file %s\n", filename);
    return FALSE;
  }
  scanptr = scans;
  scanno = 0;

  while (read_scan_integer(fp, &val, &termchar)) {
    if (scanno >= MAX_SCANS) {
      fprintf(stderr, "Too many scans defined in file %s\n", filename);
      fclose(fp);
      return FALSE;
    }
    scanptr->component_index[0] = (int) val;
    ncomps = 1;
    while (termchar == ' ') {
      if (ncomps >= MAX_COMPS_IN_SCAN) {
  fprintf(stderr, "Too many components in one scan in file %s\n",
    filename);
  fclose(fp);
  return FALSE;
      }
      if (! read_scan_integer(fp, &val, &termchar))
  goto bogus;
      scanptr->component_index[ncomps] = (int) val;
      ncomps++;
    }
    scanptr->comps_in_scan = ncomps;
    if (termchar == ':') {
      if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ')
  goto bogus;
      scanptr->Ss = (int) val;
      if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ')
  goto bogus;
      scanptr->Se = (int) val;
      if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ')
  goto bogus;
      scanptr->Ah = (int) val;
      if (! read_scan_integer(fp, &val, &termchar))
  goto bogus;
      scanptr->Al = (int) val;
    } else {
      /* set non-progressive parameters */
      scanptr->Ss = 0;
      scanptr->Se = DCTSIZE2-1;
      scanptr->Ah = 0;
      scanptr->Al = 0;
    }
    if (termchar != ';' && termchar != EOF) {
bogus:
      fprintf(stderr, "Invalid scan entry format in file %s\n", filename);
      fclose(fp);
      return FALSE;
    }
    scanptr++, scanno++;
  }

  if (termchar != EOF) {
    fprintf(stderr, "Non-numeric data in file %s\n", filename);
    fclose(fp);
    return FALSE;
  }

  if (scanno > 0) {
    /* Stash completed scan list in cinfo structure.
     * NOTE: for cjpeg's use, JPOOL_IMAGE is the right lifetime for this data,
     * but if you want to compress multiple images you'd want JPOOL_PERMANENT.
     */
    scanptr = (jpeg_scan_info *)
      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
          scanno * SIZEOF(jpeg_scan_info));
    MEMCOPY(scanptr, scans, scanno * SIZEOF(jpeg_scan_info));
    cinfo->scan_info = scanptr;
    cinfo->num_scans = scanno;
  }

  fclose(fp);
  return TRUE;
}
コード例 #17
0
ファイル: jctrans.c プロジェクト: svn2github/htmldoc
jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
			       j_compress_ptr dstinfo)
{
  JQUANT_TBL ** qtblptr;
  jpeg_component_info *incomp, *outcomp;
  JQUANT_TBL *c_quant, *slot_quant;
  int tblno, ci, coefi;

  /* Safety check to ensure start_compress not called yet. */
  if (dstinfo->global_state != CSTATE_START)
    ERREXIT1(dstinfo, JERR_BAD_STATE, dstinfo->global_state);
  /* Copy fundamental image dimensions */
  dstinfo->image_width = srcinfo->image_width;
  dstinfo->image_height = srcinfo->image_height;
  dstinfo->input_components = srcinfo->num_components;
  dstinfo->in_color_space = srcinfo->jpeg_color_space;
  /* Initialize all parameters to default values */
  jpeg_set_defaults(dstinfo);
  /* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB.
   * Fix it to get the right header markers for the image colorspace.
   */
  jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space);
  dstinfo->data_precision = srcinfo->data_precision;
  dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling;
  /* Copy the source's quantization tables. */
  for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {
    if (srcinfo->quant_tbl_ptrs[tblno] != NULL) {
      qtblptr = & dstinfo->quant_tbl_ptrs[tblno];
      if (*qtblptr == NULL)
	*qtblptr = jpeg_alloc_quant_table((j_common_ptr) dstinfo);
      MEMCOPY((*qtblptr)->quantval,
	      srcinfo->quant_tbl_ptrs[tblno]->quantval,
	      SIZEOF((*qtblptr)->quantval));
      (*qtblptr)->sent_table = FALSE;
    }
  }
  /* Copy the source's per-component info.
   * Note we assume jpeg_set_defaults has allocated the dest comp_info array.
   */
  dstinfo->num_components = srcinfo->num_components;
  if (dstinfo->num_components < 1 || dstinfo->num_components > MAX_COMPONENTS)
    ERREXIT2(dstinfo, JERR_COMPONENT_COUNT, dstinfo->num_components,
	     MAX_COMPONENTS);
  for (ci = 0, incomp = srcinfo->comp_info, outcomp = dstinfo->comp_info;
       ci < dstinfo->num_components; ci++, incomp++, outcomp++) {
    outcomp->component_id = incomp->component_id;
    outcomp->h_samp_factor = incomp->h_samp_factor;
    outcomp->v_samp_factor = incomp->v_samp_factor;
    outcomp->quant_tbl_no = incomp->quant_tbl_no;
    /* Make sure saved quantization table for component matches the qtable
     * slot.  If not, the input file re-used this qtable slot.
     * IJG encoder currently cannot duplicate this.
     */
    tblno = outcomp->quant_tbl_no;
    if (tblno < 0 || tblno >= NUM_QUANT_TBLS ||
	srcinfo->quant_tbl_ptrs[tblno] == NULL)
      ERREXIT1(dstinfo, JERR_NO_QUANT_TABLE, tblno);
    slot_quant = srcinfo->quant_tbl_ptrs[tblno];
    c_quant = incomp->quant_table;
    if (c_quant != NULL) {
      for (coefi = 0; coefi < DCTSIZE2; coefi++) {
	if (c_quant->quantval[coefi] != slot_quant->quantval[coefi])
	  ERREXIT1(dstinfo, JERR_MISMATCHED_QUANT_TABLE, tblno);
      }
    }
    /* Note: we do not copy the source's Huffman table assignments;
     * instead we rely on jpeg_set_colorspace to have made a suitable choice.
     */
  }
  /* Also copy JFIF version and resolution information, if available.
   * Strictly speaking this isn't "critical" info, but it's nearly
   * always appropriate to copy it if available.  In particular,
   * if the application chooses to copy JFIF 1.02 extension markers from
   * the source file, we need to copy the version to make sure we don't
   * emit a file that has 1.02 extensions but a claimed version of 1.01.
   * We will *not*, however, copy version info from mislabeled "2.01" files.
   */
  if (srcinfo->saw_JFIF_marker) {
    if (srcinfo->JFIF_major_version == 1) {
      dstinfo->JFIF_major_version = srcinfo->JFIF_major_version;
      dstinfo->JFIF_minor_version = srcinfo->JFIF_minor_version;
    }
    dstinfo->density_unit = srcinfo->density_unit;
    dstinfo->X_density = srcinfo->X_density;
    dstinfo->Y_density = srcinfo->Y_density;
  }
}
コード例 #18
0
ファイル: Jctrans.c プロジェクト: cjus/s34mme
jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
			       j_compress_ptr dstinfo)
{
  JQUANT_TBL ** qtblptr;
  jpeg_component_info *incomp, *outcomp;
  JQUANT_TBL *c_quant, *slot_quant;
  int tblno, ci, coefi;

  /* Safety check to ensure start_compress not called yet. */
  if (dstinfo->global_state != CSTATE_START)
    ERREXIT1(dstinfo, JERR_BAD_STATE, dstinfo->global_state);
  /* Copy fundamental image dimensions */
  dstinfo->image_width = srcinfo->image_width;
  dstinfo->image_height = srcinfo->image_height;
  dstinfo->input_components = srcinfo->num_components;
  dstinfo->in_color_space = srcinfo->jpeg_color_space;
  /* Initialize all parameters to default values */
  jpeg_set_defaults(dstinfo);
  /* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB.
   * Fix it to get the right header markers for the image colorspace.
   */
  jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space);
  dstinfo->data_precision = srcinfo->data_precision;
  dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling;
  /* Copy the source's quantization tables. */
  for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {
    if (srcinfo->quant_tbl_ptrs[tblno] != NULL) {
      qtblptr = & dstinfo->quant_tbl_ptrs[tblno];
      if (*qtblptr == NULL)
	*qtblptr = jpeg_alloc_quant_table((j_common_ptr) dstinfo);
      MEMCOPY((*qtblptr)->quantval,
	      srcinfo->quant_tbl_ptrs[tblno]->quantval,
	      SIZEOF((*qtblptr)->quantval));
      (*qtblptr)->sent_table = FALSE;
    }
  }
  /* Copy the source's per-component info.
   * Note we assume jpeg_set_defaults has allocated the dest comp_info array.
   */
  dstinfo->num_components = srcinfo->num_components;
  if (dstinfo->num_components < 1 || dstinfo->num_components > MAX_COMPONENTS)
    ERREXIT2(dstinfo, JERR_COMPONENT_COUNT, dstinfo->num_components,
	     MAX_COMPONENTS);
  for (ci = 0, incomp = srcinfo->comp_info, outcomp = dstinfo->comp_info;
       ci < dstinfo->num_components; ci++, incomp++, outcomp++) {
    outcomp->component_id = incomp->component_id;
    outcomp->h_samp_factor = incomp->h_samp_factor;
    outcomp->v_samp_factor = incomp->v_samp_factor;
    outcomp->quant_tbl_no = incomp->quant_tbl_no;
    /* Make sure saved quantization table for component matches the qtable
     * slot.  If not, the input file re-used this qtable slot.
     * IJG encoder currently cannot duplicate this.
     */
    tblno = outcomp->quant_tbl_no;
    if (tblno < 0 || tblno >= NUM_QUANT_TBLS ||
	srcinfo->quant_tbl_ptrs[tblno] == NULL)
      ERREXIT1(dstinfo, JERR_NO_QUANT_TABLE, tblno);
    slot_quant = srcinfo->quant_tbl_ptrs[tblno];
    c_quant = incomp->quant_table;
    if (c_quant != NULL) {
      for (coefi = 0; coefi < DCTSIZE2; coefi++) {
	if (c_quant->quantval[coefi] != slot_quant->quantval[coefi])
	  ERREXIT1(dstinfo, JERR_MISMATCHED_QUANT_TABLE, tblno);
      }
    }
    /* Note: we do not copy the source's Huffman table assignments;
     * instead we rely on jpeg_set_colorspace to have made a suitable choice.
     */
  }
}
コード例 #19
0
ファイル: lp_MDO.c プロジェクト: JensAdamczak/lpSolveAPI
int __WINAPI getMDO(lprec *lp, MYBOOL *usedpos, int *colorder, int *size, MYBOOL symmetric)
{
  int    error = FALSE;
  int    nrows = lp->rows+1, ncols = colorder[0];
  int    i, j, kk, n;
  int    *col_end, *row_map = NULL;
  int    Bnz, Blen, *Brows = NULL;
  int    stats[COLAMD_STATS];
  double knobs[COLAMD_KNOBS];

 /* Tally the non-zero counts of the unused columns/rows of the 
    basis matrix and store corresponding "net" starting positions */
  allocINT(lp, &col_end, ncols+1, FALSE);
  n = prepareMDO(lp, usedpos, colorder, col_end, NULL);
  Bnz = col_end[ncols];

 /* Check that we have unused basic columns, otherwise skip analysis */  
  if(ncols == 0 || Bnz == 0) 
    goto Transfer;

 /* Get net number of rows and fill mapper */
  allocINT(lp, &row_map, nrows, FALSE);
  nrows = 0;
  for(i = 0; i <= lp->rows; i++) {
    row_map[i] = i-nrows;
   /* Increment eliminated row counter if necessary */
    if(!includeMDO(usedpos, i)) 
      nrows++;
  }
  nrows = lp->rows+1 - nrows;

 /* Store row indeces of non-zero values in the basic columns */
  Blen = colamd_recommended(Bnz, nrows, ncols);
  allocINT(lp, &Brows, Blen, FALSE);
  prepareMDO(lp, usedpos, colorder, Brows, row_map);
#ifdef Paranoia
  verifyMDO(lp, col_end, Brows, nrows, ncols);
#endif

 /* Compute the MDO */
#if 1
  colamd_set_defaults(knobs);
  knobs [COLAMD_DENSE_ROW] = 0.2+0.2 ;    /* default changed for UMFPACK */
  knobs [COLAMD_DENSE_COL] = knobs [COLAMD_DENSE_ROW];    
  if(symmetric && (nrows == ncols)) {
    MEMCOPY(colorder, Brows, ncols + 1);
    error = !symamd(nrows, colorder, col_end, Brows, knobs, stats, mdo_calloc, mdo_free);
  }
  else
    error = !colamd(nrows, ncols, Blen, Brows, col_end, knobs, stats);
#else
  if(symmetric && (nrows == ncols)) {
    MEMCOPY(colorder, Brows, ncols + 1);
    error = !symamd(nrows, colorder, col_end, Brows, knobs, stats, mdo_calloc, mdo_free);
  }
  else
    error = !colamd(nrows, ncols, Blen, Brows, col_end, (double *) NULL, stats);
#endif

 /* Transfer the estimated optimal ordering, adjusting for index offsets */
Transfer:
  if(error) 
    error = stats[COLAMD_STATUS];
  else {
    MEMCOPY(Brows, colorder, ncols + 1);
    for(j = 0; j < ncols; j++) {
      kk = col_end[j];
      n = Brows[kk+1];
      colorder[j+1] = n;
    }
  }

  /* Free temporary vectors */
  FREE(col_end);
  if(row_map != NULL)
    FREE(row_map);
  if(Brows != NULL)
    FREE(Brows);

  if(size != NULL)
    *size = ncols;
  return( error );
}
コード例 #20
0
static EmberStatus setEntry(uint8_t index,
                            const EmberAfRf4ceMsoIrRfDatabaseEntry *entry)
{
  // When a new entry comes in, we always remove the old entry, even though the
  // new entry might not fit.  The rationale is that the old entry is being
  // replaced because it is no longer valid for the peripheral devices in the
  // system.  Reverting to a default entry seems better than keeping the old,
  // invalid entry.
  uint32_t reclaimableBytes = calculateHeapUsage(&database[index]);
  if (reclaimableBytes != 0) {
    uint8_t *head;
    uint8_t i;

    // If the space we think we are using is ever less than what we think we
    // can reclaim, then something has gone very wrong.
    assert(reclaimableBytes <= USED_HEAP_SPACE());

    // The RF payloads and the IR code are all stored contiguously in the heap,
    // although some of them may be empty.  We just need to find whichever one
    // is first.  If we expect to have one but can't find it or we do find it
    // but its not actually within the heap area, then something has gone very
    // wrong.
    head = findHead(&database[index]);
    assert(head != NULL);
    assert(heap <= head);
    assert(head + reclaimableBytes <= tail);

    // Rewind the tail pointer and all the RF payload and IR code pointers for
    // entries that follow the old one.  This makes them point to where they
    // should after the heap is adjusted.  This means the pointers are NOT
    // valid until the heap is adjusted.
    tail -= reclaimableBytes;
    for (i = 0; i < COUNTOF(database); i++) {
      if (head < database[i].rfPressedDescriptor.payload) {
        database[i].rfPressedDescriptor.payload -= reclaimableBytes;
      }
      if (head < database[i].rfRepeatedDescriptor.payload) {
        database[i].rfRepeatedDescriptor.payload -= reclaimableBytes;
      }
      if (head < database[i].rfReleasedDescriptor.payload) {
        database[i].rfReleasedDescriptor.payload -= reclaimableBytes;
      }
      if (head < database[i].irDescriptor.irCode) {
        database[i].irDescriptor.irCode -= reclaimableBytes;
      }
    }

    // Move the stuff after the old entry so it immediately follows the stuff
    // preceding the old entry.  The old entry is now gone and the tail, RF
    // payload, and IR pointers are all valid again.
    MEMMOVE(head, head + reclaimableBytes, tail - head);

    // Wipe the stuff following the new tail.
    MEMSET(tail, 0, reclaimableBytes);
  }

  // The free space is the unused space and includes what we reclaimed from the
  // old entry.  If we don't have enough room, we drop the new entry and leave
  // a default in its place.
  if (FREE_HEAP_SPACE() < calculateHeapUsage(entry)) {
    SET_DEFAULT(&database[index]);
    return EMBER_TABLE_FULL;
  }

  // The basic structure of the new entry is copied as is to the database.  The
  // variable-sized portion of each descriptor is copied into the heap and then
  // the pointer to that data from the database is adjusted to point into the
  // heap.
  MEMCOPY(&database[index], entry, sizeof(EmberAfRf4ceMsoIrRfDatabaseEntry));
  database[index].rfPressedDescriptor.payload
    = copyRfPayload(emberAfRf4ceMsoIrRfDatabaseEntryHasRfPressedDescriptor(entry),
                    &entry->rfPressedDescriptor);
  database[index].rfRepeatedDescriptor.payload
    = copyRfPayload(emberAfRf4ceMsoIrRfDatabaseEntryHasRfRepeatedDescriptor(entry),
                    &entry->rfRepeatedDescriptor);
  database[index].rfReleasedDescriptor.payload
    = copyRfPayload(emberAfRf4ceMsoIrRfDatabaseEntryHasRfReleasedDescriptor(entry),
                    &entry->rfReleasedDescriptor);
  database[index].irDescriptor.irCode
    = copyIrCode(emberAfRf4ceMsoIrRfDatabaseEntryHasIrDescriptor(entry),
                 &entry->irDescriptor);

  return EMBER_SUCCESS;
}
コード例 #21
0
CED2KFriendLink::CED2KFriendLink(LPCTSTR userName, uchar userHash[])
{
	m_sUserName = userName;
	MEMCOPY(m_hash, userHash, 16*sizeof(uchar));
}
コード例 #22
0
ファイル: jchuff.c プロジェクト: m-berkani/ClearCanvas
jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
{
#define MAX_CLEN 32		/* assumed maximum initial code length */
    UINT8 bits[MAX_CLEN+1];	/* bits[k] = # of symbols with code length k */
    int codesize[257];		/* codesize[k] = code length of symbol k */
    int others[257];		/* next symbol in current branch of tree */
    int c1, c2;
    int p, i, j;
    long v;

    /* This algorithm is explained in section K.2 of the JPEG standard */

    MEMZERO(bits, SIZEOF(bits));
    MEMZERO(codesize, SIZEOF(codesize));
    for (i = 0; i < 257; i++)
        others[i] = -1;		/* init links to empty */

    freq[256] = 1;		/* make sure 256 has a nonzero count */
    /* Including the pseudo-symbol 256 in the Huffman procedure guarantees
     * that no real symbol is given code-value of all ones, because 256
     * will be placed last in the largest codeword category.
     */

    /* Huffman's basic algorithm to assign optimal code lengths to symbols */

    for (;;) {
        /* Find the smallest nonzero frequency, set c1 = its symbol */
        /* In case of ties, take the larger symbol number */
        c1 = -1;
        v = 1000000000L;
        for (i = 0; i <= 256; i++) {
            if (freq[i] && freq[i] <= v) {
                v = freq[i];
                c1 = i;
            }
        }

        /* Find the next smallest nonzero frequency, set c2 = its symbol */
        /* In case of ties, take the larger symbol number */
        c2 = -1;
        v = 1000000000L;
        for (i = 0; i <= 256; i++) {
            if (freq[i] && freq[i] <= v && i != c1) {
                v = freq[i];
                c2 = i;
            }
        }

        /* Done if we've merged everything into one frequency */
        if (c2 < 0)
            break;

        /* Else merge the two counts/trees */
        freq[c1] += freq[c2];
        freq[c2] = 0;

        /* Increment the codesize of everything in c1's tree branch */
        codesize[c1]++;
        while (others[c1] >= 0) {
            c1 = others[c1];
            codesize[c1]++;
        }

        others[c1] = c2;		/* chain c2 onto c1's tree branch */

        /* Increment the codesize of everything in c2's tree branch */
        codesize[c2]++;
        while (others[c2] >= 0) {
            c2 = others[c2];
            codesize[c2]++;
        }
    }

    /* Now count the number of symbols of each code length */
    for (i = 0; i <= 256; i++) {
        if (codesize[i]) {
            /* The JPEG standard seems to think that this can't happen, */
            /* but I'm paranoid... */
            if (codesize[i] > MAX_CLEN)
                ERREXIT(cinfo, JERR_HUFF_CLEN_OVERFLOW);

            bits[codesize[i]]++;
        }
    }

    /* JPEG doesn't allow symbols with code lengths over 16 bits, so if the pure
     * Huffman procedure assigned any such lengths, we must adjust the coding.
     * Here is what the JPEG spec says about how this next bit works:
     * Since symbols are paired for the longest Huffman code, the symbols are
     * removed from this length category two at a time.  The prefix for the pair
     * (which is one bit shorter) is allocated to one of the pair; then,
     * skipping the BITS entry for that prefix length, a code word from the next
     * shortest nonzero BITS entry is converted into a prefix for two code words
     * one bit longer.
     */

    for (i = MAX_CLEN; i > 16; i--) {
        while (bits[i] > 0) {
            j = i - 2;		/* find length of new prefix to be used */
            while (bits[j] == 0)
                j--;

            bits[i] -= 2;		/* remove two symbols */
            bits[i-1]++;		/* one goes in this length */
            bits[j+1] += 2;		/* two new symbols in this length */
            bits[j]--;		/* symbol of this length is now a prefix */
        }
    }

    /* Remove the count for the pseudo-symbol 256 from the largest codelength */
    while (bits[i] == 0)		/* find largest codelength still in use */
        i--;
    bits[i]--;

    /* Return final symbol counts (only for lengths 0..16) */
    MEMCOPY(htbl->bits, bits, SIZEOF(htbl->bits));

    /* Return a list of the symbols sorted by code length */
    /* It's not real clear to me why we don't need to consider the codelength
     * changes made above, but the JPEG spec seems to think this works.
     */
    p = 0;
    for (i = 1; i <= MAX_CLEN; i++) {
        for (j = 0; j <= 255; j++) {
            if (codesize[j] == i) {
                htbl->huffval[p] = (UINT8) j;
                p++;
            }
        }
    }

    /* Set sent_table FALSE so updated table will be written to JPEG file. */
    htbl->sent_table = FALSE;
}
コード例 #23
0
/*! Helper inline function for setting an incoming connection device's
    clusters list and length of that list
*/
static inline void SetInConnEUI64Address(const EmberEUI64 in_eui64) {
  MatchDescriptorReq_t *in_dev = GetTopInDeviceDescriptor();
  assert(in_dev != NULL);
  MEMCOPY(in_dev->source_eui64, in_eui64, EUI64_SIZE);
}
コード例 #24
0
ファイル: lp_SOS.c プロジェクト: SimonRit/RTK
int SOS_member_delete(SOSgroup *group, int sosindex, int member)
{
  int   *list, i, i2, k, n, nn = 0;
  SOSrec *SOS;
  lprec  *lp = group->lp;

#ifdef Paranoia
  if((sosindex < 0) || (sosindex > group->sos_count)) {
    report(group->lp, IMPORTANT, "SOS_member_delete: Invalid SOS index %d\n", sosindex);
    return( -1 );
  }
#endif

  if(sosindex == 0) {
    for(i = group->memberpos[member-1]; i < group->memberpos[member]; i++) {
      k = group->membership[i];
      n = SOS_member_delete(group, k, member);
      if(n >= 0)
        nn += n;
      else
        return( n );
    }
    /* We must update the mapper */
    k = group->memberpos[member];
    i = group->memberpos[member-1];
    n = group->memberpos[lp->columns] - k;
    if(n > 0)
      MEMCOPY(group->membership + i, group->membership + k, n);
    for(i = member; i <= lp->columns; i++)
      group->memberpos[i] = group->memberpos[i-1];
  }
  else {
    SOS = group->sos_list[sosindex-1];
    list = SOS->members;
    n = list[0];

    /* Find the offset of the member */
    i = 1;
    while((i <= n) && (abs(list[i]) != member))
      i++;
    if(i > n)
      return( -1 );
    nn++;

    /* Shift remaining members *and* the active count one position left */
    while(i <= n) {
      list[i] = list[i+1];
      i++;
    }
    list[0]--;
    SOS->size--;

    /* Do the same with the active list one position left */
    i = n + 1;
    i2 = i + list[n];
    k = i + 1;
    while(i < i2) {
      if(abs(list[k]) == member)
        k++;
      list[i] = list[k];
      i++;
      k++;
    }
  }

  return( nn );
}
コード例 #25
0
static ya_result
buffer_input_stream_read(input_stream* stream, u8* buffer, u32 len)
{
    buffer_input_stream_data* data = (buffer_input_stream_data*)stream->data;
    u8* src = data->buffer;

    ya_result ret;

    u32 remaining = data->buffer_size - data->buffer_offset;

    if(len <= remaining)
    {
        MEMCOPY(buffer, &src[data->buffer_offset], len);
        data->buffer_offset += len;

        /* There are still some bytes available */

        return len;
    }

    /* len >= remaining : copy what remains in the buffer */

    MEMCOPY(buffer, &src[data->buffer_offset], remaining);
    len -= remaining;
    buffer += remaining;

    /* NOTE: at this point the internal buffer is empty */

    if(len >= data->buffer_maxsize)
    {
        /* It would be pointless to buffer a read bigger than the buffer */

        data->buffer_offset = data->buffer_size; /* mark the buffer as "empty" */

        if(ISOK(ret = input_stream_read(&data->filtered, buffer, len)))
        {
            return remaining + ret; /* the chunk we've read from the buffer +
				   the chunk we've read from the stream */
        }
        else // 'remaining' bytes may have been copied already, if so, return that before the error
        {
            return (remaining > 0)?remaining:ret;
        }
    }

#ifdef DEBUG
    memset(data->buffer, 0xee, data->buffer_maxsize);
#endif

    // What remains to read is smaller than the buffer max size:
    // read a full buffer

    if((ret = input_stream_read(&data->filtered, data->buffer, data->buffer_maxsize)) <= 0)
    {
        data->buffer_size = 0;
        data->buffer_offset = 0;
        
        // 'remaining' bytes may have been copied already, if so, return that before the error

        return (remaining > 0) ? remaining : ERROR /* eof */;
    }
    
    if(len > ret)
    {
        len = ret;
    }

    MEMCOPY(buffer, data->buffer, len); /* starts at offset 0 */

    data->buffer_size = ret;
    data->buffer_offset = len;

    return remaining + len;
}
コード例 #26
0
void tmspHostSetEui64PostHook(const EmberEui64 *eui64)
{
  MEMCOPY(localEui64.bytes, eui64->bytes, 8);
}
コード例 #27
0
ファイル: Jcmcu.c プロジェクト: adamjoniec/theimp
LOCAL void
extract_block (JSAMPARRAY input_data, int start_row, long start_col,
	       JBLOCK output_data, QUANT_TBL_PTR quanttbl)
/* Extract one 8x8 block from the specified location in the sample array; */
/* perform forward DCT, quantization scaling, and zigzag reordering on it. */
{
  /* This routine is heavily used, so it's worth coding it tightly. */
  DCTBLOCK block;
#ifdef DCT_ERR_STATS
  DCTBLOCK svblock;		/* saves input data for comparison */
#endif

  { register JSAMPROW elemptr;
    register DCTELEM *localblkptr = block;
    register int elemr;

    for (elemr = DCTSIZE; elemr > 0; elemr--) {
      elemptr = input_data[start_row++] + start_col;
#if DCTSIZE == 8		/* unroll the inner loop */
      *localblkptr++ = (DCTELEM) (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
      *localblkptr++ = (DCTELEM) (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
      *localblkptr++ = (DCTELEM) (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
      *localblkptr++ = (DCTELEM) (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
      *localblkptr++ = (DCTELEM) (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
      *localblkptr++ = (DCTELEM) (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
      *localblkptr++ = (DCTELEM) (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
      *localblkptr++ = (DCTELEM) (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
#else
      { register int elemc;
	for (elemc = DCTSIZE; elemc > 0; elemc--) {
	  *localblkptr++ = (DCTELEM) (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
	}
      }
#endif
    }
  }

#ifdef DCT_ERR_STATS
  MEMCOPY(svblock, block, SIZEOF(DCTBLOCK));
#endif

  j_fwd_dct(block);

  { register JCOEF temp;
    register QUANT_VAL qval;
    register int i;

    for (i = 0; i < DCTSIZE2; i++) {
      qval = *quanttbl++;
      temp = (JCOEF) block[ZAG[i]];
      /* Divide the coefficient value by qval, ensuring proper rounding.
       * Since C does not specify the direction of rounding for negative
       * quotients, we have to force the dividend positive for portability.
       *
       * In most files, at least half of the output values will be zero
       * (at default quantization settings, more like three-quarters...)
       * so we should ensure that this case is fast.  On many machines,
       * a comparison is enough cheaper than a divide to make a special test
       * a win.  Since both inputs will be nonnegative, we need only test
       * for a < b to discover whether a/b is 0.
       * If your machine's division is fast enough, define FAST_DIVIDE.
       */
#ifdef FAST_DIVIDE
#define DIVIDE_BY(a,b)	a /= b
#else
#define DIVIDE_BY(a,b)	(a >= b) ? (a /= b) : (a = 0)
#endif
      if (temp < 0) {
	temp = -temp;
	temp += qval>>1;	/* for rounding */
	DIVIDE_BY(temp, qval);
	temp = -temp;
      } else {
	temp += qval>>1;	/* for rounding */
	DIVIDE_BY(temp, qval);
      }
      *output_data++ = temp;
    }
コード例 #28
0
void emberGetNetworkParameters(EmberNetworkParameters *networkParams)
{
  MEMCOPY(networkParams, &networkCache, sizeof(EmberNetworkParameters));
}
コード例 #29
0
noscale(j_compress_ptr cinfo,
	JSAMPROW input_buf, JSAMPROW output_buf, JDIMENSION width)
{
  MEMCOPY(output_buf, input_buf, width * SIZEOF(JSAMPLE));
  return;
}
コード例 #30
0
// A pairing index value of 0xFF means "local attributes".
void emAfRf4ceZrcReadOrWriteAttribute(uint8_t pairingIndex,
                                      uint8_t attrId,
                                      uint16_t entryIdOrValueLength,
                                      bool isRead,
                                      uint8_t *val)
{
  bool localAttributes = (pairingIndex == 0xFF);
  EmAfRf4ceZrcAttributes *attributes = (localAttributes)
                                       ? &emAfRf4ceZrcLocalNodeAttributes
                                       : &emAfRf4ceZrcRemoteNodeAttributes;

  if (isRead) {
    switch (attrId) {
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_VERSION:
      val[0] = LOW_BYTE(attributes->zrcProfileVersion);
      val[1] = HIGH_BYTE(attributes->zrcProfileVersion);
      break;
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_CAPABILITIES:
    {
      uint32_t cababilities = ((pairingIndex == 0xFF)
                             ? emAfRf4ceZrcGetLocalNodeCapabilities()
                             : emAfRf4ceZrcGetRemoteNodeCapabilities(pairingIndex));
      val[0] = BYTE_0(cababilities);
      val[1] = BYTE_1(cababilities);
      val[2] = BYTE_2(cababilities);
      val[3] = BYTE_3(cababilities);
    }
      break;
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_ACTION_BANKS_SUPPORTED_RX:
      MEMCOPY(val, attributes->actionBanksSupportedRx->contents, ZRC_BITMASK_SIZE);
      break;
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_ACTION_BANKS_SUPPORTED_TX:
      MEMCOPY(val, attributes->actionBanksSupportedTx->contents, ZRC_BITMASK_SIZE);
      break;
#if (defined(EMBER_AF_PLUGIN_RF4CE_ZRC20_LOCAL_IRDB_VENDOR_ATTRIBUTE_SUPPORT)       \
     || defined(EMBER_AF_PLUGIN_RF4CE_ZRC20_REMOTE_IRDB_VENDOR_ATTRIBUTES_SUPPORT)  \
     || defined(EMBER_SCRIPTED_TEST))
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_IRDB_VENDOR_SUPPORT:
    {
      // Can't just perform a MEMCOPY, endianness matters.
      uint8_t i;
      uint8_t entriesNum = (localAttributes
                          ? EMBER_AF_RF4CE_ZRC_IRDB_VENDOR_ID_COUNT
                          : EMBER_AF_PLUGIN_RF4CE_ZRC20_REMOTE_IRDB_VENDORS_SUPPORTED_TABLE_SIZE);

      // Non-valid entries are set to EMBER_RF4CE_NULL_VENDOR_ID.
      for(i=0; (i<entriesNum
                && attributes->IRDBVendorSupport[i] != EMBER_RF4CE_NULL_VENDOR_ID);
          i++) {
        val[2*i] = LOW_BYTE(attributes->IRDBVendorSupport[i]);
        val[2*i+1] = HIGH_BYTE(attributes->IRDBVendorSupport[i]);
      }
    }
      break;
#endif // EMBER_AF_PLUGIN_RF4CE_ZRC20_LOCAL_IRDB_VENDOR_ATTRIBUTE_SUPPORT || EMBER_AF_PLUGIN_RF4CE_ZRC20_REMOTE_IRDB_VENDOR_ATTRIBUTES_SUPPORT
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_ACTION_BANKS_VERSION:
      val[0] = LOW_BYTE(attributes->zrcActionBanksVersion);
      val[1] = HIGH_BYTE(attributes->zrcActionBanksVersion);
      break;
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_ACTION_CODES_SUPPORTED_RX:
#if (defined (EMBER_AF_RF4CE_ZRC_IS_HA_ACTIONS_RECIPIENT) || defined(EMBER_SCRIPTED_TEST))
      // RX action codes related to HA action banks should be all 0xFF if the
      // node is an HA actions recipient.
      if (entryIdOrValueLength >= EMBER_AF_RF4CE_ZRC_ACTION_BANK_HOME_AUTOMATION_INSTANCE_0
          && entryIdOrValueLength <= EMBER_AF_RF4CE_ZRC_ACTION_BANK_HOME_AUTOMATION_INSTANCE_31) {
        MEMSET(val, 0xFF, ZRC_BITMASK_SIZE);
        break;
      }
      // Fall-through here
#endif // EMBER_AF_RF4CE_ZRC_IS_HA_ACTIONS_RECIPIENT
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_ACTION_CODES_SUPPORTED_TX:
    {
      uint8_t *attrPtr = emAfRf4ceZrcGetActionCodesAttributePointer(attrId,
                                                                  entryIdOrValueLength,
                                                                  pairingIndex);
      assert(attrPtr != NULL);
      MEMCOPY(val, attrPtr, ZRC_BITMASK_SIZE);
      break;
    }
#if defined(EMBER_AF_PLUGIN_RF4CE_ZRC20_ACTION_MAPPING_SUPPORT) || defined(EMBER_SCRIPTED_TEST)
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_MAPPABLE_ACTIONS:
    {
      EmberAfRf4ceZrcMappableAction mappableAction;
      assert (emberAfPluginRf4ceZrc20GetMappableActionCallback(pairingIndex,
                                                               entryIdOrValueLength,
                                                               &mappableAction)
              == EMBER_SUCCESS);

      val[MAPPABLE_ACTION_ACTION_DEVICE_TYPE_OFFSET] = mappableAction.actionDeviceType;
      val[MAPPABLE_ACTION_ACTION_BANK_OFFSET] = mappableAction.actionBank;
      val[MAPPABLE_ACTION_ACTION_CODE_OFFSET] = mappableAction.actionCode;
    }
      break;
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_ACTION_MAPPINGS:
    {
      EmberAfRf4ceZrcActionMapping actionMapping;
      assert (emberAfPluginRf4ceZrc20GetActionMappingCallback(pairingIndex,
                                                              entryIdOrValueLength,
                                                              &actionMapping)
              == EMBER_SUCCESS);

      *val++ = actionMapping.mappingFlags;
      if (READBITS(actionMapping.mappingFlags,
                   (EMBER_AF_RF4CE_ZRC_ACTION_MAPPING_MAPPING_FLAGS_RF_SPECIFIED_BIT
                     | EMBER_AF_RF4CE_ZRC_ACTION_MAPPING_MAPPING_FLAGS_USE_DEFAULT_BIT))
          == EMBER_AF_RF4CE_ZRC_ACTION_MAPPING_MAPPING_FLAGS_RF_SPECIFIED_BIT) {
        *val++ = actionMapping.rfConfig;
        *val++ = actionMapping.rf4ceTxOptions;
        *val++ = actionMapping.actionDataLength;
        assert(actionMapping.actionData != NULL);
        MEMCOPY(val, actionMapping.actionData, actionMapping.actionDataLength);
        val += actionMapping.actionDataLength;
      }

      if (READBITS(actionMapping.mappingFlags,
                   (EMBER_AF_RF4CE_ZRC_ACTION_MAPPING_MAPPING_FLAGS_IR_SPECIFIED_BIT
                     | EMBER_AF_RF4CE_ZRC_ACTION_MAPPING_MAPPING_FLAGS_USE_DEFAULT_BIT))
          == EMBER_AF_RF4CE_ZRC_ACTION_MAPPING_MAPPING_FLAGS_IR_SPECIFIED_BIT) {
        *val++ = actionMapping.irConfig;
        if (actionMapping.irConfig
            & ACTION_MAPPING_IR_CONFIG_VENDOR_SPECIFIC_BIT) {
          *val++ = LOW_BYTE(actionMapping.irVendorId);
          *val++ = HIGH_BYTE(actionMapping.irVendorId);
        }
        *val++ = actionMapping.irCodeLength;
        assert(actionMapping.irCode != NULL);
        MEMCOPY(val, actionMapping.irCode, actionMapping.irCodeLength);
      }
    }
      break;
#endif // EMBER_AF_PLUGIN_RF4CE_ZRC20_ACTION_MAPPING_SUPPORT

#if (defined(EMBER_AF_RF4CE_ZRC_IS_HA_ACTIONS_ORIGINATOR)             \
     || defined (EMBER_AF_RF4CE_ZRC_IS_HA_ACTIONS_RECIPIENT)          \
     || defined(EMBER_SCRIPTED_TEST))
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_HOME_AUTOMATION:
      // This attribute can only be pulled and is stored at the application.
      // This plugin can only access this attribute via callback. As result,
      // we will get here only after having called (and it returns 'success')
      // emAfRf4ceZrcIsArrayedAttributeSupported() in the pullAttributes()
      // handler function. emAfRf4ceZrcIsArrayedAttributeSupported() saves the
      // contents in the static object tempHaAttribute. So we just copy it
      // here.
      assert(tempHaAttribute.contentsLength < (MAX_ZRC_ATTRIBUTE_SIZE - 1));
      *val++ = HA_ATTRIBUTE_STATUS_VALUE_AVAILABLE_FLAG;
      MEMCOPY(val, tempHaAttribute.contents, tempHaAttribute.contentsLength);
      break;
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_HOME_AUTOMATION_SUPPORTED:
      emberAfPluginRf4ceZrc20GetHomeAutomationSupportedCallback(pairingIndex,
                                                                entryIdOrValueLength,
                                                                (EmberAfRf4ceZrcHomeAutomationSupported*)val);
      break;
#endif // EMBER_AF_RF4CE_ZRC_IS_HA_ACTIONS_ORIGINATOR || EMBER_AF_RF4CE_ZRC_IS_HA_ACTIONS_RECIPIENT
    }
  } else { // !isRead
    switch (attrId) {
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_VERSION:
      attributes->zrcProfileVersion = HIGH_LOW_TO_INT(val[1], val[0]);
      break;
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_CAPABILITIES:
      // We only allow setting remote nodes capabilities.
      if (pairingIndex < 0xFF) {
        emAfRf4ceZrcSetRemoteNodeCapabilities(pairingIndex,
                                              emberFetchLowHighInt32u(val));
      }
      break;
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_ACTION_BANKS_SUPPORTED_RX:
      MEMCOPY(attributes->actionBanksSupportedRx->contents, val, ZRC_BITMASK_SIZE);
      break;
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_ACTION_BANKS_SUPPORTED_TX:
      MEMCOPY(attributes->actionBanksSupportedTx->contents, val, ZRC_BITMASK_SIZE);
      break;
#if defined(EMBER_AF_PLUGIN_RF4CE_ZRC20_REMOTE_IRDB_VENDOR_ATTRIBUTES_SUPPORT) || defined(EMBER_SCRIPTED_TEST)
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_IRDB_VENDOR_SUPPORT:
    {
      // Only remote IRDB vendor support attributes can written.
      uint8_t i;
      for (i=0; i < EMBER_AF_PLUGIN_RF4CE_ZRC20_REMOTE_IRDB_VENDORS_SUPPORTED_TABLE_SIZE; i++) {
        uint16_t vendorId;
        if (i < entryIdOrValueLength / 2) {
          vendorId = HIGH_LOW_TO_INT(val[2*i+1], val[2*i]);
        } else {
          // The rest of the entries are set to NULL_VENDOR_ID.
          vendorId = EMBER_RF4CE_NULL_VENDOR_ID;
        }

        attributes->IRDBVendorSupport[i] = vendorId;

#if defined(EMBER_SCRIPTED_TEST)
        simpleScriptCheck("", "Remote IRDB attribute, entry set", "ii",
                          i,
                          vendorId);
#endif // EMBER_SCRIPTED_TEST
      }
    }
      break;
#endif // EMBER_AF_PLUGIN_RF4CE_ZRC20_REMOTE_IRDB_VENDOR_ATTRIBUTES_SUPPORT
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_ACTION_BANKS_VERSION:
      attributes->zrcActionBanksVersion = HIGH_LOW_TO_INT(val[1], val[0]);
      break;
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_ACTION_CODES_SUPPORTED_RX:
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_ACTION_CODES_SUPPORTED_TX:
    {
      uint8_t *attrPtr = emAfRf4ceZrcGetActionCodesAttributePointer(attrId,
                                                                  entryIdOrValueLength,
                                                                  pairingIndex);
      assert(attrPtr != NULL);
      MEMCOPY(attrPtr, val, ZRC_BITMASK_SIZE);
      break;
    }

#if defined(EMBER_AF_PLUGIN_RF4CE_ZRC20_ACTION_MAPPING_SUPPORT) || defined(EMBER_SCRIPTED_TEST)
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_MAPPABLE_ACTIONS:
    {
      EmberAfRf4ceZrcMappableAction mappableAction;
      mappableAction.actionDeviceType = val[0];
      mappableAction.actionBank = val[1];
      mappableAction.actionCode = val[2];
      emberAfPluginRf4ceZrc20IncomingMappableActionCallback(emberAfRf4ceGetPairingIndex(),
                                                            entryIdOrValueLength,
                                                            &mappableAction);
    }
      break;
    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_ACTION_MAPPINGS:
    {
      EmberAfRf4ceZrcActionMapping actionMapping;
      uint8_t *finger = val;
      actionMapping.actionData = NULL;
      actionMapping.irCode = NULL;

      // Mapping flags
      actionMapping.mappingFlags = *finger++;

      // RF descriptor
      if (READBITS(actionMapping.mappingFlags,
                   (EMBER_AF_RF4CE_ZRC_ACTION_MAPPING_MAPPING_FLAGS_RF_SPECIFIED_BIT
                     | EMBER_AF_RF4CE_ZRC_ACTION_MAPPING_MAPPING_FLAGS_USE_DEFAULT_BIT))
          == EMBER_AF_RF4CE_ZRC_ACTION_MAPPING_MAPPING_FLAGS_RF_SPECIFIED_BIT) {
        actionMapping.rfConfig = *finger++;
        actionMapping.rf4ceTxOptions = *finger++;
        actionMapping.actionDataLength = *finger++;
        actionMapping.actionData = finger;
        finger += actionMapping.actionDataLength;
      }

      // IR descriptor
      if (READBITS(actionMapping.mappingFlags,
                   (EMBER_AF_RF4CE_ZRC_ACTION_MAPPING_MAPPING_FLAGS_IR_SPECIFIED_BIT
                     | EMBER_AF_RF4CE_ZRC_ACTION_MAPPING_MAPPING_FLAGS_USE_DEFAULT_BIT))
          == EMBER_AF_RF4CE_ZRC_ACTION_MAPPING_MAPPING_FLAGS_IR_SPECIFIED_BIT) {
        actionMapping.irConfig = *finger++;
        if (actionMapping.irConfig
            & ACTION_MAPPING_IR_CONFIG_VENDOR_SPECIFIC_BIT) {
          actionMapping.irVendorId = HIGH_LOW_TO_INT(finger[1], finger[0]);
          finger += 2;
        }
        actionMapping.irCodeLength = *finger++;
        actionMapping.irCode = finger;
      }

      emberAfPluginRf4ceZrc20IncomingActionMappingCallback(emberAfRf4ceGetPairingIndex(),
                                                           entryIdOrValueLength,
                                                           &actionMapping);
    }
      break;
#endif // EMBER_AF_PLUGIN_RF4CE_ZRC20_ACTION_MAPPING_SUPPORT

#if (defined(EMBER_AF_RF4CE_ZRC_IS_HA_ACTIONS_ORIGINATOR)             \
     || defined (EMBER_AF_RF4CE_ZRC_IS_HA_ACTIONS_RECIPIENT)          \
     || defined(EMBER_SCRIPTED_TEST))

    // EMBER_AF_RF4CE_ZRC_ATTRIBUTE_HOME_AUTOMATION attributes sets are handled
    // in the HA action code.

    case EMBER_AF_RF4CE_ZRC_ATTRIBUTE_HOME_AUTOMATION_SUPPORTED:
      emberAfPluginRf4ceZrc20IncomingHomeAutomationSupportedCallback(emberAfRf4ceGetPairingIndex(),
                                                                     entryIdOrValueLength,
                                                                     (EmberAfRf4ceZrcHomeAutomationSupported*)val);
      break;
#endif // EMBER_AF_RF4CE_ZRC_IS_HA_ACTIONS_ORIGINATOR || EMBER_AF_RF4CE_ZRC_IS_HA_ACTIONS_RECIPIENT
    }
  }
}