idx
int64 | func
string | target
int64 |
|---|---|---|
438,645
|
static u32 *emit_lri(u32 *batch, const struct lri *lri, unsigned int count)
{
GEM_BUG_ON(!count || count > 63);
*batch++ = MI_LOAD_REGISTER_IMM(count);
do {
*batch++ = i915_mmio_reg_offset(lri->reg);
*batch++ = lri->value;
} while (lri++, --count);
*batch++ = MI_NOOP;
return batch;
}
| 0
|
432,880
|
filter_can_trim (struct backend *b, struct connection *conn)
{
struct backend_filter *f = container_of (b, struct backend_filter, backend);
void *handle = connection_get_handle (conn, b->i);
struct b_conn nxdata = { .b = b->next, .conn = conn };
if (f->filter.can_trim)
return f->filter.can_trim (&next_ops, &nxdata, handle);
else
return backend_can_trim (b->next, conn);
}
| 0
|
199,657
|
size_t ZSTD_estimateCStreamSize_usingCParams(ZSTD_compressionParameters cParams)
{
ZSTD_CCtx_params const params = ZSTD_makeCCtxParamsFromCParams(cParams);
return ZSTD_estimateCStreamSize_usingCCtxParams(¶ms);
}
| 0
|
65,224
|
static void sctp_v4_ecn_capable(struct sock *sk)
{
INET_ECN_xmit(sk);
}
| 0
|
438,005
|
long Track::GetNumber() const { return m_info.number; }
| 0
|
118,159
|
int ssl3_get_next_proto(SSL *s)
{
int ok;
int proto_len, padding_len;
long n;
const unsigned char *p;
/* Clients cannot send a NextProtocol message if we didn't see the
* extension in their ClientHello */
if (!s->s3->next_proto_neg_seen)
{
SSLerr(SSL_F_SSL3_GET_NEXT_PROTO,SSL_R_GOT_NEXT_PROTO_WITHOUT_EXTENSION);
return -1;
}
n=s->method->ssl_get_message(s,
SSL3_ST_SR_NEXT_PROTO_A,
SSL3_ST_SR_NEXT_PROTO_B,
SSL3_MT_NEXT_PROTO,
514, /* See the payload format below */
&ok);
if (!ok)
return((int)n);
/* s->state doesn't reflect whether ChangeCipherSpec has been received
* in this handshake, but s->s3->change_cipher_spec does (will be reset
* by ssl3_get_finished). */
if (!s->s3->change_cipher_spec)
{
SSLerr(SSL_F_SSL3_GET_NEXT_PROTO,SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS);
return -1;
}
if (n < 2)
return 0; /* The body must be > 1 bytes long */
p=(unsigned char *)s->init_msg;
/*-
* The payload looks like:
* uint8 proto_len;
* uint8 proto[proto_len];
* uint8 padding_len;
* uint8 padding[padding_len];
*/
proto_len = p[0];
if (proto_len + 2 > s->init_num)
return 0;
padding_len = p[proto_len + 1];
if (proto_len + padding_len + 2 != s->init_num)
return 0;
s->next_proto_negotiated = OPENSSL_malloc(proto_len);
if (!s->next_proto_negotiated)
{
SSLerr(SSL_F_SSL3_GET_NEXT_PROTO,ERR_R_MALLOC_FAILURE);
return 0;
}
memcpy(s->next_proto_negotiated, p + 1, proto_len);
s->next_proto_negotiated_len = proto_len;
return 1;
}
| 0
|
606
|
static void optimize_b ( MACROBLOCK * mb , int ib , int type , ENTROPY_CONTEXT * a , ENTROPY_CONTEXT * l ) {
BLOCK * b ;
BLOCKD * d ;
vp8_token_state tokens [ 17 ] [ 2 ] ;
unsigned best_mask [ 2 ] ;
const short * dequant_ptr ;
const short * coeff_ptr ;
short * qcoeff_ptr ;
short * dqcoeff_ptr ;
int eob ;
int i0 ;
int rc ;
int x ;
int sz = 0 ;
int next ;
int rdmult ;
int rddiv ;
int final_eob ;
int rd_cost0 ;
int rd_cost1 ;
int rate0 ;
int rate1 ;
int error0 ;
int error1 ;
int t0 ;
int t1 ;
int best ;
int band ;
int pt ;
int i ;
int err_mult = plane_rd_mult [ type ] ;
b = & mb -> block [ ib ] ;
d = & mb -> e_mbd . block [ ib ] ;
# if 0 vp8_strict_quantize_b ( b , d ) ;
# endif dequant_ptr = d -> dequant ;
coeff_ptr = b -> coeff ;
qcoeff_ptr = d -> qcoeff ;
dqcoeff_ptr = d -> dqcoeff ;
i0 = ! type ;
eob = * d -> eob ;
rdmult = mb -> rdmult * err_mult ;
if ( mb -> e_mbd . mode_info_context -> mbmi . ref_frame == INTRA_FRAME ) rdmult = ( rdmult * 9 ) >> 4 ;
rddiv = mb -> rddiv ;
best_mask [ 0 ] = best_mask [ 1 ] = 0 ;
tokens [ eob ] [ 0 ] . rate = 0 ;
tokens [ eob ] [ 0 ] . error = 0 ;
tokens [ eob ] [ 0 ] . next = 16 ;
tokens [ eob ] [ 0 ] . token = DCT_EOB_TOKEN ;
tokens [ eob ] [ 0 ] . qc = 0 ;
* ( tokens [ eob ] + 1 ) = * ( tokens [ eob ] + 0 ) ;
next = eob ;
for ( i = eob ;
i -- > i0 ;
) {
int base_bits ;
int d2 ;
int dx ;
rc = vp8_default_zig_zag1d [ i ] ;
x = qcoeff_ptr [ rc ] ;
if ( x ) {
int shortcut = 0 ;
error0 = tokens [ next ] [ 0 ] . error ;
error1 = tokens [ next ] [ 1 ] . error ;
rate0 = tokens [ next ] [ 0 ] . rate ;
rate1 = tokens [ next ] [ 1 ] . rate ;
t0 = ( vp8_dct_value_tokens_ptr + x ) -> Token ;
if ( next < 16 ) {
band = vp8_coef_bands [ i + 1 ] ;
pt = vp8_prev_token_class [ t0 ] ;
rate0 += mb -> token_costs [ type ] [ band ] [ pt ] [ tokens [ next ] [ 0 ] . token ] ;
rate1 += mb -> token_costs [ type ] [ band ] [ pt ] [ tokens [ next ] [ 1 ] . token ] ;
}
rd_cost0 = RDCOST ( rdmult , rddiv , rate0 , error0 ) ;
rd_cost1 = RDCOST ( rdmult , rddiv , rate1 , error1 ) ;
if ( rd_cost0 == rd_cost1 ) {
rd_cost0 = RDTRUNC ( rdmult , rddiv , rate0 , error0 ) ;
rd_cost1 = RDTRUNC ( rdmult , rddiv , rate1 , error1 ) ;
}
best = rd_cost1 < rd_cost0 ;
base_bits = * ( vp8_dct_value_cost_ptr + x ) ;
dx = dqcoeff_ptr [ rc ] - coeff_ptr [ rc ] ;
d2 = dx * dx ;
tokens [ i ] [ 0 ] . rate = base_bits + ( best ? rate1 : rate0 ) ;
tokens [ i ] [ 0 ] . error = d2 + ( best ? error1 : error0 ) ;
tokens [ i ] [ 0 ] . next = next ;
tokens [ i ] [ 0 ] . token = t0 ;
tokens [ i ] [ 0 ] . qc = x ;
best_mask [ 0 ] |= best << i ;
rate0 = tokens [ next ] [ 0 ] . rate ;
rate1 = tokens [ next ] [ 1 ] . rate ;
if ( ( abs ( x ) * dequant_ptr [ rc ] > abs ( coeff_ptr [ rc ] ) ) && ( abs ( x ) * dequant_ptr [ rc ] < abs ( coeff_ptr [ rc ] ) + dequant_ptr [ rc ] ) ) shortcut = 1 ;
else shortcut = 0 ;
if ( shortcut ) {
sz = - ( x < 0 ) ;
x -= 2 * sz + 1 ;
}
if ( ! x ) {
t0 = tokens [ next ] [ 0 ] . token == DCT_EOB_TOKEN ? DCT_EOB_TOKEN : ZERO_TOKEN ;
t1 = tokens [ next ] [ 1 ] . token == DCT_EOB_TOKEN ? DCT_EOB_TOKEN : ZERO_TOKEN ;
}
else {
t0 = t1 = ( vp8_dct_value_tokens_ptr + x ) -> Token ;
}
if ( next < 16 ) {
band = vp8_coef_bands [ i + 1 ] ;
if ( t0 != DCT_EOB_TOKEN ) {
pt = vp8_prev_token_class [ t0 ] ;
rate0 += mb -> token_costs [ type ] [ band ] [ pt ] [ tokens [ next ] [ 0 ] . token ] ;
}
if ( t1 != DCT_EOB_TOKEN ) {
pt = vp8_prev_token_class [ t1 ] ;
rate1 += mb -> token_costs [ type ] [ band ] [ pt ] [ tokens [ next ] [ 1 ] . token ] ;
}
}
rd_cost0 = RDCOST ( rdmult , rddiv , rate0 , error0 ) ;
rd_cost1 = RDCOST ( rdmult , rddiv , rate1 , error1 ) ;
if ( rd_cost0 == rd_cost1 ) {
rd_cost0 = RDTRUNC ( rdmult , rddiv , rate0 , error0 ) ;
rd_cost1 = RDTRUNC ( rdmult , rddiv , rate1 , error1 ) ;
}
best = rd_cost1 < rd_cost0 ;
base_bits = * ( vp8_dct_value_cost_ptr + x ) ;
if ( shortcut ) {
dx -= ( dequant_ptr [ rc ] + sz ) ^ sz ;
d2 = dx * dx ;
}
tokens [ i ] [ 1 ] . rate = base_bits + ( best ? rate1 : rate0 ) ;
tokens [ i ] [ 1 ] . error = d2 + ( best ? error1 : error0 ) ;
tokens [ i ] [ 1 ] . next = next ;
tokens [ i ] [ 1 ] . token = best ? t1 : t0 ;
tokens [ i ] [ 1 ] . qc = x ;
best_mask [ 1 ] |= best << i ;
next = i ;
}
else {
band = vp8_coef_bands [ i + 1 ] ;
t0 = tokens [ next ] [ 0 ] . token ;
t1 = tokens [ next ] [ 1 ] . token ;
if ( t0 != DCT_EOB_TOKEN ) {
tokens [ next ] [ 0 ] . rate += mb -> token_costs [ type ] [ band ] [ 0 ] [ t0 ] ;
tokens [ next ] [ 0 ] . token = ZERO_TOKEN ;
}
if ( t1 != DCT_EOB_TOKEN ) {
tokens [ next ] [ 1 ] . rate += mb -> token_costs [ type ] [ band ] [ 0 ] [ t1 ] ;
tokens [ next ] [ 1 ] . token = ZERO_TOKEN ;
}
}
}
band = vp8_coef_bands [ i + 1 ] ;
VP8_COMBINEENTROPYCONTEXTS ( pt , * a , * l ) ;
rate0 = tokens [ next ] [ 0 ] . rate ;
rate1 = tokens [ next ] [ 1 ] . rate ;
error0 = tokens [ next ] [ 0 ] . error ;
error1 = tokens [ next ] [ 1 ] . error ;
t0 = tokens [ next ] [ 0 ] . token ;
t1 = tokens [ next ] [ 1 ] . token ;
rate0 += mb -> token_costs [ type ] [ band ] [ pt ] [ t0 ] ;
rate1 += mb -> token_costs [ type ] [ band ] [ pt ] [ t1 ] ;
rd_cost0 = RDCOST ( rdmult , rddiv , rate0 , error0 ) ;
rd_cost1 = RDCOST ( rdmult , rddiv , rate1 , error1 ) ;
if ( rd_cost0 == rd_cost1 ) {
rd_cost0 = RDTRUNC ( rdmult , rddiv , rate0 , error0 ) ;
rd_cost1 = RDTRUNC ( rdmult , rddiv , rate1 , error1 ) ;
}
best = rd_cost1 < rd_cost0 ;
final_eob = i0 - 1 ;
for ( i = next ;
i < eob ;
i = next ) {
x = tokens [ i ] [ best ] . qc ;
if ( x ) final_eob = i ;
rc = vp8_default_zig_zag1d [ i ] ;
qcoeff_ptr [ rc ] = x ;
dqcoeff_ptr [ rc ] = x * dequant_ptr [ rc ] ;
next = tokens [ i ] [ best ] . next ;
best = ( best_mask [ best ] >> i ) & 1 ;
}
final_eob ++ ;
* a = * l = ( final_eob != ! type ) ;
* d -> eob = ( char ) final_eob ;
}
| 1
|
205,146
|
DragController::DragController(Page* page)
: page_(page),
document_under_mouse_(nullptr),
drag_initiator_(nullptr),
file_input_element_under_mouse_(nullptr),
document_is_handling_drag_(false),
drag_destination_action_(kDragDestinationActionNone),
did_initiate_drag_(false) {}
| 0
|
424,207
|
static int assess_restrict_namespaces(
const struct security_assessor *a,
const struct security_info *info,
const void *data,
uint64_t *ret_badness,
char **ret_description) {
assert(ret_badness);
assert(ret_description);
*ret_badness = !!(info->restrict_namespaces & a->parameter);
*ret_description = NULL;
return 0;
}
| 0
|
253,656
|
void ChromeWebContentsDelegateAndroid::FindReply(
WebContents* web_contents,
int request_id,
int number_of_matches,
const gfx::Rect& selection_rect,
int active_match_ordinal,
bool final_update) {
if (!notification_registrar_.IsRegistered(this,
chrome::NOTIFICATION_FIND_RESULT_AVAILABLE,
content::Source<WebContents>(web_contents))) {
notification_registrar_.Add(this,
chrome::NOTIFICATION_FIND_RESULT_AVAILABLE,
content::Source<WebContents>(web_contents));
}
FindTabHelper* find_tab_helper = FindTabHelper::FromWebContents(web_contents);
find_tab_helper->HandleFindReply(request_id,
number_of_matches,
selection_rect,
active_match_ordinal,
final_update);
}
| 0
|
307,115
|
cf2_free_instance( void* ptr )
{
CF2_Font font = (CF2_Font)ptr;
if ( font )
{
FT_Memory memory = font->memory;
(void)memory;
}
}
| 0
|
235,669
|
void HTMLInputElement::UpdateType() {
DCHECK(input_type_);
DCHECK(input_type_view_);
const AtomicString& new_type_name =
InputType::NormalizeTypeName(FastGetAttribute(typeAttr));
if (input_type_->FormControlType() == new_type_name)
return;
InputType* new_type = InputType::Create(*this, new_type_name);
RemoveFromRadioButtonGroup();
ValueMode old_value_mode = input_type_->GetValueMode();
bool did_respect_height_and_width =
input_type_->ShouldRespectHeightAndWidthAttributes();
bool could_be_successful_submit_button = CanBeSuccessfulSubmitButton();
input_type_view_->DestroyShadowSubtree();
DropInnerEditorElement();
LazyReattachIfAttached();
if (input_type_->SupportsRequired() != new_type->SupportsRequired() &&
IsRequired()) {
PseudoStateChanged(CSSSelector::kPseudoRequired);
PseudoStateChanged(CSSSelector::kPseudoOptional);
}
if (input_type_->SupportsReadOnly() != new_type->SupportsReadOnly()) {
PseudoStateChanged(CSSSelector::kPseudoReadOnly);
PseudoStateChanged(CSSSelector::kPseudoReadWrite);
}
if (input_type_->IsCheckable() != new_type->IsCheckable()) {
PseudoStateChanged(CSSSelector::kPseudoChecked);
}
PseudoStateChanged(CSSSelector::kPseudoIndeterminate);
if (input_type_->IsSteppable() || new_type->IsSteppable()) {
PseudoStateChanged(CSSSelector::kPseudoInRange);
PseudoStateChanged(CSSSelector::kPseudoOutOfRange);
}
bool placeholder_changed =
input_type_->SupportsPlaceholder() != new_type->SupportsPlaceholder();
has_been_password_field_ |= new_type_name == InputTypeNames::password;
input_type_ = new_type;
input_type_view_ = input_type_->CreateView();
if (input_type_view_->NeedsShadowSubtree()) {
EnsureUserAgentShadowRoot();
CreateShadowSubtree();
}
SetNeedsWillValidateCheck();
if (placeholder_changed) {
UpdatePlaceholderText();
UpdatePlaceholderVisibility();
PseudoStateChanged(CSSSelector::kPseudoPlaceholderShown);
}
ValueMode new_value_mode = input_type_->GetValueMode();
if (old_value_mode == ValueMode::kValue &&
(new_value_mode == ValueMode::kDefault ||
new_value_mode == ValueMode::kDefaultOn)) {
if (HasDirtyValue())
setAttribute(valueAttr, AtomicString(non_attribute_value_));
non_attribute_value_ = String();
has_dirty_value_ = false;
}
else if (old_value_mode != ValueMode::kValue &&
new_value_mode == ValueMode::kValue) {
AtomicString value_string = FastGetAttribute(valueAttr);
input_type_->WarnIfValueIsInvalid(value_string);
non_attribute_value_ = SanitizeValue(value_string);
has_dirty_value_ = false;
}
else if (old_value_mode != ValueMode::kFilename &&
new_value_mode == ValueMode::kFilename) {
non_attribute_value_ = String();
has_dirty_value_ = false;
} else {
if (!HasDirtyValue()) {
String default_value = FastGetAttribute(valueAttr);
if (!default_value.IsNull())
input_type_->WarnIfValueIsInvalid(default_value);
}
if (new_value_mode == ValueMode::kValue) {
String new_value = SanitizeValue(non_attribute_value_);
if (!EqualIgnoringNullity(new_value, non_attribute_value_)) {
if (HasDirtyValue())
setValue(new_value);
else
SetNonDirtyValue(new_value);
}
}
}
needs_to_update_view_value_ = true;
input_type_view_->UpdateView();
if (did_respect_height_and_width !=
input_type_->ShouldRespectHeightAndWidthAttributes()) {
DCHECK(GetElementData());
AttributeCollection attributes = AttributesWithoutUpdate();
if (const Attribute* height = attributes.Find(heightAttr)) {
TextControlElement::AttributeChanged(AttributeModificationParams(
heightAttr, height->Value(), height->Value(),
AttributeModificationReason::kDirectly));
}
if (const Attribute* width = attributes.Find(widthAttr)) {
TextControlElement::AttributeChanged(
AttributeModificationParams(widthAttr, width->Value(), width->Value(),
AttributeModificationReason::kDirectly));
}
if (const Attribute* align = attributes.Find(alignAttr)) {
TextControlElement::AttributeChanged(
AttributeModificationParams(alignAttr, align->Value(), align->Value(),
AttributeModificationReason::kDirectly));
}
}
if (GetDocument().FocusedElement() == this)
GetDocument().UpdateFocusAppearanceLater();
ClearValueBeforeFirstUserEdit();
AddToRadioButtonGroup();
SetNeedsValidityCheck();
if ((could_be_successful_submit_button || CanBeSuccessfulSubmitButton()) &&
formOwner() && isConnected())
formOwner()->InvalidateDefaultButtonStyle();
NotifyFormStateChanged();
}
| 0
|
498,952
|
static int esilbreak_reg_write(RzAnalysisEsil *esil, const char *name, ut64 *val) {
if (!esil) {
return 0;
}
RzAnalysis *analysis = esil->analysis;
EsilBreakCtx *ctx = esil->user;
RzAnalysisOp *op = ctx->op;
RzCore *core = analysis->coreb.core;
handle_var_stack_access(esil, *val, RZ_ANALYSIS_VAR_ACCESS_TYPE_PTR, esil->analysis->bits / 8);
//specific case to handle blx/bx cases in arm through emulation
// XXX this thing creates a lot of false positives
ut64 at = *val;
if (analysis && analysis->opt.armthumb) {
if (analysis->cur && analysis->cur->arch && analysis->bits < 33 &&
strstr(analysis->cur->arch, "arm") && !strcmp(name, "pc") && op) {
switch (op->type) {
case RZ_ANALYSIS_OP_TYPE_RCALL: // BLX
case RZ_ANALYSIS_OP_TYPE_RJMP: // BX
// maybe UJMP/UCALL is enough here
if (!(*val & 1)) {
rz_analysis_hint_set_bits(analysis, *val, 32);
} else {
ut64 snv = rz_reg_getv(analysis->reg, "pc");
if (snv != UT32_MAX && snv != UT64_MAX) {
if (rz_io_is_valid_offset(analysis->iob.io, *val, 1)) {
rz_analysis_hint_set_bits(analysis, *val - 1, 16);
}
}
}
break;
default:
break;
}
}
}
if (core->rasm->bits == 32 && strstr(core->rasm->cur->name, "arm")) {
if ((!(at & 1)) && rz_io_is_valid_offset(analysis->iob.io, at, 0)) { // !core->analysis->opt.noncode)) {
add_string_ref(analysis->coreb.core, esil->address, at);
}
}
return 0;
}
| 0
|
509,636
|
static void test_bug3796()
{
MYSQL_STMT *stmt;
MYSQL_BIND my_bind[1];
const char *concat_arg0= "concat_with_";
enum { OUT_BUFF_SIZE= 30 };
char out_buff[OUT_BUFF_SIZE];
char canonical_buff[OUT_BUFF_SIZE];
ulong out_length;
const char *stmt_text;
int rc;
myheader("test_bug3796");
/* Create and fill test table */
stmt_text= "DROP TABLE IF EXISTS t1";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
stmt_text= "CREATE TABLE t1 (a INT, b VARCHAR(30))";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
stmt_text= "INSERT INTO t1 VALUES(1, 'ONE'), (2, 'TWO')";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
/* Create statement handle and prepare it with select */
stmt= mysql_stmt_init(mysql);
stmt_text= "SELECT concat(?, b) FROM t1";
rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
check_execute(stmt, rc);
/* Bind input buffers */
bzero((char*) my_bind, sizeof(my_bind));
my_bind[0].buffer_type= MYSQL_TYPE_STRING;
my_bind[0].buffer= (void *) concat_arg0;
my_bind[0].buffer_length= strlen(concat_arg0);
mysql_stmt_bind_param(stmt, my_bind);
/* Execute the select statement */
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
my_bind[0].buffer= (void *) out_buff;
my_bind[0].buffer_length= OUT_BUFF_SIZE;
my_bind[0].length= &out_length;
mysql_stmt_bind_result(stmt, my_bind);
rc= mysql_stmt_fetch(stmt);
if (!opt_silent)
printf("Concat result: '%s'\n", out_buff);
check_execute(stmt, rc);
strmov(canonical_buff, concat_arg0);
strcat(canonical_buff, "ONE");
DIE_UNLESS(strlen(canonical_buff) == out_length &&
strncmp(out_buff, canonical_buff, out_length) == 0);
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
strmov(canonical_buff + strlen(concat_arg0), "TWO");
DIE_UNLESS(strlen(canonical_buff) == out_length &&
strncmp(out_buff, canonical_buff, out_length) == 0);
if (!opt_silent)
printf("Concat result: '%s'\n", out_buff);
rc= mysql_stmt_fetch(stmt);
DIE_UNLESS(rc == MYSQL_NO_DATA);
mysql_stmt_close(stmt);
stmt_text= "DROP TABLE IF EXISTS t1";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
}
| 0
|
442,492
|
const SecretSchema *docker_get_schema(void)
{
static const SecretSchema docker_schema = {
"io.docker.Credentials", SECRET_SCHEMA_NONE,
{
{ "label", SECRET_SCHEMA_ATTRIBUTE_STRING },
{ "server", SECRET_SCHEMA_ATTRIBUTE_STRING },
{ "username", SECRET_SCHEMA_ATTRIBUTE_STRING },
{ "docker_cli", SECRET_SCHEMA_ATTRIBUTE_STRING },
{ "NULL", 0 },
}
};
return &docker_schema;
}
| 0
|
340,547
|
int page_unprotect(target_ulong address, unsigned long pc, void *puc)
{
unsigned int page_index, prot, pindex;
PageDesc *p, *p1;
target_ulong host_start, host_end, addr;
/* Technically this isn't safe inside a signal handler. However we
know this only ever happens in a synchronous SEGV handler, so in
practice it seems to be ok. */
mmap_lock();
host_start = address & qemu_host_page_mask;
page_index = host_start >> TARGET_PAGE_BITS;
p1 = page_find(page_index);
if (!p1) {
mmap_unlock();
return 0;
}
host_end = host_start + qemu_host_page_size;
p = p1;
prot = 0;
for(addr = host_start;addr < host_end; addr += TARGET_PAGE_SIZE) {
prot |= p->flags;
p++;
}
/* if the page was really writable, then we change its
protection back to writable */
if (prot & PAGE_WRITE_ORG) {
pindex = (address - host_start) >> TARGET_PAGE_BITS;
if (!(p1[pindex].flags & PAGE_WRITE)) {
mprotect((void *)g2h(host_start), qemu_host_page_size,
(prot & PAGE_BITS) | PAGE_WRITE);
p1[pindex].flags |= PAGE_WRITE;
/* and since the content will be modified, we must invalidate
the corresponding translated code. */
tb_invalidate_phys_page(address, pc, puc);
#ifdef DEBUG_TB_CHECK
tb_invalidate_check(address);
#endif
mmap_unlock();
return 1;
}
}
mmap_unlock();
return 0;
}
| 0
|
513,856
|
static UINT cliprdr_server_packet_send(CliprdrServerPrivate* cliprdr, wStream* s)
{
UINT rc;
size_t pos, size;
BOOL status;
UINT32 dataLen;
UINT32 written;
pos = Stream_GetPosition(s);
if ((pos < 8) || (pos > UINT32_MAX))
{
rc = ERROR_NO_DATA;
goto fail;
}
dataLen = (UINT32)(pos - 8);
Stream_SetPosition(s, 4);
Stream_Write_UINT32(s, dataLen);
Stream_SetPosition(s, pos);
size = Stream_Length(s);
if (size > UINT32_MAX)
{
rc = ERROR_INVALID_DATA;
goto fail;
}
status = WTSVirtualChannelWrite(cliprdr->ChannelHandle, (PCHAR)Stream_Buffer(s), (UINT32)size,
&written);
rc = status ? CHANNEL_RC_OK : ERROR_INTERNAL_ERROR;
fail:
Stream_Free(s, TRUE);
return rc;
}
| 0
|
105,711
|
static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
size_t count, loff_t *ppos)
{
struct usb_yurex *dev;
int i, set = 0, retval = 0;
char buffer[16];
char *data = buffer;
unsigned long long c, c2 = 0;
signed long timeout = 0;
DEFINE_WAIT(wait);
count = min(sizeof(buffer), count);
dev = file->private_data;
/* verify that we actually have some data to write */
if (count == 0)
goto error;
mutex_lock(&dev->io_mutex);
if (!dev->interface) { /* already disconnected */
mutex_unlock(&dev->io_mutex);
retval = -ENODEV;
goto error;
}
if (copy_from_user(buffer, user_buffer, count)) {
mutex_unlock(&dev->io_mutex);
retval = -EFAULT;
goto error;
}
memset(dev->cntl_buffer, CMD_PADDING, YUREX_BUF_SIZE);
switch (buffer[0]) {
case CMD_ANIMATE:
case CMD_LED:
dev->cntl_buffer[0] = buffer[0];
dev->cntl_buffer[1] = buffer[1];
dev->cntl_buffer[2] = CMD_EOF;
break;
case CMD_READ:
case CMD_VERSION:
dev->cntl_buffer[0] = buffer[0];
dev->cntl_buffer[1] = 0x00;
dev->cntl_buffer[2] = CMD_EOF;
break;
case CMD_SET:
data++;
/* FALL THROUGH */
case '0' ... '9':
set = 1;
c = c2 = simple_strtoull(data, NULL, 0);
dev->cntl_buffer[0] = CMD_SET;
for (i = 1; i < 6; i++) {
dev->cntl_buffer[i] = (c>>32) & 0xff;
c <<= 8;
}
buffer[6] = CMD_EOF;
break;
default:
mutex_unlock(&dev->io_mutex);
return -EINVAL;
}
/* send the data as the control msg */
prepare_to_wait(&dev->waitq, &wait, TASK_INTERRUPTIBLE);
dev_dbg(&dev->interface->dev, "%s - submit %c\n", __func__,
dev->cntl_buffer[0]);
retval = usb_submit_urb(dev->cntl_urb, GFP_KERNEL);
if (retval >= 0)
timeout = schedule_timeout(YUREX_WRITE_TIMEOUT);
finish_wait(&dev->waitq, &wait);
mutex_unlock(&dev->io_mutex);
if (retval < 0) {
dev_err(&dev->interface->dev,
"%s - failed to send bulk msg, error %d\n",
__func__, retval);
goto error;
}
if (set && timeout)
dev->bbu = c2;
return timeout ? count : -EIO;
error:
return retval;
}
| 0
|
344,495
|
_fr_window_ask_overwrite_dialog (OverwriteData *odata)
{
if ((odata->edata->overwrite == FR_OVERWRITE_ASK) && (odata->current_file != NULL)) {
const char *base_name;
GFile *destination;
base_name = _g_path_get_relative_basename ((char *) odata->current_file->data, odata->edata->base_dir, odata->edata->junk_paths);
destination = g_file_get_child (odata->edata->destination, base_name);
g_file_query_info_async (destination,
G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
G_PRIORITY_DEFAULT,
odata->window->priv->cancellable,
query_info_ready_for_overwrite_dialog_cb,
odata);
g_object_unref (destination);
return;
}
if (odata->edata->file_list != NULL) {
/* speed optimization: passing NULL when extracting all the
* files is faster if the command supports the
* propCanExtractAll property. */
if (odata->extract_all) {
_g_string_list_free (odata->edata->file_list);
odata->edata->file_list = NULL;
}
odata->edata->overwrite = FR_OVERWRITE_YES;
_fr_window_archive_extract_from_edata (odata->window, odata->edata);
}
else {
GtkWidget *d;
d = _gtk_message_dialog_new (GTK_WINDOW (odata->window),
0,
GTK_STOCK_DIALOG_WARNING,
_("Extraction not performed"),
NULL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_OK);
fr_window_show_error_dialog (odata->window, d, GTK_WINDOW (odata->window), _("Extraction not performed"));
fr_window_stop_batch (odata->window);
}
g_free (odata);
}
| 1
|
74,803
|
static inline void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst1, int16_t *dst2,
int dstWidth, const uint8_t *src1,
const uint8_t *src2, int srcW, int xInc)
{
int32_t *filterPos = c->hChrFilterPos;
int16_t *filter = c->hChrFilter;
void *mmx2FilterCode= c->chrMmx2FilterCode;
int i;
#if defined(PIC)
DECLARE_ALIGNED(8, uint64_t, ebxsave);
#endif
__asm__ volatile(
#if defined(PIC)
"mov %%"REG_b", %7 \n\t"
#endif
"pxor %%mm7, %%mm7 \n\t"
"mov %0, %%"REG_c" \n\t"
"mov %1, %%"REG_D" \n\t"
"mov %2, %%"REG_d" \n\t"
"mov %3, %%"REG_b" \n\t"
"xor %%"REG_a", %%"REG_a" \n\t" // i
PREFETCH" (%%"REG_c") \n\t"
PREFETCH" 32(%%"REG_c") \n\t"
PREFETCH" 64(%%"REG_c") \n\t"
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
"xor %%"REG_a", %%"REG_a" \n\t" // i
"mov %5, %%"REG_c" \n\t" // src
"mov %6, %%"REG_D" \n\t" // buf2
PREFETCH" (%%"REG_c") \n\t"
PREFETCH" 32(%%"REG_c") \n\t"
PREFETCH" 64(%%"REG_c") \n\t"
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
#if defined(PIC)
"mov %7, %%"REG_b" \n\t"
#endif
:: "m" (src1), "m" (dst1), "m" (filter), "m" (filterPos),
"m" (mmx2FilterCode), "m" (src2), "m"(dst2)
#if defined(PIC)
,"m" (ebxsave)
#endif
: "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D
#if !defined(PIC)
,"%"REG_b
#endif
);
for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) {
dst1[i] = src1[srcW-1]*128;
dst2[i] = src2[srcW-1]*128;
}
}
| 0
|
326,026
|
static int dvbsub_parse_region_segment(AVCodecContext *avctx,
const uint8_t *buf, int buf_size)
{
DVBSubContext *ctx = avctx->priv_data;
const uint8_t *buf_end = buf + buf_size;
int region_id, object_id;
int av_unused version;
DVBSubRegion *region;
DVBSubObject *object;
DVBSubObjectDisplay *display;
int fill;
int ret;
if (buf_size < 10)
return AVERROR_INVALIDDATA;
region_id = *buf++;
region = get_region(ctx, region_id);
if (!region) {
region = av_mallocz(sizeof(DVBSubRegion));
if (!region)
return AVERROR(ENOMEM);
region->id = region_id;
region->version = -1;
region->next = ctx->region_list;
ctx->region_list = region;
version = ((*buf)>>4) & 15;
fill = ((*buf++) >> 3) & 1;
region->width = AV_RB16(buf);
buf += 2;
region->height = AV_RB16(buf);
buf += 2;
if (region->width * region->height != region->buf_size) {
av_free(region->pbuf);
region->buf_size = region->width * region->height;
region->pbuf = av_malloc(region->buf_size);
if (!region->pbuf) {
region->buf_size =
region->width =
region->height = 0;
return AVERROR(ENOMEM);
fill = 1;
region->dirty = 0;
region->depth = 1 << (((*buf++) >> 2) & 7);
if(region->depth<2 || region->depth>8){
av_log(avctx, AV_LOG_ERROR, "region depth %d is invalid\n", region->depth);
region->depth= 4;
region->clut = *buf++;
if (region->depth == 8) {
region->bgcolor = *buf++;
buf += 1;
} else {
buf += 1;
if (region->depth == 4)
region->bgcolor = (((*buf++) >> 4) & 15);
else
region->bgcolor = (((*buf++) >> 2) & 3);
ff_dlog(avctx, "Region %d, (%dx%d)\n", region_id, region->width, region->height);
if (fill) {
memset(region->pbuf, region->bgcolor, region->buf_size);
ff_dlog(avctx, "Fill region (%d)\n", region->bgcolor);
delete_region_display_list(ctx, region);
while (buf + 5 < buf_end) {
object_id = AV_RB16(buf);
buf += 2;
object = get_object(ctx, object_id);
if (!object) {
object = av_mallocz(sizeof(DVBSubObject));
if (!object)
return AVERROR(ENOMEM);
object->id = object_id;
object->next = ctx->object_list;
ctx->object_list = object;
object->type = (*buf) >> 6;
display = av_mallocz(sizeof(DVBSubObjectDisplay));
if (!display)
return AVERROR(ENOMEM);
display->object_id = object_id;
display->region_id = region_id;
display->x_pos = AV_RB16(buf) & 0xfff;
buf += 2;
display->y_pos = AV_RB16(buf) & 0xfff;
buf += 2;
if ((object->type == 1 || object->type == 2) && buf+1 < buf_end) {
display->fgcolor = *buf++;
display->bgcolor = *buf++;
display->region_list_next = region->display_list;
region->display_list = display;
display->object_list_next = object->display_list;
object->display_list = display;
return 0;
| 1
|
347,158
|
static bool fbo_check_config(const char *cfgstring, char **reason)
{
char *options;
char *path;
int fd;
tcmu_dbg("check: cfgstring %s\n", cfgstring);
options = strchr(cfgstring, '/');
if (!options) {
if (asprintf(reason, "Invalid cfgstring") == -1)
*reason = NULL;
return false;
}
options += 1; /* get past '/' */
while (options[0] != '/') {
if (strncasecmp(options, "ro/", 3)) {
if (asprintf(reason, "Unknown option %s\n",
options) == -1)
*reason = NULL;
return false;
}
options = strchr(options, '/');
if (!options) {
if (asprintf(reason, "Invalid cfgstring") == -1)
*reason = NULL;
return false;
}
options += 1;
}
path = options;
if (!path) {
if (asprintf(reason, "No path found") == -1)
*reason = NULL;
return false;
}
if (access(path, R_OK) != -1)
return true; /* File exists */
/* We also support creating the file, so see if we can create it */
/* NB: If we're creating it, then we'll need write permission */
fd = creat(path, S_IRUSR | S_IWUSR);
if (fd == -1) {
if (asprintf(reason, "Could not create file") == -1)
*reason = NULL;
return false;
}
unlink(path);
return true;
}
| 1
|
15,274
|
static subpicture_t * spu_new_buffer ( decoder_t * p_dec , const subpicture_updater_t * p_updater ) {
decoder_owner_sys_t * p_owner = p_dec -> p_owner ;
vout_thread_t * p_vout = NULL ;
subpicture_t * p_subpic ;
int i_attempts = 30 ;
while ( i_attempts -- ) {
if ( DecoderIsExitRequested ( p_dec ) || p_dec -> b_error ) break ;
p_vout = input_resource_HoldVout ( p_owner -> p_resource ) ;
if ( p_vout ) break ;
msleep ( DECODER_SPU_VOUT_WAIT_DURATION ) ;
}
if ( ! p_vout ) {
msg_Warn ( p_dec , "no vout found, dropping subpicture" ) ;
return NULL ;
}
if ( p_owner -> p_spu_vout != p_vout ) {
p_owner -> i_spu_channel = vout_RegisterSubpictureChannel ( p_vout ) ;
p_owner -> i_spu_order = 0 ;
p_owner -> p_spu_vout = p_vout ;
}
p_subpic = subpicture_New ( p_updater ) ;
if ( p_subpic ) {
p_subpic -> i_channel = p_owner -> i_spu_channel ;
p_subpic -> i_order = p_owner -> i_spu_order ++ ;
p_subpic -> b_subtitle = true ;
}
vlc_object_release ( p_vout ) ;
return p_subpic ;
}
| 0
|
348,068
|
int main(void) {
test_syslog_parse_identifier("pidu[111]: xxx", "pidu", "111", 11);
test_syslog_parse_identifier("pidu: xxx", "pidu", NULL, 6);
test_syslog_parse_identifier("pidu xxx", NULL, NULL, 0);
return 0;
}
| 1
|
374,026
|
xps_lookup_font(xps_document *doc, char *name)
{
xps_font_cache *cache;
for (cache = doc->font_table; cache; cache = cache->next)
if (!xps_strcasecmp(cache->name, name))
return fz_keep_font(doc->ctx, cache->font);
return NULL;
}
| 0
|
96,210
|
static void emitline(JF, js_Ast *node)
{
F->lastline = node->line;
}
| 0
|
435,486
|
EXPORTED int meth_propfind(struct transaction_t *txn, void *params)
{
struct meth_params *fparams = (struct meth_params *) params;
int ret = 0, r;
const char **hdr;
unsigned depth;
xmlDocPtr indoc = NULL, outdoc = NULL;
xmlNodePtr root, cur = NULL, props = NULL;
xmlNsPtr ns[NUM_NAMESPACE];
struct hash_table ns_table = { 0, NULL, NULL };
struct propfind_ctx fctx;
memset(&fctx, 0, sizeof(struct propfind_ctx));
/* Parse the path */
if (fparams->parse_path) {
r = dav_parse_req_target(txn, fparams);
if (r) return r;
}
/* Make sure method is allowed */
if (!(txn->req_tgt.allow & ALLOW_DAV)) return HTTP_NOT_ALLOWED;
/* Check Depth */
hdr = spool_getheader(txn->req_hdrs, "Depth");
if (!hdr || !strcmp(hdr[0], "infinity")) {
depth = 3;
if ((txn->error.precond = fparams->propfind.finite_depth_precond)) {
ret = HTTP_FORBIDDEN;
goto done;
}
}
else if (!strcmp(hdr[0], "1")) {
depth = 1;
}
else if (!strcmp(hdr[0], "0")) {
depth = 0;
}
else {
txn->error.desc = "Illegal Depth value\r\n";
return HTTP_BAD_REQUEST;
}
if (txn->req_tgt.mbentry) {
int rights;
/* Check ACL for current user */
rights = httpd_myrights(httpd_authstate, txn->req_tgt.mbentry);
if ((rights & DACL_READ) != DACL_READ) {
/* DAV:need-privileges */
txn->error.precond = DAV_NEED_PRIVS;
txn->error.resource = txn->req_tgt.path;
txn->error.rights = DACL_READ;
ret = HTTP_NO_PRIVS;
goto done;
}
if (txn->req_tgt.mbentry->server) {
/* Remote mailbox */
struct backend *be;
be = proxy_findserver(txn->req_tgt.mbentry->server,
&http_protocol, httpd_userid,
&backend_cached, NULL, NULL, httpd_in);
if (!be) return HTTP_UNAVAILABLE;
return http_pipe_req_resp(be, txn);
}
/* Local Mailbox */
}
/* Principal or Local Mailbox */
/* Parse the PROPFIND body, if exists */
ret = parse_xml_body(txn, &root, NULL);
if (ret) goto done;
if (!root) {
/* Empty request */
fctx.mode = PROPFIND_ALL;
}
else {
indoc = root->doc;
/* Make sure its a DAV:propfind element */
if (!root->ns || xmlStrcmp(root->ns->href, BAD_CAST XML_NS_DAV) ||
xmlStrcmp(root->name, BAD_CAST "propfind")) {
txn->error.desc = "Missing DAV:propfind element in PROPFIND request";
ret = HTTP_BAD_REQUEST;
goto done;
}
/* Find child element of propfind */
for (cur = root->children;
cur && cur->type != XML_ELEMENT_NODE; cur = cur->next);
if (!cur) {
txn->error.desc = "Missing child node element in PROPFIND request";
ret = HTTP_BAD_REQUEST;
goto done;
}
/* Add propfind type to our header cache */
spool_cache_header(xstrdup(":type"), xstrdup((const char *) cur->name),
txn->req_hdrs);
/* Make sure its a known element */
if (!xmlStrcmp(cur->name, BAD_CAST "allprop")) {
fctx.mode = PROPFIND_ALL;
}
else if (!xmlStrcmp(cur->name, BAD_CAST "propname")) {
fctx.mode = PROPFIND_NAME;
fctx.prefer = PREFER_MIN; /* Don't want 404 (Not Found) */
}
else if (!xmlStrcmp(cur->name, BAD_CAST "prop")) {
fctx.mode = PROPFIND_PROP;
props = cur->children;
}
else {
ret = HTTP_BAD_REQUEST;
goto done;
}
/* Check for extra elements */
for (cur = cur->next; cur; cur = cur->next) {
if (cur->type == XML_ELEMENT_NODE) {
if ((fctx.mode == PROPFIND_ALL) && !props &&
/* Check for 'include' element */
!xmlStrcmp(cur->name, BAD_CAST "include")) {
props = cur->children;
}
else {
ret = HTTP_BAD_REQUEST;
goto done;
}
}
}
}
/* Start construction of our multistatus response */
root = init_xml_response("multistatus", NS_DAV, root, ns);
if (!root) {
ret = HTTP_SERVER_ERROR;
txn->error.desc = "Unable to create XML response";
goto done;
}
outdoc = root->doc;
/* Populate our propfind context */
fctx.txn = txn;
fctx.req_tgt = &txn->req_tgt;
fctx.depth = depth;
fctx.prefer |= get_preferences(txn);
fctx.userid = httpd_userid;
fctx.userisadmin = httpd_userisadmin;
fctx.authstate = httpd_authstate;
fctx.mbentry = NULL;
fctx.mailbox = NULL;
fctx.record = NULL;
fctx.get_validators = fparams->get_validators;
fctx.reqd_privs = DACL_READ;
fctx.filter = NULL;
fctx.filter_crit = NULL;
if (fparams->mime_types) fctx.free_obj = fparams->mime_types[0].free;
fctx.open_db = fparams->davdb.open_db;
fctx.close_db = fparams->davdb.close_db;
fctx.lookup_resource = fparams->davdb.lookup_resource;
fctx.foreach_resource = fparams->davdb.foreach_resource;
fctx.proc_by_resource = &propfind_by_resource;
fctx.elist = NULL;
fctx.lprops = fparams->propfind.lprops;
fctx.root = root;
fctx.ns = ns;
fctx.ns_table = &ns_table;
fctx.ret = &ret;
/* Parse the list of properties and build a list of callbacks */
ret = preload_proplist(props, &fctx);
if (ret) goto done;
/* iCalendar/vCard data in response should not be transformed */
if (fctx.flags.fetcheddata) txn->flags.cc |= CC_NOTRANSFORM;
/* Setup for chunked response */
txn->flags.te |= TE_CHUNKED;
/* Begin XML response */
xml_response(HTTP_MULTI_STATUS, txn, fctx.root->doc);
/* Generate responses */
if (txn->req_tgt.namespace->id == URL_NS_PRINCIPAL) {
if (!depth || !(fctx.prefer & PREFER_NOROOT)) {
/* Add response for target URL */
xml_add_response(&fctx, 0, 0, NULL, NULL);
}
if (depth > 0 && !txn->req_tgt.userid) {
size_t len = strlen(namespace_principal.prefix);
char *p = txn->req_tgt.path + len;
if (!strcmp(p, "/" USER_COLLECTION_PREFIX "/")) {
/* Normalize depth so that:
* 0 = prin-set, 1+ = collection, 2+ = principal, 3+ = infinity!
*/
depth++;
}
else {
/* Add a response for 'user' collection */
snprintf(p, MAX_MAILBOX_PATH - len,
"/%s/", USER_COLLECTION_PREFIX);
xml_add_response(&fctx, 0, 0, NULL, NULL);
}
if (depth >= 2) {
/* Add responses for all user principals */
ret = mboxlist_alluser(principal_search, &fctx);
}
}
}
else {
/* Normalize depth so that:
* 0 = home-set, 1+ = collection, 2+ = resource, 3+ = infinity!
*/
if (txn->req_tgt.collection) depth++;
if (txn->req_tgt.resource) depth++;
fctx.depth = depth;
if (!txn->req_tgt.collection &&
(!depth || !(fctx.prefer & PREFER_NOROOT))) {
/* Add response for home-set collection */
if (txn->req_tgt.mbentry) {
/* Open mailbox for reading */
if ((r = mailbox_open_irl(txn->req_tgt.mbentry->name,
&fctx.mailbox))
&& r != IMAP_MAILBOX_NONEXISTENT) {
syslog(LOG_INFO, "mailbox_open_irl(%s) failed: %s",
txn->req_tgt.mbentry->name, error_message(r));
txn->error.desc = error_message(r);
ret = HTTP_SERVER_ERROR;
goto done;
}
fctx.mbentry = txn->req_tgt.mbentry;
}
if (!fctx.req_tgt->resource)
xml_add_response(&fctx, 0, 0, NULL, NULL);
/* Resource(s) */
r = propfind_by_resources(&fctx);
if (r) ret = r;
mailbox_close(&fctx.mailbox);
}
if (depth > 0) {
/* Collection(s) */
if (txn->req_tgt.collection) {
/* Add response for target collection */
propfind_by_collection(txn->req_tgt.mbentry, &fctx);
}
else if (config_getswitch(IMAPOPT_FASTMAILSHARING)) {
/* Add responses for all visible collections */
mboxlist_usermboxtree(httpd_userid, httpd_authstate,
propfind_by_collection,
&fctx, MBOXTREE_PLUS_RACL);
}
else if (txn->req_tgt.mbentry) {
/* Add responses for all contained collections */
fctx.prefer &= ~PREFER_NOROOT;
mboxlist_mboxtree(txn->req_tgt.mbentry->name,
propfind_by_collection, &fctx,
MBOXTREE_SKIP_ROOT);
switch (txn->req_tgt.namespace->id) {
case URL_NS_DRIVE:
if (txn->req_tgt.flags == TGT_DRIVE_ROOT) {
/* Add a response for 'user' hierarchy */
buf_setcstr(&fctx.buf, txn->req_tgt.namespace->prefix);
buf_printf(&fctx.buf, "/%s/", USER_COLLECTION_PREFIX);
strlcpy(fctx.req_tgt->path,
buf_cstring(&fctx.buf), MAX_MAILBOX_PATH);
fctx.mbentry = NULL;
fctx.mailbox = NULL;
r = xml_add_response(&fctx, 0, 0, NULL, NULL);
}
break;
case URL_NS_CALENDAR:
if (fctx.flags.cs_sharing) {
/* Add response for notification collection */
r = propfind_csnotify_collection(&fctx, props);
}
/* Fall through */
case URL_NS_ADDRESSBOOK:
/* Add responses for shared collections */
mboxlist_usersubs(txn->req_tgt.userid,
propfind_by_collection, &fctx,
MBOXTREE_SKIP_PERSONAL);
break;
}
}
ret = *fctx.ret;
}
}
if (fctx.davdb) fctx.close_db(fctx.davdb);
/* End XML response */
xml_partial_response(txn, fctx.root->doc, NULL /* end */, 0, &fctx.xmlbuf);
xmlBufferFree(fctx.xmlbuf);
/* End of output */
write_body(0, txn, NULL, 0);
ret = 0;
done:
/* Free the entry list */
free_entry_list(fctx.elist);
buf_free(&fctx.buf);
free_hash_table(&ns_table, NULL);
if (outdoc) xmlFreeDoc(outdoc);
if (indoc) xmlFreeDoc(indoc);
return ret;
}
| 0
|
100,946
|
static void cmd_anal_class_method(RCore *core, const char *input) {
RAnalClassErr err = R_ANAL_CLASS_ERR_SUCCESS;
char c = input[0];
switch (c) {
case ' ': // "acm"
case '-': // "acm-"
case 'n': { // "acmn"
const char *str = r_str_trim_head_ro (input + 1);
if (!*str) {
eprintf ("No class name given.\n");
break;
}
char *cstr = strdup (str);
if (!cstr) {
break;
}
char *end = strchr (cstr, ' ');
if (!end) {
eprintf ("No method name given.\n");
free (cstr);
break;
}
*end = '\0';
char *name_str = end + 1;
if (c == ' ' || c == 'n') {
end = strchr (name_str, ' ');
if (!end) {
if (c == ' ') {
eprintf ("No offset given.\n");
} else if (c == 'n') {
eprintf ("No new method name given.\n");
}
free (cstr);
break;
}
*end = '\0';
}
if (c == ' ') {
char *addr_str = end + 1;
end = strchr (addr_str, ' ');
if (end) {
*end = '\0';
}
RAnalMethod meth;
meth.name = name_str;
meth.addr = r_num_get (core->num, addr_str);
meth.vtable_offset = -1;
if (end) {
meth.vtable_offset = (int)r_num_get (core->num, end + 1);
}
err = r_anal_class_method_set (core->anal, cstr, &meth);
} else if (c == 'n') {
char *new_name_str = end + 1;
end = strchr (new_name_str, ' ');
if (end) {
*end = '\0';
}
err = r_anal_class_method_rename (core->anal, cstr, name_str, new_name_str);
} else if (c == '-') {
err = r_anal_class_method_delete (core->anal, cstr, name_str);
}
free (cstr);
break;
}
default:
r_core_cmd_help (core, help_msg_ac);
break;
}
switch (err) {
case R_ANAL_CLASS_ERR_NONEXISTENT_CLASS:
eprintf ("Class does not exist.\n");
break;
case R_ANAL_CLASS_ERR_NONEXISTENT_ATTR:
eprintf ("Method does not exist.\n");
break;
default:
break;
}
}
| 0
|
505,517
|
const char *CRYPTO_get_lock_name(int type)
{
if (type < 0)
return("dynamic");
else if (type < CRYPTO_NUM_LOCKS)
return(lock_names[type]);
else if (type-CRYPTO_NUM_LOCKS > sk_OPENSSL_STRING_num(app_locks))
return("ERROR");
else
return(sk_OPENSSL_STRING_value(app_locks,type-CRYPTO_NUM_LOCKS));
}
| 0
|
299,104
|
void HuffmanDecoder::Initialize(const unsigned int *codeBits, unsigned int nCodes)
{
// the Huffman codes are represented in 3 ways in this code:
//
// 1. most significant code bit (i.e. top of code tree) in the least significant bit position
// 2. most significant code bit (i.e. top of code tree) in the most significant bit position
// 3. most significant code bit (i.e. top of code tree) in n-th least significant bit position,
// where n is the maximum code length for this code tree
//
// (1) is the way the codes come in from the deflate stream
// (2) is used to sort codes so they can be binary searched
// (3) is used in this function to compute codes from code lengths
//
// a code in representation (2) is called "normalized" here
// The BitReverse() function is used to convert between (1) and (2)
// The NormalizeCode() function is used to convert from (3) to (2)
if (nCodes == 0)
throw Err("null code");
m_maxCodeBits = *std::max_element(codeBits, codeBits+nCodes);
if (m_maxCodeBits > MAX_CODE_BITS)
throw Err("code length exceeds maximum");
if (m_maxCodeBits == 0)
throw Err("null code");
// count number of codes of each length
SecBlockWithHint<unsigned int, 15+1> blCount(m_maxCodeBits+1);
std::fill(blCount.begin(), blCount.end(), 0);
unsigned int i;
for (i=0; i<nCodes; i++)
blCount[codeBits[i]]++;
// compute the starting code of each length
code_t code = 0;
SecBlockWithHint<code_t, 15+1> nextCode(m_maxCodeBits+1);
nextCode[1] = 0;
for (i=2; i<=m_maxCodeBits; i++)
{
// compute this while checking for overflow: code = (code + blCount[i-1]) << 1
if (code > code + blCount[i-1])
throw Err("codes oversubscribed");
code += blCount[i-1];
if (code > (code << 1))
throw Err("codes oversubscribed");
code <<= 1;
nextCode[i] = code;
}
// MAX_CODE_BITS is 32, m_maxCodeBits may be smaller.
const word64 shiftedMaxCode = ((word64)1 << m_maxCodeBits);
if (code > shiftedMaxCode - blCount[m_maxCodeBits])
throw Err("codes oversubscribed");
else if (m_maxCodeBits != 1 && code < shiftedMaxCode - blCount[m_maxCodeBits])
throw Err("codes incomplete");
// compute a vector of <code, length, value> triples sorted by code
m_codeToValue.resize(nCodes - blCount[0]);
unsigned int j=0;
for (i=0; i<nCodes; i++)
{
unsigned int len = codeBits[i];
if (len != 0)
{
code = NormalizeCode(nextCode[len]++, len);
m_codeToValue[j].code = code;
m_codeToValue[j].len = len;
m_codeToValue[j].value = i;
j++;
}
}
std::sort(m_codeToValue.begin(), m_codeToValue.end());
// initialize the decoding cache
m_cacheBits = STDMIN(9U, m_maxCodeBits);
m_cacheMask = (1 << m_cacheBits) - 1;
m_normalizedCacheMask = NormalizeCode(m_cacheMask, m_cacheBits);
CRYPTOPP_ASSERT(m_normalizedCacheMask == BitReverse(m_cacheMask));
const word64 shiftedCache = ((word64)1 << m_cacheBits);
CRYPTOPP_ASSERT(shiftedCache <= SIZE_MAX);
if (m_cache.size() != shiftedCache)
m_cache.resize((size_t)shiftedCache);
for (i=0; i<m_cache.size(); i++)
m_cache[i].type = 0;
}
| 0
|
441,290
|
AWSBrowserUploadAbstractor::get_auth_data(const req_state* const s) const
{
if (s->auth.s3_postobj_creds.x_amz_algorithm == AWS4_HMAC_SHA256_STR) {
ldpp_dout(s, 0) << "Signature verification algorithm AWS v4"
<< " (AWS4-HMAC-SHA256)" << dendl;
return get_auth_data_v4(s);
} else {
ldpp_dout(s, 0) << "Signature verification algorithm AWS v2" << dendl;
return get_auth_data_v2(s);
}
}
| 0
|
227,250
|
void LayerWebKitThread::removeAll(Vector<RefPtr<LayerWebKitThread> >& vector)
{
if (!vector.size())
return;
while (vector.size()) {
RefPtr<LayerWebKitThread> layer = vector[0].get();
ASSERT(layer->superlayer() == this);
layer->removeFromSuperlayer();
}
setNeedsCommit();
}
| 0
|
367,406
|
static void selinux_shm_free_security(struct shmid_kernel *shp)
{
ipc_free_security(&shp->shm_perm);
}
| 0
|
173,877
|
static int vrend_decode_set_constant_buffer(struct vrend_decode_ctx *ctx, uint16_t length)
{
uint32_t shader;
uint32_t index;
int nc = (length - 2);
if (length < 2)
return EINVAL;
shader = get_buf_entry(ctx, VIRGL_SET_CONSTANT_BUFFER_SHADER_TYPE);
index = get_buf_entry(ctx, VIRGL_SET_CONSTANT_BUFFER_INDEX);
if (shader >= PIPE_SHADER_TYPES)
return EINVAL;
vrend_set_constants(ctx->grctx, shader, index, nc, get_buf_ptr(ctx, VIRGL_SET_CONSTANT_BUFFER_DATA_START));
return 0;
}
| 0
|
245,149
|
bool OmniboxViewViews::OnMousePressed(const ui::MouseEvent& event) {
select_all_on_mouse_release_ =
(event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) &&
(!HasFocus() || (model()->focus_state() == OMNIBOX_FOCUS_INVISIBLE));
if (select_all_on_mouse_release_) {
model()->SetCaretVisibility(true);
saved_selection_for_focus_change_ = gfx::Range::InvalidRange();
}
return views::Textfield::OnMousePressed(event);
}
| 0
|
515,142
|
static void epsf_gencode(GVJ_t * job, node_t * n)
{
obj_state_t *obj = job->obj;
epsf_t *desc;
int doMap = (obj->url || obj->explicit_tooltip);
desc = (epsf_t *) (ND_shape_info(n));
if (!desc)
return;
if (doMap && !(job->flags & EMIT_CLUSTERS_LAST))
gvrender_begin_anchor(job,
obj->url, obj->tooltip, obj->target,
obj->id);
if (desc)
fprintf(job->output_file,
"%.5g %.5g translate newpath user_shape_%d\n",
ND_coord(n).x + desc->offset.x,
ND_coord(n).y + desc->offset.y, desc->macro_id);
ND_label(n)->pos = ND_coord(n);
emit_label(job, EMIT_NLABEL, ND_label(n));
if (doMap) {
if (job->flags & EMIT_CLUSTERS_LAST)
gvrender_begin_anchor(job,
obj->url, obj->tooltip, obj->target,
obj->id);
gvrender_end_anchor(job);
}
}
| 0
|
387,107
|
static bool vmxnet_tx_pkt_rebuild_payload(struct VmxnetTxPkt *pkt)
{
size_t payload_len = iov_size(pkt->raw, pkt->raw_frags) - pkt->hdr_len;
pkt->payload_frags = iov_copy(&pkt->vec[VMXNET_TX_PKT_PL_START_FRAG],
pkt->max_payload_frags,
pkt->raw, pkt->raw_frags,
pkt->hdr_len, payload_len);
if (pkt->payload_frags != (uint32_t) -1) {
pkt->payload_len = payload_len;
return true;
} else {
return false;
}
}
| 0
|
306,691
|
int CServer::Run()
{
//
m_PrintCBIndex = Console()->RegisterPrintCallback(g_Config.m_ConsoleOutputLevel, SendRconLineAuthed, this);
// load map
if(!LoadMap(g_Config.m_SvMap))
{
dbg_msg("server", "failed to load map. mapname='%s'", g_Config.m_SvMap);
return -1;
}
// start server
NETADDR BindAddr;
if(g_Config.m_Bindaddr[0] && net_host_lookup(g_Config.m_Bindaddr, &BindAddr, NETTYPE_ALL) == 0)
{
// sweet!
BindAddr.type = NETTYPE_ALL;
BindAddr.port = g_Config.m_SvPort;
}
else
{
mem_zero(&BindAddr, sizeof(BindAddr));
BindAddr.type = NETTYPE_ALL;
BindAddr.port = g_Config.m_SvPort;
}
if(!m_NetServer.Open(BindAddr, &m_ServerBan, g_Config.m_SvMaxClients, g_Config.m_SvMaxClientsPerIP, 0))
{
dbg_msg("server", "couldn't open socket. port %d might already be in use", g_Config.m_SvPort);
return -1;
}
m_NetServer.SetCallbacks(NewClientCallback, DelClientCallback, this);
m_Econ.Init(Console(), &m_ServerBan);
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "server name is '%s'", g_Config.m_SvName);
Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
GameServer()->OnInit();
str_format(aBuf, sizeof(aBuf), "version %s", GameServer()->NetVersion());
Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
// process pending commands
m_pConsole->StoreCommands(false);
// start game
{
int64 ReportTime = time_get();
int ReportInterval = 3;
m_Lastheartbeat = 0;
m_GameStartTime = time_get();
if(g_Config.m_Debug)
{
str_format(aBuf, sizeof(aBuf), "baseline memory usage %dk", mem_stats()->allocated/1024);
Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "server", aBuf);
}
while(m_RunServer)
{
int64 t = time_get();
int NewTicks = 0;
// load new map TODO: don't poll this
if(str_comp(g_Config.m_SvMap, m_aCurrentMap) != 0 || m_MapReload)
{
m_MapReload = 0;
// load map
if(LoadMap(g_Config.m_SvMap))
{
// new map loaded
GameServer()->OnShutdown();
for(int c = 0; c < MAX_CLIENTS; c++)
{
if(m_aClients[c].m_State <= CClient::STATE_AUTH)
continue;
SendMap(c);
m_aClients[c].Reset();
m_aClients[c].m_State = CClient::STATE_CONNECTING;
}
m_GameStartTime = time_get();
m_CurrentGameTick = 0;
Kernel()->ReregisterInterface(GameServer());
GameServer()->OnInit();
UpdateServerInfo();
}
else
{
str_format(aBuf, sizeof(aBuf), "failed to load map. mapname='%s'", g_Config.m_SvMap);
Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
str_copy(g_Config.m_SvMap, m_aCurrentMap, sizeof(g_Config.m_SvMap));
}
}
while(t > TickStartTime(m_CurrentGameTick+1))
{
m_CurrentGameTick++;
NewTicks++;
// apply new input
for(int c = 0; c < MAX_CLIENTS; c++)
{
if(m_aClients[c].m_State == CClient::STATE_EMPTY)
continue;
for(int i = 0; i < 200; i++)
{
if(m_aClients[c].m_aInputs[i].m_GameTick == Tick())
{
if(m_aClients[c].m_State == CClient::STATE_INGAME)
GameServer()->OnClientPredictedInput(c, m_aClients[c].m_aInputs[i].m_aData);
break;
}
}
}
GameServer()->OnTick();
}
// snap game
if(NewTicks)
{
if(g_Config.m_SvHighBandwidth || (m_CurrentGameTick%2) == 0)
DoSnapshot();
UpdateClientRconCommands();
}
// master server stuff
m_Register.RegisterUpdate(m_NetServer.NetType());
PumpNetwork();
if(ReportTime < time_get())
{
if(g_Config.m_Debug)
{
/*
static NETSTATS prev_stats;
NETSTATS stats;
netserver_stats(net, &stats);
perf_next();
if(config.dbg_pref)
perf_dump(&rootscope);
dbg_msg("server", "send=%8d recv=%8d",
(stats.send_bytes - prev_stats.send_bytes)/reportinterval,
(stats.recv_bytes - prev_stats.recv_bytes)/reportinterval);
prev_stats = stats;
*/
}
ReportTime += time_freq()*ReportInterval;
}
// wait for incomming data
net_socket_read_wait(m_NetServer.Socket(), 5);
}
}
// disconnect all clients on shutdown
for(int i = 0; i < MAX_CLIENTS; ++i)
{
if(m_aClients[i].m_State != CClient::STATE_EMPTY)
m_NetServer.Drop(i, "Server shutdown");
m_Econ.Shutdown();
}
GameServer()->OnShutdown();
m_pMap->Unload();
if(m_pCurrentMapData)
mem_free(m_pCurrentMapData);
return 0;
}
| 0
|
29,421
|
static int cmp_hpel ( MpegEncContext * s , const int x , const int y , const int subx , const int suby , const int size , const int h , int ref_index , int src_index , me_cmp_func cmp_func , me_cmp_func chroma_cmp_func , const int flags ) {
if ( flags & FLAG_DIRECT ) {
return cmp_direct_inline ( s , x , y , subx , suby , size , h , ref_index , src_index , cmp_func , chroma_cmp_func , 0 ) ;
}
else {
return cmp_inline ( s , x , y , subx , suby , size , h , ref_index , src_index , cmp_func , chroma_cmp_func , 0 , flags & FLAG_CHROMA ) ;
}
}
| 0
|
483,673
|
void device_set_of_node_from_dev(struct device *dev, const struct device *dev2)
{
of_node_put(dev->of_node);
dev->of_node = of_node_get(dev2->of_node);
dev->of_node_reused = true;
}
| 0
|
169,240
|
void Layer::SetClipParent(Layer* ancestor) {
DCHECK(IsPropertyChangeAllowed());
if (clip_parent_ == ancestor)
return;
if (clip_parent_)
clip_parent_->RemoveClipChild(this);
clip_parent_ = ancestor;
if (clip_parent_)
clip_parent_->AddClipChild(this);
SetNeedsCommit();
}
| 0
|
22,385
|
void xmlCleanupGlobals ( void ) {
if ( xmlThrDefMutex != NULL ) {
xmlFreeMutex ( xmlThrDefMutex ) ;
xmlThrDefMutex = NULL ;
}
__xmlGlobalInitMutexDestroy ( ) ;
}
| 0
|
169,530
|
PHP_METHOD(snmp, set)
{
php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU, SNMP_CMD_SET, (-1));
}
| 0
|
264,133
|
wait_for_completion_interruptible_timeout(struct completion *x,
unsigned long timeout)
{
return wait_for_common(x, timeout, TASK_INTERRUPTIBLE);
}
| 0
|
210,654
|
LayoutUnit LayoutBlockFlow::clearFloatsIfNeeded(LayoutBox& child, MarginInfo& marginInfo, LayoutUnit oldTopPosMargin, LayoutUnit oldTopNegMargin, LayoutUnit yPos, bool childIsSelfCollapsing, bool childDiscardMargin)
{
LayoutUnit heightIncrease = getClearDelta(&child, yPos);
marginInfo.setLastChildIsSelfCollapsingBlockWithClearance(false);
if (!heightIncrease)
return yPos;
if (childIsSelfCollapsing) {
marginInfo.setLastChildIsSelfCollapsingBlockWithClearance(true);
marginInfo.setDiscardMargin(childDiscardMargin);
LayoutBlockFlow::MarginValues childMargins = marginValuesForChild(child);
if (!childDiscardMargin) {
marginInfo.setPositiveMargin(std::max(childMargins.positiveMarginBefore(), childMargins.positiveMarginAfter()));
marginInfo.setNegativeMargin(std::max(childMargins.negativeMarginBefore(), childMargins.negativeMarginAfter()));
} else {
marginInfo.clearMargin();
}
marginInfo.setCanCollapseMarginAfterWithLastChild(false);
setLogicalHeight(child.logicalTop() + childMargins.negativeMarginBefore());
} else {
setLogicalHeight(logicalHeight() + heightIncrease);
}
if (marginInfo.canCollapseWithMarginBefore()) {
setMaxMarginBeforeValues(oldTopPosMargin, oldTopNegMargin);
marginInfo.setAtBeforeSideOfBlock(false);
setMustDiscardMarginBefore(style()->marginBeforeCollapse() == MDISCARD);
}
return yPos + heightIncrease;
}
| 0
|
394,911
|
static void network_init_gcrypt (void) /* {{{ */
{
gcry_error_t err;
/* http://lists.gnupg.org/pipermail/gcrypt-devel/2003-August/000458.html
* Because you can't know in a library whether another library has
* already initialized the library */
if (gcry_control (GCRYCTL_ANY_INITIALIZATION_P))
return;
/* http://www.gnupg.org/documentation/manuals/gcrypt/Multi_002dThreading.html
* To ensure thread-safety, it's important to set GCRYCTL_SET_THREAD_CBS
* *before* initalizing Libgcrypt with gcry_check_version(), which itself must
* be called before any other gcry_* function. GCRYCTL_ANY_INITIALIZATION_P
* above doesn't count, as it doesn't implicitly initalize Libgcrypt.
*
* tl;dr: keep all these gry_* statements in this exact order please. */
# if GCRYPT_VERSION_NUMBER < 0x010600
err = gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
if (err)
{
ERROR ("network plugin: gcry_control (GCRYCTL_SET_THREAD_CBS) failed: %s", gcry_strerror (err));
abort ();
}
# endif
gcry_check_version (NULL);
err = gcry_control (GCRYCTL_INIT_SECMEM, 32768);
if (err)
{
ERROR ("network plugin: gcry_control (GCRYCTL_SET_THREAD_CBS) failed: %s", gcry_strerror (err));
abort ();
}
gcry_control (GCRYCTL_INITIALIZATION_FINISHED);
} /* }}} void network_init_gcrypt */
| 0
|
144,237
|
person_set_color(person_t* person, color_t mask)
{
person->mask = mask;
}
| 0
|
7,566
|
static int DecodeBasicOcspResponse(byte* source, word32* ioIndex,
OcspResponse* resp, word32 size, void* cm, void* heap, int noVerify)
{
int length;
word32 idx = *ioIndex;
word32 end_index;
int ret;
int sigLength;
WOLFSSL_ENTER("DecodeBasicOcspResponse");
(void)heap;
if (GetSequence(source, &idx, &length, size) < 0)
return ASN_PARSE_E;
if (idx + length > size)
return ASN_INPUT_E;
end_index = idx + length;
if ((ret = DecodeResponseData(source, &idx, resp, size)) < 0)
return ret; /* ASN_PARSE_E, ASN_BEFORE_DATE_E, ASN_AFTER_DATE_E */
/* Get the signature algorithm */
if (GetAlgoId(source, &idx, &resp->sigOID, oidSigType, size) < 0)
return ASN_PARSE_E;
ret = CheckBitString(source, &idx, &sigLength, size, 1, NULL);
if (ret != 0)
return ret;
resp->sigSz = sigLength;
resp->sig = source + idx;
idx += sigLength;
/*
* Check the length of the BasicOcspResponse against the current index to
* see if there are certificates, they are optional.
*/
#ifndef WOLFSSL_NO_OCSP_OPTIONAL_CERTS
if (idx < end_index)
{
DecodedCert cert;
if (DecodeCerts(source, &idx, resp, size) < 0)
return ASN_PARSE_E;
InitDecodedCert(&cert, resp->cert, resp->certSz, heap);
/* Don't verify if we don't have access to Cert Manager. */
ret = ParseCertRelative(&cert, CERT_TYPE,
noVerify ? NO_VERIFY : VERIFY_OCSP, cm);
if (ret < 0) {
WOLFSSL_MSG("\tOCSP Responder certificate parsing failed");
FreeDecodedCert(&cert);
return ret;
}
#ifndef WOLFSSL_NO_OCSP_ISSUER_CHECK
if ((cert.extExtKeyUsage & EXTKEYUSE_OCSP_SIGN) == 0) {
if (XMEMCMP(cert.subjectHash,
resp->single->issuerHash, OCSP_DIGEST_SIZE) == 0) {
WOLFSSL_MSG("\tOCSP Response signed by issuer");
}
else {
WOLFSSL_MSG("\tOCSP Responder key usage check failed");
#ifdef OPENSSL_EXTRA
resp->verifyError = OCSP_BAD_ISSUER;
#else
FreeDecodedCert(&cert);
return BAD_OCSP_RESPONDER;
#endif
}
}
#endif
/* ConfirmSignature is blocking here */
ret = ConfirmSignature(&cert.sigCtx,
resp->response, resp->responseSz,
cert.publicKey, cert.pubKeySize, cert.keyOID,
resp->sig, resp->sigSz, resp->sigOID, NULL);
FreeDecodedCert(&cert);
if (ret != 0) {
WOLFSSL_MSG("\tOCSP Confirm signature failed");
return ASN_OCSP_CONFIRM_E;
}
}
else
#endif /* WOLFSSL_NO_OCSP_OPTIONAL_CERTS */
{
Signer* ca;
int sigValid = -1;
#ifndef NO_SKID
ca = GetCA(cm, resp->single->issuerKeyHash);
#else
ca = GetCA(cm, resp->single->issuerHash);
#endif
if (ca) {
SignatureCtx sigCtx;
InitSignatureCtx(&sigCtx, heap, INVALID_DEVID);
/* ConfirmSignature is blocking here */
sigValid = ConfirmSignature(&sigCtx, resp->response,
resp->responseSz, ca->publicKey, ca->pubKeySize, ca->keyOID,
resp->sig, resp->sigSz, resp->sigOID, NULL);
}
if (ca == NULL || sigValid != 0) {
WOLFSSL_MSG("\tOCSP Confirm signature failed");
return ASN_OCSP_CONFIRM_E;
}
(void)noVerify;
}
*ioIndex = idx;
return 0;
}
| 1
|
56,867
|
int __read_etc_hosts_r(
parser_t * parser,
const char *name,
int type,
enum etc_hosts_action action,
struct hostent *result_buf,
char *buf, size_t buflen,
struct hostent **result,
int *h_errnop)
{
char **tok = NULL;
struct in_addr *h_addr0 = NULL;
const size_t aliaslen = INADDROFF +
#ifdef __UCLIBC_HAS_IPV6__
sizeof(struct in6_addr)
#else
sizeof(struct in_addr)
#endif
;
int ret = HOST_NOT_FOUND;
/* make sure pointer is aligned */
int i = ALIGN_BUFFER_OFFSET(buf);
buf += i;
buflen -= i;
*h_errnop = NETDB_INTERNAL;
if (/* (ssize_t)buflen < 0 || */ buflen < aliaslen
|| (buflen - aliaslen) < BUFSZ + 1)
return ERANGE;
if (parser == NULL)
parser = __open_etc_hosts();
if (parser == NULL) {
*result = NULL;
return errno;
}
/* Layout in buf:
* char *alias[MAXTOKENS] = {address, name, aliases...}
* char **h_addr_list[1] = {*in[6]_addr, NULL}
* struct in[6]_addr
* char line_buffer[BUFSZ+];
*/
parser->data = buf;
parser->data_len = aliaslen;
parser->line_len = buflen - aliaslen;
*h_errnop = HOST_NOT_FOUND;
/* <ip>[[:space:]][<aliases>] */
while (config_read(parser, &tok, MAXTOKENS, MINTOKENS, "# \t", PARSE_NORMAL)) {
result_buf->h_aliases = tok+1;
if (action == GETHOSTENT) {
/* Return whatever the next entry happens to be. */
;
} else if (action == GET_HOSTS_BYADDR) {
if (strcmp(name, *tok) != 0)
continue;
} else { /* GET_HOSTS_BYNAME */
int aliases = 0;
char **alias = tok + 1;
while (aliases < MAXALIASES) {
char *tmp = *(alias+aliases++);
if (tmp && strcasecmp(name, tmp) == 0)
goto found;
}
continue;
}
found:
result_buf->h_name = *(result_buf->h_aliases++);
result_buf->h_addr_list = (char**)(buf + HALISTOFF);
*(result_buf->h_addr_list + 1) = '\0';
h_addr0 = (struct in_addr*)(buf + INADDROFF);
result_buf->h_addr = (char*)h_addr0;
if (0) /* nothing */;
#ifdef __UCLIBC_HAS_IPV4__
else if (type == AF_INET
&& inet_pton(AF_INET, *tok, h_addr0) > 0) {
DPRINTF("Found INET\n");
result_buf->h_addrtype = AF_INET;
result_buf->h_length = sizeof(struct in_addr);
*result = result_buf;
ret = NETDB_SUCCESS;
}
#endif
#ifdef __UCLIBC_HAS_IPV6__
#define in6 ((struct in6_addr *)buf)
else if (type == AF_INET6
&& inet_pton(AF_INET6, *tok, h_addr0) > 0) {
DPRINTF("Found INET6\n");
result_buf->h_addrtype = AF_INET6;
result_buf->h_length = sizeof(struct in6_addr);
*result = result_buf;
ret = NETDB_SUCCESS;
}
#endif
else {
/* continue parsing in the hope the user has multiple
* host types listed in the database like so:
* <ipv4 addr> host
* <ipv6 addr> host
* If looking for an IPv6 addr, don't bail when we got the IPv4
*/
DPRINTF("Error: Found host but different address family\n");
/* NB: gethostbyname2_r depends on this feature
* to avoid looking for IPv6 addr of "localhost" etc */
ret = TRY_AGAIN;
continue;
}
break;
}
if (action != GETHOSTENT)
config_close(parser);
return ret;
#undef in6
}
| 0
|
501,936
|
static int dns_common_sort_zones(struct ldb_message **m1, struct ldb_message **m2)
{
const char *n1, *n2;
size_t l1, l2;
n1 = ldb_msg_find_attr_as_string(*m1, "name", NULL);
n2 = ldb_msg_find_attr_as_string(*m2, "name", NULL);
if (n1 == NULL || n2 == NULL) {
if (n1 != NULL) {
return -1;
} else if (n2 != NULL) {
return 1;
} else {
return 0;
}
}
l1 = strlen(n1);
l2 = strlen(n2);
/* If the string lengths are not equal just sort by length */
if (l1 != l2) {
/* If m1 is the larger zone name, return it first */
return l2 - l1;
}
/*TODO: We need to compare DNs here, we want the DomainDNSZones first */
return 0;
}
| 0
|
53,573
|
check_METER(const struct ofpact_meter *a,
const struct ofpact_check_params *cp OVS_UNUSED)
{
uint32_t mid = a->meter_id;
return mid == 0 || mid > OFPM13_MAX ? OFPERR_OFPMMFC_INVALID_METER : 0;
}
| 0
|
387,136
|
static void vmxnet3_pre_save(void *opaque)
{
VMXNET3State *s = opaque;
s->mcast_list_buff_size = s->mcast_list_len * sizeof(MACAddr);
}
| 0
|
283,120
|
const BlockEntry* Cluster::GetEntry(const Track* pTrack,
long long time_ns) const {
assert(pTrack);
if (m_pSegment == NULL) // this is the special EOS cluster
return pTrack->GetEOS();
const BlockEntry* pResult = pTrack->GetEOS();
long index = 0;
for (;;) {
if (index >= m_entries_count) {
long long pos;
long len;
const long status = Parse(pos, len);
assert(status >= 0);
if (status > 0) // completely parsed, and no more entries
return pResult;
if (status < 0) // should never happen
return 0;
assert(m_entries);
assert(index < m_entries_count);
}
const BlockEntry* const pEntry = m_entries[index];
assert(pEntry);
assert(!pEntry->EOS());
const Block* const pBlock = pEntry->GetBlock();
assert(pBlock);
if (pBlock->GetTrackNumber() != pTrack->GetNumber()) {
++index;
continue;
}
if (pTrack->VetEntry(pEntry)) {
if (time_ns < 0) // just want first candidate block
return pEntry;
const long long ns = pBlock->GetTime(this);
if (ns > time_ns)
return pResult;
pResult = pEntry; // have a candidate
} else if (time_ns >= 0) {
const long long ns = pBlock->GetTime(this);
if (ns > time_ns)
return pResult;
}
++index;
}
}
| 0
|
419,707
|
static int make_filename(const char *context[_CONTEXT_MAX], char **ret) {
_cleanup_free_ char *c = NULL, *u = NULL, *p = NULL, *t = NULL;
sd_id128_t boot = {};
int r;
assert(context);
c = filename_escape(context[CONTEXT_COMM]);
if (!c)
return -ENOMEM;
u = filename_escape(context[CONTEXT_UID]);
if (!u)
return -ENOMEM;
r = sd_id128_get_boot(&boot);
if (r < 0)
return r;
p = filename_escape(context[CONTEXT_PID]);
if (!p)
return -ENOMEM;
t = filename_escape(context[CONTEXT_TIMESTAMP]);
if (!t)
return -ENOMEM;
if (asprintf(ret,
"/var/lib/systemd/coredump/core.%s.%s." SD_ID128_FORMAT_STR ".%s.%s000000",
c,
u,
SD_ID128_FORMAT_VAL(boot),
p,
t) < 0)
return -ENOMEM;
return 0;
}
| 0
|
309,526
|
InputHandler::ScrollStatus LayerTreeHostImpl::RootScrollBegin(
ScrollState* scroll_state,
InputHandler::ScrollInputType type) {
TRACE_EVENT0("cc", "LayerTreeHostImpl::RootScrollBegin");
ClearCurrentlyScrollingNode();
return ScrollBeginImpl(scroll_state, OuterViewportScrollNode(), type);
}
| 0
|
284,038
|
Response EmulationHandler::ClearGeolocationOverride() {
if (!GetWebContents())
return Response::InternalError();
auto* geolocation_context = GetWebContents()->GetGeolocationContext();
geolocation_context->ClearOverride();
return Response::OK();
}
| 0
|
136,309
|
static int_fast32_t pgx_getword(jas_stream_t *in, bool bigendian, int prec)
{
uint_fast32_t val;
int i;
int j;
int c;
int wordsize;
wordsize = (prec + 7) / 8;
if (prec > 32) {
goto error;
}
val = 0;
for (i = 0; i < wordsize; ++i) {
if ((c = jas_stream_getc(in)) == EOF) {
goto error;
}
j = bigendian ? (wordsize - 1 - i) : i;
val = val | ((c & 0xff) << (8 * j));
}
val &= (1 << prec) - 1;
return val;
error:
return -1;
}
| 0
|
34,875
|
static struct nfc_llcp_sock *nfc_llcp_sock_get_sn(struct nfc_llcp_local *local,
u8 *sn, size_t sn_len)
{
struct nfc_llcp_sock *llcp_sock;
llcp_sock = nfc_llcp_sock_from_sn(local, sn, sn_len);
if (llcp_sock == NULL)
return NULL;
sock_hold(&llcp_sock->sk);
return llcp_sock;
}
| 0
|
6,034
|
NOEXPORT char *pgsql_server(CLI *c, SERVICE_OPTIONS *opt, const PHASE phase) {
uint8_t buffer[8], ssl_ok[1]={'S'};
(void)opt; /* squash the unused parameter warning */
if(phase!=PROTOCOL_EARLY)
return NULL;
memset(buffer, 0, sizeof buffer);
s_read(c, c->local_rfd.fd, buffer, sizeof buffer);
if(safe_memcmp(buffer, ssl_request, sizeof ssl_request)) {
s_log(LOG_ERR, "PostgreSQL client did not request TLS, rejecting");
/* no way to send error on startup, so just drop the client */
throw_exception(c, 1);
}
s_write(c, c->local_wfd.fd, ssl_ok, sizeof ssl_ok);
return NULL;
}
| 1
|
54,031
|
static BOOL rdp_write_brush_capability_set(wStream* s, const rdpSettings* settings)
{
size_t header;
if (!Stream_EnsureRemainingCapacity(s, 32))
return FALSE;
header = rdp_capability_set_start(s);
if (header > UINT16_MAX)
return FALSE;
Stream_Write_UINT32(s, settings->BrushSupportLevel); /* brushSupportLevel (4 bytes) */
rdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_BRUSH);
return TRUE;
}
| 0
|
448,515
|
pk11_finalize(void) {
pk11_token_t *token, *next;
isc_result_t ret;
ret = free_all_sessions();
(void) pkcs_C_Finalize(NULL_PTR);
token = ISC_LIST_HEAD(tokens);
while (token != NULL) {
next = ISC_LIST_NEXT(token, link);
ISC_LIST_UNLINK(tokens, token, link);
if (token == rand_token)
rand_token = NULL;
if (token == best_rsa_token)
best_rsa_token = NULL;
if (token == best_dsa_token)
best_dsa_token = NULL;
if (token == best_dh_token)
best_dh_token = NULL;
if (token == digest_token)
digest_token = NULL;
if (token == best_ec_token)
best_ec_token = NULL;
if (token == best_gost_token)
best_gost_token = NULL;
if (token == aes_token)
aes_token = NULL;
pk11_mem_put(token, sizeof(*token));
token = next;
}
if (pk11_mctx != NULL)
isc_mem_detach(&pk11_mctx);
initialized = false;
return (ret);
}
| 0
|
221,999
|
void WebContentsImpl::RenderViewCreated(RenderViewHost* render_view_host) {
if (!static_cast<RenderViewHostImpl*>(render_view_host)->is_active())
return;
if (delegate_)
view_->SetOverscrollControllerEnabled(CanOverscrollContent());
NotificationService::current()->Notify(
NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED,
Source<WebContents>(this),
Details<RenderViewHost>(render_view_host));
NavigationEntry* entry = controller_.GetPendingEntry();
if (entry && entry->IsViewSourceMode()) {
render_view_host->Send(
new ViewMsg_EnableViewSourceMode(render_view_host->GetRoutingID()));
}
view_->RenderViewCreated(render_view_host);
FOR_EACH_OBSERVER(
WebContentsObserver, observers_, RenderViewCreated(render_view_host));
}
| 0
|
138,681
|
UpstreamDrainManager& Config::drainManager() {
return upstream_drain_manager_slot_->getTyped<UpstreamDrainManager>();
}
| 0
|
273,475
|
static void afiucv_pm_complete(struct device *dev)
{
#ifdef CONFIG_PM_DEBUG
printk(KERN_WARNING "afiucv_pm_complete\n");
#endif
}
| 0
|
386,944
|
static int vidioc_g_tuner(struct file *file, void *priv,
struct v4l2_tuner *vt)
{
struct usb_usbvision *usbvision = video_drvdata(file);
if (vt->index) /* Only tuner 0 */
return -EINVAL;
if (vt->type == V4L2_TUNER_RADIO)
strcpy(vt->name, "Radio");
else
strcpy(vt->name, "Television");
/* Let clients fill in the remainder of this struct */
call_all(usbvision, tuner, g_tuner, vt);
return 0;
}
| 0
|
13,821
|
void ProfileSyncService::OnExperimentsChanged(
const browser_sync::Experiments& experiments) {
if (current_experiments.Matches(experiments))
return;
if (migrator_.get() &&
migrator_->state() != browser_sync::BackendMigrator::IDLE) {
DVLOG(1) << "Dropping OnExperimentsChanged due to migrator busy.";
return;
}
const syncable::ModelTypeSet registered_types = GetRegisteredDataTypes();
syncable::ModelTypeSet to_add;
if (experiments.sync_tabs)
to_add.Put(syncable::SESSIONS);
const syncable::ModelTypeSet to_register =
Difference(to_add, registered_types);
DVLOG(2) << "OnExperimentsChanged called with types: "
<< syncable::ModelTypeSetToString(to_add);
DVLOG(2) << "Enabling types: " << syncable::ModelTypeSetToString(to_register);
for (syncable::ModelTypeSet::Iterator it = to_register.First();
it.Good(); it.Inc()) {
RegisterNewDataType(it.Get());
#if !defined(OS_ANDROID)
std::string experiment_name = GetExperimentNameForDataType(it.Get());
if (experiment_name.empty())
continue;
about_flags::SetExperimentEnabled(g_browser_process->local_state(),
experiment_name,
true);
#endif // !defined(OS_ANDROID)
}
if (sync_prefs_.HasKeepEverythingSynced()) {
sync_prefs_.SetPreferredDataTypes(registered_types, registered_types);
if (!to_register.Empty() && HasSyncSetupCompleted() && migrator_.get()) {
DVLOG(1) << "Dynamically enabling new datatypes: "
<< syncable::ModelTypeSetToString(to_register);
OnMigrationNeededForTypes(to_register);
}
}
if (experiments.sync_tab_favicons) {
DVLOG(1) << "Enabling syncing of tab favicons.";
about_flags::SetExperimentEnabled(g_browser_process->local_state(),
"sync-tab-favicons",
true);
}
current_experiments = experiments;
}
| 1
|
416,533
|
gx_update_pdf14_compositor(gx_device * pdev, gs_gstate * pgs,
const gs_pdf14trans_t * pdf14pct, gs_memory_t * mem )
{
pdf14_device *p14dev = (pdf14_device *)pdev;
gs_pdf14trans_params_t params = pdf14pct->params;
int code = 0;
params.idle = pdf14pct->idle;
switch (params.pdf14_op) {
default: /* Should not occur. */
break;
case PDF14_PUSH_DEVICE:
if (!(params.is_pattern)) {
p14dev->blend_mode = 0;
p14dev->opacity = p14dev->shape = 0.0;
pdf14_recreate_device(mem, pgs, pdev, pdf14pct);
}
break;
case PDF14_ABORT_DEVICE:
/* Something has gone very wrong. Let transparency device clean up
what ever it has allocated and then we are shutting it down */
code = gx_abort_trans_device(pgs, pdev);
if (p14dev->free_devicen) {
devn_free_params(pdev);
}
pdf14_disable_device(pdev);
pdf14_close(pdev);
break;
case PDF14_POP_DEVICE:
if (!(params.is_pattern)) {
if_debug0m('v', pdev->memory,
"[v]gx_update_pdf14_compositor(PDF14_POP_DEVICE)\n");
pgs->get_cmap_procs = p14dev->save_get_cmap_procs;
gx_set_cmap_procs(pgs, p14dev->target);
/* Send image out raster data to output device */
{
/* Make a copy so we can change the ROP */
gs_gstate new_pgs = *pgs;
/* We don't use the gs_gstate log_op since this is for the */
/* clist playback. Putting the image (band in the case of the */
/* clist) only needs to use the default ROP to copy the data */
new_pgs.log_op = rop3_default;
code = p14dev->pdf14_procs->put_image(pdev, &new_pgs, p14dev->target);
}
/* Before we disable the device release any deviceN structures.
free_devicen is set if the pdf14 device had inherited its
deviceN parameters from the target clist device. In this
case they should not be freed */
if (p14dev->free_devicen) {
devn_free_params(pdev);
}
pdf14_disable_device(pdev);
pdf14_close(pdev);
}
break;
case PDF14_BEGIN_TRANS_GROUP:
code = gx_begin_transparency_group(pgs, pdev, ¶ms);
break;
case PDF14_END_TRANS_GROUP:
code = gx_end_transparency_group(pgs, pdev);
break;
case PDF14_BEGIN_TRANS_TEXT_GROUP:
p14dev->text_group = PDF14_TEXTGROUP_BT_NOT_PUSHED;
break;
case PDF14_END_TRANS_TEXT_GROUP:
if (p14dev->text_group == PDF14_TEXTGROUP_BT_PUSHED)
code = gx_end_transparency_group(pgs, pdev);
p14dev->text_group = PDF14_TEXTGROUP_NO_BT; /* Hit ET */
break;
case PDF14_BEGIN_TRANS_MASK:
code = gx_begin_transparency_mask(pgs, pdev, ¶ms);
break;
case PDF14_END_TRANS_MASK:
code = gx_end_transparency_mask(pgs, pdev, ¶ms);
break;
case PDF14_SET_BLEND_PARAMS:
pdf14_set_params(pgs, pdev, &pdf14pct->params);
break;
case PDF14_PUSH_TRANS_STATE:
code = gx_push_transparency_state(pgs, pdev);
break;
case PDF14_POP_TRANS_STATE:
code = gx_pop_transparency_state(pgs, pdev);
break;
case PDF14_PUSH_SMASK_COLOR:
code = pdf14_increment_smask_color(pgs, pdev);
break;
case PDF14_POP_SMASK_COLOR:
code = pdf14_decrement_smask_color(pgs, pdev);
break;
}
return code;
}
| 0
|
119,699
|
static int mailimf_unstructured_parse(const char * message, size_t length,
size_t * indx, char ** result)
{
size_t cur_token;
int state;
size_t begin;
size_t terminal;
char * str;
cur_token = * indx;
while (1) {
int r;
r = mailimf_wsp_parse(message, length, &cur_token);
if (r == MAILIMF_NO_ERROR) {
/* do nothing */
}
else if (r == MAILIMF_ERROR_PARSE)
break;
else {
return r;
}
}
state = UNSTRUCTURED_START;
begin = cur_token;
terminal = cur_token;
while (state != UNSTRUCTURED_OUT) {
switch(state) {
case UNSTRUCTURED_START:
if (cur_token >= length)
return MAILIMF_ERROR_PARSE;
terminal = cur_token;
switch(message[cur_token]) {
case '\r':
state = UNSTRUCTURED_CR;
break;
case '\n':
state = UNSTRUCTURED_LF;
break;
default:
state = UNSTRUCTURED_START;
break;
}
break;
case UNSTRUCTURED_CR:
if (cur_token >= length)
return MAILIMF_ERROR_PARSE;
switch(message[cur_token]) {
case '\n':
state = UNSTRUCTURED_LF;
break;
default:
state = UNSTRUCTURED_START;
break;
}
break;
case UNSTRUCTURED_LF:
if (cur_token >= length) {
state = UNSTRUCTURED_OUT;
break;
}
switch(message[cur_token]) {
case '\t':
case ' ':
state = UNSTRUCTURED_WSP;
break;
default:
state = UNSTRUCTURED_OUT;
break;
}
break;
case UNSTRUCTURED_WSP:
if (cur_token >= length)
return MAILIMF_ERROR_PARSE;
switch(message[cur_token]) {
case '\r':
state = UNSTRUCTURED_CR;
break;
case '\n':
state = UNSTRUCTURED_LF;
break;
default:
state = UNSTRUCTURED_START;
break;
}
break;
}
cur_token ++;
}
str = malloc(terminal - begin + 1);
if (str == NULL)
return MAILIMF_ERROR_MEMORY;
strncpy(str, message + begin, terminal - begin);
str[terminal - begin] = '\0';
* indx = terminal;
* result = str;
return MAILIMF_NO_ERROR;
}
| 0
|
462,237
|
static void rtl8139_io_writel(void *opaque, uint8_t addr, uint32_t val)
{
RTL8139State *s = opaque;
switch (addr)
{
case RxMissed:
DPRINTF("RxMissed clearing on write\n");
s->RxMissed = 0;
break;
case TxConfig:
rtl8139_TxConfig_write(s, val);
break;
case RxConfig:
rtl8139_RxConfig_write(s, val);
break;
case TxStatus0 ... TxStatus0+4*4-1:
rtl8139_TxStatus_write(s, addr-TxStatus0, val);
break;
case TxAddr0 ... TxAddr0+4*4-1:
rtl8139_TxAddr_write(s, addr-TxAddr0, val);
break;
case RxBuf:
rtl8139_RxBuf_write(s, val);
break;
case RxRingAddrLO:
DPRINTF("C+ RxRing low bits write val=0x%08x\n", val);
s->RxRingAddrLO = val;
break;
case RxRingAddrHI:
DPRINTF("C+ RxRing high bits write val=0x%08x\n", val);
s->RxRingAddrHI = val;
break;
case Timer:
DPRINTF("TCTR Timer reset on write\n");
s->TCTR_base = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
rtl8139_set_next_tctr_time(s);
break;
case FlashReg:
DPRINTF("FlashReg TimerInt write val=0x%08x\n", val);
if (s->TimerInt != val) {
s->TimerInt = val;
rtl8139_set_next_tctr_time(s);
}
break;
default:
DPRINTF("ioport write(l) addr=0x%x val=0x%08x via write(b)\n",
addr, val);
rtl8139_io_writeb(opaque, addr, val & 0xff);
rtl8139_io_writeb(opaque, addr + 1, (val >> 8) & 0xff);
rtl8139_io_writeb(opaque, addr + 2, (val >> 16) & 0xff);
rtl8139_io_writeb(opaque, addr + 3, (val >> 24) & 0xff);
break;
}
}
| 0
|
154,999
|
void nego_set_negotiation_enabled(rdpNego* nego, BOOL NegotiateSecurityLayer)
{
WLog_DBG(TAG, "Enabling security layer negotiation: %s",
NegotiateSecurityLayer ? "TRUE" : "FALSE");
nego->NegotiateSecurityLayer = NegotiateSecurityLayer;
}
| 0
|
467,846
|
static void io_free_req_deferred(struct io_kiocb *req)
{
req->task_work.func = io_put_req_deferred_cb;
if (unlikely(io_req_task_work_add(req)))
io_req_task_work_add_fallback(req, io_put_req_deferred_cb);
}
| 0
|
140,891
|
f_inputdialog(typval_T *argvars, typval_T *rettv)
{
#if defined(FEAT_GUI_TEXTDIALOG)
/* Use a GUI dialog if the GUI is running and 'c' is not in 'guioptions' */
if (gui.in_use && vim_strchr(p_go, GO_CONDIALOG) == NULL)
{
char_u *message;
char_u buf[NUMBUFLEN];
char_u *defstr = (char_u *)"";
message = tv_get_string_chk(&argvars[0]);
if (argvars[1].v_type != VAR_UNKNOWN
&& (defstr = tv_get_string_buf_chk(&argvars[1], buf)) != NULL)
vim_strncpy(IObuff, defstr, IOSIZE - 1);
else
IObuff[0] = NUL;
if (message != NULL && defstr != NULL
&& do_dialog(VIM_QUESTION, NULL, message,
(char_u *)_("&OK\n&Cancel"), 1, IObuff, FALSE) == 1)
rettv->vval.v_string = vim_strsave(IObuff);
else
{
if (message != NULL && defstr != NULL
&& argvars[1].v_type != VAR_UNKNOWN
&& argvars[2].v_type != VAR_UNKNOWN)
rettv->vval.v_string = vim_strsave(
tv_get_string_buf(&argvars[2], buf));
else
rettv->vval.v_string = NULL;
}
rettv->v_type = VAR_STRING;
}
else
#endif
get_user_input(argvars, rettv, TRUE, inputsecret_flag);
}
| 0
|
182,091
|
virtual void TearDown()
{
}
| 0
|
241,031
|
void esp_dma_enable(ESPState *s, int irq, int level)
{
if (level) {
s->dma_enabled = 1;
trace_esp_dma_enable();
if (s->dma_cb) {
s->dma_cb(s);
s->dma_cb = NULL;
}
} else {
trace_esp_dma_disable();
s->dma_enabled = 0;
}
}
| 0
|
427,939
|
static int caldav_check_precond(struct transaction_t *txn, const void *data,
const char *etag, time_t lastmod)
{
const struct caldav_data *cdata = (const struct caldav_data *) data;
const char *stag = cdata ? cdata->sched_tag : NULL;
const char **hdr;
int precond;
/* Do normal WebDAV/HTTP checks (primarily for lock-token via If header) */
precond = check_precond(txn, data, etag, lastmod);
if (!(precond == HTTP_OK || precond == HTTP_PARTIAL)) return precond;
/* Per RFC 6638, check Schedule-Tag */
if ((hdr = spool_getheader(txn->req_hdrs, "If-Schedule-Tag-Match"))) {
/* Special case for Apple 'If-Schedule-Tag-Match:' with no value
* and also no schedule tag on the record - let that match */
if (cdata && !stag && !hdr[0][0]) return precond;
if (etagcmp(hdr[0], stag)) return HTTP_PRECOND_FAILED;
}
if (txn->meth == METH_GET || txn->meth == METH_HEAD) {
/* Fill in Schedule-Tag for successful GET/HEAD */
txn->resp_body.stag = stag;
}
return precond;
}
| 0
|
397,898
|
static void check_query_changes(IRC_SERVER_REC *server, const char *nick,
const char *address, const char *target)
{
QUERY_REC *query;
if (server_ischannel(SERVER(server), target))
return;
query = irc_query_find(server, nick);
if (query == NULL)
return;
if (g_strcmp0(query->name, nick) != 0) {
/* upper/lowercase chars in nick changed */
query_change_nick(query, nick);
}
if (address != NULL && (query->address == NULL ||
g_strcmp0(query->address, address) != 0)) {
/* host changed */
query_change_address(query, address);
}
}
| 0
|
70,159
|
static Jsi_RC NumberConstructor(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
if (Jsi_FunctionIsConstructor(funcPtr)) {
Jsi_Number nv = 0.0;
Jsi_Value *v = Jsi_ValueArrayIndex(interp, args, 0);
if (v) {
Jsi_ValueToNumber(interp, v);
nv = v->d.num;
}
_this->d.obj->ot = JSI_OT_NUMBER;
_this->d.obj->d.num = nv;
Jsi_ValueToObject(interp, _this);
Jsi_ValueMakeNumber(interp, ret, nv);
return JSI_OK;
}
Jsi_Value *v = Jsi_ValueArrayIndex(interp, args, 0);
if (v) {
Jsi_ValueToNumber(interp, v);
Jsi_ValueDup2(interp, ret, v);
Jsi_ValueToObject(interp, *ret);
return JSI_OK;
}
Jsi_ValueMakeNumber(interp, ret, 0.0);
return JSI_OK;
}
| 0
|
8,130
|
static Variant HHVM_FUNCTION(bcsqrt, const String& operand,
int64_t scale /* = -1 */) {
if (scale < 0) scale = BCG(bc_precision);
bc_num result;
bc_init_num(&result);
SCOPE_EXIT {
bc_free_num(&result);
};
php_str2num(&result, (char*)operand.data());
Variant ret;
if (bc_sqrt(&result, scale) != 0) {
if (result->n_scale > scale) {
result->n_scale = scale;
}
ret = String(bc_num2str(result), AttachString);
} else {
raise_warning("Square root of negative number");
}
return ret;
}
| 1
|
271,382
|
static double y2scr_pos(ASS_Renderer *render_priv, double y)
{
return y * render_priv->orig_height / render_priv->track->PlayResY +
render_priv->settings.top_margin;
}
| 0
|
445,653
|
static void commitReservation(Buffer::RawSlice* iovecs, uint64_t num_iovecs, OwnedImpl& buffer) {
buffer.commit(iovecs, num_iovecs);
}
| 0
|
246,201
|
bool Element::rareDataChildrenAffectedByFirstChildRules() const
{
ASSERT(hasRareData());
return elementRareData()->childrenAffectedByFirstChildRules();
}
| 0
|
511,481
|
expand_string_to_string_internal (string, quoted, func)
char *string;
int quoted;
EXPFUNC *func;
{
WORD_LIST *list;
char *ret;
if (string == 0 || *string == '\0')
return ((char *)NULL);
list = (*func) (string, quoted);
if (list)
{
ret = string_list (list);
dispose_words (list);
}
else
ret = (char *)NULL;
return (ret);
}
| 0
|
251,156
|
bool on_tty(void) {
/* We check both stdout and stderr, so that situations where pipes on the shell are used are reliably
* recognized, regardless if only the output or the errors are piped to some place. Since on_tty() is generally
* used to default to a safer, non-interactive, non-color mode of operation it's probably good to be defensive
* here, and check for both. Note that we don't check for STDIN_FILENO, because it should fine to use fancy
* terminal functionality when outputting stuff, even if the input is piped to us. */
if (cached_on_tty < 0)
cached_on_tty =
isatty(STDOUT_FILENO) > 0 &&
isatty(STDERR_FILENO) > 0;
return cached_on_tty;
}
| 0
|
230,953
|
void LogRendererKillCrashKeys(const GURL& site_url) {
static auto* site_url_key = base::debug::AllocateCrashKeyString(
"current_site_url", base::debug::CrashKeySize::Size64);
base::debug::SetCrashKeyString(site_url_key, site_url.spec());
}
| 0
|
226,997
|
void FetchManager::Loader::PerformNetworkError(const String& message) {
Failed(message);
}
| 0
|
292,141
|
COMPAT_SYSCALL_DEFINE1(sigpending, compat_old_sigset_t __user *, set32)
{
sigset_t set;
int err = do_sigpending(&set, sizeof(old_sigset_t));
if (err == 0)
if (copy_to_user(set32, &set, sizeof(old_sigset_t)))
err = -EFAULT;
return err;
}
| 0
|
29,409
|
static void * Type_Curve_Read ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , cmsUInt32Number * nItems , cmsUInt32Number SizeOfTag ) {
cmsUInt32Number Count ;
cmsToneCurve * NewGamma ;
* nItems = 0 ;
if ( ! _cmsReadUInt32Number ( io , & Count ) ) return NULL ;
switch ( Count ) {
case 0 : {
cmsFloat64Number SingleGamma = 1.0 ;
NewGamma = cmsBuildParametricToneCurve ( self -> ContextID , 1 , & SingleGamma ) ;
if ( ! NewGamma ) return NULL ;
* nItems = 1 ;
return NewGamma ;
}
case 1 : {
cmsUInt16Number SingleGammaFixed ;
cmsFloat64Number SingleGamma ;
if ( ! _cmsReadUInt16Number ( io , & SingleGammaFixed ) ) return NULL ;
SingleGamma = _cms8Fixed8toDouble ( SingleGammaFixed ) ;
* nItems = 1 ;
return cmsBuildParametricToneCurve ( self -> ContextID , 1 , & SingleGamma ) ;
}
default : if ( Count > 0x7FFF ) return NULL ;
NewGamma = cmsBuildTabulatedToneCurve16 ( self -> ContextID , Count , NULL ) ;
if ( ! NewGamma ) return NULL ;
if ( ! _cmsReadUInt16Array ( io , Count , NewGamma -> Table16 ) ) return NULL ;
* nItems = 1 ;
return NewGamma ;
}
cmsUNUSED_PARAMETER ( SizeOfTag ) ;
}
| 0
|
374,837
|
_equalBooleanTest(const BooleanTest *a, const BooleanTest *b)
{
COMPARE_NODE_FIELD(arg);
COMPARE_SCALAR_FIELD(booltesttype);
return true;
}
| 0
|
261,461
|
static bool bpf_map_ptr_unpriv(const struct bpf_insn_aux_data *aux)
{
return aux->map_ptr_state & BPF_MAP_PTR_UNPRIV;
}
| 0
|
401,999
|
xmlCopyNotation(xmlNotationPtr nota) {
xmlNotationPtr cur;
cur = (xmlNotationPtr) xmlMalloc(sizeof(xmlNotation));
if (cur == NULL) {
xmlVErrMemory(NULL, "malloc failed");
return(NULL);
}
if (nota->name != NULL)
cur->name = xmlStrdup(nota->name);
else
cur->name = NULL;
if (nota->PublicID != NULL)
cur->PublicID = xmlStrdup(nota->PublicID);
else
cur->PublicID = NULL;
if (nota->SystemID != NULL)
cur->SystemID = xmlStrdup(nota->SystemID);
else
cur->SystemID = NULL;
return(cur);
}
| 0
|
384,266
|
static xmlNodePtr to_xml_map(encodeTypePtr type, zval *data, int style, xmlNodePtr parent TSRMLS_DC)
{
xmlNodePtr xmlParam;
int i;
xmlParam = xmlNewNode(NULL, BAD_CAST("BOGUS"));
xmlAddChild(parent, xmlParam);
FIND_ZVAL_NULL(data, xmlParam, style);
if (Z_TYPE_P(data) == IS_ARRAY) {
i = zend_hash_num_elements(Z_ARRVAL_P(data));
zend_hash_internal_pointer_reset(data->value.ht);
for (;i > 0;i--) {
xmlNodePtr xparam, item;
xmlNodePtr key;
zval **temp_data;
char *key_val;
ulong int_val;
zend_hash_get_current_data(data->value.ht, (void **)&temp_data);
item = xmlNewNode(NULL, BAD_CAST("item"));
xmlAddChild(xmlParam, item);
key = xmlNewNode(NULL, BAD_CAST("key"));
xmlAddChild(item,key);
if (zend_hash_get_current_key(data->value.ht, &key_val, &int_val, FALSE) == HASH_KEY_IS_STRING) {
if (style == SOAP_ENCODED) {
set_xsi_type(key, "xsd:string");
}
xmlNodeSetContent(key, BAD_CAST(key_val));
} else {
smart_str tmp = {0};
smart_str_append_long(&tmp, int_val);
smart_str_0(&tmp);
if (style == SOAP_ENCODED) {
set_xsi_type(key, "xsd:int");
}
xmlNodeSetContentLen(key, BAD_CAST(tmp.c), tmp.len);
smart_str_free(&tmp);
}
xparam = master_to_xml(get_conversion((*temp_data)->type), (*temp_data), style, item TSRMLS_CC);
xmlNodeSetName(xparam, BAD_CAST("value"));
zend_hash_move_forward(data->value.ht);
}
}
if (style == SOAP_ENCODED) {
set_ns_and_type(xmlParam, type);
}
return xmlParam;
}
| 0
|
23,836
|
char * Curl_checkheaders ( const struct connectdata * conn , const char * thisheader ) {
struct curl_slist * head ;
size_t thislen = strlen ( thisheader ) ;
struct Curl_easy * data = conn -> data ;
for ( head = data -> set . headers ;
head ;
head = head -> next ) {
if ( Curl_raw_nequal ( head -> data , thisheader , thislen ) ) return head -> data ;
}
return NULL ;
}
| 0
|
389,124
|
uint32 fuzzy_distance(const char *s1, unsigned len1, const char *s2, unsigned len2)
{
uint32 a[MAXPATHLEN], diag, above, left, diag_inc, above_inc, left_inc;
int32 cost;
unsigned i1, i2;
if (!len1 || !len2) {
if (!len1) {
s1 = s2;
len1 = len2;
}
for (i1 = 0, cost = 0; i1 < len1; i1++)
cost += s1[i1];
return (int32)len1 * UNIT + cost;
}
for (i2 = 0; i2 < len2; i2++)
a[i2] = (i2+1) * UNIT;
for (i1 = 0; i1 < len1; i1++) {
diag = i1 * UNIT;
above = (i1+1) * UNIT;
for (i2 = 0; i2 < len2; i2++) {
left = a[i2];
if ((cost = *((uchar*)s1+i1) - *((uchar*)s2+i2)) != 0) {
if (cost < 0)
cost = UNIT - cost;
else
cost = UNIT + cost;
}
diag_inc = diag + cost;
left_inc = left + UNIT + *((uchar*)s1+i1);
above_inc = above + UNIT + *((uchar*)s2+i2);
a[i2] = above = left < above
? (left_inc < diag_inc ? left_inc : diag_inc)
: (above_inc < diag_inc ? above_inc : diag_inc);
diag = left;
}
}
return a[len2-1];
}
| 0
|
503,202
|
TEST_F(OptimizePipeline, ExclusionProjectThenProjectPushDown) {
auto pipeline = Pipeline::parse(
makeVector(fromjson("{$_internalUnpackBucket: { exclude: [], timeField: 'time',"
"metaField: 'myMeta', bucketMaxSpanSeconds: 3600}}"),
fromjson("{$project: {myMeta: 0}}"),
fromjson("{$project: {myMeta: 1, a: 1, _id: 0}}")),
getExpCtx());
ASSERT_EQ(3u, pipeline->getSources().size());
pipeline->optimizePipeline();
// We should push down the exclusion project on the metaField then internalize the remaining
// project.
auto serialized = pipeline->serializeToBson();
ASSERT_EQ(2u, serialized.size());
ASSERT_BSONOBJ_EQ(fromjson("{$project: {meta: false, _id: true}}"), serialized[0]);
ASSERT_BSONOBJ_EQ(
fromjson("{$_internalUnpackBucket: { include: ['a', 'myMeta'], timeField: 'time', "
"metaField: 'myMeta', bucketMaxSpanSeconds: 3600}}"),
serialized[1]);
}
| 0
|
195,269
|
void Browser::OnContentSettingsChange(TabContents* source) {
if (source == GetSelectedTabContents())
window_->GetLocationBar()->UpdateContentSettingsIcons();
}
| 0
|
267,197
|
set_arglist(char_u *str)
{
do_arglist(str, AL_SET, 0, FALSE);
}
| 0
|
357,413
|
static struct audit_watch *audit_dupe_watch(struct audit_watch *old)
{
char *path;
struct audit_watch *new;
path = kstrdup(old->path, GFP_KERNEL);
if (unlikely(!path))
return ERR_PTR(-ENOMEM);
new = audit_init_watch(path);
if (IS_ERR(new)) {
kfree(path);
goto out;
}
new->dev = old->dev;
new->ino = old->ino;
get_inotify_watch(&old->parent->wdata);
new->parent = old->parent;
out:
return new;
}
| 0
|
66,528
|
static inline char *upcase_string(char *dst, size_t dst_size, const char *src)
{
int i;
for (i = 0; src[i] && i < dst_size-1; i++)
dst[i] = av_toupper(src[i]);
dst[i] = 0;
return dst;
}
| 0
|
138,414
|
static int watchdog_nmi_enable(int cpu) { return 0; }
| 0
|
426,582
|
static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table)
{
size_t length;
unsigned int tag, format, components;
char *value_ptr, tagname[64], cbuf[32], *outside=NULL;
size_t byte_count, offset_val, fpos, fgot;
int64_t byte_count_signed;
xp_field_type *tmp_xp;
#ifdef EXIF_DEBUG
char *dump_data;
int dump_free;
#endif /* EXIF_DEBUG */
/* Protect against corrupt headers */
if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "corrupt EXIF header: maximum directory nesting level reached");
return FALSE;
}
ImageInfo->ifd_nesting_level++;
tag = php_ifd_get16u(dir_entry, ImageInfo->motorola_intel);
format = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel);
components = php_ifd_get32u(dir_entry+4, ImageInfo->motorola_intel);
if (!format || format > NUM_FORMATS) {
/* (-1) catches illegal zero case as unsigned underflows to positive large. */
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Illegal format code 0x%04X, suppose BYTE", tag, exif_get_tagname(tag, tagname, -12, tag_table), format);
format = TAG_FMT_BYTE;
/*return TRUE;*/
}
if (components <= 0) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Illegal components(%d)", tag, exif_get_tagname(tag, tagname, -12, tag_table), components);
return FALSE;
}
byte_count_signed = (int64_t)components * php_tiff_bytes_per_format[format];
if (byte_count_signed < 0 || (byte_count_signed > INT32_MAX)) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Illegal byte_count", tag, exif_get_tagname(tag, tagname, -12, tag_table));
return FALSE;
}
byte_count = (size_t)byte_count_signed;
if (byte_count > 4) {
offset_val = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel);
/* If its bigger than 4 bytes, the dir entry contains an offset. */
value_ptr = offset_base+offset_val;
/*
dir_entry is ImageInfo->file.list[sn].data+2+i*12
offset_base is ImageInfo->file.list[sn].data-dir_offset
dir_entry - offset_base is dir_offset+2+i*12
*/
if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry || offset_val < (size_t)(dir_entry-offset_base)) {
/* It is important to check for IMAGE_FILETYPE_TIFF
* JPEG does not use absolute pointers instead its pointers are
* relative to the start of the TIFF header in APP1 section. */
if (byte_count > ImageInfo->FileSize || offset_val>ImageInfo->FileSize-byte_count || (ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_II && ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_MM && ImageInfo->FileType!=IMAGE_FILETYPE_JPEG)) {
if (value_ptr < dir_entry) {
/* we can read this if offset_val > 0 */
/* some files have their values in other parts of the file */
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Illegal pointer offset(x%04X < x%04X)", tag, exif_get_tagname(tag, tagname, -12, tag_table), offset_val, dir_entry);
} else {
/* this is for sure not allowed */
/* exception are IFD pointers */
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Illegal pointer offset(x%04X + x%04X = x%04X > x%04X)", tag, exif_get_tagname(tag, tagname, -12, tag_table), offset_val, byte_count, offset_val+byte_count, IFDlength);
}
return FALSE;
}
if (byte_count>sizeof(cbuf)) {
/* mark as outside range and get buffer */
value_ptr = safe_emalloc(byte_count, 1, 0);
outside = value_ptr;
} else {
/* In most cases we only access a small range so
* it is faster to use a static buffer there
* BUT it offers also the possibility to have
* pointers read without the need to free them
* explicitley before returning. */
memset(&cbuf, 0, sizeof(cbuf));
value_ptr = cbuf;
}
fpos = php_stream_tell(ImageInfo->infile);
php_stream_seek(ImageInfo->infile, displacement+offset_val, SEEK_SET);
fgot = php_stream_tell(ImageInfo->infile);
if (fgot!=displacement+offset_val) {
EFREE_IF(outside);
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Wrong file pointer: 0x%08X != 0x%08X", fgot, displacement+offset_val);
return FALSE;
}
fgot = php_stream_read(ImageInfo->infile, value_ptr, byte_count);
php_stream_seek(ImageInfo->infile, fpos, SEEK_SET);
if (fgot<byte_count) {
EFREE_IF(outside);
EXIF_ERRLOG_FILEEOF(ImageInfo)
return FALSE;
}
}
} else {
/* 4 bytes or less and value is in the dir entry itself */
value_ptr = dir_entry+8;
offset_val= value_ptr-offset_base;
}
ImageInfo->sections_found |= FOUND_ANY_TAG;
#ifdef EXIF_DEBUG
dump_data = exif_dump_data(&dump_free, format, components, length, ImageInfo->motorola_intel, value_ptr);
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process tag(x%04X=%s,@x%04X + x%04X(=%d)): %s%s %s", tag, exif_get_tagname(tag, tagname, -12, tag_table), offset_val+displacement, byte_count, byte_count, (components>1)&&format!=TAG_FMT_UNDEFINED&&format!=TAG_FMT_STRING?"ARRAY OF ":"", exif_get_tagformat(format), dump_data);
if (dump_free) {
efree(dump_data);
}
#endif
if (section_index==SECTION_THUMBNAIL) {
if (!ImageInfo->Thumbnail.data) {
switch(tag) {
case TAG_IMAGEWIDTH:
case TAG_COMP_IMAGE_WIDTH:
ImageInfo->Thumbnail.width = exif_convert_any_to_int(value_ptr, exif_rewrite_tag_format_to_unsigned(format), ImageInfo->motorola_intel);
break;
case TAG_IMAGEHEIGHT:
case TAG_COMP_IMAGE_HEIGHT:
ImageInfo->Thumbnail.height = exif_convert_any_to_int(value_ptr, exif_rewrite_tag_format_to_unsigned(format), ImageInfo->motorola_intel);
break;
case TAG_STRIP_OFFSETS:
case TAG_JPEG_INTERCHANGE_FORMAT:
/* accept both formats */
ImageInfo->Thumbnail.offset = exif_convert_any_to_int(value_ptr, exif_rewrite_tag_format_to_unsigned(format), ImageInfo->motorola_intel);
break;
case TAG_STRIP_BYTE_COUNTS:
if (ImageInfo->FileType == IMAGE_FILETYPE_TIFF_II || ImageInfo->FileType == IMAGE_FILETYPE_TIFF_MM) {
ImageInfo->Thumbnail.filetype = ImageInfo->FileType;
} else {
/* motorola is easier to read */
ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_TIFF_MM;
}
ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, exif_rewrite_tag_format_to_unsigned(format), ImageInfo->motorola_intel);
break;
case TAG_JPEG_INTERCHANGE_FORMAT_LEN:
if (ImageInfo->Thumbnail.filetype == IMAGE_FILETYPE_UNKNOWN) {
ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_JPEG;
ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, exif_rewrite_tag_format_to_unsigned(format), ImageInfo->motorola_intel);
}
break;
}
}
} else {
if (section_index==SECTION_IFD0 || section_index==SECTION_EXIF)
switch(tag) {
case TAG_COPYRIGHT:
/* check for "<photographer> NUL <editor> NUL" */
if (byte_count>1 && (length=php_strnlen(value_ptr, byte_count)) > 0) {
if (length<byte_count-1) {
/* When there are any characters after the first NUL */
ImageInfo->CopyrightPhotographer = estrdup(value_ptr);
ImageInfo->CopyrightEditor = estrndup(value_ptr+length+1, byte_count-length-1);
spprintf(&ImageInfo->Copyright, 0, "%s, %s", ImageInfo->CopyrightPhotographer, ImageInfo->CopyrightEditor);
/* format = TAG_FMT_UNDEFINED; this musn't be ASCII */
/* but we are not supposed to change this */
/* keep in mind that image_info does not store editor value */
} else {
ImageInfo->Copyright = estrndup(value_ptr, byte_count);
}
}
break;
case TAG_USERCOMMENT:
EFREE_IF(ImageInfo->UserComment);
ImageInfo->UserComment = NULL;
EFREE_IF(ImageInfo->UserCommentEncoding);
ImageInfo->UserCommentEncoding = NULL;
ImageInfo->UserCommentLength = exif_process_user_comment(ImageInfo, &(ImageInfo->UserComment), &(ImageInfo->UserCommentEncoding), value_ptr, byte_count);
break;
case TAG_XP_TITLE:
case TAG_XP_COMMENTS:
case TAG_XP_AUTHOR:
case TAG_XP_KEYWORDS:
case TAG_XP_SUBJECT:
tmp_xp = (xp_field_type*)safe_erealloc(ImageInfo->xp_fields.list, (ImageInfo->xp_fields.count+1), sizeof(xp_field_type), 0);
ImageInfo->sections_found |= FOUND_WINXP;
ImageInfo->xp_fields.list = tmp_xp;
ImageInfo->xp_fields.count++;
exif_process_unicode(ImageInfo, &(ImageInfo->xp_fields.list[ImageInfo->xp_fields.count-1]), tag, value_ptr, byte_count);
break;
case TAG_FNUMBER:
/* Simplest way of expressing aperture, so I trust it the most.
(overwrite previously computed value if there is one) */
ImageInfo->ApertureFNumber = (float)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel);
break;
case TAG_APERTURE:
case TAG_MAX_APERTURE:
/* More relevant info always comes earlier, so only use this field if we don't
have appropriate aperture information yet. */
if (ImageInfo->ApertureFNumber == 0) {
ImageInfo->ApertureFNumber
= (float)exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel)*log(2)*0.5);
}
break;
case TAG_SHUTTERSPEED:
/* More complicated way of expressing exposure time, so only use
this value if we don't already have it from somewhere else.
SHUTTERSPEED comes after EXPOSURE TIME
*/
if (ImageInfo->ExposureTime == 0) {
ImageInfo->ExposureTime
= (float)(1/exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel)*log(2)));
}
break;
case TAG_EXPOSURETIME:
ImageInfo->ExposureTime = -1;
break;
case TAG_COMP_IMAGE_WIDTH:
ImageInfo->ExifImageWidth = exif_convert_any_to_int(value_ptr, exif_rewrite_tag_format_to_unsigned(format), ImageInfo->motorola_intel);
break;
case TAG_FOCALPLANE_X_RES:
ImageInfo->FocalplaneXRes = exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel);
break;
case TAG_SUBJECT_DISTANCE:
/* Inidcates the distacne the autofocus camera is focused to.
Tends to be less accurate as distance increases. */
ImageInfo->Distance = (float)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel);
break;
case TAG_FOCALPLANE_RESOLUTION_UNIT:
switch((int)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel)) {
case 1: ImageInfo->FocalplaneUnits = 25.4; break; /* inch */
case 2:
/* According to the information I was using, 2 measn meters.
But looking at the Cannon powershot's files, inches is the only
sensible value. */
ImageInfo->FocalplaneUnits = 25.4;
break;
case 3: ImageInfo->FocalplaneUnits = 10; break; /* centimeter */
case 4: ImageInfo->FocalplaneUnits = 1; break; /* milimeter */
case 5: ImageInfo->FocalplaneUnits = .001; break; /* micrometer */
}
break;
case TAG_SUB_IFD:
if (format==TAG_FMT_IFD) {
/* If this is called we are either in a TIFFs thumbnail or a JPEG where we cannot handle it */
/* TIFF thumbnail: our data structure cannot store a thumbnail of a thumbnail */
/* JPEG do we have the data area and what to do with it */
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Skip SUB IFD");
}
break;
case TAG_MAKE:
ImageInfo->make = estrndup(value_ptr, byte_count);
break;
case TAG_MODEL:
ImageInfo->model = estrndup(value_ptr, byte_count);
break;
case TAG_MAKER_NOTE:
if (!exif_process_IFD_in_MAKERNOTE(ImageInfo, value_ptr, byte_count, offset_base, IFDlength, displacement)) {
EFREE_IF(outside);
return FALSE;
}
break;
case TAG_EXIF_IFD_POINTER:
case TAG_GPS_IFD_POINTER:
case TAG_INTEROP_IFD_POINTER:
if (ReadNextIFD) {
char *Subdir_start;
int sub_section_index = 0;
switch(tag) {
case TAG_EXIF_IFD_POINTER:
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Found EXIF");
#endif
ImageInfo->sections_found |= FOUND_EXIF;
sub_section_index = SECTION_EXIF;
break;
case TAG_GPS_IFD_POINTER:
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Found GPS");
#endif
ImageInfo->sections_found |= FOUND_GPS;
sub_section_index = SECTION_GPS;
break;
case TAG_INTEROP_IFD_POINTER:
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Found INTEROPERABILITY");
#endif
ImageInfo->sections_found |= FOUND_INTEROP;
sub_section_index = SECTION_INTEROP;
break;
}
Subdir_start = offset_base + php_ifd_get32u(value_ptr, ImageInfo->motorola_intel);
if (Subdir_start < offset_base || Subdir_start > offset_base+IFDlength) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD Pointer");
return FALSE;
}
if (!exif_process_IFD_in_JPEG(ImageInfo, Subdir_start, offset_base, IFDlength, displacement, sub_section_index, tag)) {
return FALSE;
}
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Subsection %s done", exif_get_sectionname(sub_section_index));
#endif
}
}
}
exif_iif_add_tag(ImageInfo, section_index, exif_get_tagname(tag, tagname, sizeof(tagname), tag_table), tag, format, components, value_ptr, byte_count);
EFREE_IF(outside);
return TRUE;
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.