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
e_bindings_signal_handle(E_Binding_Context ctxt, E_Object *obj, const char *sig, const char *src) { E_Action *act; E_Binding_Signal *binding; if (sig && (sig[0] == 0)) sig = NULL; if (src && (src[0] == 0)) src = NULL; act = e_bindings_signal_find(ctxt, obj, sig, src, &binding); if (act) { if (act->func.go_signal) act->func.go_signal(obj, binding->params, sig, src); else if (act->func.go) act->func.go(obj, binding->params); return act; } return act; }
false
false
false
false
false
0
setFlowAccuColorTable(char* cellname) { struct Colors colors; char *mapset; struct Range r; mapset = G_find_cell(cellname, ""); if (mapset == NULL) { G_fatal_error (_("Raster map <%s> not found"), cellname); } if (G_read_range(cellname, mapset, &r) == -1) { G_fatal_error(_("cannot read range")); } /*fprintf(stderr, "%s range is: min=%d, max=%d\n", cellname, r.min, r.max);*/ int v[6]; v[0] = r.min; v[1] = 5; v[2] = 30; v[3] = 100; v[4] = 1000; v[5] = r.max; G_init_colors(&colors); G_add_color_rule(v[0], 255,255,255, v[1], 255,255,0, &colors); G_add_color_rule(v[1], 255,255,0, v[2], 0,255,255, &colors); G_add_color_rule(v[2], 0,255,255, v[3], 0,127,255, &colors); G_add_color_rule(v[3], 0,127,255, v[4], 0,0,255, &colors); G_add_color_rule(v[4], 0,0,255, (CELL)v[5], 0,0,0, &colors); if (G_write_colors(cellname, mapset, &colors) == -1) { G_fatal_error(_("cannot write colors")); } G_free_colors(&colors); }
false
false
false
false
false
0
bnxt_free_stats(struct bnxt *bp) { u32 size, i; struct pci_dev *pdev = bp->pdev; if (!bp->bnapi) return; size = sizeof(struct ctx_hw_stats); for (i = 0; i < bp->cp_nr_rings; i++) { struct bnxt_napi *bnapi = bp->bnapi[i]; struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring; if (cpr->hw_stats) { dma_free_coherent(&pdev->dev, size, cpr->hw_stats, cpr->hw_stats_map); cpr->hw_stats = NULL; } } }
false
false
false
false
false
0
gst_file_index_add_id (GstIndex * index, GstIndexEntry * entry) { GstFileIndex *fileindex = GST_FILE_INDEX (index); GstFileIndexId *id_index; id_index = g_hash_table_lookup (fileindex->id_index, &entry->id); if (!id_index) { id_index = g_slice_new0 (GstFileIndexId); id_index->id = entry->id; id_index->id_desc = g_strdup (entry->data.id.description); /* It would be useful to know the GType of the writer so we can try to cope with changes in the id_desc path. */ g_hash_table_insert (fileindex->id_index, &id_index->id, id_index); } }
false
false
false
false
false
0
dlm_migrate_request_handler(struct o2net_msg *msg, u32 len, void *data, void **ret_data) { struct dlm_ctxt *dlm = data; struct dlm_lock_resource *res = NULL; struct dlm_migrate_request *migrate = (struct dlm_migrate_request *) msg->buf; struct dlm_master_list_entry *mle = NULL, *oldmle = NULL; const char *name; unsigned int namelen, hash; int ret = 0; if (!dlm_grab(dlm)) return -EINVAL; name = migrate->name; namelen = migrate->namelen; hash = dlm_lockid_hash(name, namelen); /* preallocate.. if this fails, abort */ mle = kmem_cache_alloc(dlm_mle_cache, GFP_NOFS); if (!mle) { ret = -ENOMEM; goto leave; } /* check for pre-existing lock */ spin_lock(&dlm->spinlock); res = __dlm_lookup_lockres(dlm, name, namelen, hash); if (res) { spin_lock(&res->spinlock); if (res->state & DLM_LOCK_RES_RECOVERING) { /* if all is working ok, this can only mean that we got * a migrate request from a node that we now see as * dead. what can we do here? drop it to the floor? */ spin_unlock(&res->spinlock); mlog(ML_ERROR, "Got a migrate request, but the " "lockres is marked as recovering!"); kmem_cache_free(dlm_mle_cache, mle); ret = -EINVAL; /* need a better solution */ goto unlock; } res->state |= DLM_LOCK_RES_MIGRATING; spin_unlock(&res->spinlock); } spin_lock(&dlm->master_lock); /* ignore status. only nonzero status would BUG. */ ret = dlm_add_migration_mle(dlm, res, mle, &oldmle, name, namelen, migrate->new_master, migrate->master); spin_unlock(&dlm->master_lock); unlock: spin_unlock(&dlm->spinlock); if (oldmle) { /* master is known, detach if not already detached */ dlm_mle_detach_hb_events(dlm, oldmle); dlm_put_mle(oldmle); } if (res) dlm_lockres_put(res); leave: dlm_put(dlm); return ret; }
false
false
false
false
false
0
gt_lua_get_table_as_uchararray(lua_State *L, int index, unsigned char **outarray, unsigned long *arrlen, GtError *err) { int had_err = 0, val; unsigned long i; unsigned char *arr; if (!lua_istable(L, index)) { gt_error_set(err, "argument is not a table"); return -1; } *arrlen = lua_objlen(L, index); arr = gt_malloc(*arrlen * sizeof (unsigned char)); for (i = 1; i <= *arrlen; i++) { lua_rawgeti(L, index, i); if (!lua_isnumber(L, -1)) { had_err = -1; gt_error_set(err, "input contains non-numeric value"); break; } if (!had_err && (val = lua_tointeger(L, -1)) > UCHAR_MAX) { had_err = -1; gt_error_set(err, "input contains oversized encoded value"); } if (!had_err) arr[i-1] = (unsigned char) val; lua_pop(L, 1); } *outarray = arr; return 0; }
false
false
false
false
false
0
field() const { XData::Field f = XDataField::field(); QStringList val; for (int i = 0; i < list->count(); i++) { QListWidgetItem* item = list->item(i); if ( list->isItemSelected(item) ) { QString lbl = item->text(); XData::Field::OptionList opts = f.options(); XData::Field::OptionList::Iterator it = opts.begin(); for ( ; it != opts.end(); ++it) { if ( (*it).label == lbl || (*it).value == lbl ) { val << (*it).value; break; } } } } f.setValue(val); return f; }
false
false
false
false
false
0
pxenv_undi_set_station_address ( struct s_PXENV_UNDI_SET_STATION_ADDRESS *undi_set_station_address ) { struct ll_protocol *ll_protocol = pxe_netdev->ll_protocol; DBG ( "PXENV_UNDI_SET_STATION_ADDRESS %s", ll_protocol->ntoa ( undi_set_station_address->StationAddress ) ); /* If adapter is open, the change will have no effect; return * an error */ if ( pxe_netdev->state & NETDEV_OPEN ) { DBG ( " failed: netdev is open\n" ); undi_set_station_address->Status = PXENV_STATUS_UNDI_INVALID_STATE; return PXENV_EXIT_FAILURE; } /* Update MAC address */ memcpy ( pxe_netdev->ll_addr, &undi_set_station_address->StationAddress, ll_protocol->ll_addr_len ); DBG ( "\n" ); undi_set_station_address->Status = PXENV_STATUS_SUCCESS; return PXENV_EXIT_SUCCESS; }
false
false
false
false
false
0
with_bus_thread_func (void *data) { DBusError error; DBusConnection *connection; ClientData cd; const char *address; GMainContext *context; g_printerr ("Starting client thread %p\n", g_thread_self()); address = g_getenv ("DBUS_SESSION_BUS_ADDRESS"); if (address == NULL) { g_printerr ("DBUS_SESSION_BUS_ADDRESS not set\n"); exit (1); } dbus_error_init (&error); connection = dbus_connection_open_private (address, &error); if (connection == NULL) { g_printerr ("could not open connection to bus: %s\n", error.message); dbus_error_free (&error); exit (1); } if (!dbus_bus_register (connection, &error)) { g_printerr ("could not register with bus: %s\n", error.message); dbus_error_free (&error); exit (1); } context = g_main_context_new (); cd.iterations = 1; cd.loop = g_main_loop_new (context, FALSE); if (!dbus_connection_add_filter (connection, with_bus_client_filter, &cd, NULL)) g_error ("no memory"); dbus_connection_setup_with_g_main (connection, context); g_printerr ("Client thread sending message to prime pingpong\n"); send_echo_method_call (connection); g_printerr ("Client thread sent message\n"); g_printerr ("Client thread entering main loop\n"); g_main_loop_run (cd.loop); g_printerr ("Client thread %p exiting main loop\n", g_thread_self()); dbus_connection_close (connection); g_main_loop_unref (cd.loop); g_main_context_unref (context); return NULL; }
false
false
false
false
false
0
allocateCandidatesAndFindBasisForAdd( Value *LHS, Value *RHS, Instruction *I) { Value *S = nullptr; ConstantInt *Idx = nullptr; if (match(RHS, m_Mul(m_Value(S), m_ConstantInt(Idx)))) { // I = LHS + RHS = LHS + Idx * S allocateCandidatesAndFindBasis(Candidate::Add, SE->getSCEV(LHS), Idx, S, I); } else if (match(RHS, m_Shl(m_Value(S), m_ConstantInt(Idx)))) { // I = LHS + RHS = LHS + (S << Idx) = LHS + S * (1 << Idx) APInt One(Idx->getBitWidth(), 1); Idx = ConstantInt::get(Idx->getContext(), One << Idx->getValue()); allocateCandidatesAndFindBasis(Candidate::Add, SE->getSCEV(LHS), Idx, S, I); } else { // At least, I = LHS + 1 * RHS ConstantInt *One = ConstantInt::get(cast<IntegerType>(I->getType()), 1); allocateCandidatesAndFindBasis(Candidate::Add, SE->getSCEV(LHS), One, RHS, I); } }
false
false
false
false
false
0
vmw_kms_stdu_surface_dirty(struct vmw_private *dev_priv, struct vmw_framebuffer *framebuffer, struct drm_clip_rect *clips, struct drm_vmw_rect *vclips, struct vmw_resource *srf, s32 dest_x, s32 dest_y, unsigned num_clips, int inc, struct vmw_fence_obj **out_fence) { struct vmw_framebuffer_surface *vfbs = container_of(framebuffer, typeof(*vfbs), base); struct vmw_stdu_dirty sdirty; int ret; if (!srf) srf = &vfbs->surface->res; ret = vmw_kms_helper_resource_prepare(srf, true); if (ret) return ret; if (vfbs->is_dmabuf_proxy) { ret = vmw_kms_update_proxy(srf, clips, num_clips, inc); if (ret) goto out_finish; } sdirty.base.fifo_commit = vmw_kms_stdu_surface_fifo_commit; sdirty.base.clip = vmw_kms_stdu_surface_clip; sdirty.base.fifo_reserve_size = sizeof(struct vmw_stdu_surface_copy) + sizeof(SVGA3dCopyBox) * num_clips + sizeof(struct vmw_stdu_update); sdirty.sid = srf->id; sdirty.left = sdirty.top = S32_MAX; sdirty.right = sdirty.bottom = S32_MIN; ret = vmw_kms_helper_dirty(dev_priv, framebuffer, clips, vclips, dest_x, dest_y, num_clips, inc, &sdirty.base); out_finish: vmw_kms_helper_resource_finish(srf, out_fence); return ret; }
false
false
false
false
false
0
RuleComplexity( void *theEnv, struct lhsParseNode *theLHS) { struct lhsParseNode *thePattern, *tempPattern; int complexity = 0; while (theLHS != NULL) { complexity += 1; /* Add 1 for each pattern. */ complexity += ExpressionComplexity(theEnv,theLHS->networkTest); thePattern = theLHS->right; while (thePattern != NULL) { if (thePattern->multifieldSlot) { tempPattern = thePattern->bottom; while (tempPattern != NULL) { complexity += ExpressionComplexity(theEnv,tempPattern->networkTest); tempPattern = tempPattern->right; } } else { complexity += ExpressionComplexity(theEnv,thePattern->networkTest); } thePattern = thePattern->right; } theLHS = theLHS->bottom; } return(complexity); }
false
false
false
false
false
0
nla_put_drbd_cfg_context(struct sk_buff *skb, struct drbd_resource *resource, struct drbd_connection *connection, struct drbd_device *device) { struct nlattr *nla; nla = nla_nest_start(skb, DRBD_NLA_CFG_CONTEXT); if (!nla) goto nla_put_failure; if (device && nla_put_u32(skb, T_ctx_volume, device->vnr)) goto nla_put_failure; if (nla_put_string(skb, T_ctx_resource_name, resource->name)) goto nla_put_failure; if (connection) { if (connection->my_addr_len && nla_put(skb, T_ctx_my_addr, connection->my_addr_len, &connection->my_addr)) goto nla_put_failure; if (connection->peer_addr_len && nla_put(skb, T_ctx_peer_addr, connection->peer_addr_len, &connection->peer_addr)) goto nla_put_failure; } nla_nest_end(skb, nla); return 0; nla_put_failure: if (nla) nla_nest_cancel(skb, nla); return -EMSGSIZE; }
false
false
false
false
false
0
ipw2100_pci_remove_one(struct pci_dev *pci_dev) { struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); struct net_device *dev = priv->net_dev; mutex_lock(&priv->action_mutex); priv->status &= ~STATUS_INITIALIZED; sysfs_remove_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); #ifdef CONFIG_PM if (ipw2100_firmware.version) ipw2100_release_firmware(priv, &ipw2100_firmware); #endif /* Take down the hardware */ ipw2100_down(priv); /* Release the mutex so that the network subsystem can * complete any needed calls into the driver... */ mutex_unlock(&priv->action_mutex); /* Unregister the device first - this results in close() * being called if the device is open. If we free storage * first, then close() will crash. * FIXME: remove the comment above. */ unregister_netdev(dev); ipw2100_kill_works(priv); ipw2100_queues_free(priv); /* Free potential debugging firmware snapshot */ ipw2100_snapshot_free(priv); free_irq(dev->irq, priv); pci_iounmap(pci_dev, priv->ioaddr); /* wiphy_unregister needs to be here, before free_libipw */ wiphy_unregister(priv->ieee->wdev.wiphy); kfree(priv->ieee->bg_band.channels); free_libipw(dev, 0); pci_release_regions(pci_dev); pci_disable_device(pci_dev); IPW_DEBUG_INFO("exit\n"); }
false
false
false
false
false
0
check_for_hex(BW *bw) { W *w; if (bw->o.hex) return 1; for (w = bw->parent->link.next; w != bw->parent; w = w->link.next) if ((w->watom == &watomtw || w->watom == &watompw) && ((BW *)w->object)->b == bw->b && ((BW *)w->object)->o.hex) return 1; return 0; }
false
false
false
false
false
0
elm_clock_show_am_pm_get(const Evas_Object *obj) { ELM_CLOCK_CHECK(obj) EINA_FALSE; ELM_CLOCK_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE); return sd->am_pm; }
false
false
false
false
false
0
cd_device_set_enabled (CdDevice *device, gboolean enabled, GError **error) { CdDevicePrivate *priv = device->priv; gboolean ret; GError *error_local = NULL; /* device is already the correct state */ if (priv->enabled == enabled) { ret = TRUE; goto out; } /* update database */ ret = cd_device_db_set_property (device->priv->device_db, device->priv->id, "Enabled", enabled ? "True" : "False", &error_local); if (!ret) { g_set_error (error, CD_DEVICE_ERROR, CD_DEVICE_ERROR_INTERNAL, "%s", error_local->message); g_error_free (error_local); goto out; } /* change property */ priv->enabled = enabled; /* reset modification time */ cd_device_reset_modified (device); /* emit */ cd_device_dbus_emit_property_changed (device, "Enabled", g_variant_new_boolean (enabled)); /* emit global signal */ cd_device_dbus_emit_device_changed (device); out: return ret; }
false
false
false
false
false
0
getname(const u_char *ap) { register struct hostent *hp; u_int32_t addr; static struct hnamemem *p; /* static for longjmp() */ memcpy(&addr, ap, sizeof(addr)); p = &hnametable[addr & (HASHNAMESIZE-1)]; for (; p->nxt; p = p->nxt) { if (p->addr == addr) return (p->name); } p->addr = addr; p->nxt = newhnamemem(); /* * Print names unless: * (1) -n was given. * (2) Address is foreign and -f was given. (If -f was not * given, f_netmask and f_localnet are 0 and the test * evaluates to true) */ if (!nflag && (addr & f_netmask) == f_localnet) { hp = gethostbyaddr((char *)&addr, 4, AF_INET); if (hp) { char *dotp; p->name = strdup(hp->h_name); if (Nflag) { /* Remove domain qualifications */ dotp = strchr(p->name, '.'); if (dotp) *dotp = '\0'; } return (p->name); } } p->name = strdup(intoa(addr)); return (p->name); }
false
false
false
false
false
0
fuse_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *buf) { fuse_state_t *state; fuse_in_header_t *finh; fuse_private_t *priv = NULL; struct fuse_attr_out fao; priv = this->private; state = frame->root->state; finh = state->finh; if (op_ret == 0) { gf_log ("glusterfs-fuse", GF_LOG_TRACE, "%"PRIu64": %s() %s => %"PRId64, frame->root->unique, gf_fop_list[frame->root->op], state->loc.path ? state->loc.path : "ERR", buf->ia_ino); /* TODO: make these timeouts configurable via meta */ /* TODO: what if the inode number has changed by now */ buf->ia_blksize = this->ctx->page_size; gf_fuse_stat2attr (buf, &fao.attr); fao.attr_valid = calc_timeout_sec (priv->attribute_timeout); fao.attr_valid_nsec = calc_timeout_nsec (priv->attribute_timeout); #if FUSE_KERNEL_MINOR_VERSION >= 9 priv->proto_minor >= 9 ? send_fuse_obj (this, finh, &fao) : send_fuse_data (this, finh, &fao, FUSE_COMPAT_ATTR_OUT_SIZE); #else send_fuse_obj (this, finh, &fao); #endif } else { GF_LOG_OCCASIONALLY ( gf_fuse_conn_err_log, "glusterfs-fuse", GF_LOG_WARNING, "%"PRIu64": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op], state->loc.path ? state->loc.path : "ERR", strerror (op_errno)); send_fuse_err (this, finh, op_errno); } free_fuse_state (state); STACK_DESTROY (frame->root); return 0; }
false
false
false
false
false
0
compute_prefixtab(const char *p, unsigned long m) { unsigned long i, vlen = 0, *prefixtab; char b; gt_assert(p); prefixtab = gt_malloc(sizeof (unsigned long) * (m+1)); prefixtab[0] = GT_UNDEF_ULONG; /* paranoia */ if (m) prefixtab[1] = 0; for (i = 2; i <= m; i++) { b = p[i-1]; while (vlen > 0 && p[vlen] != b) vlen = prefixtab[vlen]; if (p[vlen] == b) vlen++; prefixtab[i] = vlen; } return prefixtab; }
false
false
false
false
false
0
mouseDoubleClickEvent( QMouseEvent* e ) { if ( e->button() == Qt::LeftButton ) { d->possibleTripleClick=true; QTimer::singleShot( QApplication::doubleClickInterval(),this, SLOT(tripleClickTimeout()) ); } QLineEdit::mouseDoubleClickEvent( e ); }
false
false
false
false
false
0
overwriteBuf(UT_UCSChar * pBuf, UT_uint32 length, PT_BufIndex * pbi) { if (m_buffer[_varsetFromBufIndex(*pbi)] .overwrite(_subscriptFromBufIndex(*pbi), (UT_GrowBufElement*)pBuf, length)) { return true; } UT_DEBUGMSG(("could not overwriteBuf\n")); return false; }
false
false
false
false
false
0
_ov_open1(void *f,OggVorbis_File *vf,char *initial, long ibytes, ov_callbacks callbacks){ long offset=(f?callbacks.seek_func(f,0,SEEK_CUR):-1); int ret; memset(vf,0,sizeof(OggVorbis_File)); vf->datasource=f; vf->callbacks = callbacks; /* init the framing state */ ogg_sync_init(&vf->oy); /* perhaps some data was previously read into a buffer for testing against other stream types. Allow initialization from this previously read data (as we may be reading from a non-seekable stream) */ if(initial){ char *buffer=ogg_sync_buffer(&vf->oy,ibytes); memcpy(buffer,initial,ibytes); ogg_sync_wrote(&vf->oy,ibytes); } /* can we seek? Stevens suggests the seek test was portable */ if(offset!=-1)vf->seekable=1; /* No seeking yet; Set up a 'single' (current) logical bitstream entry for partial open */ vf->links=1; vf->vi=_ogg_calloc(vf->links,sizeof(vorbis_info)); /* Try to fetch the headers, maintaining all the storage */ if((ret=_fetch_headers(vf,vf->vi,&vf->current_serialno,NULL))<0){ vf->datasource=NULL; ov_clear(vf); }else if(vf->ready_state < PARTOPEN) vf->ready_state=PARTOPEN; return(ret); }
false
false
false
false
false
0
new_g15_screen(int screentype) { struct sigaction new_sigaction; int g15screen_fd; struct sockaddr_in serv_addr; static int sighandler_init=0; /* raise the priority of our packets */ int tos = 0x6; char buffer[256]; if(sighandler_init==0) { #ifdef HAVE_BACKTRACE new_sigaction.sa_handler = g15_sighandler; new_sigaction.sa_flags = 0; sigaction(SIGSEGV,&new_sigaction,NULL); #endif sighandler_init=1; } g15screen_fd = socket(AF_INET, SOCK_STREAM, 0); if (g15screen_fd < 0) return -1; memset(&serv_addr, 0, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; inet_aton (G15SERVER_ADDR, &serv_addr.sin_addr); serv_addr.sin_port = htons(G15SERVER_PORT); if (connect(g15screen_fd,(struct sockaddr *)&serv_addr,sizeof(serv_addr)) < 0) return -1; setsockopt(g15screen_fd, SOL_SOCKET, SO_PRIORITY, &tos, sizeof(tos)); if (fcntl(g15screen_fd, F_SETFL, O_NONBLOCK) <0 ) { } memset(buffer,0,256); if(g15_recv(g15screen_fd, buffer, 16)<0) return -1; /* here we check that we're really talking to the g15daemon */ if(strcmp(buffer,"G15 daemon HELLO") != 0) return -1; if(screentype == G15_TEXTBUF) /* txt buffer - not supported yet */ g15_send(g15screen_fd,"TBUF",4); else if(screentype == G15_WBMPBUF) /* wbmp buffer */ g15_send(g15screen_fd,"WBUF",4); else if(screentype == G15_G15RBUF) g15_send(g15screen_fd,"RBUF",4); else g15_send(g15screen_fd,"GBUF",4); return g15screen_fd; }
false
false
false
false
false
0
_expblur (guchar* pixels, gint width, gint height, gint channels, gint radius, gint aprec, gint zprec) { gint alpha; gint row = 0; gint col = 0; if (radius < 1) return; // calculate the alpha such that 90% of // the kernel is within the radius. // (Kernel extends to infinity) alpha = (gint) ((1 << aprec) * (1.0f - expf (-2.3f / (radius + 1.f)))); for (; row < height; row++) _blurrow (pixels, width, height, channels, row, alpha, aprec, zprec); for(; col < width; col++) _blurcol (pixels, width, height, channels, col, alpha, aprec, zprec); return; }
false
false
false
false
false
0
ajp_msg_append_string_ex(ajp_msg_t *msg, const char *value, int convert) { apr_size_t len; if (value == NULL) { return(ajp_msg_append_uint16(msg, 0xFFFF)); } len = strlen(value); if ((msg->len + len + 3) > msg->max_size) { return ajp_log_overflow(msg, "ajp_msg_append_cvt_string"); } /* ignore error - we checked once */ ajp_msg_append_uint16(msg, (apr_uint16_t)len); /* We checked for space !! */ memcpy(msg->buf + msg->len, value, len + 1); /* including \0 */ if (convert) { /* convert from EBCDIC if needed */ ap_xlate_proto_to_ascii((char *)msg->buf + msg->len, len + 1); } msg->len += len + 1; return APR_SUCCESS; }
false
true
false
false
false
1
GetUpperBounds(int i, int j) { if (i < j) return bounds(i, j); else return bounds(j, i); }
false
false
false
false
false
0
setConfiguration(const XMPP::XData& c) { MUCConfigurationTask* t = new MUCConfigurationTask(room_, client_->rootTask()); XData config = c; config.setType(XData::Data_Submit); connect(t,SIGNAL(finished()),SLOT(setConfiguration_finished())); t->set(config); t->go(true); }
false
false
false
false
false
0
tool_hash_function(gconstpointer key) { const char *s_key = (const char*)key; guint hash = 0; if (s_key) { int i; int length = strlen(s_key); for (i=0; i<length; i++) { hash = (hash<<4) + (hash ^ (guint)s_key[i]); } } return hash; }
false
false
false
false
false
0
pontis_add_controls(struct snd_ice1712 *ice) { unsigned int i; int err; for (i = 0; i < ARRAY_SIZE(pontis_controls); i++) { err = snd_ctl_add(ice->card, snd_ctl_new1(&pontis_controls[i], ice)); if (err < 0) return err; } wm_proc_init(ice); cs_proc_init(ice); return 0; }
false
false
false
false
false
0
follow_inner(PointRep *target) { if (this == target) { return true; } else { for (PointRepSet::iterator curr = inner_set.begin(); curr != inner_set.end(); ++curr) { if ((*curr)->follow_inner(target)) { return true; } } } return false; }
false
false
false
false
false
0
seeImpossible() { QString s; mutex.lock(); s+=TimetableGenerateForm::tr("Information relating difficult to schedule activities:"); s+="\n\n"; s+=TimetableGenerateForm::tr("Please check the constraints related to the last " "activities in the list below, which might be difficult to schedule:"); s+="\n\n"; s+=TimetableGenerateForm::tr("Here are the placed activities which lead to a difficulty, " "in order from the first one to the last (the last one FET failed to schedule " "and the last ones are difficult):"); s+="\n\n"; for(int i=0; i<gen.nDifficultActivities; i++){ int ai=gen.difficultActivities[i]; s+=TimetableGenerateForm::tr("No: %1").arg(i+1); s+=", "; s+=TimetableGenerateForm::tr("Id: %1 (%2)", "%1 is id of activity, %2 is detailed description of activity") .arg(gt.rules.internalActivitiesList[ai].id) .arg(getActivityDetailedDescription(gt.rules, gt.rules.internalActivitiesList[ai].id)); s+="\n"; } mutex.unlock(); //show the message in a dialog QDialog dialog(this); dialog.setWindowTitle(tr("FET - information about difficult activities")); QVBoxLayout* vl=new QVBoxLayout(&dialog); QPlainTextEdit* te=new QPlainTextEdit(); te->setPlainText(s); te->setReadOnly(true); QPushButton* pb=new QPushButton(tr("OK")); QHBoxLayout* hl=new QHBoxLayout(0); hl->addStretch(1); hl->addWidget(pb); vl->addWidget(te); vl->addLayout(hl); connect(pb, SIGNAL(clicked()), &dialog, SLOT(close())); dialog.resize(700,500); centerWidgetOnScreen(&dialog); restoreFETDialogGeometry(&dialog, settingsName); setParentAndOtherThings(&dialog, this); dialog.exec(); saveFETDialogGeometry(&dialog, settingsName); }
false
false
false
false
false
0
msg_puts_long_len_attr(longstr, len, attr) char_u *longstr; int len; int attr; { int slen = len; int room; room = Columns - msg_col; if (len > room && room >= 20) { slen = (room - 3) / 2; msg_outtrans_len_attr(longstr, slen, attr); msg_puts_attr((char_u *)"...", hl_attr(HLF_8)); } msg_outtrans_len_attr(longstr + len - slen, slen, attr); }
false
false
false
false
false
0
attr_set_deletion_csn( Slapi_Attr *a, const CSN *csn) { PR_ASSERT(a!=NULL); if(csn_compare(csn,a->a_deletioncsn)>0) { csn_free(&a->a_deletioncsn); a->a_deletioncsn= csn_dup(csn); } return 0; }
false
false
false
false
false
0
Intersects( OGRGeometry *poOtherGeom ) const { OGREnvelope oEnv1, oEnv2; if( this == NULL || poOtherGeom == NULL ) return TRUE; this->getEnvelope( &oEnv1 ); poOtherGeom->getEnvelope( &oEnv2 ); if( oEnv1.MaxX < oEnv2.MinX || oEnv1.MaxY < oEnv2.MinY || oEnv2.MaxX < oEnv1.MinX || oEnv2.MaxY < oEnv1.MinY ) return FALSE; #ifndef HAVE_GEOS // Without GEOS we assume that envelope overlap is equivelent to // actual intersection. return TRUE; #else GEOSGeom hThisGeosGeom = NULL; GEOSGeom hOtherGeosGeom = NULL; hThisGeosGeom = exportToGEOS(); hOtherGeosGeom = poOtherGeom->exportToGEOS(); OGRBoolean bResult = FALSE; if( hThisGeosGeom != NULL && hOtherGeosGeom != NULL ) { if( GEOSIntersects( hThisGeosGeom, hOtherGeosGeom ) != 0 ) bResult = TRUE; else bResult = FALSE; } GEOSGeom_destroy( hThisGeosGeom ); GEOSGeom_destroy( hOtherGeosGeom ); return bResult; #endif /* HAVE_GEOS */ }
false
false
false
false
false
0
ssl_cert_type(X509 *x, EVP_PKEY *pkey) { EVP_PKEY *pk; int ret= -1,i; if (pkey == NULL) pk=X509_get_pubkey(x); else pk=pkey; if (pk == NULL) goto err; i=pk->type; if (i == EVP_PKEY_RSA) { ret=SSL_PKEY_RSA_ENC; } else if (i == EVP_PKEY_DSA) { ret=SSL_PKEY_DSA_SIGN; } #ifndef OPENSSL_NO_EC else if (i == EVP_PKEY_EC) { ret = SSL_PKEY_ECC; } #endif else if (i == NID_id_GostR3410_94 || i == NID_id_GostR3410_94_cc) { ret = SSL_PKEY_GOST94; } else if (i == NID_id_GostR3410_2001 || i == NID_id_GostR3410_2001_cc) { ret = SSL_PKEY_GOST01; } err: if(!pkey) EVP_PKEY_free(pk); return(ret); }
false
false
false
false
false
0
mpcf_fold_ast(int n, mpc_val_t **xs) { int i, j; mpc_ast_t** as = (mpc_ast_t**)xs; mpc_ast_t *r; if (n == 0) { return NULL; } if (n == 1) { return xs[0]; } if (n == 2 && xs[1] == NULL) { return xs[0]; } if (n == 2 && xs[0] == NULL) { return xs[1]; } r = mpc_ast_new(">", ""); for (i = 0; i < n; i++) { if (as[i] == NULL) { continue; } if (as[i] && as[i]->children_num > 0) { for (j = 0; j < as[i]->children_num; j++) { mpc_ast_add_child(r, as[i]->children[j]); } mpc_ast_delete_no_children(as[i]); } else if (as[i] && as[i]->children_num == 0) { mpc_ast_add_child(r, as[i]); } } if (r->children_num) { r->state = r->children[0]->state; } return r; }
false
false
false
false
false
0
dialog_create_action_areav (GtkDialog *dialog, va_list args) { GtkWidget *hbbox = NULL; GtkWidget *button; /* action area variables */ const gchar *label; GtkSignalFunc callback; gpointer data; GObject *slot_object; GtkWidget **widget_ptr; gboolean default_action; gboolean connect_delete; gboolean delete_connected = FALSE; g_return_if_fail (dialog != NULL); g_return_if_fail (GTK_IS_DIALOG (dialog)); /* prepare the action_area */ label = va_arg (args, const gchar *); if (label) { gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 2); gtk_box_set_homogeneous (GTK_BOX (dialog->action_area), FALSE); hbbox = gtk_hbutton_box_new (); gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4); gtk_box_pack_end (GTK_BOX (dialog->action_area), hbbox, FALSE, FALSE, 0); gtk_widget_show (hbbox); } /* the action_area buttons */ while (label) { callback = va_arg (args, GtkSignalFunc); data = va_arg (args, gpointer); slot_object = va_arg (args, GObject *); widget_ptr = va_arg (args, GtkWidget **); default_action = va_arg (args, gboolean); connect_delete = va_arg (args, gboolean); button = gtk_button_new_with_label (label); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0); if (slot_object == (GObject *) 1) slot_object = G_OBJECT (dialog); if (data == NULL) data = dialog; if (callback) { if (slot_object) g_signal_connect_object (G_OBJECT (button), "clicked", G_CALLBACK (callback), slot_object, G_CONNECT_SWAPPED); else g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (callback), data); } if (widget_ptr) *widget_ptr = button; if (connect_delete && callback && !delete_connected) { gtk_object_set_data (GTK_OBJECT (dialog), "dialog_cancel_callback", (gpointer) callback); gtk_object_set_data (GTK_OBJECT (dialog), "dialog_cancel_widget", slot_object ? slot_object : G_OBJECT (button)); /* catch the WM delete event */ g_signal_connect (G_OBJECT (dialog), "delete_event", G_CALLBACK (dialog_delete_callback), data); delete_connected = TRUE; } if (default_action) gtk_widget_grab_default (button); gtk_widget_show (button); label = va_arg (args, gchar *); } }
false
false
false
false
false
0
GetMaxPlayers() const { if (MapDifficultyEntry const* mapDiff = GetMapDifficulty()) { if (mapDiff->maxPlayers || IsRegularDifficulty()) // Normal case (expect that regular difficulty always have correct maxplayers) return mapDiff->maxPlayers; else // DBC have 0 maxplayers for heroic instances with expansion < 2 { // The heroic entry exists, so we don't have to check anything, simply return normal max players MapDifficultyEntry const* normalDiff = GetMapDifficultyData(i_id, REGULAR_DIFFICULTY); return normalDiff ? normalDiff->maxPlayers : 0; } } else // I'd rather ASSERT(false); return 0; }
false
false
false
false
false
0
is_equal(const ExecutionPath *e) const { const UninitVar *c = static_cast<const UninitVar *>(e); return (varname == c->varname && pointer == c->pointer && array == c->array && alloc == c->alloc && strncpy_ == c->strncpy_); }
false
false
false
false
false
0
lock_piece(Field *field, Block *block) { int i, j; for (i = 0; i < 4; ++i) { for (j = 0; j < 4; ++j) { (*field)[i + block->posy][j + block->posx] |= blocks[block->blocktype][block->orient][i][j]; } } }
false
false
false
false
false
0
VasySimplifyHashTristateAsg( RtlFigure ) rtlfig_list *RtlFigure; { rtldecl_list *RtlDeclar; rtlsym *RtlSymbol; rtlasg_list *RtlAsg; authelem *Element; chain_list *HeadChain; vexexpr *VexAtom; char *AtomName; int VexMin; int VexMax; int VexIndex; if ( VasyHashRtlAsg == (authtable *)0 ) { VasyHashRtlAsg = createauthtable( 1000 ); } else { resetauthtable( VasyHashRtlAsg ); } for ( RtlAsg = RtlFigure->ASSIGN; RtlAsg != (rtlasg_list *)0; RtlAsg = RtlAsg->NEXT ) { VexAtom = RtlAsg->VEX_ATOM; AtomName = GetVexAtomValue( VexAtom ); RtlDeclar = searchrtldecl( RtlFigure, AtomName ); VexMin = getvexvectormin( VexAtom ); VexMax = getvexvectormax( VexAtom ); if ( RtlAsg->TYPE == RTL_ASG_TRISTATE ) { for ( VexIndex = VexMin; VexIndex <= VexMax; VexIndex++ ) { RtlSymbol = getrtlsymdecl( RtlDeclar, VexIndex ); Element = searchauthelem( VasyHashRtlAsg, (char *)RtlSymbol ); if ( Element == (authelem *)0 ) HeadChain = (chain_list *)0; else HeadChain = (chain_list *)Element->VALUE; HeadChain = addchain( HeadChain, (void *)RtlAsg ); addauthelem( VasyHashRtlAsg, (char *)RtlSymbol, (long)HeadChain ); } } } if ( IsVasyDebugLevel1() ) { viewauthtable( VasyHashRtlAsg, VasySimplifyViewHashTristateAsg ); } }
false
false
false
false
false
0
main(int cnt, char *vec[]) { int iface; if (cnt < 2) { err("Usage:\n" "%s <UART device>\n" "UART device --> UART device node Ex: /dev/ttyS0\n", vec[0]); return EXIT_FAILURE; } signal(SIGTERM, app_sig_handler); signal(SIGINT, app_sig_handler); if ((iface = uart_init(vec[1])) < 0) { return EXIT_FAILURE; } if (pthread_create(&t_app, NULL, app_thread, (void *)iface)) { err("Unable to create application thread\n"); return EXIT_FAILURE; } if (pthread_create(&t_rx, NULL, rx_thread, (void *)iface)) { err("Unable to create RX thread [%s]\n", strerror(errno)); return EXIT_FAILURE; } pthread_join(t_rx, NULL); pthread_join(t_app, NULL); unlink(IN_PIPE_NAME); dbg ("APP: Exiting...\n"); return EXIT_SUCCESS; }
false
false
false
false
false
0
rsvg_defs_extern_lookup (const RsvgDefs * defs, const char *filename, const char *name) { RsvgHandle *file; file = (RsvgHandle *) g_hash_table_lookup (defs->externs, filename); if (file == NULL) { if (rsvg_defs_load_extern (defs, filename)) return NULL; file = (RsvgHandle *) g_hash_table_lookup (defs->externs, filename); } if (file != NULL) return (RsvgNode *) g_hash_table_lookup (file->priv->defs->hash, name); else return NULL; }
false
false
false
false
false
0
ilt_load_table(FILE *fd) { insn_lookup_t *ilt; int i; if (!(ilt = malloc(sizeof(*ilt)))) return NULL; memset(ilt,0,sizeof(*ilt)); fseek(fd,0,SEEK_SET); for(i=0;i<RFC_ARRAY_NUMBER;i++) { if (ilt_load_rfct(fd,ilt) == -1) return NULL; } if (ilt_check_cached_table(ilt) == -1) return NULL; return ilt; }
false
false
false
false
false
0
extract_nb(uint32 insn, bool *invalid) { uint32 ret; ret = (insn >> 11) & 0x1f; if (ret == 0) ret = 32; return ret; }
false
false
false
false
false
0
mul_under_dim_size(Array_table *atbl, const int udim) { int i; SemTree *ret = make_semtree_const_int(1); for (i = 0; i < udim; i++) { SemTree *dim_size; dim_size = get_array_table_dim_size(atbl, i); ret = concat_semtree(OPE_MUL, ret, dim_size); } semtree_process(ret); return ret; }
false
false
false
false
false
0
apply_seg( x86_op_t *op, unsigned int prefixes ) { if (! prefixes ) return; /* apply overrides from prefix */ switch ( prefixes & PREFIX_REG_MASK ) { case PREFIX_CS: op->flags |= op_cs_seg; break; case PREFIX_SS: op->flags |= op_ss_seg; break; case PREFIX_DS: op->flags |= op_ds_seg; break; case PREFIX_ES: op->flags |= op_es_seg; break; case PREFIX_FS: op->flags |= op_fs_seg; break; case PREFIX_GS: op->flags |= op_gs_seg; break; } return; }
false
false
false
false
false
0
IDirectFBVideoProvider_V4L_GetCapabilities( IDirectFBVideoProvider *thiz, DFBVideoProviderCapabilities *caps ) { DIRECT_INTERFACE_GET_DATA (IDirectFBVideoProvider_V4L) if (!caps) return DFB_INVARG; #ifdef DFB_HAVE_V4L2 if (data->is_v4l2) { *caps = 0; data->saturation.id = V4L2_CID_SATURATION; if (ioctl( data->fd, VIDIOC_G_CTRL, &data->saturation )) { *caps |= DVCAPS_SATURATION; } else { data->saturation.id = 0; } data->brightness.id = V4L2_CID_BRIGHTNESS; if (ioctl( data->fd, VIDIOC_G_CTRL, &data->brightness )) { *caps |= DVCAPS_BRIGHTNESS; } else { data->brightness.id = 0; } data->contrast.id = V4L2_CID_CONTRAST; if (ioctl( data->fd, VIDIOC_G_CTRL, &data->contrast )) { *caps |= DVCAPS_CONTRAST; } else { data->contrast.id = 0; } data->hue.id = V4L2_CID_HUE; if (ioctl( data->fd, VIDIOC_G_CTRL, &data->hue )) { *caps |= DVCAPS_HUE; } else { data->hue.id = 0; } /* fixme: interlaced might not be true for field capture */ *caps |= DVCAPS_BASIC | DVCAPS_SCALE | DVCAPS_INTERLACED; } else #endif { *caps = ( DVCAPS_BASIC | DVCAPS_BRIGHTNESS | DVCAPS_CONTRAST | DVCAPS_HUE | DVCAPS_SATURATION | DVCAPS_INTERLACED ); if (data->vcap.type & VID_TYPE_SCALES) *caps |= DVCAPS_SCALE; } return DFB_OK; }
false
false
false
false
false
0
blogic_dealloc_ccb(struct blogic_ccb *ccb, int dma_unmap) { struct blogic_adapter *adapter = ccb->adapter; if (ccb->command != NULL) scsi_dma_unmap(ccb->command); if (dma_unmap) pci_unmap_single(adapter->pci_device, ccb->sensedata, ccb->sense_datalen, PCI_DMA_FROMDEVICE); ccb->command = NULL; ccb->status = BLOGIC_CCB_FREE; ccb->next = adapter->free_ccbs; adapter->free_ccbs = ccb; }
false
false
false
false
false
0
sis900_mdio_idle(long mdio_addr) { outl(MDIO | MDDIR, mdio_addr); sis900_mdio_delay(); outl(MDIO | MDDIR | MDC, mdio_addr); }
false
false
false
false
false
0
write_smc(u8 cmd, const char *key, const u8 *buffer, u8 len) { int i; if (send_command(cmd) || send_argument(key)) { pr_warn("%s: write arg fail\n", key); return -EIO; } if (send_byte(len, APPLESMC_DATA_PORT)) { pr_warn("%.4s: write len fail\n", key); return -EIO; } for (i = 0; i < len; i++) { if (send_byte(buffer[i], APPLESMC_DATA_PORT)) { pr_warn("%s: write data fail\n", key); return -EIO; } } return 0; }
false
false
false
false
false
0
rfbCloseClient(rfbClientPtr cl) { rfbExtensionData* extension; for(extension=cl->extensions; extension; extension=extension->next) if(extension->extension->close) extension->extension->close(cl, extension->data); LOCK(cl->updateMutex); #ifdef LIBVNCSERVER_HAVE_LIBPTHREAD if (cl->sock != -1) #endif { FD_CLR(cl->sock,&(cl->screen->allFds)); if(cl->sock==cl->screen->maxFd) while(cl->screen->maxFd>0 && !FD_ISSET(cl->screen->maxFd,&(cl->screen->allFds))) cl->screen->maxFd--; #ifndef __MINGW32__ shutdown(cl->sock,SHUT_RDWR); #endif closesocket(cl->sock); cl->sock = -1; } TSIGNAL(cl->updateCond); UNLOCK(cl->updateMutex); }
false
false
false
false
false
0
string_sequence_new (gchar **strings) { GSequence *sequence; sequence = g_sequence_new(g_free); for (; *strings; strings++) { g_sequence_append(sequence, g_strdup(*strings)); } return sequence; }
false
false
false
false
false
0
ufs2_update_inode(struct inode *inode, struct ufs2_inode *ufs_inode) { struct super_block *sb = inode->i_sb; struct ufs_inode_info *ufsi = UFS_I(inode); UFSD("ENTER\n"); ufs_inode->ui_mode = cpu_to_fs16(sb, inode->i_mode); ufs_inode->ui_nlink = cpu_to_fs16(sb, inode->i_nlink); ufs_inode->ui_uid = cpu_to_fs32(sb, i_uid_read(inode)); ufs_inode->ui_gid = cpu_to_fs32(sb, i_gid_read(inode)); ufs_inode->ui_size = cpu_to_fs64(sb, inode->i_size); ufs_inode->ui_atime = cpu_to_fs64(sb, inode->i_atime.tv_sec); ufs_inode->ui_atimensec = cpu_to_fs32(sb, inode->i_atime.tv_nsec); ufs_inode->ui_ctime = cpu_to_fs64(sb, inode->i_ctime.tv_sec); ufs_inode->ui_ctimensec = cpu_to_fs32(sb, inode->i_ctime.tv_nsec); ufs_inode->ui_mtime = cpu_to_fs64(sb, inode->i_mtime.tv_sec); ufs_inode->ui_mtimensec = cpu_to_fs32(sb, inode->i_mtime.tv_nsec); ufs_inode->ui_blocks = cpu_to_fs64(sb, inode->i_blocks); ufs_inode->ui_flags = cpu_to_fs32(sb, ufsi->i_flags); ufs_inode->ui_gen = cpu_to_fs32(sb, inode->i_generation); if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) { /* ufs_inode->ui_u2.ui_addr.ui_db[0] = cpu_to_fs32(sb, inode->i_rdev); */ ufs_inode->ui_u2.ui_addr.ui_db[0] = ufsi->i_u1.u2_i_data[0]; } else if (inode->i_blocks) { memcpy(&ufs_inode->ui_u2.ui_addr, ufsi->i_u1.u2_i_data, sizeof(ufs_inode->ui_u2.ui_addr)); } else { memcpy(&ufs_inode->ui_u2.ui_symlink, ufsi->i_u1.i_symlink, sizeof(ufs_inode->ui_u2.ui_symlink)); } if (!inode->i_nlink) memset (ufs_inode, 0, sizeof(struct ufs2_inode)); UFSD("EXIT\n"); }
false
true
false
false
false
1
main(int argc, char* argv[]) { UBool verbose = TRUE; char writeCode; U_MAIN_INIT_ARGS(argc, argv); options[kOptDestDir].value = "."; /* read command line options */ argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options); /* error handling, printing usage message */ if(argc<0) { fprintf(stderr, "error in command line argument \"%s\"\n", argv[-argc]); } if(argc<0 || options[kOptHelpH].doesOccur || options[kOptHelpQuestionMark].doesOccur) { fprintf(stderr, "usage: %s [-options] filename1 filename2 ...\n" "\tread each binary input file and \n" "\tcreate a .c file with a byte array that contains the input file's data\n" "options:\n" "\t-h or -? or --help this usage text\n" "\t-d or --destdir destination directory, followed by the path\n" "\t-n or --name symbol prefix, followed by the prefix\n" "\t-e or --entrypoint entry point name, followed by the name (_dat will be appended)\n" "\t-r or --revision Specify a version\n" , argv[0]); #ifdef CAN_GENERATE_OBJECTS fprintf(stderr, "\t-o or --object write a .obj file instead of .c\n" "\t-m or --match-arch file.o match the architecture (CPU, 32/64 bits) of the specified .o\n" "\t ELF format defaults to i386. Windows defaults to the native platform.\n"); #endif fprintf(stderr, "\t-f or --filename Specify an alternate base filename. (default: symbolname_typ)\n" "\t-a or --assembly Create assembly file. (possible values are: "); printAssemblyHeadersToStdErr(); } else { const char *message, *filename; /* TODO: remove void (*writeCode)(const char *, const char *); */ if(options[kOptAssembly].doesOccur) { message="generating assembly code for %s\n"; writeCode = CALL_WRITEASSEMBLY; /* TODO: remove writeCode=&writeAssemblyCode; */ if (!checkAssemblyHeaderName(options[kOptAssembly].value)) { fprintf(stderr, "Assembly type \"%s\" is unknown.\n", options[kOptAssembly].value); return -1; } } #ifdef CAN_GENERATE_OBJECTS else if(options[kOptObject].doesOccur) { message="generating object code for %s\n"; writeCode = CALL_WRITEOBJECT; /* TODO: remove writeCode=&writeObjectCode; */ } #endif else { message="generating C code for %s\n"; writeCode = CALL_WRITECCODE; /* TODO: remove writeCode=&writeCCode; */ } while(--argc) { filename=getLongPathname(argv[argc]); if (verbose) { fprintf(stdout, message, filename); } switch (writeCode) { case CALL_WRITECCODE: writeCCode(filename, options[kOptDestDir].value, options[kOptName].doesOccur ? options[kOptName].value : NULL, options[kOptFilename].doesOccur ? options[kOptFilename].value : NULL, NULL); break; case CALL_WRITEASSEMBLY: writeAssemblyCode(filename, options[kOptDestDir].value, options[kOptEntryPoint].doesOccur ? options[kOptEntryPoint].value : NULL, options[kOptFilename].doesOccur ? options[kOptFilename].value : NULL, NULL); break; #ifdef CAN_GENERATE_OBJECTS case CALL_WRITEOBJECT: writeObjectCode(filename, options[kOptDestDir].value, options[kOptEntryPoint].doesOccur ? options[kOptEntryPoint].value : NULL, options[kOptMatchArch].doesOccur ? options[kOptMatchArch].value : NULL, options[kOptFilename].doesOccur ? options[kOptFilename].value : NULL, NULL); break; #endif default: /* Should never occur. */ break; } /* TODO: remove writeCode(filename, options[kOptDestDir].value); */ } } return 0; }
false
false
false
false
true
1
SetSaslError(Authen_SASL_Cyrus sasl,int code, const char* msg) { if (sasl == NULL) #ifdef SASL2 code = SASL_NOTINIT; #else code = SASL_FAIL; #endif else { _DEBUG("former error: %s, Code: %d",sasl->additional_errormsg, sasl->error_code); // Do not overwrite Error which are not handled yet, except this one which // aren't errors at all if (sasl->error_code == SASL_OK || sasl->error_code == SASL_CONTINUE ) { sasl->error_code = code; if (sasl->additional_errormsg != NULL) free(sasl->additional_errormsg); // Is there a message and is it really an error, otherwise ignore message if (msg != NULL && code != SASL_OK && code != SASL_CONTINUE) sasl->additional_errormsg = strdup(msg); else sasl->additional_errormsg = NULL; } _DEBUG("called Error: %s, Code: %d Client: %d",msg,code,sasl->is_client); _DEBUG("now Error: %s, Code: %d",sasl->additional_errormsg,sasl->error_code); } return code; }
false
false
false
false
false
0
win_enter_ext(wp, undo_sync, curwin_invalid, trigger_enter_autocmds, trigger_leave_autocmds) win_T *wp; int undo_sync; int curwin_invalid; int trigger_enter_autocmds UNUSED; int trigger_leave_autocmds UNUSED; { #ifdef FEAT_AUTOCMD int other_buffer = FALSE; #endif if (wp == curwin && !curwin_invalid) /* nothing to do */ return; #ifdef FEAT_AUTOCMD if (!curwin_invalid && trigger_leave_autocmds) { /* * Be careful: If autocommands delete the window, return now. */ if (wp->w_buffer != curbuf) { apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf); other_buffer = TRUE; if (!win_valid(wp)) return; } apply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf); if (!win_valid(wp)) return; # ifdef FEAT_EVAL /* autocmds may abort script processing */ if (aborting()) return; # endif } #endif /* sync undo before leaving the current buffer */ if (undo_sync && curbuf != wp->w_buffer) u_sync(FALSE); /* may have to copy the buffer options when 'cpo' contains 'S' */ if (wp->w_buffer != curbuf) buf_copy_options(wp->w_buffer, BCO_ENTER | BCO_NOHELP); if (!curwin_invalid) { prevwin = curwin; /* remember for CTRL-W p */ curwin->w_redr_status = TRUE; } curwin = wp; curbuf = wp->w_buffer; check_cursor(); #ifdef FEAT_VIRTUALEDIT if (!virtual_active()) curwin->w_cursor.coladd = 0; #endif changed_line_abv_curs(); /* assume cursor position needs updating */ if (curwin->w_localdir != NULL) { /* Window has a local directory: Save current directory as global * directory (unless that was done already) and change to the local * directory. */ if (globaldir == NULL) { char_u cwd[MAXPATHL]; if (mch_dirname(cwd, MAXPATHL) == OK) globaldir = vim_strsave(cwd); } if (mch_chdir((char *)curwin->w_localdir) == 0) shorten_fnames(TRUE); } else if (globaldir != NULL) { /* Window doesn't have a local directory and we are not in the global * directory: Change to the global directory. */ ignored = mch_chdir((char *)globaldir); vim_free(globaldir); globaldir = NULL; shorten_fnames(TRUE); } #ifdef FEAT_AUTOCMD if (trigger_enter_autocmds) { apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf); if (other_buffer) apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); } #endif #ifdef FEAT_TITLE maketitle(); #endif curwin->w_redr_status = TRUE; redraw_tabline = TRUE; if (restart_edit) redraw_later(VALID); /* causes status line redraw */ /* set window height to desired minimal value */ if (curwin->w_height < p_wh && !curwin->w_p_wfh) win_setheight((int)p_wh); else if (curwin->w_height == 0) win_setheight(1); #ifdef FEAT_VERTSPLIT /* set window width to desired minimal value */ if (curwin->w_width < p_wiw && !curwin->w_p_wfw) win_setwidth((int)p_wiw); #endif #ifdef FEAT_MOUSE setmouse(); /* in case jumped to/from help buffer */ #endif /* Change directories when the 'acd' option is set. */ DO_AUTOCHDIR }
false
false
false
false
false
0
crush_find_rule(const struct crush_map *map, int ruleset, int type, int size) { __u32 i; for (i = 0; i < map->max_rules; i++) { if (map->rules[i] && map->rules[i]->mask.ruleset == ruleset && map->rules[i]->mask.type == type && map->rules[i]->mask.min_size <= size && map->rules[i]->mask.max_size >= size) return i; } return -1; }
false
false
false
false
false
0
emit_notes_for_changes (rtx insn, enum emit_note_where where, shared_hash vars) { emit_note_data data; htab_t htab = shared_hash_htab (vars); if (!htab_elements (changed_variables)) return; if (MAY_HAVE_DEBUG_INSNS) process_changed_values (htab); data.insn = insn; data.where = where; data.vars = htab; htab_traverse (changed_variables, emit_note_insn_var_location, &data); }
false
false
false
false
false
0
CellGetNumberOfNodes( Partition *p, Cell *W ) { int first = W->first; int next = W->next; int i, num; for ( i = first, num = 0; i < next; i ++ ) { if ( !( rank_mark_bit & p->Rank[(int)p->AtNumber[i]] ) ) { num++; } } INCHI_HEAPCHK return num; }
false
false
false
false
false
0
OnHash(const unsigned char *srcmac, const unsigned char *dstmac, struct evbuffer *evb) { if (evbuffer_get_length(evb) < 4 + Sha1Hash::SIZE) { eprintf("%s #%u incorrect size in eth has\n", tintstr(), my_channel); return; } bin_t range = bin_fromUInt32(evbuffer_remove_32be(evb)); rec_ranges.set(range); Sha1Hash hash = evbuffer_remove_hash(evb); transfer->file().OfferHash(range, hash); char bin_name_buf[32]; dprintf("%s #%u -hash %s\n",tintstr(),my_channel,range.str(bin_name_buf)); }
false
false
false
false
false
0
engineBoots_conf(const char *word, char *cptr) { engineBoots = atoi(cptr) + 1; DEBUGMSGTL(("snmpv3", "engineBoots: %lu\n", engineBoots)); }
false
false
false
false
true
1
Curl_expire(struct SessionHandle *data, long milli) { struct Curl_multi *multi = data->multi; struct timeval *nowp = &data->state.expiretime; int rc; /* this is only interesting for multi-interface using libcurl, and only while there is still a multi interface struct remaining! */ if(!multi) return; if(!milli) { /* No timeout, clear the time data. */ if(nowp->tv_sec) { /* Since this is an cleared time, we must remove the previous entry from the splay tree */ rc = Curl_splayremovebyaddr(multi->timetree, &data->state.timenode, &multi->timetree); if(rc) infof(data, "Internal error clearing splay node = %d\n", rc); infof(data, "Expire cleared\n"); nowp->tv_sec = 0; nowp->tv_usec = 0; } } else { struct timeval set; int rest; set = Curl_tvnow(); set.tv_sec += milli/1000; set.tv_usec += (milli%1000)*1000; rest = (int)(set.tv_usec - 1000000); if(rest > 0) { /* bigger than a full microsec */ set.tv_sec++; set.tv_usec -= 1000000; } if(nowp->tv_sec) { /* This means that the struct is added as a node in the splay tree. Compare if the new time is earlier, and only remove-old/add-new if it is. */ long diff = curlx_tvdiff(set, *nowp); if(diff > 0) /* the new expire time was later so we don't change this */ return; /* Since this is an updated time, we must remove the previous entry from the splay tree first and then re-add the new value */ rc = Curl_splayremovebyaddr(multi->timetree, &data->state.timenode, &multi->timetree); if(rc) infof(data, "Internal error removing splay node = %d\n", rc); } *nowp = set; #if 0 infof(data, "Expire at %ld / %ld (%ldms)\n", (long)nowp->tv_sec, (long)nowp->tv_usec, milli); #endif data->state.timenode.payload = data; multi->timetree = Curl_splayinsert((int)nowp->tv_sec, multi->timetree, &data->state.timenode); } #if 0 Curl_splayprint(multi->timetree, 0, TRUE); #endif }
false
false
false
false
false
0
silence_gen_init(silence_gen_state_t *s, int silent_samples) { if (s == NULL) { if ((s = (silence_gen_state_t *) malloc(sizeof(*s))) == NULL) return NULL; } memset(s, 0, sizeof(*s)); s->remaining_samples = silent_samples; return s; }
false
false
false
false
false
0
game_view_redraw_tile_cb (GameView* self, Tile* tile) { gint x = 0; gint y = 0; Tile* _tmp0_ = NULL; gint _tmp1_ = 0; gint _tmp2_ = 0; gint _tmp3_ = 0; gint _tmp4_ = 0; g_return_if_fail (self != NULL); g_return_if_fail (tile != NULL); game_view_update_dimensions (self); _tmp0_ = tile; game_view_get_tile_position (self, _tmp0_, &_tmp1_, &_tmp2_); x = _tmp1_; y = _tmp2_; _tmp3_ = self->priv->tile_pattern_width; _tmp4_ = self->priv->tile_pattern_height; gtk_widget_queue_draw_area ((GtkWidget*) self, x, y, _tmp3_, _tmp4_); }
false
false
false
false
false
0
vmpressure_work_fn(struct work_struct *work) { struct vmpressure *vmpr = work_to_vmpressure(work); unsigned long scanned; unsigned long reclaimed; spin_lock(&vmpr->sr_lock); /* * Several contexts might be calling vmpressure(), so it is * possible that the work was rescheduled again before the old * work context cleared the counters. In that case we will run * just after the old work returns, but then scanned might be zero * here. No need for any locks here since we don't care if * vmpr->reclaimed is in sync. */ scanned = vmpr->scanned; if (!scanned) { spin_unlock(&vmpr->sr_lock); return; } reclaimed = vmpr->reclaimed; vmpr->scanned = 0; vmpr->reclaimed = 0; spin_unlock(&vmpr->sr_lock); do { if (vmpressure_event(vmpr, scanned, reclaimed)) break; /* * If not handled, propagate the event upward into the * hierarchy. */ } while ((vmpr = vmpressure_parent(vmpr))); }
false
false
false
false
false
0
io_type_enabled(struct pci_dev *pdev, unsigned int mask) { u16 cmd; return !pci_read_config_word(pdev, PCI_COMMAND, &cmd) && (cmd & mask); }
false
false
false
false
false
0
ListExpr2 ( Obj list, Expr expr ) { Obj sub; /* value of a subexpression */ Int len; /* logical length of the list */ Int i; /* loop variable */ Int posshole; /* initially 0, set to 1 at first empty position, then next full position causes the list to be made non-dense */ /* get the length of the list */ len = SIZE_EXPR(expr) / sizeof(Expr); /* initially we have not seen a hole */ posshole = 0; /* handle the subexpressions */ for ( i = 1; i <= len; i++ ) { /* if the subexpression is empty */ if ( ADDR_EXPR(expr)[i-1] == 0 ) { if (!posshole) posshole = 1; continue; } else { if (posshole == 1) { SET_FILT_LIST(list, FN_IS_NDENSE); posshole = 2; } /* special case if subexpression is a list expression */ if ( TNUM_EXPR( ADDR_EXPR(expr)[i-1] ) == T_LIST_EXPR ) { sub = ListExpr1( ADDR_EXPR(expr)[i-1] ); SET_ELM_PLIST( list, i, sub ); CHANGED_BAG( list ); ListExpr2( sub, ADDR_EXPR(expr)[i-1] ); } /* special case if subexpression is a record expression */ else if ( TNUM_EXPR( ADDR_EXPR(expr)[i-1] ) == T_REC_EXPR ) { sub = RecExpr1( ADDR_EXPR(expr)[i-1] ); SET_ELM_PLIST( list, i, sub ); CHANGED_BAG( list ); RecExpr2( sub, ADDR_EXPR(expr)[i-1] ); } /* general case */ else { sub = EVAL_EXPR( ADDR_EXPR(expr)[i-1] ); SET_ELM_PLIST( list, i, sub ); CHANGED_BAG( list ); } } } if (!posshole) SET_FILT_LIST(list, FN_IS_DENSE); }
false
false
false
false
false
0
method_A5(const int *account, int *weight) { number2Array("2121212120", weight); if (AccountNumberCheck::OK == algo01(10, weight, true, 10, account)) return AccountNumberCheck::OK; if (account[0] == 9) return AccountNumberCheck::ERROR; number2Array("0987654320", weight); weight[0] = 10; return algo01(11, weight, false, 10, account); }
false
false
false
false
false
0
mg_md5(char buf[33], ...) { unsigned char hash[16]; const char *p; va_list ap; MD5_CTX ctx; MD5Init(&ctx); va_start(ap, buf); while ((p = va_arg(ap, const char *)) != NULL) { MD5Update(&ctx, (const unsigned char *) p, (unsigned) strlen(p)); } va_end(ap); MD5Final(hash, &ctx); bin2str(buf, hash, sizeof(hash)); return buf; }
false
false
false
false
false
0
alphabet_lua_decode(lua_State *L) { GtAlphabet **alpha; unsigned int code; char character; alpha = check_alphabet(L, 1); code = luaL_checkinteger(L, 2); /* XXX: too restrictive, does not consider wildcards */ luaL_argcheck(L, code < gt_alphabet_size(*alpha), 2, "invalid code"); character = gt_alphabet_decode(*alpha, code); lua_pushlstring(L, &character, 1); return 1; }
false
false
false
false
false
0
sge_uid2user(uid_t uid, char *dst, size_t sz, int retries) { const char *last_username; DENTER(UIDGID_LAYER, "sge_uid2user"); last_username = uidgid_state_get_last_username(); if (!last_username[0] || (uidgid_state_get_last_uid() != uid)) { struct passwd *pw; struct passwd pwentry; int size; char *buffer; size = get_pw_buffer_size(); buffer = sge_malloc(size); /* max retries that are made resolving user name */ while (getpwuid_r(uid, &pwentry, buffer, size, &pw) != 0 || !pw) { if (!retries--) { ERROR((SGE_EVENT, MSG_SYSTEM_GETPWUIDFAILED_US, sge_u32c(uid), strerror(errno))); FREE(buffer); DEXIT; return 1; } sleep(1); } /* cache user name */ uidgid_state_set_last_username(pw->pw_name); uidgid_state_set_last_uid(uid); FREE(buffer); } if (dst) { sge_strlcpy(dst, uidgid_state_get_last_username(), sz); } DEXIT; return 0; }
false
false
false
false
false
0
zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ { if ((class_type->ce_flags & ZEND_ACC_CONSTANTS_UPDATED) == 0 || (!CE_STATIC_MEMBERS(class_type) && class_type->default_static_members_count)) { zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry); zend_class_entry *old_scope = *scope; int i; *scope = class_type; zend_hash_apply_with_argument(&class_type->constants_table, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC); for (i = 0; i < class_type->default_properties_count; i++) { if (class_type->default_properties_table[i]) { zval_update_constant(&class_type->default_properties_table[i], (void**)1 TSRMLS_CC); } } if (!CE_STATIC_MEMBERS(class_type) && class_type->default_static_members_count) { zval **p; if (class_type->parent) { zend_update_class_constants(class_type->parent TSRMLS_CC); } #if ZTS CG(static_members_table)[(zend_intptr_t)(class_type->static_members_table)] = emalloc(sizeof(zval*) * class_type->default_static_members_count); #else class_type->static_members_table = emalloc(sizeof(zval*) * class_type->default_static_members_count); #endif for (i = 0; i < class_type->default_static_members_count; i++) { p = &class_type->default_static_members_table[i]; if (Z_ISREF_PP(p) && class_type->parent && i < class_type->parent->default_static_members_count && *p == class_type->parent->default_static_members_table[i] && CE_STATIC_MEMBERS(class_type->parent)[i] ) { zval *q = CE_STATIC_MEMBERS(class_type->parent)[i]; Z_ADDREF_P(q); Z_SET_ISREF_P(q); CE_STATIC_MEMBERS(class_type)[i] = q; } else { zval *r; ALLOC_ZVAL(r); *r = **p; INIT_PZVAL(r); zval_copy_ctor(r); CE_STATIC_MEMBERS(class_type)[i] = r; } } } for (i = 0; i < class_type->default_static_members_count; i++) { zval_update_constant(&CE_STATIC_MEMBERS(class_type)[i], (void**)1 TSRMLS_CC); } *scope = old_scope; class_type->ce_flags |= ZEND_ACC_CONSTANTS_UPDATED; } }
false
false
false
false
false
0
visible_context(gs_context_t *pctx) { return (pctx && pctx->visible ? pctx : (gs_context_t *)0); }
false
false
false
false
false
0
jt1_i(void) { UINT8 adr = ROP_ARG(PC); PC += 1; if( !(ENABLE & CNT) ) { UINT8 level = RP(I8X41_t1); if( level ) CONTROL |= TEST1; else CONTROL &= ~TEST1; } if( (CONTROL & TEST1) ) PC = (PC & 0x700) | adr; }
false
false
false
false
false
0
CallAssistance() { // FIXME: should player pets call for assistance? if (!m_AlreadyCallAssistance && getVictim() && !isCharmed()) { SetNoCallAssistance(true); if (GetCreatureInfo()->ExtraFlags & CREATURE_FLAG_EXTRA_NO_CALL_ASSIST) return; AI()->SendAIEventAround(AI_EVENT_CALL_ASSISTANCE, getVictim(), sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_ASSISTANCE_DELAY), sWorld.getConfig(CONFIG_FLOAT_CREATURE_FAMILY_ASSISTANCE_RADIUS)); } }
false
false
false
false
false
0
putxy (gadouble x, gadouble y) { if (xycnt>=grsize) return(1); *(xybuf+(xycnt*2)) = x; *(xybuf+(xycnt*2+1)) = y; xycnt++; return(0); }
false
false
false
false
false
0
UpdateEscortAI(const uint32 uiDiff) override { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) { return; } if (m_uiRend_Timer < uiDiff) { DoCastSpellIfCan(m_creature->getVictim(), SPELL_REND); m_uiRend_Timer = 20000; } else { m_uiRend_Timer -= uiDiff; } if (m_uiThunderclap_Timer < uiDiff) { DoCastSpellIfCan(m_creature, SPELL_THUNDERCLAP); m_uiThunderclap_Timer = 30000; } else { m_uiThunderclap_Timer -= uiDiff; } DoMeleeAttackIfReady(); }
false
false
false
false
false
0
printSysThermalZoneTemperature(const char *cmd) { int zone = 0; if (sscanf(cmd, "acpi/Thermal_Zone/%d", &zone) <= 0) { output("-1\n"); return; } output( "%d\n", getSysFileValue("thermal_zone", zone, "temp") / 1000); }
false
false
false
false
false
0
define_variable(Sexp* var, Sexp* val, Env* ep) { Frame* fp; fp = ep->frames; char* varstr = (var->u.atom)->u.sym; Sexp* interned_var = intern_symbol(varstr); free(var); if (fp == NULL){ Frame* newfp; newfp = (Frame*)emalloc(sizeof(Frame)); mk_frame(interned_var, val, newfp); ep->frames = newfp; } else { scan_define(interned_var, val, fp); } }
false
false
false
false
false
0
ar_style_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { ArStyle *style = AR_STYLE (object); ArStylePrivate *priv = style->priv; switch (property_id) { case PROP_CARD_OVERHANG: priv->card_overhang = g_value_get_double (value); break; case PROP_CARD_SLOT_RATIO: priv->card_slot_ratio = g_value_get_double (value); break; case PROP_CARD_STEP: priv->card_step = g_value_get_double (value); break; case PROP_CARD_THEME: ar_style_set_card_theme (style, g_value_get_object (value)); break; case PROP_CLICK_TO_MOVE: ar_style_set_click_to_move (style, g_value_get_boolean (value)); break; case PROP_DND_DRAG_THRESHOLD: priv->dnd_drag_threshold = g_value_get_int (value); break; case PROP_DOUBLE_CLICK_TIME: priv->double_click_time = g_value_get_int (value); break; case PROP_ENABLE_ANIMATIONS: ar_style_set_enable_animations (style, g_value_get_boolean (value)); break; case PROP_FOCUS_LINE_WIDTH: priv->focus_line_width = g_value_get_int (value); break; case PROP_FOCUS_PADDING: priv->focus_padding = g_value_get_int (value); break; case PROP_INTERIOR_FOCUS: priv->interior_focus = g_value_get_boolean (value) != FALSE; break; case PROP_RTL: priv->rtl = g_value_get_boolean (value) != FALSE; break; case PROP_SELECTION_COLOR: { const GdkRGBA *color; if ((color = g_value_get_boxed (value)) != NULL) { priv->selection_color = *color; } else { priv->selection_color = default_selection_color; } break; } case PROP_ENABLE_SOUND: ar_style_set_enable_sound (style, g_value_get_boolean (value)); break; case PROP_SHOW_TOOLTIPS: priv->enable_tooltips = g_value_get_boolean (value) != FALSE; break; case PROP_SHOW_STATUS_MESSAGES: priv->enable_status_messages = g_value_get_boolean (value) != FALSE; break; case PROP_TOUCHSCREEN_MODE: priv->touchscreen_mode = g_value_get_boolean (value) != FALSE; break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } }
false
false
false
false
false
0
instance_reduce(object instance_obj) { list result; object instance_class(instance_obj.attr("__class__")); result.append(instance_class); object none; if (!getattr(instance_obj, "__safe_for_unpickling__", none)) { str type_name(getattr(instance_class, "__name__")); str module_name(getattr(instance_class, "__module__", object(""))); if (module_name) module_name += "."; PyErr_SetObject( PyExc_RuntimeError, ( "Pickling of \"%s\" instances is not enabled" " (http://www.boost.org/libs/python/doc/v2/pickle.html)" % (module_name+type_name)).ptr() ); throw_error_already_set(); } object getinitargs = getattr(instance_obj, "__getinitargs__", none); tuple initargs; if (!getinitargs.is_none()) { initargs = tuple(getinitargs()); } result.append(initargs); object getstate = getattr(instance_obj, "__getstate__", none); object instance_dict = getattr(instance_obj, "__dict__", none); long len_instance_dict = 0; if (!instance_dict.is_none()) { len_instance_dict = len(instance_dict); } if (!getstate.is_none()) { if (len_instance_dict > 0) { object getstate_manages_dict = getattr( instance_obj, "__getstate_manages_dict__", none); if (getstate_manages_dict.is_none()) { PyErr_SetString(PyExc_RuntimeError, "Incomplete pickle support" " (__getstate_manages_dict__ not set)"); throw_error_already_set(); } } result.append(getstate()); } else if (len_instance_dict > 0) { result.append(instance_dict); } return tuple(result); }
false
false
false
false
false
0
spool_berkeleydb_check_reopen_database(lList **answer_list, bdb_info info) { bool ret = true; DB_ENV *env; DENTER(BDB_LAYER, "spool_berkeleydb_check_reopen_database"); env = bdb_get_env(info); /* * if environment is not set, it was either * - closed due to an error condition * - never open for this thread * try to open it. */ if (env == NULL) { ret = spool_berkeleydb_create_environment(answer_list, info); if (ret) { ret = spool_berkeleydb_open_database(answer_list, info, false); } } DEXIT; return ret; }
false
false
false
false
false
0
get_device(int number, char *device, int device_len) { FILE *proc_file; char *current_device; char *lineptr = NULL; char *saveptr = NULL; size_t bufflen; int i, count, counter; int return_value = 0; proc_file = fopen("/proc/sys/dev/cdrom/info", "r"); if (proc_file != NULL) { /* skip to line containing device names */ do { if (getline(&lineptr, &bufflen, proc_file) < 0) { return 0; } } while (strstr(lineptr, "drive name:") == NULL); /* count number of devices = number of tabs - 1*/ count = -1; for (i = 0; i < strlen(lineptr); i++) { if (lineptr[i] == '\t') count++; } /* go through devices, they are in reverse order */ current_device = strtok_r(lineptr, "\t", &saveptr); /* skip column title */ current_device = strtok_r(NULL, "\t", &saveptr); counter = count; while (current_device != NULL && counter >= number) { if (counter == number) { snprintf(device, device_len, "/dev/%s", current_device); return_value = 1; } /* go to next in list */ current_device = strtok_r(NULL, "\t", &saveptr); counter--; } /* trim the trailing \n for the last entry = first device */ if (default_device[strlen(default_device)-1] == '\n') { default_device[strlen(default_device)-1] = '\0'; } free(lineptr); fclose(proc_file); } return return_value; }
false
false
true
false
true
1
ves_icall_System_Buffer_SetByteInternal (MonoArray *array, gint32 idx, gint8 value) { MONO_ARCH_SAVE_REGS; mono_array_set (array, gint8, idx, value); }
false
false
false
false
false
0
EnsureConstructor(i::Handle<i::ObjectTemplateInfo> templ) { if (templ->constructor()->IsUndefined()) { Local<FunctionTemplate> constructor = FunctionTemplate::New(); Utils::OpenHandle(*constructor)->set_instance_template(*templ); templ->set_constructor(*Utils::OpenHandle(*constructor)); } return i::Handle<i::FunctionTemplateInfo>( i::FunctionTemplateInfo::cast(templ->constructor())); }
false
false
false
false
false
0
EmitEOL() { // If we don't have any comments, just emit a \n. if (!IsVerboseAsm) { OS << '\n'; return; } EmitCommentsAndEOL(); }
false
false
false
false
false
0
xgbe_acpi_support(struct xgbe_prv_data *pdata) { struct device *dev = pdata->dev; u32 property; int ret; /* Obtain the system clock setting */ ret = device_property_read_u32(dev, XGBE_ACPI_DMA_FREQ, &property); if (ret) { dev_err(dev, "unable to obtain %s property\n", XGBE_ACPI_DMA_FREQ); return ret; } pdata->sysclk_rate = property; /* Obtain the PTP clock setting */ ret = device_property_read_u32(dev, XGBE_ACPI_PTP_FREQ, &property); if (ret) { dev_err(dev, "unable to obtain %s property\n", XGBE_ACPI_PTP_FREQ); return ret; } pdata->ptpclk_rate = property; return 0; }
false
false
false
false
false
0
send_firing_info_packet() { ubyte data[MAX_PACKET_SIZE]; int packet_size; ubyte plinked, sdual; Assert( !(Net_player->flags & NETINFO_FLAG_AM_MASTER) ); BUILD_HEADER(FIRING_INFO); plinked = (ubyte)((Player_ship->flags & SF_PRIMARY_LINKED)?1:0); sdual = (ubyte)((Player_ship->flags & SF_SECONDARY_DUAL_FIRE)?1:0); ADD_DATA( plinked ); ADD_DATA( sdual ); multi_io_send_reliable(Net_player, data, packet_size); }
false
false
false
false
false
0
savelist(bool forsure) { int retval = 0; if (!pointlist.empty()) { string trueFileName; if (!forsure) // backup trueFileName = PtFileName + ".bak"; else trueFileName = PtFileName; ofstream PtFile(trueFileName.c_str()); ///,ios_base::out); // declare and open the file dbgprintf("Saving the point list to %s\n", trueFileName.c_str()); if (PtFile) { retval = outputlist(PtFile); if ((retval == 0) && forsure) { // saving was successful, no need to back up until next // actual change hasChanged = false; } } else { errprintf("Could not open file %s\nfor saving point file: %s\n", trueFileName.c_str(), strerror(errno)); retval = 1; } } else { dbgprintf("Point list is empty\n"); if (forsure) { ofstream PtFile(PtFileName.c_str()); if (PtFile) { PtFile << endl; // empty the file // retval stay at 0, not an error here. } else { errprintf("Could not clearfile %s: %s\n", PtFileName.c_str(), strerror(errno)); retval = 1; } } } // stream gets closed automatically here, if opened. return retval; }
false
false
false
false
false
0
uwb_rsv_handle_timeout_work(struct work_struct *work) { struct uwb_rsv *rsv = container_of(work, struct uwb_rsv, handle_timeout_work); struct uwb_rc *rc = rsv->rc; mutex_lock(&rc->rsvs_mutex); uwb_rsv_dump("TO", rsv); switch (rsv->state) { case UWB_RSV_STATE_O_INITIATED: if (rsv->is_multicast) { uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_ESTABLISHED); goto unlock; } break; case UWB_RSV_STATE_O_MOVE_EXPANDING: if (rsv->is_multicast) { uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_MOVE_COMBINING); goto unlock; } break; case UWB_RSV_STATE_O_MOVE_COMBINING: if (rsv->is_multicast) { uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_MOVE_REDUCING); goto unlock; } break; case UWB_RSV_STATE_O_MOVE_REDUCING: if (rsv->is_multicast) { uwb_rsv_set_state(rsv, UWB_RSV_STATE_O_ESTABLISHED); goto unlock; } break; case UWB_RSV_STATE_O_ESTABLISHED: if (rsv->is_multicast) goto unlock; break; case UWB_RSV_STATE_T_EXPANDING_ACCEPTED: /* * The time out could be for the main or of the * companion DRP, assume it's for the companion and * drop that first. A further time out is required to * drop the main. */ uwb_rsv_set_state(rsv, UWB_RSV_STATE_T_ACCEPTED); uwb_drp_avail_release(rsv->rc, &rsv->mv.companion_mas); goto unlock; case UWB_RSV_STATE_NONE: goto unlock; default: break; } uwb_rsv_remove(rsv); unlock: mutex_unlock(&rc->rsvs_mutex); }
false
false
false
false
false
0
default_series_name(char *template_path) { if(template_path) return string_format("%s.series", template_path); else return string_format(DEFAULT_LOG_NAME ".series", getpid()); }
false
false
false
false
false
0
tdb1_free_region(struct tdb_context *tdb, tdb1_off_t offset, ssize_t length) { struct tdb1_record rec; if (length <= sizeof(rec)) { /* the region is not worth adding */ return 0; } if (length + offset > tdb->file->map_size) { tdb->last_error = tdb_logerr(tdb, TDB_ERR_CORRUPT, TDB_LOG_ERROR, "tdb1_free_region: adding region beyond" " end of file"); return -1; } memset(&rec,'\0',sizeof(rec)); rec.rec_len = length - sizeof(rec); if (tdb1_free(tdb, offset, &rec) == -1) { tdb_logerr(tdb, tdb->last_error, TDB_LOG_ERROR, "tdb1_free_region: failed to add free record"); return -1; } return 0; }
false
false
false
false
false
0
wsm_multi_tx_confirm(struct cw1200_common *priv, struct wsm_buf *buf, int link_id) { int ret; int count; int i; count = WSM_GET32(buf); if (WARN_ON(count <= 0)) return -EINVAL; if (count > 1) { /* We already released one buffer, now for the rest */ ret = wsm_release_tx_buffer(priv, count - 1); if (ret < 0) return ret; else if (ret > 0) cw1200_bh_wakeup(priv); } cw1200_debug_txed_multi(priv, count); for (i = 0; i < count; ++i) { ret = wsm_tx_confirm(priv, buf, link_id); if (ret) return ret; } return ret; underflow: WARN_ON(1); return -EINVAL; }
false
false
false
false
false
0
addrcache_next_cache_id() { int retVal; if( _nextCacheID__ == 0 ) { _nextCacheID__ = 1; } retVal = _nextCacheID__; ++_nextCacheID__; return retVal; }
false
false
false
false
false
0
real_setmiss (double missval, int varno, DATASET *dset) { int i, t, count = 0; int start = 1, end = dset->v; if (varno) { start = varno; end = varno + 1; } for (i=start; i<end; i++) { for (t=0; t<dset->n; t++) { if (dset->Z[i][t] == missval) { dset->Z[i][t] = NADBL; count++; } } } return count; }
false
false
false
false
false
0
clear() { DictionaryEntry *de; ListIterator iterator(*this); while ((de=(DictionaryEntry*)iterator.getNext())) delete de; this->List::clear(); // FIXME: should be clear the local symbol table. }
false
false
false
false
false
0
OpUnmap() { pmd_unmap_it in ; pmd_unmap_ot out ; if (!readn(newsock, (char *)&in, sizeof( pmd_unmap_it))) return ; /* read input for operation */ if (ntohl(in.pid) > 0) /* remove all entries for pid */ out.count = unmapPid(ntohl(in.pid)) ; else /* remove entry for mapid */ out.count = unmapMapid(in.mapid, ntohs(in.protocol)) ; if (out.count > 0) { out.status = htons(SUCCESS) ; out.error = htons(PMD_ER_NOERROR) ; } else { out.status = htons(FAILURE) ; out.error = htons(PMD_ER_NOENTRY) ; } /* return the # of entries unmapped */ out.count = htons(out.count) ; writen(newsock, (char *)&out, sizeof(pmd_unmap_ot)) ; }
false
false
false
false
false
0
bq2415x_i2c_read_mask(struct bq2415x_device *bq, u8 reg, u8 mask, u8 shift) { int ret; if (shift > 8) return -EINVAL; ret = bq2415x_i2c_read(bq, reg); if (ret < 0) return ret; return (ret & mask) >> shift; }
false
false
false
false
false
0