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
taos_als_cal_target_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct tsl2583_chip *chip = iio_priv(indio_dev); int value; if (kstrtoint(buf, 0, &value)) return -EINVAL; if (value) chip->taos_settings.als_cal_target = value; return len; }
false
false
false
false
false
0
cmd_cmdsize(vector_t *strvec) { unsigned int i; int size = 0; vector_t *descvec; desc_t *desc; for (i = 0; i < vector_active (strvec); i++) { if ((descvec = vector_slot (strvec, i)) != NULL) { if ((vector_active (descvec)) == 1 && (desc = vector_slot (descvec, 0)) != NULL) { if (desc->cmd == NULL || CMD_OPTION (desc->cmd)) return size; else size++; } else { size++; } } } return size; }
false
false
false
false
false
0
netxen_nic_pci_mem_access_direct(struct netxen_adapter *adapter, u64 off, u64 *data, int op) { void __iomem *addr, *mem_ptr = NULL; resource_size_t mem_base; int ret; u32 start; spin_lock(&adapter->ahw.mem_lock); ret = adapter->pci_set_window(adapter, off, &start); if (ret != 0) goto unlock; if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { addr = adapter->ahw.pci_base0 + start; } else { addr = pci_base_offset(adapter, start); if (addr) goto noremap; mem_base = pci_resource_start(adapter->pdev, 0) + (start & PAGE_MASK); mem_ptr = ioremap(mem_base, PAGE_SIZE); if (mem_ptr == NULL) { ret = -EIO; goto unlock; } addr = mem_ptr + (start & (PAGE_SIZE-1)); } noremap: if (op == 0) /* read */ *data = readq(addr); else /* write */ writeq(*data, addr); unlock: spin_unlock(&adapter->ahw.mem_lock); if (mem_ptr) iounmap(mem_ptr); return ret; }
false
false
false
false
false
0
writeXML(STD_NAMESPACE ostream &stream, const size_t flags) const { OFString tmpString; /* iterate over all list items */ OFListConstIterator(ItemStruct *) iter = ItemList.begin(); const OFListConstIterator(ItemStruct *) last = ItemList.end(); while (iter != last) { ItemStruct *item = OFstatic_cast(ItemStruct *, *iter); /* check whether list item really exists */ if (item != NULL) { stream << "<scheme designator=\"" << convertToXMLString(item->CodingSchemeDesignator, tmpString) << "\">" << OFendl; writeStringValueToXML(stream, convertToXMLString(item->CodingSchemeRegistry, tmpString), "registry", (flags & DSRTypes::XF_writeEmptyTags) > 0); writeStringValueToXML(stream, item->CodingSchemeUID, "uid", (flags & DSRTypes::XF_writeEmptyTags) > 0); writeStringValueToXML(stream, convertToXMLString(item->CodingSchemeExternalID, tmpString), "identifier", (flags & DSRTypes::XF_writeEmptyTags) > 0); writeStringValueToXML(stream, convertToXMLString(item->CodingSchemeName, tmpString), "name", (flags & DSRTypes::XF_writeEmptyTags) > 0); writeStringValueToXML(stream, convertToXMLString(item->CodingSchemeVersion, tmpString), "version", (flags & DSRTypes::XF_writeEmptyTags) > 0); writeStringValueToXML(stream, convertToXMLString(item->ResponsibleOrganization, tmpString), "organization", (flags & DSRTypes::XF_writeEmptyTags) > 0); stream << "</scheme>" << OFendl; } ++iter; } return EC_Normal; }
false
false
false
false
false
0
print_los(object *op) { int x, y; char buf[MAP_CLIENT_X*2+20], buf2[10]; snprintf(buf, sizeof(buf), "[fixed] "); for (x = 0; x < op->contr->socket.mapx; x++) { snprintf(buf2, sizeof(buf2), "%2d", x); strncat(buf, buf2, sizeof(buf)-strlen(buf)-1); } draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DEBUG, buf); for (y = 0; y < op->contr->socket.mapy; y++) { snprintf(buf, sizeof(buf), "[fixed]%2d:", y); for (x = 0; x < op->contr->socket.mapx; x++) { snprintf(buf2, sizeof(buf2), " %1d", op->contr->blocked_los[x][y] == 100 ? 1 : 0); strncat(buf, buf2, sizeof(buf)-strlen(buf)-1); } draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_DEBUG, buf); } }
false
false
false
false
false
0
operator+(const double f) const { char buf[30]; sprintf(buf, "%f", f); const int s_length = ::strlen(buf); GStr newstring; newstring.replace_data(length() + s_length); ::memcpy(newstring.chrs(), chars(), length()); ::memcpy(&(newstring.chrs())[length()], buf, s_length); return newstring; }
false
false
false
false
false
0
recursive_lock_destroy(pTHX_ recursive_lock_t *lock) { MUTEX_DESTROY(&lock->mutex); COND_DESTROY(&lock->cond); }
false
false
false
false
false
0
PerlIOScalar_pushed(pTHX_ PerlIO * f, const char *mode, SV * arg, PerlIO_funcs * tab) { IV code; PerlIOScalar *s = PerlIOSelf(f, PerlIOScalar); /* If called (normally) via open() then arg is ref to scalar we are * using, otherwise arg (from binmode presumably) is either NULL * or the _name_ of the scalar */ if (arg && SvOK(arg)) { if (SvROK(arg)) { if (SvREADONLY(SvRV(arg)) && !SvIsCOW(SvRV(arg)) && mode && *mode != 'r') { if (ckWARN(WARN_LAYER)) Perl_warner(aTHX_ packWARN(WARN_LAYER), "%s", PL_no_modify); SETERRNO(EINVAL, SS_IVCHAN); return -1; } s->var = SvREFCNT_inc(SvRV(arg)); SvGETMAGIC(s->var); if (!SvPOK(s->var) && SvOK(s->var)) (void)SvPV_nomg_const_nolen(s->var); } else { s->var = SvREFCNT_inc(perl_get_sv (SvPV_nolen(arg), GV_ADD | GV_ADDMULTI)); } } else { s->var = newSVpvn("", 0); } SvUPGRADE(s->var, SVt_PV); code = PerlIOBase_pushed(aTHX_ f, mode, Nullsv, tab); if (!SvOK(s->var) || (PerlIOBase(f)->flags) & PERLIO_F_TRUNCATE) { sv_force_normal(s->var); SvCUR_set(s->var, 0); } if (SvUTF8(s->var) && !sv_utf8_downgrade(s->var, TRUE)) { if (ckWARN(WARN_UTF8)) Perl_warner(aTHX_ packWARN(WARN_UTF8), code_point_warning); SETERRNO(EINVAL, SS_IVCHAN); SvREFCNT_dec(s->var); s->var = Nullsv; return -1; } if ((PerlIOBase(f)->flags) & PERLIO_F_APPEND) { sv_force_normal(s->var); s->posn = SvCUR(s->var); } else s->posn = 0; SvSETMAGIC(s->var); return code; }
false
false
false
false
false
0
load_float(UnpicklerObject *self) { PyObject *value; char *endptr, *s; Py_ssize_t len; double d; if ((len = _Unpickler_Readline(self, &s)) < 0) return -1; if (len < 2) return bad_readline(); errno = 0; d = PyOS_string_to_double(s, &endptr, PyExc_OverflowError); if (d == -1.0 && PyErr_Occurred()) return -1; if ((endptr[0] != '\n') && (endptr[0] != '\0')) { PyErr_SetString(PyExc_ValueError, "could not convert string to float"); return -1; } value = PyFloat_FromDouble(d); if (value == NULL) return -1; PDATA_PUSH(self->stack, value, -1); return 0; }
false
false
false
false
false
0
type_eqv_(jl_value_t *a, jl_value_t *b) { if (a == b) return 1; if (jl_is_typector(a)) a = (jl_value_t*)((jl_typector_t*)a)->body; if (jl_is_typector(b)) b = (jl_value_t*)((jl_typector_t*)b)->body; if (jl_is_typevar(a)) { if (jl_is_typevar(b)) { return type_eqv_(((jl_tvar_t*)a)->ub, ((jl_tvar_t*)b)->ub) && type_eqv_(((jl_tvar_t*)a)->lb, ((jl_tvar_t*)b)->lb); } else { return 0; } } if (jl_is_long(a)) { if (jl_is_long(b)) return (jl_unbox_long(a) == jl_unbox_long(b)); return 0; } if (jl_is_tuple(a)) { if (jl_is_tuple(b)) { return extensionally_same_type(a, b); } return 0; } if (jl_is_union_type(a)) { if (jl_is_union_type(b)) { return extensionally_same_type(a, b); } return 0; } if (jl_is_func_type(a)) { if (jl_is_func_type(b)) { return (type_eqv_((jl_value_t*)((jl_func_type_t*)a)->from, (jl_value_t*)((jl_func_type_t*)b)->from) && type_eqv_((jl_value_t*)((jl_func_type_t*)a)->to, (jl_value_t*)((jl_func_type_t*)b)->to)); } return 0; } assert(jl_is_some_tag_type(a)); if (!jl_is_some_tag_type(b)) return 0; jl_tag_type_t *tta = (jl_tag_type_t*)a; jl_tag_type_t *ttb = (jl_tag_type_t*)b; if (tta->name != ttb->name) return 0; jl_tuple_t *ap = tta->parameters; jl_tuple_t *bp = ttb->parameters; assert(ap->length == bp->length); size_t i; for(i=0; i < ap->length; i++) { jl_value_t *api = jl_tupleref(ap,i); jl_value_t *bpi = jl_tupleref(bp,i); if (api == bpi) continue; if (!type_eqv_(api, bpi)) return 0; } return 1; }
false
false
false
false
false
0
ECPGtrans(int lineno, const char *connection_name, const char *transaction) { PGresult *res; struct connection *con = ecpg_get_connection(connection_name); if (!ecpg_init(con, connection_name, lineno)) return (false); ecpg_log("ECPGtrans line %d action = %s connection = %s\n", lineno, transaction, con ? con->name : "(nil)"); /* if we have no connection we just simulate the command */ if (con && con->connection) { /* * If we got a transaction command but have no open transaction, we * have to start one, unless we are in autocommit, where the * developers have to take care themselves. However, if the command is * a begin statement, we just execute it once. */ if (con->committed && !con->autocommit && strncmp(transaction, "begin", 5) != 0 && strncmp(transaction, "start", 5) != 0) { res = PQexec(con->connection, "begin transaction"); if (!ecpg_check_PQresult(res, lineno, con->connection, ECPG_COMPAT_PGSQL)) return FALSE; PQclear(res); } res = PQexec(con->connection, transaction); if (!ecpg_check_PQresult(res, lineno, con->connection, ECPG_COMPAT_PGSQL)) return FALSE; PQclear(res); } if (strcmp(transaction, "commit") == 0 || strcmp(transaction, "rollback") == 0) con->committed = true; else con->committed = false; return true; }
false
false
false
false
false
0
find_nested_options(struct isl_args *args, void *opt, struct isl_args *wanted) { int i; struct isl_options *options; if (args == wanted) return opt; for (i = 0; args->args[i].type != isl_arg_end; ++i) { struct isl_arg *arg = &args->args[i]; void *child; if (arg->type != isl_arg_child) continue; if (arg->offset == (size_t) -1) child = opt; else child = *(void **)(((char *)opt) + arg->offset); options = find_nested_options(arg->u.child.child, child, wanted); if (options) return options; } return NULL; }
false
false
false
false
false
0
rinoo_http_destroy(t_http *http) { if (http->request.buffer != NULL) { buffer_destroy(http->request.buffer); http->request.buffer = NULL; } if (http->response.buffer != NULL) { buffer_destroy(http->response.buffer); http->response.buffer = NULL; } rinoo_http_headers_flush(&http->request.headers); rinoo_http_headers_flush(&http->response.headers); }
false
false
false
false
false
0
addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpellState state /*= PETSPELL_NEW*/, PetSpellType type /*= PETSPELL_NORMAL*/) { SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id); if (!spellInfo) { // do pet spell book cleanup if (state == PETSPELL_UNCHANGED) // spell load case { sLog.outError("Pet::addSpell: nonexistent in SpellStore spell #%u request, deleting for all pets in `pet_spell`.", spell_id); CharacterDatabase.PExecute("DELETE FROM pet_spell WHERE spell = '%u'", spell_id); } else { sLog.outError("Pet::addSpell: nonexistent in SpellStore spell #%u request.", spell_id); } return false; } PetSpellMap::iterator itr = m_spells.find(spell_id); if (itr != m_spells.end()) { if (itr->second.state == PETSPELL_REMOVED) { m_spells.erase(itr); state = PETSPELL_CHANGED; } else if (state == PETSPELL_UNCHANGED && itr->second.state != PETSPELL_UNCHANGED) { // can be in case spell loading but learned at some previous spell loading itr->second.state = PETSPELL_UNCHANGED; if (active == ACT_ENABLED) { ToggleAutocast(spell_id, true); } else if (active == ACT_DISABLED) { ToggleAutocast(spell_id, false); } return false; } else { return false; } } PetSpell newspell; newspell.state = state; newspell.type = type; if (active == ACT_DECIDE) // active was not used before, so we save it's autocast/passive state here { if (IsPassiveSpell(spellInfo)) { newspell.active = ACT_PASSIVE; } else { newspell.active = ACT_DISABLED; } } else { newspell.active = active; } if (sSpellMgr.GetSpellRank(spell_id) != 0) { for (PetSpellMap::const_iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2) { if (itr2->second.state == PETSPELL_REMOVED) continue; uint32 const oldspell_id = itr2->first; if (sSpellMgr.IsRankSpellDueToSpell(spellInfo, oldspell_id)) { // replace by new high rank if (sSpellMgr.IsHighRankOfSpell(spell_id, oldspell_id)) { newspell.active = itr2->second.active; if (newspell.active == ACT_ENABLED) { ToggleAutocast(oldspell_id, false); } unlearnSpell(oldspell_id, false, false); break; } // ignore new lesser rank else if (sSpellMgr.IsHighRankOfSpell(oldspell_id, spell_id)) { return false; } } } } m_spells[spell_id] = newspell; if (IsPassiveSpell(spellInfo)) { CastSpell(this, spell_id, true); } else { m_charmInfo->AddSpellToActionBar(spell_id, ActiveStates(newspell.active)); } if (newspell.active == ACT_ENABLED) { ToggleAutocast(spell_id, true); } return true; }
false
false
false
false
false
0
getselectedjob_chk(const ULONG priv) { const Hashspq *result = getselectedjob(); const struct spq *rj; if (!result) { doerror(Job_seg.njobs != 0? 314: 315); /* {No job selected} {No jobs to select} */ return NULL; } rj = &result->j; /* Set priv to 0 if no check required */ if (priv) { if (!(mypriv->spu_flgs & priv) && strcmp(Realuname, rj->spq_uname) != 0) { disp_str = rj->spq_file; disp_str2 = rj->spq_uname; doerror(priv == PV_VOTHERJ? 336: 3004); /* {xmspq job not readable} {spq job not yours} */ return NULL; } if (rj->spq_netid && !(mypriv->spu_flgs & PV_REMOTEJ)) { doerror(3011); /* {spq no remote job priv} */ return NULL; } } JREQ = *rj; JREQS = result - Job_seg.jlist; return rj; }
false
false
false
false
false
0
pppoe_seq_next(struct seq_file *seq, void *v, loff_t *pos) { struct pppoe_net *pn = pppoe_pernet(seq_file_net(seq)); struct pppox_sock *po; ++*pos; if (v == SEQ_START_TOKEN) { po = pppoe_get_idx(pn, 0); goto out; } po = v; if (po->next) po = po->next; else { int hash = hash_item(po->pppoe_pa.sid, po->pppoe_pa.remote); po = NULL; while (++hash < PPPOE_HASH_SIZE) { po = pn->hash_table[hash]; if (po) break; } } out: return po; }
false
false
false
false
false
0
_job_timed_out(struct job_record *job_ptr) { xassert(job_ptr); if (job_ptr->details) { time_t now = time(NULL); job_ptr->end_time = now; job_ptr->time_last_active = now; job_ptr->job_state = JOB_TIMEOUT | JOB_COMPLETING; build_cg_bitmap(job_ptr); job_ptr->exit_code = MAX(job_ptr->exit_code, 1); job_completion_logger(job_ptr, false); deallocate_nodes(job_ptr, true, false, false); } else job_signal(job_ptr->job_id, SIGKILL, 0, 0, false); return; }
false
false
false
false
false
0
ar9003_hw_get_max_edge_power(struct ar9300_eeprom *eep, u16 freq, int idx, bool is2GHz) { u16 twiceMaxEdgePower = MAX_RATE_POWER; u8 *ctl_freqbin = is2GHz ? &eep->ctl_freqbin_2G[idx][0] : &eep->ctl_freqbin_5G[idx][0]; u16 num_edges = is2GHz ? AR9300_NUM_BAND_EDGES_2G : AR9300_NUM_BAND_EDGES_5G; unsigned int edge; /* Get the edge power */ for (edge = 0; (edge < num_edges) && (ctl_freqbin[edge] != AR5416_BCHAN_UNUSED); edge++) { /* * If there's an exact channel match or an inband flag set * on the lower channel use the given rdEdgePower */ if (freq == ath9k_hw_fbin2freq(ctl_freqbin[edge], is2GHz)) { twiceMaxEdgePower = ar9003_hw_get_direct_edge_power(eep, idx, edge, is2GHz); break; } else if ((edge > 0) && (freq < ath9k_hw_fbin2freq(ctl_freqbin[edge], is2GHz))) { twiceMaxEdgePower = ar9003_hw_get_indirect_edge_power(eep, idx, edge, freq, is2GHz); /* * Leave loop - no more affecting edges possible in * this monotonic increasing list */ break; } } if (is2GHz && !twiceMaxEdgePower) twiceMaxEdgePower = 60; return twiceMaxEdgePower; }
false
false
false
false
false
0
console_init(void) { #ifdef VT_OPENQRY int vtno; #endif char *s; s = getenv("CONSOLE"); if (!s) s = getenv("console"); if (s) { int fd = open(s, O_RDWR | O_NONBLOCK | O_NOCTTY); if (fd >= 0) { dup2(fd, STDIN_FILENO); dup2(fd, STDOUT_FILENO); xmove_fd(fd, STDERR_FILENO); } dbg_message(L_LOG, "console='%s'", s); } else { /* Make sure fd 0,1,2 are not closed * (so that they won't be used by future opens) */ bb_sanitize_stdio(); // Users report problems // /* Make sure init can't be blocked by writing to stderr */ // fcntl(STDERR_FILENO, F_SETFL, fcntl(STDERR_FILENO, F_GETFL) | O_NONBLOCK); } s = getenv("TERM"); #ifdef VT_OPENQRY if (ioctl(STDIN_FILENO, VT_OPENQRY, &vtno) != 0) { /* Not a linux terminal, probably serial console. * Force the TERM setting to vt102 * if TERM is set to linux (the default) */ if (!s || strcmp(s, "linux") == 0) putenv((char*)"TERM=vt102"); if (!ENABLE_FEATURE_INIT_SYSLOG) log_console = NULL; } else #endif if (!s) putenv((char*)"TERM=" CONFIG_INIT_TERMINAL_TYPE); }
false
false
false
false
true
1
AppendString(const char* str) { int i = 0; while (str[i] != '\0' && cursor_ + i < end_) { cursor_[i] = str[i]; ++i; } cursor_ += i; }
false
false
false
false
false
0
cmd_rescope_name (WorkbookControl *wbc, GnmNamedExpr *nexpr, Sheet *scope) { CmdRescopeName *me; g_return_val_if_fail (wbc != NULL, TRUE); g_return_val_if_fail (nexpr != NULL, TRUE); g_return_val_if_fail (!expr_name_is_placeholder (nexpr), TRUE); expr_name_ref (nexpr); me = g_object_new (CMD_RESCOPE_NAME_TYPE, NULL); me->nexpr = nexpr; me->scope = scope; me->cmd.sheet = wb_control_cur_sheet (wbc); me->cmd.size = 1; me->cmd.cmd_descriptor = g_strdup_printf (_("Change Scope of Name %s"), expr_name_name (nexpr)); return gnm_command_push_undo (wbc, G_OBJECT (me)); }
false
false
false
false
false
0
Markup () { ostringstream oss; switch (parenthesis) { case 0: oss << "("; break; case 1: oss << "["; break; case 2: oss << "{"; break; } list<FormulaElt *>::iterator i, end = children.end(); for (i = children.begin (); i != end; i++) { oss << (*i)->Markup (); } switch (parenthesis) { case 0: oss << ")"; break; case 1: oss << "]"; break; case 2: oss << "}"; break; } oss << FormulaElt::Markup (); return oss.str (); }
false
false
false
false
false
0
playlist3_message_close(Playlist3MessagePlugin * self) { /* reset */ widget_added = FALSE; if (self->priv->error_visible) { self->priv->error_visible = FALSE; g_source_remove(self->priv->timeout_callback); if (pl3_xml) { GtkWidget *event = GTK_WIDGET(gtk_builder_get_object(pl3_xml, "error_event")); gtk_widget_hide(event); gtk_container_foreach(GTK_CONTAINER(event), (GtkCallback) (gtk_widget_destroy), NULL); } } self->priv->timeout_callback = 0; return FALSE; }
false
false
false
false
false
0
ompi_io_ompio_full_print_queue(int queue_type){ int ret = OMPI_SUCCESS; print_queue *q=NULL; ret = ompi_io_ompio_set_print_queue(&q, queue_type); assert ( ret != OMPI_ERROR); if (q->count < QUEUESIZE) return 0; else return 1; }
false
false
false
true
false
1
gt_bsPrint(FILE *fp, constBitString str, BitOffset offset, BitOffset numBits) { uint32_t accum = 0; unsigned bitsLeft = numBits, bitTop = offset%bitElemBits, bitsInAccum = 0; size_t elemStart = offset/bitElemBits; const BitElem *p = str + elemStart; char buf[sizeof (accum) * CHAR_BIT]; int ioGtError = 0; gt_assert(str); do { if (bitTop) { uint32_t mask; unsigned bits2Read = MIN(bitElemBits - bitTop, bitsLeft); unsigned unreadRightBits = (bitElemBits - bitTop - bits2Read); mask = (~((~(uint32_t)0) << bits2Read)) << unreadRightBits; ACCUM2FP(((*p++) & mask) >> unreadRightBits, bits2Read); bitsLeft -= bits2Read; } /* get bits from intervening elems */ while (bitsLeft >= bitElemBits && !ioGtError) { while (bitsLeft >= bitElemBits && sizeof (accum) * CHAR_BIT - bitElemBits >= bitsInAccum) { accum = accum << bitElemBits | (*p++); bitsLeft -= bitElemBits; bitsInAccum += bitElemBits; } ACCUM2FP(accum, bitsInAccum); accum = 0; bitsInAccum = 0; } if (ioGtError) break; /* get bits from last elem */ if (bitsLeft) { accum = ((*p) & ((~(uint32_t)0)<<(bitElemBits - bitsLeft))) >> (bitElemBits - bitsLeft); ACCUM2FP(accum, bitsLeft); } } while (0); return ioGtError?-1:0; }
true
true
false
false
false
1
generate_type_encode (const Symbol *s) { fprintf (codefile, "int ASN1CALL\n" "encode_%s(unsigned char *p HEIMDAL_UNUSED_ATTRIBUTE, size_t len HEIMDAL_UNUSED_ATTRIBUTE," " const %s *data, size_t *size)\n" "{\n", s->gen_name, s->gen_name); switch (s->type->type) { case TInteger: case TBoolean: case TOctetString: case TGeneralizedTime: case TGeneralString: case TTeletexString: case TUTCTime: case TUTF8String: case TPrintableString: case TIA5String: case TBMPString: case TUniversalString: case TVisibleString: case TNull: case TBitString: case TEnumerated: case TOID: case TSequence: case TSequenceOf: case TSet: case TSetOf: case TTag: case TType: case TChoice: fprintf (codefile, "size_t ret HEIMDAL_UNUSED_ATTRIBUTE = 0;\n" "size_t l HEIMDAL_UNUSED_ATTRIBUTE;\n" "int i HEIMDAL_UNUSED_ATTRIBUTE, e HEIMDAL_UNUSED_ATTRIBUTE;\n\n"); encode_type("data", s->type, "Top"); fprintf (codefile, "*size = ret;\n" "return 0;\n"); break; default: abort (); } fprintf (codefile, "}\n\n"); }
false
false
false
false
false
0
snd_timer_hw_open(snd_timer_t **handle, const char *name, int dev_class, int dev_sclass, int card, int device, int subdevice, int mode) { int fd, ver, tmode, ret; snd_timer_t *tmr; struct sndrv_timer_select sel; *handle = NULL; tmode = O_RDONLY; if (mode & SND_TIMER_OPEN_NONBLOCK) tmode |= O_NONBLOCK; fd = snd_open_device(SNDRV_FILE_TIMER, tmode); if (fd < 0) return -errno; if (ioctl(fd, SNDRV_TIMER_IOCTL_PVERSION, &ver) < 0) { ret = -errno; close(fd); return ret; } if (SNDRV_PROTOCOL_INCOMPATIBLE(ver, SNDRV_TIMER_VERSION_MAX)) { close(fd); return -SND_ERROR_INCOMPATIBLE_VERSION; } if (mode & SND_TIMER_OPEN_TREAD) { int arg = 1; if (ver < SNDRV_PROTOCOL_VERSION(2, 0, 3)) { ret = -ENOTTY; goto __no_tread; } if (ioctl(fd, SNDRV_TIMER_IOCTL_TREAD, &arg) < 0) { ret = -errno; __no_tread: close(fd); SNDMSG("extended read is not supported (SNDRV_TIMER_IOCTL_TREAD)"); return ret; } } memset(&sel, 0, sizeof(sel)); sel.id.dev_class = dev_class; sel.id.dev_sclass = dev_sclass; sel.id.card = card; sel.id.device = device; sel.id.subdevice = subdevice; if (ioctl(fd, SNDRV_TIMER_IOCTL_SELECT, &sel) < 0) { ret = -errno; close(fd); return ret; } tmr = (snd_timer_t *) calloc(1, sizeof(snd_timer_t)); if (tmr == NULL) { close(fd); return -ENOMEM; } tmr->type = SND_TIMER_TYPE_HW; tmr->version = ver; tmr->mode = tmode; tmr->name = strdup(name); tmr->poll_fd = fd; tmr->ops = &snd_timer_hw_ops; INIT_LIST_HEAD(&tmr->async_handlers); *handle = tmr; return 0; }
false
false
false
false
false
0
pmon(gn_data *data, struct gn_statemachine *state) { gn_error error; /* Initialise the code for the GSM interface. */ error = gn_gsm_initialise(state); if (error != GN_ERR_NONE) { fprintf(stderr, _("GSM/FBUS init failed! (Unknown model?). Quitting.\n")); return error; } while (1) { usleep(50000); } return GN_ERR_NONE; }
false
false
false
false
true
1
operator()(Actor* self, bool force) { if (self->getExp() >= 1 && self->getHealth() < self->getMaxHealth()) { self->addExp(-1); self->hurt(-3); self->msgs.push_back("You feel a bit better."); return true; } return false; }
false
false
false
false
false
0
q_add(const char *str) { if (str) q_add_length(str, strlen(str)); }
false
false
false
false
false
0
init_values(const XAP_EncodingManager* that) { const char * ucs4i = ucs4Internal (); const char * naten = that->getNativeEncodingName (); iconv_handle_N2U = UT_iconv_open (ucs4i, naten); if (!UT_iconv_isValid(iconv_handle_N2U)) { UT_DEBUGMSG(("WARNING: UT_iconv_open(%s,%s) failed!\n",ucs4i,naten)); } iconv_handle_U2N = UT_iconv_open (naten, ucs4i); if (!UT_iconv_isValid(iconv_handle_U2N)) { UT_DEBUGMSG(("WARNING: UT_iconv_open(%s,%s) failed!\n",naten,ucs4i)); } iconv_handle_U2Latin1 = UT_iconv_open ("ISO-8859-1", ucs4i); if (!UT_iconv_isValid(iconv_handle_U2Latin1)) { UT_DEBUGMSG(("WARNING: UT_iconv_open(ISO-8859-1,%s) failed!\n",ucs4i)); } char* winencname = wvLIDToCodePageConverter(that->getWinLanguageCode()); iconv_handle_Win2U = UT_iconv_open(ucs4Internal(),winencname); iconv_handle_U2Win = UT_iconv_open(winencname,ucs4Internal()); }
false
false
false
false
false
0
isakmp_attr_print(const u_char *p, const u_char *ep) { u_int16_t *q; int totlen; u_int32_t t; q = (u_int16_t *)p; if (p[0] & 0x80) totlen = 4; else totlen = 4 + EXTRACT_16BITS(&q[1]); if (ep < p + totlen) { printf("[|attr]"); return ep + 1; } printf("("); t = EXTRACT_16BITS(&q[0]) & 0x7fff; printf("type=#%d ", t); if (p[0] & 0x80) { printf("value="); t = q[1]; rawprint((caddr_t)&q[1], 2); } else { printf("len=%d value=", EXTRACT_16BITS(&q[1])); rawprint((caddr_t)&p[2], EXTRACT_16BITS(&q[1])); } printf(")"); return p + totlen; }
false
false
false
false
false
0
CvtStringToGridType(dpy, args, num_args, from, to, data) Display *dpy; XrmValuePtr args; Cardinal *num_args; XrmValuePtr from, to; XtPointer *data; { static unsigned char grid_type; String start = from->addr; if (*num_args != 0) XtAppWarningMsg( XtDisplayToApplicationContext(dpy), "cvtStringToGridType", "wrongParameters", "XbaeMatrix", "String to GridType conversion needs no extra arguments", NULL, NULL); /* * User didn't provide enough space */ if (to->addr != NULL && to->size < sizeof(unsigned char)) { to->size = sizeof(unsigned char); return False; } /* * Skip leading white space */ while (isspace(*start)) start++; if (StringsAreEqual(start, "grid_none", 9)) grid_type = XmGRID_NONE; else if (StringsAreEqual(start, "grid_cell_line", 14)) grid_type = XmGRID_CELL_LINE; else if (StringsAreEqual(start, "grid_cell_shadow", 16)) grid_type = XmGRID_CELL_SHADOW; else if (StringsAreEqual(start, "grid_row_line", 13)) grid_type = XmGRID_ROW_LINE; else if (StringsAreEqual(start, "grid_row_shadow", 15)) grid_type = XmGRID_ROW_SHADOW; else if (StringsAreEqual(start, "grid_column_line", 16)) grid_type = XmGRID_COLUMN_LINE; else if (StringsAreEqual(start, "grid_column_shadow", 15)) grid_type = XmGRID_COLUMN_SHADOW; /* Deprecated types. To be removed in next version. */ else if (StringsAreEqual(start, "grid_line", 9)) grid_type = XmGRID_LINE; else if (StringsAreEqual(start, "grid_shadow_in", 14)) grid_type = XmGRID_SHADOW_IN; else if (StringsAreEqual(start, "grid_shadow_out", 15)) grid_type = XmGRID_SHADOW_OUT; else { XtDisplayStringConversionWarning(dpy, from->addr, XmRGridType); return False; } /* Deprecated types. To be removed in next version. */ if (grid_type >= XmGRID_LINE) XtAppWarningMsg( XtDisplayToApplicationContext(dpy), "cvtStringToGridType", "deprecatedType", "XbaeMatrix", "Value for GridType is deprecated and will be removed in next release", NULL, NULL); /* * Store our return value */ if (to->addr == NULL) to->addr = (XtPointer) &grid_type; else *(unsigned char *) to->addr = grid_type; to->size = sizeof(unsigned char); return True; }
false
false
false
false
false
0
make_oper_cache_key(ParseState *pstate, OprCacheKey *key, List *opname, Oid ltypeId, Oid rtypeId, int location) { char *schemaname; char *opername; /* deconstruct the name list */ DeconstructQualifiedName(opname, &schemaname, &opername); /* ensure zero-fill for stable hashing */ MemSet(key, 0, sizeof(OprCacheKey)); /* save operator name and input types into key */ strlcpy(key->oprname, opername, NAMEDATALEN); key->left_arg = ltypeId; key->right_arg = rtypeId; if (schemaname) { ParseCallbackState pcbstate; /* search only in exact schema given */ setup_parser_errposition_callback(&pcbstate, pstate, location); key->search_path[0] = LookupExplicitNamespace(schemaname, false); cancel_parser_errposition_callback(&pcbstate); } else { /* get the active search path */ if (fetch_search_path_array(key->search_path, MAX_CACHED_PATH_LEN) > MAX_CACHED_PATH_LEN) return false; /* oops, didn't fit */ } return true; }
false
false
false
false
false
0
bisho_pane_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { BishoPane *pane = BISHO_PANE (object); switch (property_id) { case PROP_SERVICE: { GtkTextBuffer *buffer; GtkTextIter end; char *s; pane->info = g_value_get_pointer (value); buffer = mux_label_get_buffer (MUX_LABEL (pane->description)); if (pane->info->description) { gtk_text_buffer_get_end_iter (buffer, &end); gtk_text_buffer_insert (buffer, &end, pane->info->description, -1); } if (pane->info->link) { GtkTextTag *tag; gtk_text_buffer_get_end_iter (buffer, &end); tag = mux_label_create_link_tag (MUX_LABEL (pane->description), pane->info->link); gtk_text_buffer_insert (buffer, &end, " ", -1); gtk_text_buffer_insert_with_tags (buffer, &end, _("Launch site for more information."), -1, tag, NULL); } s = g_strdup_printf (_("<small>You'll need an account with %s and an Internet connection to use this web service.</small>"), pane->info->display_name); gtk_label_set_markup (GTK_LABEL (pane->disclaimer), s); g_free (s); } break; case PROP_SOCIALWEB: pane->socialweb = g_value_dup_object (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } }
false
false
false
false
false
0
gspca_dev_probe(struct usb_interface *intf, const struct usb_device_id *id, const struct sd_desc *sd_desc, int dev_size, struct module *module) { struct usb_device *dev = interface_to_usbdev(intf); /* we don't handle multi-config cameras */ if (dev->descriptor.bNumConfigurations != 1) { pr_err("%04x:%04x too many config\n", id->idVendor, id->idProduct); return -ENODEV; } /* the USB video interface must be the first one */ if (dev->actconfig->desc.bNumInterfaces != 1 && intf->cur_altsetting->desc.bInterfaceNumber != 0) return -ENODEV; return gspca_dev_probe2(intf, id, sd_desc, dev_size, module); }
false
false
false
false
false
0
format_template_member_free (TemplateMember *member) { g_return_if_fail (member != NULL); if (member->mstyle) { gnm_style_unref (member->mstyle); member->mstyle = NULL; } g_free (member); }
false
false
false
false
false
0
GetFloatArray(float** pfData) { if (*pfData == NULL) *pfData = new float[4*m_iSize.area()]; RenderTransferFunction(); memcpy(*pfData, m_pColorData->GetDataPointer(), 4*sizeof(float)*m_iSize.area()); }
false
false
false
false
false
0
pm8001_set_phy_profile_single(struct pm8001_hba_info *pm8001_ha, u32 phy, u32 length, u32 *buf) { u32 tag, opc; int rc, i; struct set_phy_profile_req payload; struct inbound_queue_table *circularQ; memset(&payload, 0, sizeof(payload)); rc = pm8001_tag_alloc(pm8001_ha, &tag); if (rc) PM8001_INIT_DBG(pm8001_ha, pm8001_printk("Invalid tag")); circularQ = &pm8001_ha->inbnd_q_tbl[0]; opc = OPC_INB_SET_PHY_PROFILE; payload.tag = cpu_to_le32(tag); payload.ppc_phyid = (((SAS_PHY_ANALOG_SETTINGS_PAGE & 0xF) << 8) | (phy & 0xFF)); for (i = 0; i < length; i++) payload.reserved[i] = cpu_to_le32(*(buf + i)); rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 0); if (rc) pm8001_tag_free(pm8001_ha, tag); PM8001_INIT_DBG(pm8001_ha, pm8001_printk("PHY %d settings applied", phy)); }
false
false
false
false
false
0
check_change(void) {int n=0; if(!lines_match())return; print_where=true; do {changing=true;/*39:*/ #line 560 "common.w" {if(++change_line,!input_ln(change_file)) {loc= &buffer[0];err_print("! Change file ended before @y"); change_limit=change_buffer;changing=false;return; } if(limit> &buffer[1]&&buffer[0]=='@') if(buffer[1]=='y')break; else if(buffer[1]=='x'||buffer[1]=='z') {loc= &buffer[2];err_print("! Where is the matching @y?");} else/*35:*/ #line 497 "common.w" {if(buffer[1]=='i'&&!compatibility_mode) {loc= &buffer[2];err_print("! No includes allowed in change file");} }/*:35*//*37:*/ #line 512 "common.w" {int n=(int)(limit-buffer);change_limit=change_buffer+n; strncpy(change_buffer,buffer,n); }/*:37*/ #line 572 "common.w" }/*:39*/ #line 538 "common.w" changing=false; if(!get_web_line()) {loc= &buffer[0]; err_print("! CWEB file ended during a change");return; } if(!lines_match())++n; }while(true); if(n>0) {loc= &buffer[2]; print("\n! Hmm... %d of the preceding lines failed to match",n); err_print(""); } }
false
false
false
false
false
0
ms_biff_bof_data_new (BiffQuery *q) { MsBiffBofData *ans = g_new (MsBiffBofData, 1); if (q->length >= 4) { /* Determine type from BOF */ switch (q->opcode) { case BIFF_BOF_v0: ans->version = MS_BIFF_V2; break; case BIFF_BOF_v2: ans->version = MS_BIFF_V3; break; case BIFF_BOF_v4: ans->version = MS_BIFF_V4; break; case BIFF_BOF_v8: d (2, { g_printerr ("Complicated BIFF version 0x%x\n", GSF_LE_GET_GUINT16 (q->non_decrypted_data)); gsf_mem_dump (q->non_decrypted_data, q->length); }); switch (GSF_LE_GET_GUINT16 (q->non_decrypted_data)) { case 0x0600: ans->version = MS_BIFF_V8; break; case 0x0500: /* * OR ebiff7: FIXME ? ! */ ans->version = MS_BIFF_V7; break; /* The following are non-standard records written by buggy tools. Taken from OO docs. */ case 0x0400: ans->version = MS_BIFF_V4; break; case 0x0300: ans->version = MS_BIFF_V3; break; case 0x0200: case 0x0007: case 0x0000: ans->version = MS_BIFF_V2; break; default: g_printerr ("Unknown BIFF sub-number 0x%X in BOF %x\n", GSF_LE_GET_GUINT16 (q->non_decrypted_data), q->opcode); ans->version = MS_BIFF_V_UNKNOWN; } break; default: g_printerr ("Unknown BIFF number in BOF %x\n", q->opcode); ans->version = MS_BIFF_V_UNKNOWN; g_printerr ("Biff version %d\n", ans->version); } switch (GSF_LE_GET_GUINT16 (q->non_decrypted_data + 2)) { case 0x0005: ans->type = MS_BIFF_TYPE_Workbook; break; case 0x0006: ans->type = MS_BIFF_TYPE_VBModule; break; case 0x0010: ans->type = MS_BIFF_TYPE_Worksheet; break; case 0x0020: ans->type = MS_BIFF_TYPE_Chart; break; case 0x0040: ans->type = MS_BIFF_TYPE_Macrosheet; break; case 0x0100: ans->type = MS_BIFF_TYPE_Workspace; break; default: ans->type = MS_BIFF_TYPE_Unknown; g_printerr ("Unknown BIFF type in BOF %x\n", GSF_LE_GET_GUINT16 (q->non_decrypted_data + 2)); break; } /* Now store in the directory array: */ d (2, g_printerr ("BOF %x, %d == %d, %d\n", q->opcode, q->length, ans->version, ans->type);); } else { g_printerr ("Not a BOF !\n"); ans->version = MS_BIFF_V_UNKNOWN; ans->type = MS_BIFF_TYPE_Unknown; } return ans; }
false
false
false
false
false
0
check_printable(char *id, int maxlen) { static char buffer[MAX_IDLEN]; char *idval,*bufval; int i = 0; memset(buffer,'\0',MAX_IDLEN); if(maxlen > MAX_IDLEN) maxlen = MAX_IDLEN; bufval = buffer; for(idval = id; idval && (i < maxlen - 1); ++idval,++bufval,++i) if(!isprint(*idval)) { *bufval = '\0'; break; } else *bufval = *idval; return(buffer); }
true
true
false
false
false
1
snic_fwcq_cmpl_handler(struct snic *snic, int io_cmpl_work) { unsigned int num_ent = 0; /* number cq entries processed */ unsigned int cq_idx; unsigned int nent_per_cq; struct snic_misc_stats *misc_stats = &snic->s_stats.misc; for (cq_idx = snic->wq_count; cq_idx < snic->cq_count; cq_idx++) { nent_per_cq = vnic_cq_fw_service(&snic->cq[cq_idx], snic_io_cmpl_handler, io_cmpl_work); num_ent += nent_per_cq; if (nent_per_cq > atomic64_read(&misc_stats->max_cq_ents)) atomic64_set(&misc_stats->max_cq_ents, nent_per_cq); } return num_ent; }
false
false
false
false
false
0
configure(Vector<String> &conf, ErrorHandler *errh) { String arg; _incremental = _unshift_ip_addr = false; if (Args(conf, this, errh) .read_mp("FIELD", AnyArg(), arg) .read("INCREMENTAL", _incremental) .read("UNSHIFT_IP_ADDR", _unshift_ip_addr) .complete() < 0) return -1; const char *end = IPField::parse(arg.begin(), arg.end(), -1, &_f, errh, this); if (end == arg.begin()) return -1; else if (end != arg.end()) return errh->error("garbage after field specification"); int32_t right = _f.bit_offset() + _f.bit_length() - 1; if ((_f.bit_offset() / 32) != (right / 32)) return errh->error("field specification does not fit within a single word"); if (_f.bit_length() > 32) return errh->error("field length too large, max 32"); else if (_f.bit_length() == 32 && _incremental) return errh->error("'INCREMENTAL' is incompatible with field length 32"); if (_f.bit_length() == 32) _mask = 0xFFFFFFFFU; else _mask = (1 << _f.bit_length()) - 1; _offset = (_f.bit_offset() / 32) * 4; if (!_unshift_ip_addr || _f.proto() != 0 || _f.bit_offset() < 12*8 || _f.bit_offset() >= 20*8) _shift = 31 - right % 32; else { _mask <<= 31 - right % 32; _shift = 0; } return 0; }
false
false
false
false
false
0
suspend_activities(bool called_from_worker) { #ifdef DEBUG_BOINC_API char log_buf[256]; fprintf(stderr, "%s suspend_activities() called from %s\n", boinc_msg_prefix(log_buf, sizeof(log_buf)), called_from_worker?"worker thread":"timer thread" ); #endif #ifdef _WIN32 static vector<int> pids; if (options.multi_thread) { if (pids.size() == 0) { pids.push_back(GetCurrentProcessId()); } suspend_or_resume_threads(pids, timer_thread_id, false, true); } else { SuspendThread(worker_thread_handle); } #else if (options.multi_process) { suspend_or_resume_descendants(false); } // if called from worker thread, sleep until suspension is over // if called from time thread, don't need to do anything; // suspension is done by signal handler in worker thread // if (called_from_worker) { while (boinc_status.suspended) { sleep(1); } } #endif return 0; }
false
false
false
false
false
0
H5B2_test_decode(const uint8_t *raw, void *nrecord, void *_ctx) { H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */ FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ HDassert(ctx); H5F_DECODE_LENGTH_LEN(raw, *(hsize_t *)nrecord, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) }
false
false
false
false
false
0
intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request) { int ret = 0; request->ringbuf = request->ctx->engine[request->engine->id].ringbuf; if (i915.enable_guc_submission) { /* * Check that the GuC has space for the request before * going any further, as the i915_add_request() call * later on mustn't fail ... */ struct intel_guc *guc = &request->i915->guc; ret = i915_guc_wq_check_space(guc->execbuf_client); if (ret) return ret; } if (request->ctx != request->i915->kernel_context) ret = intel_lr_context_pin(request->ctx, request->engine); return ret; }
false
false
false
false
false
0
ajFileNewOutNameDirS(const AjPStr name, const AjPDirout dir) { AjPFile thys; ajDebug("ajFileNewOutNameDirS('%S' '%S')\n", dir->Name, name); AJNEW0(thys); if(!dir) { #ifdef WIN32 if(ajStrMatchC(name, "/dev/null")) thys->fp = fopen("NUL", "wb"); else #endif /* WIN32 */ thys->fp = fopen(ajStrGetPtr(name), "wb"); ajDebug("ajFileNewOutNameDirS open name '%S'\n", name); } else { if(ajFilenameHasPath(name)) ajStrAssignS(&fileDirfixTmp, name); else { ajStrAssignS(&fileDirfixTmp, dir->Name); if(ajStrGetCharLast(dir->Name) != SLASH_CHAR) ajStrAppendC(&fileDirfixTmp, SLASH_STRING); ajStrAppendS(&fileDirfixTmp, name); } ajFilenameSetExtS(&fileDirfixTmp, dir->Extension); thys->fp = fopen(ajStrGetPtr(fileDirfixTmp), "wb"); ajDebug("ajFileNewOutNameDirS open dirfix '%S'\n", fileDirfixTmp); } if(!thys->fp) { ajWarn("Failed to open output file '%S' in directory '%S' " "error:%d '%s'", name, dir, errno, strerror(errno)); thys->Handle = 0; return NULL; } thys->Handle = ++fileHandle; ajStrAssignS(&thys->Name, name); filePrintname(thys->Name, &thys->Printname); thys->End = ajFalse; fileOpenCnt++; fileOpenTot++; if(fileOpenCnt > fileOpenMax) fileOpenMax = fileOpenCnt; return thys; }
false
false
false
false
true
1
restore_node_features(int recover) { int i; struct node_record *node_ptr; for (i=0, node_ptr=node_record_table_ptr; i<node_record_count; i++, node_ptr++) { if (node_ptr->weight != node_ptr->config_ptr->weight) { error("Node %s Weight(%u) differ from slurm.conf", node_ptr->name, node_ptr->weight); if (recover == 2) { _update_node_weight(node_ptr->name, node_ptr->weight); } else { node_ptr->weight = node_ptr->config_ptr-> weight; } } if (_strcmp(node_ptr->config_ptr->feature, node_ptr->features)){ error("Node %s Features(%s) differ from slurm.conf", node_ptr->name, node_ptr->features); if (recover == 2) { _update_node_features(node_ptr->name, node_ptr->features); } else { xfree(node_ptr->features); node_ptr->features = xstrdup(node_ptr-> config_ptr-> feature); } } /* We lose the gres information updated manually and always * use the information from slurm.conf */ (void) gres_plugin_node_reconfig(node_ptr->name, node_ptr->config_ptr->gres, &node_ptr->gres, &node_ptr->gres_list, slurmctld_conf.fast_schedule); gres_plugin_node_state_log(node_ptr->gres_list, node_ptr->name); } }
false
false
false
false
false
0
paintEvent(QPaintEvent * event) { // unbreak painting QToolButton::paintEvent(event); // draw mark if (m_markOpacity > 0.0 && !m_markPixmap.isNull()) { QPainter p(this); if (m_markOpacity < 1.0) p.setOpacity(m_markOpacity); p.drawPixmap(width() - m_markPixmap.width(), 0, m_markPixmap); } }
false
false
false
false
false
0
DtsSetInputFormat( HANDLE hDevice, BC_INPUT_FORMAT *pInputFormat ) { DTS_LIB_CONTEXT *Ctx = NULL; uint32_t videoAlgo = BC_VID_ALGO_H264; uint32_t ScaledWidth = 0; DTS_GET_CTX(hDevice,Ctx); Ctx->VidParams.MediaSubType = pInputFormat->mSubtype; Ctx->VidParams.WidthInPixels = pInputFormat->width; Ctx->VidParams.HeightInPixels = pInputFormat->height; if (pInputFormat->startCodeSz) Ctx->VidParams.StartCodeSz = pInputFormat->startCodeSz; else Ctx->VidParams.StartCodeSz = BRCM_START_CODE_SIZE; if (pInputFormat->metaDataSz) { if(Ctx->VidParams.pMetaData){ DebugLog_Trace(LDIL_DBG,"deleting buffer\n"); free(Ctx->VidParams.pMetaData); } Ctx->VidParams.pMetaData = (uint8_t*)malloc(pInputFormat->metaDataSz); memcpy(Ctx->VidParams.pMetaData, pInputFormat->pMetaData, pInputFormat->metaDataSz); Ctx->VidParams.MetaDataSz = pInputFormat->metaDataSz; } if(Ctx->VidParams.MediaSubType == BC_MSUBTYPE_H264 || Ctx->VidParams.MediaSubType== BC_MSUBTYPE_AVC1) { videoAlgo = BC_VID_ALGO_H264; } else if (Ctx->VidParams.MediaSubType==BC_MSUBTYPE_DIVX) { videoAlgo = BC_VID_ALGO_DIVX; } else if(Ctx->VidParams.MediaSubType == BC_MSUBTYPE_MPEG2VIDEO ) { videoAlgo = BC_VID_ALGO_MPEG2; } else if(Ctx->VidParams.MediaSubType == BC_MSUBTYPE_WVC1 || Ctx->VidParams.MediaSubType == BC_MSUBTYPE_WMVA ||Ctx->VidParams.MediaSubType == BC_MSUBTYPE_VC1) { videoAlgo = BC_VID_ALGO_VC1; } else if (Ctx->VidParams.MediaSubType == BC_MSUBTYPE_WMV3) { videoAlgo = BC_VID_ALGO_VC1MP; // Main Profile } if (Ctx->DevId == BC_PCI_DEVID_FLEA || Ctx->VidParams.MediaSubType == BC_MSUBTYPE_WMV3) Ctx->VidParams.StreamType = BC_STREAM_TYPE_PES; else Ctx->VidParams.StreamType = BC_STREAM_TYPE_ES; DtsSetVideoParams(hDevice, videoAlgo, pInputFormat->FGTEnable, pInputFormat->MetaDataEnable, pInputFormat->Progressive, pInputFormat->OptFlags); DtsSetPESConverter(hDevice); if(Ctx->DevId == BC_PCI_DEVID_FLEA) { if(Ctx->SingleThreadedAppMode) { pInputFormat->bEnableScaling = true; pInputFormat->ScalingParams.sWidth = 1280; } if(pInputFormat->bEnableScaling) { if((pInputFormat->ScalingParams.sWidth > 1920)|| (pInputFormat->ScalingParams.sWidth < 128)) ScaledWidth = 1280; else ScaledWidth = pInputFormat->ScalingParams.sWidth; Ctx->EnableScaling = (ScaledWidth << 20) | (ScaledWidth << 8) | pInputFormat->bEnableScaling; } else { Ctx->EnableScaling = 0; } Ctx->bEnable720pDropHalf = 0; } return DtsCheckProfile(hDevice); }
false
false
false
false
false
0
Forward (Event& e) { if (IsAChild(e.target)) { e.target->Handle(e); } else { Handle(e); } }
false
false
false
false
false
0
emi_pending_smsmessage(SMSCenter *smsc) { char *tmpbuff; int n = 0; /* time_t timenow; */ /* Block until we have a connection */ guarantee_link(smsc); /* If we have MO-message, then act (return 1) */ if (memorybuffer_has_rawmessage(smsc, 52, 'O') > 0 || memorybuffer_has_rawmessage(smsc, 1, 'O') > 0 ) return 1; tmpbuff = gw_malloc(10 * 1024); memset(tmpbuff, 0, 10*1024); /* check for data */ n = get_data(smsc, tmpbuff, 10 * 1024); if (n > 0) memorybuffer_insert_data(smsc, tmpbuff, n); /* delete all ACKs/NACKs/whatever */ while (memorybuffer_has_rawmessage(smsc, 51, 'R') > 0 || memorybuffer_has_rawmessage(smsc, 1, 'R') > 0) memorybuffer_cut_rawmessage(smsc, tmpbuff, 10*1024); gw_free(tmpbuff); /* If we have MO-message, then act (return 1) */ if (memorybuffer_has_rawmessage(smsc, 52, 'O') > 0 || memorybuffer_has_rawmessage(smsc, 1, 'O') > 0) return 1; /* time(&timenow); if( (smsc->emi_last_spoke + 60*20) < timenow) { time(&smsc->emi_last_spoke); } */ return 0; }
false
false
false
false
false
0
mv_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags) { struct mv_req *req = NULL; req = kzalloc(sizeof *req, gfp_flags); if (!req) return NULL; req->req.dma = DMA_ADDR_INVALID; INIT_LIST_HEAD(&req->queue); return &req->req; }
false
false
false
false
false
0
ReadInOneItem(char *ItemPointer, char *ItemsSectionEnd, item *TargetItem) { init_item(TargetItem); char *iname = ReadAndMallocStringFromData(ItemPointer, ITEM_NAME_STRING, "\""); TargetItem->type = GetItemIndexByName(iname); free(iname); ReadValueFromString(ItemPointer, ITEM_POS_X_STRING, "%f", &(TargetItem->pos.x), ItemsSectionEnd); ReadValueFromString(ItemPointer, ITEM_POS_Y_STRING, "%f", &(TargetItem->pos.y), ItemsSectionEnd); ReadValueFromStringWithDefault(ItemPointer, ITEM_ARMOR_CLASS_BASE_STRING, "%d", "0", &(TargetItem->armor_class), ItemsSectionEnd); ReadValueFromString(ItemPointer, ITEM_MAX_DURABILITY_STRING, "%d", &(TargetItem->max_durability), ItemsSectionEnd); ReadValueFromString(ItemPointer, ITEM_CUR_DURABILITY_STRING, "%f", &(TargetItem->current_durability), ItemsSectionEnd); ReadValueFromString(ItemPointer, ITEM_AMMO_CLIP_STRING, "%d", &(TargetItem->ammo_clip), ItemsSectionEnd); ReadValueFromString(ItemPointer, ITEM_MULTIPLICITY_STRING, "%d", &(TargetItem->multiplicity), ItemsSectionEnd); // Read the socket data of the item and calculate bonuses using it. int i; int socket_count; ReadValueFromStringWithDefault(ItemPointer, ITEM_SOCKETS_SIZE_STRING, "%d", "0", &socket_count, ItemsSectionEnd); for (i = 0; i < socket_count; i++) { char type_string[32]; char addon_string[32]; struct upgrade_socket socket; sprintf(type_string, "%s%d=", ITEM_SOCKET_TYPE_STRING, i); sprintf(addon_string, "%s%d=", ITEM_SOCKET_ADDON_STRING, i); ReadValueFromString(ItemPointer, type_string, "%d", &socket.type, ItemsSectionEnd); socket.addon = ReadAndMallocStringFromDataOptional(ItemPointer, addon_string, "\""); create_upgrade_socket(TargetItem, socket.type, socket.addon); free(socket.addon); } calculate_item_bonuses(TargetItem); DebugPrintf(1, "\nPosX=%f PosY=%f Item=%d", TargetItem->pos.x, TargetItem->pos.y, TargetItem->type); }
false
false
false
false
false
0
handle_print_numeric(const char *token, char *line) { const char *value; char *st; value = strtok_r(line, " \t\n", &st); if (value && ( (strcasecmp(value, "yes") == 0) || (strcasecmp(value, "true") == 0) || (*value == '1') )) { netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT, NETSNMP_OID_OUTPUT_NUMERIC); } }
false
false
false
false
false
0
ClearAnimObj(void) { register anim_t *obj; /* Leggo la lista al contrario per cancellare correttamente tutto */ for (obj = (anim_t *) DrawList.pTailPred; obj->node.mpPrev; obj = (anim_t *) obj->node.mpPrev) { if (obj->bg) { bltchunkybitmap(obj->bg, 0, 0, main_bitmap, obj->x_back, obj->y_back, obj->max_width, obj->max_height, obj->max_width, bitmap_width); /* if(double_buffering) { obj->x_back=obj->x_pos; obj->y_back=obj->y_pos; } */ } } }
false
false
false
false
false
0
vg_rule_add_tool (VgRule *rule, const char *tool) { VgTool *tail, *n; n = g_new (VgTool, 1); n->next = NULL; n->name = vg_strdup (tool); tail = (VgTool *) &rule->tools; while (tail->next != NULL) tail = tail->next; tail->next = n; }
false
false
false
false
false
0
flute_freq_free(flute_freq_susp_type susp) { deleteInstrument(susp->myflute); sound_unref(susp->breath_env); sound_unref(susp->freq_env); ffree_generic(susp, sizeof(flute_freq_susp_node), "flute_freq_free"); }
false
false
false
false
false
0
item_set_info_free (gpointer data) { item_set_info_args *args = data; g_assert (data); g_free (args->path); if (args->session) gkr_session_unref (args->session); gnome_keyring_item_info_free (args->info); g_slice_free (item_set_info_args, args); }
false
false
false
false
false
0
str_char (lua_State *L) { int n = lua_gettop(L); /* number of arguments */ int i; luaL_Buffer b; luaL_buffinit(L, &b); for (i=1; i<=n; i++) { int c = luaL_checkint(L, i); luaL_argcheck(L, uchar(c) == c, i, "invalid value"); luaL_putchar(&b, uchar(c)); } luaL_pushresult(&b); return 1; }
false
false
false
false
false
0
ibvs_cpu_write( IN ibvs_t* const p_ibvs, IN uint16_t lid, IN uint8_t size, IN uint8_t cpu_traget_size, IN uint32_t data[], IN uint32_t address) { ib_api_status_t status; osm_madw_t *p_madw_arr[1]; ib_vs_t res_mad; OSM_LOG_ENTER(&(IbisObj.log)); __ibvs_prep_ext_port_access_mad( p_ibvs, EXT_CPU_PORT, lid, VENDOR_SET, size, cpu_traget_size, 0, data, address, 0, 0, &p_madw_arr[0]); status = ibis_gsi_send_sync_mad_batch( &(IbisObj.mad_ctrl), p_ibvs->h_bind, 1, p_madw_arr, sizeof(ib_vs_t), (uint8_t*)&res_mad); if (status == IB_SUCCESS) status = ibis_get_mad_status((ib_mad_t*)&res_mad); OSM_LOG_EXIT(&(IbisObj.log)); return (status); }
false
false
false
false
false
0
_tenEMBimodalIterate(tenEMBimodalParm *biparm) { static const char me[]="_tenEMBimodalIterate"; double om1, os1, om2, os2, of1, m1, s1, m2, s2, f1; /* copy old values */ om1 = biparm->mean1; os1 = biparm->stdv1; of1 = biparm->fraction1; om2 = biparm->mean2; os2 = biparm->stdv2; /* find new values, and calculate delta */ _tenEMBimodalPP(biparm); f1 = _tenEMBimodalNewFraction1(biparm); /* if (1 == biparm->stage) { */ _tenEMBimodalNewMean(&m1, &m2, biparm); /* } */ _tenEMBimodalNewSigma(&s1, &s2, m1, m2, biparm); biparm->delta = ((fabs(m1 - om1) + fabs(m2 - om2) + fabs(s1 - os1) + fabs(s2 - os2))/biparm->N + fabs(f1 - of1)); /* set new values */ biparm->mean1 = m1; biparm->stdv1 = s1; biparm->fraction1 = f1; biparm->mean2 = m2; biparm->stdv2 = s2; if (biparm->verbose) { fprintf(stderr, "%s(%d:%d):\n", me, biparm->stage, biparm->iteration); fprintf(stderr, " m1, s1 = %g, %g\n", m1, s1); fprintf(stderr, " m2, s2 = %g, %g\n", m2, s2); fprintf(stderr, " f1 = %g ; delta = %g\n", f1, biparm->delta); } if (biparm->verbose > 1) { _tenEMBimodalSaveImage(biparm); } return 0; }
false
false
false
false
false
0
loc_buildplace( Figure ) schfig_list *Figure; { scpcol_list *Column; scpcol_list *MaxColumn; MaxColumn = loc_buildplacefirst( Figure ); for ( Column = MaxColumn; Column->NEXT; Column = Column->NEXT ) { loc_buildplaceout( Figure, Column, Column->NEXT ); } HEAD_SCPCOL = (scpcol_list *)reverse( (chain_list *)HEAD_SCPCOL ); for ( Column = MaxColumn; Column->NEXT; Column = Column->NEXT ) { loc_buildplacein(Figure, Column->NEXT, Column); } HEAD_SCPCOL = (scpcol_list *)reverse((chain_list *)HEAD_SCPCOL ); return ( Figure ); }
false
false
false
false
false
0
locate_sos_marker() { int c; c = process_markers(); if (c == M_EOI) { return JPGD_FALSE; } else if (c != M_SOS) { stop_decoding(JPGD_UNEXPECTED_MARKER); } read_sos_marker(); return JPGD_TRUE; }
false
false
false
false
false
0
ximageutil_xcontext_clear (GstXContext * xcontext) { g_return_if_fail (xcontext != NULL); if (xcontext->caps != NULL) gst_caps_unref (xcontext->caps); if (xcontext->par) { g_value_unset (xcontext->par); g_free (xcontext->par); } XCloseDisplay (xcontext->disp); g_free (xcontext); }
false
false
false
false
false
0
setup_ikconfig(char *config) { char *ent, *tokptr; struct ikconfig_list *new; ikconfig_all = calloc(1, sizeof(struct ikconfig_list) * IKCONFIG_MAX); if (!ikconfig_all) { error(WARNING, "cannot calloc for ikconfig entries.\n"); return 0; } ent = strtok_r(config, "\n", &tokptr); while (ent) { while (whitespace(*ent)) ent++; if (ent[0] != '#') { add_ikconfig_entry(ent, &ikconfig_all[kt->ikconfig_ents++]); if (kt->ikconfig_ents == IKCONFIG_MAX) { error(WARNING, "ikconfig overflow.\n"); return 1; } } ent = strtok_r(NULL, "\n", &tokptr); } if (kt->ikconfig_ents == 0) { free(ikconfig_all); return 0; } if ((new = realloc(ikconfig_all, sizeof(struct ikconfig_list) * kt->ikconfig_ents))) ikconfig_all = new; return 1; }
false
false
false
false
false
0
kvp_frame_set_slot_path_gslist (KvpFrame *frame, const KvpValue *new_value, GSList *key_path) { if (!frame || !key_path) return; while (TRUE) { const char *key = key_path->data; KvpValue *value; if (!key) return; g_return_if_fail (*key != '\0'); key_path = key_path->next; if (!key_path) { kvp_frame_set_slot (frame, key, new_value); return; } value = kvp_frame_get_slot (frame, key); if (!value) { KvpFrame *new_frame = kvp_frame_new (); KvpValue *frame_value = kvp_value_new_frame (new_frame); kvp_frame_set_slot_nc (frame, key, frame_value); value = kvp_frame_get_slot (frame, key); if (!value) return; } frame = kvp_value_get_frame (value); if (!frame) return; } }
false
false
false
false
false
0
onMouseButtonDown(MouseEventArgs& e) { // default processing (this is now essential as it controls event firing). Window::onMouseButtonDown(e); if (e.button == LeftButton) { if (isSizingEnabled()) { // get position of mouse as co-ordinates local to this window. Point localPos(CoordConverter::screenToWindow(*this, e.position)); // if the mouse is on the sizing border if (getSizingBorderAtPoint(localPos) != SizingNone) { // ensure all inputs come to us for now if (captureInput()) { // setup the 'dragging' state variables d_beingSized = true; d_dragPoint = localPos; // do drag-sizing started notification WindowEventArgs args(this); onDragSizingStarted(args); ++e.handled; } } } } }
false
false
false
false
false
0
bfa_cb_sfp_show(struct bfa_sfp_s *sfp) { bfa_trc(sfp, sfp->lock); if (sfp->cbfn) sfp->cbfn(sfp->cbarg, sfp->status); sfp->lock = 0; sfp->cbfn = NULL; }
false
false
false
false
false
0
gst_ring_buffer_debug_spec_buff (GstRingBufferSpec * spec) { GST_DEBUG ("acquire ringbuffer: buffer time: %" G_GINT64_FORMAT " usec", spec->buffer_time); GST_DEBUG ("acquire ringbuffer: latency time: %" G_GINT64_FORMAT " usec", spec->latency_time); GST_DEBUG ("acquire ringbuffer: total segments: %d", spec->segtotal); GST_DEBUG ("acquire ringbuffer: latency segments: %d", spec->seglatency); GST_DEBUG ("acquire ringbuffer: segment size: %d bytes = %d samples", spec->segsize, spec->segsize / spec->bytes_per_sample); GST_DEBUG ("acquire ringbuffer: buffer size: %d bytes = %d samples", spec->segsize * spec->segtotal, spec->segsize * spec->segtotal / spec->bytes_per_sample); }
false
false
false
false
false
0
SyfFsmGetMustangOut( FsmFigure ) fsmfig_list *FsmFigure; { syfinfo *SyfInfo; long *OutWeightArray; fsmout_list *ScanOut; fsmstate_list *ScanState; fsmlocout_list *ScanLocout; long NumberState; long NumberOut; long IndexState; long IndexOut; SyfInfo = FSM_SYF_INFO( FsmFigure ); NumberState = FsmFigure->NUMBER_STATE; NumberOut = FsmFigure->NUMBER_OUT; OutWeightArray = SyfInfo->MUSTANG_OUT; if ( OutWeightArray == (long *)0 ) { OutWeightArray = (long *)autallocblock( sizeof(long) * NumberState * NumberOut ); SyfInfo->MUSTANG_OUT = OutWeightArray; IndexOut = 0; for ( ScanOut = FsmFigure->OUT; ScanOut != (fsmout_list *)0; ScanOut = ScanOut->NEXT ) { FSM_SYF_OUT( ScanOut )->INDEX = IndexOut++; } } else { memset( OutWeightArray, 0, sizeof(long) * NumberState * NumberOut ); } IndexState = 0; for ( ScanState = FsmFigure->STATE; ScanState != (fsmstate_list *)0; ScanState = ScanState->NEXT ) { for ( ScanLocout = ScanState->LOCOUT; ScanLocout != (fsmlocout_list *)0; ScanLocout = ScanLocout->NEXT ) { IndexOut = FSM_SYF_OUT( ScanLocout->OUT )->INDEX; if ( SYF_MUSTANG_JEDI_ATOM ) { if ( ScanLocout->ABL != (chain_list *)0 ) { OutWeightArray[ ( IndexOut * NumberState ) + IndexState ] += getablexprnumatom( ScanLocout->ABL ); } } else { OutWeightArray[ ( IndexOut * NumberState ) + IndexState ]++; } } FSM_SYF_STATE( ScanState )->INDEX = IndexState++; } }
false
false
false
false
false
0
check_use_entry_in_element(Element *curr, Def_use_table *def) { int i; if (curr->enabled == FALSE) return; for (i = 0; i < 3; i++) { if (curr->ses[i]->enabled && check_use_entry_in_sub_data(curr->ses[i]->range, def)) { range_is_not_enabled (curr->ses[i], curr); } } if (curr->next_dim) { check_use_entry_in_element(curr->next_dim, def); } }
false
false
false
false
false
0
gst_update_registry (void) { gboolean res; #ifndef GST_DISABLE_REGISTRY GError *err = NULL; res = ensure_current_registry (&err); if (err) { GST_WARNING ("registry update failed: %s", err->message); g_error_free (err); } else { GST_LOG ("registry update succeeded"); } #else GST_WARNING ("registry update failed: %s", "registry disabled"); res = TRUE; #endif /* GST_DISABLE_REGISTRY */ if (_priv_gst_preload_plugins) { GST_DEBUG ("Preloading indicated plugins..."); g_slist_foreach (_priv_gst_preload_plugins, load_plugin_func, NULL); } return res; }
false
false
false
false
false
0
_elm_image_smart_load_size_set(Evas_Object *obj, int size) { ELM_IMAGE_DATA_GET(obj, sd); sd->load_size = size; if (!sd->img || sd->edje) return; evas_object_image_load_size_set(sd->img, sd->load_size, sd->load_size); }
false
false
false
false
false
0
WriteMakeRule(std::ostream& os, const char* comment, const char* target, const std::vector<std::string>& depends, const std::vector<std::string>& commands, bool symbolic, bool in_help) { // Make sure there is a target. if(!target || !*target) { cmSystemTools::Error("No target for WriteMakeRule! called with comment: ", comment); return; } std::string replace; // Write the comment describing the rule in the makefile. if(comment) { replace = comment; std::string::size_type lpos = 0; std::string::size_type rpos; while((rpos = replace.find('\n', lpos)) != std::string::npos) { os << "# " << replace.substr(lpos, rpos-lpos) << "\n"; lpos = rpos+1; } os << "# " << replace.substr(lpos) << "\n"; } // Construct the left hand side of the rule. replace = target; std::string tgt = this->Convert(replace.c_str(),HOME_OUTPUT,MAKEFILE); const char* space = ""; if(tgt.size() == 1) { // Add a space before the ":" to avoid drive letter confusion on // Windows. space = " "; } // Mark the rule as symbolic if requested. if(symbolic) { if(const char* sym = this->Makefile->GetDefinition("CMAKE_MAKE_SYMBOLIC_RULE")) { os << cmMakeSafe(tgt) << space << ": " << sym << "\n"; } } // Write the rule. if(depends.empty()) { // No dependencies. The commands will always run. os << cmMakeSafe(tgt) << space << ":\n"; } else { // Split dependencies into multiple rule lines. This allows for // very long dependency lists even on older make implementations. for(std::vector<std::string>::const_iterator dep = depends.begin(); dep != depends.end(); ++dep) { replace = *dep; replace = this->Convert(replace.c_str(),HOME_OUTPUT,MAKEFILE); os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n"; } } // Write the list of commands. for(std::vector<std::string>::const_iterator i = commands.begin(); i != commands.end(); ++i) { replace = *i; os << "\t" << replace.c_str() << "\n"; } if(symbolic && !this->WatcomWMake) { os << ".PHONY : " << cmMakeSafe(tgt) << "\n"; } os << "\n"; // Add the output to the local help if requested. if(in_help) { this->LocalHelp.push_back(target); } }
false
false
false
false
false
0
putString(const char *stringVal) { errorFlag = EC_Normal; /* check for an empty string parameter */ if ((stringVal != NULL) && (strlen(stringVal) > 0)) putValue(stringVal, strlen(stringVal)); else putValue(NULL, 0); /* make sure that extra padding is removed from the string */ fStringMode = DCM_UnknownString; makeMachineByteString(); return errorFlag; }
false
false
false
false
false
0
ADIOI_Complete_async(int *error_code) { /* complete all outstanding async I/O operations so that new ones can be initiated. Remove them all from async_list. */ ADIO_Status status; ADIO_Request *request; ADIOI_Async_node *tmp; if (!ADIOI_Async_list_head) *error_code = MPI_SUCCESS; while (ADIOI_Async_list_head) { request = ADIOI_Async_list_head->request; (*request)->queued = -1; /* ugly internal hack that prevents ADIOI_xxxComplete from freeing the request object. This is required, because the user will call MPI_Wait later, which would require status to be filled. */ switch ((*request)->optype) { case ADIOI_READ: /* (*((*request)->fd->fns->ADIOI_xxx_ReadComplete))(request, &status,error_code);*/ ADIO_ReadComplete(request, &status, error_code); break; case ADIOI_WRITE: /* (*((*request)->fd->fns->ADIOI_xxx_WriteComplete))(request, &status, error_code);*/ ADIO_WriteComplete(request, &status, error_code); break; default: FPRINTF(stderr, "Error in ADIOI_Complete_Async\n"); break; } (*request)->queued = 0; /* dequeued, but request object not freed */ tmp = ADIOI_Async_list_head; ADIOI_Async_list_head = ADIOI_Async_list_head->next; ADIOI_Free_async_node(tmp); } ADIOI_Async_list_tail = NULL; }
false
false
false
false
false
0
get_line_offset_in_equivalent_spaces (GtkSourceView *view, GtkTextIter *iter) { GtkTextIter i; gint tab_width; gint n = 0; tab_width = view->priv->tab_width; i = *iter; gtk_text_iter_set_line_offset (&i, 0); while (!gtk_text_iter_equal (&i, iter)) { gunichar c; c = gtk_text_iter_get_char (&i); if (c == '\t') n += tab_width - n % tab_width; else ++n; gtk_text_iter_forward_char (&i); } return n; }
false
false
false
false
false
0
operator+=( AbstractCommandPtr aCommand ) throw( CommandFrameException ) { GUARD; if( aCommand != NULLPTR ) { theCommands.push_back( aCommand ); } else { throw CommandFrameException( LOCATION ); } return ( *this ); }
false
false
false
false
false
0
get_dbinfo(krb5_context context, const krb5_config_binding *db_binding, const char *label, struct hdb_dbinfo **db) { struct hdb_dbinfo *di; const char *p; *db = NULL; p = krb5_config_get_string(context, db_binding, "dbname", NULL); if(p == NULL) return 0; di = calloc(1, sizeof(*di)); if (di == NULL) { krb5_set_error_message(context, ENOMEM, "malloc: out of memory"); return ENOMEM; } di->label = strdup(label); di->dbname = strdup(p); p = krb5_config_get_string(context, db_binding, "realm", NULL); if(p) di->realm = strdup(p); p = krb5_config_get_string(context, db_binding, "mkey_file", NULL); if(p) di->mkey_file = strdup(p); p = krb5_config_get_string(context, db_binding, "acl_file", NULL); if(p) di->acl_file = strdup(p); p = krb5_config_get_string(context, db_binding, "log_file", NULL); if(p) di->log_file = strdup(p); di->binding = db_binding; *db = di; return 0; }
false
false
false
false
false
0
snd_asihpi_sampleclock_add(struct snd_card_asihpi *asihpi, struct hpi_control *hpi_ctl) { struct snd_card *card; struct snd_kcontrol_new snd_control; struct clk_cache *clkcache; u32 hSC = hpi_ctl->h_control; int has_aes_in = 0; int i, j; u16 source; if (snd_BUG_ON(!asihpi)) return -EINVAL; card = asihpi->card; clkcache = &asihpi->cc; snd_control.private_value = hpi_ctl->h_control; clkcache->has_local = 0; for (i = 0; i <= HPI_SAMPLECLOCK_SOURCE_LAST; i++) { if (hpi_sample_clock_query_source(hSC, i, &source)) break; clkcache->s[i].source = source; clkcache->s[i].index = 0; clkcache->s[i].name = sampleclock_sources[source]; if (source == HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT) has_aes_in = 1; if (source == HPI_SAMPLECLOCK_SOURCE_LOCAL) clkcache->has_local = 1; } if (has_aes_in) /* already will have picked up index 0 above */ for (j = 1; j < 8; j++) { if (hpi_sample_clock_query_source_index(hSC, j, HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT, &source)) break; clkcache->s[i].source = HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT; clkcache->s[i].index = j; clkcache->s[i].name = sampleclock_sources[ j+HPI_SAMPLECLOCK_SOURCE_LAST]; i++; } clkcache->count = i; asihpi_ctl_init(&snd_control, hpi_ctl, "Source"); snd_control.access = SNDRV_CTL_ELEM_ACCESS_READWRITE ; snd_control.info = snd_asihpi_clksrc_info; snd_control.get = snd_asihpi_clksrc_get; snd_control.put = snd_asihpi_clksrc_put; if (ctl_add(card, &snd_control, asihpi) < 0) return -EINVAL; if (clkcache->has_local) { asihpi_ctl_init(&snd_control, hpi_ctl, "Localrate"); snd_control.access = SNDRV_CTL_ELEM_ACCESS_READWRITE ; snd_control.info = snd_asihpi_clklocal_info; snd_control.get = snd_asihpi_clklocal_get; snd_control.put = snd_asihpi_clklocal_put; if (ctl_add(card, &snd_control, asihpi) < 0) return -EINVAL; } asihpi_ctl_init(&snd_control, hpi_ctl, "Rate"); snd_control.access = SNDRV_CTL_ELEM_ACCESS_VOLATILE | SNDRV_CTL_ELEM_ACCESS_READ; snd_control.info = snd_asihpi_clkrate_info; snd_control.get = snd_asihpi_clkrate_get; return ctl_add(card, &snd_control, asihpi); }
false
false
false
false
false
0
append_basis_states (unsigned basis_states, wfa_t *wfa, coding_t *c) /* * Append the WFA basis states 0, ... , ('basis_states' - 1). * * No return value. * * Side effects: * The WFA information are updated in structure 'wfa' * State images and inner products are computed (in 'c') */ { unsigned level, state; /* * Allocate memory */ for (state = 0; state < basis_states; state++) { clear_or_alloc (&c->images_of_state [state], size_of_tree (c->options.images_level)); for (level = c->options.images_level + 1; level <= c->options.lc_max_level; level++) clear_or_alloc (&c->ip_states_state [state][level], state + 1); clear_or_alloc (&c->ip_images_state [state], size_of_tree (c->products_level)); c->images_of_state [state][0] = wfa->final_distribution [state]; wfa->level_of_state [state] = -1; } compute_images (0, basis_states - 1, wfa, c); compute_ip_states_state (0, basis_states - 1, wfa, c); wfa->states = basis_states; if (wfa->states >= MAXSTATES) error ("Maximum number of states reached!"); }
false
false
false
false
false
0
convertseries(StackInfo *si) { Series newtop = NULL; Object subo; int i; double seriespos = 0.0; newtop = DXNewSeries(); if (!newtop) goto error; for (i=0, seriespos = 0.0; (subo=DXGetEnumeratedMember((Group)si->thisobj, i, NULL)); i++, seriespos += 1.0) if (!DXSetSeriesMember(newtop, i, seriespos, subo)) goto error; /* done */ return (Object)newtop; error: DXDelete((Object)newtop); return NULL; }
false
false
false
false
false
0
gnumeric_r_dpois (GnmFuncEvalInfo *ei, GnmValue const * const *args) { gnm_float x = value_get_as_float (args[0]); gnm_float lambda = value_get_as_float (args[1]); gboolean give_log = args[2] ? value_get_as_checked_bool (args[2]) : FALSE; return value_new_float (dpois (x, lambda, give_log)); }
false
false
false
false
false
0
fprintch(strom,ch) truc strom; int ch; { ifun writech; writech = putcfun(strom); if(STREAMpos(strom) >= PrintCols || ch == EOL) { writech(EOL); STREAMpos(strom) = 0; } if(ch != EOL) { writech(ch); STREAMpos(strom) += 1; } return(STREAMpos(strom)); }
false
false
false
false
false
0
setgain(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; if (sd->sensor == SENSOR_PO2030N) { u8 rgain[] = /* 15: gain */ {0xa1, 0x6e, 0x15, 0x00, 0x40, 0x00, 0x00, 0x15}; rgain[3] = gspca_dev->gain->val; i2c_w8(gspca_dev, rgain); } }
false
false
false
false
false
0
drbg_hash_df(struct drbg_state *drbg, unsigned char *outval, size_t outlen, struct list_head *entropylist) { int ret = 0; size_t len = 0; unsigned char input[5]; unsigned char *tmp = drbg->scratchpad + drbg_statelen(drbg); struct drbg_string data; /* 10.4.1 step 3 */ input[0] = 1; drbg_cpu_to_be32((outlen * 8), &input[1]); /* 10.4.1 step 4.1 -- concatenation of data for input into hash */ drbg_string_fill(&data, input, 5); list_add(&data.list, entropylist); /* 10.4.1 step 4 */ while (len < outlen) { short blocklen = 0; /* 10.4.1 step 4.1 */ ret = drbg_kcapi_hash(drbg, NULL, tmp, entropylist); if (ret) goto out; /* 10.4.1 step 4.2 */ input[0]++; blocklen = (drbg_blocklen(drbg) < (outlen - len)) ? drbg_blocklen(drbg) : (outlen - len); memcpy(outval + len, tmp, blocklen); len += blocklen; } out: memset(tmp, 0, drbg_blocklen(drbg)); return ret; }
true
true
false
false
false
1
rectangle_end_line( int y ) { size_t i; struct rectangle *ptr; for( i = 0; i < rectangle_active_count; i++ ) { /* Skip if this rectangle was updated this line */ if( rectangle_active[i].y + rectangle_active[i].h == y + 1 ) continue; if ( settings_current.frame_rate > 1 && compare_and_merge_rectangles( &rectangle_active[i] ) ) { /* Mark the active rectangle as done */ rectangle_active[i].h = 0; continue; } /* We couldn't find a rectangle to extend, so create a new one */ if( ++rectangle_inactive_count > rectangle_inactive_allocated ) { size_t new_alloc; new_alloc = rectangle_inactive_allocated ? 2 * rectangle_inactive_allocated : 8; ptr = libspectrum_realloc( rectangle_inactive, new_alloc * sizeof( struct rectangle ) ); rectangle_inactive_allocated = new_alloc; rectangle_inactive = ptr; } rectangle_inactive[ rectangle_inactive_count - 1 ] = rectangle_active[i]; /* Mark the active rectangle as done */ rectangle_active[i].h = 0; } /* Compress the list of active rectangles */ for( i = 0, ptr = rectangle_active; i < rectangle_active_count; i++ ) { if( rectangle_active[i].h == 0 ) continue; *ptr = rectangle_active[i]; ptr++; } rectangle_active_count = ptr - rectangle_active; }
false
false
false
false
false
0
create(const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol) { switch (Symbol->getSymTag()) { FACTORY_SYMTAG_CASE(Exe, PDBSymbolExe) FACTORY_SYMTAG_CASE(Compiland, PDBSymbolCompiland) FACTORY_SYMTAG_CASE(CompilandDetails, PDBSymbolCompilandDetails) FACTORY_SYMTAG_CASE(CompilandEnv, PDBSymbolCompilandEnv) FACTORY_SYMTAG_CASE(Function, PDBSymbolFunc) FACTORY_SYMTAG_CASE(Block, PDBSymbolBlock) FACTORY_SYMTAG_CASE(Data, PDBSymbolData) FACTORY_SYMTAG_CASE(Annotation, PDBSymbolAnnotation) FACTORY_SYMTAG_CASE(Label, PDBSymbolLabel) FACTORY_SYMTAG_CASE(PublicSymbol, PDBSymbolPublicSymbol) FACTORY_SYMTAG_CASE(UDT, PDBSymbolTypeUDT) FACTORY_SYMTAG_CASE(Enum, PDBSymbolTypeEnum) FACTORY_SYMTAG_CASE(FunctionSig, PDBSymbolTypeFunctionSig) FACTORY_SYMTAG_CASE(PointerType, PDBSymbolTypePointer) FACTORY_SYMTAG_CASE(ArrayType, PDBSymbolTypeArray) FACTORY_SYMTAG_CASE(BuiltinType, PDBSymbolTypeBuiltin) FACTORY_SYMTAG_CASE(Typedef, PDBSymbolTypeTypedef) FACTORY_SYMTAG_CASE(BaseClass, PDBSymbolTypeBaseClass) FACTORY_SYMTAG_CASE(Friend, PDBSymbolTypeFriend) FACTORY_SYMTAG_CASE(FunctionArg, PDBSymbolTypeFunctionArg) FACTORY_SYMTAG_CASE(FuncDebugStart, PDBSymbolFuncDebugStart) FACTORY_SYMTAG_CASE(FuncDebugEnd, PDBSymbolFuncDebugEnd) FACTORY_SYMTAG_CASE(UsingNamespace, PDBSymbolUsingNamespace) FACTORY_SYMTAG_CASE(VTableShape, PDBSymbolTypeVTableShape) FACTORY_SYMTAG_CASE(VTable, PDBSymbolTypeVTable) FACTORY_SYMTAG_CASE(Custom, PDBSymbolCustom) FACTORY_SYMTAG_CASE(Thunk, PDBSymbolThunk) FACTORY_SYMTAG_CASE(CustomType, PDBSymbolTypeCustom) FACTORY_SYMTAG_CASE(ManagedType, PDBSymbolTypeManaged) FACTORY_SYMTAG_CASE(Dimension, PDBSymbolTypeDimension) default: return std::unique_ptr<PDBSymbol>( new PDBSymbolUnknown(PDBSession, std::move(Symbol))); } }
false
false
false
false
false
0
check_depth(Window win, Window top, int doall) { XWindowAttributes attr, *pattr; /* first see if it is (still) a valid window: */ MV_count++; if (cache_win > 0.0) { pattr = vw_lookup(win); if (pattr == NULL) { return 1; /* indicate done */ } } else { if (! valid_window(win, &attr, 1)) { return 1; /* indicate done */ } pattr = &attr; } if (! doall && pattr->map_state != IsViewable) { /* * store results anyway... this may lead to table * filling up, but currently this allows us to update * state of onetime mapped windows. */ check_depth_win(win, top, pattr); return 1; /* indicate done */ } else if (check_depth_win(win, top, pattr)) { return 1; /* indicate done */ } else { return 0; /* indicate not done */ } }
false
false
false
false
false
0
_pilPAFHeaderCreate(const char *name, const char *type, const char *id, const char *desc) { PilList *hdr = newPilList(); if (hdr) { _pilPAFAppend(hdr, PAF_HDR_START, PAF_TYPE_NONE, NULL, NULL); _pilPAFAppend(hdr, PAF_TYPE, PAF_TYPE_STRING, type, "Type of parameter file"); if (id) _pilPAFAppend(hdr, PAF_ID, PAF_TYPE_STRING, id, NULL); else _pilPAFAppend(hdr, PAF_ID, PAF_TYPE_STRING, "", NULL); _pilPAFAppend(hdr, PAF_NAME, PAF_TYPE_STRING, name, "Name of PAF"); if (desc) _pilPAFAppend(hdr, PAF_DESC, PAF_TYPE_STRING, desc, "Short description of PAF"); else _pilPAFAppend(hdr, PAF_DESC, PAF_TYPE_STRING, "", "Short description of PAF"); _pilPAFAppend(hdr, PAF_CRTE_NAME, PAF_TYPE_NONE, NULL, "Name of creator"); _pilPAFAppend(hdr, PAF_CRTE_TIME, PAF_TYPE_NONE, NULL, "Civil time for creation"); _pilPAFAppend(hdr, PAF_LCHG_NAME, PAF_TYPE_NONE, NULL, "Author of par. file"); _pilPAFAppend(hdr, PAF_LCHG_TIME, PAF_TYPE_NONE, NULL, "Timestamp for last change"); _pilPAFAppend(hdr, PAF_CHCK_NAME, PAF_TYPE_STRING, "", "Name of appl. checking"); _pilPAFAppend(hdr, PAF_CHCK_TIME, PAF_TYPE_STRING, "", "Time for checking"); _pilPAFAppend(hdr, PAF_CHCK_CHECKSUM, PAF_TYPE_STRING, "", "Checksum for the PAF"); _pilPAFAppend(hdr, PAF_HDR_END, PAF_TYPE_NONE, NULL, NULL); } return hdr; }
false
false
false
false
false
0
is_operand(const char *w, double *operand_value) { double value; if (w[0] == '"' && w[strlen(w) - 1] == '"') { return STRING; } else if (rpn_which_function(w)) { return FUNCTION; } else if (!strcmp(w, "x") || !strcmp(w, "y") || !strcmp(w, "z") || !strcmp(w, "u") || !strcmp(w, "v") || !strcmp(w, "grid")) { return COLUMN_NAME; } else if (is_var(w)) { if (getdnum(w, &value)) *operand_value = value; else return VARIABLE_WITH_MISSING_VALUE; if (gr_missing(value)) return VARIABLE_WITH_MISSING_VALUE; else return NUMBER; } else if (getdnum(w, &value)) { // BUG - if can't scan, will die *operand_value = value; return NUMBER; } else { return NOT_OPERAND; } }
false
false
false
false
false
0
loadConfig_sensorSpecific( const mrpt::utils::CConfigFileBase &configSource, const std::string &iniSection ) { m_sensorPose = CPose3D( configSource.read_float(iniSection,"pose_x",0), configSource.read_float(iniSection,"pose_y",0), configSource.read_float(iniSection,"pose_z",0), DEG2RAD( configSource.read_float(iniSection,"pose_yaw",0) ), DEG2RAD( configSource.read_float(iniSection,"pose_pitch",0) ), DEG2RAD( configSource.read_float(iniSection,"pose_roll",0) ) ); m_mm_mode = configSource.read_bool(iniSection,"mm_mode",m_mm_mode); #ifdef MRPT_OS_WINDOWS m_com_port = configSource.read_string(iniSection, "COM_port_WIN", m_com_port, true ); #else m_com_port = configSource.read_string(iniSection, "COM_port_LIN", m_com_port, true ); #endif m_com_baudRate = configSource.read_int(iniSection, "COM_baudRate", m_com_baudRate ); m_nTries_connect = configSource.read_int(iniSection, "nTries_connect", m_nTries_connect ); m_scans_FOV = configSource.read_int(iniSection, "FOV", m_scans_FOV ); m_scans_res = configSource.read_int(iniSection, "resolution", m_scans_res ); m_skip_laser_config = configSource.read_bool(iniSection, "skip_laser_config", m_skip_laser_config ); // Parent options: C2DRangeFinderAbstract::loadCommonParams(configSource, iniSection); }
false
false
false
false
false
0
snd_ice1712_ews88mt_input_sense_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); struct ews_spec *spec = ice->spec; int channel = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); unsigned char data, ndata; if (snd_BUG_ON(channel < 0 || channel > 7)) return 0; snd_i2c_lock(ice->i2c); if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF1], &data, 1) != 1) { snd_i2c_unlock(ice->i2c); return -EIO; } ndata = (data & ~(1 << channel)) | (ucontrol->value.enumerated.item[0] ? 0 : (1 << channel)); if (ndata != data && snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_PCF1], &ndata, 1) != 1) { snd_i2c_unlock(ice->i2c); return -EIO; } snd_i2c_unlock(ice->i2c); return ndata != data; }
false
false
false
false
false
0
remove0blocks(unsigned char *pIn, int *inSize) { long long *in = (long long *)pIn; long long *out = (long long *)pIn; int i; for (i = 0; i < *inSize; i += 8, in++) /* Skip 8 byte blocks of all 0 */ if (*in) *out++ = *in; *inSize -= (in - out) * 8; }
false
false
false
false
false
0
f_winwidth(argvars, rettv) typval_T *argvars; typval_T *rettv; { win_T *wp; wp = find_win_by_nr(&argvars[0], NULL); if (wp == NULL) rettv->vval.v_number = -1; else #ifdef FEAT_VERTSPLIT rettv->vval.v_number = wp->w_width; #else rettv->vval.v_number = Columns; #endif }
false
false
false
false
false
0
__checkVertex(const size_t& n) { if ((n == 0) or (n > (*__vertices).numberOfVertices())) { throw MeshReaderAM_FMTFormat::VertexError(); } }
false
false
false
false
false
0
inflate_unzip_internal(STATE_PARAM transformer_state_t *xstate) { IF_DESKTOP(long long) int n = 0; ssize_t nwrote; /* Allocate all global buffers (for DYN_ALLOC option) */ gunzip_window = xmalloc(GUNZIP_WSIZE); gunzip_outbuf_count = 0; gunzip_bytes_out = 0; gunzip_src_fd = xstate->src_fd; /* (re) initialize state */ method = -1; need_another_block = 1; resume_copy = 0; gunzip_bk = 0; gunzip_bb = 0; /* Create the crc table */ gunzip_crc_table = crc32_filltable(NULL, 0); gunzip_crc = ~0; error_msg = "corrupted data"; if (setjmp(error_jmp)) { /* Error from deep inside zip machinery */ n = -1; goto ret; } while (1) { int r = inflate_get_next_window(PASS_STATE_ONLY); nwrote = transformer_write(xstate, gunzip_window, gunzip_outbuf_count); if (nwrote == (ssize_t)-1) { n = -1; goto ret; } IF_DESKTOP(n += nwrote;) if (r == 0) break; } /* Store unused bytes in a global buffer so calling applets can access it */ if (gunzip_bk >= 8) { /* Undo too much lookahead. The next read will be byte aligned * so we can discard unused bits in the last meaningful byte. */ bytebuffer_offset--; bytebuffer[bytebuffer_offset] = gunzip_bb & 0xff; gunzip_bb >>= 8; gunzip_bk -= 8; } ret: /* Cleanup */ free(gunzip_window); free(gunzip_crc_table); return n; }
false
false
false
false
false
0
x_list_append (x_list_t *list, void *data) { x_list_t *new_list; x_list_t *last; new_list = _x_list_alloc (); new_list->data = data; if (list) { last = x_list_last (list); /* g_assert (last != NULL); */ last->next = new_list; new_list->prev = last; return list; } else { return new_list; } }
false
false
false
false
false
0