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
cookies_free(struct cookie *c, int vals) { struct cookie *o; while(c){ o = c->next; if(vals){ free(c->nam); free(c->val); free(c->host); } free(c); c = o; } }
false
false
false
false
false
0
temp_kvs_init(void) { uint16_t cmd; uint32_t nodeid, num_children, size; Buf buf = NULL; xfree(temp_kvs_buf); temp_kvs_cnt = 0; temp_kvs_size = TEMP_KVS_SIZE_INC; temp_kvs_buf = xmalloc(temp_kvs_size); /* put the tree cmd here to simplify message sending */ if (in_stepd()) { cmd = TREE_CMD_KVS_FENCE; } else { cmd = TREE_CMD_KVS_FENCE_RESP; } buf = init_buf(1024); pack16(cmd, buf); if (in_stepd()) { nodeid = job_info.nodeid; /* XXX: TBC */ num_children = tree_info.num_children + 1; pack32((uint32_t)nodeid, buf); /* from_nodeid */ packstr(tree_info.this_node, buf); /* from_node */ pack32((uint32_t)num_children, buf); /* num_children */ } size = get_buf_offset(buf); if (temp_kvs_cnt + size > temp_kvs_size) { temp_kvs_size += TEMP_KVS_SIZE_INC; xrealloc(temp_kvs_buf, temp_kvs_size); } memcpy(&temp_kvs_buf[temp_kvs_cnt], get_buf_data(buf), size); temp_kvs_cnt += size; free_buf(buf); tasks_to_wait = 0; children_to_wait = 0; return SLURM_SUCCESS; }
false
false
false
false
false
0
free_strdup(char ** s, const char * str) { if (*s != NULL) { free(*s); } if (str != NULL) { *s = strdup(str); } else { *s = NULL; } }
false
false
false
false
false
0
getUserDefinedUsages(string &key,string &query, string &msg) { VS_map::iterator cur; if( (cur = VSM_UserDefinedUsages.find(key)) == VSM_UserDefinedUsages.end() ) // not found { return 0; } else { msg = (cur->second)[rand() % (cur->second).size()]; key.insert( 0,"{" ); key.append( "}" ); replaceString(msg, key, query); return 1; } }
false
false
false
false
false
0
pm_clk_runtime_resume(struct device *dev) { int ret; dev_dbg(dev, "%s\n", __func__); ret = pm_clk_resume(dev); if (ret) { dev_err(dev, "failed to resume clock\n"); return ret; } return pm_generic_runtime_resume(dev); }
false
false
false
false
false
0
find_includefile(HSCPRC *hp, EXPSTR * dest, STRPTR filename) { BOOL found = FALSE; /* reset filename */ set_estr(dest, filename); if (!fexists(filename)) { DLNODE *nd = dll_first(hp->include_dirs); /* process all include-directories.. */ while (nd && !found) { /* concat incdir+filename, check if it exists, * process next or abort loop */ link_fname(dest, (STRPTR) dln_data(nd), filename); D(fprintf(stderr, DHL " try `%s'\n", estr2str(dest))); if (fexists(estr2str(dest))) found = TRUE; else nd = dln_next(nd); } } else { /* found in current directory */ found = TRUE; } if (found) { D(fprintf(stderr, DHL " found at `%s'\n", estr2str(dest))); } return (found); }
false
false
false
false
false
0
multimaster_bepostop_delete (Slapi_PBlock *pb) { Slapi_Operation *op; slapi_pblock_get(pb, SLAPI_OPERATION, &op); if ( ! operation_is_flag_set (op, OP_FLAG_REPL_FIXUP) ) { urp_post_delete_operation (pb); } return SLAPI_PLUGIN_SUCCESS; }
false
false
false
false
false
0
default_hash(void *a) { size_t len = blength((bstring)a); char *key = bdata((bstring)a); uint32_t hash = 0; uint32_t i = 0; for(hash = i = 0; i < len; ++i) { hash += key[i]; hash += (hash << 10); hash ^= (hash >> 6); } hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15); return hash; }
false
false
false
false
false
0
qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) { if (_c == QMetaObject::InvokeMetaMethod) { Q_ASSERT(staticMetaObject.cast(_o)); auth_tcp_client *_t = static_cast<auth_tcp_client *>(_o); switch (_id) { case 0: _t->emit_tcp_state((*reinterpret_cast< int(*)>(_a[1]))); break; case 1: _t->emit_error(); break; case 2: _t->auth_suceeded(); break; case 3: _t->received_stream((*reinterpret_cast< QString(*)>(_a[1]))); break; case 4: _t->received_stream((*reinterpret_cast< QTcpSocket*(*)>(_a[1]))); break; case 5: _t->disconnected_client((*reinterpret_cast< int(*)>(_a[1]))); break; case 6: _t->disconnected_socket(); break; case 7: _t->wrong_password(); break; case 8: _t->update_progress_size((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 9: _t->connect_to_server((*reinterpret_cast< const char*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 10: _t->stop_client(); break; case 11: _t->socket_error((*reinterpret_cast< QAbstractSocket::SocketError(*)>(_a[1]))); break; case 12: _t->disconnected_client(); break; case 13: _t->read_from_server(); break; default: ; } } }
false
false
false
false
false
0
artec48u_scanner_stop_scan (Artec48U_Scanner * s) { XDBG ((1, "artec48u_scanner_stop_scan begin: \n")); artec48u_line_reader_free (s->reader); s->reader = NULL; return artec48u_stop_scan (s->dev); }
false
false
false
false
false
0
c_tmap_scanline_lin_nolight() { ubyte *dest; uint c; int x, index = fx_xleft + (bytes_per_row * fx_y ); fix u,v,dudx, dvdx; u = fx_u; v = fx_v*64; dudx = fx_du_dx; dvdx = fx_dv_dx*64; dest = (ubyte *)(write_buffer + fx_xleft + (bytes_per_row * fx_y) ); if (!Transparency_on) { for (x= fx_xright-fx_xleft+1 ; x > 0; --x ) { if (++index >= SWIDTH*SHEIGHT) return; *dest++ = (uint)pixptr[ (f2i(v)&(64*63)) + (f2i(u)&63) ]; u += dudx; v += dvdx; } } else { for (x= fx_xright-fx_xleft+1 ; x > 0; --x ) { if (++index >= SWIDTH*SHEIGHT) return; c = (uint)pixptr[ (f2i(v)&(64*63)) + (f2i(u)&63) ]; if ( c!=255) *dest = c; dest++; u += dudx; v += dvdx; } } }
false
false
false
false
false
0
init_equiv_class (vec<state_t> states, vec<state_t> *classes) { size_t i; state_t prev = 0; int class_num = 1; classes->create (150); for (i = 0; i < states.length (); i++) { state_t state = states[i]; if (prev) { if (compare_states_for_equiv (&prev, &state) != 0) { classes->safe_push (prev); class_num++; prev = NULL; } } state->equiv_class_num_1 = class_num; state->next_equiv_class_state = prev; prev = state; } if (prev) classes->safe_push (prev); return class_num; }
false
false
false
false
false
0
DSDPAddFixedVariable( DSDPSchurMat M, int vari, double val){ int i,t,*iinew,info,nvars; double *ddnew,*vvnew; FixedVariables *fv=&M.schur->fv; DSDPFunctionBegin; nvars=fv->nvars; if (nvars>=fv->nmaxvars){ t=2*nvars + 2; DSDPCALLOC2(&iinew,int,t,&info); DSDPCALLOC2(&ddnew,double,t,&info); DSDPCALLOC2(&vvnew,double,t,&info); for (i=0;i<nvars;i++){ iinew[i]=fv->var[i]; ddnew[i]=fv->fval[i]; vvnew[i]=fv->fdual[i]; } DSDPFREE(&fv->var,&info);DSDPCHKERR(info); DSDPFREE(&fv->fval,&info);DSDPCHKERR(info); DSDPFREE(&fv->fdual,&info);DSDPCHKERR(info); fv->var=iinew; fv->fval=ddnew; fv->fdual=vvnew; fv->nmaxvars=t; } fv->var[fv->nvars]=vari; fv->fval[fv->nvars]=val; fv->nvars++; DSDPFunctionReturn(0); }
false
false
false
true
false
1
stonith_check_fence_tolerance(int tolerance, const char *target, const char *action) { GHashTableIter iter; time_t now = time(NULL); remote_fencing_op_t *rop = NULL; crm_trace("tolerance=%d, remote_op_list=%p", tolerance, remote_op_list); if (tolerance <= 0 || !remote_op_list || target == NULL || action == NULL) { return FALSE; } g_hash_table_iter_init(&iter, remote_op_list); while (g_hash_table_iter_next(&iter, NULL, (void **)&rop)) { if (strcmp(rop->target, target) != 0) { continue; } else if (rop->state != st_done) { continue; } else if (strcmp(rop->action, action) != 0) { continue; } else if ((rop->completed + tolerance) < now) { continue; } crm_notice("Target %s was fenced (%s) less than %ds ago by %s on behalf of %s", target, action, tolerance, rop->delegate, rop->originator); return TRUE; } return FALSE; }
false
false
false
false
false
0
bbox_image_begin(const gs_imager_state * pis, const gs_matrix * pmat, const gs_image_common_t * pic, const gs_int_rect * prect, const gx_clip_path * pcpath, gs_memory_t * memory, bbox_image_enum ** ppbe) { int code; gs_matrix mat; bbox_image_enum *pbe; if (pmat == 0) pmat = &ctm_only(pis); if ((code = gs_matrix_invert(&pic->ImageMatrix, &mat)) < 0 || (code = gs_matrix_multiply(&mat, pmat, &mat)) < 0 ) return code; pbe = gs_alloc_struct(memory, bbox_image_enum, &st_bbox_image_enum, "bbox_image_begin"); if (pbe == 0) return_error(gs_error_VMerror); pbe->memory = memory; pbe->matrix = mat; pbe->pcpath = pcpath; pbe->target_info = 0; /* in case no target */ pbe->params_are_const = false; /* check the first time */ if (prect) { pbe->x0 = prect->p.x, pbe->x1 = prect->q.x; pbe->y = prect->p.y, pbe->height = prect->q.y - prect->p.y; } else { gs_int_point size; int code = (*pic->type->source_size) (pis, pic, &size); if (code < 0) { gs_free_object(memory, pbe, "bbox_image_begin"); return code; } pbe->x0 = 0, pbe->x1 = size.x; pbe->y = 0, pbe->height = size.y; } *ppbe = pbe; return 0; }
false
false
false
false
false
0
getp_prepend(VMG_ vm_obj_id_t self, vm_val_t *retval, uint *argc) { vm_val_t val; size_t cnt; size_t i; static CVmNativeCodeDesc desc(1); /* check arguments */ if (get_prop_check_argc(retval, argc, &desc)) return TRUE; /* get the old size */ cnt = get_element_count(); /* expand the vector by one element */ set_element_count_undo(vmg_ self, cnt + 1); /* move each existing element up one slot to make room for the new one */ for (i = cnt ; i != 0 ; --i) { /* get this element */ get_element(i - 1, &val); /* * bump it up to the next slot - keep undo except for the last * slot, which is newly added and thus doesn't have an old value * that we need to keep */ if (i == cnt) set_element(i, &val); else set_element_undo(vmg_ self, i, &val); } /* retrieve the value for the new element */ G_stk->pop(&val); /* * set the first element - note that there's no need to save undo, * since undoing this operation will simply discard this element (in * other words, there's no previous value for this element since it's * being created anew here) */ set_element(0, &val); /* the return value is 'self' */ retval->set_obj(self); /* handled */ return TRUE; }
false
false
false
false
false
0
_SSL_check_subject_altname (X509 *cert, const char *host) { STACK_OF(GENERAL_NAME) *altname_stack = NULL; GInetAddress *addr; GSocketFamily family; int type = GEN_DNS; int count, i; int rv = -1; altname_stack = X509_get_ext_d2i (cert, NID_subject_alt_name, NULL, NULL); if (altname_stack == NULL) return -1; addr = g_inet_address_new_from_string (host); if (addr != NULL) { family = g_inet_address_get_family (addr); if (family == G_SOCKET_FAMILY_IPV4 || family == G_SOCKET_FAMILY_IPV6) type = GEN_IPADD; } count = sk_GENERAL_NAME_num(altname_stack); for (i = 0; i < count; i++) { GENERAL_NAME *altname; altname = sk_GENERAL_NAME_value (altname_stack, i); if (altname->type != type) continue; if (type == GEN_DNS) { unsigned char *data; int format; format = ASN1_STRING_type (altname->d.dNSName); if (format == V_ASN1_IA5STRING) { data = ASN1_STRING_data (altname->d.dNSName); if (ASN1_STRING_length (altname->d.dNSName) != (int)strlen(data)) { g_warning("NUL byte in subjectAltName, probably a malicious certificate.\n"); rv = -2; break; } if (_SSL_match_hostname (data, host) == 0) { rv = 0; break; } } else g_warning ("unhandled subjectAltName dNSName encoding (%d)\n", format); } else if (type == GEN_IPADD) { unsigned char *data; const guint8 *addr_bytes; int datalen, addr_len; datalen = ASN1_STRING_length (altname->d.iPAddress); data = ASN1_STRING_data (altname->d.iPAddress); addr_bytes = g_inet_address_to_bytes (addr); addr_len = (int)g_inet_address_get_native_size (addr); if (datalen == addr_len && memcmp (data, addr_bytes, addr_len) == 0) { rv = 0; break; } } } if (addr != NULL) g_object_unref (addr); sk_GENERAL_NAME_free (altname_stack); return rv; }
false
false
false
false
false
0
log_tree_diff_flush(struct rev_info *opt) { diffcore_std(&opt->diffopt); if (diff_queue_is_empty()) { int saved_fmt = opt->diffopt.output_format; opt->diffopt.output_format = DIFF_FORMAT_NO_OUTPUT; diff_flush(&opt->diffopt); opt->diffopt.output_format = saved_fmt; return 0; } if (opt->loginfo && !opt->no_commit_id) { /* When showing a verbose header (i.e. log message), * and not in --pretty=oneline format, we would want * an extra newline between the end of log and the * output for readability. */ show_log(opt); if ((opt->diffopt.output_format & ~DIFF_FORMAT_NO_OUTPUT) && opt->verbose_header && opt->commit_format != CMIT_FMT_ONELINE) { int pch = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH; if ((pch & opt->diffopt.output_format) == pch) printf("---"); putchar('\n'); } } diff_flush(&opt->diffopt); return 1; }
false
false
false
false
false
0
pages_map(void *addr, size_t size) { void *ret; assert(size != 0); #ifdef _WIN32 /* * If VirtualAlloc can't allocate at the given address when one is * given, it fails and returns NULL. */ ret = VirtualAlloc(addr, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); #else /* * We don't use MAP_FIXED here, because it can cause the *replacement* * of existing mappings, and we only want to create new mappings. */ ret = mmap(addr, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); assert(ret != NULL); if (ret == MAP_FAILED) ret = NULL; else if (addr != NULL && ret != addr) { /* * We succeeded in mapping memory, but not in the right place. */ if (munmap(ret, size) == -1) { char buf[BUFERROR_BUF]; buferror(get_errno(), buf, sizeof(buf)); malloc_printf("<jemalloc: Error in munmap(): %s\n", buf); if (opt_abort) abort(); } ret = NULL; } #endif assert(ret == NULL || (addr == NULL && ret != addr) || (addr != NULL && ret == addr)); return (ret); }
false
false
false
false
false
0
CPLRecode( const char *pszSource, const char *pszSrcEncoding, const char *pszDstEncoding ) { /* -------------------------------------------------------------------- */ /* Handle a few common short cuts. */ /* -------------------------------------------------------------------- */ if ( EQUAL(pszSrcEncoding, pszDstEncoding) ) return CPLStrdup(pszSource); if ( EQUAL(pszSrcEncoding, CPL_ENC_ASCII) && ( EQUAL(pszDstEncoding, CPL_ENC_UTF8) || EQUAL(pszDstEncoding, CPL_ENC_ISO8859_1) ) ) return CPLStrdup(pszSource); #ifdef CPL_RECODE_ICONV /* -------------------------------------------------------------------- */ /* CPL_ENC_ISO8859_1 -> CPL_ENC_UTF8 */ /* and CPL_ENC_UTF8 -> CPL_ENC_ISO8859_1 conversions are hadled */ /* very well by the stub implementation which is faster than the */ /* iconv() route. Use a stub for these two ones and iconv() */ /* everything else. */ /* -------------------------------------------------------------------- */ if ( ( EQUAL(pszSrcEncoding, CPL_ENC_ISO8859_1) && EQUAL(pszDstEncoding, CPL_ENC_UTF8) ) || ( EQUAL(pszSrcEncoding, CPL_ENC_UTF8) && EQUAL(pszDstEncoding, CPL_ENC_ISO8859_1) ) ) { return CPLRecodeStub( pszSource, pszSrcEncoding, pszDstEncoding ); } else { return CPLRecodeIconv( pszSource, pszSrcEncoding, pszDstEncoding ); } #else /* CPL_RECODE_STUB */ return CPLRecodeStub( pszSource, pszSrcEncoding, pszDstEncoding ); #endif /* CPL_RECODE_ICONV */ }
false
false
false
false
false
0
computeIntersects(Edge *e0, Edge *e1, SegmentIntersector *si) { const CoordinateSequence *pts0=e0->getCoordinates(); const CoordinateSequence *pts1=e1->getCoordinates(); size_t npts0=pts0->getSize(); size_t npts1=pts1->getSize(); for(size_t i0=0; i0<npts0-1; ++i0) { for(size_t i1=0; i1<npts1-1; ++i1) { si->addIntersections(e0, i0, e1, i1); } } } }
false
false
false
false
false
0
DoOpenFile(const wxString& filename, bool addToHistory) { cbEditor* ed = Manager::Get()->GetEditorManager()->Open(filename); if (ed) { // Cryogen 24/3/10 Activate the editor after opening. Partial fix for bug #14087. ed->Activate(); if (addToHistory) m_filesHistory.AddToHistory(ed->GetFilename()); return true; } return false; }
false
false
false
false
false
0
emitUADD(const Instruction *i) { const int neg0 = i->src(0).mod.neg(); const int neg1 = i->src(1).mod.neg() ^ ((i->op == OP_SUB) ? 1 : 0); code[0] = 0x20008000; if (i->src(1).getFile() == FILE_IMMEDIATE) { code[1] = 0; emitForm_IMM(i); } else if (i->encSize == 8) { code[0] = 0x20000000; code[1] = (typeSizeof(i->dType) == 2) ? 0 : 0x04000000; emitForm_ADD(i); } else { emitForm_MUL(i); } assert(!(neg0 && neg1)); code[0] |= neg0 << 28; code[0] |= neg1 << 22; if (i->flagsSrc >= 0) { // addc == sub | subr assert(!(code[0] & 0x10400000) && !i->getPredicate()); code[0] |= 0x10400000; srcId(i->src(i->flagsSrc), 32 + 12); } }
false
false
false
false
false
0
glade_gtk_combo_box_set_property (GladeWidgetAdaptor * adaptor, GObject * object, const gchar * id, const GValue * value) { if (!strcmp (id, "entry-text-column")) { /* Avoid warnings */ if (g_value_get_int (value) >= 0) GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor, object, id, value); } else if (!strcmp (id, "text-column")) { if (g_value_get_int (value) >= 0) gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (object), g_value_get_int (value)); } else if (!strcmp (id, "add-tearoffs")) { GladeWidget *widget = glade_widget_get_from_gobject (object); if (g_value_get_boolean (value)) glade_widget_property_set_sensitive (widget, "tearoff-title", TRUE, NULL); else glade_widget_property_set_sensitive (widget, "tearoff-title", FALSE, _("Tearoff menus are disabled")); } else GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor, object, id, value); }
false
false
false
false
false
0
ParseSimpleFacet( void *theEnv, char *readSource, char *specbits, char *facetName, int testBit, char *clearRelation, char *setRelation, char *alternateRelation, char *varRelation, SYMBOL_HN **facetSymbolicValue) { int rtnCode; if (TestBitMap(specbits,testBit)) { PrintErrorID(theEnv,"CLSLTPSR",2,FALSE); EnvPrintRouter(theEnv,WERROR,facetName); EnvPrintRouter(theEnv,WERROR," facet already specified.\n"); return(-1); } SetBitMap(specbits,testBit); SavePPBuffer(theEnv," "); GetToken(theEnv,readSource,&DefclassData(theEnv)->ObjectParseToken); /* =============================== Check for the variable relation =============================== */ if (DefclassData(theEnv)->ObjectParseToken.type == SF_VARIABLE) { if ((varRelation == NULL) ? FALSE : (strcmp(DOToString(DefclassData(theEnv)->ObjectParseToken),varRelation) == 0)) rtnCode = 3; else goto ParseSimpleFacetError; } else { if (DefclassData(theEnv)->ObjectParseToken.type != SYMBOL) goto ParseSimpleFacetError; /* =================================================== If the facet value buffer is non-NULL simply get the value and do not check any relations =================================================== */ if (facetSymbolicValue == NULL) { if (strcmp(DOToString(DefclassData(theEnv)->ObjectParseToken),clearRelation) == 0) rtnCode = 0; else if (strcmp(DOToString(DefclassData(theEnv)->ObjectParseToken),setRelation) == 0) rtnCode = 1; else if ((alternateRelation == NULL) ? FALSE : (strcmp(DOToString(DefclassData(theEnv)->ObjectParseToken),alternateRelation) == 0)) rtnCode = 2; else goto ParseSimpleFacetError; } else { rtnCode = 4; *facetSymbolicValue = (SYMBOL_HN *) DefclassData(theEnv)->ObjectParseToken.value; } } GetToken(theEnv,readSource,&DefclassData(theEnv)->ObjectParseToken); if (DefclassData(theEnv)->ObjectParseToken.type != RPAREN) goto ParseSimpleFacetError; return(rtnCode); ParseSimpleFacetError: SyntaxErrorMessage(theEnv,"slot facet"); return(-1); }
false
false
false
false
false
0
merge_space_tree(struct btrfs_free_space_ctl *ctl) { struct btrfs_free_space *e, *prev = NULL; struct rb_node *n; again: spin_lock(&ctl->tree_lock); for (n = rb_first(&ctl->free_space_offset); n; n = rb_next(n)) { e = rb_entry(n, struct btrfs_free_space, offset_index); if (!prev) goto next; if (e->bitmap || prev->bitmap) goto next; if (prev->offset + prev->bytes == e->offset) { unlink_free_space(ctl, prev); unlink_free_space(ctl, e); prev->bytes += e->bytes; kmem_cache_free(btrfs_free_space_cachep, e); link_free_space(ctl, prev); prev = NULL; spin_unlock(&ctl->tree_lock); goto again; } next: prev = e; } spin_unlock(&ctl->tree_lock); }
false
false
false
false
false
0
cbf_new_column (cbf_handle handle, const char *columnname) { cbf_node *node; int errorcode; unsigned int rows; if (!handle) return CBF_ARGUMENT; /* Find the category node */ cbf_failnez (cbf_find_parent (&node, handle->node, CBF_CATEGORY)) /* How many rows does this category have? */ cbf_failnez (cbf_count_rows (handle, &rows)) /* Copy the name */ if (columnname) { columnname = cbf_copy_string (NULL, columnname, 0); if (!columnname) return CBF_ALLOC; } /* Add a column */ errorcode = cbf_make_child (&node, node, CBF_COLUMN, columnname); if (errorcode) { cbf_free_string (NULL, columnname); return errorcode; } /* Set the number of rows */ errorcode = cbf_set_children (node, rows); if (errorcode) return errorcode | cbf_free_node (node); /* Success */ handle->node = node; handle->row = 0; handle->search_row = 0; return 0; }
false
false
false
false
false
0
sf_readrow_hsbin(SpiceStream *sf, double *ivar, double *dvars) { int i; int rc; if(!sf->read_sweepparam) { /* first row of table */ if(sf_readsweep_hsbin(sf, NULL) <= 0) /* discard sweep parameters, if any */ return -1; } rc = sf_getval_hsbin(sf, ivar); if(rc == 0) /* file EOF */ return 0; if(rc < 0) return -1; if(*ivar >= 1.0e29) { /* "infinity" at end of data table */ sf->read_tables++; if(sf->read_tables == sf->ntables) return 0; /* end of data, should also be EOF but we don't check */ else { sf->read_sweepparam = 0; sf->read_rows = 0; return -2; /* end of table, more tables follow */ } } sf->read_rows++; for(i = 0; i < sf->ncols-1; i++) { if(sf_getval_hsbin(sf, &dvars[i]) != 1) { ss_msg(WARN, "sf_readrow_hsbin", "%s: EOF or error reading data field %d in row %d of table %d; file is incomplete.", sf->filename, i, sf->read_rows, sf->read_tables); return 0; } } return 1; }
false
false
false
false
false
0
send_set_info(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, u64 volatile_fid, u32 pid, int info_class, unsigned int num, void **data, unsigned int *size) { struct smb2_set_info_req *req; struct smb2_set_info_rsp *rsp = NULL; struct kvec *iov; struct kvec rsp_iov; int rc = 0; int resp_buftype; unsigned int i; struct TCP_Server_Info *server; struct cifs_ses *ses = tcon->ses; int flags = 0; if (ses && (ses->server)) server = ses->server; else return -EIO; if (!num) return -EINVAL; iov = kmalloc(sizeof(struct kvec) * num, GFP_KERNEL); if (!iov) return -ENOMEM; rc = small_smb2_init(SMB2_SET_INFO, tcon, (void **) &req); if (rc) { kfree(iov); return rc; } if (encryption_required(tcon)) flags |= CIFS_TRANSFORM_REQ; req->hdr.sync_hdr.ProcessId = cpu_to_le32(pid); req->InfoType = SMB2_O_INFO_FILE; req->FileInfoClass = info_class; req->PersistentFileId = persistent_fid; req->VolatileFileId = volatile_fid; /* 4 for RFC1001 length and 1 for Buffer */ req->BufferOffset = cpu_to_le16(sizeof(struct smb2_set_info_req) - 1 - 4); req->BufferLength = cpu_to_le32(*size); inc_rfc1001_len(req, *size - 1 /* Buffer */); memcpy(req->Buffer, *data, *size); iov[0].iov_base = (char *)req; /* 4 for RFC1001 length */ iov[0].iov_len = get_rfc1002_length(req) + 4; for (i = 1; i < num; i++) { inc_rfc1001_len(req, size[i]); le32_add_cpu(&req->BufferLength, size[i]); iov[i].iov_base = (char *)data[i]; iov[i].iov_len = size[i]; } rc = SendReceive2(xid, ses, iov, num, &resp_buftype, flags, &rsp_iov); cifs_small_buf_release(req); rsp = (struct smb2_set_info_rsp *)rsp_iov.iov_base; if (rc != 0) cifs_stats_fail_inc(tcon, SMB2_SET_INFO_HE); free_rsp_buf(resp_buftype, rsp); kfree(iov); return rc; }
false
false
false
false
false
0
count_nondeletable_pages(Relation onerel, LVRelStats *vacrelstats) { BlockNumber blkno; /* Strange coding of loop control is needed because blkno is unsigned */ blkno = vacrelstats->rel_pages; while (blkno > vacrelstats->nonempty_pages) { Buffer buf; Page page; OffsetNumber offnum, maxoff; bool hastup; /* * We don't insert a vacuum delay point here, because we have an * exclusive lock on the table which we want to hold for as short a * time as possible. We still need to check for interrupts however. */ CHECK_FOR_INTERRUPTS(); blkno--; buf = ReadBufferExtended(onerel, MAIN_FORKNUM, blkno, RBM_NORMAL, vac_strategy); /* In this phase we only need shared access to the buffer */ LockBuffer(buf, BUFFER_LOCK_SHARE); page = BufferGetPage(buf); if (PageIsNew(page) || PageIsEmpty(page)) { /* PageIsNew probably shouldn't happen... */ UnlockReleaseBuffer(buf); continue; } hastup = false; maxoff = PageGetMaxOffsetNumber(page); for (offnum = FirstOffsetNumber; offnum <= maxoff; offnum = OffsetNumberNext(offnum)) { ItemId itemid; itemid = PageGetItemId(page, offnum); /* * Note: any non-unused item should be taken as a reason to keep * this page. We formerly thought that DEAD tuples could be * thrown away, but that's not so, because we'd not have cleaned * out their index entries. */ if (ItemIdIsUsed(itemid)) { hastup = true; break; /* can stop scanning */ } } /* scan along page */ UnlockReleaseBuffer(buf); /* Done scanning if we found a tuple here */ if (hastup) return blkno + 1; } /* * If we fall out of the loop, all the previously-thought-to-be-empty * pages still are; we need not bother to look at the last known-nonempty * page. */ return vacrelstats->nonempty_pages; }
false
false
false
false
false
0
account_get_logged_in_init_socket(const char *name) { int i; for (i=0; i < socket_info.allocated_sockets; i++) { if (init_sockets[i].status == Ns_Add && init_sockets[i].account_name && !strcasecmp(init_sockets[i].account_name, name)) return(&init_sockets[i]); } return NULL; }
false
false
false
false
false
0
gwy_statusbar_update_markup(GtkStatusbar *statusbar, G_GNUC_UNUSED guint context_id, const gchar *text) { g_return_if_fail(GTK_IS_STATUSBAR(statusbar)); if (!text) text = ""; /* FIXME: this causes size allocation request */ gtk_label_set_markup(GTK_LABEL(statusbar->label), text); }
false
false
false
false
false
0
ArgusEncode64 (const char *ptr, int len, char *str, int slen) { int retn = 0; const unsigned char *in = (const unsigned char *)ptr; unsigned char *buf = (unsigned char *) str; unsigned char oval; unsigned newlen; if (ptr && ((newlen = (len + 2) / 3 * 4) < slen)) { while (len >= 3) { *buf++ = basis_64[in[0] >> 2]; *buf++ = basis_64[((in[0] << 4) & 0x30) | (in[1] >> 4)]; *buf++ = basis_64[((in[1] << 2) & 0x3c) | (in[2] >> 6)]; *buf++ = basis_64[in[2] & 0x3f]; in += 3; len -= 3; } if (len > 0) { *buf++ = basis_64[in[0] >> 2]; oval = (in[0] << 4) & 0x30; if (len > 1) oval |= in[1] >> 4; *buf++ = basis_64[oval]; *buf++ = (len < 2) ? '=' : basis_64[(in[1] << 2) & 0x3c]; *buf++ = '='; } if (newlen < slen) *buf = '\0'; retn = newlen; } return (retn); }
false
false
false
false
false
0
nv4e_i2c_bus_new(struct nvkm_i2c_pad *pad, int id, u8 drive, struct nvkm_i2c_bus **pbus) { struct nv4e_i2c_bus *bus; if (!(bus = kzalloc(sizeof(*bus), GFP_KERNEL))) return -ENOMEM; *pbus = &bus->base; nvkm_i2c_bus_ctor(&nv4e_i2c_bus_func, pad, id, &bus->base); bus->addr = 0x600800 + drive; return 0; }
false
false
false
false
false
0
ajGraphNewpage(AjPGraph thys, AjBool resetdefaults) { ajint old; ajint cold; float fold; ajDebug("ajGraphNewPage reset:%B\n", resetdefaults); if(graphData) { GraphDatafileNext(); return; } GraphSubPage(0); if(resetdefaults) { ajGraphicsSetFgcolour(BLACK); ajGraphicsSetCharscale(1.0); ajGraphicsSetLinestyle(0); } else { /* pladv resets every thing so need */ /* to get the old copies */ cold = ajGraphicsSetFgcolour(BLACK); fold = ajGraphicsSetCharscale(0.0); old = ajGraphicsSetLinestyle(0); ajGraphTrace(thys); GraphLabelTitle(((thys->flags & AJGRAPH_TITLE) ? ajStrGetPtr(thys->title) : " "), ((thys->flags & AJGRAPH_SUBTITLE) ? ajStrGetPtr(thys->subtitle) : " ")); if(thys->windowset) GraphSetWin(thys->xstart, thys->xend, thys->ystart, thys->yend); else GraphSetWin(0.0, 480.0, 0.0, 640.0); /* then set it again */ ajGraphicsSetFgcolour(cold); ajGraphicsSetCharscale(fold); ajGraphicsSetLinestyle(old); } return; }
false
false
false
false
false
0
folder_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { switch (property_id) { case PROP_DESCRIPTION: camel_folder_set_description ( CAMEL_FOLDER (object), g_value_get_string (value)); return; case PROP_DISPLAY_NAME: camel_folder_set_display_name ( CAMEL_FOLDER (object), g_value_get_string (value)); return; case PROP_FULL_NAME: camel_folder_set_full_name ( CAMEL_FOLDER (object), g_value_get_string (value)); return; case PROP_PARENT_STORE: folder_set_parent_store ( CAMEL_FOLDER (object), g_value_get_object (value)); return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); }
false
false
false
false
false
0
__Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_4294967295 = PyInt_FromString((char *)"4294967295", 0, 0); if (unlikely(!__pyx_int_4294967295)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; }
false
false
false
false
false
0
setRepetitions(int repetitions) { _rtt.clear(); _rtt.resize(repetitions, 0); _errors.assign(repetitions, ""); }
false
false
false
false
false
0
_ocfs2_free_clusters(handle_t *handle, struct inode *bitmap_inode, struct buffer_head *bitmap_bh, u64 start_blk, unsigned int num_clusters, void (*undo_fn)(unsigned int bit, unsigned long *bitmap)) { int status; u16 bg_start_bit; u64 bg_blkno; struct ocfs2_dinode *fe; /* You can't ever have a contiguous set of clusters * bigger than a block group bitmap so we never have to worry * about looping on them. * This is expensive. We can safely remove once this stuff has * gotten tested really well. */ BUG_ON(start_blk != ocfs2_clusters_to_blocks(bitmap_inode->i_sb, ocfs2_blocks_to_clusters(bitmap_inode->i_sb, start_blk))); fe = (struct ocfs2_dinode *) bitmap_bh->b_data; ocfs2_block_to_cluster_group(bitmap_inode, start_blk, &bg_blkno, &bg_start_bit); trace_ocfs2_free_clusters((unsigned long long)bg_blkno, (unsigned long long)start_blk, bg_start_bit, num_clusters); status = _ocfs2_free_suballoc_bits(handle, bitmap_inode, bitmap_bh, bg_start_bit, bg_blkno, num_clusters, undo_fn); if (status < 0) { mlog_errno(status); goto out; } ocfs2_local_alloc_seen_free_bits(OCFS2_SB(bitmap_inode->i_sb), num_clusters); out: if (status) mlog_errno(status); return status; }
false
false
false
false
false
0
movePoint(int index, const QPointF &point, bool emitUpdate) { m_points[index] = bound_point(point, boundingRect(), m_locks.at(index)); if (emitUpdate) { firePointChange(); } }
false
false
false
false
false
0
eeprom_93xx46_bin_write(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) { struct eeprom_93xx46_dev *edev; struct device *dev; int i, ret, step = 1; dev = container_of(kobj, struct device, kobj); edev = dev_get_drvdata(dev); /* only write even number of bytes on 16-bit devices */ if (edev->addrlen == 6) { step = 2; count &= ~1; } /* erase/write enable */ ret = eeprom_93xx46_ew(edev, 1); if (ret) return ret; mutex_lock(&edev->lock); if (edev->pdata->prepare) edev->pdata->prepare(edev); for (i = 0; i < count; i += step) { ret = eeprom_93xx46_write_word(edev, &buf[i], off + i); if (ret) { dev_err(&edev->spi->dev, "write failed at %d: %d\n", (int)off + i, ret); break; } } if (edev->pdata->finish) edev->pdata->finish(edev); mutex_unlock(&edev->lock); /* erase/write disable */ eeprom_93xx46_ew(edev, 0); return ret ? : count; }
false
false
false
false
false
0
unix_slashes(char *buf) { /* * Convert "~/" into "HOME>>". */ if(strncmp(buf, "~/", 2) == 0) { strdel(buf, 2); strins(buf, "HOME" FM_DEREF_TOKEN, 0); } #if defined(WIN32) int len = strlen(buf); for(int i = 0; i < len; ++i) if(buf[i] == '\\') buf[i] = '/'; #elif defined(MACOS) int start = 0; int len = strlen(buf); for(int i = start; i < len; ++i) if(buf[i] == ':') buf[i] = '/'; #endif no_double_slashes(buf); }
false
false
false
false
false
0
do_find_free_inode(int argc, char *argv[]) { ext2_ino_t free_inode, dir; int mode; int retval; char *tmp; if (argc > 3 || (argc>1 && *argv[1] == '?')) { com_err(argv[0], 0, "Usage: find_free_inode [dir] [mode]"); return; } if (check_fs_open(argv[0])) return; if (argc > 1) { dir = strtol(argv[1], &tmp, 0); if (*tmp) { com_err(argv[0], 0, "Bad dir - %s", argv[1]); return; } } else dir = root; if (argc > 2) { mode = strtol(argv[2], &tmp, 0); if (*tmp) { com_err(argv[0], 0, "Bad mode - %s", argv[2]); return; } } else mode = 010755; retval = ext2fs_new_inode(current_fs, dir, mode, 0, &free_inode); if (retval) com_err("ext2fs_new_inode", retval, 0); else printf("Free inode found: %u\n", free_inode); }
false
false
false
false
false
0
e_util_slist_to_strv (const GSList *strings) { const GSList *iter; GPtrArray *array; array = g_ptr_array_sized_new (g_slist_length ((GSList *) strings) + 1); for (iter = strings; iter; iter = iter->next) { const gchar *str = iter->data; if (str) g_ptr_array_add (array, g_strdup (str)); } /* NULL-terminated */ g_ptr_array_add (array, NULL); return (gchar **) g_ptr_array_free (array, FALSE); }
false
false
false
false
false
0
inf_gtk_certificate_dialog_new(GtkWindow* parent, GtkDialogFlags dialog_flags, InfGtkCertificateDialogFlags certificate_flags, const gchar* hostname, InfCertificateChain* certificate_chain) { GObject* object; g_return_val_if_fail(parent == NULL || GTK_IS_WINDOW(parent), NULL); g_return_val_if_fail(certificate_flags != 0, NULL); g_return_val_if_fail(hostname != NULL, NULL); g_return_val_if_fail(certificate_chain != NULL, NULL); object = g_object_new( INF_GTK_TYPE_CERTIFICATE_DIALOG, "certificate-chain", certificate_chain, "certificate-flags", certificate_flags, "hostname", hostname, NULL ); if(dialog_flags & GTK_DIALOG_MODAL) gtk_window_set_modal(GTK_WINDOW(object), TRUE); if(dialog_flags & GTK_DIALOG_DESTROY_WITH_PARENT) gtk_window_set_destroy_with_parent(GTK_WINDOW(object), TRUE); #if !GTK_CHECK_VERSION(2,90,7) if(dialog_flags & GTK_DIALOG_NO_SEPARATOR) gtk_dialog_set_has_separator(GTK_DIALOG(object), FALSE); #endif gtk_window_set_transient_for(GTK_WINDOW(object), parent); return INF_GTK_CERTIFICATE_DIALOG(object); }
false
false
false
false
false
0
span_log_init(logging_state_t *s, int level, const char *tag) { if (s == NULL) { if ((s = (logging_state_t *) malloc(sizeof(*s))) == NULL) return NULL; } s->span_error = __span_error; s->span_message = __span_message; s->level = level; s->tag = tag; s->protocol = NULL; s->samples_per_second = SAMPLE_RATE; s->elapsed_samples = 0; return s; }
false
false
false
false
false
0
ParseTransportableItem(AString *token) { int r = -1; for (int i=0; i<NITEMS; i++) { if(ItemDefs[i].flags & ItemType::DISABLED) continue; if(ItemDefs[i].flags & ItemType::NOTRANSPORT) continue; if(ItemDefs[i].flags & ItemType::CANTGIVE) continue; if (ItemDefs[i].type & IT_ILLUSION) { if ((*token == (AString("i") + ItemDefs[i].name)) || (*token == (AString("i") + ItemDefs[i].names)) || (*token == (AString("i") + ItemDefs[i].abr))) { r = i; break; } } else { if ((*token == ItemDefs[i].name) || (*token == ItemDefs[i].names) || (*token == ItemDefs[i].abr)) { r = i; break; } } } if(r != -1) { if(ItemDefs[r].flags & ItemType::DISABLED) r = -1; } return r; }
false
false
false
false
false
0
add_conflict_symbol(int state_no, int symbol) { struct node *p; p = Allocate_node(); p -> value = symbol; if (conflict_symbols[state_no] == NULL) p -> next = p; else { p -> next = conflict_symbols[state_no] -> next; conflict_symbols[state_no] -> next = p; } conflict_symbols[state_no] = p; return; }
false
false
false
false
false
0
cp_real10(const String &str, int frac_digits, int32_t *result) { DecimalFixedPointArg dfpa(frac_digits); if (!dfpa.parse_saturating(str, *result)) { cp_errno = CPE_FORMAT; return false; } else if (dfpa.status == dfpa.status_range) cp_errno = CPE_OVERFLOW; else cp_errno = CPE_OK; return true; }
false
false
false
false
false
0
tapeConfigLoadCbk (void *data) { int rval = 1 ; long iv ; int bv ; FILE *fp = (FILE *) data ; char *dir ; if (getString (topScope,"backlog-directory",&dir,NO_INHERIT)) { if (tapeDirectory != NULL && strcmp (tapeDirectory,dir) != 0) { syslog (LOG_ERR,NO_CHANGE_BACKLOG) ; FREE (dir) ; dir = strdup (tapeDirectory) ; } if (!isDirectory (dir) && isDirectory (TAPE_DIRECTORY)) { logOrPrint (LOG_ERR,fp,BAD_TAPEDIR_CHANGE,dir,TAPE_DIRECTORY) ; FREE (dir) ; dir = strdup (TAPE_DIRECTORY) ; } else if (!isDirectory (dir)) logAndExit (1,NO_TAPE_DIR) ; } else if (!isDirectory (TAPE_DIRECTORY)) logAndExit (1,NO_TAPE_DIR) ; else dir = strdup (TAPE_DIRECTORY) ; if (tapeDirectory != NULL) FREE (tapeDirectory) ; tapeDirectory = dir ; if (getInteger (topScope,"backlog-highwater",&iv,NO_INHERIT)) { if (iv < 0) { rval = 0 ; logOrPrint (LOG_ERR,fp,LESS_THAN_ZERO,"backlog-highwater", iv,"global scope",(long)TAPE_HIGHWATER); iv = TAPE_HIGHWATER ; } } else iv = TAPE_HIGHWATER ; tapeHighwater = (u_int) iv ; if (getInteger (topScope,"backlog-rotate-period",&iv,NO_INHERIT)) { if (iv < 0) { rval = 0 ; logOrPrint (LOG_ERR,fp,LESS_THAN_ZERO,"backlog-rotate-period", iv,"global scope",(long)TAPE_ROTATE_PERIOD); iv = TAPE_ROTATE_PERIOD ; } } else iv = TAPE_ROTATE_PERIOD ; rotatePeriod = (u_int) iv ; if (getInteger (topScope,"backlog-ckpt-period",&iv,NO_INHERIT)) { if (iv < 0) { rval = 0 ; logOrPrint (LOG_ERR,fp,LESS_THAN_ZERO,"backlog-ckpt-period",iv, "global scope",(long)TAPE_CHECKPOINT_PERIOD); iv = TAPE_CHECKPOINT_PERIOD ; } } else iv = TAPE_CHECKPOINT_PERIOD ; tapeCkPtPeriod = (u_int) iv ; if (getInteger (topScope,"backlog-newfile-period",&iv,NO_INHERIT)) { if (iv < 0) { rval = 0 ; logOrPrint (LOG_ERR,fp,LESS_THAN_ZERO,"backlog-newfile-period", iv,"global scope",(long)TAPE_NEWFILE_PERIOD); iv = TAPE_NEWFILE_PERIOD ; } } else iv = TAPE_NEWFILE_PERIOD ; tapeCkNewFilePeriod = (u_int) iv ; if (getBool (topScope,"debug-shrinking",&bv,NO_INHERIT)) debugShrinking = (bv ? true : false) ; return rval ; }
false
false
false
false
false
0
force_reg (enum machine_mode mode, rtx x) { rtx temp, insn, set; if (REG_P (x)) return x; if (general_operand (x, mode)) { temp = gen_reg_rtx (mode); insn = emit_move_insn (temp, x); } else { temp = force_operand (x, NULL_RTX); if (REG_P (temp)) insn = get_last_insn (); else { rtx temp2 = gen_reg_rtx (mode); insn = emit_move_insn (temp2, temp); temp = temp2; } } /* Let optimizers know that TEMP's value never changes and that X can be substituted for it. Don't get confused if INSN set something else (such as a SUBREG of TEMP). */ if (CONSTANT_P (x) && (set = single_set (insn)) != 0 && SET_DEST (set) == temp && ! rtx_equal_p (x, SET_SRC (set))) set_unique_reg_note (insn, REG_EQUAL, x); /* Let optimizers know that TEMP is a pointer, and if so, the known alignment of that pointer. */ { unsigned align = 0; if (GET_CODE (x) == SYMBOL_REF) { align = BITS_PER_UNIT; if (SYMBOL_REF_DECL (x) && DECL_P (SYMBOL_REF_DECL (x))) align = DECL_ALIGN (SYMBOL_REF_DECL (x)); } else if (GET_CODE (x) == LABEL_REF) align = BITS_PER_UNIT; else if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS && GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF && CONST_INT_P (XEXP (XEXP (x, 0), 1))) { rtx s = XEXP (XEXP (x, 0), 0); rtx c = XEXP (XEXP (x, 0), 1); unsigned sa, ca; sa = BITS_PER_UNIT; if (SYMBOL_REF_DECL (s) && DECL_P (SYMBOL_REF_DECL (s))) sa = DECL_ALIGN (SYMBOL_REF_DECL (s)); if (INTVAL (c) == 0) align = sa; else { ca = ctz_hwi (INTVAL (c)) * BITS_PER_UNIT; align = MIN (sa, ca); } } if (align || (MEM_P (x) && MEM_POINTER (x))) mark_reg_pointer (temp, align); } return temp; }
false
false
false
false
false
0
lua_copytagmethods (int tagto, int tagfrom) { int e; checktag(tagto); checktag(tagfrom); for (e=0; e<IM_N; e++) { if (validevent(tagto, e)) *luaT_getim(tagto, e) = *luaT_getim(tagfrom, e); } return tagto; }
false
false
false
false
false
0
quote_string (dst, src) char *dst, *src; { U_CHAR c; *dst++ = '\"'; for (;;) switch ((c = *src++)) { default: if (isprint (c)) *dst++ = c; else { sprintf (dst, "\\%03o", c); dst += 4; } break; case '\"': case '\\': *dst++ = '\\'; *dst++ = c; break; case '\0': *dst++ = '\"'; *dst = '\0'; return dst; } }
false
false
false
false
false
0
combo_set_list(void *_object, GB_ARRAY array) { int i; QString text = COMBOBOX->currentText(); COMBOBOX->blockSignals(true); COMBOBOX->clear(); if (array) { for (i = 0; i < GB.Array.Count(array); i++) { COMBOBOX->insertItem(TO_QSTRING(*((char **)GB.Array.Get(array, i)))); } } COMBOBOX->setDirty(); combo_set_text(THIS, text); if (!COMBOBOX->isEditable()) { if (combo_get_current_item(THIS) < 0) combo_set_current_item(THIS, 0); } COMBOBOX->blockSignals(false); }
false
false
false
false
false
0
parse_htpl_switch_rnd___fwd(stack, untag) int untag; STR stack; { TOKEN token; static done = 0; STR buff; int code; static int nesting = 0; static int refcount = 0; refcount++; makepersist(stack); pushscope(scope_random_switch, 0); printcode("{\n"); code = 1; kludge_reunifying = 1; asprintf(&buff, "SWITCH CASE"); kludge_reunifying = 0; nest++; code = parse_htpl(buff, untag); nest--; if (!code) { croak("Unification of '%s' failed", buff); free(buff); RETURN(0) } free(buff); nesting = 0; RETURN(1) }
false
false
false
false
false
0
shadeBoundedIfThenElse1(GLERectangle* bounds, double p, double step1) { // if x1+p*s > y1 then if (bounds->getXMax()+p*step1 > bounds->getYMax()) { // aline y1-p*s y1 cairo_line_to(m_cr, bounds->getYMax()-p*step1, bounds->getYMax()); } else { // aline x1 x1+p*s cairo_line_to(m_cr, bounds->getXMax(), bounds->getXMax()+p*step1); } cairo_stroke(m_cr); }
false
false
false
false
false
0
print_packet(uint8_t *pack) { struct ethhdr *ethhdr = (struct ethhdr *)pack; struct pppoe_hdr *hdr = (struct pppoe_hdr *)(pack + ETH_HLEN); struct pppoe_tag *tag; int n; log_info2("[PPPoE "); switch (hdr->code) { case CODE_PADI: log_info2("PADI"); break; case CODE_PADO: log_info2("PADO"); break; case CODE_PADR: log_info2("PADR"); break; case CODE_PADS: log_info2("PADS"); break; case CODE_PADT: log_info2("PADT"); break; } log_info2(" %02x:%02x:%02x:%02x:%02x:%02x => %02x:%02x:%02x:%02x:%02x:%02x", ethhdr->h_source[0], ethhdr->h_source[1], ethhdr->h_source[2], ethhdr->h_source[3], ethhdr->h_source[4], ethhdr->h_source[5], ethhdr->h_dest[0], ethhdr->h_dest[1], ethhdr->h_dest[2], ethhdr->h_dest[3], ethhdr->h_dest[4], ethhdr->h_dest[5]); log_info2(" sid=%04x", ntohs(hdr->sid)); for (n = 0; n < ntohs(hdr->length); n += sizeof(*tag) + ntohs(tag->tag_len)) { tag = (struct pppoe_tag *)(pack + ETH_HLEN + sizeof(*hdr) + n); switch (ntohs(tag->tag_type)) { case TAG_END_OF_LIST: log_info2(" <End-Of-List>"); break; case TAG_SERVICE_NAME: log_info2(" <Service-Name "); print_tag_string(tag); log_info2(">"); break; case TAG_AC_NAME: log_info2(" <AC-Name "); print_tag_string(tag); log_info2(">"); break; case TAG_HOST_UNIQ: log_info2(" <Host-Uniq "); print_tag_octets(tag); log_info2(">"); break; case TAG_AC_COOKIE: log_info2(" <AC-Cookie "); print_tag_octets(tag); log_info2(">"); break; case TAG_VENDOR_SPECIFIC: if (ntohs(tag->tag_len) < 4) log_info2(" <Vendor-Specific invalid>"); else log_info2(" <Vendor-Specific %x>", ntohl(*(uint32_t *)tag->tag_data)); break; case TAG_RELAY_SESSION_ID: log_info2(" <Relay-Session-Id"); print_tag_octets(tag); log_info2(">"); break; case TAG_SERVICE_NAME_ERROR: log_info2(" <Service-Name-Error>"); break; case TAG_AC_SYSTEM_ERROR: log_info2(" <AC-System-Error>"); break; case TAG_GENERIC_ERROR: log_info2(" <Generic-Error>"); break; default: log_info2(" <Unknown (%x)>", ntohs(tag->tag_type)); break; } } log_info2("]\n"); }
false
false
false
false
false
0
gtab_get_preedit(char *str, GCIN_PREEDIT_ATTR attr[], int *pcursor, int *sub_comp_len) { int i=0; int strN=0; int attrN=0; int ch_N=0; // dbg("gtab_get_preedit\n"); str[0]=0; *pcursor=0; #if WIN32 || 1 *sub_comp_len = ggg.ci > 0; #if 1 if (ggg.gbufN && !gcin_edit_display_ap_only()) *sub_comp_len|=4; #endif #endif gboolean ap_only = gcin_edit_display_ap_only(); if (gtab_phrase_on()) { attr[0].flag=GCIN_PREEDIT_ATTR_FLAG_UNDERLINE; attr[0].ofs0=0; if (ggg.gbufN) attrN=1; gboolean last_is_en_word = FALSE; for(i=0; i < ggg.gbufN; i++) { char *s = gbuf[i].ch; char tt[MAX_CIN_PHR+2]; if (en_word_len(s) && !(gbuf[i].flag & FLAG_CHPHO_GTAB_BUF_EN_NO_SPC)) { if (last_is_en_word) { strcpy(tt, " "); strcat(tt, s); s = tt; } last_is_en_word = TRUE; } else { last_is_en_word = FALSE; } int len = strlen(s); int N = utf8_str_N(s); ch_N+=N; if (i < ggg.gbuf_cursor) *pcursor+=N; if (ap_only && i==ggg.gbuf_cursor) { attr[1].ofs0=*pcursor; attr[1].ofs1=*pcursor+N; attr[1].flag=GCIN_PREEDIT_ATTR_FLAG_REVERSE; attrN++; } if (gcin_display_on_the_spot_key() && i==ggg.gbuf_cursor) strN += get_DispInArea_str(str+strN); memcpy(str+strN, s, len); strN+=len; } } if (gcin_display_on_the_spot_key() && i==ggg.gbuf_cursor) strN += get_DispInArea_str(str+strN); str[strN]=0; attr[0].ofs1 = ch_N; return attrN; }
true
true
false
false
false
1
appendLinearRingTaggedText(const LinearRing* linearRing, int level, Writer *writer) { writer->write("LINEARRING "); if( outputDimension == 3 && !old3D && !linearRing->isEmpty() ) writer->write( "Z " ); appendLineStringText((LineString*)linearRing, level, false, writer); }
false
false
false
false
false
0
FillInReductionPop(WiggleIterator * wi) { if (wi->done) return; WiggleReducerData * data = (WiggleReducerData *) wi->data; Multiplexer * multi = data->multi; if (multi->done) { wi->done = true; return; } wi->chrom = multi->chrom; wi->start = multi->start; wi->finish = multi->finish; if (multi->inplay[1]) wi->value = multi->values[1]; else wi->value = multi->default_values[1]; popMultiplexer(multi); }
false
false
false
false
false
0
operator- (void) { switch (this->type_) { case ACE_ETCL_DOUBLE: return ETCL_Literal_Constraint (- this->op_.double_); case ACE_ETCL_INTEGER: case ACE_ETCL_SIGNED: return ETCL_Literal_Constraint (- this->op_.integer_); case ACE_ETCL_UNSIGNED: return ETCL_Literal_Constraint (- (ACE_CDR::Long) this->op_.uinteger_); default: return ETCL_Literal_Constraint ((ACE_CDR::Long) 0); } }
false
false
false
false
false
0
octeon_get_tx_qsize(struct octeon_device *oct, u32 q_no) { if (oct && (q_no < MAX_OCTEON_INSTR_QUEUES) && (oct->io_qmask.iq & (1UL << q_no))) return oct->instr_queue[q_no]->max_count; return -1; }
false
false
false
false
false
0
gsb_data_partial_balance_init_from_liste_cptes ( gint partial_balance_number, GtkWidget *parent ) { struct_partial_balance *partial_balance; gchar **tab; gint i; gint account_nb; gint currency_nb = 0; kind_account kind = -1; kind_account kind_nb = -1; gchar *tmp_str; gboolean return_val = TRUE; gboolean currency_mixte = FALSE; partial_balance = gsb_data_partial_balance_get_structure ( partial_balance_number ); if ( !partial_balance ) return FALSE; if ( partial_balance -> liste_cptes == NULL || strlen ( partial_balance -> liste_cptes ) == 0 ) return FALSE; tab = g_strsplit ( partial_balance -> liste_cptes, ";", 0 ); for ( i = 0; tab[i]; i++ ) { gint account_currency; account_nb = utils_str_atoi ( tab[i] ); account_currency = gsb_data_account_get_currency ( account_nb ); if ( currency_nb == 0 ) currency_nb = account_currency; else if ( currency_nb != account_currency ) { if ( currency_mixte == FALSE ) { no_devise_solde_partiels = gsb_partial_balance_request_currency ( parent ); if ( gsb_data_currency_link_search ( currency_nb, account_currency ) == 0 ) { tmp_str = g_strdup_printf ( _("You need to create a link between currency %s and %s."), gsb_data_currency_get_name ( currency_nb ), gsb_data_currency_get_name ( account_currency ) ); dialogue_warning_hint ( tmp_str, _("Attention missing link between currencies") ); } } currency_mixte = TRUE; return_val = FALSE; } if ( kind == -1 ) kind = gsb_data_account_get_kind ( account_nb ); else if ( ( kind_nb = gsb_data_account_get_kind ( account_nb ) ) != kind ) { switch ( kind ) { case GSB_TYPE_BANK: case GSB_TYPE_CASH: if ( kind_nb >= GSB_TYPE_LIABILITIES ) return_val = FALSE; break; case GSB_TYPE_LIABILITIES: return_val = FALSE; break; case GSB_TYPE_ASSET: return_val = FALSE; break; } } } if ( currency_mixte ) gsb_data_partial_balance_set_currency ( partial_balance_number, no_devise_solde_partiels ); else gsb_data_partial_balance_set_currency ( partial_balance_number, currency_nb ); if ( return_val == FALSE ) gsb_data_partial_balance_set_kind ( partial_balance_number, -1 ); else gsb_data_partial_balance_set_kind ( partial_balance_number, kind ); return return_val; }
false
false
false
false
false
0
evas_object_image_render_post(Evas_Object *obj) { Evas_Object_Image *o; Eina_Rectangle *r; /* this moves the current data to the previous state parts of the object */ /* in whatever way is safest for the object. also if we don't need object */ /* data anymore we can free it if the object deems this is a good idea */ o = (Evas_Object_Image *)(obj->object_data); /* remove those pesky changes */ evas_object_clip_changes_clean(obj); EINA_LIST_FREE(o->pixel_updates, r) eina_rectangle_free(r); /* move cur to prev safely for object data */ evas_object_cur_prev(obj); o->prev = o->cur; o->changed = 0; /* FIXME: copy strings across */ }
false
false
false
false
false
0
_nss_dns_getnetbyname_r (const char *name, struct netent *result, char *buffer, size_t buflen, int *errnop, int *herrnop) { /* Return entry for network with NAME. */ union { querybuf *buf; u_char *ptr; } net_buffer; querybuf *orig_net_buffer; int anslen; char *qbuf; enum nss_status status; if (__res_maybe_init (&_res, 0) == -1) return NSS_STATUS_UNAVAIL; qbuf = strdupa (name); net_buffer.buf = orig_net_buffer = (querybuf *) alloca (1024); anslen = __libc_res_nsearch (&_res, qbuf, C_IN, T_PTR, net_buffer.buf->buf, 1024, &net_buffer.ptr, NULL, NULL, NULL); if (anslen < 0) { /* Nothing found. */ *errnop = errno; if (net_buffer.buf != orig_net_buffer) free (net_buffer.buf); return (errno == ECONNREFUSED || errno == EPFNOSUPPORT || errno == EAFNOSUPPORT) ? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND; } status = getanswer_r (net_buffer.buf, anslen, result, buffer, buflen, errnop, herrnop, BYNAME); if (net_buffer.buf != orig_net_buffer) free (net_buffer.buf); return status; }
false
false
false
false
false
0
rsvg_handle_has_sub (RsvgHandle * handle, const char *id) { g_return_val_if_fail (handle, FALSE); if (G_UNLIKELY (!id || !id[0])) return FALSE; return rsvg_defs_lookup (handle->priv->defs, id) != NULL; }
false
false
false
false
false
0
NumberValue() const { i::Isolate* isolate = i::Isolate::Current(); if (IsDeadCheck(isolate, "v8::NumberObject::NumberValue()")) return 0; LOG_API(isolate, "NumberObject::NumberValue"); i::Handle<i::Object> obj = Utils::OpenHandle(this); i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); return jsvalue->value()->Number(); }
false
false
false
false
false
0
EXTRACTOR_IPC_shared_memory_create_ (size_t size) { struct EXTRACTOR_SharedMemory *shm; const char *tpath; if (NULL == (shm = malloc (sizeof (struct EXTRACTOR_SharedMemory)))) { LOG_STRERROR ("malloc"); return NULL; } #if SOMEBSD /* this works on FreeBSD, not sure about others... */ tpath = getenv ("TMPDIR"); if (tpath == NULL) tpath = "/tmp/"; #else tpath = "/"; /* Linux */ #endif snprintf (shm->shm_name, MAX_SHM_NAME, "%sLE-%u-%u", tpath, getpid (), (unsigned int) RANDOM()); if (-1 == (shm->shm_id = shm_open (shm->shm_name, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR))) { LOG_STRERROR_FILE ("shm_open", shm->shm_name); free (shm); return NULL; } if ( (0 != ftruncate (shm->shm_id, size)) || (NULL == (shm->shm_ptr = mmap (NULL, size, PROT_WRITE, MAP_SHARED, shm->shm_id, 0))) || (((void*) -1) == shm->shm_ptr) ) { LOG_STRERROR ("ftruncate/mmap"); (void) close (shm->shm_id); (void) shm_unlink (shm->shm_name); free (shm); return NULL; } shm->shm_size = size; shm->rc = 0; return shm; }
false
false
false
false
false
0
OnTestCaseStart(const TestCase& test_case) { test_case_name_ = test_case.name(); const internal::String counts = FormatCountableNoun(test_case.test_to_run_count(), "test", "tests"); ColoredPrintf(COLOR_GREEN, "[----------] "); printf("%s from %s", counts.c_str(), test_case_name_.c_str()); if (test_case.comment()[0] == '\0') { printf("\n"); } else { printf(", where %s\n", test_case.comment()); } fflush(stdout); }
false
false
false
false
false
0
NC3_new_nc(NC** ncpp) { NC *ncp; #if _CRAYMPP && defined(LOCKNUMREC) ncp = (NC *) shmalloc(sizeof(NC)); #else ncp = (NC *) malloc(sizeof(NC)); #endif /* _CRAYMPP && LOCKNUMREC */ if(ncp == NULL) return NC_ENOMEM; (void) memset(ncp, 0, sizeof(NC)); ncp->xsz = MIN_NC_XSZ; assert(ncp->xsz == ncx_len_NC(ncp,0)); if(ncpp) *ncpp = ncp; return NC_NOERR; }
false
false
false
false
false
0
ConnectCB(int status) { ostringstream osstr; if (status != 0) { if (reconnect_attempt < 0) { globalreg->messagebus->InjectMessage("Could not connect to GPSD server", MSGFLAG_ERROR); globalreg->messagebus->InjectMessage("GPSD reconnection not enabled, " "disabling GPSD", MSGFLAG_ERROR); return; } /* snprintf(errstr, STATUS_MAX, "Could not connect to the GPSD server, will " "reconnect in %d seconds", kismin(reconnect_attempt + 1, 6) * 5); globalreg->messagebus->InjectMessage(errstr, MSGFLAG_ERROR); */ reconnect_attempt++; last_disconnect = globalreg->timestamp.tv_sec; return; } // Set the poll mode to initial setup and call the timer poll_mode = -1; last_hed_time = 0; si_units = 0; reconnect_attempt = 1; last_disconnect = 0; gps_connected = 0; return; }
false
false
false
false
false
0
validateForm(formTree* ft) { static bool guard = false; if(ft == NULL) return true; if(ft->path_selector == EXISTS || ft->path_selector == ALWAYS) { //nonparametric modal //check if all listed actions are ok string actname; for(int i = 0; i < (ft->elements)->elements; ++i) { actname = string((char*)get(ft->elements, i)); if(actions.count(actname) == 0) { cerr << "Formula error, no such action: " << actname << endl; return false; } } } else if(ft->path_selector == EXISTSPARA || ft->path_selector == ALWAYSPARA) { //parametric modal //build/gather BDD variables for actions string parvarname = ft->varName; vector<BDD> vv; //act_i + ... + act_k encoded for curr. var. which are not constant BDD locvar = manager.bddZero(); //act_i * ... * act_k encoded for curr. var. which are constant BDD loccvar = manager.bddOne(); if(parVariableNameToBDDVec.count(parvarname) == 0) { parVars.insert(parvarname); for(set<string>::const_iterator act = actions.begin(); act != actions.end(); ++act) { //collect BDD variables for parvarname BDD currvar; if(!guard) { currvar = getActionBDD(*act); origVarName = parvarname; } else currvar = manager.bddVar(); if((limits == NULL) || ((limits != NULL) && !isActionConst(*act))) locvar += currvar; else loccvar *= currvar; vv.push_back(currvar); } parVariableNameToBDDVec[parvarname] = vv; allVarSel *= locvar * loccvar; guard = true; nvars += actions.size(); } } else if(ft->path_selector == NONEPARA) { //booleans if(ft->opertr == MNONE) { //check if propositions are ok string proposition = ft->varName; if(propositions.count(proposition) == 0) { cerr << "Formula error, no such proposition: " << proposition << endl; return false; } else return true; } } else { cerr << "Formula validation error: check the source for bugs!" << endl; return false; } return validateForm(ft->left) && validateForm(ft->right); }
false
false
false
false
false
0
get_config_for_overwrite_prevention_cb (SyncevoSession *session, SyncevoConfig *config, GError *error, save_config_data *data) { static int index = 0; char *name; if (error) { index = 0; if (error->code == DBUS_GERROR_REMOTE_EXCEPTION && dbus_g_error_has_name (error, SYNCEVO_DBUS_ERROR_NO_SUCH_CONFIG)) { /* Config does not exist (as expected), we can now save */ syncevo_session_set_config (session, data->temporary, data->temporary, data->widget->config, (SyncevoSessionGenericCb)set_config_cb, data); return; } g_warning ("Unexpected error in Session.GetConfig: %s", error->message); g_error_free (error); g_object_unref (session); return; } /* Config exists when we are trying to create a new config... * Need to start a new session with another name */ g_object_unref (session); name = g_strdup_printf ("%s__%d", data->basename, ++index); sync_config_widget_set_name (data->widget, name); g_free (name); syncevo_server_start_no_sync_session (data->widget->server, data->widget->config_name, (SyncevoServerStartSessionCb)start_session_for_config_write_cb, data); }
false
false
false
false
false
0
ast_update_use_count(void) { /* Notify any module monitors that the use count for a resource has changed */ struct loadupdate *m; AST_LIST_LOCK(&updaters); AST_LIST_TRAVERSE(&updaters, m, entry) m->updater(); AST_LIST_UNLOCK(&updaters); }
false
false
false
false
false
0
writeAnimation(TiXmlElement* animsNode, const Animation* anim) { TiXmlElement* animNode = animsNode->InsertEndChild(TiXmlElement("animation"))->ToElement(); animNode->SetAttribute("name", anim->getName()); animNode->SetAttribute("length", StringConverter::toString(anim->getLength())); // Optional base keyframe information if (anim->getUseBaseKeyFrame()) { TiXmlElement* baseInfoNode = animNode->InsertEndChild(TiXmlElement("baseinfo"))->ToElement(); baseInfoNode->SetAttribute("baseanimationname", anim->getBaseKeyFrameAnimationName()); baseInfoNode->SetAttribute("basekeyframetime", StringConverter::toString(anim->getBaseKeyFrameTime())); } // Write all tracks TiXmlElement* tracksNode = animNode->InsertEndChild(TiXmlElement("tracks"))->ToElement(); Animation::NodeTrackIterator trackIt = anim->getNodeTrackIterator(); while (trackIt.hasMoreElements()) { writeAnimationTrack(tracksNode, trackIt.getNext()); } }
false
false
false
false
false
0
at76_load_internal_fw(struct usb_device *udev, struct fwentry *fwe) { int ret; int need_remap = !at76_is_505a(fwe->board_type); ret = at76_usbdfu_download(udev, fwe->intfw, fwe->intfw_size, need_remap ? 0 : 2 * HZ); if (ret < 0) { dev_err(&udev->dev, "downloading internal fw failed with %d\n", ret); goto exit; } at76_dbg(DBG_DEVSTART, "sending REMAP"); /* no REMAP for 505A (see SF driver) */ if (need_remap) { ret = at76_remap(udev); if (ret < 0) { dev_err(&udev->dev, "sending REMAP failed with %d\n", ret); goto exit; } } at76_dbg(DBG_DEVSTART, "sleeping for 2 seconds"); schedule_timeout_interruptible(2 * HZ + 1); usb_reset_device(udev); exit: return ret; }
false
false
false
false
false
0
destroy_async(struct usb_dev_state *ps, struct list_head *list) { struct urb *urb; struct async *as; unsigned long flags; spin_lock_irqsave(&ps->lock, flags); while (!list_empty(list)) { as = list_entry(list->next, struct async, asynclist); list_del_init(&as->asynclist); urb = as->urb; usb_get_urb(urb); /* drop the spinlock so the completion handler can run */ spin_unlock_irqrestore(&ps->lock, flags); usb_kill_urb(urb); usb_put_urb(urb); spin_lock_irqsave(&ps->lock, flags); } spin_unlock_irqrestore(&ps->lock, flags); }
false
false
false
false
false
0
update_glbl_clist(GtkWidget *calling_widget __unused, GtkWidget *edit_win_to_destroy) { int column; for (column = 0; column < COOKIE_COLUMNS; column++) { gtk_clist_set_text(GTK_CLIST(glbl_clist), glbl_clist_selected_row, column, glbl_selected_cookie[column] ); } glbl_last_sorted_column = -1; /* because we just set the text in a column somewhere in the clist, no columns can be assumed to be sorted anymore */ gtk_widget_destroy(edit_win_to_destroy); }
false
false
false
false
false
0
print_import_ok (PKT_public_key *pk, PKT_secret_key *sk, unsigned int reason) { byte array[MAX_FINGERPRINT_LEN], *s; char buf[MAX_FINGERPRINT_LEN*2+30], *p; size_t i, n; sprintf (buf, "%u ", reason); p = buf + strlen (buf); if (pk) fingerprint_from_pk (pk, array, &n); else fingerprint_from_sk (sk, array, &n); s = array; for (i=0; i < n ; i++, s++, p += 2) sprintf (p, "%02X", *s); write_status_text (STATUS_IMPORT_OK, buf); }
false
false
false
false
false
0
test_upload_default_album (UploadData *data, gconstpointer service) { GDataUploadStream *upload_stream; const gchar * const *tags, * const *tags2; gssize transfer_size; GError *error = NULL; gdata_test_mock_server_start_trace (mock_server, "upload-default-album"); /* Prepare the upload stream */ /* TODO right now, it will just go to the default album, we want an uploading one :| */ upload_stream = gdata_picasaweb_service_upload_file (GDATA_PICASAWEB_SERVICE (service), NULL, data->photo, data->slug, data->content_type, NULL, &error); g_assert_no_error (error); g_assert (GDATA_IS_UPLOAD_STREAM (upload_stream)); /* Upload the photo */ transfer_size = g_output_stream_splice (G_OUTPUT_STREAM (upload_stream), G_INPUT_STREAM (data->file_stream), G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, NULL, &error); g_assert_no_error (error); g_assert_cmpint (transfer_size, >, 0); /* Finish off the upload */ data->updated_photo = gdata_picasaweb_service_finish_file_upload (GDATA_PICASAWEB_SERVICE (service), upload_stream, &error); g_assert_no_error (error); g_assert (GDATA_IS_PICASAWEB_FILE (data->updated_photo)); /* Check the photo's properties */ g_assert (gdata_entry_is_inserted (GDATA_ENTRY (data->updated_photo))); g_assert_cmpstr (gdata_entry_get_title (GDATA_ENTRY (data->updated_photo)), ==, gdata_entry_get_title (GDATA_ENTRY (data->photo))); g_assert_cmpstr (gdata_picasaweb_file_get_caption (data->updated_photo), ==, gdata_picasaweb_file_get_caption (data->photo)); tags = gdata_picasaweb_file_get_tags (data->photo); tags2 = gdata_picasaweb_file_get_tags (data->updated_photo); g_assert_cmpuint (g_strv_length ((gchar**) tags2), ==, g_strv_length ((gchar**) tags)); g_assert_cmpstr (tags2[0], ==, tags[0]); g_assert_cmpstr (tags2[1], ==, tags[1]); g_assert_cmpstr (tags2[2], ==, tags[2]); gdata_mock_server_end_trace (mock_server); }
false
false
false
false
false
0
addEdgePoint (Agedge_t* ep, Dt_t* alist, agxbuf* xb) { gmlattr* ap; char* x = "0"; char* y = "0"; for (ap = dtfirst(alist); ap; ap = dtnext (alist, ap)) { if (ap->sort == XVAL) { x = ap->u.value; } else if (ap->sort == YVAL) { y = ap->u.value; } else { fprintf (stderr, "non-X/Y field in point attribute"); unknown ((Agobj_t*)ep, ap, xb); } } if (agxblen(xb)) agxbputc (xb, ' '); agxbput (xb, x); agxbputc (xb, ','); agxbput (xb, y); }
false
false
false
false
false
0
nemo_view_factory_create (const char *id, NemoWindowSlot *slot) { const NemoViewInfo *view_info; NemoView *view; view_info = nemo_view_factory_lookup (id); if (view_info == NULL) { return NULL; } view = view_info->create (slot); if (g_object_is_floating (view)) { g_object_ref_sink (view); } return view; }
false
false
false
false
false
0
find_entry(HashTable *ht,const void *key,size_t klen,const void *val) { HashEntry **hep, *he; unsigned int hash; hash = ht->Hash(key, &klen); /* scan linked list */ for (hep = &ht->array[hash & ht->max], he = *hep; he; hep = &he->next, he = *hep) { if (he->hash == hash && he->klen == klen && memcmp(he->key, key, klen) == 0) break; } if (he || !val) return hep; /* add a new entry for non-NULL values */ if ((he = ht->free) != NULL) ht->free = he->next; else he = iPool.Alloc(ht->pool, sizeof(*he)); he->next = NULL; he->hash = hash; he->key = key; he->klen = klen; memcpy(he->val,val,ht->ElementSize); *hep = he; ht->count++; return hep; }
false
false
false
false
false
0
flush() { CursesContainer *p=getParent(); if (p) p->flush(); }
false
false
false
false
false
0
crmf_generic_encoder_callback(void *arg, const char* buf, unsigned long len, int depth, SEC_ASN1EncodingPart data_kind) { struct crmfEncoderArg *encoderArg = (struct crmfEncoderArg*)arg; unsigned char *cursor; if (encoderArg->buffer->len + len > encoderArg->allocatedLen) { int newSize = encoderArg->buffer->len+CRMF_DEFAULT_ALLOC_SIZE; void *dummy = PORT_Realloc(encoderArg->buffer->data, newSize); if (dummy == NULL) { /* I really want to return an error code here */ PORT_Assert(0); return; } encoderArg->buffer->data = dummy; encoderArg->allocatedLen = newSize; } cursor = &(encoderArg->buffer->data[encoderArg->buffer->len]); PORT_Memcpy (cursor, buf, len); encoderArg->buffer->len += len; }
false
false
false
false
false
0
xps_rels_for_part(char *buf, char *name, int buflen) { char *p, *basename; p = strrchr(name, '/'); basename = p ? p + 1 : name; fz_strlcpy(buf, name, buflen); p = strrchr(buf, '/'); if (p) *p = 0; fz_strlcat(buf, "/_rels/", buflen); fz_strlcat(buf, basename, buflen); fz_strlcat(buf, ".rels", buflen); }
false
false
false
false
false
0
detail_send(rad_listen_t *listener, REQUEST *request) { int rtt; struct timeval now; listen_detail_t *data = listener->data; rad_assert(request->listener == listener); rad_assert(listener->send == detail_send); /* * This request timed out. Remember that, and tell the * caller it's OK to read more "detail" file stuff. */ if (request->reply->code == 0) { data->delay_time = data->retry_interval * USEC; data->signal = 1; data->state = STATE_NO_REPLY; RDEBUG("Detail - No response configured for request %d. Will retry in %d seconds", request->number, data->retry_interval); radius_signal_self(RADIUS_SIGNAL_SELF_DETAIL); return 0; } /* * We call gettimeofday a lot. But it should be OK, * because there's nothing else to do. */ gettimeofday(&now, NULL); /* * If we haven't sent a packet in the last second, reset * the RTT. */ now.tv_sec -= 1; if (timercmp(&data->last_packet, &now, <)) { data->has_rtt = FALSE; } now.tv_sec += 1; /* * Only one detail packet may be outstanding at a time, * so it's safe to update some entries in the detail * structure. * * We keep smoothed round trip time (SRTT), but not round * trip timeout (RTO). We use SRTT to calculate a rough * load factor. */ rtt = now.tv_sec - request->packet->timestamp.tv_sec; rtt *= USEC; rtt += now.tv_usec; rtt -= request->packet->timestamp.tv_usec; /* * If we're proxying, the RTT is our processing time, * plus the network delay there and back, plus the time * on the other end to process the packet. Ideally, we * should remove the network delays from the RTT, but we * don't know what they are. * * So, to be safe, we over-estimate the total cost of * processing the packet. */ if (!data->has_rtt) { data->has_rtt = TRUE; data->srtt = rtt; data->rttvar = rtt / 2; } else { data->rttvar -= data->rttvar >> 2; data->rttvar += (data->srtt - rtt); data->srtt -= data->srtt >> 3; data->srtt += rtt >> 3; } /* * Calculate the time we wait before sending the next * packet. * * rtt / (rtt + delay) = load_factor / 100 */ data->delay_time = (data->srtt * (100 - data->load_factor)) / (data->load_factor); /* * Cap delay at 4 packets/s. If the end system can't * handle this, then it's very broken. */ if (data->delay_time > (USEC / 4)) data->delay_time= USEC / 4; RDEBUG3("Received response for request %d. Will read the next packet in %d seconds", request->number, data->delay_time / USEC); data->last_packet = now; data->signal = 1; data->state = STATE_REPLIED; radius_signal_self(RADIUS_SIGNAL_SELF_DETAIL); return 0; }
false
false
false
false
false
0
zero_stats(void) { int i; cgtime(&total_tv_start); copy_time(&tv_hashmeter, &total_tv_start); total_rolling = 0; rolling1 = 0; rolling5 = 0; rolling15 = 0; total_mhashes_done = 0; for(i = 0; i < CG_LOCAL_MHASHES_MAX_NUM; i++) { g_local_mhashes_dones[i] = 0; } g_local_mhashes_index = 0; g_max_fan = 0; g_max_temp = 0; total_getworks = 0; total_accepted = 0; total_rejected = 0; hw_errors = 0; total_stale = 0; total_discarded = 0; local_work = 0; total_go = 0; total_ro = 0; total_secs = 1.0; last_total_secs = 1.0; total_diff1 = 0; found_blocks = 0; total_diff_accepted = 0; total_diff_rejected = 0; total_diff_stale = 0; for (i = 0; i < total_pools; i++) { struct pool *pool = pools[i]; pool->getwork_requested = 0; pool->accepted = 0; pool->rejected = 0; pool->stale_shares = 0; pool->discarded_work = 0; pool->getfail_occasions = 0; pool->remotefail_occasions = 0; pool->last_share_time = 0; pool->diff1 = 0; pool->diff_accepted = 0; pool->diff_rejected = 0; pool->diff_stale = 0; pool->last_share_diff = 0; } zero_bestshare(); for (i = 0; i < total_devices; ++i) { struct cgpu_info *cgpu = get_devices(i); copy_time(&cgpu->dev_start_tv, &total_tv_start); mutex_lock(&hash_lock); cgpu->total_mhashes = 0; cgpu->accepted = 0; cgpu->rejected = 0; cgpu->hw_errors = 0; cgpu->utility = 0.0; cgpu->last_share_pool_time = 0; cgpu->diff1 = 0; cgpu->diff_accepted = 0; cgpu->diff_rejected = 0; cgpu->last_share_diff = 0; mutex_unlock(&hash_lock); /* Don't take any locks in the driver zero stats function, as * it's called async from everything else and we don't want to * deadlock. */ cgpu->drv->zero_stats(cgpu); } }
false
false
false
false
false
0
vPrintFMT(FILE *pFile, const char *szString, size_t tStringLength, USHORT usFontstyle) { const UCHAR *pucByte, *pucStart, *pucLast, *pucNonSpace; fail(szString == NULL); if (szString == NULL || szString[0] == '\0' || tStringLength == 0) { return; } if (eEncoding == encoding_utf_8) { fprintf(pFile, "%.*s", (int)tStringLength, szString); return; } if (ucNbsp == 0) { ucNbsp = ucGetNbspCharacter(); DBG_HEX_C(ucNbsp != 0xa0, ucNbsp); } pucStart = (UCHAR *)szString; pucLast = pucStart + tStringLength - 1; pucNonSpace = pucLast; while ((*pucNonSpace == (UCHAR)' ' || *pucNonSpace == ucNbsp) && pucNonSpace > pucStart) { pucNonSpace--; } /* 1: The spaces at the start */ pucByte = pucStart; while ((*pucByte == (UCHAR)' ' || *pucByte == ucNbsp) && pucByte <= pucLast) { (void)putc(' ', pFile); pucByte++; } if (pucByte > pucLast) { /* There is no text, just spaces */ return; } /* 2: Start the *bold*, /italic/ and _underline_ */ if (bIsBold(usFontstyle)) { (void)putc('*', pFile); } if (bIsItalic(usFontstyle)) { (void)putc('/', pFile); } if (bIsUnderline(usFontstyle)) { (void)putc('_', pFile); } /* 3: The text itself */ while (pucByte <= pucNonSpace) { if (*pucByte == ucNbsp) { (void)putc(' ', pFile); } else { (void)putc((char)*pucByte, pFile); } pucByte++; } /* 4: End the *bold*, /italic/ and _underline_ */ if (bIsUnderline(usFontstyle)) { (void)putc('_', pFile); } if (bIsItalic(usFontstyle)) { (void)putc('/', pFile); } if (bIsBold(usFontstyle)) { (void)putc('*', pFile); } /* 5: The spaces at the end */ while (pucByte <= pucLast) { (void)putc(' ', pFile); pucByte++; } }
false
false
false
false
false
0
makeConfigurationDependencies(HeapTuple tuple, bool removeOld, Relation mapRel) { Form_pg_ts_config cfg = (Form_pg_ts_config) GETSTRUCT(tuple); ObjectAddresses *addrs; ObjectAddress myself, referenced; myself.classId = TSConfigRelationId; myself.objectId = HeapTupleGetOid(tuple); myself.objectSubId = 0; /* for ALTER case, first flush old dependencies */ if (removeOld) { deleteDependencyRecordsFor(myself.classId, myself.objectId); deleteSharedDependencyRecordsFor(myself.classId, myself.objectId); } /* * We use an ObjectAddresses list to remove possible duplicate * dependencies from the config map info. The pg_ts_config items * shouldn't be duplicates, but might as well fold them all into one call. */ addrs = new_object_addresses(); /* dependency on namespace */ referenced.classId = NamespaceRelationId; referenced.objectId = cfg->cfgnamespace; referenced.objectSubId = 0; add_exact_object_address(&referenced, addrs); /* dependency on owner */ recordDependencyOnOwner(myself.classId, myself.objectId, cfg->cfgowner); /* dependency on parser */ referenced.classId = TSParserRelationId; referenced.objectId = cfg->cfgparser; referenced.objectSubId = 0; add_exact_object_address(&referenced, addrs); /* dependencies on dictionaries listed in config map */ if (mapRel) { ScanKeyData skey; SysScanDesc scan; HeapTuple maptup; /* CCI to ensure we can see effects of caller's changes */ CommandCounterIncrement(); ScanKeyInit(&skey, Anum_pg_ts_config_map_mapcfg, BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(myself.objectId)); scan = systable_beginscan(mapRel, TSConfigMapIndexId, true, SnapshotNow, 1, &skey); while (HeapTupleIsValid((maptup = systable_getnext(scan)))) { Form_pg_ts_config_map cfgmap = (Form_pg_ts_config_map) GETSTRUCT(maptup); referenced.classId = TSDictionaryRelationId; referenced.objectId = cfgmap->mapdict; referenced.objectSubId = 0; add_exact_object_address(&referenced, addrs); } systable_endscan(scan); } /* Record 'em (this includes duplicate elimination) */ record_object_address_dependencies(&myself, addrs, DEPENDENCY_NORMAL); free_object_addresses(addrs); }
false
false
false
false
false
0
Bop_a8_set_alphapixel_Aop_alut44( GenefxState *gfxs ) { int w = gfxs->length; u8 *S = gfxs->Bop[0]; u8 *D = gfxs->Aop[0]; u32 Cop = gfxs->Cop; DFBColor color = gfxs->color; DFBColor *entries = gfxs->Alut->entries; #define SET_PIXEL(d,alpha) \ switch (alpha) {\ case 0xff: d = Cop;\ case 0: break; \ default: {\ register u16 s = alpha+1;\ DFBColor dc = entries[d & 0x0f];\ u16 sa = (d & 0xf0) + alpha;\ dc.r = ((color.r - dc.r) * s + (dc.r << 8)) >> 8;\ dc.g = ((color.g - dc.g) * s + (dc.g << 8)) >> 8;\ dc.b = ((color.b - dc.b) * s + (dc.b << 8)) >> 8;\ if (sa & 0xff00) sa = 0xf0;\ d = (sa & 0xf0) + \ dfb_palette_search( gfxs->Alut, dc.r, dc.g, dc.b, 0x80 );\ }\ } while (w--) { SET_PIXEL( *D, *S ); D++, S++; } #undef SET_PIXEL }
false
false
false
false
false
0
find_tm_replacement_function (tree fndecl) { if (tm_wrap_map) { struct tree_map *h, in; in.base.from = fndecl; in.hash = htab_hash_pointer (fndecl); h = (struct tree_map *) htab_find_with_hash (tm_wrap_map, &in, in.hash); if (h) return h->to; } /* ??? We may well want TM versions of most of the common <string.h> functions. For now, we've already these two defined. */ /* Adjust expand_call_tm() attributes as necessary for the cases handled here: */ if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL) switch (DECL_FUNCTION_CODE (fndecl)) { case BUILT_IN_MEMCPY: return builtin_decl_explicit (BUILT_IN_TM_MEMCPY); case BUILT_IN_MEMMOVE: return builtin_decl_explicit (BUILT_IN_TM_MEMMOVE); case BUILT_IN_MEMSET: return builtin_decl_explicit (BUILT_IN_TM_MEMSET); default: return NULL; } return NULL; }
false
false
false
false
false
0
dump_rt(struct lib_context *lc, struct asr_raidtable *rt) { unsigned i; DP("ridcode:\t\t\t0x%X", rt, rt->ridcode); DP("rversion:\t\t%d", rt, rt->rversion); DP("max configs:\t\t%d", rt, rt->maxelm); DP("configs:\t\t\t%d", rt, rt->elmcnt); DP("config sz:\t\t%d", rt, rt->elmsize); DP("checksum:\t\t\t0x%X", rt, rt->rchksum); DP("raid flags:\t\t0x%X", rt, rt->raidFlags); DP("timestamp:\t\t0x%X", rt, rt->timestamp); P("irocFlags:\t\t%X%s", rt, rt->irocFlags, rt->irocFlags, rt->irocFlags & ASR_IF_BOOTABLE ? " (bootable)" : ""); DP("dirt, rty:\t\t%d", rt, rt->dirty); DP("action prio:\t\t%d", rt, rt->actionPriority); DP("spareid:\t\t\t%d", rt, rt->spareid); DP("sparedrivemagic:\t\t0x%X", rt, rt->sparedrivemagic); DP("raidmagic:\t\t0x%X", rt, rt->raidmagic); DP("verifydate:\t\t0x%X", rt, rt->verifyDate); DP("recreatedate:\t\t0x%X", rt, rt->recreateDate); log_print(lc, "\nRAID config table:"); for (i = 0; i < rt->elmcnt; i++) dump_cl(lc, &rt->ent[i]); }
false
false
false
false
false
0
qla8044_read_flash_data(scsi_qla_host_t *vha, uint8_t *p_data, uint32_t flash_addr, int u32_word_count) { int i, ret_val = QLA_SUCCESS; uint32_t u32_word; if (qla8044_flash_lock(vha) != QLA_SUCCESS) { ret_val = QLA_FUNCTION_FAILED; goto exit_lock_error; } if (flash_addr & 0x03) { ql_log(ql_log_warn, vha, 0xb117, "%s: Illegal addr = 0x%x\n", __func__, flash_addr); ret_val = QLA_FUNCTION_FAILED; goto exit_flash_read; } for (i = 0; i < u32_word_count; i++) { if (qla8044_wr_reg_indirect(vha, QLA8044_FLASH_DIRECT_WINDOW, (flash_addr & 0xFFFF0000))) { ql_log(ql_log_warn, vha, 0xb119, "%s: failed to write addr 0x%x to " "FLASH_DIRECT_WINDOW\n! ", __func__, flash_addr); ret_val = QLA_FUNCTION_FAILED; goto exit_flash_read; } ret_val = qla8044_rd_reg_indirect(vha, QLA8044_FLASH_DIRECT_DATA(flash_addr), &u32_word); if (ret_val != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0xb08c, "%s: failed to read addr 0x%x!\n", __func__, flash_addr); goto exit_flash_read; } *(uint32_t *)p_data = u32_word; p_data = p_data + 4; flash_addr = flash_addr + 4; } exit_flash_read: qla8044_flash_unlock(vha); exit_lock_error: return ret_val; }
false
false
false
false
false
0
read_auth_reply(fde_t *fd, void *data) { struct AuthRequest *auth = data; char *s = NULL; char *t = NULL; int len; int count; char buf[AUTH_BUFSIZ + 1]; /* buffer to read auth reply into */ /* Why? * Well, recv() on many POSIX systems is a per-packet operation, * and we do not necessarily want this, because on lowspec machines, * the ident response may come back fragmented, thus resulting in an * invalid ident response, even if the ident response was really OK. * * So PLEASE do not change this code to recv without being aware of the * consequences. * * --nenolod */ len = read(fd->fd, buf, AUTH_BUFSIZ); if (len < 0) { if (ignoreErrno(errno)) comm_setselect(fd, COMM_SELECT_READ, read_auth_reply, auth, 0); else auth_error(auth); return; } if (len > 0) { buf[len] = '\0'; if ((s = GetValidIdent(buf))) { t = auth->client->username; while (*s == '~' || *s == '^') s++; for (count = USERLEN; *s && count; s++) { if (*s == '@') break; if (!IsSpace(*s) && *s != ':' && *s != '[') { *t++ = *s; count--; } } *t = '\0'; } } fd_close(fd); ClearAuth(auth); if (s == NULL) { sendheader(auth->client, REPORT_FAIL_ID); ++ServerStats.is_abad; } else { sendheader(auth->client, REPORT_FIN_ID); ++ServerStats.is_asuc; SetGotId(auth->client); } release_auth_client(auth); }
true
true
false
false
true
1
ml_gdome_mevnt_compare(value v1, value v2) { CAMLparam2(v1,v2); GdomeMutationEvent* obj1_ = MutationEvent_val(v1); GdomeMutationEvent* obj2_ = MutationEvent_val(v2); CAMLreturn((int) (obj1_ - obj2_)); }
false
false
false
false
false
0
nfs_cache_unregister_net(struct net *net, struct cache_detail *cd) { struct super_block *pipefs_sb; pipefs_sb = rpc_get_sb_net(net); if (pipefs_sb) { nfs_cache_unregister_sb(pipefs_sb, cd); rpc_put_sb_net(net); } sunrpc_destroy_cache_detail(cd); }
false
false
false
false
false
0
cgetustr(char *buf, const char *cap, char **str) { u_int m_room; const char *bp; char *mp; int len; char *mem; /* * Find string capability cap */ if ((bp = cgetcap(buf, cap, '=')) == NULL) return (-1); /* * Conversion / storage allocation loop ... Allocate memory in * chunks SFRAG in size. */ if ((mem = malloc(SFRAG)) == NULL) { errno = ENOMEM; return (-2); /* couldn't even allocate the first fragment */ } m_room = SFRAG; mp = mem; while (*bp != ':' && *bp != '\0') { /* * Loop invariants: * There is always room for one more character in mem. * Mp always points just past last character in mem. * Bp always points at next character in buf. */ *mp++ = *bp++; m_room--; /* * Enforce loop invariant: if no room left in current * buffer, try to get some more. */ if (m_room == 0) { size_t size = mp - mem; if ((mem = realloc(mem, size + SFRAG)) == NULL) return (-2); m_room = SFRAG; mp = mem + size; } } *mp++ = '\0'; /* loop invariant let's us do this */ m_room--; len = mp - mem - 1; /* * Give back any extra memory and return value and success. */ if (m_room != 0) if ((mem = realloc(mem, (size_t)(mp - mem))) == NULL) return (-2); *str = mem; return (len); }
false
false
false
false
false
0
references( CMCIClient * mb, CMPIObjectPath * cop, const char * resultClass, const char * role , CMPIFlags flags, char ** properties, CMPIStatus * rc) { ClientEnc *cl = (ClientEnc*)mb; CMCIConnection *con = cl->connection; UtilStringBuffer *sb = UtilFactory->newStringBuffer(2048); char *error; CMPIEnumeration *retval; START_TIMING(References); SET_DEBUG(); con->ft->genRequest(cl, References, cop, 0); addXmlHeader(sb); sb->ft->append3Chars(sb, "<IMETHODCALL NAME=\"", References, "\">"); addXmlNamespace(sb, cop); addXmlObjectName(sb, cop, "ObjectName"); /* Add optional parameters */ if (resultClass) sb->ft->append3Chars(sb, "<IPARAMVALUE NAME=\"ResultClass\"><CLASSNAME NAME=\"", resultClass, "\"/></IPARAMVALUE>\n"); if (role) sb->ft->append3Chars(sb, "<IPARAMVALUE NAME=\"Role\"><VALUE>", role, "</VALUE></IPARAMVALUE>\n"); /* Add optional flags */ emitorigin(sb,flags & CMPI_FLAG_IncludeClassOrigin); emitqual(sb,flags & CMPI_FLAG_IncludeQualifiers); /* Add property list filter */ if (properties != NULL) addXmlPropertyListParam(sb, properties); sb->ft->appendChars(sb,"</IMETHODCALL>\n"); addXmlFooter(sb); error = con->ft->addPayload(con, sb); if (error || (error=con->ft->getResponse(con,cop))) { CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,error); free(error); END_TIMING(_T_FAILED); return NULL; } if (con->mStatus.rc != CMPI_RC_OK) { if (rc) *rc=cloneStatus(con->mStatus); CMRelease(sb); return NULL; } CMRelease(sb); ResponseHdr rh=scanCimXmlResponse(CMGetCharPtr(con->mResponse),cop); if (rh.errCode!=0) { CMSetStatusWithChars(rc,rh.errCode,rh.description); free(rh.description); CMRelease(rh.rvArray); END_TIMING(_T_FAILED); return NULL; } #if DEBUG if (do_debug) printf ("\treturn enumeration array type %d expected CMPI_instance %d\n", rh.rvArray->ft->getSimpleType(rh.rvArray, NULL), CMPI_instance); #endif CMSetStatus(rc,CMPI_RC_OK); retval = newCMPIEnumeration(rh.rvArray, NULL); END_TIMING(_T_GOOD); return retval; }
false
false
false
false
false
0
shared_unlock(int idx) /* unlock given segment, assumes seg is locked !! */ { int r, r2, mode; if (SHARED_OK != (r = shared_check_locked_index(idx))) return(r); if (shared_lt[idx].lkcnt > 0) { shared_lt[idx].lkcnt--; /* unlock read lock */ mode = SHARED_RDONLY; } else { shared_lt[idx].lkcnt = 0; /* unlock write lock */ shared_gt[idx].nprocdebug--; mode = SHARED_RDWRITE; } if (0 == shared_lt[idx].lkcnt) if (shared_gt[idx].attr & SHARED_RESIZE) { if (shmdt((char *)(shared_lt[idx].p))) r = SHARED_IPCERR; /* segment is resizable, then detach segment */ shared_lt[idx].p = NULL; /* signal detachment in local table */ } r2 = shared_demux(idx, mode); /* unlock segment, rest is only parameter checking */ return(r ? r : r2); }
false
false
false
false
false
0