本文整理汇总了C++中HEADER函数的典型用法代码示例。如果您正苦于以下问题:C++ HEADER函数的具体用法?C++ HEADER怎么用?C++ HEADER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HEADER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HEADER
bool videoInputCamera::setSizeAndSubtype() {
//store current mediatype
AM_MEDIA_TYPE * tmpType = NULL;
HRESULT hr = pStreamConfig->GetFormat(&tmpType);
if(hr != S_OK)return false;
VIDEOINFOHEADER *lpVih = reinterpret_cast<VIDEOINFOHEADER*>(pAmMediaType->pbFormat);
HEADER(lpVih)->biWidth = cfg->cam_width;
HEADER(lpVih)->biHeight = cfg->cam_height;
pAmMediaType->formattype = FORMAT_VideoInfo;
pAmMediaType->majortype = MEDIATYPE_Video;
pAmMediaType->subtype = getMediaSubtype(cfg->cam_format);
//buffer size
pAmMediaType->lSampleSize = cfg->cam_width* cfg->cam_height*3;
//set fps if requested
lpVih->AvgTimePerFrame = (unsigned long)(10000000 / cfg->cam_fps);
//okay lets try new size
hr = pStreamConfig->SetFormat(pAmMediaType);
if(hr == S_OK){
if( tmpType != NULL )deleteMediaType(tmpType);
return true;
}else{
pStreamConfig->SetFormat(tmpType);
if( tmpType != NULL )deleteMediaType(tmpType);
}
return false;
}
示例2: sort_ide_block
/* sort the IDE block as per the typelib spec: IID order, unresolved first */
static void
sort_ide_block(TreeState *state)
{
XPTInterfaceDirectoryEntry *ide;
int i;
/* boy, I sure hope qsort works correctly everywhere */
#ifdef DEBUG_shaver_sort
fputs("before sort:\n", stderr);
for (i = 0; i < IFACES(state); i++) {
fputs(" ", stderr);
print_IID(&HEADER(state)->interface_directory[i].iid, stderr);
fputc('\n', stderr);
}
#endif
qsort(HEADER(state)->interface_directory, IFACES(state),
sizeof(*ide), compare_IDEs);
#ifdef DEBUG_shaver_sort
fputs("after sort:\n", stderr);
for (i = 0; i < IFACES(state); i++) {
fputs(" ", stderr);
print_IID(&HEADER(state)->interface_directory[i].iid, stderr);
fputc('\n', stderr);
}
#endif
for (i = 0; i < IFACES(state); i++) {
ide = HEADER(state)->interface_directory + i;
g_hash_table_insert(IFACE_MAP(state), ide->name, (void *)(i + 1));
}
return;
}
示例3: eequal
rt_public EIF_BOOLEAN eequal(register EIF_REFERENCE target, register EIF_REFERENCE source)
{
/* Eiffel standard equality: it assumes that dynamic type of Eiffel
* object refered by `source' conforms to dynamic type of Eiffel
* object refered by `target'. `source' and `target' cannot be NULL
* or special objects here.
* If both `source' and `target' have the same dynamic type and this
* type is not composite, then perform a block comparison; otherwise
* perform a field by field comparison.
* It is the feature `standard_is_equal' of class ANY.
* Return a boolean.
*/
REQUIRE ("source_not_null", source);
REQUIRE ("target_not_null", target);
if (source == target) {
/* Minor optimization, if references are equal then it is the same object. */
return EIF_TRUE;
}
if (Dftype(source) == Dftype(target)) {
/* Dynamic type are the same: because of the intra-expanded
* references, we can perform only a block comparison if
* the target (or the source) is a composite object (i.e: it has
* expanded attributes): since an attribute keeps expanded or
* not expanded all the time, we can test either the source or
* the target.
*/
if (HEADER(source)->ov_flags & EO_SPEC) {
/* Works for both SPECIAL and TUPLE object */
/* Eiffel standard equality on special objects: type check assumes
* the comparison is on areas of the same type (containing the same
* thing). Called by the redefinition of feature `equal' of special
* class. `source' and/or `target' cannot be NULL.
* Return a boolean.
*/
/* First condition: same count */
if
((RT_SPECIAL_COUNT(source) != RT_SPECIAL_COUNT(target)) ||
(RT_SPECIAL_ELEM_SIZE(source) != RT_SPECIAL_ELEM_SIZE(target)))
{
return EIF_FALSE;
} else {
/* Second condition: block equality */
return EIF_TEST(!memcmp (source, target, RT_SPECIAL_VISIBLE_SIZE(source)));
}
} else {
if (!(HEADER(source)->ov_flags & EO_COMP)) /* Perform a block comparison */
return EIF_TEST(!memcmp (source, target, EIF_Size(Dtype(source))));
else
return e_field_equal(target, source);
}
}
/* Field by field comparison */
return EIF_FALSE;
}
示例4: http_request_ok
gboolean http_request_ok (http_request *h) {
guint hdr_len = http_get_hdr_len( h->buffer->str );
guint c_len;
if (hdr_len != 0) {
if(CONFd("Verbosity") >= 8) g_warning( "http_request_ok: hdr_len %d", hdr_len );
if ( HEADER("Content-length") && (c_len=atoi(HEADER("Content-length")) <= (h->buffer->len - hdr_len)) ) {
if(CONFd("Verbosity") >= 8) g_warning( "http_request_ok: Parsing query from HTTP-Content." );
http_parse_query( h, &(h->buffer->str[hdr_len]) );
h->complete++;
if(CONFd("Verbosity") >= 8) g_warning( "http_request_ok: Query parsing finished, exiting." );
return TRUE;
}
else if (HEADER("Content-length") && (CONFd("Verbosity") >= 8))
g_warning( "http_request_ok: HEADER was OK, but CONTENT reading failed." );
else if(CONFd("Verbosity") >= 8)
g_warning( "http_request_ok: No Content-length header, parsing query from URI." );
http_parse_query( h, NULL );
if (!h->query) {
if (CONFd("Verbosity") >= 8) g_message("http_request_ok: No QUERY found.");
}
else if (CONFd("Verbosity") >= 8) {
GString *z;
z = g_hash_as_string( h->query );
g_debug( "http_request_ok: Query: %s", z->str );
g_string_free(z, 1);
}
h->complete++;
if(CONFd("Verbosity") >= 8) g_warning( "http_request_ok: Query parsing finished, exiting." );
return TRUE;
}
if(CONFd("Verbosity") >= 6) g_warning( "http_request_ok: Request not HTTP: <CR><LF><CR><LF> (header_end) NOT found" );
return FALSE;
}
示例5: eif_std_ref_copy
rt_public void eif_std_ref_copy(register EIF_REFERENCE source, register EIF_REFERENCE target)
{
/* Copy Eiffel object `source' into Eiffel object `target'.
* Dynamic type of `source' is supposed to be the same as dynamic type
* of `target'. It assumes also that `source' and `target' are not
* references on special objects.
* Problem: updating intra-references on expanded object
* because the garbage collector needs to explore those references.
*/
uint16 flags; /* Source object flags */
union overhead *s_zone; /* Source object header */
union overhead *t_zone; /* Target object header */
#ifdef ISE_GC
EIF_REFERENCE enclosing; /* Enclosing target object */
#endif
rt_uint_ptr size;
s_zone = HEADER(source);
flags = s_zone->ov_flags;
t_zone = HEADER(target);
if (s_zone->ov_dftype == t_zone->ov_dftype) {
if (flags & EO_COMP) {
/* Case of composite object: updating of references on expanded objects. */
eif_std_field_copy (source, target);
} else {
/* Copy of source object into target object with same dynamic type. Block copy here. */
if (flags & EO_SPEC) {
size = RT_SPECIAL_VISIBLE_SIZE(source);
} else {
size = EIF_Size(s_zone->ov_dtype);
}
memmove(target, source, size);
}
#ifdef ISE_GC
/* Precompute the enclosing target object */
enclosing = target; /* By default */
if (eif_is_nested_expanded(t_zone->ov_flags)) {
enclosing -= t_zone->ov_size & B_SIZE;
}
/* Perform aging tests. We need the address of the enclosing object to
* update the flags there, in case the target is to be memorized.
*/
flags = HEADER(enclosing)->ov_flags;
CHECK ("Not forwarded", !(HEADER (enclosing)->ov_size & B_FWD));
if (
flags & EO_OLD && /* Object is old */
!(flags & EO_REM) && /* Not remembered */
refers_new_object(target) /* And copied refers to new objects */
)
erembq(enclosing); /* Then remember the enclosing object */
#endif /* ISE_GC */
}
}
示例6: cm_TRC_traceLoadMap
void cm_TRC_traceLoadMap(
t_nmfTraceComponentCommandDescription command,
const t_component_instance* component)
{
if(cm_trace_enabled)
{
struct t_nmfTraceComponent trace;
/*
* Generate instantiate trace
*/
trace.header.v = HEADER(TRACE_TYPE_COMPONENT, sizeof(trace));
trace.command = (t_uint16)command;
trace.domainId = (t_uint16)component->Template->dspId + 1;
trace.componentContext = (t_uint32)component->thisAddress;
trace.componentUserContext = (t_uint32)component;
cm_StringCopy((char*)trace.componentLocalName, component->pathname, MAX_COMPONENT_NAME_LENGTH);
cm_StringCopy((char*)trace.componentTemplateName, component->Template->name, MAX_TEMPLATE_NAME_LENGTH);
writeN((struct t_nmfTraceChannelHeader*)&trace);
if(command == TRACE_COMPONENT_COMMAND_ADD)
{
struct t_nmfTraceMethod tracemethod;
int i, j, k;
/*
* Generate method trace
*/
tracemethod.header.v = HEADER(TRACE_TYPE_METHOD, sizeof(tracemethod));
tracemethod.domainId = (t_uint16)component->Template->dspId + 1;
tracemethod.componentContext = (t_uint32)component->thisAddress;
for(i = 0; i < component->Template->provideNumber; i++)
{
t_interface_provide* provide = &component->Template->provides[i];
t_interface_provide_loaded* provideLoaded = &component->Template->providesLoaded[i];
for(j = 0; j < provide->collectionSize; j++)
{
for(k = 0; k < provide->interface->methodNumber; k++)
{
tracemethod.methodId = provideLoaded->indexesLoaded[j][k].methodAddresses;
cm_StringCopy((char*)tracemethod.methodName, provide->interface->methodNames[k], MAX_INTERFACE_METHOD_NAME_LENGTH);
writeN((struct t_nmfTraceChannelHeader*)&tracemethod);
}
}
}
}
}
}
示例7: spcopy
rt_private void spcopy(register EIF_REFERENCE source, register EIF_REFERENCE target)
{
/* Copy a special Eiffel object into another one. It assumes that
* `source' and `target' are not NULL and that count of `target' is greater
* than count of `source'.
*/
rt_uint_ptr field_size;
rt_uint_ptr t_count, s_count;
#ifdef ISE_GC
uint16 flags;
#endif
REQUIRE ("source not null", source);
REQUIRE ("target not null", target);
REQUIRE ("source is special", HEADER(source)->ov_flags & EO_SPEC);
REQUIRE ("target is special", HEADER(target)->ov_flags & EO_SPEC);
REQUIRE ("target_elem_size_identical", RT_SPECIAL_ELEM_SIZE(target) == RT_SPECIAL_ELEM_SIZE(source));
/* Because we can call copy with special/tuples of different size, we have to take the min size
* of the two objects to know exactly how much we are allowed to copy without causing a
* memory corruption. In case users actually call `copy' directly, not indirectly via `twin',
* the postcondition of `copy' will be violated, although it would have been better to have
* a precondition it is much better than memory corruption.*/
/* FIXME: Once `copy' is not exported anymore to ANY, but just TUPLE/SPECIAL then we will be able
* to add RT_SPECIAL_COUNT(target) == RT_SPECIAL_COUNT(source) as precondition of `spcopy'.*/
t_count = RT_SPECIAL_COUNT(target);
s_count = RT_SPECIAL_COUNT(source);
field_size = (t_count > s_count ? s_count : t_count) * (rt_uint_ptr) RT_SPECIAL_ELEM_SIZE (source);
memmove(target, source, field_size); /* Block copy */
#ifdef ISE_GC
/* Ok, normally we would have to perform age tests, by scanning the special
* object, looking for new objects. But a special object can be really big,
* and can also contain some expanded objects, which should be traversed
* to see if they contain any new objects. Ok, that's enough! This is a
* GC problem and is normally performed by the GC. So, if the special object
* is old and contains some references, I am automatically inserting it
* in the remembered set. The GC will remove it from there at the next
* cycle, if necessary--RAM.
*/
flags = HEADER(target)->ov_flags;
CHECK ("Not forwarded", !(HEADER (target)->ov_flags & B_FWD));
if ((flags & (EO_REF | EO_OLD | EO_REM)) == (EO_OLD | EO_REF))
/* May it hold new references? */
eremb(target); /* Remember it, even if not needed, to fasten
copying process. */
#endif /* ISE_GC */
}
示例8: lynx_image_info
static void lynx_image_info(imgtool_image *img, char *string, const int len)
{
lynx_image *image=(lynx_image*)img;
char dostext_with_null[33]= { 0 };
char name_with_null[25]={ 0 };
strncpy(dostext_with_null, HEADER(image)->dostext, 32);
strncpy(name_with_null, HEADER(image)->description, 24);
sprintf(string,"%s\n%s\nversion:%.4x max entries:%d",
dostext_with_null,
name_with_null,
GET_UWORD(HEADER(image)->version),
HEADER(image)->max_entries);
}
示例9: init_dchat_v1
/**
* Initializes a DChat V1 structure containing all available and
* supported headers of the DChat V1 protocol.
* The given structure will be initialized with all headers
* available. The header IDs and names will be set and function addresses
* pointing to corresponding value parsers will be set too.
* @param proto
* @return 0 if structure has been initialized successfully, -1 otherwise
*/
int
init_dchat_v1(dchat_v1_t* proto)
{
int temp_size;
int proto_size;
// available headers
dchat_header_t temp[] =
{
HEADER(HDR_ID_VER, HDR_NAME_VER, 1, ver_str_to_pdu, ver_pdu_to_str),
HEADER(HDR_ID_CTT, HDR_NAME_CTT, 1, ctt_str_to_pdu, ctt_pdu_to_str),
HEADER(HDR_ID_CTL, HDR_NAME_CTL, 1, ctl_str_to_pdu, ctl_pdu_to_str),
HEADER(HDR_ID_ONI, HDR_NAME_ONI, 1, oni_str_to_pdu, oni_pdu_to_str),
HEADER(HDR_ID_LNP, HDR_NAME_LNP, 1, lnp_str_to_pdu, lnp_pdu_to_str),
HEADER(HDR_ID_NIC, HDR_NAME_NIC, 0, nic_str_to_pdu, nic_pdu_to_str),
HEADER(HDR_ID_DAT, HDR_NAME_DAT, 0, dat_str_to_pdu, dat_pdu_to_str),
HEADER(HDR_ID_SRV, HDR_NAME_SRV, 0, srv_str_to_pdu, srv_pdu_to_str)
};
temp_size = sizeof(temp) / sizeof(temp[0]);
if (temp_size > HDR_AMOUNT)
{
return -1;
}
memset(proto, 0, sizeof(*proto));
memcpy(proto->header, &temp, sizeof(temp));
return 0;
}
示例10: typelib_prolog
static gboolean
typelib_prolog(TreeState *state)
{
state->priv = calloc(1, sizeof(struct priv_data));
if (!state->priv)
return FALSE;
IFACES(state) = 0;
IFACE_MAP(state) = g_hash_table_new(g_str_hash, g_str_equal);
if (!IFACE_MAP(state)) {
/* XXX report error */
free(state->priv);
return FALSE;
}
/* find all interfaces, top-level and referenced by others */
IDL_tree_walk_in_order(state->tree, find_interfaces, state);
ARENA(state) = XPT_NewArena(1024, sizeof(double), "main xpidl arena");
HEADER(state) = XPT_NewHeader(ARENA(state), IFACES(state),
major_version, minor_version);
/* fill IDEs from hash table */
IFACES(state) = 0;
g_hash_table_foreach_remove(IFACE_MAP(state), fill_ide_table, state);
/* if any are left then we must have failed in fill_ide_table */
if (g_hash_table_size(IFACE_MAP(state)))
return FALSE;
/* sort the IDEs by IID order and store indices in the interface map */
sort_ide_block(state);
return TRUE;
}
示例11: FUNC
static int FUNC(extension_data)(CodedBitstreamContext *ctx, RWContext *rw,
MPEG2RawExtensionData *current)
{
int err;
HEADER("Extension Data");
ui(8, extension_start_code);
ui(4, extension_start_code_identifier);
switch (current->extension_start_code_identifier) {
case 1:
return FUNC(sequence_extension)
(ctx, rw, ¤t->data.sequence);
case 2:
return FUNC(sequence_display_extension)
(ctx, rw, ¤t->data.sequence_display);
case 3:
return FUNC(quant_matrix_extension)
(ctx, rw, ¤t->data.quant_matrix);
case 7:
return FUNC(picture_display_extension)
(ctx, rw, ¤t->data.picture_display);
case 8:
return FUNC(picture_coding_extension)
(ctx, rw, ¤t->data.picture_coding);
default:
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid extension ID %d.\n",
current->extension_start_code_identifier);
return AVERROR_INVALIDDATA;
}
}
示例12: deletefree
static void deletefree(void *currblock) {
int listcounter = 0;
size_t size = GETSIZE(HEADER(currblock));
for (;(listcounter < LISTS - 1) && (size > 1); listcounter++) {
size >>= 1;
}
if (PREVFREE(currblock) != NULL) {
if (NEXTFREE(currblock) != NULL) {
SETPTR(NEXTPTR(PREVFREE(currblock)), NEXTFREE(currblock));
SETPTR(PREVPTR(NEXTFREE(currblock)), PREVFREE(currblock));
} else {
SETPTR(NEXTPTR(PREVFREE(currblock)), NULL);
free_lists[listcounter] = PREVFREE(currblock);
}
} else {
if (NEXTFREE(currblock) != NULL) {
SETPTR(PREVPTR(NEXTFREE(currblock)), NULL);
} else {
free_lists[listcounter] = NULL;
}
}
return;
}
示例13: HEADER
void Connection::ReadPacket()
{
if(Errors())
return;
/** Handle Reading Packet Type Header. **/
if(SOCKET->available() > 0 && INCOMING->GetHeader() == 255)
{
std::vector<unsigned char> HEADER(1, 255);
if(Read(HEADER, 1) == 1)
INCOMING->SetHeader(HEADER[0]);
return;
}
if(INCOMING->GetHeader() != 255 && !INCOMING->Complete())
{
/** Handle Reading Packet Length Header. **/
if(SOCKET->available() >= 4 && INCOMING->GetLength() == 0)
{
std::vector<unsigned char> BYTES(4, 0);
if(Read(BYTES, 4) == 4)
{
INCOMING->SetLength(BYTES);
Event(0);
}
return;
}
/** Handle Reading Packet Data. **/
unsigned int nAvailable = SOCKET->available();
if(nAvailable > 0 && INCOMING->GetLength() > 0 && INCOMING->GetData().size() < INCOMING->GetLength())
{
std::vector<unsigned char> DATA( std::min(nAvailable, (unsigned int)(INCOMING->GetLength() - INCOMING->GetData().size())), 0);
unsigned int nRead = Read(DATA, DATA.size());
if(nRead == DATA.size())
{
std::vector<unsigned char> dta = INCOMING->GetData();
try
{
dta.insert(dta.end(), DATA.begin(), DATA.end());
}
catch(const std::exception e)
{
return;
}
INCOMING->SetData(dta);
Event(nRead);
}
return;
}
}
}
示例14: GETSIZE
void *mm_realloc(void *currblock, size_t size)
{
void *new_currblock = currblock;
size_t new_size = size;
int remainder;
int extendsize;
int block_buffer;
if (size == 0)
return NULL;
if (new_size <= DSIZE) {
new_size = 2 * DSIZE;
} else {
new_size = DSIZE * ((new_size + (DSIZE) + (DSIZE - 1)) / DSIZE);
}
new_size += 16;
block_buffer = GETSIZE(HEADER(currblock)) - new_size;
if (block_buffer < 0) {
if (!FULL(HEADER(NEXT(currblock))) || !GETSIZE(HEADER(NEXT(currblock)))) {
remainder = GETSIZE(HEADER(currblock)) + GETSIZE(HEADER(NEXT(currblock))) - new_size;
if (remainder < 0) {
extendsize = ((-remainder)>CHUNKSIZE?(-remainder):CHUNKSIZE);
if (extend_heap(extendsize) == NULL)
return NULL;
remainder += extendsize;
}
deletefree(NEXT(currblock));
CLEARTAG(HEADER(currblock), PACK(new_size + remainder, 1)); // Block header
CLEARTAG(FOOTER(currblock), PACK(new_size + remainder, 1)); // Block footer
} else {
new_currblock = mm_malloc(new_size - DSIZE);
line_count--;
memmove(new_currblock, currblock,((size)<new_size?(size):new_size));
mm_free(currblock);
line_count--;
}
block_buffer = GETSIZE(HEADER(new_currblock)) - new_size;
}
if (block_buffer < 2 * 16)
SETRTAG(HEADER(NEXT(new_currblock)));
line_count++;
if (MMCHECK) {
mm_check('r', currblock, size);
}
return new_currblock;
}
示例15: HEADER
void OvMemoryPool::free_memory_debug(void* _memory)
{
OvMemHeader* k_mem_header = NULL;
k_mem_header = HEADER(_memory);
k_mem_header->m_iLine = -1;
k_mem_header->m_pBlock = NULL;
k_mem_header->mNext = m_pFreeMemoryList;
m_pFreeMemoryList = k_mem_header;
}