idx
int64
func
string
target
int64
258,230
static int tunnel_dns ( int tun_fd , int dns_fd , int bind_fd ) { struct query q ; int read ; int domain_len ; int inside_topdomain = 0 ; if ( ( read = read_dns ( dns_fd , tun_fd , & q ) ) <= 0 ) return 0 ; if ( debug >= 2 ) { fprintf ( stderr , "RX: client %s, type %d, name %s\n" , format_addr ( & q . from , q . fromlen ) , q . type , q . name ) ; } domain_len = strlen ( q . name ) - strlen ( topdomain ) ; if ( domain_len >= 0 && ! strcasecmp ( q . name + domain_len , topdomain ) ) inside_topdomain = 1 ; if ( domain_len >= 1 && q . name [ domain_len - 1 ] != '.' ) inside_topdomain = 0 ; if ( inside_topdomain ) { if ( domain_len == 3 && q . type == T_A && ( q . name [ 0 ] == 'n' || q . name [ 0 ] == 'N' ) && ( q . name [ 1 ] == 's' || q . name [ 1 ] == 'S' ) && q . name [ 2 ] == '.' ) { handle_a_request ( dns_fd , & q , 0 ) ; return 0 ; } if ( domain_len == 4 && q . type == T_A && ( q . name [ 0 ] == 'w' || q . name [ 0 ] == 'W' ) && ( q . name [ 1 ] == 'w' || q . name [ 1 ] == 'W' ) && ( q . name [ 2 ] == 'w' || q . name [ 2 ] == 'W' ) && q . name [ 3 ] == '.' ) { handle_a_request ( dns_fd , & q , 1 ) ; return 0 ; } switch ( q . type ) { case T_NULL : case T_PRIVATE : case T_CNAME : case T_A : case T_MX : case T_SRV : case T_TXT : handle_null_request ( tun_fd , dns_fd , & q , domain_len ) ; break ; case T_NS : handle_ns_request ( dns_fd , & q ) ; break ; default : break ; } } else { if ( bind_fd ) { forward_query ( bind_fd , & q ) ; } } return 0 ; }
0
405,136
EXPORTED int mboxlist_findsub(struct namespace *namespace, const char *pattern, int isadmin, const char *userid, const struct auth_state *auth_state, findall_cb *proc, void *rock, int force) { strarray_t patterns = STRARRAY_INITIALIZER; strarray_append(&patterns, pattern); int r = mboxlist_findsubmulti(namespace, &patterns, isadmin, userid, auth_state, proc, rock, force); strarray_fini(&patterns); return r; }
0
367,572
static inline int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry) { return 0; }
0
281,316
spnego_gss_inquire_context( OM_uint32 *minor_status, const gss_ctx_id_t context_handle, gss_name_t *src_name, gss_name_t *targ_name, OM_uint32 *lifetime_rec, gss_OID *mech_type, OM_uint32 *ctx_flags, int *locally_initiated, int *opened) { OM_uint32 ret = GSS_S_COMPLETE; ret = gss_inquire_context(minor_status, context_handle, src_name, targ_name, lifetime_rec, mech_type, ctx_flags, locally_initiated, opened); return (ret); }
0
495,744
void Curl_free_idnconverted_hostname(struct hostname *host) { #if defined(USE_LIBIDN2) if(host->encalloc) { idn2_free(host->encalloc); /* must be freed with idn2_free() since this was allocated by libidn */ host->encalloc = NULL; } #elif defined(USE_WIN32_IDN) free(host->encalloc); /* must be freed with free() since this was allocated by curl_win32_idn_to_ascii */ host->encalloc = NULL; #else (void)host; #endif }
0
294,147
int gnutls_x509_ext_import_private_key_usage_period(const gnutls_datum_t * ext, time_t * activation, time_t * expiration) { int result, ret; ASN1_TYPE c2 = ASN1_TYPE_EMPTY; result = asn1_create_element (_gnutls_get_pkix(), "PKIX1.PrivateKeyUsagePeriod", &c2); if (result != ASN1_SUCCESS) { gnutls_assert(); ret = _gnutls_asn2err(result); goto cleanup; } result = _asn1_strict_der_decode(&c2, ext->data, ext->size, NULL); if (result != ASN1_SUCCESS) { gnutls_assert(); ret = _gnutls_asn2err(result); goto cleanup; } if (activation) *activation = _gnutls_x509_get_time(c2, "notBefore", 1); if (expiration) *expiration = _gnutls_x509_get_time(c2, "notAfter", 1); ret = 0; cleanup: asn1_delete_structure(&c2); return ret; }
0
140,875
int sc_mutex_create(const sc_context_t *ctx, void **mutex) { if (ctx == NULL) return SC_ERROR_INVALID_ARGUMENTS; if (ctx->thread_ctx != NULL && ctx->thread_ctx->create_mutex != NULL) return ctx->thread_ctx->create_mutex(mutex); else return SC_SUCCESS; }
0
436,152
big5_left_adjust_char_head(const UChar* start, const UChar* s) { const UChar *p; int len; if (s <= start) return (UChar* )s; p = s; if (BIG5_ISMB_TRAIL(*p)) { while (p > start) { if (! BIG5_ISMB_FIRST(*--p)) { p++; break; } } } len = enclen(ONIG_ENCODING_BIG5, p); if (p + len > s) return (UChar* )p; p += len; return (UChar* )(p + ((s - p) & ~1)); }
0
477,959
T& operator()(const unsigned int x, const unsigned int y, const unsigned int z) { return _data[x + y*(ulongT)_width + z*(ulongT)_width*_height]; }
0
56,306
std::chrono::milliseconds streamIdleTimeout() const override { return stream_idle_timeout_; }
0
14,624
SpeechRecognitionManagerImpl::SpeechRecognitionManagerImpl( media::AudioSystem* audio_system, MediaStreamManager* media_stream_manager) : audio_system_(audio_system), media_stream_manager_(media_stream_manager), primary_session_id_(kSessionIDInvalid), last_session_id_(kSessionIDInvalid), is_dispatching_event_(false), delegate_(GetContentClient() ->browser() ->CreateSpeechRecognitionManagerDelegate()), weak_factory_(this) { DCHECK(!g_speech_recognition_manager_impl); g_speech_recognition_manager_impl = this; frame_deletion_observer_.reset(new FrameDeletionObserver( base::BindRepeating(&SpeechRecognitionManagerImpl::AbortSessionImpl, weak_factory_.GetWeakPtr()))); }
1
345,857
do_restrict( sockaddr_u *srcadr, endpt *inter, struct req_pkt *inpkt, int op ) { char * datap; struct conf_restrict cr; u_short items; size_t item_sz; sockaddr_u matchaddr; sockaddr_u matchmask; int bad; /* * Do a check of the flags to make sure that only * the NTPPORT flag is set, if any. If not, complain * about it. Note we are very picky here. */ items = INFO_NITEMS(inpkt->err_nitems); item_sz = INFO_ITEMSIZE(inpkt->mbz_itemsize); datap = inpkt->u.data; if (item_sz > sizeof(cr)) { req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } bad = FALSE; while (items-- > 0 && !bad) { memcpy(&cr, datap, item_sz); cr.flags = ntohs(cr.flags); cr.mflags = ntohs(cr.mflags); if (~RESM_NTPONLY & cr.mflags) bad |= 1; if (~RES_ALLFLAGS & cr.flags) bad |= 2; if (INADDR_ANY != cr.mask) { if (client_v6_capable && cr.v6_flag) { if (IN6_IS_ADDR_UNSPECIFIED(&cr.addr6)) bad |= 4; } else { if (INADDR_ANY == cr.addr) bad |= 8; } } datap += item_sz; } if (bad) { msyslog(LOG_ERR, "do_restrict: bad = %#x", bad); req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } /* * Looks okay, try it out */ ZERO_SOCK(&matchaddr); ZERO_SOCK(&matchmask); datap = inpkt->u.data; while (items-- > 0) { memcpy(&cr, datap, item_sz); cr.flags = ntohs(cr.flags); cr.mflags = ntohs(cr.mflags); if (client_v6_capable && cr.v6_flag) { AF(&matchaddr) = AF_INET6; AF(&matchmask) = AF_INET6; SOCK_ADDR6(&matchaddr) = cr.addr6; SOCK_ADDR6(&matchmask) = cr.mask6; } else { AF(&matchaddr) = AF_INET; AF(&matchmask) = AF_INET; NSRCADR(&matchaddr) = cr.addr; NSRCADR(&matchmask) = cr.mask; } hack_restrict(op, &matchaddr, &matchmask, cr.mflags, cr.flags, 0); datap += item_sz; } req_ack(srcadr, inter, inpkt, INFO_OKAY); }
1
462,934
TEST(EqOp, MatchesMinKey) { BSONObj operand = BSON("a" << MinKey); EqualityMatchExpression eq; eq.init("a", operand["a"]).transitional_ignore(); ASSERT(eq.matchesBSON(BSON("a" << MinKey), NULL)); ASSERT(!eq.matchesBSON(BSON("a" << MaxKey), NULL)); ASSERT(!eq.matchesBSON(BSON("a" << 4), NULL)); }
0
257,976
Datum eqsel ( PG_FUNCTION_ARGS ) { PlannerInfo * root = ( PlannerInfo * ) PG_GETARG_POINTER ( 0 ) ; Oid operator = PG_GETARG_OID ( 1 ) ; List * args = ( List * ) PG_GETARG_POINTER ( 2 ) ; int varRelid = PG_GETARG_INT32 ( 3 ) ; VariableStatData vardata ; Node * other ; bool varonleft ; double selec ; if ( ! get_restriction_variable ( root , args , varRelid , & vardata , & other , & varonleft ) ) PG_RETURN_FLOAT8 ( DEFAULT_EQ_SEL ) ; if ( IsA ( other , Const ) ) selec = var_eq_const ( & vardata , operator , ( ( Const * ) other ) -> constvalue , ( ( Const * ) other ) -> constisnull , varonleft ) ; else selec = var_eq_non_const ( & vardata , operator , other , varonleft ) ; ReleaseVariableStats ( vardata ) ; PG_RETURN_FLOAT8 ( ( float8 ) selec ) ; }
0
33,975
void dup_mm_exe_file(struct mm_struct *oldmm, struct mm_struct *newmm) { /* It's safe to write the exe_file pointer without exe_file_lock because * this is called during fork when the task is not yet in /proc */ newmm->exe_file = get_mm_exe_file(oldmm); }
0
94,731
int ext4_alloc_flex_bg_array(struct super_block *sb, ext4_group_t ngroup) { struct ext4_sb_info *sbi = EXT4_SB(sb); struct flex_groups *new_groups; int size; if (!sbi->s_log_groups_per_flex) return 0; size = ext4_flex_group(sbi, ngroup - 1) + 1; if (size <= sbi->s_flex_groups_allocated) return 0; size = roundup_pow_of_two(size * sizeof(struct flex_groups)); new_groups = ext4_kvzalloc(size, GFP_KERNEL); if (!new_groups) { ext4_msg(sb, KERN_ERR, "not enough memory for %d flex groups", size / (int) sizeof(struct flex_groups)); return -ENOMEM; } if (sbi->s_flex_groups) { memcpy(new_groups, sbi->s_flex_groups, (sbi->s_flex_groups_allocated * sizeof(struct flex_groups))); kvfree(sbi->s_flex_groups); } sbi->s_flex_groups = new_groups; sbi->s_flex_groups_allocated = size / sizeof(struct flex_groups); return 0; }
0
333,832
static void dmg_refresh_limits(BlockDriverState *bs, Error **errp) { bs->request_alignment = BDRV_SECTOR_SIZE; /* No sub-sector I/O supported */ }
0
148,187
PathMatcherImpl(const RequirementRule& rule) : BaseMatcherImpl(rule), path_(rule.match().path()), path_matcher_(Matchers::PathMatcher::createExact(path_, !case_sensitive_)) {}
0
83,744
void cil_destroy_category(struct cil_cat *cat) { if (cat == NULL) { return; } cil_symtab_datum_destroy(&cat->datum); free(cat); }
0
20,542
static int bind_socket_ai ( struct addrinfo * ai , int reuse ) { int fd , on = 1 , r ; int serrno ; fd = socket ( AF_INET , SOCK_STREAM , 0 ) ; if ( fd == - 1 ) { event_warn ( "socket" ) ; return ( - 1 ) ; } if ( evutil_make_socket_nonblocking ( fd ) < 0 ) goto out ; # ifndef WIN32 if ( fcntl ( fd , F_SETFD , 1 ) == - 1 ) { event_warn ( "fcntl(F_SETFD)" ) ; goto out ; } # endif setsockopt ( fd , SOL_SOCKET , SO_KEEPALIVE , ( void * ) & on , sizeof ( on ) ) ; if ( reuse ) { setsockopt ( fd , SOL_SOCKET , SO_REUSEADDR , ( void * ) & on , sizeof ( on ) ) ; } if ( ai != NULL ) { r = bind ( fd , ai -> ai_addr , ai -> ai_addrlen ) ; if ( r == - 1 ) goto out ; } return ( fd ) ; out : serrno = EVUTIL_SOCKET_ERROR ( ) ; EVUTIL_CLOSESOCKET ( fd ) ; EVUTIL_SET_SOCKET_ERROR ( serrno ) ; return ( - 1 ) ; }
0
253,545
MultiBufferBlockId ResourceMultiBufferDataProvider::Tell() const { return pos_; }
0
31,193
gchar * proto_find_undecoded_data ( proto_tree * tree , guint length ) { gchar * decoded = ( gchar * ) wmem_alloc0 ( wmem_packet_scope ( ) , length / 8 + 1 ) ; proto_tree_traverse_pre_order ( tree , check_for_undecoded , decoded ) ; return decoded ; }
0
204,592
int venc_dev::venc_input_log_buffers(OMX_BUFFERHEADERTYPE *pbuffer, int fd, int plane_offset) { if (venc_handle->is_secure_session()) { DEBUG_PRINT_ERROR("logging secure input buffers is not allowed!"); return -1; } if (!m_debug.infile) { int size = snprintf(m_debug.infile_name, PROPERTY_VALUE_MAX, "%s/input_enc_%lu_%lu_%p.yuv", m_debug.log_loc, m_sVenc_cfg.input_width, m_sVenc_cfg.input_height, this); if ((size > PROPERTY_VALUE_MAX) && (size < 0)) { DEBUG_PRINT_ERROR("Failed to open output file: %s for logging size:%d", m_debug.infile_name, size); } m_debug.infile = fopen (m_debug.infile_name, "ab"); if (!m_debug.infile) { DEBUG_PRINT_HIGH("Failed to open input file: %s for logging", m_debug.infile_name); m_debug.infile_name[0] = '\0'; return -1; } } if (m_debug.infile && pbuffer && pbuffer->nFilledLen) { unsigned long i, msize; int stride = VENUS_Y_STRIDE(COLOR_FMT_NV12, m_sVenc_cfg.input_width); int scanlines = VENUS_Y_SCANLINES(COLOR_FMT_NV12, m_sVenc_cfg.input_height); unsigned char *pvirt,*ptemp; char *temp = (char *)pbuffer->pBuffer; msize = VENUS_BUFFER_SIZE(COLOR_FMT_NV12, m_sVenc_cfg.input_width, m_sVenc_cfg.input_height); if (metadatamode == 1) { pvirt= (unsigned char *)mmap(NULL, msize, PROT_READ|PROT_WRITE,MAP_SHARED, fd, plane_offset); if (pvirt) { ptemp = pvirt; for (i = 0; i < m_sVenc_cfg.input_height; i++) { fwrite(ptemp, m_sVenc_cfg.input_width, 1, m_debug.infile); ptemp += stride; } ptemp = pvirt + (stride * scanlines); for(i = 0; i < m_sVenc_cfg.input_height/2; i++) { fwrite(ptemp, m_sVenc_cfg.input_width, 1, m_debug.infile); ptemp += stride; } munmap(pvirt, msize); } else if (pvirt == MAP_FAILED) { DEBUG_PRINT_ERROR("%s mmap failed", __func__); return -1; } } else { for (i = 0; i < m_sVenc_cfg.input_height; i++) { fwrite(temp, m_sVenc_cfg.input_width, 1, m_debug.infile); temp += stride; } temp = (char *)pbuffer->pBuffer + (stride * scanlines); for(i = 0; i < m_sVenc_cfg.input_height/2; i++) { fwrite(temp, m_sVenc_cfg.input_width, 1, m_debug.infile); temp += stride; } } } return 0; }
0
326,724
static int decode_value(SCPRContext *s, unsigned *cnt, unsigned maxc, unsigned step, unsigned *rval) { GetByteContext *gb = &s->gb; RangeCoder *rc = &s->rc; unsigned totfr = cnt[maxc]; unsigned value; unsigned c = 0, cumfr = 0, cnt_c = 0; int i, ret; if ((ret = s->get_freq(rc, totfr, &value)) < 0) return ret; while (c < maxc) { cnt_c = cnt[c]; if (value >= cumfr + cnt_c) cumfr += cnt_c; else break; c++; } s->decode(gb, rc, cumfr, cnt_c, totfr); cnt[c] = cnt_c + step; totfr += step; if (totfr > BOT) { totfr = 0; for (i = 0; i < maxc; i++) { unsigned nc = (cnt[i] >> 1) + 1; cnt[i] = nc; totfr += nc; } } cnt[maxc] = totfr; *rval = c; return 0; }
0
288,778
static GstFlowReturn gst_asf_demux_process_advanced_mutual_exclusion ( GstASFDemux * demux , guint8 * data , guint64 size ) { ASFGuid guid ; guint16 num , i ; if ( size < 16 + 2 + ( 2 * 2 ) ) goto not_enough_data ; gst_asf_demux_get_guid ( & guid , & data , & size ) ; num = gst_asf_demux_get_uint16 ( & data , & size ) ; if ( num < 2 ) { GST_WARNING_OBJECT ( demux , "nonsensical mutually exclusive streams count" ) ; return GST_FLOW_OK ; } if ( size < ( num * sizeof ( guint16 ) ) ) goto not_enough_data ; for ( i = 0 ; i < num ; ++ i ) { guint8 mes ; mes = gst_asf_demux_get_uint16 ( & data , & size ) & 0x7f ; GST_LOG_OBJECT ( demux , "mutually exclusive: stream %d" , mes ) ; demux -> mut_ex_streams = g_slist_append ( demux -> mut_ex_streams , GINT_TO_POINTER ( mes ) ) ; } return GST_FLOW_OK ; not_enough_data : { GST_WARNING_OBJECT ( demux , "short read parsing advanced mutual exclusion" ) ; return GST_FLOW_OK ; } }
0
393,533
xmlidDocTest(const char *filename, const char *result, const char *err, int options) { int res = 0; int ret = 0; char *temp; xpathDocument = xmlReadFile(filename, NULL, options | XML_PARSE_DTDATTR | XML_PARSE_NOENT); if (xpathDocument == NULL) { fprintf(stderr, "Failed to load %s\n", filename); return(-1); } temp = resultFilename(filename, "", ".res"); if (temp == NULL) { fprintf(stderr, "Out of memory\n"); fatalError(); } xpathOutput = fopen(temp, "wb"); if (xpathOutput == NULL) { fprintf(stderr, "failed to open output file %s\n", temp); xmlFreeDoc(xpathDocument); free(temp); return(-1); } testXPath("id('bar')", 0, 0); fclose(xpathOutput); if (result != NULL) { ret = compareFiles(temp, result); if (ret) { fprintf(stderr, "Result for %s failed in %s\n", filename, result); res = 1; } } if (temp != NULL) { unlink(temp); free(temp); } xmlFreeDoc(xpathDocument); if (err != NULL) { ret = compareFileMem(err, testErrors, testErrorsSize); if (ret != 0) { fprintf(stderr, "Error for %s failed\n", filename); res = 1; } } return(res); }
0
192,144
LayoutUnit RenderFlexibleBox::childIntrinsicWidth(RenderBox* child) const { if (!child->isHorizontalWritingMode() && needToStretchChildLogicalHeight(child)) return constrainedChildIntrinsicContentLogicalHeight(child); return child->width(); }
0
192,181
UserShare* SyncManager::GetUserShare() const { return data_->GetUserShare(); }
0
58,997
void abst_box_del(GF_Box *s) { GF_AdobeBootstrapInfoBox *ptr = (GF_AdobeBootstrapInfoBox *)s; if (ptr == NULL) return; if (ptr->movie_identifier) gf_free(ptr->movie_identifier); if (ptr->drm_data) gf_free(ptr->drm_data); if (ptr->meta_data) gf_free(ptr->meta_data); while (gf_list_count(ptr->server_entry_table)) { gf_free(gf_list_get(ptr->server_entry_table, 0)); gf_list_rem(ptr->server_entry_table, 0); } gf_list_del(ptr->server_entry_table); while (gf_list_count(ptr->quality_entry_table)) { gf_free(gf_list_get(ptr->quality_entry_table, 0)); gf_list_rem(ptr->quality_entry_table, 0); } gf_list_del(ptr->quality_entry_table); while (gf_list_count(ptr->segment_run_table_entries)) { gf_isom_box_del((GF_Box *)gf_list_get(ptr->segment_run_table_entries, 0)); gf_list_rem(ptr->segment_run_table_entries, 0); } gf_list_del(ptr->segment_run_table_entries); while (gf_list_count(ptr->fragment_run_table_entries)) { gf_isom_box_del((GF_Box *)gf_list_get(ptr->fragment_run_table_entries, 0)); gf_list_rem(ptr->fragment_run_table_entries, 0); } gf_list_del(ptr->fragment_run_table_entries); gf_free(ptr); }
0
118,096
lookup_installation_for_path (GFile *path, GError **error) { FlatpakInstallation *installation; if (installation_cache == NULL) installation_cache = g_hash_table_new_full (g_file_hash, (GEqualFunc)g_file_equal, g_object_unref, g_object_unref); installation = g_hash_table_lookup (installation_cache, path); if (installation == NULL) { g_autoptr(FlatpakDir) dir = NULL; dir = flatpak_dir_get_by_path (path); installation = flatpak_installation_new_for_dir (dir, NULL, error); if (installation == NULL) return NULL; flatpak_installation_set_no_interaction (installation, TRUE); g_hash_table_insert (installation_cache, g_object_ref (path), installation); } return g_object_ref (installation); }
0
304,915
GF_Err pdin_Write(GF_Box *s, GF_BitStream *bs) { GF_Err e; u32 i; GF_ProgressiveDownloadBox *ptr = (GF_ProgressiveDownloadBox *)s; e = gf_isom_full_box_write(s, bs); if (e) return e; for (i=0; i<ptr->count; i++) { gf_bs_write_u32(bs, ptr->rates[i]); gf_bs_write_u32(bs, ptr->times[i]); } return GF_OK;
0
168,751
DrawingBuffer* WebGLRenderingContextBase::GetDrawingBuffer() const { return drawing_buffer_.get(); }
0
283,402
static void OverloadedMethodLMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { scheduler::CooperativeSchedulingManager::Instance()->Safepoint(); bool is_arity_error = false; switch (std::min(2, info.Length())) { case 1: if (info[0]->IsNumber()) { OverloadedMethodL1Method(info); return; } if (true) { OverloadedMethodL2Method(info); return; } if (true) { OverloadedMethodL1Method(info); return; } break; case 2: if (info[0]->IsNumber()) { OverloadedMethodL1Method(info); return; } if (true) { OverloadedMethodL2Method(info); return; } if (true) { OverloadedMethodL1Method(info); return; } break; default: is_arity_error = true; } ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, "TestObject", "overloadedMethodL"); if (is_arity_error) { if (info.Length() < 1) { exception_state.ThrowTypeError(ExceptionMessages::NotEnoughArguments(1, info.Length())); return; } } exception_state.ThrowTypeError("No function was found that matched the signature provided."); }
0
33,575
mono_verifier_is_signature_compatible (MonoMethodSignature *target, MonoMethodSignature *candidate) { return mono_delegate_signature_equal (target, candidate, FALSE); }
0
357,904
static int ext4_journalled_writepage(struct page *page, struct writeback_control *wbc) { struct inode *inode = page->mapping->host; loff_t size = i_size_read(inode); loff_t len; trace_mark(ext4_journalled_writepage, "dev %s ino %lu page_index %lu", inode->i_sb->s_id, inode->i_ino, page->index); J_ASSERT(PageLocked(page)); if (page->index == size >> PAGE_CACHE_SHIFT) len = size & ~PAGE_CACHE_MASK; else len = PAGE_CACHE_SIZE; if (page_has_buffers(page)) { /* if page has buffers it should all be mapped * and allocated. If there are not buffers attached * to the page we know the page is dirty but it lost * buffers. That means that at some moment in time * after write_begin() / write_end() has been called * all buffers have been clean and thus they must have been * written at least once. So they are all mapped and we can * happily proceed with mapping them and writing the page. */ BUG_ON(walk_page_buffers(NULL, page_buffers(page), 0, len, NULL, ext4_bh_unmapped_or_delay)); } if (ext4_journal_current_handle()) goto no_write; if (PageChecked(page)) { /* * It's mmapped pagecache. Add buffers and journal it. There * doesn't seem much point in redirtying the page here. */ ClearPageChecked(page); return __ext4_journalled_writepage(page, wbc); } else { /* * It may be a page full of checkpoint-mode buffers. We don't * really know unless we go poke around in the buffer_heads. * But block_write_full_page will do the right thing. */ return block_write_full_page(page, ext4_normal_get_block_write, wbc); } no_write: redirty_page_for_writepage(wbc, page); unlock_page(page); return 0; }
0
333,785
static void test_visitor_in_native_list_uint16(TestInputVisitorData *data, const void *unused) { test_native_list_integer_helper(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_U16); }
0
271,764
void MessageWrapper::Wrap(const std::string& message, std::string& out) { // If there is a fixed message, it is stored in prefix. Otherwise prefix contains // only the prefix, so append the message and the suffix out.assign(prefix); if (!fixed) out.append(message).append(suffix); }
0
32,465
static void build_mixer_unit_ctl(struct mixer_build *state, struct uac_mixer_unit_descriptor *desc, int in_pin, int in_ch, int unitid, struct usb_audio_term *iterm) { struct usb_mixer_elem_info *cval; unsigned int num_outs = uac_mixer_unit_bNrChannels(desc); unsigned int i, len; struct snd_kcontrol *kctl; const struct usbmix_name_map *map; map = find_map(state, unitid, 0); if (check_ignored_ctl(map)) return; cval = kzalloc(sizeof(*cval), GFP_KERNEL); if (!cval) return; snd_usb_mixer_elem_init_std(&cval->head, state->mixer, unitid); cval->control = in_ch + 1; /* based on 1 */ cval->val_type = USB_MIXER_S16; for (i = 0; i < num_outs; i++) { __u8 *c = uac_mixer_unit_bmControls(desc, state->mixer->protocol); if (check_matrix_bitmap(c, in_ch, i, num_outs)) { cval->cmask |= (1 << i); cval->channels++; } } /* get min/max values */ get_min_max(cval, 0); kctl = snd_ctl_new1(&usb_feature_unit_ctl, cval); if (!kctl) { usb_audio_err(state->chip, "cannot malloc kcontrol\n"); kfree(cval); return; } kctl->private_free = snd_usb_mixer_elem_free; len = check_mapped_name(map, kctl->id.name, sizeof(kctl->id.name)); if (!len) len = get_term_name(state, iterm, kctl->id.name, sizeof(kctl->id.name), 0); if (!len) len = sprintf(kctl->id.name, "Mixer Source %d", in_ch + 1); append_ctl_name(kctl, " Volume"); usb_audio_dbg(state->chip, "[%d] MU [%s] ch = %d, val = %d/%d\n", cval->head.id, kctl->id.name, cval->channels, cval->min, cval->max); snd_usb_mixer_add_control(&cval->head, kctl); }
0
49,253
TEST(FormatterTest, RuntimePrecision) { char format_str[BUFFER_SIZE]; safe_sprintf(format_str, "{0:.{%u", UINT_MAX); increment(format_str + 5); EXPECT_THROW_MSG(format(format_str, 0), FormatError, "number is too big"); std::size_t size = std::strlen(format_str); format_str[size] = '}'; format_str[size + 1] = 0; EXPECT_THROW_MSG(format(format_str, 0), FormatError, "number is too big"); format_str[size + 1] = '}'; format_str[size + 2] = 0; EXPECT_THROW_MSG(format(format_str, 0), FormatError, "number is too big"); EXPECT_THROW_MSG(format("{0:.{", 0), FormatError, "invalid format string"); EXPECT_THROW_MSG(format("{0:.{}", 0), FormatError, "cannot switch from manual to automatic argument indexing"); EXPECT_THROW_MSG(format("{0:.{?}}", 0), FormatError, "invalid format string"); EXPECT_THROW_MSG(format("{0:.{1}", 0, 0), FormatError, "precision not allowed in integer format specifier"); EXPECT_THROW_MSG(format("{0:.{1}}", 0), FormatError, "argument index out of range"); EXPECT_THROW_MSG(format("{0:.{0:}}", 0), FormatError, "invalid format string"); EXPECT_THROW_MSG(format("{0:.{1}}", 0, -1), FormatError, "negative precision"); EXPECT_THROW_MSG(format("{0:.{1}}", 0, (INT_MAX + 1u)), FormatError, "number is too big"); EXPECT_THROW_MSG(format("{0:.{1}}", 0, -1l), FormatError, "negative precision"); if (fmt::internal::const_check(sizeof(long) > sizeof(int))) { long value = INT_MAX; EXPECT_THROW_MSG(format("{0:.{1}}", 0, (value + 1)), FormatError, "number is too big"); } EXPECT_THROW_MSG(format("{0:.{1}}", 0, (INT_MAX + 1ul)), FormatError, "number is too big"); EXPECT_THROW_MSG(format("{0:.{1}}", 0, '0'), FormatError, "precision is not integer"); EXPECT_THROW_MSG(format("{0:.{1}}", 0, 0.0), FormatError, "precision is not integer"); EXPECT_THROW_MSG(format("{0:.{1}}", 42, 2), FormatError, "precision not allowed in integer format specifier"); EXPECT_THROW_MSG(format("{0:.{1}f}", 42, 2), FormatError, "precision not allowed in integer format specifier"); EXPECT_THROW_MSG(format("{0:.{1}}", 42u, 2), FormatError, "precision not allowed in integer format specifier"); EXPECT_THROW_MSG(format("{0:.{1}f}", 42u, 2), FormatError, "precision not allowed in integer format specifier"); EXPECT_THROW_MSG(format("{0:.{1}}", 42l, 2), FormatError, "precision not allowed in integer format specifier"); EXPECT_THROW_MSG(format("{0:.{1}f}", 42l, 2), FormatError, "precision not allowed in integer format specifier"); EXPECT_THROW_MSG(format("{0:.{1}}", 42ul, 2), FormatError, "precision not allowed in integer format specifier"); EXPECT_THROW_MSG(format("{0:.{1}f}", 42ul, 2), FormatError, "precision not allowed in integer format specifier"); EXPECT_THROW_MSG(format("{0:.{1}}", 42ll, 2), FormatError, "precision not allowed in integer format specifier"); EXPECT_THROW_MSG(format("{0:.{1}f}", 42ll, 2), FormatError, "precision not allowed in integer format specifier"); EXPECT_THROW_MSG(format("{0:.{1}}", 42ull, 2), FormatError, "precision not allowed in integer format specifier"); EXPECT_THROW_MSG(format("{0:.{1}f}", 42ull, 2), FormatError, "precision not allowed in integer format specifier"); EXPECT_THROW_MSG(format("{0:3.{1}}", 'x', 0), FormatError, "precision not allowed in integer format specifier"); EXPECT_EQ("1.2", format("{0:.{1}}", 1.2345, 2)); EXPECT_EQ("1.2", format("{1:.{0}}", 2, 1.2345l)); EXPECT_THROW_MSG(format("{0:.{1}}", reinterpret_cast<void*>(0xcafe), 2), FormatError, "precision not allowed in pointer format specifier"); EXPECT_THROW_MSG(format("{0:.{1}f}", reinterpret_cast<void*>(0xcafe), 2), FormatError, "precision not allowed in pointer format specifier"); EXPECT_EQ("st", format("{0:.{1}}", "str", 2)); }
0
289,069
static int dissect_h225_INTEGER_1_65535 ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 1U , 65535U , NULL , FALSE ) ; return offset ; }
0
478,791
CImg<intT> get_select(CImgDisplay &disp, const unsigned int feature_type=2, unsigned int *const XYZ=0, const bool exit_on_anykey=false, const bool is_deep_selection_default=false) const { return _select(disp,0,feature_type,XYZ,0,0,0,exit_on_anykey,true,false,is_deep_selection_default); }
0
320,682
bool net_tx_pkt_add_raw_fragment(struct NetTxPkt *pkt, hwaddr pa, size_t len) { hwaddr mapped_len = 0; struct iovec *ventry; assert(pkt); assert(pkt->max_raw_frags > pkt->raw_frags); if (!len) { return true; } ventry = &pkt->raw[pkt->raw_frags]; mapped_len = len; ventry->iov_base = cpu_physical_memory_map(pa, &mapped_len, false); ventry->iov_len = mapped_len; pkt->raw_frags += !!ventry->iov_base; if ((ventry->iov_base == NULL) || (len != mapped_len)) { return false; } return true; }
0
105,459
njs_vmcode_interpreter(njs_vm_t *vm, u_char *pc, void *promise_cap, void *async_ctx) { u_char *catch; double num, exponent; int32_t i32; uint32_t u32; njs_str_t string; njs_uint_t hint; njs_bool_t valid, lambda_call; njs_value_t *retval, *value1, *value2; njs_value_t *src, *s1, *s2, dst; njs_value_t *function, name; njs_value_t numeric1, numeric2, primitive1, primitive2; njs_frame_t *frame; njs_jump_off_t ret; njs_vmcode_await_t *await; njs_native_frame_t *previous, *native; njs_property_next_t *next; njs_vmcode_import_t *import; njs_vmcode_finally_t *finally; njs_vmcode_generic_t *vmcode; njs_vmcode_variable_t *var; njs_vmcode_move_arg_t *move_arg; njs_vmcode_prop_get_t *get; njs_vmcode_prop_set_t *set; njs_vmcode_operation_t op; njs_vmcode_prop_next_t *pnext; njs_vmcode_test_jump_t *test_jump; njs_vmcode_equal_jump_t *equal; njs_vmcode_try_return_t *try_return; njs_vmcode_method_frame_t *method_frame; njs_vmcode_function_copy_t *fcopy; njs_vmcode_prop_accessor_t *accessor; njs_vmcode_try_trampoline_t *try_trampoline; njs_vmcode_function_frame_t *function_frame; next: for ( ;; ) { vmcode = (njs_vmcode_generic_t *) pc; /* * The first operand is passed as is in value2 to * NJS_VMCODE_JUMP, * NJS_VMCODE_IF_TRUE_JUMP, * NJS_VMCODE_IF_FALSE_JUMP, * NJS_VMCODE_FUNCTION_FRAME, * NJS_VMCODE_FUNCTION_CALL, * NJS_VMCODE_RETURN, * NJS_VMCODE_TRY_START, * NJS_VMCODE_TRY_CONTINUE, * NJS_VMCODE_TRY_BREAK, * NJS_VMCODE_TRY_END, * NJS_VMCODE_CATCH, * NJS_VMCODE_THROW, * NJS_VMCODE_STOP. */ value2 = (njs_value_t *) vmcode->operand1; value1 = NULL; switch (vmcode->code.operands) { case NJS_VMCODE_3OPERANDS: njs_vmcode_operand(vm, vmcode->operand3, value2); /* Fall through. */ case NJS_VMCODE_2OPERANDS: njs_vmcode_operand(vm, vmcode->operand2, value1); } op = vmcode->code.operation; /* * On success an operation returns size of the bytecode, * a jump offset or zero after the call or return operations. * Jumps can return a negative offset. Compilers can generate * (ret < 0 && ret >= NJS_PREEMPT) * as a single unsigned comparision. */ if (op > NJS_VMCODE_NORET) { if (op == NJS_VMCODE_MOVE) { njs_vmcode_operand(vm, vmcode->operand1, retval); *retval = *value1; pc += sizeof(njs_vmcode_move_t); goto next; } if (op == NJS_VMCODE_PROPERTY_GET) { get = (njs_vmcode_prop_get_t *) pc; njs_vmcode_operand(vm, get->value, retval); ret = njs_value_property(vm, value1, value2, retval); if (njs_slow_path(ret == NJS_ERROR)) { goto error; } pc += sizeof(njs_vmcode_prop_get_t); goto next; } switch (op) { case NJS_VMCODE_INCREMENT: case NJS_VMCODE_POST_INCREMENT: case NJS_VMCODE_DECREMENT: case NJS_VMCODE_POST_DECREMENT: if (njs_slow_path(!njs_is_numeric(value2))) { ret = njs_value_to_numeric(vm, value2, &numeric1); if (njs_slow_path(ret != NJS_OK)) { goto error; } num = njs_number(&numeric1); } else { num = njs_number(value2); } njs_set_number(value1, num + (1 - 2 * ((op - NJS_VMCODE_INCREMENT) >> 1))); njs_vmcode_operand(vm, vmcode->operand1, retval); if (op & 1) { njs_set_number(retval, num); } else { *retval = *value1; } pc += sizeof(njs_vmcode_3addr_t); goto next; case NJS_VMCODE_GLOBAL_GET: get = (njs_vmcode_prop_get_t *) pc; njs_vmcode_operand(vm, get->value, retval); ret = njs_value_property(vm, value1, value2, retval); if (njs_slow_path(ret == NJS_ERROR)) { goto error; } pc += sizeof(njs_vmcode_prop_get_t); if (ret == NJS_OK) { pc += sizeof(njs_vmcode_error_t); } goto next; /* * njs_vmcode_try_return() saves a return value to use it later by * njs_vmcode_finally(), and jumps to the nearest try_break block. */ case NJS_VMCODE_TRY_RETURN: njs_vmcode_operand(vm, vmcode->operand1, retval); *retval = *value1; try_return = (njs_vmcode_try_return_t *) pc; pc += try_return->offset; goto next; case NJS_VMCODE_LESS: case NJS_VMCODE_GREATER: case NJS_VMCODE_LESS_OR_EQUAL: case NJS_VMCODE_GREATER_OR_EQUAL: case NJS_VMCODE_ADDITION: if (njs_slow_path(!njs_is_primitive(value1))) { hint = (op == NJS_VMCODE_ADDITION) && njs_is_date(value1); ret = njs_value_to_primitive(vm, &primitive1, value1, hint); if (ret != NJS_OK) { goto error; } value1 = &primitive1; } if (njs_slow_path(!njs_is_primitive(value2))) { hint = (op == NJS_VMCODE_ADDITION) && njs_is_date(value2); ret = njs_value_to_primitive(vm, &primitive2, value2, hint); if (ret != NJS_OK) { goto error; } value2 = &primitive2; } if (njs_slow_path(njs_is_symbol(value1) || njs_is_symbol(value2))) { njs_symbol_conversion_failed(vm, (op == NJS_VMCODE_ADDITION) && (njs_is_string(value1) || njs_is_string(value2))); goto error; } njs_vmcode_operand(vm, vmcode->operand1, retval); if (op == NJS_VMCODE_ADDITION) { if (njs_fast_path(njs_is_numeric(value1) && njs_is_numeric(value2))) { njs_set_number(retval, njs_number(value1) + njs_number(value2)); pc += sizeof(njs_vmcode_3addr_t); goto next; } if (njs_is_string(value1)) { s1 = value1; s2 = &dst; src = value2; } else { s1 = &dst; s2 = value2; src = value1; } ret = njs_primitive_value_to_string(vm, &dst, src); if (njs_slow_path(ret != NJS_OK)) { goto error; } ret = njs_string_concat(vm, s1, s2); if (njs_slow_path(ret == NJS_ERROR)) { goto error; } *retval = vm->retval; pc += ret; goto next; } if ((uint8_t) (op - NJS_VMCODE_GREATER) < 2) { /* NJS_VMCODE_GREATER, NJS_VMCODE_LESS_OR_EQUAL */ src = value1; value1 = value2; value2 = src; } ret = njs_primitive_values_compare(vm, value1, value2); if (op < NJS_VMCODE_LESS_OR_EQUAL) { ret = ret > 0; } else { ret = ret == 0; } njs_set_boolean(retval, ret); pc += sizeof(njs_vmcode_3addr_t); goto next; case NJS_VMCODE_EQUAL: case NJS_VMCODE_NOT_EQUAL: ret = njs_values_equal(vm, value1, value2); if (njs_slow_path(ret < 0)) { goto error; } ret ^= op - NJS_VMCODE_EQUAL; njs_vmcode_operand(vm, vmcode->operand1, retval); njs_set_boolean(retval, ret); pc += sizeof(njs_vmcode_3addr_t); goto next; case NJS_VMCODE_SUBSTRACTION: case NJS_VMCODE_MULTIPLICATION: case NJS_VMCODE_EXPONENTIATION: case NJS_VMCODE_DIVISION: case NJS_VMCODE_REMAINDER: case NJS_VMCODE_BITWISE_AND: case NJS_VMCODE_BITWISE_OR: case NJS_VMCODE_BITWISE_XOR: case NJS_VMCODE_LEFT_SHIFT: case NJS_VMCODE_RIGHT_SHIFT: case NJS_VMCODE_UNSIGNED_RIGHT_SHIFT: if (njs_slow_path(!njs_is_numeric(value1))) { ret = njs_value_to_numeric(vm, value1, &numeric1); if (njs_slow_path(ret != NJS_OK)) { goto error; } value1 = &numeric1; } if (njs_slow_path(!njs_is_numeric(value2))) { ret = njs_value_to_numeric(vm, value2, &numeric2); if (njs_slow_path(ret != NJS_OK)) { goto error; } value2 = &numeric2; } num = njs_number(value1); njs_vmcode_operand(vm, vmcode->operand1, retval); pc += sizeof(njs_vmcode_3addr_t); switch (op) { case NJS_VMCODE_SUBSTRACTION: num -= njs_number(value2); break; case NJS_VMCODE_MULTIPLICATION: num *= njs_number(value2); break; case NJS_VMCODE_EXPONENTIATION: exponent = njs_number(value2); /* * According to ES7: * 1. If exponent is NaN, the result should be NaN; * 2. The result of +/-1 ** +/-Infinity should be NaN. */ valid = njs_expect(1, fabs(num) != 1 || (!isnan(exponent) && !isinf(exponent))); num = valid ? pow(num, exponent) : NAN; break; case NJS_VMCODE_DIVISION: num /= njs_number(value2); break; case NJS_VMCODE_REMAINDER: num = fmod(num, njs_number(value2)); break; case NJS_VMCODE_BITWISE_AND: case NJS_VMCODE_BITWISE_OR: case NJS_VMCODE_BITWISE_XOR: i32 = njs_number_to_int32(njs_number(value2)); switch (op) { case NJS_VMCODE_BITWISE_AND: i32 &= njs_number_to_int32(num); break; case NJS_VMCODE_BITWISE_OR: i32 |= njs_number_to_int32(num); break; case NJS_VMCODE_BITWISE_XOR: i32 ^= njs_number_to_int32(num); break; } njs_set_int32(retval, i32); goto next; default: u32 = njs_number_to_uint32(njs_number(value2)) & 0x1f; switch (op) { case NJS_VMCODE_LEFT_SHIFT: case NJS_VMCODE_RIGHT_SHIFT: i32 = njs_number_to_int32(num); if (op == NJS_VMCODE_LEFT_SHIFT) { /* Shifting of negative numbers is undefined. */ i32 = (uint32_t) i32 << u32; } else { i32 >>= u32; } njs_set_int32(retval, i32); break; default: /* NJS_VMCODE_UNSIGNED_RIGHT_SHIFT */ njs_set_uint32(retval, njs_number_to_uint32(num) >> u32); } goto next; } njs_set_number(retval, num); goto next; case NJS_VMCODE_OBJECT_COPY: ret = njs_vmcode_object_copy(vm, value1, value2); break; case NJS_VMCODE_TEMPLATE_LITERAL: ret = njs_vmcode_template_literal(vm, value1, value2); break; case NJS_VMCODE_PROPERTY_IN: ret = njs_vmcode_property_in(vm, value1, value2); break; case NJS_VMCODE_PROPERTY_DELETE: ret = njs_value_property_delete(vm, value1, value2, NULL); if (njs_fast_path(ret != NJS_ERROR)) { vm->retval = njs_value_true; ret = sizeof(njs_vmcode_3addr_t); } break; case NJS_VMCODE_PROPERTY_FOREACH: ret = njs_vmcode_property_foreach(vm, value1, value2, pc); break; case NJS_VMCODE_STRICT_EQUAL: case NJS_VMCODE_STRICT_NOT_EQUAL: ret = njs_values_strict_equal(value1, value2); ret ^= op - NJS_VMCODE_STRICT_EQUAL; njs_vmcode_operand(vm, vmcode->operand1, retval); njs_set_boolean(retval, ret); pc += sizeof(njs_vmcode_3addr_t); goto next; case NJS_VMCODE_TEST_IF_TRUE: case NJS_VMCODE_TEST_IF_FALSE: case NJS_VMCODE_COALESCE: if (op == NJS_VMCODE_COALESCE) { ret = !njs_is_null_or_undefined(value1); } else { ret = njs_is_true(value1); ret ^= op - NJS_VMCODE_TEST_IF_TRUE; } if (ret) { test_jump = (njs_vmcode_test_jump_t *) pc; ret = test_jump->offset; } else { ret = sizeof(njs_vmcode_3addr_t); } njs_vmcode_operand(vm, vmcode->operand1, retval); *retval = *value1; pc += ret; goto next; case NJS_VMCODE_UNARY_PLUS: case NJS_VMCODE_UNARY_NEGATION: case NJS_VMCODE_BITWISE_NOT: if (njs_slow_path(!njs_is_numeric(value1))) { ret = njs_value_to_numeric(vm, value1, &numeric1); if (njs_slow_path(ret != NJS_OK)) { goto error; } value1 = &numeric1; } num = njs_number(value1); njs_vmcode_operand(vm, vmcode->operand1, retval); switch (op) { case NJS_VMCODE_UNARY_NEGATION: num = -num; /* Fall through. */ case NJS_VMCODE_UNARY_PLUS: njs_set_number(retval, num); break; case NJS_VMCODE_BITWISE_NOT: njs_set_int32(retval, ~njs_number_to_uint32(num)); } pc += sizeof(njs_vmcode_2addr_t); goto next; case NJS_VMCODE_LOGICAL_NOT: njs_vmcode_operand(vm, vmcode->operand1, retval); njs_set_boolean(retval, !njs_is_true(value1)); pc += sizeof(njs_vmcode_2addr_t); goto next; case NJS_VMCODE_OBJECT: ret = njs_vmcode_object(vm); break; case NJS_VMCODE_ARRAY: ret = njs_vmcode_array(vm, pc); break; case NJS_VMCODE_FUNCTION: ret = njs_vmcode_function(vm, pc); break; case NJS_VMCODE_REGEXP: ret = njs_vmcode_regexp(vm, pc); break; case NJS_VMCODE_INSTANCE_OF: ret = njs_vmcode_instance_of(vm, value1, value2); break; case NJS_VMCODE_TYPEOF: ret = njs_vmcode_typeof(vm, value1, value2); break; case NJS_VMCODE_VOID: njs_set_undefined(&vm->retval); ret = sizeof(njs_vmcode_2addr_t); break; case NJS_VMCODE_DELETE: njs_release(vm, value1); vm->retval = njs_value_true; ret = sizeof(njs_vmcode_2addr_t); break; case NJS_VMCODE_DEBUGGER: ret = njs_vmcode_debugger(vm); break; default: njs_internal_error(vm, "%d has retval", op); goto error; } if (njs_slow_path(ret < 0 && ret >= NJS_PREEMPT)) { break; } njs_vmcode_operand(vm, vmcode->operand1, retval); njs_release(vm, retval); *retval = vm->retval; } else { switch (op) { case NJS_VMCODE_MOVE_ARG: move_arg = (njs_vmcode_move_arg_t *) pc; native = vm->top_frame; hint = move_arg->dst; value1 = &native->arguments_offset[hint]; njs_vmcode_operand(vm, move_arg->src, value2); *value1 = *value2; ret = sizeof(njs_vmcode_move_arg_t); break; case NJS_VMCODE_STOP: njs_vmcode_operand(vm, (njs_index_t) value2, value2); vm->retval = *value2; return NJS_OK; case NJS_VMCODE_JUMP: ret = (njs_jump_off_t) value2; break; case NJS_VMCODE_PROPERTY_SET: set = (njs_vmcode_prop_set_t *) pc; njs_vmcode_operand(vm, set->value, retval); ret = njs_value_property_set(vm, value1, value2, retval); if (njs_slow_path(ret == NJS_ERROR)) { goto error; } ret = sizeof(njs_vmcode_prop_set_t); break; case NJS_VMCODE_PROPERTY_ACCESSOR: accessor = (njs_vmcode_prop_accessor_t *) pc; njs_vmcode_operand(vm, accessor->value, function); ret = njs_value_to_key(vm, &name, value2); if (njs_slow_path(ret != NJS_OK)) { njs_internal_error(vm, "failed conversion of type \"%s\" " "to string while property define", njs_type_string(value2->type)); goto error; } ret = njs_object_prop_define(vm, value1, &name, function, accessor->type); if (njs_slow_path(ret != NJS_OK)) { return NJS_ERROR; } ret = sizeof(njs_vmcode_prop_accessor_t); break; case NJS_VMCODE_IF_TRUE_JUMP: case NJS_VMCODE_IF_FALSE_JUMP: ret = njs_is_true(value1); ret ^= op - NJS_VMCODE_IF_TRUE_JUMP; ret = ret ? (njs_jump_off_t) value2 : (njs_jump_off_t) sizeof(njs_vmcode_cond_jump_t); break; case NJS_VMCODE_IF_EQUAL_JUMP: if (njs_values_strict_equal(value1, value2)) { equal = (njs_vmcode_equal_jump_t *) pc; ret = equal->offset; } else { ret = sizeof(njs_vmcode_3addr_t); } break; case NJS_VMCODE_PROPERTY_INIT: set = (njs_vmcode_prop_set_t *) pc; njs_vmcode_operand(vm, set->value, retval); ret = njs_vmcode_property_init(vm, value1, value2, retval); if (njs_slow_path(ret == NJS_ERROR)) { goto error; } break; case NJS_VMCODE_RETURN: njs_vmcode_operand(vm, (njs_index_t) value2, value2); return njs_vmcode_return(vm, NULL, value2); case NJS_VMCODE_FUNCTION_COPY: fcopy = (njs_vmcode_function_copy_t *) pc; ret = njs_vmcode_function_copy(vm, fcopy->function, fcopy->retval); break; case NJS_VMCODE_FUNCTION_FRAME: function_frame = (njs_vmcode_function_frame_t *) pc; /* TODO: external object instead of void this. */ ret = njs_function_frame_create(vm, value1, &njs_value_undefined, (uintptr_t) value2, function_frame->ctor); if (njs_slow_path(ret != NJS_OK)) { goto error; } ret = sizeof(njs_vmcode_function_frame_t); break; case NJS_VMCODE_METHOD_FRAME: method_frame = (njs_vmcode_method_frame_t *) pc; ret = njs_value_property(vm, value1, value2, &dst); if (njs_slow_path(ret == NJS_ERROR)) { goto error; } if (njs_slow_path(!njs_is_function(&dst))) { ret = njs_value_to_key(vm, value2, value2); if (njs_slow_path(ret != NJS_OK)) { return NJS_ERROR; } njs_key_string_get(vm, value2, &string); njs_type_error(vm, "(intermediate value)[\"%V\"] is not a function", &string); goto error; } ret = njs_function_frame_create(vm, &dst, value1, method_frame->nargs, method_frame->ctor); if (njs_slow_path(ret != NJS_OK)) { goto error; } ret = sizeof(njs_vmcode_method_frame_t); break; case NJS_VMCODE_FUNCTION_CALL: vm->active_frame->native.pc = pc; njs_vmcode_operand(vm, (njs_index_t) value2, value2); ret = njs_function_frame_invoke(vm, value2); if (njs_slow_path(ret == NJS_ERROR)) { goto error; } ret = sizeof(njs_vmcode_function_call_t); break; case NJS_VMCODE_PROPERTY_NEXT: pnext = (njs_vmcode_prop_next_t *) pc; retval = njs_scope_value(vm, pnext->retval); next = value2->data.u.next; if (next->index < next->array->length) { *retval = next->array->start[next->index++]; ret = pnext->offset; break; } njs_mp_free(vm->mem_pool, next); ret = sizeof(njs_vmcode_prop_next_t); break; case NJS_VMCODE_ARGUMENTS: ret = njs_vmcode_arguments(vm, pc); if (njs_slow_path(ret == NJS_ERROR)) { goto error; } break; case NJS_VMCODE_PROTO_INIT: set = (njs_vmcode_prop_set_t *) pc; njs_vmcode_operand(vm, set->value, retval); ret = njs_vmcode_proto_init(vm, value1, value2, retval); if (njs_slow_path(ret == NJS_ERROR)) { goto error; } break; case NJS_VMCODE_IMPORT: import = (njs_vmcode_import_t *) pc; retval = njs_scope_value(vm, import->retval); ret = njs_vmcode_import(vm, import->module, retval); if (njs_slow_path(ret == NJS_ERROR)) { goto error; } break; case NJS_VMCODE_AWAIT: await = (njs_vmcode_await_t *) pc; return njs_vmcode_await(vm, await, promise_cap, async_ctx); case NJS_VMCODE_TRY_START: ret = njs_vmcode_try_start(vm, value1, value2, pc); if (njs_slow_path(ret == NJS_ERROR)) { goto error; } break; case NJS_VMCODE_THROW: njs_vmcode_operand(vm, (njs_index_t) value2, value2); vm->retval = *value2; goto error; case NJS_VMCODE_TRY_BREAK: try_trampoline = (njs_vmcode_try_trampoline_t *) pc; value1 = njs_scope_value(vm, try_trampoline->exit_value); ret = njs_vmcode_try_break(vm, value1, value2); break; case NJS_VMCODE_TRY_CONTINUE: try_trampoline = (njs_vmcode_try_trampoline_t *) pc; value1 = njs_scope_value(vm, try_trampoline->exit_value); ret = njs_vmcode_try_continue(vm, value1, value2); break; case NJS_VMCODE_TRY_END: ret = njs_vmcode_try_end(vm, value1, value2); break; /* * njs_vmcode_catch() is set on the start of a "catch" block to * store exception and to remove a "try" block if there is no * "finally" block or to update a catch address to the start of * a "finally" block. * njs_vmcode_catch() is set on the start of a "finally" block * to store uncaught exception and to remove a "try" block. */ case NJS_VMCODE_CATCH: *value1 = vm->retval; if ((njs_jump_off_t) value2 == sizeof(njs_vmcode_catch_t)) { ret = njs_vmcode_try_end(vm, value1, value2); } else { frame = (njs_frame_t *) vm->top_frame; frame->exception.catch = pc + (njs_jump_off_t) value2; ret = sizeof(njs_vmcode_catch_t); } break; case NJS_VMCODE_FINALLY: finally = (njs_vmcode_finally_t *) pc; value1 = njs_scope_value(vm, finally->exit_value); ret = njs_vmcode_finally(vm, value1, value2, pc); switch (ret) { case NJS_OK: return NJS_OK; case NJS_ERROR: goto error; } break; case NJS_VMCODE_LET: var = (njs_vmcode_variable_t *) pc; value1 = njs_scope_value(vm, var->dst); if (njs_is_valid(value1)) { value1 = njs_mp_alloc(vm->mem_pool, sizeof(njs_value_t)); if (njs_slow_path(value1 == NULL)) { return NJS_ERROR; } njs_scope_value_set(vm, var->dst, value1); } njs_set_undefined(value1); ret = sizeof(njs_vmcode_variable_t); break; case NJS_VMCODE_LET_UPDATE: var = (njs_vmcode_variable_t *) pc; value2 = njs_scope_value(vm, var->dst); value1 = njs_mp_alloc(vm->mem_pool, sizeof(njs_value_t)); if (njs_slow_path(value1 == NULL)) { return NJS_ERROR; } *value1 = *value2; njs_scope_value_set(vm, var->dst, value1); ret = sizeof(njs_vmcode_variable_t); break; case NJS_VMCODE_INITIALIZATION_TEST: var = (njs_vmcode_variable_t *) pc; value1 = njs_scope_value(vm, var->dst); if (njs_is_valid(value1)) { ret = sizeof(njs_vmcode_variable_t); break; } /* Fall through. */ case NJS_VMCODE_NOT_INITIALIZED: njs_reference_error(vm, "cannot access variable " "before initialization"); goto error; case NJS_VMCODE_ERROR: njs_vmcode_error(vm, pc); goto error; case NJS_VMCODE_ASSIGNMENT_ERROR: njs_type_error(vm, "assignment to constant variable"); goto error; default: njs_internal_error(vm, "%d has NO retval", op); goto error; } } pc += ret; } error: if (njs_is_error(&vm->retval)) { vm->active_frame->native.pc = pc; (void) njs_error_stack_attach(vm, &vm->retval); } for ( ;; ) { native = vm->top_frame; if (!native->native) { frame = (njs_frame_t *) native; catch = frame->exception.catch; if (catch != NULL) { pc = catch; goto next; } } previous = native->previous; if (previous == NULL) { break; } lambda_call = (native == &vm->active_frame->native); njs_vm_scopes_restore(vm, native, previous); if (native->size != 0) { vm->stack_size -= native->size; njs_mp_free(vm->mem_pool, native); } if (lambda_call) { break; } } return NJS_ERROR; }
0
374,693
AlterTableLookupRelation(AlterTableStmt *stmt, LOCKMODE lockmode) { return RangeVarGetRelidExtended(stmt->relation, lockmode, stmt->missing_ok, false, RangeVarCallbackForAlterRelation, (void *) stmt); }
0
413,541
static int _find_update_object_in_list(void *x, void *key) { slurmdb_update_object_t *object = (slurmdb_update_object_t *)x; slurmdb_update_type_t type = *(slurmdb_update_type_t *)key; if (object->type == type) return 1; return 0; }
0
461,229
autoar_extractor_check_file_conflict (GFile *file, mode_t extracted_filetype) { GFileType file_type; gboolean conflict = FALSE; file_type = g_file_query_file_type (file, G_FILE_QUERY_INFO_NONE, NULL); /* If there is no file with the given name, there will be no conflict */ if (file_type == G_FILE_TYPE_UNKNOWN) { return FALSE; } switch (extracted_filetype) { case AE_IFDIR: break; case AE_IFREG: case AE_IFLNK: #if defined HAVE_MKFIFO || defined HAVE_MKNOD case AE_IFIFO: #endif #ifdef HAVE_MKNOD case AE_IFSOCK: case AE_IFBLK: case AE_IFCHR: #endif conflict = TRUE; break; default: break; } return conflict; }
0
244,144
static void aio_fput_routine(struct work_struct *data) { spin_lock_irq(&fput_lock); while (likely(!list_empty(&fput_head))) { struct kiocb *req = list_kiocb(fput_head.next); struct kioctx *ctx = req->ki_ctx; list_del(&req->ki_list); spin_unlock_irq(&fput_lock); /* Complete the fput(s) */ if (req->ki_filp != NULL) fput(req->ki_filp); /* Link the iocb into the context's free list */ spin_lock_irq(&ctx->ctx_lock); really_put_req(ctx, req); spin_unlock_irq(&ctx->ctx_lock); put_ioctx(ctx); spin_lock_irq(&fput_lock); } spin_unlock_irq(&fput_lock); }
0
419,675
static int determine_space(Server *s, uint64_t *available, uint64_t *limit) { JournalStorage *js; int r; assert(s); js = s->system_journal ? &s->system_storage : &s->runtime_storage; r = cache_space_refresh(s, js); if (r >= 0) { if (available) *available = js->space.available; if (limit) *limit = js->space.limit; } return r; }
0
251,787
GDataEntry* GDataEntry::FromDocumentEntry(GDataDirectory* parent, DocumentEntry* doc, GDataRootDirectory* root) { DCHECK(doc); if (doc->is_folder()) return GDataDirectory::FromDocumentEntry(parent, doc, root); else if (doc->is_hosted_document() || doc->is_file()) return GDataFile::FromDocumentEntry(parent, doc, root); return NULL; }
0
414,403
static void getRDB(void) { int s = context->fd; int fd; unsigned long long payload = sendSync(s); char buf[4096]; fprintf(stderr,"SYNC sent to master, writing %llu bytes to '%s'\n", payload, config.rdb_filename); /* Write to file. */ if (!strcmp(config.rdb_filename,"-")) { fd = STDOUT_FILENO; } else { fd = open(config.rdb_filename, O_CREAT|O_WRONLY, 0644); if (fd == -1) { fprintf(stderr, "Error opening '%s': %s\n", config.rdb_filename, strerror(errno)); exit(1); } } while(payload) { ssize_t nread, nwritten; nread = read(s,buf,(payload > sizeof(buf)) ? sizeof(buf) : payload); if (nread <= 0) { fprintf(stderr,"I/O Error reading RDB payload from socket\n"); exit(1); } nwritten = write(fd, buf, nread); if (nwritten != nread) { fprintf(stderr,"Error writing data to file: %s\n", strerror(errno)); exit(1); } payload -= nread; } close(s); /* Close the file descriptor ASAP as fsync() may take time. */ fsync(fd); fprintf(stderr,"Transfer finished with success.\n"); exit(0); }
0
356,193
static long do_rmdir(int dfd, const char __user *pathname) { int error = 0; char * name; struct dentry *dentry; struct nameidata nd; name = getname(pathname); if(IS_ERR(name)) return PTR_ERR(name); error = do_path_lookup(dfd, name, LOOKUP_PARENT, &nd); if (error) goto exit; switch(nd.last_type) { case LAST_DOTDOT: error = -ENOTEMPTY; goto exit1; case LAST_DOT: error = -EINVAL; goto exit1; case LAST_ROOT: error = -EBUSY; goto exit1; } mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); dentry = lookup_hash(&nd); error = PTR_ERR(dentry); if (IS_ERR(dentry)) goto exit2; error = mnt_want_write(nd.path.mnt); if (error) goto exit3; error = vfs_rmdir(nd.path.dentry->d_inode, dentry); mnt_drop_write(nd.path.mnt); exit3: dput(dentry); exit2: mutex_unlock(&nd.path.dentry->d_inode->i_mutex); exit1: path_put(&nd.path); exit: putname(name); return error; }
0
109,531
static int loop(int fd) { void (*workfn) (int ci); void (*deadfn) (int ci); int rv, i; rv = setup_transport(); if (rv < 0) goto fail; rv = setup_ticket(); if (rv < 0) goto fail; rv = write_daemon_state(fd, BOOTHD_STARTED); if (rv != 0) { log_error("write daemon state %d to lockfile error %s: %s", BOOTHD_STARTED, cl.lockfile, strerror(errno)); goto fail; } log_info("BOOTH %s daemon started, node id is 0x%08X (%d).", type_to_string(local->type), local->site_id, local->site_id); while (1) { rv = poll(pollfds, client_maxi + 1, poll_timeout); if (rv == -1 && errno == EINTR) continue; if (rv < 0) { log_error("poll failed: %s (%d)", strerror(errno), errno); goto fail; } for (i = 0; i <= client_maxi; i++) { if (clients[i].fd < 0) continue; if (pollfds[i].revents & POLLIN) { workfn = clients[i].workfn; if (workfn) workfn(i); } if (pollfds[i].revents & (POLLERR | POLLHUP | POLLNVAL)) { deadfn = clients[i].deadfn; if (deadfn) deadfn(i); } } process_tickets(); if (process_signals() != 0) { return 0; } } return 0; fail: return -1; }
0
445,408
TEST_P(ConnectionLimitIntegrationTest, TestEmptyGlobalCxRuntimeLimit) { const std::string log_line = "no configured limit to the number of allowed active connections."; EXPECT_LOG_CONTAINS("warn", log_line, { initialize(); }); }
0
163,596
net::Error CallbackAndReturn( const DownloadResourceHandler::OnStartedCallback& started_cb, net::Error net_error) { if (started_cb.is_null()) return net_error; BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(started_cb, static_cast<DownloadItem*>(NULL), net_error)); return net_error; }
0
137,604
static int llc_ui_release(struct socket *sock) { struct sock *sk = sock->sk; struct llc_sock *llc; if (unlikely(sk == NULL)) goto out; sock_hold(sk); lock_sock(sk); llc = llc_sk(sk); dprintk("%s: closing local(%02X) remote(%02X)\n", __func__, llc->laddr.lsap, llc->daddr.lsap); if (!llc_send_disc(sk)) llc_ui_wait_for_disc(sk, sk->sk_rcvtimeo); if (!sock_flag(sk, SOCK_ZAPPED)) { struct llc_sap *sap = llc->sap; /* Hold this for release_sock(), so that llc_backlog_rcv() * could still use it. */ llc_sap_hold(sap); llc_sap_remove_socket(llc->sap, sk); release_sock(sk); llc_sap_put(sap); } else { release_sock(sk); } dev_put_track(llc->dev, &llc->dev_tracker); sock_put(sk); llc_sk_free(sk); out: return 0; }
0
464,796
static void v4l_print_audioout(const void *arg, bool write_only) { const struct v4l2_audioout *p = arg; if (write_only) pr_cont("index=%u\n", p->index); else pr_cont("index=%u, name=%.*s, capability=0x%x, mode=0x%x\n", p->index, (int)sizeof(p->name), p->name, p->capability, p->mode); }
0
481,477
static void io_rsrc_file_put(struct io_ring_ctx *ctx, struct io_rsrc_put *prsrc) { struct file *file = prsrc->file; #if defined(CONFIG_UNIX) struct sock *sock = ctx->ring_sock->sk; struct sk_buff_head list, *head = &sock->sk_receive_queue; struct sk_buff *skb; int i; if (!io_file_need_scm(file)) { fput(file); return; } __skb_queue_head_init(&list); /* * Find the skb that holds this file in its SCM_RIGHTS. When found, * remove this entry and rearrange the file array. */ skb = skb_dequeue(head); while (skb) { struct scm_fp_list *fp; fp = UNIXCB(skb).fp; for (i = 0; i < fp->count; i++) { int left; if (fp->fp[i] != file) continue; unix_notinflight(fp->user, fp->fp[i]); left = fp->count - 1 - i; if (left) { memmove(&fp->fp[i], &fp->fp[i + 1], left * sizeof(struct file *)); } fp->count--; if (!fp->count) { kfree_skb(skb); skb = NULL; } else { __skb_queue_tail(&list, skb); } fput(file); file = NULL; break; } if (!file) break; __skb_queue_tail(&list, skb); skb = skb_dequeue(head); } if (skb_peek(&list)) { spin_lock_irq(&head->lock); while ((skb = __skb_dequeue(&list)) != NULL) __skb_queue_tail(head, skb); spin_unlock_irq(&head->lock); } #else fput(file); #endif
0
53,934
void mg_set_protocol_mqtt(struct mg_connection *nc) { nc->proto_handler = mqtt_handler; nc->proto_data = MG_CALLOC(1, sizeof(struct mg_mqtt_proto_data)); nc->proto_data_destructor = mg_mqtt_proto_data_destructor; }
0
508,923
int tls1_ec_curve_id2nid(int curve_id) { /* ECC curves from RFC 4492 */ if ((curve_id < 1) || ((unsigned int)curve_id > sizeof(nid_list) / sizeof(nid_list[0]))) return 0; return nid_list[curve_id - 1]; }
0
387,982
png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length, int keep) { int handled = 0; /* the chunk was handled */ png_debug(1, "in png_handle_unknown"); #ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED /* NOTE: this code is based on the code in libpng-1.4.12 except for fixing * the bug which meant that setting a non-default behavior for a specific * chunk would be ignored (the default was always used unless a user * callback was installed). * * 'keep' is the value from the png_chunk_unknown_handling, the setting for * this specific chunk_name, if PNG_HANDLE_AS_UNKNOWN_SUPPORTED, if not it * will always be PNG_HANDLE_CHUNK_AS_DEFAULT and it needs to be set here. * This is just an optimization to avoid multiple calls to the lookup * function. */ # ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED # ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED keep = png_chunk_unknown_handling(png_ptr, png_ptr->chunk_name); # endif # endif /* One of the following methods will read the chunk or skip it (at least one * of these is always defined because this is the only way to switch on * PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) */ # ifdef PNG_READ_USER_CHUNKS_SUPPORTED /* The user callback takes precedence over the chunk keep value, but the * keep value is still required to validate a save of a critical chunk. */ if (png_ptr->read_user_chunk_fn != NULL) { if (png_cache_unknown_chunk(png_ptr, length) != 0) { /* Callback to user unknown chunk handler */ int ret = (*(png_ptr->read_user_chunk_fn))(png_ptr, &png_ptr->unknown_chunk); /* ret is: * negative: An error occurred; png_chunk_error will be called. * zero: The chunk was not handled, the chunk will be discarded * unless png_set_keep_unknown_chunks has been used to set * a 'keep' behavior for this particular chunk, in which * case that will be used. A critical chunk will cause an * error at this point unless it is to be saved. * positive: The chunk was handled, libpng will ignore/discard it. */ if (ret < 0) png_chunk_error(png_ptr, "error in user chunk"); else if (ret == 0) { /* If the keep value is 'default' or 'never' override it, but * still error out on critical chunks unless the keep value is * 'always' While this is weird it is the behavior in 1.4.12. * A possible improvement would be to obey the value set for the * chunk, but this would be an API change that would probably * damage some applications. * * The png_app_warning below catches the case that matters, where * the application has not set specific save or ignore for this * chunk or global save or ignore. */ if (keep < PNG_HANDLE_CHUNK_IF_SAFE) { # ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED if (png_ptr->unknown_default < PNG_HANDLE_CHUNK_IF_SAFE) { png_chunk_warning(png_ptr, "Saving unknown chunk:"); png_app_warning(png_ptr, "forcing save of an unhandled chunk;" " please call png_set_keep_unknown_chunks"); /* with keep = PNG_HANDLE_CHUNK_IF_SAFE */ } # endif keep = PNG_HANDLE_CHUNK_IF_SAFE; } } else /* chunk was handled */ { handled = 1; /* Critical chunks can be safely discarded at this point. */ keep = PNG_HANDLE_CHUNK_NEVER; } } else keep = PNG_HANDLE_CHUNK_NEVER; /* insufficient memory */ } else /* Use the SAVE_UNKNOWN_CHUNKS code or skip the chunk */ # endif /* READ_USER_CHUNKS */ # ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED { /* keep is currently just the per-chunk setting, if there was no * setting change it to the global default now (not that this may * still be AS_DEFAULT) then obtain the cache of the chunk if required, * if not simply skip the chunk. */ if (keep == PNG_HANDLE_CHUNK_AS_DEFAULT) keep = png_ptr->unknown_default; if (keep == PNG_HANDLE_CHUNK_ALWAYS || (keep == PNG_HANDLE_CHUNK_IF_SAFE && PNG_CHUNK_ANCILLARY(png_ptr->chunk_name))) { if (png_cache_unknown_chunk(png_ptr, length) == 0) keep = PNG_HANDLE_CHUNK_NEVER; } else png_crc_finish(png_ptr, length); } # else # ifndef PNG_READ_USER_CHUNKS_SUPPORTED # error no method to support READ_UNKNOWN_CHUNKS # endif { /* If here there is no read callback pointer set and no support is * compiled in to just save the unknown chunks, so simply skip this * chunk. If 'keep' is something other than AS_DEFAULT or NEVER then * the app has erroneously asked for unknown chunk saving when there * is no support. */ if (keep > PNG_HANDLE_CHUNK_NEVER) png_app_error(png_ptr, "no unknown chunk support available"); png_crc_finish(png_ptr, length); } # endif # ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED /* Now store the chunk in the chunk list if appropriate, and if the limits * permit it. */ if (keep == PNG_HANDLE_CHUNK_ALWAYS || (keep == PNG_HANDLE_CHUNK_IF_SAFE && PNG_CHUNK_ANCILLARY(png_ptr->chunk_name))) { # ifdef PNG_USER_LIMITS_SUPPORTED switch (png_ptr->user_chunk_cache_max) { case 2: png_ptr->user_chunk_cache_max = 1; png_chunk_benign_error(png_ptr, "no space in chunk cache"); /* FALL THROUGH */ case 1: /* NOTE: prior to 1.6.0 this case resulted in an unknown critical * chunk being skipped, now there will be a hard error below. */ break; default: /* not at limit */ --(png_ptr->user_chunk_cache_max); /* FALL THROUGH */ case 0: /* no limit */ # endif /* USER_LIMITS */ /* Here when the limit isn't reached or when limits are compiled * out; store the chunk. */ png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); handled = 1; # ifdef PNG_USER_LIMITS_SUPPORTED break; } # endif } # else /* no store support: the chunk must be handled by the user callback */ PNG_UNUSED(info_ptr) # endif /* Regardless of the error handling below the cached data (if any) can be * freed now. Notice that the data is not freed if there is a png_error, but * it will be freed by destroy_read_struct. */ if (png_ptr->unknown_chunk.data != NULL) png_free(png_ptr, png_ptr->unknown_chunk.data); png_ptr->unknown_chunk.data = NULL; #else /* !PNG_READ_UNKNOWN_CHUNKS_SUPPORTED */ /* There is no support to read an unknown chunk, so just skip it. */ png_crc_finish(png_ptr, length); PNG_UNUSED(info_ptr) PNG_UNUSED(keep) #endif /* !READ_UNKNOWN_CHUNKS */ /* Check for unhandled critical chunks */ if (handled == 0 && PNG_CHUNK_CRITICAL(png_ptr->chunk_name)) png_chunk_error(png_ptr, "unhandled critical chunk"); }
0
367,316
static int smack_audit_rule_init(u32 field, u32 op, char *rulestr, void **vrule) { char **rule = (char **)vrule; *rule = NULL; if (field != AUDIT_SUBJ_USER && field != AUDIT_OBJ_USER) return -EINVAL; if (op != Audit_equal && op != Audit_not_equal) return -EINVAL; *rule = smk_import(rulestr, 0); return 0; }
0
244,610
static int ssl_method_error(const SSL *s, const SSL_METHOD *method) { int version = method->version; if ((s->min_proto_version != 0 && version_cmp(s, version, s->min_proto_version) < 0) || ssl_security(s, SSL_SECOP_VERSION, 0, version, NULL) == 0) return SSL_R_VERSION_TOO_LOW; if (s->max_proto_version != 0 && version_cmp(s, version, s->max_proto_version) > 0) return SSL_R_VERSION_TOO_HIGH; if ((s->options & method->mask) != 0) return SSL_R_UNSUPPORTED_PROTOCOL; if ((method->flags & SSL_METHOD_NO_SUITEB) != 0 && tls1_suiteb(s)) return SSL_R_AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE; else if ((method->flags & SSL_METHOD_NO_FIPS) != 0 && FIPS_mode()) return SSL_R_AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE; return 0; }
0
207,688
void ShellSurface::Close() { if (!close_callback_.is_null()) close_callback_.Run(); }
0
354,435
static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt) { /* Expand any short form frames */ if (skb->mac.raw[2] == 1) { struct ddpehdr *ddp; /* Find our address */ struct atalk_addr *ap = atalk_find_dev_addr(dev); if (!ap || skb->len < sizeof(struct ddpshdr)) goto freeit; /* Don't mangle buffer if shared */ if (!(skb = skb_share_check(skb, GFP_ATOMIC))) return 0; /* * The push leaves us with a ddephdr not an shdr, and * handily the port bytes in the right place preset. */ ddp = (struct ddpehdr *) skb_push(skb, sizeof(*ddp) - 4); /* Now fill in the long header */ /* * These two first. The mac overlays the new source/dest * network information so we MUST copy these before * we write the network numbers ! */ ddp->deh_dnode = skb->mac.raw[0]; /* From physical header */ ddp->deh_snode = skb->mac.raw[1]; /* From physical header */ ddp->deh_dnet = ap->s_net; /* Network number */ ddp->deh_snet = ap->s_net; ddp->deh_sum = 0; /* No checksum */ /* * Not sure about this bit... */ ddp->deh_len = skb->len; ddp->deh_hops = DDP_MAXHOPS; /* Non routable, so force a drop if we slip up later */ /* Mend the byte order */ *((__u16 *)ddp) = htons(*((__u16 *)ddp)); } skb->h.raw = skb->data; return atalk_rcv(skb, dev, pt); freeit: kfree_skb(skb); return 0; }
0
292,425
static void client_init_reply_buf(void) { replybuf_pos = replybuf; replybuf_left = sizeof replybuf - 1U; }
0
396,699
GC_INNER void GC_remove_header(struct hblk *h) { hdr **ha; GET_HDR_ADDR(h, ha); free_hdr(*ha); *ha = 0; }
0
114,627
static void cobject(JF, js_Ast *list) { js_Ast *head = list; while (list) { js_Ast *kv = list->a; js_Ast *prop = kv->a; if (prop->type == AST_IDENTIFIER || prop->type == EXP_STRING) { emitline(J, F, prop); emitstring(J, F, OP_STRING, prop->string); } else if (prop->type == EXP_NUMBER) { emitline(J, F, prop); emitnumber(J, F, prop->number); } else { jsC_error(J, prop, "invalid property name in object initializer"); } if (F->strict) checkdup(J, F, head, kv); switch (kv->type) { default: /* impossible */ break; case EXP_PROP_VAL: cexp(J, F, kv->b); emitline(J, F, kv); emit(J, F, OP_INITPROP); break; case EXP_PROP_GET: emitfunction(J, F, newfun(J, prop->line, NULL, NULL, kv->c, 0, F->strict)); emitline(J, F, kv); emit(J, F, OP_INITGETTER); break; case EXP_PROP_SET: emitfunction(J, F, newfun(J, prop->line, NULL, kv->b, kv->c, 0, F->strict)); emitline(J, F, kv); emit(J, F, OP_INITSETTER); break; } list = list->b; } }
0
323,648
QList *qdict_get_qlist(const QDict *qdict, const char *key) { return qobject_to_qlist(qdict_get_obj(qdict, key, QTYPE_QLIST)); }
1
203,343
jbig2_decode_generic_template1_TPGDON(Jbig2Ctx *ctx, Jbig2Segment *segment, const Jbig2GenericRegionParams *params, Jbig2ArithState *as, Jbig2Image *image, Jbig2ArithCx *GB_stats) { const int GBW = image->width; const int GBH = image->height; uint32_t CONTEXT; int x, y; bool bit; int LTP = 0; for (y = 0; y < GBH; y++) { bit = jbig2_arith_decode(as, &GB_stats[0x0795]); if (bit < 0) return -1; LTP ^= bit; if (!LTP) { for (x = 0; x < GBW; x++) { CONTEXT = jbig2_image_get_pixel(image, x - 1, y); CONTEXT |= jbig2_image_get_pixel(image, x - 2, y) << 1; CONTEXT |= jbig2_image_get_pixel(image, x - 3, y) << 2; CONTEXT |= jbig2_image_get_pixel(image, x + params->gbat[0], y + params->gbat[1]) << 3; CONTEXT |= jbig2_image_get_pixel(image, x + 2, y - 1) << 4; CONTEXT |= jbig2_image_get_pixel(image, x + 1, y - 1) << 5; CONTEXT |= jbig2_image_get_pixel(image, x, y - 1) << 6; CONTEXT |= jbig2_image_get_pixel(image, x - 1, y - 1) << 7; CONTEXT |= jbig2_image_get_pixel(image, x - 2, y - 1) << 8; CONTEXT |= jbig2_image_get_pixel(image, x + 2, y - 2) << 9; CONTEXT |= jbig2_image_get_pixel(image, x + 1, y - 2) << 10; CONTEXT |= jbig2_image_get_pixel(image, x, y - 2) << 11; CONTEXT |= jbig2_image_get_pixel(image, x - 1, y - 2) << 12; bit = jbig2_arith_decode(as, &GB_stats[CONTEXT]); if (bit < 0) return -1; jbig2_image_set_pixel(image, x, y, bit); } } else { copy_prev_row(image, y); } } return 0; }
0
255,538
_PyMemoTable_ResizeTable(PyMemoTable *self, Py_ssize_t min_size) { PyMemoEntry *oldtable = NULL; PyMemoEntry *oldentry, *newentry; Py_ssize_t new_size = MT_MINSIZE; Py_ssize_t to_process; assert(min_size > 0); /* Find the smallest valid table size >= min_size. */ while (new_size < min_size && new_size > 0) new_size <<= 1; if (new_size <= 0) { PyErr_NoMemory(); return -1; } /* new_size needs to be a power of two. */ assert((new_size & (new_size - 1)) == 0); /* Allocate new table. */ oldtable = self->mt_table; self->mt_table = PyMem_NEW(PyMemoEntry, new_size); if (self->mt_table == NULL) { self->mt_table = oldtable; PyErr_NoMemory(); return -1; } self->mt_allocated = new_size; self->mt_mask = new_size - 1; memset(self->mt_table, 0, sizeof(PyMemoEntry) * new_size); /* Copy entries from the old table. */ to_process = self->mt_used; for (oldentry = oldtable; to_process > 0; oldentry++) { if (oldentry->me_key != NULL) { to_process--; /* newentry is a pointer to a chunk of the new mt_table, so we're setting the key:value pair in-place. */ newentry = _PyMemoTable_Lookup(self, oldentry->me_key); newentry->me_key = oldentry->me_key; newentry->me_value = oldentry->me_value; } } /* Deallocate the old table. */ PyMem_FREE(oldtable); return 0; }
1
416,561
gx_default_1_add_decode_color( gx_device * dev, gx_color_index color, gx_color_value cv[1] ) { gx_color_value rgb[3]; int code = dev_proc(dev, map_color_rgb)(dev, color, rgb); cv[0] = rgb[0]; return code; }
0
28,039
static void process_gitlink ( struct rev_info * revs , const unsigned char * sha1 , show_object_fn show , struct strbuf * path , const char * name , void * cb_data ) { }
0
137,985
long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask, unsigned long bitmap_size) { unsigned long nr_compat_longs; /* align bitmap up to nearest compat_long_t boundary */ bitmap_size = ALIGN(bitmap_size, BITS_PER_COMPAT_LONG); nr_compat_longs = BITS_TO_COMPAT_LONGS(bitmap_size); if (!access_ok(VERIFY_WRITE, umask, bitmap_size / 8)) return -EFAULT; user_access_begin(); while (nr_compat_longs > 1) { unsigned long m = *mask++; unsafe_put_user((compat_ulong_t)m, umask++, Efault); unsafe_put_user(m >> BITS_PER_COMPAT_LONG, umask++, Efault); nr_compat_longs -= 2; } if (nr_compat_longs) unsafe_put_user((compat_ulong_t)*mask, umask++, Efault); user_access_end(); return 0; Efault: user_access_end(); return -EFAULT; }
0
517,762
ha_rows ha_maria::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint *bufsz, uint *flags, Cost_estimate *cost) { /* This call is here because there is no location where this->table would already be known. TODO: consider moving it into some per-query initialization call. */ ds_mrr.init(this, table); return ds_mrr.dsmrr_info_const(keyno, seq, seq_init_param, n_ranges, bufsz, flags, cost); }
0
293,416
static int incclasscanon(Reclass *cc, Rune c) { Rune *p, r; for (p = cc->spans; p < cc->end; p += 2) for (r = p[0]; r <= p[1]; ++r) if (c == canon(r)) return 1; return 0; }
0
88,225
static void ath10k_usb_free_urb_to_pipe(struct ath10k_usb_pipe *pipe, struct ath10k_urb_context *urb_context) { unsigned long flags; spin_lock_irqsave(&pipe->ar_usb->cs_lock, flags); pipe->urb_cnt++; list_add(&urb_context->link, &pipe->urb_list_head); spin_unlock_irqrestore(&pipe->ar_usb->cs_lock, flags); }
0
46,545
void CLASS identify() { char head[32], *cp; int hlen, flen, fsize, zero_fsize=1, i, c, is_canon; struct jhead jh; short pana[][6] = { { 3130, 1743, 4, 0, -6, 0 }, { 3130, 2055, 4, 0, -6, 0 }, { 3130, 2319, 4, 0, -6, 0 }, { 3170, 2103, 18, 0,-42, 20 }, { 3170, 2367, 18, 13,-42,-21 }, { 3177, 2367, 0, 0, -1, 0 }, { 3304, 2458, 0, 0, -1, 0 }, { 3330, 2463, 9, 0, -5, 0 }, { 3330, 2479, 9, 0,-17, 4 }, { 3370, 1899, 15, 0,-44, 20 }, { 3370, 2235, 15, 0,-44, 20 }, { 3370, 2511, 15, 10,-44,-21 }, { 3690, 2751, 3, 0, -8, -3 }, { 3710, 2751, 0, 0, -3, 0 }, { 3724, 2450, 0, 0, 0, -2 }, { 3770, 2487, 17, 0,-44, 19 }, { 3770, 2799, 17, 15,-44,-19 }, { 3880, 2170, 6, 0, -6, 0 }, { 4060, 3018, 0, 0, 0, -2 }, { 4290, 2391, 3, 0, -8, -1 }, { 4330, 2439, 17, 15,-44,-19 }, { 4508, 2962, 0, 0, -3, -4 }, { 4508, 3330, 0, 0, -3, -6 } }; static const struct { int fsize; const char make[12], model[19], withjpeg; } table[] = { { 62464, "Kodak", "DC20" ,0 }, { 124928, "Kodak", "DC20" ,0 }, { 1652736, "Kodak", "DCS200" ,0 }, { 4159302, "Kodak", "C330" ,0 }, { 4162462, "Kodak", "C330" ,0 }, { 460800, "Kodak", "C603v" ,0 }, { 614400, "Kodak", "C603v" ,0 }, { 6163328, "Kodak", "C603" ,0 }, { 6166488, "Kodak", "C603" ,0 }, { 9116448, "Kodak", "C603y" ,0 }, { 311696, "ST Micro", "STV680 VGA" ,0 }, /* SPYz */ { 787456, "Creative", "PC-CAM 600" ,0 }, { 1138688, "Minolta", "RD175" ,0 }, { 3840000, "Foculus", "531C" ,0 }, { 786432, "AVT", "F-080C" ,0 }, { 1447680, "AVT", "F-145C" ,0 }, { 1920000, "AVT", "F-201C" ,0 }, { 5067304, "AVT", "F-510C" ,0 }, { 5067316, "AVT", "F-510C" ,0 }, { 10134608, "AVT", "F-510C" ,0 }, { 10134620, "AVT", "F-510C" ,0 }, { 16157136, "AVT", "F-810C" ,0 }, { 1409024, "Sony", "XCD-SX910CR" ,0 }, { 2818048, "Sony", "XCD-SX910CR" ,0 }, { 3884928, "Micron", "2010" ,0 }, { 6624000, "Pixelink", "A782" ,0 }, { 13248000, "Pixelink", "A782" ,0 }, { 6291456, "RoverShot","3320AF" ,0 }, { 6553440, "Canon", "PowerShot A460" ,0 }, { 6653280, "Canon", "PowerShot A530" ,0 }, { 6573120, "Canon", "PowerShot A610" ,0 }, { 9219600, "Canon", "PowerShot A620" ,0 }, { 9243240, "Canon", "PowerShot A470" ,0 }, { 10341600, "Canon", "PowerShot A720 IS",0 }, { 10383120, "Canon", "PowerShot A630" ,0 }, { 12945240, "Canon", "PowerShot A640" ,0 }, { 15636240, "Canon", "PowerShot A650" ,0 }, { 5298000, "Canon", "PowerShot SD300" ,0 }, { 7710960, "Canon", "PowerShot S3 IS" ,0 }, { 15467760, "Canon", "PowerShot SX110 IS",0 }, { 15534576, "Canon", "PowerShot SX120 IS",0 }, { 18653760, "Canon", "PowerShot SX20 IS",0 }, { 21936096, "Canon", "PowerShot SX30 IS",0 }, { 5939200, "OLYMPUS", "C770UZ" ,0 }, { 1581060, "NIKON", "E900" ,1 }, /* or E900s,E910 */ { 2465792, "NIKON", "E950" ,1 }, /* or E800,E700 */ { 2940928, "NIKON", "E2100" ,1 }, /* or E2500 */ { 4771840, "NIKON", "E990" ,1 }, /* or E995, Oly C3030Z */ { 4775936, "NIKON", "E3700" ,1 }, /* or Optio 33WR */ { 5869568, "NIKON", "E4300" ,1 }, /* or DiMAGE Z2 */ { 5865472, "NIKON", "E4500" ,1 }, { 7438336, "NIKON", "E5000" ,1 }, /* or E5700 */ { 8998912, "NIKON", "COOLPIX S6" ,1 }, { 1976352, "CASIO", "QV-2000UX" ,1 }, { 3217760, "CASIO", "QV-3*00EX" ,1 }, { 6218368, "CASIO", "QV-5700" ,1 }, { 6054400, "CASIO", "QV-R41" ,1 }, { 7530816, "CASIO", "QV-R51" ,1 }, { 7684000, "CASIO", "QV-4000" ,1 }, { 2937856, "CASIO", "EX-S20" ,1 }, { 4948608, "CASIO", "EX-S100" ,1 }, { 7542528, "CASIO", "EX-Z50" ,1 }, { 7562048, "CASIO", "EX-Z500" ,1 }, { 7753344, "CASIO", "EX-Z55" ,1 }, { 7816704, "CASIO", "EX-Z60" ,1 }, { 10843712, "CASIO", "EX-Z75" ,1 }, { 10834368, "CASIO", "EX-Z750" ,1 }, { 12310144, "CASIO", "EX-Z850" ,1 }, { 15499264, "CASIO", "EX-Z1050" ,1 }, { 7426656, "CASIO", "EX-P505" ,1 }, { 9313536, "CASIO", "EX-P600" ,1 }, { 10979200, "CASIO", "EX-P700" ,1 }, { 3178560, "PENTAX", "Optio S" ,1 }, { 4841984, "PENTAX", "Optio S" ,1 }, { 6114240, "PENTAX", "Optio S4" ,1 }, /* or S4i, CASIO EX-Z4 */ { 10702848, "PENTAX", "Optio 750Z" ,1 }, { 15980544, "AGFAPHOTO","DC-833m" ,1 }, { 16098048, "SAMSUNG", "S85" ,1 }, { 16215552, "SAMSUNG", "S85" ,1 }, { 20487168, "SAMSUNG", "WB550" ,1 }, { 24000000, "SAMSUNG", "WB550" ,1 }, { 12582980, "Sinar", "" ,0 }, { 33292868, "Sinar", "" ,0 }, { 44390468, "Sinar", "" ,0 } }; static const char *corp[] = { "Canon", "NIKON", "EPSON", "KODAK", "Kodak", "OLYMPUS", "PENTAX", "MINOLTA", "Minolta", "Konica", "CASIO", "Sinar", "Phase One", "SAMSUNG", "Mamiya", "MOTOROLA" }; tiff_flip = flip = filters = -1; /* 0 is valid, so -1 is unknown */ raw_height = raw_width = fuji_width = fuji_layout = cr2_slice[0] = 0; maximum = height = width = top_margin = left_margin = 0; cdesc[0] = desc[0] = artist[0] = make[0] = model[0] = model2[0] = 0; iso_speed = shutter = aperture = focal_len = unique_id = 0; tiff_nifds = 0; memset (tiff_ifd, 0, sizeof tiff_ifd); memset (gpsdata, 0, sizeof gpsdata); memset (cblack, 0, sizeof cblack); memset (white, 0, sizeof white); thumb_offset = thumb_length = thumb_width = thumb_height = 0; load_raw = thumb_load_raw = 0; write_thumb = &CLASS jpeg_thumb; data_offset = meta_length = tiff_bps = tiff_compress = 0; kodak_cbpp = zero_after_ff = dng_version = load_flags = 0; timestamp = shot_order = tiff_samples = black = is_foveon = 0; mix_green = profile_length = data_error = zero_is_bad = 0; pixel_aspect = is_raw = raw_color = 1; tile_width = tile_length = INT_MAX; for (i=0; i < 4; i++) { cam_mul[i] = i == 1; pre_mul[i] = i < 3; FORC3 cmatrix[c][i] = 0; FORC3 rgb_cam[c][i] = c == i; } colors = 3; for (i=0; i < 0x4000; i++) curve[i] = i; order = get2(); hlen = get4(); fseek (ifp, 0, SEEK_SET); fread (head, 1, 32, ifp); fseek (ifp, 0, SEEK_END); flen = fsize = ftell(ifp); /* Note for Rawstudio maintainers, this check is not present in upstream dcraw */ if (fsize < 32) return; if ((cp = (char *) memmem (head, 32, "MMMM", 4)) || (cp = (char *) memmem (head, 32, "IIII", 4))) { parse_phase_one (cp-head); if (cp-head && parse_tiff(0)) apply_tiff(); } else if (order == 0x4949 || order == 0x4d4d) { if (!memcmp (head+6,"HEAPCCDR",8)) { data_offset = hlen; parse_ciff (hlen, flen - hlen); } else if (parse_tiff(0)) apply_tiff(); } else if (!memcmp (head,"\xff\xd8\xff\xe1",4) && !memcmp (head+6,"Exif",4)) { fseek (ifp, 4, SEEK_SET); data_offset = 4 + get2(); fseek (ifp, data_offset, SEEK_SET); if (fgetc(ifp) != 0xff) parse_tiff(12); thumb_offset = 0; } else if (!memcmp (head+25,"ARECOYK",7)) { strcpy (make, "Contax"); strcpy (model,"N Digital"); fseek (ifp, 33, SEEK_SET); get_timestamp(1); fseek (ifp, 60, SEEK_SET); FORC4 cam_mul[c ^ (c >> 1)] = get4(); } else if (!strcmp (head, "PXN")) { strcpy (make, "Logitech"); strcpy (model,"Fotoman Pixtura"); } else if (!strcmp (head, "qktk")) { strcpy (make, "Apple"); strcpy (model,"QuickTake 100"); load_raw = &CLASS quicktake_100_load_raw; } else if (!strcmp (head, "qktn")) { strcpy (make, "Apple"); strcpy (model,"QuickTake 150"); load_raw = &CLASS kodak_radc_load_raw; } else if (!memcmp (head,"FUJIFILM",8)) { fseek (ifp, 84, SEEK_SET); thumb_offset = get4(); thumb_length = get4(); fseek (ifp, 92, SEEK_SET); parse_fuji (get4()); if (thumb_offset > 120) { fseek (ifp, 120, SEEK_SET); is_raw += (i = get4()) && 1; if (is_raw == 2 && shot_select) parse_fuji (i); } fseek (ifp, 100+28*(shot_select > 0), SEEK_SET); parse_tiff (data_offset = get4()); parse_tiff (thumb_offset+12); apply_tiff(); } else if (!memcmp (head,"RIFF",4)) { fseek (ifp, 0, SEEK_SET); parse_riff(); } else if (!memcmp (head,"\0\001\0\001\0@",6)) { fseek (ifp, 6, SEEK_SET); fread (make, 1, 8, ifp); fread (model, 1, 8, ifp); fread (model2, 1, 16, ifp); data_offset = get2(); get2(); raw_width = get2(); raw_height = get2(); load_raw = &CLASS nokia_load_raw; filters = 0x61616161; } else if (!memcmp (head,"NOKIARAW",8)) { strcpy (make, "NOKIA"); strcpy (model, "X2"); order = 0x4949; fseek (ifp, 300, SEEK_SET); data_offset = get4(); i = get4(); width = get2(); height = get2(); data_offset += i - width * 5 / 4 * height; load_raw = &CLASS nokia_load_raw; filters = 0x61616161; } else if (!memcmp (head,"ARRI",4)) { order = 0x4949; fseek (ifp, 20, SEEK_SET); width = get4(); height = get4(); strcpy (make, "ARRI"); fseek (ifp, 668, SEEK_SET); fread (model, 1, 64, ifp); data_offset = 4096; load_raw = &CLASS packed_load_raw; load_flags = 88; filters = 0x61616161; } else if (!memcmp (head+4,"RED1",4)) { strcpy (make, "RED"); strcpy (model,"ONE"); parse_redcine(); load_raw = &CLASS redcine_load_raw; gamma_curve (1/2.4, 12.92, 1, 4095); filters = 0x49494949; } else if (!memcmp (head,"DSC-Image",9)) parse_rollei(); else if (!memcmp (head,"PWAD",4)) parse_sinar_ia(); else if (!memcmp (head,"\0MRM",4)) parse_minolta(0); else if (!memcmp (head,"FOVb",4)) parse_foveon(); else if (!memcmp (head,"CI",2)) parse_cine(); else for (zero_fsize=i=0; i < (int) sizeof table / (int) sizeof *table; i++) if (fsize == table[i].fsize) { strcpy (make, table[i].make ); strcpy (model, table[i].model); if (table[i].withjpeg) parse_external_jpeg(); } if (zero_fsize) fsize = 0; if (make[0] == 0) parse_smal (0, flen); if (make[0] == 0) parse_jpeg (is_raw = 0); for (i=0; i < (int) sizeof corp / (int) sizeof *corp; i++) if (strstr (make, corp[i])) /* Simplify company names */ strcpy (make, corp[i]); if (!strncmp (make,"KODAK",5) && ((cp = strstr(model," DIGITAL CAMERA")) || (cp = strstr(model," Digital Camera")) || (cp = strstr(model,"FILE VERSION")))) *cp = 0; cp = make + strlen(make); /* Remove trailing spaces */ while (*--cp == ' ') *cp = 0; cp = model + strlen(model); while (*--cp == ' ') *cp = 0; i = strlen(make); /* Remove make from model */ if (!strncasecmp (model, make, i) && model[i++] == ' ') memmove (model, model+i, 64-i); if (!strncmp (model,"Digital Camera ",15)) strcpy (model, model+15); desc[511] = artist[63] = make[63] = model[63] = model2[63] = 0; if (!is_raw) goto notraw; if (!height) height = raw_height; if (!width) width = raw_width; if (fuji_width) { fuji_width = (raw_width+1)/2; width = height + fuji_width; height = width - 1; pixel_aspect = 1; } if (height == 2624 && width == 3936) /* Pentax K10D and Samsung GX10 */ { height = 2616; width = 3896; } if (height == 3136 && width == 4864) /* Pentax K20D and Samsung GX20 */ { height = 3124; width = 4688; filters = 0x16161616; } if (width == 4352 && (!strcmp(model,"K-r") || !strcmp(model,"K-x"))) { width = 4309; filters = 0x16161616; } if (width >= 4960 && !strcmp(model,"K-5")) { left_margin = 10; width = 4950; filters = 0x16161616; } if (width == 4736 && !strcmp(model,"K-7")) { height = 3122; width = 4684; filters = 0x16161616; top_margin = 2; } if (width == 7424 && !strcmp(model,"645D")) { height = 5502; width = 7328; filters = 0x61616161; top_margin = 29; left_margin = 48; } if (height == 3014 && width == 4096) /* Ricoh GX200 */ width = 4014; if (dng_version) { if (filters == UINT_MAX) filters = 0; if (filters) is_raw = tiff_samples; else colors = tiff_samples; if (tiff_compress == 1) load_raw = &CLASS adobe_dng_load_raw_nc; if (tiff_compress == 7) load_raw = &CLASS adobe_dng_load_raw_lj; goto dng_skip; } if ((is_canon = !strcmp(make,"Canon"))) load_raw = memcmp (head+6,"HEAPCCDR",8) ? &CLASS lossless_jpeg_load_raw : &CLASS canon_compressed_load_raw; if (!strcmp(make,"NIKON")) { if (!load_raw) load_raw = &CLASS packed_load_raw; if (model[0] == 'E') load_flags |= !data_offset << 2 | 2; } if (!strcmp(make,"CASIO")) { load_raw = &CLASS packed_load_raw; maximum = 0xf7f; } /* Set parameters based on camera name (for non-DNG files). */ if (is_foveon) { if (height*2 < width) pixel_aspect = 0.5; if (height > width) pixel_aspect = 2; filters = 0; load_raw = &CLASS foveon_load_raw; simple_coeff(0); } else if (is_canon && tiff_bps == 15) { switch (width) { case 3344: width -= 66; case 3872: width -= 6; } filters = 0; load_raw = &CLASS canon_sraw_load_raw; } else if (!strcmp(model,"PowerShot 600")) { height = 613; width = 854; raw_width = 896; pixel_aspect = 607/628.0; colors = 4; filters = 0xe1e4e1e4; load_raw = &CLASS canon_600_load_raw; } else if (!strcmp(model,"PowerShot A5") || !strcmp(model,"PowerShot A5 Zoom")) { height = 773; width = 960; raw_width = 992; pixel_aspect = 256/235.0; colors = 4; filters = 0x1e4e1e4e; goto canon_a5; } else if (!strcmp(model,"PowerShot A50")) { height = 968; width = 1290; raw_width = 1320; colors = 4; filters = 0x1b4e4b1e; goto canon_a5; } else if (!strcmp(model,"PowerShot Pro70")) { height = 1024; width = 1552; colors = 4; filters = 0x1e4b4e1b; goto canon_a5; } else if (!strcmp(model,"PowerShot SD300")) { height = 1752; width = 2344; raw_height = 1766; raw_width = 2400; top_margin = 12; left_margin = 12; goto canon_a5; } else if (!strcmp(model,"PowerShot A460")) { height = 1960; width = 2616; raw_height = 1968; raw_width = 2664; top_margin = 4; left_margin = 4; goto canon_a5; } else if (!strcmp(model,"PowerShot A530")) { height = 1984; width = 2620; raw_height = 1992; raw_width = 2672; top_margin = 6; left_margin = 10; goto canon_a5; } else if (!strcmp(model,"PowerShot A610")) { if (canon_s2is()) strcpy (model+10, "S2 IS"); height = 1960; width = 2616; raw_height = 1968; raw_width = 2672; top_margin = 8; left_margin = 12; goto canon_a5; } else if (!strcmp(model,"PowerShot A620")) { height = 2328; width = 3112; raw_height = 2340; raw_width = 3152; top_margin = 12; left_margin = 36; goto canon_a5; } else if (!strcmp(model,"PowerShot A470")) { height = 2328; width = 3096; raw_height = 2346; raw_width = 3152; top_margin = 6; left_margin = 12; goto canon_a5; } else if (!strcmp(model,"PowerShot A720 IS")) { height = 2472; width = 3298; raw_height = 2480; raw_width = 3336; top_margin = 5; left_margin = 6; goto canon_a5; } else if (!strcmp(model,"PowerShot A630")) { height = 2472; width = 3288; raw_height = 2484; raw_width = 3344; top_margin = 6; left_margin = 12; goto canon_a5; } else if (!strcmp(model,"PowerShot A640")) { height = 2760; width = 3672; raw_height = 2772; raw_width = 3736; top_margin = 6; left_margin = 12; goto canon_a5; } else if (!strcmp(model,"PowerShot A650")) { height = 3024; width = 4032; raw_height = 3048; raw_width = 4104; top_margin = 12; left_margin = 48; goto canon_a5; } else if (!strcmp(model,"PowerShot S3 IS")) { height = 2128; width = 2840; raw_height = 2136; raw_width = 2888; top_margin = 8; left_margin = 44; canon_a5: tiff_bps = 10; load_raw = &CLASS packed_load_raw; load_flags = 40; if (raw_width > 1600) zero_is_bad = 1; } else if (!strcmp(model,"PowerShot SX110 IS")) { height = 2760; width = 3684; raw_height = 2772; raw_width = 3720; top_margin = 12; left_margin = 6; load_raw = &CLASS packed_load_raw; load_flags = 40; zero_is_bad = 1; } else if (!strcmp(model,"PowerShot SX120 IS")) { height = 2742; width = 3664; raw_height = 2778; raw_width = 3728; top_margin = 18; left_margin = 16; filters = 0x49494949; load_raw = &CLASS packed_load_raw; load_flags = 40; zero_is_bad = 1; } else if (!strcmp(model,"PowerShot SX20 IS")) { height = 3024; width = 4032; raw_height = 3048; raw_width = 4080; top_margin = 12; left_margin = 24; load_raw = &CLASS packed_load_raw; load_flags = 40; zero_is_bad = 1; } else if (!strcmp(model,"PowerShot SX30 IS")) { height = 3254; width = 4366; raw_height = 3276; raw_width = 4464; top_margin = 10; left_margin = 25; filters = 0x16161616; load_raw = &CLASS packed_load_raw; load_flags = 40; zero_is_bad = 1; } else if (!strcmp(model,"PowerShot Pro90 IS")) { width = 1896; colors = 4; filters = 0xb4b4b4b4; } else if (is_canon && raw_width == 2144) { height = 1550; width = 2088; top_margin = 8; left_margin = 4; if (!strcmp(model,"PowerShot G1")) { colors = 4; filters = 0xb4b4b4b4; } } else if (is_canon && raw_width == 2224) { height = 1448; width = 2176; top_margin = 6; left_margin = 48; } else if (is_canon && raw_width == 2376) { height = 1720; width = 2312; top_margin = 6; left_margin = 12; } else if (is_canon && raw_width == 2672) { height = 1960; width = 2616; top_margin = 6; left_margin = 12; } else if (is_canon && raw_width == 3152) { height = 2056; width = 3088; top_margin = 12; left_margin = 64; if (unique_id == 0x80000170) adobe_coeff ("Canon","EOS 300D"); } else if (is_canon && raw_width == 3160) { height = 2328; width = 3112; top_margin = 12; left_margin = 44; } else if (is_canon && raw_width == 3344) { height = 2472; width = 3288; top_margin = 6; left_margin = 4; } else if (!strcmp(model,"EOS D2000C")) { filters = 0x61616161; black = curve[200]; } else if (is_canon && raw_width == 3516) { top_margin = 14; left_margin = 42; if (unique_id == 0x80000189) adobe_coeff ("Canon","EOS 350D"); goto canon_cr2; } else if (is_canon && raw_width == 3596) { top_margin = 12; left_margin = 74; goto canon_cr2; } else if (is_canon && raw_width == 3744) { height = 2760; width = 3684; top_margin = 16; left_margin = 8; if (unique_id > 0x2720000) { top_margin = 12; left_margin = 52; } } else if (is_canon && raw_width == 3944) { height = 2602; width = 3908; top_margin = 18; left_margin = 30; } else if (is_canon && raw_width == 3948) { top_margin = 18; left_margin = 42; height -= 2; if (unique_id == 0x80000236) adobe_coeff ("Canon","EOS 400D"); if (unique_id == 0x80000254) adobe_coeff ("Canon","EOS 1000D"); goto canon_cr2; } else if (is_canon && raw_width == 3984) { top_margin = 20; left_margin = 76; height -= 2; goto canon_cr2; } else if (is_canon && raw_width == 4104) { height = 3024; width = 4032; top_margin = 12; left_margin = 48; } else if (is_canon && raw_width == 4152) { top_margin = 12; left_margin = 192; goto canon_cr2; } else if (is_canon && raw_width == 4160) { height = 3048; width = 4048; top_margin = 11; left_margin = 104; } else if (is_canon && raw_width == 4312) { top_margin = 18; left_margin = 22; height -= 2; if (unique_id == 0x80000176) adobe_coeff ("Canon","EOS 450D"); goto canon_cr2; } else if (is_canon && raw_width == 4352) { top_margin = 18; left_margin = 62; if (unique_id == 0x80000288) adobe_coeff ("Canon","EOS 1100D"); goto canon_cr2; } else if (is_canon && raw_width == 4476) { top_margin = 34; left_margin = 90; goto canon_cr2; } else if (is_canon && raw_width == 4480) { height = 3326; width = 4432; top_margin = 10; left_margin = 12; filters = 0x49494949; } else if (is_canon && raw_width == 4832) { top_margin = unique_id == 0x80000261 ? 51:26; left_margin = 62; if (unique_id == 0x80000252) adobe_coeff ("Canon","EOS 500D"); goto canon_cr2; } else if (is_canon && raw_width == 5120) { height -= top_margin = 45; left_margin = 142; width = 4916; } else if (is_canon && raw_width == 5344) { top_margin = 51; left_margin = 142; if (unique_id == 0x80000270) adobe_coeff ("Canon","EOS 550D"); if (unique_id == 0x80000286) adobe_coeff ("Canon","EOS 600D"); goto canon_cr2; } else if (is_canon && raw_width == 5360) { top_margin = 51; left_margin = 158; goto canon_cr2; } else if (is_canon && raw_width == 5792) { top_margin = 51; left_margin = 158; goto canon_cr2; } else if (is_canon && raw_width == 5108) { top_margin = 13; left_margin = 98; canon_cr2: height -= top_margin; width -= left_margin; } else if (is_canon && raw_width == 5712) { height = 3752; width = 5640; top_margin = 20; left_margin = 62; } else if (!strcmp(model,"D1")) { cam_mul[0] *= 256/527.0; cam_mul[2] *= 256/317.0; } else if (!strcmp(model,"D1X")) { width -= 4; pixel_aspect = 0.5; } else if (!strcmp(model,"D40X") || !strcmp(model,"D60") || !strcmp(model,"D80") || !strcmp(model,"D3000")) { height -= 3; width -= 4; } else if (!strcmp(model,"D3") || !strcmp(model,"D3S") || !strcmp(model,"D700")) { width -= 4; left_margin = 2; } else if (!strcmp(model,"D5000")) { width -= 42; } else if (!strcmp(model,"D5100") || !strcmp(model,"D7000")) { width -= 44; } else if (!strcmp(model,"D3100")) { width -= 28; left_margin = 6; } else if (!strncmp(model,"D40",3) || !strncmp(model,"D50",3) || !strncmp(model,"D70",3)) { width--; } else if (!strcmp(model,"D90")) { width -= 42; } else if (!strcmp(model,"D100")) { if (tiff_compress == 34713 && !nikon_is_compressed()) { load_raw = &CLASS packed_load_raw; load_flags |= 1; raw_width = (width += 3) + 3; } } else if (!strcmp(model,"D200")) { left_margin = 1; width -= 4; filters = 0x94949494; } else if (!strncmp(model,"D2H",3)) { left_margin = 6; width -= 14; } else if (!strncmp(model,"D2X",3)) { if (width == 3264) width -= 32; else width -= 8; } else if (!strncmp(model,"D300",4)) { width -= 32; } else if (!strncmp(model,"COOLPIX P",9)) { load_flags = 24; filters = 0x94949494; if (model[9] == '7' && iso_speed >= 400) black = 255; } else if (!strncmp(model,"1 ",2)) { height -= 2; } else if (fsize == 1581060) { height = 963; width = 1287; raw_width = 1632; maximum = 0x3f4; colors = 4; filters = 0x1e1e1e1e; simple_coeff(3); pre_mul[0] = 1.2085; pre_mul[1] = 1.0943; pre_mul[3] = 1.1103; goto e900; } else if (fsize == 2465792) { height = 1203; width = 1616; raw_width = 2048; colors = 4; filters = 0x4b4b4b4b; adobe_coeff ("NIKON","E950"); e900: tiff_bps = 10; load_raw = &CLASS packed_load_raw; load_flags = 6; } else if (fsize == 4771840) { height = 1540; width = 2064; colors = 4; filters = 0xe1e1e1e1; load_raw = &CLASS packed_load_raw; load_flags = 6; if (!timestamp && nikon_e995()) strcpy (model, "E995"); if (strcmp(model,"E995")) { filters = 0xb4b4b4b4; simple_coeff(3); pre_mul[0] = 1.196; pre_mul[1] = 1.246; pre_mul[2] = 1.018; } } else if (!strcmp(model,"E2100")) { if (!timestamp && !nikon_e2100()) goto cp_e2500; height = 1206; width = 1616; load_flags = 30; } else if (!strcmp(model,"E2500")) { cp_e2500: strcpy (model, "E2500"); height = 1204; width = 1616; colors = 4; filters = 0x4b4b4b4b; } else if (fsize == 4775936) { height = 1542; width = 2064; load_raw = &CLASS packed_load_raw; load_flags = 30; if (!timestamp) nikon_3700(); if (model[0] == 'E' && atoi(model+1) < 3700) filters = 0x49494949; if (!strcmp(model,"Optio 33WR")) { flip = 1; filters = 0x16161616; } if (make[0] == 'O') { i = find_green (12, 32, 1188864, 3576832); c = find_green (12, 32, 2383920, 2387016); if (abs(i) < abs(c)) { SWAP(i,c); load_flags = 24; } if (i < 0) filters = 0x61616161; } } else if (fsize == 5869568) { height = 1710; width = 2288; filters = 0x16161616; if (!timestamp && minolta_z2()) { strcpy (make, "Minolta"); strcpy (model,"DiMAGE Z2"); } load_raw = &CLASS packed_load_raw; load_flags = 6 + 24*(make[0] == 'M'); } else if (!strcmp(model,"E4500")) { height = 1708; width = 2288; colors = 4; filters = 0xb4b4b4b4; } else if (fsize == 7438336) { height = 1924; width = 2576; colors = 4; filters = 0xb4b4b4b4; } else if (fsize == 8998912) { height = 2118; width = 2832; maximum = 0xf83; load_raw = &CLASS packed_load_raw; load_flags = 30; } else if (!strcmp(model,"FinePix S5100") || !strcmp(model,"FinePix S5500")) { height -= top_margin = 6; } else if (!strcmp(make,"FUJIFILM")) { if (!strcmp(model+7,"S2Pro")) { strcpy (model+7," S2Pro"); height = 2144; width = 2880; flip = 6; } else if (load_raw != &CLASS packed_load_raw) maximum = (is_raw == 2 && shot_select) ? 0x2f00 : 0x3e00; top_margin = (raw_height - height) >> 2 << 1; left_margin = (raw_width - width ) >> 2 << 1; if (width == 3328) { width = 3262; left_margin = 34; } if (!strcmp(model,"X10")) filters = 0x16161616; if (fuji_layout) raw_width *= is_raw; if (load_raw == &CLASS fuji_load_raw) { fuji_width = width >> !fuji_layout; width = (height >> fuji_layout) + fuji_width; raw_height = height; height = width - 1; if (~fuji_width & 1) filters = 0x49494949; } } else if (!strcmp(model,"RD175")) { height = 986; width = 1534; data_offset = 513; filters = 0x61616161; load_raw = &CLASS minolta_rd175_load_raw; } else if (!strcmp(model,"KD-400Z")) { height = 1712; width = 2312; raw_width = 2336; goto konica_400z; } else if (!strcmp(model,"KD-510Z")) { goto konica_510z; } else if (!strcasecmp(make,"MINOLTA")) { load_raw = &CLASS unpacked_load_raw; maximum = 0xfff; if (!strncmp(model,"DiMAGE A",8)) { if (!strcmp(model,"DiMAGE A200")) filters = 0x49494949; tiff_bps = 12; load_raw = &CLASS packed_load_raw; } else if (!strncmp(model,"ALPHA",5) || !strncmp(model,"DYNAX",5) || !strncmp(model,"MAXXUM",6)) { sprintf (model+20, "DYNAX %-10s", model+6+(model[0]=='M')); adobe_coeff (make, model+20); load_raw = &CLASS packed_load_raw; } else if (!strncmp(model,"DiMAGE G",8)) { if (model[8] == '4') { height = 1716; width = 2304; } else if (model[8] == '5') { konica_510z: height = 1956; width = 2607; raw_width = 2624; } else if (model[8] == '6') { height = 2136; width = 2848; } data_offset += 14; filters = 0x61616161; konica_400z: load_raw = &CLASS unpacked_load_raw; maximum = 0x3df; order = 0x4d4d; } } else if (!strcmp(model,"*ist D")) { data_error = -1; } else if (!strcmp(model,"*ist DS")) { height -= 2; } else if (!strcmp(model,"Optio S")) { if (fsize == 3178560) { height = 1540; width = 2064; load_raw = &CLASS eight_bit_load_raw; cam_mul[0] *= 4; cam_mul[2] *= 4; } else { height = 1544; width = 2068; raw_width = 3136; load_raw = &CLASS packed_load_raw; maximum = 0xf7c; } } else if (fsize == 6114240) { height = 1737; width = 2324; raw_width = 3520; load_raw = &CLASS packed_load_raw; maximum = 0xf7a; } else if (!strcmp(model,"Optio 750Z")) { height = 2302; width = 3072; load_raw = &CLASS packed_load_raw; load_flags = 30; } else if (!strcmp(model,"DC-833m")) { height = 2448; width = 3264; order = 0x4949; filters = 0x61616161; load_raw = &CLASS unpacked_load_raw; maximum = 0xfc00; } else if (!strncmp(model,"S85",3)) { height = 2448; width = 3264; raw_width = fsize/height/2; order = 0x4d4d; load_raw = &CLASS unpacked_load_raw; } else if (!strncmp(model,"NX1",3)) { height -= top_margin = 8; width -= 2 * (left_margin = 8); load_flags = 32; } else if (!strcmp(model,"NX200")) { order = 0x4949; height = 3662; width = 5528; top_margin = 2; left_margin = 46; } else if (!strcmp(model,"EX1")) { order = 0x4949; height -= 20; top_margin = 2; if ((width -= 6) > 3682) { height -= 10; width -= 46; top_margin = 8; } } else if (!strcmp(model,"WB2000")) { order = 0x4949; height -= 3; top_margin = 2; if ((width -= 10) > 3718) { height -= 28; width -= 56; top_margin = 8; } } else if (fsize == 20487168) { height = 2808; width = 3648; goto wb550; } else if (fsize == 24000000) { height = 3000; width = 4000; wb550: strcpy (model, "WB550"); order = 0x4d4d; load_raw = &CLASS unpacked_load_raw; load_flags = 6; maximum = 0x3df; } else if (!strcmp(model,"STV680 VGA")) { height = 484; width = 644; load_raw = &CLASS eight_bit_load_raw; flip = 2; filters = 0x16161616; black = 16; } else if (!strcmp(model,"N95")) { height = raw_height - (top_margin = 2); } else if (!strcmp(model,"531C")) { height = 1200; width = 1600; load_raw = &CLASS unpacked_load_raw; filters = 0x49494949; } else if (!strcmp(model,"F-080C")) { height = 768; width = 1024; load_raw = &CLASS eight_bit_load_raw; } else if (!strcmp(model,"F-145C")) { height = 1040; width = 1392; load_raw = &CLASS eight_bit_load_raw; } else if (!strcmp(model,"F-201C")) { height = 1200; width = 1600; load_raw = &CLASS eight_bit_load_raw; } else if (!strcmp(model,"F-510C")) { height = 1958; width = 2588; load_raw = fsize < 7500000 ? &CLASS eight_bit_load_raw : &CLASS unpacked_load_raw; data_offset = fsize - width*height*(fsize >> 22); maximum = 0xfff0; } else if (!strcmp(model,"F-810C")) { height = 2469; width = 3272; load_raw = &CLASS unpacked_load_raw; maximum = 0xfff0; } else if (!strcmp(model,"XCD-SX910CR")) { height = 1024; width = 1375; raw_width = 1376; filters = 0x49494949; maximum = 0x3ff; load_raw = fsize < 2000000 ? &CLASS eight_bit_load_raw : &CLASS unpacked_load_raw; } else if (!strcmp(model,"2010")) { height = 1207; width = 1608; order = 0x4949; filters = 0x16161616; data_offset = 3212; maximum = 0x3ff; load_raw = &CLASS unpacked_load_raw; } else if (!strcmp(model,"A782")) { height = 3000; width = 2208; filters = 0x61616161; load_raw = fsize < 10000000 ? &CLASS eight_bit_load_raw : &CLASS unpacked_load_raw; maximum = 0xffc0; } else if (!strcmp(model,"3320AF")) { height = 1536; raw_width = width = 2048; filters = 0x61616161; load_raw = &CLASS unpacked_load_raw; maximum = 0x3ff; fseek (ifp, 0x300000, SEEK_SET); if ((order = guess_byte_order(0x10000)) == 0x4d4d) { height -= (top_margin = 16); width -= (left_margin = 28); maximum = 0xf5c0; strcpy (make, "ISG"); model[0] = 0; } } else if (!strcmp(make,"Hasselblad")) { if (load_raw == &CLASS lossless_jpeg_load_raw) load_raw = &CLASS hasselblad_load_raw; if (raw_width == 7262) { height = 5444; width = 7248; top_margin = 4; left_margin = 7; filters = 0x61616161; } else if (raw_width == 7410) { height = 5502; width = 7328; top_margin = 4; left_margin = 41; filters = 0x61616161; } else if (raw_width == 9044) { height = 6716; width = 8964; top_margin = 8; left_margin = 40; black += load_flags = 256; maximum = 0x8101; } else if (raw_width == 4090) { strcpy (model, "V96C"); height -= (top_margin = 6); width -= (left_margin = 3) + 7; filters = 0x61616161; } } else if (!strcmp(make,"Sinar")) { if (!memcmp(head,"8BPS",4)) { fseek (ifp, 14, SEEK_SET); height = get4(); width = get4(); filters = 0x61616161; data_offset = 68; } if (!load_raw) load_raw = &CLASS unpacked_load_raw; maximum = 0x3fff; } else if (!strcmp(make,"Leaf")) { maximum = 0x3fff; fseek (ifp, data_offset, SEEK_SET); if (ljpeg_start (&jh, 1) && jh.bits == 15) maximum = 0x1fff; if (tiff_samples > 1) filters = 0; if (tiff_samples > 1 || tile_length < raw_height) { load_raw = &CLASS leaf_hdr_load_raw; raw_width = tile_width; } if ((width | height) == 2048) { if (tiff_samples == 1) { filters = 1; strcpy (cdesc, "RBTG"); strcpy (model, "CatchLight"); top_margin = 8; left_margin = 18; height = 2032; width = 2016; } else { strcpy (model, "DCB2"); top_margin = 10; left_margin = 16; height = 2028; width = 2022; } } else if (width+height == 3144+2060) { if (!model[0]) strcpy (model, "Cantare"); if (width > height) { top_margin = 6; left_margin = 32; height = 2048; width = 3072; filters = 0x61616161; } else { left_margin = 6; top_margin = 32; width = 2048; height = 3072; filters = 0x16161616; } if (!cam_mul[0] || model[0] == 'V') filters = 0; else is_raw = tiff_samples; } else if (width == 2116) { strcpy (model, "Valeo 6"); height -= 2 * (top_margin = 30); width -= 2 * (left_margin = 55); filters = 0x49494949; } else if (width == 3171) { strcpy (model, "Valeo 6"); height -= 2 * (top_margin = 24); width -= 2 * (left_margin = 24); filters = 0x16161616; } } else if (!strcmp(make,"LEICA") || !strcmp(make,"Panasonic")) { if ((flen - data_offset) / (raw_width*8/7) == raw_height) load_raw = &CLASS panasonic_load_raw; if (!load_raw) { load_raw = &CLASS unpacked_load_raw; load_flags = 4; } zero_is_bad = 1; if ((height += 12) > raw_height) height = raw_height; for (i=0; i < (int) sizeof pana / (int) sizeof *pana; i++) if (raw_width == pana[i][0] && raw_height == pana[i][1]) { left_margin = pana[i][2]; top_margin = pana[i][3]; width += pana[i][4]; height += pana[i][5]; } filters = 0x01010101 * (uchar) "\x94\x61\x49\x16" [((filters-1) ^ (left_margin & 1) ^ (top_margin << 1)) & 3]; } else if (!strcmp(model,"C770UZ")) { height = 1718; width = 2304; filters = 0x16161616; load_raw = &CLASS packed_load_raw; load_flags = 30; } else if (!strcmp(make,"OLYMPUS")) { height += height & 1; filters = exif_cfa; if (width == 4100) width -= 4; if (width == 4080) width -= 24; if (load_raw == &CLASS unpacked_load_raw) load_flags = 4; tiff_bps = 12; if (!strcmp(model,"E-300") || !strcmp(model,"E-500")) { width -= 20; if (load_raw == &CLASS unpacked_load_raw) { maximum = 0xfc3; memset (cblack, 0, sizeof cblack); } } else if (!strcmp(model,"E-330")) { width -= 30; if (load_raw == &CLASS unpacked_load_raw) maximum = 0xf79; } else if (!strcmp(model,"SP550UZ")) { thumb_length = flen - (thumb_offset = 0xa39800); thumb_height = 480; thumb_width = 640; } } else if (!strcmp(model,"N Digital")) { height = 2047; width = 3072; filters = 0x61616161; data_offset = 0x1a00; load_raw = &CLASS packed_load_raw; } else if (!strcmp(model,"DSC-F828")) { width = 3288; left_margin = 5; data_offset = 862144; load_raw = &CLASS sony_load_raw; filters = 0x9c9c9c9c; colors = 4; strcpy (cdesc, "RGBE"); } else if (!strcmp(model,"DSC-V3")) { width = 3109; left_margin = 59; data_offset = 787392; load_raw = &CLASS sony_load_raw; } else if (!strcmp(make,"SONY") && raw_width == 3984) { adobe_coeff ("SONY","DSC-R1"); width = 3925; order = 0x4d4d; } else if (!strcmp(make,"SONY") && raw_width == 6048) { width -= 24; } else if (!strcmp(model,"DSLR-A100")) { if (width == 3880) { height--; width = ++raw_width; } else { order = 0x4d4d; load_flags = 2; } filters = 0x61616161; } else if (!strcmp(model,"DSLR-A350")) { height -= 4; } else if (!strcmp(model,"NEX-5N")) { width -= 24; } else if (!strcmp(model,"PIXL")) { height -= top_margin = 4; width -= left_margin = 32; gamma_curve (0, 7, 1, 255); } else if (!strcmp(model,"C603v")) { height = 480; width = 640; if (fsize < 614400 || find_green (16, 16, 3840, 5120) < 25) goto c603v; strcpy (model,"KAI-0340"); height -= 3; data_offset = 3840; order = 0x4949; load_raw = &CLASS unpacked_load_raw; } else if (!strcmp(model,"C603y")) { height = 2134; width = 2848; c603v: filters = 0; load_raw = &CLASS kodak_yrgb_load_raw; gamma_curve (0, 3.875, 1, 255); } else if (!strcmp(model,"C603")) { raw_height = height = 2152; raw_width = width = 2864; goto c603; } else if (!strcmp(model,"C330")) { height = 1744; width = 2336; raw_height = 1779; raw_width = 2338; top_margin = 33; left_margin = 1; c603: order = 0x4949; if ((data_offset = fsize - raw_height*raw_width)) { fseek (ifp, 168, SEEK_SET); read_shorts (curve, 256); } else gamma_curve (0, 3.875, 1, 255); load_raw = &CLASS eight_bit_load_raw; } else if (!strncasecmp(model,"EasyShare",9)) { data_offset = data_offset < 0x15000 ? 0x15000 : 0x17000; load_raw = &CLASS packed_load_raw; } else if (!strcasecmp(make,"KODAK")) { if (filters == UINT_MAX) filters = 0x61616161; if (!strncmp(model,"NC2000",6)) { width -= 4; left_margin = 2; } else if (!strcmp(model,"EOSDCS3B")) { width -= 4; left_margin = 2; } else if (!strcmp(model,"EOSDCS1")) { width -= 4; left_margin = 2; } else if (!strcmp(model,"DCS420")) { width -= 4; left_margin = 2; } else if (!strncmp(model,"DCS460 ",7)) { model[6] = 0; width -= 4; left_margin = 2; } else if (!strcmp(model,"DCS460A")) { width -= 4; left_margin = 2; colors = 1; filters = 0; } else if (!strcmp(model,"DCS660M")) { black = 214; colors = 1; filters = 0; } else if (!strcmp(model,"DCS760M")) { colors = 1; filters = 0; } if (!strcmp(model+4,"20X")) strcpy (cdesc, "MYCY"); if (strstr(model,"DC25")) { strcpy (model, "DC25"); data_offset = 15424; } if (!strncmp(model,"DC2",3)) { height = 242; if (flen < 100000) { raw_width = 256; width = 249; pixel_aspect = (4.0*height) / (3.0*width); } else { raw_width = 512; width = 501; pixel_aspect = (493.0*height) / (373.0*width); } data_offset += raw_width + 1; colors = 4; filters = 0x8d8d8d8d; simple_coeff(1); pre_mul[1] = 1.179; pre_mul[2] = 1.209; pre_mul[3] = 1.036; load_raw = &CLASS eight_bit_load_raw; } else if (!strcmp(model,"40")) { strcpy (model, "DC40"); height = 512; width = 768; data_offset = 1152; load_raw = &CLASS kodak_radc_load_raw; } else if (strstr(model,"DC50")) { strcpy (model, "DC50"); height = 512; width = 768; data_offset = 19712; load_raw = &CLASS kodak_radc_load_raw; } else if (strstr(model,"DC120")) { strcpy (model, "DC120"); height = 976; width = 848; pixel_aspect = height/0.75/width; load_raw = tiff_compress == 7 ? &CLASS kodak_jpeg_load_raw : &CLASS kodak_dc120_load_raw; } else if (!strcmp(model,"DCS200")) { thumb_height = 128; thumb_width = 192; thumb_offset = 6144; thumb_misc = 360; write_thumb = &CLASS layer_thumb; height = 1024; width = 1536; data_offset = 79872; load_raw = &CLASS eight_bit_load_raw; black = 17; } } else if (!strcmp(model,"Fotoman Pixtura")) { height = 512; width = 768; data_offset = 3632; load_raw = &CLASS kodak_radc_load_raw; filters = 0x61616161; simple_coeff(2); } else if (!strncmp(model,"QuickTake",9)) { if (head[5]) strcpy (model+10, "200"); fseek (ifp, 544, SEEK_SET); height = get2(); width = get2(); data_offset = (get4(),get2()) == 30 ? 738:736; if (height > width) { SWAP(height,width); fseek (ifp, data_offset-6, SEEK_SET); flip = ~get2() & 3 ? 5:6; } filters = 0x61616161; } else if (!strcmp(make,"Rollei") && !load_raw) { switch (raw_width) { case 1316: height = 1030; width = 1300; top_margin = 1; left_margin = 6; break; case 2568: height = 1960; width = 2560; top_margin = 2; left_margin = 8; } filters = 0x16161616; load_raw = &CLASS rollei_load_raw; } else if (!strcmp(model,"PC-CAM 600")) { height = 768; data_offset = width = 1024; filters = 0x49494949; load_raw = &CLASS eight_bit_load_raw; } else if (!strcmp(model,"QV-2000UX")) { height = 1208; width = 1632; data_offset = width * 2; load_raw = &CLASS eight_bit_load_raw; } else if (fsize == 3217760) { height = 1546; width = 2070; raw_width = 2080; load_raw = &CLASS eight_bit_load_raw; } else if (!strcmp(model,"QV-4000")) { height = 1700; width = 2260; load_raw = &CLASS unpacked_load_raw; maximum = 0xffff; } else if (!strcmp(model,"QV-5700")) { height = 1924; width = 2576; raw_width = 3232; tiff_bps = 10; } else if (!strcmp(model,"QV-R41")) { height = 1720; width = 2312; raw_width = 3520; left_margin = 2; } else if (!strcmp(model,"QV-R51")) { height = 1926; width = 2580; raw_width = 3904; } else if (!strcmp(model,"EX-S20")) { height = 1208; width = 1620; raw_width = 2432; flip = 3; } else if (!strcmp(model,"EX-S100")) { height = 1544; width = 2058; raw_width = 3136; } else if (!strcmp(model,"EX-Z50")) { height = 1931; width = 2570; raw_width = 3904; } else if (!strcmp(model,"EX-Z500")) { height = 1937; width = 2577; raw_width = 3904; filters = 0x16161616; } else if (!strcmp(model,"EX-Z55")) { height = 1960; width = 2570; raw_width = 3904; } else if (!strcmp(model,"EX-Z60")) { height = 2145; width = 2833; raw_width = 3584; filters = 0x16161616; tiff_bps = 10; } else if (!strcmp(model,"EX-Z75")) { height = 2321; width = 3089; raw_width = 4672; maximum = 0xfff; } else if (!strcmp(model,"EX-Z750")) { height = 2319; width = 3087; raw_width = 4672; maximum = 0xfff; } else if (!strcmp(model,"EX-Z850")) { height = 2468; width = 3279; raw_width = 4928; maximum = 0xfff; } else if (fsize == 15499264) { /* EX-Z1050 or EX-Z1080 */ height = 2752; width = 3672; raw_width = 5632; } else if (!strcmp(model,"EX-P505")) { height = 1928; width = 2568; raw_width = 3852; maximum = 0xfff; } else if (fsize == 9313536) { /* EX-P600 or QV-R61 */ height = 2142; width = 2844; raw_width = 4288; } else if (!strcmp(model,"EX-P700")) { height = 2318; width = 3082; raw_width = 4672; } if (!model[0]) sprintf (model, "%dx%d", width, height); if (filters == UINT_MAX) filters = 0x94949494; if (raw_color) adobe_coeff (make, model); if (load_raw == &CLASS kodak_radc_load_raw) if (raw_color) adobe_coeff ("Apple","Quicktake"); if (thumb_offset && !thumb_height) { fseek (ifp, thumb_offset, SEEK_SET); if (ljpeg_start (&jh, 1)) { thumb_width = jh.wide; thumb_height = jh.high; } } dng_skip: if (!tiff_bps) tiff_bps = 12; if (!maximum) maximum = (1 << tiff_bps) - 1; if (!load_raw || height < 22) is_raw = 0; #ifndef HAVE_LIBJASPER if (load_raw == &CLASS redcine_load_raw) { dcraw_message (DCRAW_ERROR,_("%s: You must link dcraw with %s!!\n"), ifname_display, "libjasper"); is_raw = 0; } #endif #ifndef HAVE_LIBJPEG if (load_raw == &CLASS kodak_jpeg_load_raw) { dcraw_message (DCRAW_ERROR,_("%s: You must link dcraw with %s!!\n"), ifname_display, "libjpeg"); is_raw = 0; } #endif if (!cdesc[0]) strcpy (cdesc, colors == 3 ? "RGBG":"GMCY"); if (!raw_height) raw_height = height; if (!raw_width ) raw_width = width; if (filters && colors == 3) filters |= ((filters >> 2 & 0x22222222) | (filters << 2 & 0x88888888)) & filters << 1; notraw: if (flip == -1) flip = tiff_flip; if (flip == -1) flip = 0; }
0
475,777
static int nft_chain_parse_netdev(struct net *net, struct nlattr *tb[], struct list_head *hook_list) { struct nft_hook *hook; int err; if (tb[NFTA_HOOK_DEV]) { hook = nft_netdev_hook_alloc(net, tb[NFTA_HOOK_DEV]); if (IS_ERR(hook)) return PTR_ERR(hook); list_add_tail(&hook->list, hook_list); } else if (tb[NFTA_HOOK_DEVS]) { err = nf_tables_parse_netdev_hooks(net, tb[NFTA_HOOK_DEVS], hook_list); if (err < 0) return err; if (list_empty(hook_list)) return -EINVAL; } else { return -EINVAL; } return 0; }
0
183,105
static void locationReplaceableAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) { TestObjectPython* proxyImp = V8TestObjectPython::toNative(info.Holder()); RefPtr<TestNode> imp = WTF::getPtr(proxyImp->locationReplaceable()); if (!imp) return; V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); imp->setHref(cppValue); }
0
79,833
GF_Err mp4s_AddBox(GF_Box *s, GF_Box *a) { GF_MPEGSampleEntryBox *ptr = (GF_MPEGSampleEntryBox *)s; switch (a->type) { case GF_ISOM_BOX_TYPE_ESDS: if (ptr->esd) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->esd = (GF_ESDBox *)a; break; case GF_ISOM_BOX_TYPE_SINF: gf_list_add(ptr->protections, a); break; default: return gf_isom_box_add_default(s, a); } return GF_OK; }
0
340,323
static uint64_t megasas_port_read(void *opaque, target_phys_addr_t addr, unsigned size) { return megasas_mmio_read(opaque, addr & 0xff, size); }
0
62,467
static void __sctp_write_space(struct sctp_association *asoc) { struct sock *sk = asoc->base.sk; if (sctp_wspace(asoc) <= 0) return; if (waitqueue_active(&asoc->wait)) wake_up_interruptible(&asoc->wait); if (sctp_writeable(sk)) { struct socket_wq *wq; rcu_read_lock(); wq = rcu_dereference(sk->sk_wq); if (wq) { if (waitqueue_active(&wq->wait)) wake_up_interruptible(&wq->wait); /* Note that we try to include the Async I/O support * here by modeling from the current TCP/UDP code. * We have not tested with it yet. */ if (!(sk->sk_shutdown & SEND_SHUTDOWN)) sock_wake_async(wq, SOCK_WAKE_SPACE, POLL_OUT); } rcu_read_unlock(); } }
0
3,276
static ssize_t _epoll_readv( oe_fd_t* desc, const struct oe_iovec* iov, int iovcnt) { ssize_t ret = -1; epoll_t* file = _cast_epoll(desc); void* buf = NULL; size_t buf_size = 0; if (!file || (iovcnt && !iov) || iovcnt < 0 || iovcnt > OE_IOV_MAX) OE_RAISE_ERRNO(OE_EINVAL); /* Flatten the IO vector into contiguous heap memory. */ if (oe_iov_pack(iov, iovcnt, &buf, &buf_size) != 0) OE_RAISE_ERRNO(OE_ENOMEM); /* Call the host. */ if (oe_syscall_readv_ocall(&ret, file->host_fd, buf, iovcnt, buf_size) != OE_OK) { OE_RAISE_ERRNO(OE_EINVAL); } /* Synchronize data read with IO vector. */ if (oe_iov_sync(iov, iovcnt, buf, buf_size) != 0) OE_RAISE_ERRNO(OE_EINVAL); done: if (buf) oe_free(buf); return ret; }
1
181,585
HTREEITEM TreeView::GetTreeItemForNode(TreeModelNode* node) { NodeDetails* details = GetNodeDetails(node); return details ? details->tree_item : NULL; }
0
189,023
ShelfBackgroundAnimator::~ShelfBackgroundAnimator() { if (wallpaper_controller_) wallpaper_controller_->RemoveObserver(this); if (shelf_) shelf_->RemoveObserver(this); }
0
427,251
thumbnail_failed_path (const char *uri) { char *path, *file; file = thumbnail_filename (uri); /* XXX: appname is only used for failed thumbnails. Is this a mistake? */ path = g_build_filename (g_get_user_cache_dir (), "thumbnails", "fail", appname, file, NULL); g_free (file); return path; }
0
28,667
static struct passwd * current_getpwuid ( void ) { uid_t ruid ; errno = 0 ; ruid = getuid ( ) ; return errno == 0 ? getpwuid ( ruid ) : NULL ; }
0
418,070
bool RGWBulkDelete::Deleter::verify_permission(RGWBucketInfo& binfo, map<string, bufferlist>& battrs, ACLOwner& bucket_owner /* out */) { RGWAccessControlPolicy bacl(store->ctx()); int ret = read_bucket_policy(store, s, binfo, battrs, &bacl, binfo.bucket); if (ret < 0) { return false; } auto policy = get_iam_policy_from_attr(s->cct, store, battrs, binfo.bucket.tenant); bucket_owner = bacl.get_owner(); /* We can use global user_acl because each BulkDelete request is allowed * to work on entities from a single account only. */ return verify_bucket_permission(s, binfo.bucket, s->user_acl.get(), &bacl, policy, rgw::IAM::s3DeleteBucket); }
0
470,722
send_newstyle_option_reply (uint32_t option, uint32_t reply) { GET_CONN; struct nbd_fixed_new_option_reply fixed_new_option_reply; fixed_new_option_reply.magic = htobe64 (NBD_REP_MAGIC); fixed_new_option_reply.option = htobe32 (option); fixed_new_option_reply.reply = htobe32 (reply); fixed_new_option_reply.replylen = htobe32 (0); if (conn->send (&fixed_new_option_reply, sizeof fixed_new_option_reply, 0) == -1) { /* The protocol document says that the client is allowed to simply * drop the connection after sending NBD_OPT_ABORT, or may read * the reply. */ if (option == NBD_OPT_ABORT) debug ("write: %s: %m", name_of_nbd_opt (option)); else nbdkit_error ("write: %s: %m", name_of_nbd_opt (option)); return -1; } return 0; }
0
14,509
int _dbus_printf_string_upper_bound (const char *format, va_list args) { /* MSVCRT's vsnprintf semantics are a bit different */ char buf[1024]; int bufsize; int len; bufsize = sizeof (buf); len = _vsnprintf (buf, bufsize - 1, format, args); while (len == -1) /* try again */ { p = malloc (bufsize); if (p == NULL) return -1; if (p == NULL) return -1; len = _vsnprintf (p, bufsize - 1, format, args); free (p); } * Returns the UTF-16 form of a UTF-8 string. The result should be * freed with dbus_free() when no longer needed. * * @param str the UTF-8 string * @param error return location for error code */ wchar_t * _dbus_win_utf8_to_utf16 (const char *str, DBusError *error) { DBusString s; int n; wchar_t *retval; _dbus_string_init_const (&s, str); if (!_dbus_string_validate_utf8 (&s, 0, _dbus_string_get_length (&s))) { dbus_set_error_const (error, DBUS_ERROR_FAILED, "Invalid UTF-8"); return NULL; } n = MultiByteToWideChar (CP_UTF8, 0, str, -1, NULL, 0); if (n == 0) { _dbus_win_set_error_from_win_error (error, GetLastError ()); return NULL; } retval = dbus_new (wchar_t, n); if (!retval) { _DBUS_SET_OOM (error); return NULL; } if (MultiByteToWideChar (CP_UTF8, 0, str, -1, retval, n) != n) { dbus_free (retval); dbus_set_error_const (error, DBUS_ERROR_FAILED, "MultiByteToWideChar inconsistency"); return NULL; } return retval; } /** * Returns the UTF-8 form of a UTF-16 string. The result should be * freed with dbus_free() when no longer needed. * * @param str the UTF-16 string * @param error return location for error code */ char * _dbus_win_utf16_to_utf8 (const wchar_t *str, DBusError *error) { int n; char *retval; n = WideCharToMultiByte (CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL); if (n == 0) { _dbus_win_set_error_from_win_error (error, GetLastError ()); return NULL; } retval = dbus_malloc (n); if (!retval) { _DBUS_SET_OOM (error); return NULL; } if (WideCharToMultiByte (CP_UTF8, 0, str, -1, retval, n, NULL, NULL) != n) { dbus_free (retval); dbus_set_error_const (error, DBUS_ERROR_FAILED, "WideCharToMultiByte inconsistency"); return NULL; } return retval; } /************************************************************************ ************************************************************************/ dbus_bool_t _dbus_win_account_to_sid (const wchar_t *waccount, void **ppsid, DBusError *error) { dbus_bool_t retval = FALSE; DWORD sid_length, wdomain_length; SID_NAME_USE use; wchar_t *wdomain; *ppsid = NULL; sid_length = 0; wdomain_length = 0; if (!LookupAccountNameW (NULL, waccount, NULL, &sid_length, NULL, &wdomain_length, &use) && GetLastError () != ERROR_INSUFFICIENT_BUFFER) { _dbus_win_set_error_from_win_error (error, GetLastError ()); return FALSE; } *ppsid = dbus_malloc (sid_length); if (!*ppsid) { _DBUS_SET_OOM (error); return FALSE; } wdomain = dbus_new (wchar_t, wdomain_length); if (!wdomain) { _DBUS_SET_OOM (error); goto out1; } if (!LookupAccountNameW (NULL, waccount, (PSID) *ppsid, &sid_length, wdomain, &wdomain_length, &use)) { _dbus_win_set_error_from_win_error (error, GetLastError ()); goto out2; } if (!IsValidSid ((PSID) *ppsid)) { dbus_set_error_const (error, DBUS_ERROR_FAILED, "Invalid SID"); goto out2; } retval = TRUE; out2: dbus_free (wdomain); out1: if (!retval) { dbus_free (*ppsid); *ppsid = NULL; } return retval; } /** @} end of sysdeps-win */
1
337,677
static char *qemu_rbd_array_opts(QDict *options, const char *prefix, int type, Error **errp) { int num_entries; QemuOpts *opts = NULL; QDict *sub_options; const char *host; const char *port; char *str; char *rados_str = NULL; Error *local_err = NULL; int i; assert(type == RBD_MON_HOST); num_entries = qdict_array_entries(options, prefix); if (num_entries < 0) { error_setg(errp, "Parse error on RBD QDict array"); return NULL; } for (i = 0; i < num_entries; i++) { char *strbuf = NULL; const char *value; char *rados_str_tmp; str = g_strdup_printf("%s%d.", prefix, i); qdict_extract_subqdict(options, &sub_options, str); g_free(str); opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, sub_options, &local_err); QDECREF(sub_options); if (local_err) { error_propagate(errp, local_err); g_free(rados_str); rados_str = NULL; goto exit; } if (type == RBD_MON_HOST) { host = qemu_opt_get(opts, "host"); port = qemu_opt_get(opts, "port"); value = host; if (port) { /* check for ipv6 */ if (strchr(host, ':')) { strbuf = g_strdup_printf("[%s]:%s", host, port); } else { strbuf = g_strdup_printf("%s:%s", host, port); } value = strbuf; } else if (strchr(host, ':')) { strbuf = g_strdup_printf("[%s]", host); value = strbuf; } } else { abort(); } /* each iteration in the for loop will build upon the string, and if * rados_str is NULL then it is our first pass */ if (rados_str) { /* separate options with ';', as that is what rados_conf_set() * requires */ rados_str_tmp = rados_str; rados_str = g_strdup_printf("%s;%s", rados_str_tmp, value); g_free(rados_str_tmp); } else { rados_str = g_strdup(value); } g_free(strbuf); qemu_opts_del(opts); opts = NULL; } exit: qemu_opts_del(opts); return rados_str; }
1
24,306
static gpgme_error_t gpgsm_export_ext ( void * engine , const char * pattern [ ] , gpgme_export_mode_t mode , gpgme_data_t keydata , int use_armor ) { engine_gpgsm_t gpgsm = engine ; gpgme_error_t err = 0 ; char * line ; int length = 7 + 1 ; char * linep ; if ( ! gpgsm ) return gpg_error ( GPG_ERR_INV_VALUE ) ; if ( mode ) return gpg_error ( GPG_ERR_NOT_SUPPORTED ) ; if ( pattern && * pattern ) { const char * * pat = pattern ; while ( * pat ) { const char * patlet = * pat ; while ( * patlet ) { length ++ ; if ( * patlet == '%' || * patlet == ' ' || * patlet == '+' ) length += 2 ; patlet ++ ; } pat ++ ; length ++ ; } } line = malloc ( length ) ; if ( ! line ) return gpg_error_from_syserror ( ) ; strcpy ( line , "EXPORT " ) ; linep = & line [ 7 ] ; if ( pattern && * pattern ) { while ( * pattern ) { const char * patlet = * pattern ; while ( * patlet ) { switch ( * patlet ) { case '%' : * ( linep ++ ) = '%' ; * ( linep ++ ) = '2' ; * ( linep ++ ) = '5' ; break ; case ' ' : * ( linep ++ ) = '%' ; * ( linep ++ ) = '2' ; * ( linep ++ ) = '0' ; break ; case '+' : * ( linep ++ ) = '%' ; * ( linep ++ ) = '2' ; * ( linep ++ ) = 'B' ; break ; default : * ( linep ++ ) = * patlet ; break ; } patlet ++ ; } pattern ++ ; if ( * pattern ) * linep ++ = ' ' ; } } * linep = '\0' ; gpgsm -> output_cb . data = keydata ; err = gpgsm_set_fd ( gpgsm , OUTPUT_FD , use_armor ? "--armor" : map_data_enc ( gpgsm -> output_cb . data ) ) ; if ( err ) return err ; gpgsm_clear_fd ( gpgsm , INPUT_FD ) ; gpgsm_clear_fd ( gpgsm , MESSAGE_FD ) ; gpgsm -> inline_data = NULL ; err = start ( gpgsm , line ) ; free ( line ) ; return err ; }
0
16,293
static int parse_CAggregSpec ( tvbuff_t * tvb , int offset , proto_tree * parent_tree , proto_tree * pad_tree , const char * fmt , ... ) { proto_item * item ; proto_tree * tree ; va_list ap ; guint8 type ; guint32 ccAlias , idColumn ; const char * txt ; va_start ( ap , fmt ) ; txt = wmem_strdup_vprintf ( wmem_packet_scope ( ) , fmt , ap ) ; va_end ( ap ) ; tree = proto_tree_add_subtree ( parent_tree , tvb , offset , 0 , ett_CAggregSpec , & item , txt ) ; type = tvb_get_guint8 ( tvb , offset ) ; proto_tree_add_uint ( tree , hf_mswsp_caggregspec_type , tvb , offset , 1 , type ) ; proto_item_append_text ( item , "type: %u" , type ) ; offset += 1 ; offset = parse_padding ( tvb , offset , 4 , pad_tree , "padding" ) ; ccAlias = tvb_get_letohl ( tvb , offset ) ; proto_tree_add_uint ( tree , hf_mswsp_caggregspec_ccalias , tvb , offset , 1 , ccAlias ) ; offset += 4 ; proto_tree_add_item ( tree , hf_mswsp_caggregspec_alias , tvb , offset , 2 * ccAlias , ENC_LITTLE_ENDIAN | ENC_UCS_2 ) ; offset += 2 * ccAlias ; idColumn = tvb_get_letohl ( tvb , offset ) ; proto_tree_add_uint ( tree , hf_mswsp_caggregspec_idcolumn , tvb , offset , 1 , idColumn ) ; offset += 4 ; proto_item_set_end ( item , tvb , offset ) ; return offset ; }
0
58,057
format_NOTE(const struct ofpact_note *a, const struct ofpact_format_params *fp) { ds_put_format(fp->s, "%snote:%s", colors.param, colors.end); format_hex_arg(fp->s, a->data, a->length); }
0
492,709
create_user_authz(authz_full_t *authz, const char *repository, const char *user, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { int i; node_t *root = create_node(NULL, result_pool); construction_context_t *ctx = create_construction_context(scratch_pool); /* Use a separate sub-pool to keep memory usage tight. */ apr_pool_t *subpool = svn_pool_create(scratch_pool); /* Find all ACLs for REPOSITORY. */ apr_array_header_t *acls = apr_array_make(subpool, authz->acls->nelts, sizeof(authz_acl_t *)); for (i = 0; i < authz->acls->nelts; ++i) { const authz_acl_t *acl = &APR_ARRAY_IDX(authz->acls, i, authz_acl_t); if (svn_authz__acl_applies_to_repo(acl, repository)) { /* ACLs in the AUTHZ are sorted by path and repository. * So, if there is a rule for the repo and a global rule for the * same path, we will detect them here. */ if (acls->nelts) { const authz_acl_t *prev_acl = APR_ARRAY_IDX(acls, acls->nelts - 1, const authz_acl_t *); if (svn_authz__compare_paths(&prev_acl->rule, &acl->rule) == 0) { svn_boolean_t global_acl_applies; svn_boolean_t repos_acl_applies; /* Previous ACL is a global rule. */ SVN_ERR_ASSERT_NO_RETURN(!strcmp(prev_acl->rule.repos, AUTHZ_ANY_REPOSITORY)); /* Current ACL is a per-repository rule. */ SVN_ERR_ASSERT_NO_RETURN(strcmp(acl->rule.repos, AUTHZ_ANY_REPOSITORY)); global_acl_applies = svn_authz__get_acl_access(NULL, prev_acl, user, repository); repos_acl_applies = svn_authz__get_acl_access(NULL, acl, user, repository); /* Prefer rules which apply to both this user and this path * over rules which apply only to the path. In cases where * both rules apply to user and path, always prefer the * repository-specific rule. */ if (!global_acl_applies || repos_acl_applies) { apr_array_pop(acls); APR_ARRAY_PUSH(acls, const authz_acl_t *) = acl; } } else APR_ARRAY_PUSH(acls, const authz_acl_t *) = acl; } else APR_ARRAY_PUSH(acls, const authz_acl_t *) = acl; } } /* Filtering and tree construction. */ for (i = 0; i < acls->nelts; ++i) process_acl(ctx, APR_ARRAY_IDX(acls, i, const authz_acl_t *), root, repository, user, result_pool, subpool); /* If there is no relevant rule at the root node, the "no access" default * applies. Give it a SEQUENCE_NUMBER that will never overrule others. */ if (!has_local_rule(&root->rights)) { root->rights.access.sequence_number = 0; root->rights.access.rights = authz_access_none; } /* Trim the tree. * * We can't do pattern comparison, so for most pattern rules we cannot * say that a set of rules "eclipses" / overrides a given other set of * rules for all possible paths. That limits the accuracy of our check * for recursive access in similar ways than for non-pattern rules. * * However, the user expects a rule ending with "**" to eclipse any older * rule in that sub-tree recursively. So, this trim function removes * eclipsed nodes from the tree. */ svn_pool_clear(subpool); trim_tree(root, NO_SEQUENCE_NUMBER, subpool); /* Calculate recursive rights. * * This is a bottom-up calculation of the range of access rights * specified anywhere in the respective sub-tree, including the base * node itself. * * To prevent additional finalization passes, we piggy-back the addition * of the ordering links of the prefix and suffix sub-node rules. */ svn_pool_clear(subpool); finalize_tree(root, &root->rights, subpool); /* Done. */ svn_pool_destroy(subpool); return root; }
0
213,617
void RegistrationManager::TryRegisterId(const invalidation::ObjectId& id, bool is_retry) { DCHECK(CalledOnValidThread()); RegistrationStatusMap::const_iterator it = registration_statuses_.find(id); if (it == registration_statuses_.end()) { DLOG(FATAL) << "TryRegisterId called on " << ObjectIdToString(id) << " which is not in the registration map"; return; } RegistrationStatus* status = it->second; if (!status->enabled) { return; } status->last_registration_attempt = base::Time::Now(); if (is_retry) { DCHECK(!status->last_registration_request.is_null()); status->delay = (status->last_registration_request - status->last_registration_attempt) + status->next_delay; base::TimeDelta delay = (status->delay <= base::TimeDelta()) ? base::TimeDelta() : status->delay; DVLOG(2) << "Registering " << ObjectIdToString(id) << " in " << delay.InMilliseconds() << " ms"; status->registration_timer.Stop(); status->registration_timer.Start(FROM_HERE, delay, status, &RegistrationManager::RegistrationStatus::DoRegister); double next_delay_seconds = CalculateBackoff(static_cast<double>(status->next_delay.InSeconds()), kInitialRegistrationDelaySeconds, kMinRegistrationDelaySeconds, kMaxRegistrationDelaySeconds, kRegistrationDelayExponent, GetJitter(), kRegistrationDelayMaxJitter); status->next_delay = base::TimeDelta::FromSeconds(static_cast<int64>(next_delay_seconds)); DVLOG(2) << "New next delay for " << ObjectIdToString(id) << " is " << status->next_delay.InSeconds() << " seconds"; } else { DVLOG(2) << "Not a retry -- registering " << ObjectIdToString(id) << " immediately"; status->delay = base::TimeDelta(); status->next_delay = base::TimeDelta(); status->DoRegister(); } }
0
522,953
bool LEX::sp_declare_cursor(THD *thd, const LEX_CSTRING *name, sp_lex_cursor *cursor_stmt, sp_pcontext *param_ctx, bool add_cpush_instr) { uint offp; sp_instr_cpush *i; if (spcont->find_cursor(name, &offp, true)) { my_error(ER_SP_DUP_CURS, MYF(0), name->str); return true; } if (unlikely(spcont->add_cursor(name, param_ctx, cursor_stmt))) return true; if (add_cpush_instr) { i= new (thd->mem_root) sp_instr_cpush(sphead->instructions(), spcont, cursor_stmt, spcont->current_cursor_count() - 1); return unlikely(i == NULL) || unlikely(sphead->add_instr(i)); } return false; }
0
198,289
void CSoundFile::InvertLoop(ModChannel *pChn) { if(GetType() != MOD_TYPE_MOD || pChn->nEFxSpeed == 0) return; ModSample *pModSample = const_cast<ModSample *>(pChn->pModSample); if(pModSample == nullptr || !pModSample->HasSampleData() || !pModSample->uFlags[CHN_LOOP] || pModSample->uFlags[CHN_16BIT]) return; pChn->nEFxDelay += ModEFxTable[pChn->nEFxSpeed & 0x0F]; if((pChn->nEFxDelay & 0x80) == 0) return; // only applied if the "delay" reaches 128 pChn->nEFxDelay = 0; if (++pChn->nEFxOffset >= pModSample->nLoopEnd - pModSample->nLoopStart) pChn->nEFxOffset = 0; uint8 &sample = mpt::byte_cast<uint8 *>(pModSample->sampleb())[pModSample->nLoopStart + pChn->nEFxOffset]; sample = ~sample; ctrlSmp::PrecomputeLoops(*pModSample, *this, false); }
0
65,975
void mg_mqtt_publish(struct mg_connection *nc, const char *topic, uint16_t message_id, int flags, const void *data, size_t len) { uint16_t netbytes; uint16_t topic_len = strlen(topic); size_t total_len = 2 + topic_len + len; if (MG_MQTT_GET_QOS(flags) > 0) { total_len += 2; } mg_send_mqtt_header(nc, MG_MQTT_CMD_PUBLISH, flags, total_len); netbytes = htons(topic_len); mg_send(nc, &netbytes, 2); mg_send(nc, topic, topic_len); if (MG_MQTT_GET_QOS(flags) > 0) { netbytes = htons(message_id); mg_send(nc, &netbytes, 2); } mg_send(nc, data, len); }
0
142,228
current_func_returned(void) { return current_funccal->returned; }
0