functionSource
stringlengths
20
97.4k
CWE-119
bool
2 classes
CWE-120
bool
2 classes
CWE-469
bool
2 classes
CWE-476
bool
2 classes
CWE-other
bool
2 classes
combine
int64
0
1
ganv_node_get_draw_properties(const GanvNode* node, double* dash_length, double* border_color, double* fill_color) { GanvNodeImpl* impl = node->impl; *dash_length = impl->dash_length; *border_color = impl->border_color; *fill_color = impl->fill_color; if (impl->selected) { *dash_length = 4.0; *border_color = highlight_color(impl->border_color, 0x20); } if (impl->highlighted) { *border_color = highlight_color(impl->border_color, 0x20); } }
false
false
false
false
false
0
getvalue (srcp) char **srcp; { char *src = *srcp; bfd_vma value = 0; unsigned int len = hex_value(*src++); if (len == 0) len = 16; while (len--) { value = value << 4 | hex_value(*src++); } *srcp = src; return value; }
false
false
false
false
false
0
load_new_zones(ns_server_t *server, isc_boolean_t stop) { isc_result_t result; dns_view_t *view; result = isc_task_beginexclusive(server->task); RUNTIME_CHECK(result == ISC_R_SUCCESS); /* * Load zone data from disk. */ for (view = ISC_LIST_HEAD(server->viewlist); view != NULL; view = ISC_LIST_NEXT(view, link)) { CHECK(dns_view_loadnew(view, stop)); /* Load managed-keys data */ if (view->managed_keys != NULL) CHECK(dns_zone_loadnew(view->managed_keys)); if (view->redirect != NULL) CHECK(dns_zone_loadnew(view->redirect)); } /* * Resume zone XFRs. */ dns_zonemgr_resumexfrs(server->zonemgr); cleanup: isc_task_endexclusive(server->task); return (result); }
false
false
false
false
false
0
znzputc(int c, znzFile file) { if (file==NULL) { return 0; } #ifdef HAVE_ZLIB if (file->zfptr!=NULL) return gzputc(file->zfptr,c); #endif return fputc(c,file->nzfptr); }
false
false
false
false
false
0
handle_teardown_request (GstRTSPClient * client, GstRTSPClientState * state) { GstRTSPSession *session; GstRTSPSessionMedia *media; GstRTSPStatusCode code; if (!state->session) goto no_session; session = state->session; /* get a handle to the configuration of the media in the session */ media = gst_rtsp_session_get_media (session, state->uri); if (!media) goto not_found; state->sessmedia = media; /* unlink the all TCP callbacks */ unlink_session_streams (client, session, media); /* remove the session from the watched sessions */ g_object_weak_unref (G_OBJECT (session), (GWeakNotify) client_session_finalized, client); client->sessions = g_list_remove (client->sessions, session); gst_rtsp_session_media_set_state (media, GST_STATE_NULL); /* unmanage the media in the session, returns false if all media session * are torn down. */ if (!gst_rtsp_session_release_media (session, media)) { /* remove the session */ gst_rtsp_session_pool_remove (client->session_pool, session); } /* construct the response now */ code = GST_RTSP_STS_OK; gst_rtsp_message_init_response (state->response, code, gst_rtsp_status_as_text (code), state->request); gst_rtsp_message_add_header (state->response, GST_RTSP_HDR_CONNECTION, "close"); send_response (client, session, state->response); close_connection (client); return TRUE; /* ERRORS */ no_session: { send_generic_response (client, GST_RTSP_STS_SESSION_NOT_FOUND, state); return FALSE; } not_found: { send_generic_response (client, GST_RTSP_STS_NOT_FOUND, state); return FALSE; } }
false
false
false
false
false
0
Study(int sk, int days) { Skill *s; if(Globals->SKILL_LIMIT_NONLEADERS && !IsLeader()) { if (skills.Num()) { s = (Skill *) skills.First(); if ((s->type != sk) && (s->days > 0)) { Error("STUDY: Can know only 1 skill."); return 0; } } } int max = GetSkillMax(sk); if (GetRealSkill(sk) >= max) { Error("STUDY: Maximum level for skill reached."); return 0; } if (!CanStudy(sk)) { Error("STUDY: Doesn't have the pre-requisite skills to study that."); return 0; } skills.SetDays(sk, skills.GetDays(sk) + days); AdjustSkills(); /* Check to see if we need to show a skill report */ int lvl = GetRealSkill(sk); if (lvl > faction->skills.GetDays(sk)) { faction->skills.SetDays(sk, lvl); faction->shows.Add(new ShowSkill(sk, lvl)); } return 1; }
false
false
false
false
false
0
qla24xx_msix_rsp_q(int irq, void *dev_id) { struct qla_hw_data *ha; struct rsp_que *rsp; struct device_reg_24xx __iomem *reg; struct scsi_qla_host *vha; unsigned long flags; uint32_t stat = 0; rsp = (struct rsp_que *) dev_id; if (!rsp) { ql_log(ql_log_info, NULL, 0x505a, "%s: NULL response queue pointer.\n", __func__); return IRQ_NONE; } ha = rsp->hw; reg = &ha->iobase->isp24; spin_lock_irqsave(&ha->hardware_lock, flags); vha = pci_get_drvdata(ha->pdev); /* * Use host_status register to check to PCI disconnection before we * we process the response queue. */ stat = RD_REG_DWORD(&reg->host_status); if (qla2x00_check_reg32_for_disconnect(vha, stat)) goto out; qla24xx_process_response_queue(vha, rsp); if (!ha->flags.disable_msix_handshake) { WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_INT); RD_REG_DWORD_RELAXED(&reg->hccr); } out: spin_unlock_irqrestore(&ha->hardware_lock, flags); return IRQ_HANDLED; }
false
false
false
false
false
0
addProddableBlock ( ObjectCode* oc, void* start, int size ) { ProddableBlock* pb = stgMallocBytes(sizeof(ProddableBlock), "addProddableBlock"); IF_DEBUG(linker, debugBelch("addProddableBlock: %p %p %d\n", oc, start, size)); ASSERT(size > 0); pb->start = start; pb->size = size; pb->next = oc->proddables; oc->proddables = pb; }
false
false
false
false
false
0
tp_base_connection_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_params) { guint i; TpBaseConnection *self = TP_BASE_CONNECTION ( G_OBJECT_CLASS (tp_base_connection_parent_class)->constructor ( type, n_construct_properties, construct_params)); TpBaseConnectionPrivate *priv = self->priv; TpBaseConnectionClass *cls = TP_BASE_CONNECTION_GET_CLASS (self); g_assert (cls->create_handle_repos != NULL); g_assert (cls->create_channel_factories != NULL || cls->create_channel_managers != NULL); g_assert (cls->shut_down != NULL); g_assert (cls->start_connecting != NULL); /* if we fail to connect to D-Bus here, we'll return an error from * register */ tp_base_connection_ensure_dbus (self, NULL); (cls->create_handle_repos) (self, priv->handles); /* a connection that doesn't support contacts is no use to anyone */ g_assert (priv->handles[TP_HANDLE_TYPE_CONTACT] != NULL); if (cls->create_channel_factories != NULL) priv->channel_factories = cls->create_channel_factories (self); else priv->channel_factories = g_ptr_array_sized_new (0); if (cls->create_channel_managers != NULL) priv->channel_managers = cls->create_channel_managers (self); else priv->channel_managers = g_ptr_array_sized_new (0); for (i = 0; i < priv->channel_factories->len; i++) { GObject *factory = g_ptr_array_index (priv->channel_factories, i); g_signal_connect (factory, "new-channel", G_CALLBACK (factory_new_channel_cb), self); g_signal_connect (factory, "channel-error", G_CALLBACK (factory_channel_error_cb), self); } for (i = 0; i < priv->channel_managers->len; i++) { TpChannelManager *manager = TP_CHANNEL_MANAGER ( g_ptr_array_index (priv->channel_managers, i)); g_signal_connect (manager, "new-channels", (GCallback) manager_new_channels_cb, self); g_signal_connect (manager, "request-already-satisfied", (GCallback) manager_request_already_satisfied_cb, self); g_signal_connect (manager, "request-failed", (GCallback) manager_request_failed_cb, self); g_signal_connect (manager, "channel-closed", (GCallback) manager_channel_closed_cb, self); } tp_base_connection_create_interfaces_array (self); priv->been_constructed = TRUE; return (GObject *) self; }
false
false
false
false
false
0
triton_context_print(void) { struct _triton_context_t *ctx; list_for_each_entry(ctx, &ctx_list, entry) printf("%p\n", ctx); }
false
false
false
false
false
0
libgnac_converter_eos_cb(GstBus *bus, GstMessage *message, gpointer data) { LibgnacConverter *converter = (LibgnacConverter *) data; g_return_if_fail(LIBGNAC_IS_CONVERTER(converter)); LibgnacMediaItem *item = converter->priv->current; gchar *uri = g_file_get_uri(item->source); g_signal_emit(converter, signals[FILE_COMPLETED], 0, uri); g_free(uri); /* Start next file conversion */ if (!libgnac_converter_start_next(converter)) { converter->priv->n_converted = -1; g_signal_emit(converter, signals[COMPLETION], 0); } }
false
false
false
false
false
0
g3d_stream_gsf_close(gpointer data) { G3DStreamGsf *sg = (G3DStreamGsf *)data; g_object_unref(sg->input_subfile); if(sg->infile_msole) g_object_unref(sg->infile_msole); if(sg->infile_zip) g_object_unref(sg->infile_zip); if(sg->uri) g_free(sg->uri); g_object_unref(sg->input_container); g_free(sg); return 0; }
false
false
false
false
false
0
orderModule(const Module &M) { // This needs to match the order used by ValueEnumerator::ValueEnumerator() // and ValueEnumerator::incorporateFunction(). OrderMap OM; // In the reader, initializers of GlobalValues are set *after* all the // globals have been read. Rather than awkwardly modeling this behaviour // directly in predictValueUseListOrderImpl(), just assign IDs to // initializers of GlobalValues before GlobalValues themselves to model this // implicitly. for (const GlobalVariable &G : M.globals()) if (G.hasInitializer()) if (!isa<GlobalValue>(G.getInitializer())) orderValue(G.getInitializer(), OM); for (const GlobalAlias &A : M.aliases()) if (!isa<GlobalValue>(A.getAliasee())) orderValue(A.getAliasee(), OM); for (const Function &F : M) { if (F.hasPrefixData()) if (!isa<GlobalValue>(F.getPrefixData())) orderValue(F.getPrefixData(), OM); if (F.hasPrologueData()) if (!isa<GlobalValue>(F.getPrologueData())) orderValue(F.getPrologueData(), OM); if (F.hasPersonalityFn()) if (!isa<GlobalValue>(F.getPersonalityFn())) orderValue(F.getPersonalityFn(), OM); } OM.LastGlobalConstantID = OM.size(); // Initializers of GlobalValues are processed in // BitcodeReader::ResolveGlobalAndAliasInits(). Match the order there rather // than ValueEnumerator, and match the code in predictValueUseListOrderImpl() // by giving IDs in reverse order. // // Since GlobalValues never reference each other directly (just through // initializers), their relative IDs only matter for determining order of // uses in their initializers. for (const Function &F : M) orderValue(&F, OM); for (const GlobalAlias &A : M.aliases()) orderValue(&A, OM); for (const GlobalVariable &G : M.globals()) orderValue(&G, OM); OM.LastGlobalValueID = OM.size(); for (const Function &F : M) { if (F.isDeclaration()) continue; // Here we need to match the union of ValueEnumerator::incorporateFunction() // and WriteFunction(). Basic blocks are implicitly declared before // anything else (by declaring their size). for (const BasicBlock &BB : F) orderValue(&BB, OM); for (const Argument &A : F.args()) orderValue(&A, OM); for (const BasicBlock &BB : F) for (const Instruction &I : BB) for (const Value *Op : I.operands()) if ((isa<Constant>(*Op) && !isa<GlobalValue>(*Op)) || isa<InlineAsm>(*Op)) orderValue(Op, OM); for (const BasicBlock &BB : F) for (const Instruction &I : BB) orderValue(&I, OM); } return OM; }
false
false
false
false
false
0
Perl_mro_get_linear_isa(pTHX_ HV *stash) { struct mro_meta* meta; AV *isa; PERL_ARGS_ASSERT_MRO_GET_LINEAR_ISA; if(!SvOOK(stash)) Perl_croak(aTHX_ "Can't linearize anonymous symbol table"); meta = HvMROMETA(stash); if (!meta->mro_which) Perl_croak(aTHX_ "panic: invalid MRO!"); isa = meta->mro_which->resolve(aTHX_ stash, 0); if (meta->mro_which != &dfs_alg) { /* skip for dfs, for speed */ SV * const namesv = (HvENAME(stash)||HvNAME(stash)) ? newSVhek(HvENAME_HEK(stash) ? HvENAME_HEK(stash) : HvNAME_HEK(stash)) : NULL; if(namesv && (AvFILLp(isa) == -1 || !sv_eq(*AvARRAY(isa), namesv))) { AV * const old = isa; SV **svp; SV **ovp = AvARRAY(old); SV * const * const oend = ovp + AvFILLp(old) + 1; isa = (AV *)sv_2mortal((SV *)newAV()); av_extend(isa, AvFILLp(isa) = AvFILLp(old)+1); *AvARRAY(isa) = namesv; svp = AvARRAY(isa)+1; while (ovp < oend) *svp++ = SvREFCNT_inc(*ovp++); } else SvREFCNT_dec(namesv); } if (!meta->isa) { HV *const isa_hash = newHV(); /* Linearisation didn't build it for us, so do it here. */ SV *const *svp = AvARRAY(isa); SV *const *const svp_end = svp + AvFILLp(isa) + 1; const HEK *canon_name = HvENAME_HEK(stash); if (!canon_name) canon_name = HvNAME_HEK(stash); while (svp < svp_end) { (void) hv_store_ent(isa_hash, *svp++, &PL_sv_undef, 0); } (void) hv_common(isa_hash, NULL, HEK_KEY(canon_name), HEK_LEN(canon_name), HEK_FLAGS(canon_name), HV_FETCH_ISSTORE, &PL_sv_undef, HEK_HASH(canon_name)); (void) hv_store(isa_hash, "UNIVERSAL", 9, &PL_sv_undef, 0); SvREADONLY_on(isa_hash); meta->isa = isa_hash; } return isa; }
false
false
false
true
false
1
abraca_client_set_current_playback_status (AbracaClient* self, gint value) { gint _tmp0_; g_return_if_fail (self != NULL); _tmp0_ = value; self->priv->_current_playback_status = _tmp0_; g_object_notify ((GObject *) self, "current-playback-status"); }
false
false
false
false
false
0
dupe_match_unlink_child(DupeItem *child, DupeItem *parent) { DupeMatch *dm; dm = dupe_match_find_match(child, parent); if (dm) { parent->group = g_list_remove(parent->group, dm); g_free(dm); } }
false
false
false
false
false
0
CopyObjComObj ( Obj obj, Int mut ) { Obj copy; /* copy, result */ Obj tmp; /* temporary variable */ UInt i; /* loop variable */ /* don't change immutable objects */ if ( ! IS_MUTABLE_OBJ(obj) ) { return obj; } /* if the object is not copyable return */ if ( ! IS_COPYABLE_OBJ(obj) ) { ErrorQuit("Panic: encountered mutable, non-copyable object",0L,0L); return obj; } /* make a copy */ if ( mut ) { copy = NewBag( TNUM_OBJ(obj), SIZE_OBJ(obj) ); ADDR_OBJ(copy)[0] = ADDR_OBJ(obj)[0]; SET_LEN_PREC(copy,LEN_PREC(obj)); } else { copy = NewBag( TNUM_OBJ(obj), SIZE_OBJ(obj) ); ADDR_OBJ(copy)[0] = ADDR_OBJ(obj)[0]; SET_LEN_PREC(copy,LEN_PREC(obj)); CALL_2ARGS( RESET_FILTER_OBJ, copy, IsMutableObjFilt ); } /* leave a forwarding pointer */ tmp = NEW_PLIST( T_PLIST, 2 ); SET_LEN_PLIST( tmp, 2 ); SET_ELM_PLIST( tmp, 1, ADDR_OBJ(obj)[0] ); SET_ELM_PLIST( tmp, 2, copy ); ADDR_OBJ(obj)[0] = tmp; CHANGED_BAG(obj); /* now it is copied */ RetypeBag( obj, TNUM_OBJ(obj) + COPYING ); /* copy the subvalues */ for ( i = 1; i <= LEN_PREC(obj); i++) { SET_RNAM_PREC(copy,i,GET_RNAM_PREC(obj,i)); tmp = COPY_OBJ( GET_ELM_PREC(obj,i), mut ); SET_ELM_PREC(copy,i,tmp); CHANGED_BAG( copy ); } /* return the copy */ return copy; }
false
false
false
false
false
0
tryModelGeneration() { if (!d_theoryCore->incomplete()) throw Exception("Model generation should be called only after an UNKNOWN result"); QueryResult qres = UNKNOWN; int scopeLevel = d_cm->scopeLevel(); try { while (qres == UNKNOWN) { Theorem thm; d_se->push(); // Try to generate the model if (d_se->tryModelGeneration(thm)) // If success, we are satisfiable qres = INVALID; else { // Generate the clause to get rid of the faults vector<Expr> assumptions; thm.getLeafAssumptions(assumptions, true /*negate*/); if (!thm.getExpr().isFalse()) assumptions.push_back(thm.getExpr()); // Pop back to where we were while (d_cm->scopeLevel() > scopeLevel) d_se->pop(); // Restart with the new clause qres = restart(orExpr(assumptions)); // Keep this level scopeLevel = d_cm->scopeLevel(); } } } catch (Exception& e) { // Pop back to where we were while (d_cm->scopeLevel() > scopeLevel) d_se->pop(); } return qres; }
false
false
false
false
false
0
python_timers(script_t *scr, script_timer_t *time, int type) { int python_handle_result; PyObject *obj = (PyObject *)time->priv_data; PYTHON_HANDLE_HEADER(obj, Py_BuildValue("()")) PYTHON_HANDLE_FOOTER() return python_handle_result; }
false
false
false
false
false
0
smiapp_validate_csi_data_format(struct smiapp_sensor *sensor, u32 code) { const struct smiapp_csi_data_format *csi_format = sensor->csi_format; unsigned int i; for (i = 0; i < ARRAY_SIZE(smiapp_csi_data_formats); i++) { if (sensor->mbus_frame_fmts & (1 << i) && smiapp_csi_data_formats[i].code == code) return &smiapp_csi_data_formats[i]; } return csi_format; }
false
false
false
false
false
0
strip_path_suffix(const char *path, const char *suffix) { int path_len = strlen(path), suffix_len = strlen(suffix); while (suffix_len) { if (!path_len) return NULL; if (is_dir_sep(path[path_len - 1])) { if (!is_dir_sep(suffix[suffix_len - 1])) return NULL; path_len = chomp_trailing_dir_sep(path, path_len); suffix_len = chomp_trailing_dir_sep(suffix, suffix_len); } else if (path[--path_len] != suffix[--suffix_len]) return NULL; } if (path_len && !is_dir_sep(path[path_len - 1])) return NULL; return xstrndup(path, chomp_trailing_dir_sep(path, path_len)); }
false
false
false
false
false
0
Start() { if(_running) { return; } qDebug() << "Proxy exit started"; _running = true; }
false
false
false
false
false
0
minimize_using_gradient(vnl_vector<double>& x) { //fsm if (! f_->has_gradient()) { std::cerr << __FILE__ ": called method minimize_using_gradient(), but f_ has no gradient.\n"; return false; } long m = f_->get_number_of_residuals(); // I Number of residuals, must be > #unknowns long n = f_->get_number_of_unknowns(); // I Number of unknowns if (m < n) { std::cerr << __FILE__ ": Number of unknowns("<<n<<") greater than number of data ("<<m<<")\n"; failure_code_ = ERROR_DODGY_INPUT; return false; } vnl_vector<double> fx(m, 0.0); // W m Explicitly set target to 0.0 num_iterations_ = 0; set_covariance_ = false; long info; start_error_ = 0; // Set to 0 so first call to lmder_lsqfun will know to set it. double factor = 100; long nprint = 1; long mode=1, nfev, njev; vnl_vector<double> diag(n, 0); vnl_vector<double> qtf(n, 0); vnl_vector<double> wa1(n, 0); vnl_vector<double> wa2(n, 0); vnl_vector<double> wa3(n, 0); vnl_vector<double> wa4(m, 0); v3p_netlib_lmder_( lmder_lsqfun, &m, &n, x.data_block(), fx.data_block(), fdjac_.data_block(), &m, &ftol, &xtol, &gtol, &maxfev, diag.data_block(), &mode, &factor, &nprint, &info, &nfev, &njev, ipvt_.data_block(), qtf.data_block(), wa1.data_block(), wa2.data_block(), wa3.data_block(), wa4.data_block(), this); num_evaluations_ = num_iterations_; // for lmder, these are the same. if (info<0) info = ERROR_FAILURE; failure_code_ = (ReturnCodes) info; end_error_ = fx.rms(); // Translate status code switch (failure_code_) { case 1: // ftol case 2: // xtol case 3: // both case 4: // gtol return true; default: return false; } }
false
false
false
false
false
0
ReSize(int pnrows, int pncols) { nrows = pnrows; ncols = pncols; data.clear(); data.resize(nrows); }
false
false
false
false
false
0
on_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer user_data) { static int x = 1; MainWindow *self = (MainWindow *)user_data; self->_expose = true; if (x) { x = 0; self->attach_remote_listener(); Status::instance()->addStatusListener(self); string greeting("KCemu v" KCEMU_VERSION " ("); greeting += Preferences::instance()->get_kc_variant_name(); greeting += ")"; Status::instance()->setMessage(greeting.c_str()); } return FALSE; /* propagate event */ }
false
false
false
false
false
0
opal_datatype_create( int32_t expectedSize ) { opal_datatype_t* datatype = (opal_datatype_t*)OBJ_NEW(opal_datatype_t); if( expectedSize == -1 ) expectedSize = DT_INCREASE_STACK; datatype->desc.length = expectedSize + 1; /* one for the fake elem at the end */ datatype->desc.used = 0; datatype->desc.desc = (dt_elem_desc_t*)calloc(datatype->desc.length, sizeof(dt_elem_desc_t)); /* BEWARE: an upper-layer configured with OPAL_MAX_OBJECT_NAME different than the OPAL-layer will not work! */ memset( datatype->name, 0, OPAL_MAX_OBJECT_NAME ); return datatype; }
false
false
false
false
false
0
httpd_run(void) { struct timeval timeout; conndata_t *conn; herror_t err; fd_set fds; log_verbose1("starting run routine"); #ifndef WIN32 sigemptyset(&thrsigset); sigaddset(&thrsigset, SIGALRM); #endif _httpd_register_signal_handler(); if ((err = hsocket_listen(&_httpd_socket)) != H_OK) { log_error2("hsocket_listen failed (%s)", herror_message(err)); return err; } while (_httpd_run) { conn = _httpd_wait_for_empty_conn(); if (!_httpd_run) break; /* Wait for a socket to accept */ while (_httpd_run) { /* set struct timeval to the proper timeout */ timeout.tv_sec = 1; timeout.tv_usec = 0; /* zero and set file descriptior */ FD_ZERO(&fds); FD_SET(_httpd_socket.sock, &fds); /* select socket descriptor */ switch (select(_httpd_socket.sock + 1, &fds, NULL, NULL, &timeout)) { case 0: /* descriptor is not ready */ continue; case -1: /* got a signal? */ continue; default: /* no nothing */ break; } if (FD_ISSET(_httpd_socket.sock, &fds)) { break; } } /* check signal status */ if (!_httpd_run) break; if ((err = hsocket_accept(&_httpd_socket, &(conn->sock))) != H_OK) { log_error2("hsocket_accept failed (%s)", herror_message(err)); hsocket_close(&(conn->sock)); continue; } _httpd_start_thread(conn); } return 0; }
false
false
false
false
false
0
get_cif_file_type(cfile) /* Return the code for the structure name. Skip to the first DS command, * and look at the following line. * * a Stanford: A Stanford symbol name follows a DS command as in (PadIn); * b NCA: An NCA symbol name follows a DS command as in (PadIn); * h IGS: A KIC or IGS symbol name follows a DS command as in 9 PadIn; * k KIC: A KIC or IGS symbol name follows a DS command as in 9 PadIn; * i Icarus: An Icarus symbol name follows a DS command as in (9 PadIn); * q Squid: A Squid symbol name follows a DS command as in 9 /usr/joe/PadIn; * s Sif: A Sif symbol name follows a DS command as in (Name: PadIn); * n none of the above */ FILE *cfile; { int c; if (cfile == NULL) return ('n'); while ((c = getc(cfile)) != EOF) { if (isspace(c)) continue; if (c != 'D') { while (((c = getc(cfile)) != EOF) && (c != ';')) ; continue; } if ((c = getc(cfile)) == EOF) return ('n'); if (c != 'S') { while (((c = getc(cfile)) != EOF) && (c != ';')) ; continue; } /* found a DS command, skip to ; */ while (((c = getc(cfile)) != EOF) && (c != ';')) ; if (c == EOF) return ('n'); while ((c = getc(cfile)) != EOF) { if (isspace(c)) continue; if (c == '(') { /* a comment line */ while ((c = getc(cfile)) != EOF) if (isspace(c)) continue; if (c == EOF) return ('n'); if (c == '9') /* Icarus */ return ('i'); while ((c = getc(cfile)) != EOF) { if (isspace(c)) continue; if (c == ':') /* Sif */ return ('s'); if (c == ';') /* Stanford/NCA */ return ('a'); } return ('n'); } else if (c == '9') { /* user extension line */ while ((c = getc(cfile)) != EOF) { if (isspace(c)) continue; if (c == '/') /* Squid */ return ('q'); if (c == ';') /* IGS/KIC */ return ('k'); } return ('n'); } else return ('n'); } } return ('n'); }
false
false
false
false
false
0
smart_text(AW_world& selected_range, AW_device *device, int gc, const char *str,AW_pos x,AW_pos y, AW_pos alignment, AW_bitset filteri, AW_CL cd1, AW_CL cd2,long opt_strlen) { int res = device->text(gc, str, x, y, alignment, filteri, cd1, cd2, opt_strlen); if (gc == GEN_GC_CURSOR) { #if defined(DEVEL_RALF) #warning implementation missing #endif // DEVEL_RALF // @@@ FIXME: detect text size and increase_selected_range } return res; }
false
false
false
false
false
0
CL_ClearTEnts (void) { int i; memset (cl_beams, 0, sizeof(cl_beams)); memset (cl_explosions, 0, sizeof(cl_explosions)); memset (cl_lasers, 0, sizeof(cl_lasers)); // link explosions cl_free_expl = cl_explosions; cl_explosions_headnode.prev = &cl_explosions_headnode; cl_explosions_headnode.next = &cl_explosions_headnode; for ( i = 0; i < MAX_EXPLOSIONS - 1; i++ ) { cl_explosions[i].next = &cl_explosions[i+1]; } //ROGUE memset (cl_playerbeams, 0, sizeof(cl_playerbeams)); memset (cl_sustains, 0, sizeof(cl_sustains)); //ROGUE }
false
false
false
false
false
0
bio_csum(struct bio *bio, struct bkey *k) { struct bio_vec bv; struct bvec_iter iter; uint64_t csum = 0; bio_for_each_segment(bv, bio, iter) { void *d = kmap(bv.bv_page) + bv.bv_offset; csum = bch_crc64_update(csum, d, bv.bv_len); kunmap(bv.bv_page); } k->ptr[KEY_PTRS(k)] = csum & (~0ULL >> 1); }
false
false
false
false
false
0
document_scintilla_modify_current_line_marker(Document_Scintilla *doc) { g_return_if_fail(doc); Document_ScintillaDetails *docdet = DOCUMENT_SCINTILLA_GET_PRIVATE(doc); guint current_pos; guint current_line; current_pos = gtk_scintilla_get_current_pos(GTK_SCINTILLA(docdet->scintilla)); current_line = gtk_scintilla_line_from_position(GTK_SCINTILLA(docdet->scintilla), current_pos); document_scintilla_marker_modify(doc, current_line); }
false
false
false
false
false
0
bcma_chipco_watchdog_register(struct bcma_drv_cc *cc) { struct bcm47xx_wdt wdt = {}; struct platform_device *pdev; wdt.driver_data = cc; wdt.timer_set = bcma_chipco_watchdog_timer_set_wdt; wdt.timer_set_ms = bcma_chipco_watchdog_timer_set_ms_wdt; wdt.max_timer_ms = bcma_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms; pdev = platform_device_register_data(NULL, "bcm47xx-wdt", cc->core->bus->num, &wdt, sizeof(wdt)); if (IS_ERR(pdev)) return PTR_ERR(pdev); cc->watchdog = pdev; return 0; }
false
false
false
false
false
0
jv_get_refcnt(jv j) { switch (jv_get_kind(j)) { case JV_KIND_ARRAY: case JV_KIND_STRING: case JV_KIND_OBJECT: return j.u.ptr->count; default: return 1; } }
false
false
false
false
false
0
WXMPUtils_ComposeArrayItemPath_1 ( XMP_StringPtr schemaNS, XMP_StringPtr arrayName, XMP_Index itemIndex, void * itemPath, SetClientStringProc SetClientString, WXMP_Result * wResult ) { XMP_ENTER_Static ( "WXMPUtils_ComposeArrayItemPath_1" ) if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema ); if ( (arrayName == 0) || (*arrayName == 0) ) XMP_Throw ( "Empty array name", kXMPErr_BadXPath ); XMP_VarString localStr; XMPUtils::ComposeArrayItemPath ( schemaNS, arrayName, itemIndex, &localStr ); if ( itemPath != 0 ) (*SetClientString) ( itemPath, localStr.c_str(), localStr.size() ); XMP_EXIT }
false
false
false
false
false
0
write_targetSpinLock(int action, u_char * var_val, u_char var_val_type, size_t var_val_len, u_char * statP, oid * name, size_t name_len) { if (action == RESERVE1) { if (var_val_type != ASN_INTEGER) { return SNMP_ERR_WRONGTYPE; } if (var_val_len != sizeof(unsigned long)) { return SNMP_ERR_WRONGLENGTH; } if (*((unsigned long *) var_val) != snmpTargetSpinLock) { return SNMP_ERR_INCONSISTENTVALUE; } } else if (action == COMMIT) { if (snmpTargetSpinLock == 2147483647) { snmpTargetSpinLock = 0; } else { snmpTargetSpinLock++; } } return SNMP_ERR_NOERROR; }
false
false
false
false
false
0
strio_reopen(int argc, VALUE *argv, VALUE self) { rb_io_taint_check(self); if (argc == 1 && TYPE(*argv) != T_STRING) { return strio_copy(self, *argv); } strio_init(argc, argv, StringIO(self)); return self; }
false
false
false
false
false
0
typeToString(ScriptType type) { switch (type) { case CheckValidityOfAlert: return QApplication::translate("Alert::AlertScript", "Check alert validity"); case CyclingStartDate: return QApplication::translate("Alert::AlertScript", "Compute cycling starting date"); case OnAboutToShow: return QApplication::translate("Alert::AlertScript", "About to show alert"); case DuringAlert: return QApplication::translate("Alert::AlertScript", "During the alert presentation"); case OnAboutToValidate: return QApplication::translate("Alert::AlertScript", "About to validate the alert"); case OnAboutToOverride: return QApplication::translate("Alert::AlertScript", "On alert about to be overridden"); case OnOverridden: return QApplication::translate("Alert::AlertScript", "On alert overridden"); case OnPatientAboutToChange: return QApplication::translate("Alert::AlertScript", "On patient about to change"); case OnUserAboutToChange: return QApplication::translate("Alert::AlertScript", "On user about to change"); case OnEpisodeAboutToSave: return QApplication::translate("Alert::AlertScript", "On episode about to save"); case OnEpisodeLoaded: return QApplication::translate("Alert::AlertScript", "On episode loaded"); case OnRemindLater: return QApplication::translate("Alert::AlertScript", "On remind later requested"); } return QString::null; }
false
false
false
false
false
0
gamgi_engine_link_plane_assembly (gamgi_plane *plane, gamgi_assembly *assembly) { gamgi_dlist *dlist; /********************************* * add new member to parent list * *********************************/ dlist = gamgi_engine_dlist_add_end (assembly->plane_end); assembly->plane_end = dlist; if (dlist->before == NULL) assembly->plane_start = dlist; /********************************************** * cross information between parent and child * **********************************************/ dlist->data = plane; plane->object.dlist = dlist; plane->object.object = GAMGI_CAST_OBJECT assembly; }
false
false
false
false
false
0
ajMartAttachMartquery(AjPSeqin seqin, AjPMartquery mq) { AjPQuery qry = NULL; if(!seqin) return; qry = seqin->Input->Query; if(!qry) return; qry->QryData = (void *) mq; return; }
false
false
false
false
false
0
isValidUnquotedName(StringRef Name) const { if (Name.empty()) return false; // If any of the characters in the string is an unacceptable character, force // quotes. for (char C : Name) { if (!isAcceptableChar(C)) return false; } return true; }
false
false
false
false
false
0
updateState( const QPaintEngineState &state ) { if ( state.state() & QPaintEngine::DirtyPen ) { d_pen = state.pen(); } if ( state.state() & QPaintEngine::DirtyBrush ) { d_brush = state.brush(); } if ( state.state() & QPaintEngine::DirtyBrushOrigin ) { d_origin = state.brushOrigin(); } }
false
false
false
false
false
0
AddFeature(const StringRef String, bool IsEnabled) { // Don't add empty features if (!String.empty()) { // Convert to lowercase, prepend flag and add to vector Features.push_back(PrependFlag(LowercaseString(String), IsEnabled)); } }
false
false
false
false
false
0
md5_result(md_context *ctx, uchar digest[MD5_DIGEST_LEN]) { uint32 last, padn; uint32 high, low; uchar msglen[8]; high = (ctx->totalN >> 29) | (ctx->totalN2 << 3); low = (ctx->totalN << 3); SIVALu(msglen, 0, low); SIVALu(msglen, 4, high); last = ctx->totalN & 0x3F; padn = last < 56 ? 56 - last : 120 - last; md5_update(ctx, md5_padding, padn); md5_update(ctx, msglen, 8); SIVALu(digest, 0, ctx->A); SIVALu(digest, 4, ctx->B); SIVALu(digest, 8, ctx->C); SIVALu(digest, 12, ctx->D); }
false
false
false
false
true
1
save(CL_OutputSource *output, bool delete_output, bool insert_whitespace) { CL_XMLWriter writer(output, delete_output); writer.set_insert_whitespace(insert_whitespace); std::stack<CL_DomNode> node_stack; CL_DomNode cur_node = get_first_child(); while (!cur_node.is_null()) { // Create opening node: CL_XMLTokenSave opening_node; opening_node.set_type((CL_XMLToken::TokenType) cur_node.get_node_type()); opening_node.set_variant(cur_node.has_child_nodes() ? CL_XMLToken::BEGIN : CL_XMLToken::SINGLE); opening_node.set_name(cur_node.get_node_name()); opening_node.set_value(cur_node.get_node_value()); if (cur_node.is_element()) { for (int i = 0; i < cur_node.impl->attributes.get_length(); ++i) { opening_node.set_attribute(cur_node.impl->attributes.item(i).to_attr().get_name(), cur_node.impl->attributes.item(i).to_attr().get_value()); } } writer.write(opening_node); // Create any possible child nodes: if (cur_node.has_child_nodes()) { node_stack.push(cur_node); cur_node = cur_node.get_first_child(); continue; } // Create closing nodes until we reach next opening node in tree: while (true) { if (cur_node.has_child_nodes()) { CL_XMLTokenSave closing_node; closing_node.set_type((CL_XMLToken::TokenType) cur_node.get_node_type()); closing_node.set_name(cur_node.get_node_name()); closing_node.set_variant(CL_XMLToken::END); writer.write(closing_node); } cur_node = cur_node.get_next_sibling(); if (!cur_node.is_null()) break; if (node_stack.empty()) break; cur_node = node_stack.top(); node_stack.pop(); } } }
false
false
false
false
false
0
listExecute(list_ *r, listExecute_ f, void *private) { listNode_ *ptr; ReturnErrIf(r == NULL); ReturnErrIf(f == NULL); ReturnErrIf(listLock(r)); for(ptr = r->head; ptr != NULL; ptr = ptr->next) { ReturnErrIf(f(ptr->data, private)); } ReturnErrIf(listUnlock(r)); return 0; }
false
false
false
false
false
0
HandleGMTicketSystemStatusOpcode(WorldPacket& /*recv_data*/) { WorldPacket data(SMSG_GMTICKET_SYSTEMSTATUS, 4); //Handled by using .ticket system_on/off data << uint32(sTicketMgr.WillAcceptTickets() ? 1 : 0); SendPacket(&data); }
false
false
false
false
false
0
mprGrowBuf(MprBuf *bp, ssize need) { char *newbuf; ssize growBy; if (bp->maxsize > 0 && bp->buflen >= bp->maxsize) { return MPR_ERR_TOO_MANY; } if (bp->start > bp->end) { mprCompactBuf(bp); } if (need > 0) { growBy = max(bp->growBy, need); } else { growBy = bp->growBy; } if ((newbuf = mprAlloc(bp->buflen + growBy)) == 0) { mprAssert(!MPR_ERR_MEMORY); return MPR_ERR_MEMORY; } if (bp->data) { memcpy(newbuf, bp->data, bp->buflen); } bp->buflen += growBy; bp->end = newbuf + (bp->end - bp->data); bp->start = newbuf + (bp->start - bp->data); bp->data = newbuf; bp->endbuf = &bp->data[bp->buflen]; /* Increase growBy to reduce overhead */ if (bp->maxsize > 0) { if ((bp->buflen + (bp->growBy * 2)) > bp->maxsize) { bp->growBy = min(bp->maxsize - bp->buflen, bp->growBy * 2); } } else { if ((bp->buflen + (bp->growBy * 2)) > bp->maxsize) { bp->growBy = min(bp->buflen, bp->growBy * 2); } } return 0; }
false
true
false
false
false
1
create(){ FXWindow::create(); #ifndef WIN32 unsigned long n,i; Atom type,*list; int format; if(XGetWindowProperty(DISPLAY(getApp()),XDefaultRootWindow(DISPLAY(getApp())),getApp()->wmNetSupported,0,2048,False,XA_ATOM,&type,&format,&n,&i,(unsigned char**)&list)==Success && list){ for(i=0; i<n; i++){ if(list[i]==getApp()->wmNetMoveResize){ ewmh=1; break; } } XFree(list); } #endif }
false
false
false
false
false
0
toshiba_haps_reset_protection(acpi_handle handle) { acpi_status status; status = acpi_evaluate_object(handle, "RSSS", NULL, NULL); if (ACPI_FAILURE(status)) { pr_err("Unable to reset the HDD protection\n"); return -EIO; } return 0; }
false
false
false
false
false
0
createCDATASection( const DOMString &data ) { if (!impl) { return 0; } int exceptioncode = 0; CDATASectionImpl *d = ((DocumentImpl *)impl)->createCDATASection(data.implementation(), exceptioncode); if (exceptioncode) { throw DOMException(exceptioncode); } return d; }
false
false
false
false
false
0
tonga_populate_single_firmware_entry(struct pp_smumgr *smumgr, uint16_t firmware_type, struct SMU_Entry *pentry) { int result; struct cgs_firmware_info info = {0}; result = cgs_get_firmware_info( smumgr->device, tonga_convert_fw_type_to_cgs(firmware_type), &info); if (result == 0) { pentry->version = 0; pentry->id = (uint16_t)firmware_type; pentry->image_addr_high = smu_upper_32_bits(info.mc_addr); pentry->image_addr_low = smu_lower_32_bits(info.mc_addr); pentry->meta_data_addr_high = 0; pentry->meta_data_addr_low = 0; pentry->data_size_byte = info.image_size; pentry->num_register_entries = 0; if (firmware_type == UCODE_ID_RLC_G) pentry->flags = 1; else pentry->flags = 0; } else { return result; } return result; }
false
false
false
false
false
0
clr_fl(int fd, int flags) { int val; if ((val = fcntl(fd, F_GETFL, 0)) < 0) perror("fcntl F_GETFL error"); val &= ~flags; // turn flags off if (fcntl(fd, F_SETFL, val) < 0) perror("fcntl F_SETFL error"); }
false
false
false
false
false
0
key_file_use (CamelKeyFile *bs) { CamelKeyFile *bf; gint err, fd; const gchar *flag; GList *link; /* We want to: * remove file from active list * lock it * * Then when done: * unlock it * add it back to end of active list */ /* TODO: Check header on reset? */ CAMEL_KEY_FILE_LOCK (bs, lock); if (bs->fp != NULL) return 0; else if (bs->priv->deleted) { CAMEL_KEY_FILE_UNLOCK (bs, lock); errno = ENOENT; return -1; } else { d (printf ("Turning key file online: '%s'\n", bs->path)); } if ((bs->flags & O_ACCMODE) == O_RDONLY) flag = "rb"; else flag = "a+b"; if ((fd = g_open (bs->path, bs->flags | O_BINARY, 0600)) == -1 || (bs->fp = fdopen (fd, flag)) == NULL) { err = errno; if (fd != -1) close (fd); CAMEL_KEY_FILE_UNLOCK (bs, lock); errno = err; return -1; } LOCK (key_file_lock); link = g_queue_find (&key_file_list, bs->priv); if (link != NULL) { g_queue_unlink (&key_file_list, link); g_queue_push_tail_link (&key_file_active_list, link); } key_file_count++; link = g_queue_peek_head_link (&key_file_list); while (link != NULL && key_file_count > key_file_threshhold) { struct _CamelKeyFilePrivate *nw = link->data; /* We never hit the current keyfile here, as its removed from the list first */ bf = nw->base; if (bf->fp != NULL) { /* Need to trylock, as any of these lock levels might be trying * to lock the key_file_lock, so we need to check and abort if so */ if (CAMEL_BLOCK_FILE_TRYLOCK (bf, lock)) { d (printf ("Turning key file offline: %s\n", bf->path)); fclose (bf->fp); bf->fp = NULL; key_file_count--; CAMEL_BLOCK_FILE_UNLOCK (bf, lock); } } link = g_list_next (link); } UNLOCK (key_file_lock); return 0; }
false
false
false
false
false
0
init_ic_make_global_vars (void) { tree gcov_type_ptr; ptr_void = build_pointer_type (void_type_node); ic_void_ptr_var = build_decl (UNKNOWN_LOCATION, VAR_DECL, get_identifier ("__gcov_indirect_call_callee"), ptr_void); TREE_STATIC (ic_void_ptr_var) = 1; TREE_PUBLIC (ic_void_ptr_var) = 0; DECL_ARTIFICIAL (ic_void_ptr_var) = 1; DECL_INITIAL (ic_void_ptr_var) = NULL; if (targetm.have_tls) DECL_TLS_MODEL (ic_void_ptr_var) = decl_default_tls_model (ic_void_ptr_var); varpool_finalize_decl (ic_void_ptr_var); gcov_type_ptr = build_pointer_type (get_gcov_type ()); ic_gcov_type_ptr_var = build_decl (UNKNOWN_LOCATION, VAR_DECL, get_identifier ("__gcov_indirect_call_counters"), gcov_type_ptr); TREE_STATIC (ic_gcov_type_ptr_var) = 1; TREE_PUBLIC (ic_gcov_type_ptr_var) = 0; DECL_ARTIFICIAL (ic_gcov_type_ptr_var) = 1; DECL_INITIAL (ic_gcov_type_ptr_var) = NULL; if (targetm.have_tls) DECL_TLS_MODEL (ic_gcov_type_ptr_var) = decl_default_tls_model (ic_gcov_type_ptr_var); varpool_finalize_decl (ic_gcov_type_ptr_var); }
false
false
false
false
false
0
restore_action_replay (uae_u8 *src) { uae_u32 crc32; TCHAR *s; action_replay_unload (1); restore_u8 (); armodel = restore_u8 (); if (!armodel) return src; crc32 = restore_u32 (); s = restore_string (); _tcsncpy (changed_prefs.cartfile, s, 255); _tcscpy (currprefs.cartfile, changed_prefs.cartfile); xfree (s); action_replay_load (); if (restore_u32 () != arrom_size) return src; if (restore_u32 () != arram_size) return src; if (armemory_ram) memcpy (armemory_ram, src, arram_size); src += arram_size; restore_u32 (); memcpy (ar_custom, src, sizeof ar_custom); src += sizeof ar_custom; restore_u32 (); src += sizeof ar_ciaa; restore_u32 (); src += sizeof ar_ciab; action_replay_flag = ACTION_REPLAY_IDLE; if (is_ar_pc_in_rom ()) action_replay_flag = ACTION_REPLAY_ACTIVE; return src; }
false
false
false
false
false
0
abitset_xor_cmp (bitset dst, bitset src1, bitset src2) { bitset_windex i; bool changed = false; bitset_word *src1p = ABITSET_WORDS (src1); bitset_word *src2p = ABITSET_WORDS (src2); bitset_word *dstp = ABITSET_WORDS (dst); bitset_windex size = dst->b.csize; for (i = 0; i < size; i++, dstp++) { bitset_word tmp = *src1p++ ^ *src2p++; if (*dstp != tmp) { changed = true; *dstp = tmp; } } return changed; }
false
false
false
false
true
1
PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os,indent); os << indent << "PixelTolerance: " << this->PixelTolerance << endl; os << indent << "ViewPort: "; if( this->Viewport ) { this->Viewport->PrintSelf( os << endl, indent.GetNextIndent()); } else { os << "(none)" << endl; } }
false
false
false
false
false
0
init_remote_listener(int port, gboolean encrypted) { int rc; int *ssock = NULL; struct sockaddr_in saddr; int optval; static struct mainloop_fd_callbacks remote_listen_fd_callbacks = { .dispatch = cib_remote_listen, .destroy = remote_connection_destroy, }; if (port <= 0) { /* dont start it */ return 0; } if (encrypted) { #ifndef HAVE_GNUTLS_GNUTLS_H crm_warn("TLS support is not available"); return 0; #else crm_notice("Starting a tls listener on port %d.", port); gnutls_global_init(); /* gnutls_global_set_log_level (10); */ gnutls_global_set_log_function(debug_log); gnutls_dh_params_init(&dh_params); gnutls_dh_params_generate2(dh_params, DH_BITS); gnutls_anon_allocate_server_credentials(&anon_cred_s); gnutls_anon_set_server_dh_params(anon_cred_s, dh_params); #endif } else { crm_warn("Starting a plain_text listener on port %d.", port); } #ifndef HAVE_PAM crm_warn("PAM is _not_ enabled!"); #endif /* create server socket */ ssock = malloc(sizeof(int)); if(ssock == NULL) { crm_perror(LOG_ERR, "Can not create server socket." ERROR_SUFFIX); return -1; } *ssock = socket(AF_INET, SOCK_STREAM, 0); if (*ssock == -1) { crm_perror(LOG_ERR, "Can not create server socket." ERROR_SUFFIX); free(ssock); return -1; } /* reuse address */ optval = 1; rc = setsockopt(*ssock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)); if (rc < 0) { crm_perror(LOG_INFO, "Couldn't allow the reuse of local addresses by our remote listener"); } /* bind server socket */ memset(&saddr, '\0', sizeof(saddr)); saddr.sin_family = AF_INET; saddr.sin_addr.s_addr = INADDR_ANY; saddr.sin_port = htons(port); if (bind(*ssock, (struct sockaddr *)&saddr, sizeof(saddr)) == -1) { crm_perror(LOG_ERR, "Can not bind server socket." ERROR_SUFFIX); close(*ssock); free(ssock); return -2; } if (listen(*ssock, 10) == -1) { crm_perror(LOG_ERR, "Can not start listen." ERROR_SUFFIX); close(*ssock); free(ssock); return -3; } mainloop_add_fd("cib-remote", G_PRIORITY_DEFAULT, *ssock, ssock, &remote_listen_fd_callbacks); return *ssock; }
false
false
false
false
false
0
cpl_table_sort(cpl_table *table, const cpl_propertylist *reflist) { cpl_size *sort_pattern, *sort_null_pattern; cpl_error_code ec; if (table == NULL || reflist == NULL) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (cpl_propertylist_get_size(reflist) == 0) return cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); if (table->nr < 2) return CPL_ERROR_NONE; sort_pattern = cpl_malloc(table->nr * sizeof(cpl_size)); sort_null_pattern = cpl_malloc(table->nr * sizeof(cpl_size)); ec = table_sort(table, reflist, cpl_propertylist_get_size(reflist), sort_pattern, sort_null_pattern); cpl_free(sort_pattern); cpl_free(sort_null_pattern); return ec; }
true
true
false
false
true
1
on_keybinding_button_remove_clicked (GtkButton *button, gpointer user_data) { GtkTreeModel *model; GtkTreeIter iter; Key_Entry *entry, *key, *tmp; int onkey; if (!gtk_tree_selection_get_selected(keybinding_selection, &model, &iter)) { LOG(LOG_ERROR, "keys.c::on_keybinding_button_remove_clicked", "Function called with nothing selected\n"); return; } gtk_tree_model_get(model, &iter, KLIST_KEY_ENTRY, &entry, -1); for (onkey = 0; onkey < KEYHASH; onkey++) { for (key = keys[onkey]; key; key = key->next) { if (key == entry) { /* * This code is directly from unbind_key() above If it is the * first entry, it is easy */ if (key == keys[onkey]) { keys[onkey] = key->next; goto unbinded; } /* * Otherwise, we need to figure out where in the link list the * entry is. */ for (tmp = keys[onkey]; tmp->next != NULL; tmp = tmp->next) { if (tmp->next == key) { tmp->next = key->next; goto unbinded; } } } } } LOG(LOG_ERROR, "keys.c::on_keybinding_button_remove_clicked", "Unable to find matching key entry\n"); unbinded: free(key->command); free(key); save_keys(); update_keybinding_list(); }
false
false
false
false
false
0
pfs_process_sigio() { UINT64_T pid; struct pfs_process *p; debug(D_PROCESS,"SIGIO received"); itable_firstkey(pfs_process_table); while(itable_nextkey(pfs_process_table,&pid,(void**)&p)) { if(p && p->flags&PFS_PROCESS_FLAGS_ASYNC) { switch(p->state) { case PFS_PROCESS_STATE_DONE: break; default: debug(D_PROCESS,"SIGIO forwarded to pid %d",p->pid); pfs_process_raise(p->pid,SIGIO,1); break; } } } }
false
false
false
false
false
0
show_sort_keys(Plan *sortplan, int nkeys, AttrNumber *keycols, const char *qlabel, StringInfo str, int indent, ExplainState *es) { List *context; bool useprefix; int keyno; char *exprstr; Relids varnos; int i; if (nkeys <= 0) return; for (i = 0; i < indent; i++) appendStringInfo(str, " "); appendStringInfo(str, " %s: ", qlabel); /* * In this routine we expect that the plan node's tlist has not been * processed by set_plan_references(). Normally, any Vars will contain * valid varnos referencing the actual rtable. But we might instead be * looking at a dummy tlist generated by prepunion.c; if there are Vars * with zero varno, use the tlist itself to determine their names. */ varnos = pull_varnos((Node *) sortplan->targetlist); if (bms_is_member(0, varnos)) { Node *outercontext; outercontext = deparse_context_for_subplan("sort", (Node *) sortplan); context = deparse_context_for_plan(0, outercontext, 0, NULL, es->rtable); useprefix = false; } else { context = deparse_context_for_plan(0, NULL, 0, NULL, es->rtable); useprefix = list_length(es->rtable) > 1; } bms_free(varnos); for (keyno = 0; keyno < nkeys; keyno++) { /* find key expression in tlist */ AttrNumber keyresno = keycols[keyno]; TargetEntry *target = get_tle_by_resno(sortplan->targetlist, keyresno); if (!target) elog(ERROR, "no tlist entry for key %d", keyresno); /* Deparse the expression, showing any top-level cast */ exprstr = deparse_expression((Node *) target->expr, context, useprefix, true); /* And add to str */ if (keyno > 0) appendStringInfo(str, ", "); appendStringInfoString(str, exprstr); } appendStringInfo(str, "\n"); }
false
false
false
false
false
0
_gsskrb5_create_ctx( OM_uint32 * minor_status, gss_ctx_id_t * context_handle, krb5_context context, const gss_channel_bindings_t input_chan_bindings, enum gss_ctx_id_t_state state) { krb5_error_code kret; gsskrb5_ctx ctx; *context_handle = NULL; ctx = malloc(sizeof(*ctx)); if (ctx == NULL) { *minor_status = ENOMEM; return GSS_S_FAILURE; } ctx->auth_context = NULL; ctx->deleg_auth_context = NULL; ctx->source = NULL; ctx->target = NULL; ctx->kcred = NULL; ctx->ccache = NULL; ctx->state = state; ctx->flags = 0; ctx->more_flags = 0; ctx->service_keyblock = NULL; ctx->ticket = NULL; krb5_data_zero(&ctx->fwd_data); ctx->lifetime = GSS_C_INDEFINITE; ctx->order = NULL; ctx->crypto = NULL; HEIMDAL_MUTEX_init(&ctx->ctx_id_mutex); kret = krb5_auth_con_init (context, &ctx->auth_context); if (kret) { *minor_status = kret; HEIMDAL_MUTEX_destroy(&ctx->ctx_id_mutex); return GSS_S_FAILURE; } kret = krb5_auth_con_init (context, &ctx->deleg_auth_context); if (kret) { *minor_status = kret; krb5_auth_con_free(context, ctx->auth_context); HEIMDAL_MUTEX_destroy(&ctx->ctx_id_mutex); return GSS_S_FAILURE; } kret = set_addresses(context, ctx->auth_context, input_chan_bindings); if (kret) { *minor_status = kret; krb5_auth_con_free(context, ctx->auth_context); krb5_auth_con_free(context, ctx->deleg_auth_context); HEIMDAL_MUTEX_destroy(&ctx->ctx_id_mutex); return GSS_S_BAD_BINDINGS; } kret = set_addresses(context, ctx->deleg_auth_context, input_chan_bindings); if (kret) { *minor_status = kret; krb5_auth_con_free(context, ctx->auth_context); krb5_auth_con_free(context, ctx->deleg_auth_context); HEIMDAL_MUTEX_destroy(&ctx->ctx_id_mutex); return GSS_S_BAD_BINDINGS; } /* * We need a sequence number */ krb5_auth_con_addflags(context, ctx->auth_context, KRB5_AUTH_CONTEXT_DO_SEQUENCE | KRB5_AUTH_CONTEXT_CLEAR_FORWARDED_CRED, NULL); /* * We need a sequence number */ krb5_auth_con_addflags(context, ctx->deleg_auth_context, KRB5_AUTH_CONTEXT_DO_SEQUENCE | KRB5_AUTH_CONTEXT_CLEAR_FORWARDED_CRED, NULL); *context_handle = (gss_ctx_id_t)ctx; return GSS_S_COMPLETE; }
false
false
false
false
false
0
merge_fileindex_video(bgav_superindex_t * idx, bgav_stream_t * s) { int i; for(i = 0; i < s->file_index->num_entries; i++) { idx->entries[s->file_index->entries[i].position].pts = s->file_index->entries[i].pts; } }
false
false
false
false
false
0
mv_hsic_phy_probe(struct platform_device *pdev) { struct phy_provider *phy_provider; struct mv_hsic_phy *mv_phy; struct resource *r; mv_phy = devm_kzalloc(&pdev->dev, sizeof(*mv_phy), GFP_KERNEL); if (!mv_phy) return -ENOMEM; mv_phy->pdev = pdev; mv_phy->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(mv_phy->clk)) { dev_err(&pdev->dev, "failed to get clock.\n"); return PTR_ERR(mv_phy->clk); } r = platform_get_resource(pdev, IORESOURCE_MEM, 0); mv_phy->base = devm_ioremap_resource(&pdev->dev, r); if (IS_ERR(mv_phy->base)) return PTR_ERR(mv_phy->base); mv_phy->phy = devm_phy_create(&pdev->dev, pdev->dev.of_node, &hsic_ops); if (IS_ERR(mv_phy->phy)) return PTR_ERR(mv_phy->phy); phy_set_drvdata(mv_phy->phy, mv_phy); phy_provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate); return PTR_ERR_OR_ZERO(phy_provider); }
false
false
false
false
false
0
dp83867_config_init(struct phy_device *phydev) { struct dp83867_private *dp83867; int ret; u16 val, delay; if (!phydev->priv) { dp83867 = devm_kzalloc(&phydev->dev, sizeof(*dp83867), GFP_KERNEL); if (!dp83867) return -ENOMEM; phydev->priv = dp83867; ret = dp83867_of_init(phydev); if (ret) return ret; } else { dp83867 = (struct dp83867_private *)phydev->priv; } if (phy_interface_is_rgmii(phydev)) { ret = phy_write(phydev, MII_DP83867_PHYCTRL, (dp83867->fifo_depth << DP83867_PHYCR_FIFO_DEPTH_SHIFT)); if (ret) return ret; } if ((phydev->interface >= PHY_INTERFACE_MODE_RGMII_ID) && (phydev->interface <= PHY_INTERFACE_MODE_RGMII_RXID)) { val = phy_read_mmd_indirect(phydev, DP83867_RGMIICTL, DP83867_DEVADDR, phydev->addr); if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) val |= (DP83867_RGMII_TX_CLK_DELAY_EN | DP83867_RGMII_RX_CLK_DELAY_EN); if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) val |= DP83867_RGMII_TX_CLK_DELAY_EN; if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) val |= DP83867_RGMII_RX_CLK_DELAY_EN; phy_write_mmd_indirect(phydev, DP83867_RGMIICTL, DP83867_DEVADDR, phydev->addr, val); delay = (dp83867->rx_id_delay | (dp83867->tx_id_delay << DP83867_RGMII_TX_CLK_DELAY_SHIFT)); phy_write_mmd_indirect(phydev, DP83867_RGMIIDCTL, DP83867_DEVADDR, phydev->addr, delay); } /* Enable Interrupt output INT_OE in CFG3 register */ if (phy_interrupt_is_valid(phydev)) { val = phy_read(phydev, DP83867_CFG3); val |= BIT(7); phy_write(phydev, DP83867_CFG3, val); } return 0; }
false
false
false
false
false
0
getHostName () { if (m_address.sin_addr.s_addr == htonl(INADDR_ANY)) { return (""); } struct hostent* hentry; hentry = gethostbyaddr ((const char*) &m_address.sin_addr, sizeof(m_address.sin_addr), AF_INET); if (hentry == NULL) { errno = h_errno; setstate (Address::badbit); EL((ASSAERR,"gethostbyaddr() failed\n")); return (""); } return hentry->h_name; }
false
false
false
false
false
0
luaL_newstate(void) { lua_State *L; void *ud = lj_alloc_create(); if (ud == NULL) return NULL; #if LJ_64 L = lj_state_newstate(lj_alloc_f, ud); #else L = lua_newstate(lj_alloc_f, ud); #endif if (L) G(L)->panic = panic; return L; }
false
false
false
false
false
0
multi_create_accept_hit() { char selected_name[255]; int start_campaign = 0; int popup_choice = 0; // make sure all players have finished joining if(!multi_netplayer_state_check(NETPLAYER_STATE_JOINED,1)){ popup(PF_BODY_BIG | PF_USE_AFFIRMATIVE_ICON,1,POPUP_OK,XSTR("Please wait until all clients have finished joining",788)); gamesnd_play_iface(SND_GENERAL_FAIL); return; } else { gamesnd_play_iface(SND_COMMIT_PRESSED); } // do single mission stuff switch(Multi_create_list_mode){ case MULTI_CREATE_SHOW_MISSIONS: if(Multi_create_list_select != -1){ // set the netgame mode Netgame.campaign_mode = MP_SINGLE_MISSION; // setup various filenames and mission names multi_create_select_to_filename(Multi_create_list_select,selected_name); strncpy( Game_current_mission_filename, selected_name, MAX_FILENAME_LEN ); strncpy(Netgame.mission_name,selected_name,MAX_FILENAME_LEN); // NETLOG ml_printf(NOX("Starting single mission %s, with %d players"), Game_current_mission_filename, multi_num_players()); } else { multi_common_add_notify(XSTR("No mission selected!",789)); return ; } break; case MULTI_CREATE_SHOW_CAMPAIGNS: // do campaign related stuff if(Multi_create_list_select != -1){ // set the netgame mode Netgame.campaign_mode = MP_CAMPAIGN; // start a campaign instead of a single mission multi_create_select_to_filename(Multi_create_list_select,selected_name); multi_campaign_start(selected_name); start_campaign = 1; // NETLOG ml_printf(NOX("Starting campaign %s, with %d players"), selected_name, multi_num_players()); } else { multi_common_add_notify(XSTR("No campaign selected!",790)); return ; } break; } // if this is a team vs team situation, lock the players send a final team update if((Netgame.type_flags & NG_TYPE_TEAM) && (Net_player->flags & NETINFO_FLAG_AM_MASTER)){ multi_team_host_lock_all(); multi_team_send_update(); } // coop game option validation checks if ( (Netgame.type_flags & NG_TYPE_COOP) && (Net_player->flags & NETINFO_FLAG_AM_MASTER) ) { // check for time limit if (Netgame.options.mission_time_limit != i2f(-1)) { popup_choice = popup(0, 3, POPUP_CANCEL, POPUP_YES, XSTR( " &No", 506 ), XSTR("A time limit is being used in a co-op game.\r\n" " Select \'Cancel\' to go back to the mission select screen.\r\n" " Select \'Yes\' to continue with this time limit.\r\n" " Select \'No\' to continue without this time limit.", -1)); if (popup_choice == 0) { return; } else if (popup_choice == 2) { Netgame.options.mission_time_limit = i2f(-1); } } // check kill limit (NOTE: <= 0 is considered no limit) if ( (Netgame.options.kill_limit > 0) && (Netgame.options.kill_limit != 9999) ) { popup_choice = popup(0, 3, POPUP_CANCEL, POPUP_YES, XSTR( " &No", 506 ), XSTR("A kill limit is being used in a co-op game.\r\n" " Select \'Cancel\' to go back to the mission select screen.\r\n" " Select \'Yes\' to continue with this kill limit.\r\n" " Select \'No\' to continue without this kill limit.", -1)); if (popup_choice == 0) { return; } else if (popup_choice == 2) { Netgame.options.kill_limit = 9999; } } } // if not on the standalone, move to the mission sync state which will take care of everything if(Net_player->flags & NETINFO_FLAG_AM_MASTER){ Multi_sync_mode = MULTI_SYNC_PRE_BRIEFING; gameseq_post_event(GS_EVENT_MULTI_MISSION_SYNC); } // otherwise tell the standalone to do so else { // when the standalone receives this, he'll do the mission syncing himself send_mission_sync_packet(MULTI_SYNC_PRE_BRIEFING,start_campaign); } }
false
false
false
false
false
0
opal_hwloc_compare(const hwloc_topology_t topo1, const hwloc_topology_t topo2, opal_data_type_t type) { hwloc_topology_t t1, t2; unsigned d1, d2; char *x1=NULL, *x2=NULL; int l1, l2; int s; struct hwloc_topology_support *s1, *s2; /* stop stupid compiler warnings */ t1 = (hwloc_topology_t)topo1; t2 = (hwloc_topology_t)topo2; /* do something quick first */ d1 = hwloc_topology_get_depth(t1); d2 = hwloc_topology_get_depth(t2); if (d1 > d2) { return OPAL_VALUE1_GREATER; } else if (d2 > d1) { return OPAL_VALUE2_GREATER; } /* do the comparison the "cheat" way - get an xml representation * of each tree, and strcmp! */ if (0 != hwloc_topology_export_xmlbuffer(t1, &x1, &l1)) { return OPAL_EQUAL; } if (0 != hwloc_topology_export_xmlbuffer(t2, &x2, &l2)) { free(x1); return OPAL_EQUAL; } s = strcmp(x1, x2); free(x1); free(x2); if (s > 0) { return OPAL_VALUE1_GREATER; } else if (s < 0) { return OPAL_VALUE2_GREATER; } /* compare the available support - hwloc unfortunately does * not include this info in its xml support! */ if (NULL == (s1 = (struct hwloc_topology_support*)hwloc_topology_get_support(t1)) || NULL == s1->cpubind || NULL == s1->membind) { return OPAL_EQUAL; } if (NULL == (s2 = (struct hwloc_topology_support*)hwloc_topology_get_support(t2)) || NULL == s2->cpubind || NULL == s2->membind) { return OPAL_EQUAL; } /* compare the fields we care about */ if (s1->cpubind->set_thisproc_cpubind != s2->cpubind->set_thisproc_cpubind || s1->cpubind->set_thisthread_cpubind != s2->cpubind->set_thisthread_cpubind || s1->membind->set_thisproc_membind != s2->membind->set_thisproc_membind || s1->membind->set_thisthread_membind != s2->membind->set_thisthread_membind) { OPAL_OUTPUT_VERBOSE((5, opal_hwloc_base_framework.framework_output, "hwloc:base:compare BINDING CAPABILITIES DIFFER")); return OPAL_VALUE1_GREATER; } return OPAL_EQUAL; }
false
false
false
false
false
0
Combine( const wxSheetBlock &block, wxSheetBlock &top, wxSheetBlock &bottom, wxSheetBlock &left, wxSheetBlock &right ) const { wxSheetBlock iBlock(Intersect(block)); if (iBlock.IsEmpty()) return wxSHEET_BLOCK_NONE; // nothing to combine if (Contains(block)) return wxSHEET_BLOCK_ALL; // can combine all of block, no leftover int combined = wxSHEET_BLOCK_NONE; if ( block.GetTop() < GetTop() ) { top.SetCoords( block.GetTop(), block.GetLeft(), GetTop()-1, block.GetRight() ); combined |= wxSHEET_BLOCK_TOP; } if ( block.GetBottom() > GetBottom() ) { bottom.SetCoords( GetBottom()+1, block.GetLeft(), block.GetBottom(), block.GetRight() ); combined |= wxSHEET_BLOCK_BOTTOM; } if ( block.GetLeft() < GetLeft() ) { left.SetCoords(iBlock.GetTop(), block.GetLeft(), iBlock.GetBottom(), GetLeft()-1 ); combined |= wxSHEET_BLOCK_LEFT; } if ( block.GetRight() > GetRight() ) { right.SetCoords( iBlock.GetTop(), GetRight()+1, iBlock.GetBottom(), block.GetRight() ); combined |= wxSHEET_BLOCK_RIGHT; } return combined; }
false
false
false
false
false
0
reset() { pos_=initialPos_; remainingMatchLength_=initialRemainingMatchLength_; skipValue_=FALSE; int32_t length=remainingMatchLength_+1; // Remaining match length. if(maxLength_>0 && length>maxLength_) { length=maxLength_; } str_.truncate(length); pos_+=length; remainingMatchLength_-=length; stack_->setSize(0); return *this; }
false
false
false
false
false
0
_wapi_handle_ops_isowned (gpointer handle) { guint32 idx = GPOINTER_TO_UINT(handle); WapiHandleType type; if (!_WAPI_PRIVATE_VALID_SLOT (idx)) { return(FALSE); } type = _WAPI_PRIVATE_HANDLES(idx).type; if (handle_ops[type] != NULL && handle_ops[type]->is_owned != NULL) { return(handle_ops[type]->is_owned (handle)); } else { return(FALSE); } }
false
false
false
false
false
0
adj_gtab_win_pos() { if (!gwin_gtab) return; if (win_size_exceed(gwin_gtab)) move_win_gtab(current_in_win_x, current_in_win_y); }
false
false
false
false
false
0
operator[](const set<int> &t) { if(has_not(t)) { index[t] = index.size()-1; element.push_back(&(index.find(t)->first)); } return index[t]; }
false
false
false
false
false
0
gda_lemon_capi_parserTrace(FILE *TraceFILE, char *zTracePrompt){ yyTraceFILE = TraceFILE; yyTracePrompt = zTracePrompt; if( yyTraceFILE==0 ) yyTracePrompt = 0; else if( yyTracePrompt==0 ) yyTraceFILE = 0; }
false
false
false
false
false
0
foldAddMarker(lnum, marker, markerlen) linenr_T lnum; char_u *marker; int markerlen; { char_u *cms = curbuf->b_p_cms; char_u *line; int line_len; char_u *newline; char_u *p = (char_u *)strstr((char *)curbuf->b_p_cms, "%s"); /* Allocate a new line: old-line + 'cms'-start + marker + 'cms'-end */ line = ml_get(lnum); line_len = (int)STRLEN(line); if (u_save(lnum - 1, lnum + 1) == OK) { newline = alloc((unsigned)(line_len + markerlen + STRLEN(cms) + 1)); if (newline == NULL) return; STRCPY(newline, line); if (p == NULL) vim_strncpy(newline + line_len, marker, markerlen); else { STRCPY(newline + line_len, cms); STRNCPY(newline + line_len + (p - cms), marker, markerlen); STRCPY(newline + line_len + (p - cms) + markerlen, p + 2); } ml_replace(lnum, newline, FALSE); } }
false
false
false
false
false
0
rtx_unstable_p (rtx x) { RTX_CODE code = GET_CODE (x); int i; const char *fmt; switch (code) { case MEM: return ! RTX_UNCHANGING_P (x) || rtx_unstable_p (XEXP (x, 0)); case QUEUED: return 1; case ADDRESSOF: case CONST: case CONST_INT: case CONST_DOUBLE: case CONST_VECTOR: case SYMBOL_REF: case LABEL_REF: return 0; case REG: /* As in rtx_varies_p, we have to use the actual rtx, not reg number. */ if (x == frame_pointer_rtx || x == hard_frame_pointer_rtx /* The arg pointer varies if it is not a fixed register. */ || (x == arg_pointer_rtx && fixed_regs[ARG_POINTER_REGNUM]) || RTX_UNCHANGING_P (x)) return 0; #ifndef PIC_OFFSET_TABLE_REG_CALL_CLOBBERED /* ??? When call-clobbered, the value is stable modulo the restore that must happen after a call. This currently screws up local-alloc into believing that the restore is not needed. */ if (x == pic_offset_table_rtx) return 0; #endif return 1; case ASM_OPERANDS: if (MEM_VOLATILE_P (x)) return 1; /* Fall through. */ default: break; } fmt = GET_RTX_FORMAT (code); for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) if (fmt[i] == 'e') { if (rtx_unstable_p (XEXP (x, i))) return 1; } else if (fmt[i] == 'E') { int j; for (j = 0; j < XVECLEN (x, i); j++) if (rtx_unstable_p (XVECEXP (x, i, j))) return 1; } return 0; }
false
false
false
false
false
0
add_kern(Code in1, Code in2, int kern) { if (Kern *k = kern_obj(in1, in2)) k->kern += kern; else _encoding[in1].kerns.push_back(Kern(in2, kern)); }
false
false
false
false
false
0
ndmp_sxa_mover_set_window (struct ndm_session *sess, struct ndmp_xa_buf *xa, struct ndmconn *ref_conn) { struct ndm_tape_agent * ta = &sess->tape_acb; struct ndmp9_mover_get_state_reply *ms = &ta->mover_state; unsigned long long max_len; unsigned long long end_win; NDMS_WITH(ndmp9_mover_set_window) ndmta_mover_sync_state (sess); if (ref_conn->protocol_version < NDMP4VER) { /* * NDMP[23] require the Mover be in LISTEN state. * Unclear sequence for MOVER_CONNECT. */ if (ms->state != NDMP9_MOVER_STATE_LISTEN && ms->state != NDMP9_MOVER_STATE_PAUSED) { NDMADR_RAISE_ILLEGAL_STATE("mover_state !LISTEN/PAUSED"); } } else { /* * NDMP4 require the Mover be in IDLE state. * This always preceeds both MOVER_LISTEN or * MOVER_CONNECT. */ if (ms->state != NDMP9_MOVER_STATE_IDLE && ms->state != NDMP9_MOVER_STATE_PAUSED) { NDMADR_RAISE_ILLEGAL_STATE("mover_state !IDLE/PAUSED"); } } if (request->offset % ms->record_size != 0) { NDMADR_RAISE_ILLEGAL_ARGS("off !record_size"); } /* TODO: NDMPv4 subtle semantic changes here */ /* If a maximum length window is required following a mover transition * to the PAUSED state, a window length of all ones (binary) minus the * current window offset MUST be specified." (NDMPv4 RFC, Section * 3.6.2.2) -- we allow length = NDMP_LENGTH_INFINITY too */ if (request->length != NDMP_LENGTH_INFINITY && request->length + request->offset != NDMP_LENGTH_INFINITY) { if (request->length % ms->record_size != 0) { NDMADR_RAISE_ILLEGAL_ARGS("len !record_size"); } #if 0 /* Too pedantic. Sometimes needed (like for testing) */ if (request->length == 0) { NDMADR_RAISE_ILLEGAL_ARGS("length 0"); } #endif max_len = NDMP_LENGTH_INFINITY - request->offset; max_len -= max_len % ms->record_size; if (request->length > max_len) { /* learn math fella */ NDMADR_RAISE_ILLEGAL_ARGS("length too long"); } end_win = request->offset + request->length; } else { end_win = NDMP_LENGTH_INFINITY; } ms->window_offset = request->offset; /* record_num should probably be one less than this value, but the spec * says to divide, so we divide */ ms->record_num = request->offset / ms->record_size; ms->window_length = request->length; ta->mover_window_end = end_win; ta->mover_window_first_blockno = ta->tape_state.blockno.value; return 0; NDMS_ENDWITH }
false
false
false
false
false
0
stats (MonoImage *image, const char *name) { int i, num_methods, num_types; MonoMethod *method; MonoClass *klass; num_methods = mono_image_get_table_rows (image, MONO_TABLE_METHOD); for (i = 0; i < num_methods; ++i) { method = mono_get_method (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL); method_stats (method); } num_types = mono_image_get_table_rows (image, MONO_TABLE_TYPEDEF); for (i = 0; i < num_types; ++i) { klass = mono_class_get (image, MONO_TOKEN_TYPE_DEF | (i + 1)); type_stats (klass); } g_print ("Methods and code stats:\n"); g_print ("back branch waste: %d\n", back_branch_waste); g_print ("branch waste: %d\n", branch_waste); g_print ("var waste: %d\n", var_waste); g_print ("int waste: %d\n", int_waste); g_print ("nop waste: %d\n", nop_waste); g_print ("has exceptions: %d/%d, total: %d, max: %d, mean: %f\n", has_exceptions, num_methods, num_exceptions, max_exceptions, num_exceptions/(double)has_exceptions); g_print ("has locals: %d/%d, total: %d, max: %d, mean: %f\n", has_locals, num_methods, num_locals, max_locals, num_locals/(double)has_locals); g_print ("has args: %d/%d, total: %d, max: %d, mean: %f\n", has_args, num_methods, num_args, max_args, num_args/(double)has_args); g_print ("has maxstack: %d/%d, total: %d, max: %d, mean: %f\n", has_maxstack, num_methods, num_maxstack, max_maxstack, num_maxstack/(double)i); g_print ("has code: %d/%d, total: %d, max: %d, mean: %f\n", has_code, num_methods, num_code, max_code, num_code/(double)has_code); g_print ("has branch: %d/%d, total: %d, max: %d, mean: %f\n", has_branch, num_methods, num_branch, max_branch, num_branch/(double)has_branch); g_print ("has condbranch: %d/%d, total: %d, max: %d, mean: %f\n", has_condbranch, num_methods, num_condbranch, max_condbranch, num_condbranch/(double)has_condbranch); g_print ("has switch: %d/%d, total: %d, max: %d, mean: %f\n", has_switch, num_methods, num_switch, max_switch, num_switch/(double)has_switch); g_print ("has calls: %d/%d, total: %d, max: %d, mean: %f\n", has_calls, num_methods, num_calls, max_calls, num_calls/(double)has_calls); g_print ("has throw: %d/%d, total: %d, max: %d, mean: %f\n", has_throw, num_methods, num_throw, max_throw, num_throw/(double)has_throw); g_print ("sealed type cast: %d/%d\n", cast_sealed, total_cast); g_print ("interface type cast: %d/%d\n", cast_iface, total_cast); g_print ("non virtual callvirt: %d/%d\n", nonvirt_callvirt, total_callvirt); g_print ("interface callvirt: %d/%d\n", iface_callvirt, total_callvirt); g_print ("\nType stats:\n"); g_print ("interface types: %d/%d\n", num_ifaces, num_types); { double mean = 0; double stddev = 0; if (pdepth_array_next) { int i; mean = (double)num_pdepth/pdepth_array_next; for (i = 0; i < pdepth_array_next; ++i) { stddev += (pdepth_array [i] - mean) * (pdepth_array [i] - mean); } stddev = sqrt (stddev/pdepth_array_next); } g_print ("parent depth: max: %d, mean: %f, sttdev: %f, overflowing: %d\n", max_pdepth, mean, stddev, num_pdepth_ovf); } }
false
false
false
false
false
0
PerlIO_apply_layers(pTHX_ PerlIO *f, const char *mode, const char *names) { int code = 0; ENTER; save_scalar(PL_errgv); if (f && names) { PerlIO_list_t * const layers = PerlIO_list_alloc(aTHX); code = PerlIO_parse_layers(aTHX_ layers, names); if (code == 0) { code = PerlIO_apply_layera(aTHX_ f, mode, layers, 0, layers->cur); } PerlIO_list_free(aTHX_ layers); } LEAVE; return code; }
false
false
false
false
false
0
qlcnic_enable_msix(struct qlcnic_adapter *adapter, u32 num_msix) { struct pci_dev *pdev = adapter->pdev; int err, vector; if (!adapter->msix_entries) { adapter->msix_entries = kcalloc(num_msix, sizeof(struct msix_entry), GFP_KERNEL); if (!adapter->msix_entries) return -ENOMEM; } adapter->flags &= ~(QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED); if (adapter->ahw->msix_supported) { enable_msix: for (vector = 0; vector < num_msix; vector++) adapter->msix_entries[vector].entry = vector; err = pci_enable_msix_range(pdev, adapter->msix_entries, 1, num_msix); if (err == num_msix) { adapter->flags |= QLCNIC_MSIX_ENABLED; adapter->ahw->num_msix = num_msix; dev_info(&pdev->dev, "using msi-x interrupts\n"); return 0; } else if (err > 0) { pci_disable_msix(pdev); dev_info(&pdev->dev, "Unable to allocate %d MSI-X vectors, Available vectors %d\n", num_msix, err); if (qlcnic_82xx_check(adapter)) { num_msix = rounddown_pow_of_two(err); if (err < QLCNIC_82XX_MINIMUM_VECTOR) return -ENOSPC; } else { num_msix = rounddown_pow_of_two(err - 1); num_msix += 1; if (err < QLCNIC_83XX_MINIMUM_VECTOR) return -ENOSPC; } if (qlcnic_82xx_check(adapter) && !qlcnic_check_multi_tx(adapter)) { adapter->drv_sds_rings = num_msix; adapter->drv_tx_rings = QLCNIC_SINGLE_RING; } else { /* Distribute vectors equally */ adapter->drv_tx_rings = num_msix / 2; adapter->drv_sds_rings = adapter->drv_tx_rings; } if (num_msix) { dev_info(&pdev->dev, "Trying to allocate %d MSI-X interrupt vectors\n", num_msix); goto enable_msix; } } else { dev_info(&pdev->dev, "Unable to allocate %d MSI-X vectors, err=%d\n", num_msix, err); return err; } } return -EIO; }
false
false
false
false
false
0
callAsFunction(ExecState *exec, JSObject *, const List &args) { // Do not use thisObj here. See HTMLCollection. UString s = args[0]->toString(exec); // index-based lookup? bool ok; unsigned int u = s.qstring().toULong(&ok); if (ok) return getDOMNode(exec,m_impl->item(u)); // try lookup by name // ### NodeList::namedItem() would be cool to have // ### do we need to support the same two arg overload as in HTMLCollection? JSValue* result = get(exec, Identifier(s)); if (result) return result; return jsUndefined(); }
false
false
false
false
false
0
soc_probe_aux_dev(struct snd_soc_card *card, int num) { struct snd_soc_pcm_runtime *rtd = &card->rtd_aux[num]; struct snd_soc_aux_dev *aux_dev = &card->aux_dev[num]; int ret; ret = soc_probe_component(card, rtd->component); if (ret < 0) return ret; /* do machine specific initialization */ if (aux_dev->init) { ret = aux_dev->init(rtd->component); if (ret < 0) { dev_err(card->dev, "ASoC: failed to init %s: %d\n", aux_dev->name, ret); return ret; } } return soc_post_component_init(rtd, aux_dev->name); }
false
false
false
false
false
0
page_stats_print(unsigned long nbpages) { /* bad: we're assuming every cpu is at the same speed */ unsigned i; FILE *stats; u_64 lasttime=0ULL; if( pagebufstats ) { if( !(stats=fopen(pagebufstats,"w")) ) { fprintf(stderr,"can't open buffer stats data file %s\n",pagebufstats); exit(EXIT_FAILURE); } for (i=0;i<nbpages;i++) fprintf(stats,"%u %"PRIu64" %u %u %u %u %u\n",i, page_status[i].time, page_status[i].writing, page_status[i].nbsyncs, page_status[i].written, page_status[i].extra_written, page_status[i].nbpages ); fclose(stats); } if (pagetimestats) { if( !(stats=fopen(pagetimestats,"w")) ) { fprintf(stderr,"can't open page time stats data file %s\n",pagetimestats); exit(EXIT_FAILURE); } if (nbpages) lasttime=page_status[0].time; for (i=0;i<nbpages;i++) { fprintf(stats,"%i %"PRIu64" %"PRIu64"\n",i, page_status[i].time, page_status[i].time-lasttime); lasttime=page_status[i].time; } fclose(stats); } printf("\n\nbuffer: %d -> %d\n",page_status[0].nbpages,page_status[nbpages].nbpages); printf("total synchronizations: %"PRIu64"\n",nbsyncs); }
false
false
false
false
false
0
scsifront_put_rqid(struct vscsifrnt_info *info, uint32_t id) { unsigned long flags; int kick; spin_lock_irqsave(&info->shadow_lock, flags); kick = _scsifront_put_rqid(info, id); spin_unlock_irqrestore(&info->shadow_lock, flags); if (kick) scsifront_wake_up(info); }
false
false
false
false
false
0
mca_base_component_unload (const mca_base_component_t *component, int output_id) { int ret; /* Unload */ opal_output_verbose(10, output_id, "mca: base: close: unloading component %s", component->mca_component_name); /* XXX -- TODO -- Replace reserved by mca_project_name for 1.9 */ ret = mca_base_var_group_find (component->reserved, component->mca_type_name, component->mca_component_name); if (0 <= ret) { mca_base_var_group_deregister (ret); } mca_base_component_repository_release((mca_base_component_t *) component); }
false
false
false
false
false
0
is_ICC_signature(png_alloc_size_t it) { return is_ICC_signature_char(it >> 24) /* checks all the top bits */ && is_ICC_signature_char((it >> 16) & 0xff) && is_ICC_signature_char((it >> 8) & 0xff) && is_ICC_signature_char(it & 0xff); }
false
false
false
false
false
0
_wrap_GooCanvasItemSimple__do_simple_create_path(PyObject *cls, PyObject *args, PyObject *kwargs) { gpointer klass; static char *kwlist[] = { "self", "cr", NULL }; PyGObject *self; PycairoContext *cr; if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!O!:GooCanvasItemSimple.simple_create_path", kwlist, &PyGooCanvasItemSimple_Type, &self, &PycairoContext_Type, &cr)) return NULL; klass = g_type_class_ref(pyg_type_from_object(cls)); if (GOO_CANVAS_ITEM_SIMPLE_CLASS(klass)->simple_create_path) GOO_CANVAS_ITEM_SIMPLE_CLASS(klass)->simple_create_path(GOO_CANVAS_ITEM_SIMPLE(self->obj), cr->ctx); else { PyErr_SetString(PyExc_NotImplementedError, "virtual method GooCanvasItemSimple.simple_create_path not implemented"); g_type_class_unref(klass); return NULL; } g_type_class_unref(klass); Py_INCREF(Py_None); return Py_None; }
false
false
false
false
false
0
SwitchMaster(jack_driver_desc_t* driver_desc, JSList* driver_params) { std::list<JackDriverInterface*> slave_list; std::list<JackDriverInterface*>::const_iterator it; // Remove current master fAudioDriver->Stop(); fAudioDriver->Detach(); fAudioDriver->Close(); // Open new master JackDriverInfo* info = new JackDriverInfo(); JackDriverClientInterface* master = info->Open(driver_desc, fEngine, GetSynchroTable(), driver_params); if (!master) { goto error; } // Get slaves list slave_list = fAudioDriver->GetSlaves(); // Move slaves in new master for (it = slave_list.begin(); it != slave_list.end(); it++) { JackDriverInterface* slave = *it; master->AddSlave(slave); } // Delete old master delete fDriverInfo; // Activate master fAudioDriver = master; fDriverInfo = info; if (fAudioDriver->Attach() < 0) { goto error; } // Notify clients of new values fEngine->NotifyBufferSize(fEngineControl->fBufferSize); fEngine->NotifySampleRate(fEngineControl->fSampleRate); // And finally start fAudioDriver->SetMaster(true); return fAudioDriver->Start(); error: delete info; return -1; }
false
false
false
false
false
0
getnetnumber(addr) unsigned int addr; { if (IN_CLASSA (addr)) return (addr >> 24 ); if (IN_CLASSB (addr)) return (addr >> 16 ); if (IN_CLASSC (addr)) return (addr >> 8 ); else return 0; }
false
false
false
false
false
0
cmdtime_netend() { if (!cmdtime_enabled) { return; } gettimeofday(&nettime_end, 0); nettime += timesub(&nettime_start, &nettime_end); }
false
false
false
false
false
0
getVectors( std::vector<aiVector3D>& vecs ) { vecs.resize(vecMap.size()); for(vecIndexMap::dataType::iterator it = vecMap.begin(); it != vecMap.end(); it++){ vecs[it->second-1] = it->first; } }
false
false
false
false
false
0
makeweights(void) { /* make up weights vector to avoid duplicate computations */ long i; for (i = 1; i <= sites; i++) { alias[i - 1] = i; ally[i - 1] = 0; aliasweight[i - 1] = weight[i - 1]; location[i - 1] = 0; } sitesort2(sites, aliasweight); sitecombine2(sites, aliasweight); sitescrunch2(sites, 1, 2, aliasweight); for (i = 1; i <= sites; i++) { if (aliasweight[i - 1] > 0) endsite = i; } for (i = 1; i <= endsite; i++) { ally[alias[i - 1] - 1] = alias[i - 1]; location[alias[i - 1] - 1] = i; } contribution = (contribarr *) Malloc( endsite*sizeof(contribarr)); }
false
false
false
false
false
0
g_daemon_volume_monitor_find_mount_by_mount_info (GMountInfo *mount_info) { GDaemonMount *daemon_mount; G_LOCK (daemon_vm); daemon_mount = NULL; if (_the_daemon_volume_monitor != NULL) { daemon_mount = find_mount_by_mount_info (_the_daemon_volume_monitor, mount_info); if (daemon_mount != NULL) g_object_ref (daemon_mount); } G_UNLOCK (daemon_vm); return daemon_mount; }
false
false
false
false
false
0
out( MifOutputByteStream &os ) { os << '\n' << MifOutputByteStream::INDENT << "<XRef "; os.indent(); CHECK_PROPERTY( XRefName ); if( setProperties & fXRefSrcText ) XRefSrcText.escapeSpecialChars(); CHECK_PROPERTY( XRefSrcText ); CHECK_PROPERTY( XRefSrcFile ); os.undent(); os << '\n' << MifOutputByteStream::INDENT << ">"; if( setProperties & fXRefText ) os << '\n' << MifOutputByteStream::INDENT << "<String " << XRefText << ">"; os << '\n' << MifOutputByteStream::INDENT << "<XRefEnd>"; }
false
false
false
false
false
0
CreateOverlaySurface(volatile STG4000REG __iomem *pSTGReg, u32 inWidth, u32 inHeight, int bLinear, u32 ulOverlayOffset, u32 * retStride, u32 * retUVStride) { u32 tmp; u32 ulStride; if (inWidth > STG4000_OVRL_MAX_WIDTH || inHeight > STG4000_OVRL_MAX_HEIGHT) { return -EINVAL; } /* Stride in 16 byte words - 16Bpp */ if (bLinear) { /* Format is 16bits so num 16 byte words is width/8 */ if ((inWidth & 0x7) == 0) { /* inWidth % 8 */ ulStride = (inWidth / 8); } else { /* Round up to next 16byte boundary */ ulStride = ((inWidth + 8) / 8); } } else { /* Y component is 8bits so num 16 byte words is width/16 */ if ((inWidth & 0xf) == 0) { /* inWidth % 16 */ ulStride = (inWidth / 16); } else { /* Round up to next 16byte boundary */ ulStride = ((inWidth + 16) / 16); } } /* Set Overlay address and Format mode */ tmp = STG_READ_REG(DACOverlayAddr); CLEAR_BITS_FRM_TO(0, 20); if (bLinear) { CLEAR_BIT(31); /* Overlay format to Linear */ } else { tmp |= SET_BIT(31); /* Overlay format to Planer */ } /* Only bits 24:4 of the Overlay address */ tmp |= (ulOverlayOffset >> 4); STG_WRITE_REG(DACOverlayAddr, tmp); if (!bLinear) { u32 uvSize = (inWidth & 0x1) ? (inWidth + 1 / 2) : (inWidth / 2); u32 uvStride; u32 ulOffset; /* Y component is 8bits so num 32 byte words is width/32 */ if ((uvSize & 0xf) == 0) { /* inWidth % 16 */ uvStride = (uvSize / 16); } else { /* Round up to next 32byte boundary */ uvStride = ((uvSize + 16) / 16); } ulOffset = ulOverlayOffset + (inHeight * (ulStride * 16)); /* Align U,V data to 32byte boundary */ if ((ulOffset & 0x1f) != 0) ulOffset = (ulOffset + 32L) & 0xffffffE0L; tmp = STG_READ_REG(DACOverlayUAddr); CLEAR_BITS_FRM_TO(0, 20); tmp |= (ulOffset >> 4); STG_WRITE_REG(DACOverlayUAddr, tmp); ulOffset += (inHeight / 2) * (uvStride * 16); /* Align U,V data to 32byte boundary */ if ((ulOffset & 0x1f) != 0) ulOffset = (ulOffset + 32L) & 0xffffffE0L; tmp = STG_READ_REG(DACOverlayVAddr); CLEAR_BITS_FRM_TO(0, 20); tmp |= (ulOffset >> 4); STG_WRITE_REG(DACOverlayVAddr, tmp); *retUVStride = uvStride * 16; } /* Set Overlay YUV pixel format * Make sure that LUT not used - ?????? */ tmp = STG_READ_REG(DACPixelFormat); /* Only support Planer or UYVY linear formats */ CLEAR_BITS_FRM_TO(4, 9); STG_WRITE_REG(DACPixelFormat, tmp); ovlWidth = inWidth; ovlHeight = inHeight; ovlStride = ulStride; ovlLinear = bLinear; *retStride = ulStride << 4; /* In bytes */ return 0; }
false
false
false
false
false
0
netsnmp_create_watcher_info(void *data, size_t size, u_char type, int flags) { netsnmp_watcher_info *winfo = SNMP_MALLOC_TYPEDEF(netsnmp_watcher_info); if (winfo) netsnmp_init_watcher_info(winfo, data, size, type, flags); return winfo; }
false
false
false
false
false
0